1 #ifndef AliToyMCReconstruction_H
2 #define AliToyMCReconstruction_H
6 #include <TClonesArray.h>
8 #include <TVectorFfwd.h>
13 class TTreeSRedirector;
14 class AliExternalTrackParam;
15 class AliTPCtrackerSector;
17 class AliTPCCorrection;
19 class AliTPCtrackerRow;
21 class AliTPCclusterMI;
26 class AliToyMCReconstruction : public TObject {
28 AliToyMCReconstruction();
29 virtual ~AliToyMCReconstruction();
36 kPreliminaryEta // NOT TO USE (needs fixing!!! Not yet in full code!!!)
55 kFillNoTrackInfo= 0x80
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);
62 void RunFullTracking(const char* file, Int_t nmaxEv=-1);
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; }
68 void SetClusterType(Int_t type) { fClusterType = type; }
69 Int_t GetClusterType() const { return fClusterType; }
71 void SetSeedingRow(Int_t row) { fSeedingRow = row; }
72 Int_t GetSeedingRow() const { return fSeedingRow; }
74 void SetSeedingDist(Int_t dist) { fSeedingDist = dist; }
75 Int_t GetSeedingDist() const { return fSeedingDist; }
77 void SetCorrType(ECorrType type) { fCorrectionType = type; }
78 ECorrType GetCorrectionType() const { return fCorrectionType; }
80 void SetUseMaterialBudget(Bool_t mat) { fUseMaterial = mat; }
81 Bool_t GetUseMaterialBudget() const { return fUseMaterial; }
83 void SetIdealTracking(Bool_t tr) { fIdealTracking = tr; }
84 Bool_t GetIdealTracking() const { return fIdealTracking; }
86 void SetFillClusterRes(Bool_t res) { fFillClusterRes=res; }
87 Bool_t GetFillClusterRes() const { return fFillClusterRes; }
89 void SetUseT0list(Bool_t use) { fUseT0list=use; }
90 Bool_t GetUseT0list() const { return fUseT0list; }
92 void SetUseZ0list(Bool_t use) { fUseZ0list=use; }
93 Bool_t GetUseZ0list() const { return fUseZ0list; }
95 void SetForceAlpha(Bool_t use) { fForceAlpha=use; }
96 Bool_t GetForceAlpha() const { return fForceAlpha; }
98 void SetRecoInfo(Long64_t val) { fRecoInfo = val; }
99 Long64_t GetRecoInfo() const { return fRecoInfo; }
101 void SetTree(TTree *tree) { fTree=tree; }
102 TTree* GetTree() const { return fTree; }
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);
110 AliToyMCTrack *ConvertTPCSeedToToyMCTrack(const AliTPCseed &seed);
111 AliExternalTrackParam* GetRefittedTrack(const AliTPCseed &seed);
113 AliTPCclusterMI* FindMiddleCluster(const AliTPCclusterMI *clInner, const AliTPCclusterMI *clOuter,
114 Double_t roady, Double_t roadz,
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);
124 void SetRieman(const AliTPCseed &seed, AliRieman &rieman);
125 void CopyRieman(const AliRieman &from, AliRieman &to);
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);
131 void InitSpaceCharge();
133 void SetLongT0seed(Bool_t l) { fLongT0seed=l; }
134 Bool_t GetLongT0seed() const { return fLongT0seed; }
136 static TTree* ConnectTrees(const char* files);
138 Double_t GetVDrift() const;
139 Double_t GetZLength(Int_t roc) const;
141 void InitStreamer(TString addName, Int_t level=1);
143 void ConnectInputFile(const char* file, Int_t nmaxEv=-1);
146 void DumpTracksToTree(const char* file);
149 AliToyMCReconstruction(const AliToyMCReconstruction &rec);
150 AliToyMCReconstruction& operator= (AliToyMCReconstruction& rec);
152 void SetTrackPointFromCluster(const AliTPCclusterMI *cl, AliTrackPoint &p);
153 void ClusterToSpacePoint(const AliTPCclusterMI *cl, Float_t xyz[3]);
155 Int_t LoadInnerSectors();
156 Int_t LoadOuterSectors();
158 Int_t GetSector(AliExternalTrackParam *track);
159 void FillSectorStructure(Int_t maxev);
160 void FillSectorStructureAC();
162 void SetupTrackMaps();
164 void CookLabel(AliTPCseed *seed, Double_t fraction, Int_t info[5]=0);
166 void DumpSeedInfo(TObjArray *arr);
167 void DumpTrackInfo(TObjArray *arr);
168 void DumpSeedInfo(const AliToyMCTrack *toyTrack, AliTPCseed *seed);
171 void MarkClustersUsed(AliTPCseed *seed);
172 void ResetClustersZtoTime(AliTPCseed *seed);
174 Float_t FindClosestT0(const TVectorF &t0list, const TVectorF &z0list, AliExternalTrackParam &t0seed);
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
185 Int_t fNmaxEvents; // maximum number of events
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
197 TTreeSRedirector *fStreamer; // debug streamer
198 TFile *fInputFile; // input file
199 TTree *fTree; // input tree with ToyMC info
200 AliToyMCEvent *fEvent; // input event
202 AliTPCParam *fTPCParam; // tpc reco parameters
203 AliTPCCorrection *fTPCCorrection; // space charge
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
210 TClonesArray fAllClusters; //Array keeping all clusters for free seeding
212 TExMap fMapTrackEvent; // map global track number -> event number
213 TExMap fMapTrackTrackInEvent; // map global track number -> track in event
215 THn *fHnDelta; // histogram with residuals
217 Bool_t fIsAC; // if we are tracking with sector arrays running from 0-36 rather than 0-18
219 ClassDef(AliToyMCReconstruction,0)