1 #ifndef AliToyMCReconstruction_H
2 #define AliToyMCReconstruction_H
6 #include <TClonesArray.h>
8 #include <TVectorFfwd.h>
12 class TTreeSRedirector;
13 class AliExternalTrackParam;
14 class AliTPCtrackerSector;
16 class AliTPCCorrection;
18 class AliTPCtrackerRow;
20 class AliTPCclusterMI;
25 class AliToyMCReconstruction : public TObject {
27 AliToyMCReconstruction();
28 virtual ~AliToyMCReconstruction();
35 kPreliminaryEta // NOT TO USE (needs fixing!!! Not yet in full code!!!)
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);
48 void RunFullTracking(const char* file, Int_t nmaxEv=-1);
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; }
54 void SetClusterType(Int_t type) { fClusterType = type; }
55 Int_t GetClusterType() const { return fClusterType; }
57 void SetSeedingRow(Int_t row) { fSeedingRow = row; }
58 Int_t GetSeedingRow() const { return fSeedingRow; }
60 void SetSeedingDist(Int_t dist) { fSeedingDist = dist; }
61 Int_t GetSeedingDist() const { return fSeedingDist; }
63 void SetCorrType(ECorrType type) { fCorrectionType = type; }
64 ECorrType GetCorrectionType() const { return fCorrectionType; }
66 void SetUseMaterialBudget(Bool_t mat) { fUseMaterial = mat; }
67 Bool_t GetUseMaterialBudget() const { return fUseMaterial; }
69 void SetIdealTracking(Bool_t tr) { fIdealTracking = tr; }
70 Bool_t GetIdealTracking() const { return fIdealTracking; }
72 void SetFillClusterRes(Bool_t res) { fFillClusterRes=res; }
73 Bool_t GetFillClusterRes() const { return fFillClusterRes; }
75 void SetUseT0list(Bool_t use) { fUseT0list=use; }
76 Bool_t GetUseT0list() const { return fUseT0list; }
78 void SetUseZ0list(Bool_t use) { fUseZ0list=use; }
79 Bool_t GetUseZ0list() const { return fUseZ0list; }
81 void SetForceAlpha(Bool_t use) { fForceAlpha=use; }
82 Bool_t GetForceAlpha() const { return fForceAlpha; }
84 void SetTree(TTree *tree) { fTree=tree; }
85 TTree* GetTree() const { return fTree; }
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);
93 AliToyMCTrack *ConvertTPCSeedToToyMCTrack(const AliTPCseed &seed);
94 AliExternalTrackParam* GetRefittedTrack(const AliTPCseed &seed);
96 AliTPCclusterMI* FindMiddleCluster(const AliTPCclusterMI *clInner, const AliTPCclusterMI *clOuter,
97 Double_t roady, Double_t roadz,
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);
107 void SetRieman(const AliTPCseed &seed, AliRieman &rieman);
108 void CopyRieman(const AliRieman &from, AliRieman &to);
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);
114 void InitSpaceCharge();
116 void SetLongT0seed(Bool_t l) { fLongT0seed=l; }
117 Bool_t GetLongT0seed() const { return fLongT0seed; }
119 static TTree* ConnectTrees(const char* files);
121 Double_t GetVDrift() const;
122 Double_t GetZLength(Int_t roc) const;
124 void InitStreamer(TString addName, Int_t level=1);
126 void ConnectInputFile(const char* file, Int_t nmaxEv=-1);
129 void DumpTracksToTree(const char* file);
132 AliToyMCReconstruction(const AliToyMCReconstruction &rec);
133 AliToyMCReconstruction& operator= (AliToyMCReconstruction& rec);
135 void SetTrackPointFromCluster(const AliTPCclusterMI *cl, AliTrackPoint &p);
136 void ClusterToSpacePoint(const AliTPCclusterMI *cl, Float_t xyz[3]);
138 Int_t LoadInnerSectors();
139 Int_t LoadOuterSectors();
141 Int_t GetSector(AliExternalTrackParam *track);
142 void FillSectorStructure(Int_t maxev);
143 void FillSectorStructureAC();
145 void SetupTrackMaps();
147 void CookLabel(AliTPCseed *seed, Double_t fraction, Int_t info[5]=0);
149 void DumpSeedInfo(TObjArray *arr);
150 void DumpTrackInfo(TObjArray *arr);
151 void DumpSeedInfo(const AliToyMCTrack *toyTrack, AliTPCseed *seed);
154 void MarkClustersUsed(AliTPCseed *seed);
155 void ResetClustersZtoTime(AliTPCseed *seed);
157 Float_t FindClosestT0(const TVectorF &t0list, const TVectorF &z0list, AliExternalTrackParam &t0seed);
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
168 Int_t fNmaxEvents; // maximum number of events
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
179 TTreeSRedirector *fStreamer; // debug streamer
180 TFile *fInputFile; // input file
181 TTree *fTree; // input tree with ToyMC info
182 AliToyMCEvent *fEvent; // input event
184 AliTPCParam *fTPCParam; // tpc reco parameters
185 AliTPCCorrection *fTPCCorrection; // space charge
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
192 TClonesArray fAllClusters; //Array keeping all clusters for free seeding
194 TExMap fMapTrackEvent; // map global track number -> event number
195 TExMap fMapTrackTrackInEvent; // map global track number -> track in event
197 Bool_t fIsAC; // if we are tracking with sector arrays running from 0-36 rather than 0-18
199 ClassDef(AliToyMCReconstruction,0)