]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliTPCComparisonMI.h
Changes needed on Mac (F.Carminati)
[u/mrichter/AliRoot.git] / STEER / AliTPCComparisonMI.h
1
2
3 ////////////////////////////////////////////////////////////////////////
4 //
5 // Start of implementation of the class digitRow
6 //
7 ////////////////////////////////////////////////////////////////////////
8 const Int_t kgRowBytes = 32;
9
10 class digitRow: public TObject {
11
12 public:
13   digitRow();
14   virtual ~digitRow(){;}
15   void SetRow(Int_t row);
16   Bool_t TestRow(Int_t row);
17   digitRow & operator=(const digitRow &digOld);
18   Int_t RowsOn(Int_t upto=8*kgRowBytes);
19   Int_t Last();
20   Int_t First();
21   void Reset();
22
23 //private:
24   UChar_t fDig[kgRowBytes];
25
26   ClassDef(digitRow,1)  // container for digit pattern
27 };
28 ClassImp(digitRow)
29
30
31 ////////////////////////////////////////////////////////////////////////
32 //
33 // Start of implementation of the class AliTPCGenInfo
34 //
35 ////////////////////////////////////////////////////////////////////////
36
37 class AliTPCGenInfo: public TObject {
38
39 public:
40   AliTPCGenInfo();
41   ~AliTPCGenInfo();
42
43   AliTrackReference fTrackRef;      // track reference saved in the output tree
44   AliTrackReference fTrackRefOut;   // decay track reference saved in the output tree
45   TParticle fParticle;           // generated particle 
46   Int_t fLabel;                   // track label
47   Int_t fEventNr;                 // event number
48
49   Float_t fDecayCoord[3];         // position of particle decay
50   Double_t fVDist[4];             //distance of the particle vertex from primary vertex
51   
52   Int_t fRowsWithDigitsInn;    // number of rows with digits in the inner sectors
53   Int_t fRowsWithDigits;       // number of rows with digits in the outer sectors
54   Int_t fRowsTrackLength;      // last - first row with digit
55   Int_t fDigitsInSeed;         // digits in the default seed rows
56   Float_t fPrim;               // theoretical dedx in tpc according particle momenta and mass
57   digitRow fRow;               // information about digits row pattern
58   TClonesArray * fReferences;  //containner with all track references
59   ClassDef(AliTPCGenInfo,1)  // container for 
60 };
61 ClassImp(AliTPCGenInfo)
62
63
64
65 class AliTPCGenV0Info: public TObject {
66 public:
67   AliTPCGenInfo fMCd;      //info about daughter particle
68   AliTPCGenInfo fMCm;      //info about mother particle
69   void Update();        // put some derived info to special field 
70   Double_t    fDist1;    //info about closest distance according closest MC - linear DCA
71   Double_t    fDist2;    //info about closest distance parabolic DCA
72   //
73   Double_t     fPdr[3];    //momentum at vertex daughter  - according approx at DCA
74   Double_t     fPd[4];     //exact momentum from MC info
75   Double_t     fX[3];      //exact position of the vertex
76   Double_t     fXr[3];     //rec. position according helix
77   //
78   Double_t     fPm[3];    //momentum at the vertex mother
79   Double_t     fAngle[3]; //three angels
80   Double_t     fRr;       // rec position of the vertex 
81   Double_t     fR;        //exact r position of the vertex
82   Int_t        fPdg[2];   //pdg code of mother and daugter particles
83   Int_t        fLab[2];   //MC label of the partecle
84   ClassDef(AliTPCGenV0Info,1)  // container for  
85 };
86 ClassImp(AliTPCGenV0Info)
87
88
89
90 void AliTPCGenV0Info::Update()
91 {
92   fPd[0] = fMCd.fParticle.Px();
93   fPd[1] = fMCd.fParticle.Py();
94   fPd[2] = fMCd.fParticle.Pz();
95   fPd[3] = fMCd.fParticle.P();
96   fX[0]  = fMCd.fParticle.Vx();
97   fX[1]  = fMCd.fParticle.Vy();
98   fX[2]  = fMCd.fParticle.Vz();
99   fR     = TMath::Sqrt( fX[0]*fX[0]+
100                                  fX[1]*fX[1]);
101   fPdg[0]    = fMCd.fParticle.GetPdgCode();
102   fPdg[1]    = fMCm.fParticle.GetPdgCode();
103   //
104   fLab[0]    = fMCd.fParticle.GetUniqueID();
105   fLab[1]    = fMCm.fParticle.GetUniqueID();
106
107 }
108
109
110
111
112      /////////////////////////////////////////////////////////////////////////
113 class AliTPCRecInfo: public TObject {
114
115 public:
116   AliTPCRecInfo(){fTP = new TClonesArray("AliTPCTrackPoint2",0);}
117   ~AliTPCRecInfo(){if (fTP) {fTP->Delete();delete fTP;}}
118   //
119   AliTPCtrack fTPCTrack;          // tpc track
120   Float_t fTRLocalCoord[3];       //local coordinates of the track ref.
121   Int_t   fReconstructed;         //flag if track was reconstructed
122   Double_t fRecPhi;         // reconstructed phi angle (0;2*kPI)
123   Double_t fLambda;         // reconstructed 
124   Double_t fRecPt_1;        // reconstructed 
125   Float_t fdEdx;           // reconstructed  dEdx      
126   Int_t fFake;             // fake track
127   Int_t fMultiple;         // number of reconstructions
128   TClonesArray *fTP;        //container with track  points 
129   void Reset();
130   //
131   ClassDef(AliTPCRecInfo,1)  // container for 
132 };
133 ClassImp(AliTPCRecInfo)
134
135 void AliTPCRecInfo::Reset()
136 {
137   fMultiple =0; 
138   fFake     =0;
139   fReconstructed=0;
140   fRecPhi =0;
141   fLambda =0;
142 }
143
144
145 /////////////////////////////////////////////////////////
146 /////////////////////////////////////////////////////////
147 /////////////////////////////////////////////////////////
148
149
150 class AliTPCRecV0Info: public TObject {
151 public:
152   AliTPCRecInfo  fT1;      //track1
153   AliTPCRecInfo  fT2;      //track2  
154   Double_t    fDist1;    //info about closest distance according closest MC - linear DCA
155   Double_t    fDist2;    //info about closest distance parabolic DCA
156   //
157   Double_t     fPdr[3];    //momentum at vertex daughter  - according approx at DCA
158   Double_t     fXr[3];     //rec. position according helix
159   //
160   Double_t     fPm[3];    //momentum at the vertex mother
161   Double_t     fAngle[3]; //three angles
162   Double_t     fRr;       // rec position of the vertex 
163   Int_t        fLab[2];   //MC label of the partecle
164   ClassDef(AliTPCRecV0Info,1)  // container for  
165 };
166
167 ClassImp(AliTPCRecV0Info)
168
169
170
171   
172
173
174 ////////////////////////////////////////////////////////////////////////
175 // 
176 // Start of implementation of the class TPCFindGenTracks
177 //
178 ////////////////////////////////////////////////////////////////////////
179
180 class TPCFindGenTracks {
181
182 public:
183   TPCFindGenTracks();
184   TPCFindGenTracks(char* fnHits,
185                    char* fnDigits ="tpc.digits.root",
186                    char* fnRes    ="genTracks.root",
187                    Int_t nEvents=1, Int_t firstEvent=0);
188   virtual ~TPCFindGenTracks();
189   void Reset();
190   Int_t Exec();
191   Int_t Exec(Int_t nEvents, Int_t firstEventNr);
192   void CreateTreeGenTracks();
193   void CloseOutputFile();
194   Int_t TreeKLoop();
195   Int_t TreeTRLoop();
196   Int_t TreeDLoop();
197   //void  FillInfo(Int_t iParticle);
198   void SetFirstEventNr(Int_t i) {fFirstEventNr = i;}
199   void SetNEvents(Int_t i) {fNEvents = i;}
200   void SetDebug(Int_t level) {fDebug = level;}
201   Int_t SetIO(Int_t eventNr);
202   Int_t SetIO();
203   Float_t TR2LocalX(AliTrackReference *trackRef,
204                     AliTPCParam *paramTPC);
205
206 public:
207   AliTPCGenInfo*  fMCInfo;           //! information writen per particle
208   Int_t fDebug;                   //! debug flag  
209   Int_t fEventNr;                 //! current event number
210   Int_t fLabel;                   //! track label
211   Int_t fNEvents;                 //! number of events to process
212   Int_t fFirstEventNr;            //! first event to process
213   Int_t fNParticles;              //! number of particles in TreeK
214   TTree *fTreeGenTracks;          //! output tree with generated tracks
215   char *fFnRes;                   //! output file name with stored tracks
216   char *fFnHits;                  //! input file name with hits
217   char *fFnDigits;                //! input file name with digits
218   TFile *fFileGenTracks;          //! output file with stored fTreeGenTracks
219   TFile *fFileHits;               //! input file with hits
220   TFile *fFileTreeD;              //! input file with digits
221   //
222   TTree * fTreeD;                 //! current tree with digits
223   TTree * fTreeTR;                //! current tree with TR
224   AliStack *fStack;               //! current stack
225   //
226   digitRow *fContainerDigitRow;   //! big container for partial information
227   //
228   AliTrackReference *fReferences; //! container with track references
229   Int_t *fReferenceIndex0;        //! first index for given track
230   Int_t *fReferenceIndex1;        //! last  index for given track
231   //
232   AliTPCParam* fParamTPC;         //! AliTPCParam
233   Double_t fVPrim[3];             //! primary vertex position
234                                   // the fVDist[3] contains size of the 3-vector
235
236 private:
237
238 // some constants for the original non-pareller tracking (by Y.Belikov)
239   static const Int_t seedRow11 = 158;  // nRowUp - 1
240   static const Int_t seedRow12 = 139;  // nRowUp - 1 - (Int_t) 0.125*nRowUp
241   static const Int_t seedRow21 = 149;  // seedRow11 - shift
242   static const Int_t seedRow22 = 130;  // seedRow12 - shift
243   static const Double_t kRaddeg = 180./kPI;
244
245   static const Int_t fgMaxIndexTR = 50000; // maximum number of tracks with a track ref
246   static const Int_t fgMaxTR = 1000000; // maximum number of  track refs
247
248   static const Int_t fgMaxParticles = 2000000; // maximum number of generated particles
249   static const Double_t fgPtCut = .1; // do not store particles with generated pT less than this
250   static const Float_t fgTrackRefLocalXMax = 82.95;
251   static const Float_t fgTrackRefLocalXMaxDelta = 5.;
252
253   ClassDef(TPCFindGenTracks,1)    // class which creates and fills tree with TPCGenTrack objects
254 };
255 ClassImp(TPCFindGenTracks)
256
257
258
259 ////////////////////////////////////////////////////////////////////////
260 // 
261 // Start of implementation of the class TPCCmpTr
262 //
263 ////////////////////////////////////////////////////////////////////////
264
265 class TPCCmpTr {
266
267 public:
268   TPCCmpTr();
269   TPCCmpTr(char* fnRecTracks,
270            char* fnGenTracks   ="genTracks.root",
271            char* fnCmpRes      ="cmpTracks.root", 
272            char* fnGalice      ="galice.root",
273            Int_t nEvents=1, Int_t firstEvent=0);
274   virtual ~TPCCmpTr();
275   void Reset();
276   Int_t Exec();
277   Int_t Exec(Int_t nEvents, Int_t firstEventNr);
278   void CreateTreeCmp();
279   void CloseOutputFile();
280   Bool_t ConnectGenTree();
281   Int_t TreeGenLoop(Int_t eventNr);
282   Int_t TreeTLoop(Int_t eventNr);
283   void SetFirstEventNr(Int_t i) {fFirstEventNr = i;}
284   void SetNEvents(Int_t i) {fNEvents = i;}
285   void SetDebug(Int_t level) {fDebug = level;}
286
287 // tmp method, should go to TrackReferenceTPC
288   TVector3 TR2Local(AliTrackReference *trackRef,
289                     AliTPCParam *paramTPC);
290
291 private:
292
293   Int_t fEventNr;                 //! current event number
294   Int_t fNEvents;                 //! number of events to process
295   Int_t fFirstEventNr;            //! first event to process
296   //
297   char *fFnCmp;                   //! output file name with cmp tracks
298   TFile *fFileCmp;                //! output file with cmp tracks
299   TTree *fTreeCmp;                //! output tree with cmp tracks
300   //
301   char *fFnGenTracks;             //! input file name with gen tracks
302   TFile *fFileGenTracks;
303   TTree *fTreeGenTracks;
304   //
305   char *fFnHits;                  //! input file name with gAlice object (needed for B)
306   TFile *fFileHits;               //! input file with gAlice
307   //
308   char *fFnRecTracks;             //! input file name with tpc rec. tracks
309   TFile *fFileRecTracks;          //! input file with reconstructed tracks
310   TTree *fTreeRecTracks;          //! tree with reconstructed tracks
311   TTree *fTreePoints;             //! tree with reconstructed points
312   //
313   Int_t *fIndexRecTracks;         //! index of particle label in the TreeT_TPC
314   Int_t *fFakeRecTracks;          //! number of fake tracks
315   Int_t *fMultiRecTracks;         //! number of multiple reconstructions
316   //
317   TObjArray * fTracks;            //!container with tracks 
318   TObjArray * fTrackPoints;       //! container with track points
319   //
320   AliTPCParam* fParamTPC;         //! AliTPCParam
321   Int_t fNParticles;              //! number of particles in the input tree genTracks
322   Int_t fDebug;                   //! debug flag  
323   Int_t fNextTreeGenEntryToRead;    //! last entry already read from genTracks tree
324   //
325   AliTPCGenInfo*  fMCInfo;           //! MC information writen per particle
326   AliTPCRecInfo*  fRecInfo;          //! Rec. information writen per particle
327   //
328   AliTPCtrack *fTPCTrack;         //! pointer to TPC track to connect branch
329
330   ClassDef(TPCCmpTr,1)    // class which creates and fills tree with TPCGenTrack objects
331 };
332 ClassImp(TPCCmpTr)
333