FairRoot/PandaRoot
PndRiemannTrackFinder.h
Go to the documentation of this file.
1 #ifndef PNDRIEMANNTRACKFINDER_H_
2 #define PNDRIEMANNTRACKFINDER_H_
3 
4 #include "PndRiemannTrack.h"
5 #include "PndRiemannHit.h"
6 #include "FairHit.h"
7 #include "PndSdsHit.h"
8 #include "TClonesArray.h"
9 #include "PndTrackCand.h"
10 #include "TH2F.h"
11 
12 #include <vector>
13 #include <map>
14 
16 {
17 public:
19  virtual ~PndRiemannTrackFinder();
20 
21  void FindTracks();
22  void MergeTracks();
23  void SetHits(std::vector<FairHit*> hits){fHits = hits;};
24  void AddHits(std::vector<FairHit*> hits, Int_t branchId);
25  void AddHits(TClonesArray* hits, Int_t branchId);
26  void AddHit(FairHit* hit){fHits.push_back(hit);};
27  void SetVerbose (int val){fVerbose = val;}
28  int NTracks(){return fTrackCand.size();};
29  PndRiemannTrack GetTrack(int i){return fTracks[i];};
30  PndTrack GetPndTrack(int i, double B){return fTracks[i].getPndTrack(B);};
31  std::set<Int_t> GetTrackCandidates(int i){return fHitsInTracks[i];};
32  std::vector<PndTrackCand> GetTrackCand(){return fTrackCand;}
33  std::vector<PndTrackCand> GetMergedTrackCands(){return fMergedTrackCand;}
35  double HitDistance(FairHit* h1, FairHit* h2);
36  int HitTooClose(std::set<Int_t> hitsInUse, FairHit* newHit, double threshold);
37 
39  void SetMaxSZDist(double val){fMaxSZDist = val;}
40  void SetMaxSZChi2(double val){fMaxSZChi2 = val;}
44  void SetCurvDiff(double val){fCurvDiff = val;}
45  void SetDipDiff(double val){fDipDiff = val;}
46 
47 protected:
48  std::vector<FairHit*> fHits;
49  std::vector<PndRiemannTrack> fTracks;
50  std::vector<std::set<Int_t> > fHitsInTracks;
51  std::vector<PndTrackCand> fTrackCand;
52  std::vector< std::pair<double,double> > fCurvAndDipOfCand;
53  std::vector<PndTrackCand> fMergedTrackCand;
54  std::vector< std::set<int> > fHitsTooClose;
55  std::map<int, FairLink > fMapHitToID;
56  std::map<FairLink, int > fMapIDtoHit;
57  double fMaxPlaneDist;
58  double fMaxSZDist;
59  double fMinPointDist;
60  double fMaxSZChi2;
62  double fCurvDiff;
63  double fDipDiff;
64  double fMagField;
65 
66  int fVerbose;
68 
69  std::vector<std::set<Int_t> > GetStartTracks();
70  bool CheckHitDistance(int hit1, int hit2);
71  bool CheckSZ(PndRiemannTrack aTrack);
73  bool CheckHitInSameSensor(int hit1, int hit2);
74  bool CheckHitInTrack(std::set<int> hitIds, int hit);
75  bool CheckZeroPassing(std::set<int> hitIds, int hit);
76  PndRiemannTrack CreateRiemannTrack(std::set<Int_t> aHits);
77 
78  bool TrackExists(std::set<Int_t> hitsInTrack);
79  std::vector<int> FindTracksWithSimilarParameters(int TrackInd, std::vector<int>& TracksToTest, double curvDiff, double dipDiff);
80  std::vector<int> FindTracksWithSimilarHits(std::vector<int>& TracksToTest,std::vector<PndTrackCand> tempTrCnd, std::vector<int>& tempKillAfter);
81  void RemoveTrack(int TrackInd, std::vector<int>& TrackList);
82 // void PrintTrackCand(PndTrackCand* cand);
83  PndTrackCand CreateOneTrackCand(std::vector<int> tracks,std::vector<PndTrackCand> tempTrCnd);
84  // Fast method to figure out if a combination of hits is already used as a track
85  //Problem: It does not work for more than 32 hits
86 // std::vector<Int_t> fHitsInTracks; ///< one int stands for the hits used in one track. The hits are encoded as bits in an int32
87 
88  //Solution: use a vector<vector <Int_t> > fHitsInTracks instead. This is not so fast but works for more than 32 hits
89 
90 // void SetHitInTrack(Int_t position, Int_t& value);
91 // std::vector<int> GetHitsInTrack(Int_t value);
92 // bool TrackExists(Int_t hitsInTrack);
93 
94 
95 // std::vector<int> GetHitsInTrack(Int_t value);
96 
97 
98 public:
99  ClassDef(PndRiemannTrackFinder,2)
100 };
101 
102 #endif /*PNDRIEMANNTRACKFINDER_H_*/
void SetHits(std::vector< FairHit * > hits)
std::vector< std::set< int > > fHitsTooClose
matrix of TrackNr and hits which are too close to one of the three starting points ...
std::vector< std::pair< double, double > > fCurvAndDipOfCand
Curvature and dip of fPndTrackCand.
bool CheckSZ(PndRiemannTrack aTrack)
Tests the results of the sz fit.
int HitTooClose(std::set< Int_t > hitsInUse, FairHit *newHit, double threshold)
returns if and which hit was too close to the hit which is tested
void SetVerbose(int val)
Adds one new hit to the array of hits.
Int_t i
Definition: run_full.C:25
double fMaxSZChi2
Maximum allowed Chi2 in an sz fit.
std::vector< PndRiemannTrack > fTracks
Resulting Riemann Tracks.
bool TrackExists(std::set< Int_t > hitsInTrack)
void FindTracks()
Main function to start the riemann track finding.
PndRiemannTrack track
Definition: RiemannTest.C:33
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
std::map< int, FairLink > fMapHitToID
map to convert the list of hits back into a FairLink
std::vector< int > FindTracksWithSimilarParameters(int TrackInd, std::vector< int > &TracksToTest, double curvDiff, double dipDiff)
std::map< FairLink, int > fMapIDtoHit
map to convert the list of detID/hitID hits into the list of hits for track finding ...
PndTrackCand CreateOneTrackCand(std::vector< int > tracks, std::vector< PndTrackCand > tempTrCnd)
void RemoveTrack(int TrackInd, std::vector< int > &TrackList)
std::vector< FairHit * > fHits
Vector of all FairHits used for track finding (fitting)
int fMinNumberOfHits
Minimum number of hits in track necessary for a match.
std::vector< PndTrackCand > fTrackCand
List of track candidates.
void AddHits(std::vector< FairHit * > hits, Int_t branchId)
Replaces the existing array of hits with a new one.
std::vector< PndTrackCand > fMergedTrackCand
double fMagField
size of the magnetic field in Tesla
std::vector< PndTrackCand > GetTrackCand()
Returns the hits belonging to track i.
double fDipDiff
TrackMerger parameter.
void AddHit(FairHit *hit)
std::vector< PndTrackCand > GetMergedTrackCands()
std::vector< std::set< Int_t > > GetStartTracks()
double fMaxPlaneDist
Distance cut between new point and riemann plane.
void SetMaxSZDist(double val)
double HitDistance(FairHit *h1, FairHit *h2)
Calculates the distance between two hits.
bool CheckHitInSameSensor(int hit1, int hit2)
Tests if hits in the same sensor are selected.
bool CheckHitDistance(int hit1, int hit2)
Tests if the distance is larger than fMinPointDistance.
double threshold
void SetMinPointDist(double val)
void SetCurvDiff(double val)
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
Definition: hit.C:1
double fMinPointDist
Minimum distance between two points to use them as point for the base plane.
PndRiemannTrack CreateRiemannTrack(std::set< Int_t > aHits)
Creates a PndRiemannTrack from an array of indices of Hits.
PndRiemannTrack GetTrack(int i)
Returns the number of found tracks.
void SetMaxPlaneDistance(double val)
bool CheckZeroPassing(std::set< int > hitIds, int hit)
If the track contains (0,0) all points have to go forward or all have to go backward.
CbmHit * hits[nHits]
Definition: RiemannTest.C:19
double fCurvDiff
TrackMerger parameter.
std::vector< std::set< Int_t > > fHitsInTracks
Vector of indizes which hits where used in which track.
bool CheckRiemannHit(PndRiemannTrack *track, PndRiemannHit *hit)
void SetMaxSZChi2(double val)
std::vector< int > FindTracksWithSimilarHits(std::vector< int > &TracksToTest, std::vector< PndTrackCand > tempTrCnd, std::vector< int > &tempKillAfter)
---------—added by me
std::set< Int_t > GetTrackCandidates(int i)
double fMaxSZDist
Distance cut between s-z coordinate of a new point and the sz-fit of the hits in the track...
bool CheckHitInTrack(std::set< int > hitIds, int hit)
Check if this HitId is used in the track already.
PndTrack GetPndTrack(int i, double B)
Returns the track with the index i.
PndTrackCand GetTrackCand(int i)