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