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