Fixed ClassDef() accidentally removed
[u/mrichter/AliRoot.git] / TPC / TPCupgrade / AliToyMCReconstruction.h
CommitLineData
d1cf83f5 1#ifndef AliToyMCReconstruction_H
2#define AliToyMCReconstruction_H
3
a06336b6 4#include <TString.h>
d1cf83f5 5#include <TObject.h>
38d9d609 6#include <TClonesArray.h>
7#include <TExMap.h>
36a79b0d 8#include <TVectorFfwd.h>
5414766f 9#include <THn.h>
d1cf83f5 10
11class TTree;
12
13class TTreeSRedirector;
14class AliExternalTrackParam;
510cfcff 15class AliTPCtrackerSector;
4a777885 16class AliToyMCEvent;
223d9e38 17class AliTPCCorrection;
79f54519 18class AliTPCseed;
502eb90b 19class AliTPCtrackerRow;
c484014f 20class AliToyMCTrack;
21class AliTPCclusterMI;
38d9d609 22class AliRieman;
c484014f 23class AliTrackPoint;
24class AliTPCParam;
d1cf83f5 25
26class AliToyMCReconstruction : public TObject {
27public:
28 AliToyMCReconstruction();
29 virtual ~AliToyMCReconstruction();
30
31 enum ECorrType {
32 kNoCorrection = 0,
33 kTPCCenter,
34 kAverageEta,
7f72a764 35 kIdeal,
88386c5c 36 kPreliminaryEta // NOT TO USE (needs fixing!!! Not yet in full code!!!)
d1cf83f5 37 };
38
e83fd282 39 enum EDet {
40 kITS=0,
41 kTPC,
42 kTRD
43 };
70cc5429 44
45 enum ERecoFill {
46 kFillSeed = 0x01,
47 kFillOrig = 0x02,
48 kFillTrack= 0x04,
49
50 kFillITS = 0x08,
51 kFillITS1 = 0x10,
842d682d 52 kFillITS2 = 0x20,
53
54 kFillDeltas = 0x40,
55 kFillNoTrackInfo= 0x80
70cc5429 56 };
e83fd282 57
4a777885 58 void RunReco(const char* file, Int_t nmaxEv=-1);
510cfcff 59 void RunRecoAllClusters(const char* file, Int_t nmaxEv=-1);
5993ed4f 60 void RunRecoAllClustersStandardTracking(const char* file, Int_t nmaxEv=-1);
a06336b6 61
62 void RunFullTracking(const char* file, Int_t nmaxEv=-1);
4a777885 63
d1cf83f5 64 // reconstruction settings
a06336b6 65 void SetRecoSettings(Bool_t idealTracking, Int_t clusterType, ECorrType correctionType, Int_t seedingRow=130, Int_t seedingDist=10)
05da1b4e 66 { fIdealTracking=idealTracking; fClusterType=clusterType; fSeedingRow=seedingRow, fSeedingDist=seedingDist, fCorrectionType=correctionType; }
d1cf83f5 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
600eaa0d 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; }
4388aa4a 85
86 void SetFillClusterRes(Bool_t res) { fFillClusterRes=res; }
87 Bool_t GetFillClusterRes() const { return fFillClusterRes; }
88
36a79b0d 89 void SetUseT0list(Bool_t use) { fUseT0list=use; }
90 Bool_t GetUseT0list() const { return fUseT0list; }
4388aa4a 91
f45d00f9 92 void SetUseZ0list(Bool_t use) { fUseZ0list=use; }
93 Bool_t GetUseZ0list() const { return fUseZ0list; }
94
36a79b0d 95 void SetForceAlpha(Bool_t use) { fForceAlpha=use; }
96 Bool_t GetForceAlpha() const { return fForceAlpha; }
70cc5429 97
98 void SetRecoInfo(Long64_t val) { fRecoInfo = val; }
99 Long64_t GetRecoInfo() const { return fRecoInfo; }
600eaa0d 100
d1cf83f5 101 void SetTree(TTree *tree) { fTree=tree; }
102 TTree* GetTree() const { return fTree; }
103
9d548f3c 104 AliExternalTrackParam* GetSeedFromTrack(const AliToyMCTrack * const tr, Bool_t forceSeed=kFALSE);
e83fd282 105 AliExternalTrackParam* GetSeedFromTrackIdeal(const AliToyMCTrack * const tr, EDet det );
4388aa4a 106 AliExternalTrackParam* GetFittedTrackFromSeed(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, TClonesArray *arrClustRes=0x0);
c0ebc0e0 107 AliExternalTrackParam* GetFittedTrackFromSeedAllClusters(const AliToyMCTrack *tr, const AliExternalTrackParam *seed, Int_t &nClus);
e83fd282 108 AliExternalTrackParam* GetTrackRefit(const AliToyMCTrack * const tr, EDet det);
0403120d 109
110 AliToyMCTrack *ConvertTPCSeedToToyMCTrack(const AliTPCseed &seed);
111 AliExternalTrackParam* GetRefittedTrack(const AliTPCseed &seed);
112
38d9d609 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);
9d548f3c 121 Int_t MakeSeeds2(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2);
502eb90b 122 void MakeSeeds(TObjArray * arr, Int_t sec, Int_t i1, Int_t i2);
38d9d609 123
9d548f3c 124 void SetRieman(const AliTPCseed &seed, AliRieman &rieman);
125 void CopyRieman(const AliRieman &from, AliRieman &to);
126
79f54519 127 AliExternalTrackParam* ClusterToTrackAssociation(const AliTPCseed *seed, Int_t trackID, Int_t &nClus);
9d548f3c 128 void ClusterToTrackAssociation(AliTPCseed &seed);
129 void AssociateClusters(AliTPCseed &seed, Int_t firstRow, Int_t lastRow, Bool_t direction);
130
d1cf83f5 131 void InitSpaceCharge();
132
c484014f 133 void SetLongT0seed(Bool_t l) { fLongT0seed=l; }
134 Bool_t GetLongT0seed() const { return fLongT0seed; }
135
9e98dea8 136 static TTree* ConnectTrees(const char* files);
137
d1cf83f5 138 Double_t GetVDrift() const;
139 Double_t GetZLength(Int_t roc) const;
5993ed4f 140
a06336b6 141 void InitStreamer(TString addName, Int_t level=1);
c0ebc0e0 142
a06336b6 143 void ConnectInputFile(const char* file, Int_t nmaxEv=-1);
38d9d609 144 void Cleanup();
a06336b6 145
146 void DumpTracksToTree(const char* file);
38d9d609 147
bae1f6ac 148 private:
d1cf83f5 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]);
c0ebc0e0 154
155 Int_t LoadInnerSectors();
156 Int_t LoadOuterSectors();
157
158 Int_t GetSector(AliExternalTrackParam *track);
159 void FillSectorStructure(Int_t maxev);
a06336b6 160 void FillSectorStructureAC();
38d9d609 161
162 void SetupTrackMaps();
a06336b6 163
164 void CookLabel(AliTPCseed *seed, Double_t fraction, Int_t info[5]=0);
165
9d548f3c 166 void DumpSeedInfo(TObjArray *arr);
167 void DumpTrackInfo(TObjArray *arr);
168 void DumpSeedInfo(const AliToyMCTrack *toyTrack, AliTPCseed *seed);
169
a06336b6 170
171 void MarkClustersUsed(AliTPCseed *seed);
9d548f3c 172 void ResetClustersZtoTime(AliTPCseed *seed);
36a79b0d 173
f45d00f9 174 Float_t FindClosestT0(const TVectorF &t0list, const TVectorF &z0list, AliExternalTrackParam &t0seed);
d1cf83f5 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
600eaa0d 183 Bool_t fIdealTracking; // use ideal coordinates for tracking
d1cf83f5 184
a06336b6 185 Int_t fNmaxEvents; // maximum number of events
186
d1cf83f5 187 // current reconstruction info
188 Double_t fTime0; // current time0 used for reconstruction
600eaa0d 189 Bool_t fCreateT0seed; // if current seed is the T0 seed
c484014f 190 Bool_t fLongT0seed; // if we should use a t0 seed including all clusters in the seed range
4388aa4a 191 Bool_t fFillClusterRes; // fill cluster residuals?
36a79b0d 192 Bool_t fUseT0list; // if the list of T0 information should be used to guess the T0
f45d00f9 193 Bool_t fUseZ0list; // if the list of Z vertex information should be used to guess the T0
36a79b0d 194 Bool_t fForceAlpha; // force the correct alpha for the t0 seed extrapolation
70cc5429 195 Long64_t fRecoInfo; // what information to fill in the output trees
d1cf83f5 196
197 TTreeSRedirector *fStreamer; // debug streamer
38d9d609 198 TFile *fInputFile; // input file
d1cf83f5 199 TTree *fTree; // input tree with ToyMC info
4a777885 200 AliToyMCEvent *fEvent; // input event
d1cf83f5 201
202 AliTPCParam *fTPCParam; // tpc reco parameters
223d9e38 203 AliTPCCorrection *fTPCCorrection; // space charge
5993ed4f 204
a06336b6 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
38d9d609 209
a06336b6 210 TClonesArray fAllClusters; //Array keeping all clusters for free seeding
38d9d609 211
a06336b6 212 TExMap fMapTrackEvent; // map global track number -> event number
213 TExMap fMapTrackTrackInEvent; // map global track number -> track in event
38d9d609 214
5414766f 215 THn *fHnDelta; // histogram with residuals
216
a06336b6 217 Bool_t fIsAC; // if we are tracking with sector arrays running from 0-36 rather than 0-18
38d9d609 218
d1cf83f5 219 ClassDef(AliToyMCReconstruction,0)
220};
221
222
223#endif