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