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