]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/TPCupgrade/AliToyMCReconstruction.h
Fixed ClassDef() accidentally removed
[u/mrichter/AliRoot.git] / TPC / TPCupgrade / AliToyMCReconstruction.h
1 #ifndef AliToyMCReconstruction_H
2 #define AliToyMCReconstruction_H
3
4 #include <TString.h>
5 #include <TObject.h>
6 #include <TClonesArray.h>
7 #include <TExMap.h>
8 #include <TVectorFfwd.h>
9 #include <THn.h>
10
11 class TTree;
12
13 class TTreeSRedirector;
14 class AliExternalTrackParam;
15 class AliTPCtrackerSector;
16 class AliToyMCEvent;
17 class AliTPCCorrection;
18 class AliTPCseed;
19 class AliTPCtrackerRow;
20 class AliToyMCTrack;
21 class AliTPCclusterMI;
22 class AliRieman;
23 class AliTrackPoint;
24 class AliTPCParam;
25
26 class AliToyMCReconstruction : public TObject {
27 public:
28   AliToyMCReconstruction();
29   virtual ~AliToyMCReconstruction();
30   
31   enum ECorrType {
32     kNoCorrection = 0,
33     kTPCCenter,
34     kAverageEta,
35     kIdeal,
36     kPreliminaryEta // NOT TO USE (needs fixing!!! Not yet in full code!!!)
37   };
38
39   enum EDet {
40     kITS=0,
41     kTPC,
42     kTRD
43   };
44
45   enum ERecoFill {
46     kFillSeed = 0x01,
47     kFillOrig = 0x02,
48     kFillTrack= 0x04,
49     
50     kFillITS  = 0x08,
51     kFillITS1 = 0x10,
52     kFillITS2 = 0x20,
53
54     kFillDeltas = 0x40,
55     kFillNoTrackInfo= 0x80
56   };
57   
58   void RunReco(const char* file, Int_t nmaxEv=-1);
59   void RunRecoAllClusters(const char* file, Int_t nmaxEv=-1);
60   void RunRecoAllClustersStandardTracking(const char* file, Int_t nmaxEv=-1);
61
62   void RunFullTracking(const char* file, Int_t nmaxEv=-1);
63   
64   // reconstruction settings
65   void      SetRecoSettings(Bool_t idealTracking, Int_t clusterType, ECorrType correctionType, Int_t seedingRow=130, Int_t seedingDist=10)
66                            { fIdealTracking=idealTracking; fClusterType=clusterType; fSeedingRow=seedingRow, fSeedingDist=seedingDist, fCorrectionType=correctionType; }
67   
68   void      SetClusterType(Int_t type)  { fClusterType = type;    }
69   Int_t     GetClusterType()  const     { return fClusterType;    }
70   
71   void      SetSeedingRow(Int_t row)    { fSeedingRow = row;      }
72   Int_t     GetSeedingRow()  const      { return fSeedingRow;     }
73   
74   void      SetSeedingDist(Int_t dist)  { fSeedingDist = dist;    }
75   Int_t     GetSeedingDist()  const     { return fSeedingDist;    }
76   
77   void      SetCorrType(ECorrType type) { fCorrectionType = type; }
78   ECorrType GetCorrectionType() const   { return fCorrectionType; }
79
80   void   SetUseMaterialBudget(Bool_t mat) { fUseMaterial = mat;   }
81   Bool_t GetUseMaterialBudget() const   { return fUseMaterial;    }
82
83   void   SetIdealTracking(Bool_t tr)    { fIdealTracking = tr;    }
84   Bool_t GetIdealTracking()  const      { return fIdealTracking;  }
85
86   void   SetFillClusterRes(Bool_t res)  { fFillClusterRes=res;    }
87   Bool_t GetFillClusterRes()  const     { return fFillClusterRes; }
88
89   void   SetUseT0list(Bool_t use)       { fUseT0list=use;    }
90   Bool_t GetUseT0list()  const          { return fUseT0list; }
91   
92   void   SetUseZ0list(Bool_t use)       { fUseZ0list=use;    }
93   Bool_t GetUseZ0list()  const          { return fUseZ0list; }
94   
95   void   SetForceAlpha(Bool_t use)       { fForceAlpha=use;    }
96   Bool_t GetForceAlpha()  const          { return fForceAlpha; }
97
98   void SetRecoInfo(Long64_t val) { fRecoInfo = val; }
99   Long64_t GetRecoInfo() const { return fRecoInfo; }
100   
101   void   SetTree(TTree *tree) { fTree=tree; }
102   TTree* GetTree() const { return fTree; }
103
104   AliExternalTrackParam* GetSeedFromTrack(const AliToyMCTrack * const tr, Bool_t forceSeed=kFALSE);
105   AliExternalTrackParam* GetSeedFromTrackIdeal(const AliToyMCTrack * const tr, EDet det );
106   AliExternalTrackParam* GetFittedTrackFromSeed(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, TClonesArray *arrClustRes=0x0);
107   AliExternalTrackParam* GetFittedTrackFromSeedAllClusters(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, Int_t &nClus);
108   AliExternalTrackParam* GetTrackRefit(const AliToyMCTrack * const tr, EDet det);
109
110   AliToyMCTrack *ConvertTPCSeedToToyMCTrack(const AliTPCseed &seed);
111   AliExternalTrackParam* GetRefittedTrack(const AliTPCseed &seed);
112   
113   AliTPCclusterMI* FindMiddleCluster(const AliTPCclusterMI *clInner, const AliTPCclusterMI *clOuter,
114                                      Double_t roady, Double_t roadz,
115                                      AliRieman &seedFit);
116
117   void AddMiddleClusters(AliTPCseed *seed,
118                          const AliTPCclusterMI *clInner, const AliTPCclusterMI *clOuter,
119                          Double_t roady, Double_t roadz,
120                          Int_t &nTotalClusters, AliRieman &seedFit);
121   Int_t MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2);
122   void MakeSeeds(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2);
123
124   void SetRieman(const AliTPCseed &seed, AliRieman &rieman);
125   void CopyRieman(const AliRieman &from, AliRieman &to);
126   
127   AliExternalTrackParam* ClusterToTrackAssociation(const AliTPCseed *seed, Int_t trackID, Int_t &nClus);
128   void ClusterToTrackAssociation(AliTPCseed &seed);
129   void AssociateClusters(AliTPCseed &seed, Int_t firstRow, Int_t lastRow, Bool_t direction);
130   
131   void InitSpaceCharge();
132
133   void SetLongT0seed(Bool_t l) { fLongT0seed=l; }
134   Bool_t GetLongT0seed() const { return fLongT0seed; }
135   
136   static TTree* ConnectTrees(const char* files);
137   
138   Double_t GetVDrift() const;
139   Double_t GetZLength(Int_t roc) const;
140
141   void InitStreamer(TString addName, Int_t level=1);
142
143   void ConnectInputFile(const char* file, Int_t nmaxEv=-1);
144   void Cleanup();
145
146   void DumpTracksToTree(const char* file);
147   
148  private:
149   AliToyMCReconstruction(const AliToyMCReconstruction &rec);
150   AliToyMCReconstruction& operator= (AliToyMCReconstruction& rec);
151
152   void SetTrackPointFromCluster(const AliTPCclusterMI *cl, AliTrackPoint &p);
153   void ClusterToSpacePoint(const AliTPCclusterMI *cl, Float_t xyz[3]);
154
155   Int_t LoadInnerSectors();
156   Int_t LoadOuterSectors();
157   
158   Int_t GetSector(AliExternalTrackParam *track);
159   void FillSectorStructure(Int_t maxev);
160   void FillSectorStructureAC();
161
162   void SetupTrackMaps();
163
164   void CookLabel(AliTPCseed *seed, Double_t fraction, Int_t info[5]=0);
165
166   void DumpSeedInfo(TObjArray *arr);
167   void DumpTrackInfo(TObjArray *arr);
168   void DumpSeedInfo(const AliToyMCTrack *toyTrack, AliTPCseed *seed);
169   
170
171   void MarkClustersUsed(AliTPCseed *seed);
172   void ResetClustersZtoTime(AliTPCseed *seed);
173
174   Float_t FindClosestT0(const TVectorF &t0list, const TVectorF &z0list, AliExternalTrackParam &t0seed);
175   
176   // reco settings
177   Int_t  fSeedingRow;            // first row used for seeding
178   Int_t  fSeedingDist;           // distance of seeds
179   Int_t  fClusterType;           // cluster type to use
180   ECorrType fCorrectionType;     // type of space point correction
181   Bool_t fDoTrackFit;            // do track fitting
182   Bool_t fUseMaterial;           // use material budget in tracking
183   Bool_t fIdealTracking;         // use ideal coordinates for tracking
184
185   Int_t  fNmaxEvents;            // maximum number of events
186
187   // current reconstruction info
188   Double_t fTime0;               // current time0 used for reconstruction
189   Bool_t   fCreateT0seed;        // if current seed is the T0 seed
190   Bool_t   fLongT0seed;          // if we should use a t0 seed including all clusters in the seed range
191   Bool_t   fFillClusterRes;      // fill cluster residuals?
192   Bool_t   fUseT0list;           // if the list of T0 information should be used to guess the T0
193   Bool_t   fUseZ0list;           // if the list of Z vertex information should be used to guess the T0
194   Bool_t   fForceAlpha;          // force the correct alpha for the t0 seed extrapolation
195   Long64_t fRecoInfo;            // what information to fill in the output trees
196   
197   TTreeSRedirector *fStreamer;   // debug streamer
198   TFile *fInputFile;             // input file
199   TTree *fTree;                  // input tree with ToyMC info
200   AliToyMCEvent *fEvent;         // input event
201
202   AliTPCParam *fTPCParam;            // tpc reco parameters
203   AliTPCCorrection *fTPCCorrection; // space charge
204
205   const Int_t fkNSectorInner;        //number of inner sectors
206   AliTPCtrackerSector *fInnerSectorArray;  //array of inner sectors
207   const Int_t fkNSectorOuter;        //number of outer sectors
208   AliTPCtrackerSector *fOuterSectorArray;  //array of outer sectors
209
210   TClonesArray fAllClusters;     //Array keeping all clusters for free seeding
211
212   TExMap fMapTrackEvent;          // map global track number -> event number
213   TExMap fMapTrackTrackInEvent;   // map global track number -> track in event
214
215   THn    *fHnDelta;               // histogram with residuals
216
217   Bool_t fIsAC;                     // if we are tracking with sector arrays running from 0-36 rather than 0-18
218    
219   ClassDef(AliToyMCReconstruction,0)
220 };
221
222
223 #endif