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 void RunReco(const char* file, Int_t nmaxEv=-1);
56 void RunRecoAllClusters(const char* file, Int_t nmaxEv=-1);
57 void RunRecoAllClustersStandardTracking(const char* file, Int_t nmaxEv=-1);
59 void RunFullTracking(const char* file, Int_t nmaxEv=-1);
61 // reconstruction settings
62 void SetRecoSettings(Bool_t idealTracking, Int_t clusterType, ECorrType correctionType, Int_t seedingRow=130, Int_t seedingDist=10)
63 { fIdealTracking=idealTracking; fClusterType=clusterType; fSeedingRow=seedingRow, fSeedingDist=seedingDist, fCorrectionType=correctionType; }
65 void SetClusterType(Int_t type) { fClusterType = type; }
66 Int_t GetClusterType() const { return fClusterType; }
68 void SetSeedingRow(Int_t row) { fSeedingRow = row; }
69 Int_t GetSeedingRow() const { return fSeedingRow; }
71 void SetSeedingDist(Int_t dist) { fSeedingDist = dist; }
72 Int_t GetSeedingDist() const { return fSeedingDist; }
74 void SetCorrType(ECorrType type) { fCorrectionType = type; }
75 ECorrType GetCorrectionType() const { return fCorrectionType; }
77 void SetUseMaterialBudget(Bool_t mat) { fUseMaterial = mat; }
78 Bool_t GetUseMaterialBudget() const { return fUseMaterial; }
80 void SetIdealTracking(Bool_t tr) { fIdealTracking = tr; }
81 Bool_t GetIdealTracking() const { return fIdealTracking; }
83 void SetFillClusterRes(Bool_t res) { fFillClusterRes=res; }
84 Bool_t GetFillClusterRes() const { return fFillClusterRes; }
86 void SetUseT0list(Bool_t use) { fUseT0list=use; }
87 Bool_t GetUseT0list() const { return fUseT0list; }
89 void SetUseZ0list(Bool_t use) { fUseZ0list=use; }
90 Bool_t GetUseZ0list() const { return fUseZ0list; }
92 void SetForceAlpha(Bool_t use) { fForceAlpha=use; }
93 Bool_t GetForceAlpha() const { return fForceAlpha; }
95 void SetRecoInfo(Long64_t val) { fRecoInfo = val; }
96 Long64_t GetRecoInfo() const { return fRecoInfo; }
98 void SetTree(TTree *tree) { fTree=tree; }
99 TTree* GetTree() const { return fTree; }
101 AliExternalTrackParam* GetSeedFromTrack(const AliToyMCTrack * const tr, Bool_t forceSeed=kFALSE);
102 AliExternalTrackParam* GetSeedFromTrackIdeal(const AliToyMCTrack * const tr, EDet det );
103 AliExternalTrackParam* GetFittedTrackFromSeed(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, TClonesArray *arrClustRes=0x0);
104 AliExternalTrackParam* GetFittedTrackFromSeedAllClusters(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, Int_t &nClus);
105 AliExternalTrackParam* GetTrackRefit(const AliToyMCTrack * const tr, EDet det);
107 AliToyMCTrack *ConvertTPCSeedToToyMCTrack(const AliTPCseed &seed);
108 AliExternalTrackParam* GetRefittedTrack(const AliTPCseed &seed);
110 AliTPCclusterMI* FindMiddleCluster(const AliTPCclusterMI *clInner, const AliTPCclusterMI *clOuter,
111 Double_t roady, Double_t roadz,
114 void AddMiddleClusters(AliTPCseed *seed,
115 const AliTPCclusterMI *clInner, const AliTPCclusterMI *clOuter,
116 Double_t roady, Double_t roadz,
117 Int_t &nTotalClusters, AliRieman &seedFit);
118 Int_t MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2);
119 void MakeSeeds(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2);
121 void SetRieman(const AliTPCseed &seed, AliRieman &rieman);
122 void CopyRieman(const AliRieman &from, AliRieman &to);
124 AliExternalTrackParam* ClusterToTrackAssociation(const AliTPCseed *seed, Int_t trackID, Int_t &nClus);
125 void ClusterToTrackAssociation(AliTPCseed &seed);
126 void AssociateClusters(AliTPCseed &seed, Int_t firstRow, Int_t lastRow, Bool_t direction);
128 void InitSpaceCharge();
130 void SetLongT0seed(Bool_t l) { fLongT0seed=l; }
131 Bool_t GetLongT0seed() const { return fLongT0seed; }
133 static TTree* ConnectTrees(const char* files);
135 Double_t GetVDrift() const;
136 Double_t GetZLength(Int_t roc) const;
138 void InitStreamer(TString addName, Int_t level=1);
140 void ConnectInputFile(const char* file, Int_t nmaxEv=-1);
143 void DumpTracksToTree(const char* file);
146 AliToyMCReconstruction(const AliToyMCReconstruction &rec);
147 AliToyMCReconstruction& operator= (AliToyMCReconstruction& rec);
149 void SetTrackPointFromCluster(const AliTPCclusterMI *cl, AliTrackPoint &p);
150 void ClusterToSpacePoint(const AliTPCclusterMI *cl, Float_t xyz[3]);
152 Int_t LoadInnerSectors();
153 Int_t LoadOuterSectors();
155 Int_t GetSector(AliExternalTrackParam *track);
156 void FillSectorStructure(Int_t maxev);
157 void FillSectorStructureAC();
159 void SetupTrackMaps();
161 void CookLabel(AliTPCseed *seed, Double_t fraction, Int_t info[5]=0);
163 void DumpSeedInfo(TObjArray *arr);
164 void DumpTrackInfo(TObjArray *arr);
165 void DumpSeedInfo(const AliToyMCTrack *toyTrack, AliTPCseed *seed);
168 void MarkClustersUsed(AliTPCseed *seed);
169 void ResetClustersZtoTime(AliTPCseed *seed);
171 Float_t FindClosestT0(const TVectorF &t0list, const TVectorF &z0list, AliExternalTrackParam &t0seed);
174 Int_t fSeedingRow; // first row used for seeding
175 Int_t fSeedingDist; // distance of seeds
176 Int_t fClusterType; // cluster type to use
177 ECorrType fCorrectionType; // type of space point correction
178 Bool_t fDoTrackFit; // do track fitting
179 Bool_t fUseMaterial; // use material budget in tracking
180 Bool_t fIdealTracking; // use ideal coordinates for tracking
182 Int_t fNmaxEvents; // maximum number of events
184 // current reconstruction info
185 Double_t fTime0; // current time0 used for reconstruction
186 Bool_t fCreateT0seed; // if current seed is the T0 seed
187 Bool_t fLongT0seed; // if we should use a t0 seed including all clusters in the seed range
188 Bool_t fFillClusterRes; // fill cluster residuals?
189 Bool_t fUseT0list; // if the list of T0 information should be used to guess the T0
190 Bool_t fUseZ0list; // if the list of Z vertex information should be used to guess the T0
191 Bool_t fForceAlpha; // force the correct alpha for the t0 seed extrapolation
192 Long64_t fRecoInfo; // what information to fill in the output trees
194 TTreeSRedirector *fStreamer; // debug streamer
195 TFile *fInputFile; // input file
196 TTree *fTree; // input tree with ToyMC info
197 AliToyMCEvent *fEvent; // input event
199 AliTPCParam *fTPCParam; // tpc reco parameters
200 AliTPCCorrection *fTPCCorrection; // space charge
202 const Int_t fkNSectorInner; //number of inner sectors
203 AliTPCtrackerSector *fInnerSectorArray; //array of inner sectors
204 const Int_t fkNSectorOuter; //number of outer sectors
205 AliTPCtrackerSector *fOuterSectorArray; //array of outer sectors
207 TClonesArray fAllClusters; //Array keeping all clusters for free seeding
209 TExMap fMapTrackEvent; // map global track number -> event number
210 TExMap fMapTrackTrackInEvent; // map global track number -> track in event
212 THn *fHnDelta; // histogram with residuals
214 Bool_t fIsAC; // if we are tracking with sector arrays running from 0-36 rather than 0-18
216 ClassDef(AliToyMCReconstruction,0)