EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FwdTrackFinder.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file FwdTrackFinder.h
1 
2 #include <map>
3 
4 #include <TVector3.h>
5 #include <TH1D.h>
6 
7 #include <FairTask.h>
8 
9 #include <EicBoxGenerator.h>
10 #include <EicHtcTask.h>
11 //#include <KalmanFilter.h>
12 #include <EicGeoParData.h>
13 #include <FwdHoughTree.h>
14 //#include <FwdKalmanFilter.h>
15 
16 #ifndef _FWD_TRACK_FINDER_
17 #define _FWD_TRACK_FINDER_
18 
20 {
21  public:
23  ResolutionLevelPattern(const unsigned div[], unsigned dim, unsigned count):
24  mDim(dim), mCount(count) {
25  mDiv = new unsigned[dim];
26 
27  for(unsigned iq=0; iq<dim; iq++)
28  mDiv[iq] = div[iq];
29  };
30  ~ResolutionLevelPattern() { if (mDiv) delete [] mDiv; }
31 
32  unsigned GetRepetitionCount() const { return mCount; };
33  const unsigned *GetDivPtr() const { return mDiv; };
34 
35  private:
36  unsigned mDim;
37  unsigned *mDiv; // [mDim]
38  unsigned mCount;
39 
41 };
42 
44 {
45  public:
46  PhaseSpaceVariable(): mGra(0.0), mMin(0.0), mMax(0.0) {};
47  PhaseSpaceVariable(double min, double max, double gra):
48  mGra(gra), mMin(min), mMax(max) {};
50 
51  double GetRange() const { return mMax - mMin; };
52  double GetMin() const { return mMin; };
53  double GetMax() const { return mMax; };
54  double GetGra() const { return mGra; };
55 
56  private:
57  double mMin, mMax, mGra;
58 
59  ClassDef(PhaseSpaceVariable,1)
60 };
61 
62 //#define _DEFAULT_EXTRA_GRANULARITY_FACTOR_ (20./6.)
63 #define _DEFAULT_EXTRA_GRANULARITY_FACTOR_ (2.0)
64 
65 // Assume 3 sigma is fine in both gaussian and digital case;
66 #define _DEFAULT_RELATIVE_HIT_SMEARING_ (3.0)
67 
69 {
70  //FwdTrackFinderEicHtcTask(): FairTask("EIC HTC Task") { ResetVars(); };
71  //EicHtcTask(EicIdealTrackingCode *ideal, MfieldMode fieldMode = WithField);
72  public:
75  EicHtcTask(ideal, fieldMode),
76  //mGptr(0), mHits(0), mSmearing(0),
80  //mMinOkHitCounter(0), mMaxOkHitCounter(0),
87  // Allocate Hough transform class instance;
88  mFwdHoughTree = new FwdHoughTree(this);
89 
90  mTracks = new TClonesArray("FwdMatchCandidate"); assert(mTracks);
91 
94 
96 
97  ccdf = new TH1D("ccdf", "ccdf", 100, 0.0, 1.0);
98  };
100 
101  void ResetVtxNode(MatchCandidate *match);
102  void UpdateVtxNode();
103 
104  InitStatus Init();
105  void Exec(Option_t* opt);
106  void FinishTask();
107  // FIXME: a temporary hack;
108  TH1D *ccdf;
109 
110  int DefinePhiRange(double min, double max, double gra);
111  // It turns out, that defining p-range in momentum itself is more confusing
112  // (because +/- signs need to be accounted and also min.granularity should
113  // be given in inversed momentum anyway);
114  int DefineInversedMomentumRange(double min, double max, double gra);
115  int DefineInversedPtRange(double min, double max, double gra);
116  int DefineThetaRange(double min, double max, double gra);
117 
118  // These methods can be propagated to HoughTree right from the reconstruction.C;
119  void SetVerbosityLevel(unsigned level) { mFwdHoughTree->SetVerbosityLevel(level); };
120  int AddDimension(const char *name, double min, double max) {
121  return mFwdHoughTree->AddDimension(name, min, max);
122  };
123  void SetFastTreeSearchMode(unsigned qualityItrNum) {
124  mFwdHoughTree->SetFastTreeSearchMode(qualityItrNum);
125  };
126  //void ResolveAmbiguityViaWorstHit() { mFwdHoughTree->ResolveAmbiguityViaWorstHit(); };
127 
128  // Well, not all of the operations with mFwdHoughTree pointer are allowed
129  // from reconstruction.C script (say AddResolutionLevel() makes sense
130  // only after plane structure is defined); therefore prefer to formulate
131  // "requests" in reconstruction.C, store data in intermediate variables
132  // and defer actual calls to HoughTree configuration methods until Init()
133  // call happens;
134  void AddResolutionLevel(const unsigned div[], unsigned count) {
136  count));
137  //return 0;
138  };
139 
141 
142  void SetRelativeHitSmearing(double smearing) { mRelativeHitSmearing = smearing; };
143  void SetAbsoluteSpatialSmearing(double smearing) { mAbsoluteSpatialSmearing = smearing; };
145 
147 
150  };
153  };
154  void SetBlindCellDecisionLevel(unsigned level) {
155  mBlindCellDecisionLevel = level;
156  };
157 
159 
160  TrKalmanNode *GetVtxNode() const { return mVtxKfNode; };
162 
163  bool WithMagneticField() const { return GetKalmanFilter()->GetFieldMode() == WithField; };
164 
167 
171  };
175  };
176  void SetExtraNdfCount(int count) { GetKalmanFilter()->SetExtraNdfCount(count); };
178 
179  unsigned GetMissingHitCounterMax() const { return mMissingHitCounterMax; };
180 
183 
184  int GetThetaId() const { return mThetaId; };
185  int GetPhiId() const { return mPhiId; };
186  int GetInvMomentumId() const { return mInvMomentumId; };
187  int GetInvPtId() const { return mInvPtId; };
188  // NB: can still return -1, fine;
189  int GetMomentumRelatedId() const { return (mInvPtId != -1 ? mInvPtId : mInvMomentumId); };
190 
191  int ConfigureResolutionLevels(unsigned id/*const PhaseSpaceVariable *psvar*/);
192 
193  private:
194  // If looks like there is no need to save anything?; FIXME: actually may want
195  // to record FwdTrackFinder class;
197 
199 
201 
203 
205 
206  // Want to help MappingCall() not to be dependent on the order of
207  // Define*Range() calls;
209  std::vector<PhaseSpaceVariable> mPhaseSpaceVariables;
211 
212  std::vector<ResolutionLevelPattern*> mResolutionLevelPatterns;
213 
214  // See HoughTree class description; same quantities, booked from
215  // reconstruction.C script for defered application in HoughTree::Init() calls;
217  //unsigned mMinOkHitCounter, mMaxOkHitCounter;
220 
222 
223  TClonesArray *mTracks;
224 
225  // Smear hit range by +/- that many *sigma* (defined by respective digi template);
227  // Smear cell range by some number matching this value in [cm]; in case of
228  // XY- and R-measurements this will be just divided by spatial granularity when
229  // given to the ngroup->OffsetThisValue() call in HoughTree::CheckCell(); in case
230  // of A-measurements respective smearing will be guessed based on min.radius;
232 
234 
236 };
237 
238 #endif