]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG4/GammaConv/AliV0Reader.h
Added a new class for the AOD information
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / AliV0Reader.h
1 #ifndef ALIV0READER_H\r
2 #define ALIV0READER_H\r
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *\r
4  * See cxx source for full Copyright notice     */\r
5 \r
6 ////////////////////////////////////////////////\r
7 //--------------------------------------------- \r
8 // Class used to do analysis on conversion pairs\r
9 //---------------------------------------------\r
10 ////////////////////////////////////////////////\r
11 \r
12 // --- ROOT system ---\r
13 #include "TObject.h" \r
14 #include "AliESDv0.h"\r
15 #include "AliESDEvent.h"\r
16 #include "AliKFParticle.h"\r
17 #include "TParticle.h"\r
18 #include "AliGammaConversionHistograms.h"\r
19 #include <vector>\r
20 \r
21 class TClonesArray; \r
22 class TFormula;\r
23 class Riostream;\r
24 class TChain;\r
25 //--- AliRoot system ---\r
26 \r
27 class AliStack;\r
28 class AliESDEvent; \r
29 class AliMCEventHandler;\r
30 class AliESDInputHandler;\r
31 class AliESDVertex;\r
32 class AliLog;\r
33 class TChain;\r
34 class TChain;\r
35 \r
36 \r
37 \r
38 class AliV0Reader : public TObject {\r
39 \r
40  public: \r
41 \r
42   AliV0Reader();                                        //constructor\r
43   AliV0Reader(const AliV0Reader & g);                   //copy constructor\r
44   AliV0Reader & operator = (const AliV0Reader & g);     //assignment operator\r
45   virtual ~AliV0Reader() {;}                            //virtual destructor\r
46   /*\r
47    *Initialize the reader\r
48    */\r
49   void Initialize();\r
50 \r
51   /*\r
52    * Returns  AliESDEvent\r
53    */                   \r
54    AliESDEvent* GetESDEvent() const{return fESDEvent;}  \r
55 \r
56   /*\r
57    *Returns the number of v0s in the event, no cuts applied.\r
58    */\r
59   Int_t GetNumberOfV0s() const{return fESDEvent->GetNumberOfV0s();}\r
60 \r
61   /*\r
62    * Check if there are any more good v0s left in the v0 stack\r
63    * if so, fCurrent v0 is set to this v0 and can be retrieved\r
64    * by GetCurrentV0 function.\r
65    * returns kFALSE if there is no more good v0s in the v0 stack\r
66    */\r
67   Bool_t NextV0();\r
68   \r
69   /*\r
70    * Returns the v0 at the given index, no checks are done on the v0. \r
71    */\r
72   AliESDv0* GetV0(Int_t index);\r
73 \r
74   /*\r
75    * Returns the current v0\r
76    */\r
77   AliESDv0* GetCurrentV0() const{return fCurrentV0;}\r
78 \r
79   /*\r
80    * Returns the negative ESD track which belongs to fCurrentV0\r
81    */\r
82   AliESDtrack* GetNegativeESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetNindex());}\r
83 \r
84   /*\r
85    * Returns the positive ESD track which belongs to fCurrentV0\r
86    */\r
87   AliESDtrack* GetPositiveESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetPindex());}\r
88 \r
89   /*\r
90    * Returns the negative KF particle which belongs to fCurrentV0\r
91    */\r
92   AliKFParticle* GetNegativeKFParticle() const{return fCurrentNegativeKFParticle;}\r
93 \r
94   /*\r
95    * Returns the positive KF particle which belongs to fCurrentV0\r
96    */\r
97   AliKFParticle* GetPositiveKFParticle() const{return fCurrentPositiveKFParticle;}\r
98 \r
99   /*\r
100    * Returns the KFParticle object of the 2 tracks.\r
101    */\r
102   AliKFParticle* GetMotherCandidateKFCombination() const{return fCurrentMotherKFCandidate;}\r
103 \r
104   /*\r
105    * Checks the probablity that the PID of the particle is what we want it to be.\r
106    */\r
107   Bool_t CheckPIDProbability(Double_t negProbCut, Double_t posProbCut);\r
108   \r
109   /*\r
110    * Checks if the PID of the two particles are within our cuts.\r
111    */\r
112   void GetPIDProbability(Double_t &negPIDProb, Double_t &posPIDProb);\r
113 \r
114   /*\r
115    *Get the negative MC TParticle from the stack \r
116    */\r
117   TParticle * GetNegativeMCParticle() const{return fNegativeMCParticle;}\r
118 \r
119   /*\r
120    *Get the positive MC TParticle from the stack \r
121    */\r
122   TParticle * GetPositiveMCParticle() const{return fPositiveMCParticle;}\r
123 \r
124   /*\r
125    *Get the mother MC TParticle from the stack \r
126    */\r
127   TParticle * GetMotherMCParticle() const{return fMotherMCParticle;}\r
128 \r
129   /*\r
130    * Flag to see if the v0 particles share the same mother\r
131    */\r
132   Bool_t HasSameMCMother();\r
133 \r
134 \r
135   /*\r
136    *Get the PID of the MC mother particle\r
137    */\r
138   Int_t GetMotherMCParticlePDGCode() const{if(fMotherMCParticle != NULL){ cout<<"MCParticle exists"<<endl;} return fMotherMCParticle->GetPdgCode();}\r
139 \r
140   /*\r
141    *Get the MC stack \r
142    */\r
143   AliStack* GetMCStack() const{return fMCStack;}\r
144 \r
145   /*\r
146    *Get the magnetic field from the ESD event \r
147    */\r
148   Double_t GetMagneticField() const{return fESDEvent->GetMagneticField();}\r
149 \r
150   /*\r
151    *Get the primary vertex from the esd event\r
152    */\r
153   const AliESDVertex *GetPrimaryVertex() const {return fESDEvent->GetPrimaryVertex();}\r
154 \r
155   /*\r
156    * Set the PID of the negative track\r
157    */\r
158   void SetNegativeTrackPID(Int_t negTrackPID){fNegativeTrackPID=negTrackPID;}\r
159 \r
160   /*\r
161    * Set the PID of the positive track\r
162    */\r
163   void SetPositiveTrackPID(Int_t posTrackPID){fPositiveTrackPID=posTrackPID;}\r
164 \r
165   /*\r
166    * Set the flag to use the kfparticle class. Will also disable the use of esd tracks\r
167    */\r
168   void UseKFParticle(){fUseKFParticle = kTRUE; fUseESDTrack = kFALSE;}\r
169 \r
170   /*\r
171    *  Set the flag to use the esd track class. Will also disable the use of kf particles\r
172    */\r
173   void UseESDTrack(){fUseESDTrack = kTRUE; fUseKFParticle = kFALSE;}\r
174 \r
175   /*\r
176    *  Set the flag to use improved vertex or not\r
177    */\r
178   void SetUseImprovedVertex(Bool_t useImprovedVertex){fUseImprovedVertex=useImprovedVertex;}\r
179 \r
180   /*\r
181    * Return the number in the species array belonging to the negative or positive track pid.\r
182    */\r
183   Int_t GetSpeciesIndex(Int_t chargeOfTrack);\r
184 \r
185   /*\r
186    * Return the x coordinate of the v0\r
187    */\r
188   Double_t GetX() const{return fCurrentXValue;}\r
189 \r
190   /*\r
191    * Return the y coordinate of the v0\r
192    */\r
193   Double_t GetY() const{return fCurrentYValue;}\r
194 \r
195   /*\r
196    * Return the Z coordinate of the v0\r
197    */\r
198   Double_t GetZ() const{return fCurrentZValue;}\r
199 \r
200   /*\r
201    * Return the radius of the v0\r
202    */\r
203   Double_t GetXYRadius() const{return sqrt((Double_t)(fCurrentXValue*fCurrentXValue + fCurrentYValue*fCurrentYValue));}\r
204 \r
205   /*\r
206    * Get the opening angle between the two tracks\r
207    */\r
208   Double_t GetOpeningAngle(){return fNegativeTrackLorentzVector->Angle(fPositiveTrackLorentzVector->Vect());}\r
209 \r
210   /*\r
211    * Gets the Energy of the negative track.\r
212    */\r
213   Double_t GetNegativeTrackEnergy() const{return fCurrentNegativeKFParticle->E();}\r
214 \r
215   /*\r
216    * Gets the Energy of the positive track.\r
217    */\r
218   Double_t GetPositiveTrackEnergy() const{return fCurrentPositiveKFParticle->E();}\r
219 \r
220   /*\r
221    * Gets the Energy of the mother candidate.\r
222    */\r
223   Double_t GetMotherCandidateEnergy() const{return fCurrentMotherKFCandidate->E();}\r
224 \r
225   /*\r
226    * Gets the Pt of the negative track.\r
227    */\r
228   Double_t GetNegativeTrackPt() const{return fNegativeTrackLorentzVector->Pt();}\r
229 \r
230   /*\r
231    * Gets the Pt of the positive track.\r
232    */\r
233   Double_t GetPositiveTrackPt() const{return fPositiveTrackLorentzVector->Pt();}\r
234 \r
235   /*\r
236    * Gets the Pt of the mother candidate.\r
237    */\r
238   Double_t GetMotherCandidatePt() const{return fMotherCandidateLorentzVector->Pt();}\r
239 \r
240   /*\r
241    * Gets the Eta of the negative track.\r
242    */\r
243   Double_t GetNegativeTrackEta() const{return fNegativeTrackLorentzVector->Eta();}\r
244   /*\r
245    * Gets the Eta of the positive track.\r
246    */\r
247   Double_t GetPositiveTrackEta() const{return fPositiveTrackLorentzVector->Eta();}\r
248   /*\r
249    * Gets the Eta of the mother candidate.\r
250    */\r
251   Double_t GetMotherCandidateEta() const{return fMotherCandidateLorentzVector->Eta();}\r
252 \r
253   /*\r
254    * Gets the NDF of the mother candidate.\r
255    */\r
256   Double_t GetMotherCandidateNDF() const{return fCurrentMotherKFCandidate->GetNDF();}\r
257 \r
258   /*\r
259    * Gets the Chi2 of the mother candidate.\r
260    */\r
261   Double_t GetMotherCandidateChi2() const{return fCurrentMotherKFCandidate->GetChi2();}\r
262 \r
263   /*\r
264    * Gets the Mass of the mother candidate.\r
265    */\r
266   Double_t GetMotherCandidateMass() const{return fMotherCandidateKFMass;}\r
267 \r
268   /*\r
269    * Gets the Width of the mother candidate.\r
270    */\r
271   Double_t GetMotherCandidateWidth() const{return fMotherCandidateKFWidth;}\r
272 \r
273   /*\r
274    * Gets the Phi of the negative track.\r
275    */\r
276   Double_t GetNegativeTrackPhi() const;\r
277 \r
278   /*\r
279    * Gets the Phi of the positive track.\r
280    */\r
281   Double_t GetPositiveTrackPhi() const;\r
282 \r
283   /*\r
284    * Gets the Phi of the mother candidate.\r
285    */\r
286   Double_t GetMotherCandidatePhi() const;\r
287 \r
288   /*\r
289    * Gets the Rapidity of the mother candidate.\r
290    */\r
291   Double_t GetMotherCandidateRapidity() const;\r
292 \r
293 \r
294   /*\r
295    * Update data which need to be updated every event.\r
296    */\r
297   void UpdateEventByEventData();\r
298   \r
299   /*\r
300    * Gets the MaxRCut value.\r
301    */\r
302   Double_t GetMaxRCut() const{return fMaxR;}\r
303 \r
304   /*\r
305    * Gets the Eta cut value.\r
306    */\r
307   Double_t GetEtaCut() const{return fEtaCut;}\r
308 \r
309   /*\r
310    * Gets the Pt cut value.\r
311    */\r
312   Double_t GetPtCut() const{return fPtCut;}\r
313 \r
314   /*\r
315    * Gets the line cut values.\r
316    */\r
317   Double_t GetLineCutZRSlope() const{return fLineCutZRSlope;}\r
318   Double_t GetLineCutZValue() const{return fLineCutZValue;}\r
319   \r
320   /*\r
321    * Gets the Chi2 cut value for the conversions.\r
322    */\r
323   Double_t GetChi2CutConversion() const{return fChi2CutConversion;}\r
324 \r
325   /*\r
326    * Gets the Chi2 cut value for the mesons.\r
327    */\r
328   Double_t GetChi2CutMeson() const{return fChi2CutMeson;}\r
329 \r
330   Double_t GetPositiveTrackLength() const{return fCurrentPositiveESDTrack->GetIntegratedLength();}\r
331   Double_t GetNegativeTrackLength() const{return fCurrentNegativeESDTrack->GetIntegratedLength();}\r
332 \r
333   Double_t GetPositiveNTPCClusters() const{return fCurrentPositiveESDTrack->GetTPCNcls();}\r
334   Double_t GetNegativeNTPCClusters() const{return fCurrentNegativeESDTrack->GetTPCNcls();}\r
335 \r
336   /*\r
337    * Sets the MaxRCut value.\r
338    */\r
339   void SetMaxRCut(Double_t maxR){fMaxR=maxR;}\r
340 \r
341   /*\r
342    * Sets the EtaCut value.\r
343    */\r
344   void SetEtaCut(Double_t etaCut){fEtaCut=etaCut;}\r
345 \r
346   /*\r
347    * Sets the PtCut value.\r
348    */\r
349   void SetPtCut(Double_t ptCut){fPtCut=ptCut;}\r
350 \r
351   /*\r
352    * Sets the LineCut values.\r
353    */\r
354   void SetLineCutZRSlope(Double_t LineCutZRSlope){fLineCutZRSlope=LineCutZRSlope;}\r
355   void SetLineCutZValue(Double_t LineCutZValue){fLineCutZValue=LineCutZValue;}\r
356 \r
357   /*\r
358    * Sets the Chi2Cut value for conversions.\r
359    */\r
360   void SetChi2CutConversion(Double_t chi2){fChi2CutConversion=chi2;}\r
361 \r
362   /*\r
363    * Sets the Chi2Cut for the mesons.\r
364    */\r
365   void SetChi2CutMeson(Double_t chi2){fChi2CutMeson=chi2;}\r
366   \r
367   /*\r
368    * Sets the XVertexCut value.\r
369    */\r
370   void SetXVertexCut(Double_t xVtx){fCurrentXValue=xVtx;}\r
371 \r
372   /*\r
373    * Sets the YVertexCut value.\r
374    */\r
375   void SetYVertexCut(Double_t yVtx){fCurrentYValue=yVtx;}\r
376 \r
377   /*\r
378    * Sets the ZVertexCut value.\r
379    */\r
380   void SetZVertexCut(Double_t zVtx){fCurrentZValue=zVtx;}\r
381 \r
382   /*\r
383    * Sets the PIDProbabilityCut value for track particles.\r
384    */\r
385   void SetPIDProbability(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb; fPIDProbabilityCutNegativeParticle=pidProb;}\r
386 \r
387   /*\r
388    * Sets the PIDProbability cut value for the negative track.\r
389    */\r
390   void SetPIDProbabilityNegativeParticle(Double_t pidProb){fPIDProbabilityCutNegativeParticle=pidProb;}\r
391 \r
392   /*\r
393    * Sets the PIDProbability cut value for the positive track.\r
394    */\r
395   void SetPIDProbabilityPositiveParticle(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb;}\r
396 \r
397   /*\r
398    * Sets the SigmaMassCut value.\r
399    */\r
400   void SetSigmaMass(Double_t sigmaMass){fNSigmaMass=sigmaMass;}\r
401 \r
402   /*\r
403    * Sets the flag to enable/disable the usage of MC information. \r
404    */\r
405   void SetDoMCTruth(Bool_t doMC){fDoMC = doMC;}\r
406 \r
407   /*\r
408    * Updates the V0 information of the current V0.\r
409    */\r
410   Bool_t UpdateV0Information();\r
411 \r
412   /*\r
413    * Resets the V0 index.\r
414    */\r
415   void ResetV0IndexNumber(){fCurrentV0IndexNumber=0;}\r
416 \r
417   /*\r
418    * Sets the histograms.\r
419    */\r
420   void SetHistograms(AliGammaConversionHistograms *histograms){fHistograms=histograms;}\r
421 \r
422   /*\r
423    * Check for primary vertex.\r
424    */\r
425   Bool_t CheckForPrimaryVertex();\r
426 \r
427   /*\r
428    * Gets a vector of good v0s.\r
429    */\r
430   vector<AliKFParticle> GetCurrentEventGoodV0s() const{return fCurrentEventGoodV0s;}\r
431 \r
432   /*\r
433    * Gets the vector of previous events v0s (for bacground analysis)\r
434    */\r
435   vector<AliKFParticle> GetPreviousEventGoodV0s() const{return fPreviousEventGoodV0s;}\r
436 \r
437  private:\r
438   AliStack * fMCStack;           // pointer to MonteCarlo particle stack \r
439   AliMCEventHandler* fMCTruth;   // pointer to the MC event handler\r
440   TChain * fChain;               // pointer to the TChain\r
441   \r
442   AliESDInputHandler* fESDHandler;      //! pointer to esd object\r
443   AliESDEvent *fESDEvent;               //! pointer to esd object\r
444 \r
445   AliGammaConversionHistograms *fHistograms; //! pointer to histogram handling class\r
446   \r
447   Int_t fCurrentV0IndexNumber;\r
448   AliESDv0 * fCurrentV0;                //! pointer to the current v0\r
449   AliKFParticle * fCurrentNegativeKFParticle;  //! pointer to the negative KF particle\r
450   AliKFParticle * fCurrentPositiveKFParticle;  //! pointer to the positive KF particle\r
451   AliKFParticle * fCurrentMotherKFCandidate;   //! pointer to the positive KF particle\r
452 \r
453   AliESDtrack * fCurrentNegativeESDTrack;      //! pointer to the negative ESD track\r
454   AliESDtrack * fCurrentPositiveESDTrack;      //! pointer to the positive ESD track\r
455  \r
456   TLorentzVector * fNegativeTrackLorentzVector; //! pointer to the negative Track Lorentz Vector\r
457   TLorentzVector * fPositiveTrackLorentzVector; //! pointer to the positive Track Lorentz Vector\r
458   TLorentzVector * fMotherCandidateLorentzVector;   //! pointer to the mother candidate Track Lorentz Vector\r
459 \r
460   Double_t fCurrentXValue;   // current x value\r
461   Double_t fCurrentYValue;   // current y value\r
462   Double_t fCurrentZValue;   // current z value\r
463 \r
464   Int_t fPositiveTrackPID;   // positive track pid\r
465   Int_t fNegativeTrackPID;   // negative track pid\r
466 \r
467   TParticle *fNegativeMCParticle;      //!\r
468   TParticle *fPositiveMCParticle;      //!\r
469   TParticle *fMotherMCParticle;        //!\r
470 \r
471   Double_t fMotherCandidateKFMass;   // mass of mother candidate KF particle\r
472   Double_t fMotherCandidateKFWidth;  // width of mother candidate KF particle\r
473 \r
474   Bool_t fUseKFParticle;   // flag \r
475   Bool_t fUseESDTrack;     // flag \r
476   Bool_t fDoMC;            // flag \r
477 \r
478   //cuts\r
479   Double_t fMaxR; //r cut\r
480   Double_t fEtaCut; //eta cut\r
481   Double_t fPtCut; // pt cut\r
482   Double_t fLineCutZRSlope; //linecut\r
483   Double_t fLineCutZValue; //linecut\r
484   Double_t fChi2CutConversion; //chi2cut\r
485   Double_t fChi2CutMeson;  //chi2cut\r
486   Double_t fPIDProbabilityCutNegativeParticle; //pid cut\r
487   Double_t fPIDProbabilityCutPositiveParticle; //pid cut\r
488   Double_t fXVertexCut; //vertex cut\r
489   Double_t fYVertexCut; //vertex cut\r
490   Double_t fZVertexCut; // vertexcut\r
491   \r
492   Double_t fNSigmaMass; //nsigma cut\r
493   \r
494   Bool_t fUseImprovedVertex; //flag\r
495   \r
496   vector<AliKFParticle> fCurrentEventGoodV0s; //vector of good v0s\r
497   vector<AliKFParticle> fPreviousEventGoodV0s; // vector of good v0s from prevous events\r
498 \r
499   ClassDef(AliV0Reader,2)\r
500 };\r
501 \r
502 \r
503 #endif\r
504 \r
505 \r
506 \r