3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
6 ////////////////////////////////////////////////
7 //---------------------------------------------
8 // Class used to do analysis on conversion pairs
9 //---------------------------------------------
10 ////////////////////////////////////////////////
12 // --- ROOT system ---
14 #include "AliMCEvent.h" // for CF
16 #include "AliESDEvent.h"
17 #include "AliKFParticle.h"
18 #include "TParticle.h"
19 #include "AliGammaConversionHistograms.h"
21 #include "AliCFManager.h"
29 //--- AliRoot system ---
32 class AliMCEvent; // for CF
34 class AliMCEventHandler;
35 class AliESDInputHandler;
40 class AliCFManager; // for CF
41 class AliCFContainer; // for CF
42 class AliTPCpidESD; // for dEdx cut based on nSigma to particle lines
45 class AliV0Reader : public TObject {
53 kStepReconstructable = 1,
58 kStepNContributors = 6,
71 AliV0Reader(); //constructor
72 AliV0Reader(const AliV0Reader & g); //copy constructor
73 AliV0Reader & operator = (const AliV0Reader & g); //assignment operator
74 // virtual ~AliV0Reader() {;} //virtual destructor
75 virtual ~AliV0Reader(); //virtual destructor
77 *Initialize the reader
83 void SetCFManager(AliCFManager * const io){fCFManager = io;};
84 AliCFManager *GetCFManager() const {return fCFManager;}
92 AliESDEvent* GetESDEvent() const{return fESDEvent;}
95 *Returns the number of v0s in the event, no cuts applied.
97 Int_t GetNumberOfV0s() const{return fESDEvent->GetNumberOfV0s();}
100 * Check if there are any more good v0s left in the v0 stack
101 * if so, fCurrent v0 is set to this v0 and can be retrieved
102 * by GetCurrentV0 function.
103 * returns kFALSE if there is no more good v0s in the v0 stack
108 * Returns the v0 at the given index, no checks are done on the v0.
110 AliESDv0* GetV0(Int_t index);
113 * Returns the current v0
115 AliESDv0* GetCurrentV0() const{return fCurrentV0;}
118 * Returns the negative ESD track which belongs to fCurrentV0
120 AliESDtrack* GetNegativeESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetNindex());}
123 * Returns the positive ESD track which belongs to fCurrentV0
125 AliESDtrack* GetPositiveESDTrack(){return fESDEvent->GetTrack(fCurrentV0->GetPindex());}
128 * Returns the negative KF particle which belongs to fCurrentV0
130 AliKFParticle* GetNegativeKFParticle() const{return fCurrentNegativeKFParticle;}
133 * Returns the positive KF particle which belongs to fCurrentV0
135 AliKFParticle* GetPositiveKFParticle() const{return fCurrentPositiveKFParticle;}
138 * Returns the KFParticle object of the 2 tracks.
140 AliKFParticle* GetMotherCandidateKFCombination() const{return fCurrentMotherKFCandidate;}
143 * Checks the probablity that the PID of the particle is what we want it to be.
145 Bool_t CheckPIDProbability(Double_t negProbCut, Double_t posProbCut);
148 * Checks if the PID of the two particles are within our cuts.
150 void GetPIDProbability(Double_t &negPIDProb, Double_t &posPIDProb);
153 *Get the negative MC TParticle from the stack
155 TParticle * GetNegativeMCParticle() const{return fNegativeMCParticle;}
158 *Get the positive MC TParticle from the stack
160 TParticle * GetPositiveMCParticle() const{return fPositiveMCParticle;}
163 *Get the mother MC TParticle from the stack
165 TParticle * GetMotherMCParticle() const{return fMotherMCParticle;}
168 * Flag to see if the v0 particles share the same mother
170 Bool_t HasSameMCMother();
174 *Get the PID of the MC mother particle
176 Int_t GetMotherMCParticlePDGCode() const{if(fMotherMCParticle != NULL){ cout<<"MCParticle exists"<<endl;} return fMotherMCParticle->GetPdgCode();}
181 AliStack* GetMCStack() const{return fMCStack;}
185 * Setup AliMCEventHandler
187 AliMCEventHandler* GetMCTruth() const{return fMCTruth;} // for CF
193 AliMCEvent* GetMCEvent() const{return fMCEvent;} // for CF
197 *Get the magnetic field from the ESD event
199 Double_t GetMagneticField() const{return fESDEvent->GetMagneticField();}
202 *Get the primary vertex from the esd event
204 const AliESDVertex *GetPrimaryVertex() const {return fESDEvent->GetPrimaryVertex();}
207 * Set the PID of the negative track
209 void SetNegativeTrackPID(Int_t negTrackPID){fNegativeTrackPID=negTrackPID;}
212 * Set the PID of the positive track
214 void SetPositiveTrackPID(Int_t posTrackPID){fPositiveTrackPID=posTrackPID;}
217 * Set the flag to use the kfparticle class. Will also disable the use of esd tracks
219 void UseKFParticle(){fUseKFParticle = kTRUE; fUseESDTrack = kFALSE;}
222 * Set the flag to use the esd track class. Will also disable the use of kf particles
224 void UseESDTrack(){fUseESDTrack = kTRUE; fUseKFParticle = kFALSE;}
227 * Set the flag to use improved vertex or not
229 void SetUseImprovedVertex(Bool_t useImprovedVertex){fUseImprovedVertex=useImprovedVertex;}
232 * Return the number in the species array belonging to the negative or positive track pid.
234 Int_t GetSpeciesIndex(Int_t chargeOfTrack);
237 * Return the x coordinate of the v0
239 Double_t GetX() const{return fCurrentXValue;}
242 * Return the y coordinate of the v0
244 Double_t GetY() const{return fCurrentYValue;}
247 * Return the Z coordinate of the v0
249 Double_t GetZ() const{return fCurrentZValue;}
252 * Return the radius of the v0
254 Double_t GetXYRadius() const{return sqrt((Double_t)(fCurrentXValue*fCurrentXValue + fCurrentYValue*fCurrentYValue));}
257 * Get the opening angle between the two tracks
259 Double_t GetOpeningAngle(){return fNegativeTrackLorentzVector->Angle(fPositiveTrackLorentzVector->Vect());}
262 * Get the Cos Pointing angle between the two tracks
264 Double_t GetCosPointingAngle(){return fCurrentV0->GetV0CosineOfPointingAngle();}
267 * Get the DCA between the two tracks
269 Double_t GetDcaDaughters(){return fCurrentV0->GetDcaV0Daughters();}
272 * Get the Normalized DCA between the two tracks
274 Double_t GetNormDcaDistDaughters(){return fCurrentV0->GetDcaV0Daughters()/fCurrentV0->GetDistSigma();}
277 * Get the Likelihood for a Conversion
279 Double_t GetLikelihoodAP(){return fCurrentV0->GetLikelihoodAP(0,0);}
282 * Gets the Energy of the negative track.
284 Double_t GetNegativeTrackEnergy() const{return fCurrentNegativeKFParticle->E();}
287 * Gets the Energy of the positive track.
289 Double_t GetPositiveTrackEnergy() const{return fCurrentPositiveKFParticle->E();}
292 * Gets the Energy of the mother candidate.
294 Double_t GetMotherCandidateEnergy() const{return fCurrentMotherKFCandidate->E();}
297 * Gets the Pt of the negative track.
299 Double_t GetNegativeTrackPt() const{return fNegativeTrackLorentzVector->Pt();}
302 * Gets the Pt of the positive track.
304 Double_t GetPositiveTrackPt() const{return fPositiveTrackLorentzVector->Pt();}
308 * Gets the Pt of the mother candidate.
310 Double_t GetMotherCandidatePt() const{return fMotherCandidateLorentzVector->Pt();}
314 * Gets the P of the mother candidate.
316 Double_t GetMotherCandidateP() const{return fMotherCandidateLorentzVector->P();}
320 * Gets the Eta of the negative track.
322 Double_t GetNegativeTrackEta() const{return fNegativeTrackLorentzVector->Eta();}
324 * Gets the Eta of the positive track.
326 Double_t GetPositiveTrackEta() const{return fPositiveTrackLorentzVector->Eta();}
328 * Gets the Eta of the mother candidate.
330 Double_t GetMotherCandidateEta() const{return fMotherCandidateLorentzVector->Eta();}
333 * Gets the NDF of the mother candidate.
335 Double_t GetMotherCandidateNDF() const{return fCurrentMotherKFCandidate->GetNDF();}
338 * Gets the Chi2 of the mother candidate.
340 Double_t GetMotherCandidateChi2() const{return fCurrentMotherKFCandidate->GetChi2();}
343 * Gets the Mass of the mother candidate.
345 Double_t GetMotherCandidateMass() const{return fMotherCandidateKFMass;}
348 * Gets the Width of the mother candidate.
350 Double_t GetMotherCandidateWidth() const{return fMotherCandidateKFWidth;}
353 * Gets the Phi of the negative track.
355 Double_t GetNegativeTrackPhi() const;
358 * Gets the Phi of the positive track.
360 Double_t GetPositiveTrackPhi() const;
363 * Gets the Phi of the mother candidate.
365 Double_t GetMotherCandidatePhi() const;
368 * Gets the Rapidity of the mother candidate.
370 Double_t GetMotherCandidateRapidity() const;
374 * Gets the P of the negative track.
376 Double_t GetNegativeTrackP() const{return fNegativeTrackLorentzVector->P();}
379 * Gets the P of the positive track.
381 Double_t GetPositiveTrackP() const{return fPositiveTrackLorentzVector->P();}
384 * Gets the dE/dx in the TPC of the negative track.
386 Double_t GetNegativeTrackTPCdEdx() const{return fCurrentNegativeESDTrack->GetTPCsignal();}
389 * Gets the dE/dx in the TPC of the positive track.
391 Double_t GetPositiveTrackTPCdEdx() const{return fCurrentPositiveESDTrack->GetTPCsignal();}
394 * Update data which need to be updated every event.
396 void UpdateEventByEventData();
399 * Gets the MaxRCut value.
401 Double_t GetMaxRCut() const{return fMaxR;}
404 * Gets the Eta cut value.
406 Double_t GetEtaCut() const{return fEtaCut;}
409 * Gets the Pt cut value.
411 Double_t GetPtCut() const{return fPtCut;}
415 * Gets the MaxZCut value.
417 Double_t GetMaxZCut() const{return fMaxZ;}
421 * Gets the line cut values.
423 Double_t GetLineCutZRSlope() const{return fLineCutZRSlope;}
424 Double_t GetLineCutZValue() const{return fLineCutZValue;}
427 * Gets the Chi2 cut value for the conversions.
429 Double_t GetChi2CutConversion() const{return fChi2CutConversion;}
432 * Gets the Chi2 cut value for the mesons.
434 Double_t GetChi2CutMeson() const{return fChi2CutMeson;}
436 Double_t GetPositiveTrackLength() const{return fCurrentPositiveESDTrack->GetIntegratedLength();}
437 Double_t GetNegativeTrackLength() const{return fCurrentNegativeESDTrack->GetIntegratedLength();}
439 Double_t GetPositiveNTPCClusters() const{return fCurrentPositiveESDTrack->GetTPCNcls();}
440 Double_t GetNegativeNTPCClusters() const{return fCurrentNegativeESDTrack->GetTPCNcls();}
443 * Sets the MaxRCut value.
445 void SetMaxRCut(Double_t maxR){fMaxR=maxR;}
448 * Sets the EtaCut value.
450 void SetEtaCut(Double_t etaCut){fEtaCut=etaCut;}
453 * Sets the PtCut value.
455 void SetPtCut(Double_t ptCut){fPtCut=ptCut;}
459 * Sets the MaxZCut value.
461 void SetMaxZCut(Double_t maxZ){fMaxZ=maxZ;}
465 * Sets the LineCut values.
467 void SetLineCutZRSlope(Double_t LineCutZRSlope){fLineCutZRSlope=LineCutZRSlope;}
468 void SetLineCutZValue(Double_t LineCutZValue){fLineCutZValue=LineCutZValue;}
471 * Sets the Chi2Cut value for conversions.
473 void SetChi2CutConversion(Double_t chi2){fChi2CutConversion=chi2;}
476 * Sets the Chi2Cut for the mesons.
478 void SetChi2CutMeson(Double_t chi2){fChi2CutMeson=chi2;}
481 * Sets the XVertexCut value.
483 void SetXVertexCut(Double_t xVtx){fCurrentXValue=xVtx;}
486 * Sets the YVertexCut value.
488 void SetYVertexCut(Double_t yVtx){fCurrentYValue=yVtx;}
491 * Sets the ZVertexCut value.
493 void SetZVertexCut(Double_t zVtx){fCurrentZValue=zVtx;}
496 * Sets the PIDProbabilityCut value for track particles.
498 void SetPIDProbability(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb; fPIDProbabilityCutNegativeParticle=pidProb;}
501 * Sets the PIDProbability cut value for the negative track.
503 void SetPIDProbabilityNegativeParticle(Double_t pidProb){fPIDProbabilityCutNegativeParticle=pidProb;}
506 * Sets the PIDProbability cut value for the positive track.
508 void SetPIDProbabilityPositiveParticle(Double_t pidProb){fPIDProbabilityCutPositiveParticle=pidProb;}
511 * Sets the PIDnSigmaAboveElectron cut value for the tracks.
513 void SetPIDnSigmaAboveElectronLine(Double_t nSigmaAbove){fPIDnSigmaAboveElectronLine=nSigmaAbove;}
516 * Sets the PIDnSigmaBelowElectron cut value for the tracks.
518 void SetPIDnSigmaBelowElectronLine(Double_t nSigmaBelow){fPIDnSigmaBelowElectronLine=nSigmaBelow;}
521 * Sets the PIDnSigmaAbovePion cut value for the tracks.
523 void SetPIDnSigmaAbovePionLine(Double_t nSigmaAbovePion){fPIDnSigmaAbovePionLine=nSigmaAbovePion;}
526 * Sets the PIDMinPnSigmaAbovePion cut value for the tracks.
528 void SetPIDMinPnSigmaAbovePionLine(Double_t MinPnSigmaAbovePion){fPIDMinPnSigmaAbovePionLine=MinPnSigmaAbovePion;}
531 * Sets the SigmaMassCut value.
533 void SetSigmaMass(Double_t sigmaMass){fNSigmaMass=sigmaMass;}
536 * Sets the flag to enable/disable the usage of MC information.
538 void SetDoMCTruth(Bool_t doMC){fDoMC = doMC;}
541 * Sets the flag to enable/disable the cut dedx N sigma
544 void SetDodEdxSigmaCut( Bool_t dodEdxSigmaCut){fDodEdxSigmaCut=dodEdxSigmaCut;}
548 * Updates the V0 information of the current V0.
550 Bool_t UpdateV0Information();
553 * Resets the V0 index.
555 void ResetV0IndexNumber(){fCurrentV0IndexNumber=0;}
558 * Sets the histograms.
560 void SetHistograms(AliGammaConversionHistograms * const histograms){fHistograms=histograms;}
563 * Check for primary vertex.
565 Bool_t CheckForPrimaryVertex();
568 * Gets a vector of good v0s.
570 vector<AliKFParticle> GetCurrentEventGoodV0s() const{return fCurrentEventGoodV0s;}
573 * Gets the vector of previous events v0s (for bacground analysis)
575 vector<AliKFParticle> GetPreviousEventGoodV0s() const{return fPreviousEventGoodV0s;}
577 void SetUseOwnXYZCalculation(Bool_t flag){fUseOwnXYZCalculation=flag;}
579 Bool_t GetHelixCenter(AliESDtrack* track, Double_t b,Int_t charge, Double_t center[2]);
581 Bool_t GetConvPosXY(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b, Double_t convpos[2]);
583 Double_t GetConvPosZ(AliESDtrack* ptrack,AliESDtrack* ntrack, Double_t b);
585 void SetDoCF(Bool_t flag){fDoCF = flag;}
589 AliStack * fMCStack; // pointer to MonteCarlo particle stack
590 AliMCEventHandler* fMCTruth; // for CF pointer to the MC object
591 AliMCEvent *fMCEvent; // for CF pointer to MC event
592 TChain * fChain; // pointer to the TChain
594 AliESDInputHandler* fESDHandler; //! pointer to esd object
595 AliESDEvent *fESDEvent; //! pointer to esd object
599 AliCFManager *fCFManager; // pointer to the cf manager
600 // AliCFContainer *container;
602 // for dEdx cut based on nSigma to a particle line
603 AliTPCpidESD * fTPCpid;
605 AliGammaConversionHistograms *fHistograms; //! pointer to histogram handling class
607 Int_t fCurrentV0IndexNumber; // the current v0 index number
608 AliESDv0 * fCurrentV0; //! pointer to the current v0
609 AliKFParticle * fCurrentNegativeKFParticle; //! pointer to the negative KF particle
610 AliKFParticle * fCurrentPositiveKFParticle; //! pointer to the positive KF particle
611 AliKFParticle * fCurrentMotherKFCandidate; //! pointer to the positive KF particle
613 AliESDtrack * fCurrentNegativeESDTrack; //! pointer to the negative ESD track
614 AliESDtrack * fCurrentPositiveESDTrack; //! pointer to the positive ESD track
616 TLorentzVector * fNegativeTrackLorentzVector; //! pointer to the negative Track Lorentz Vector
617 TLorentzVector * fPositiveTrackLorentzVector; //! pointer to the positive Track Lorentz Vector
618 TLorentzVector * fMotherCandidateLorentzVector; //! pointer to the mother candidate Track Lorentz Vector
620 Double_t fCurrentXValue; // current x value
621 Double_t fCurrentYValue; // current y value
622 Double_t fCurrentZValue; // current z value
624 Int_t fPositiveTrackPID; // positive track pid
625 Int_t fNegativeTrackPID; // negative track pid
627 TParticle *fNegativeMCParticle; //!
628 TParticle *fPositiveMCParticle; //!
629 TParticle *fMotherMCParticle; //!
631 Double_t fMotherCandidateKFMass; // mass of mother candidate KF particle
632 Double_t fMotherCandidateKFWidth; // width of mother candidate KF particle
634 Bool_t fUseKFParticle; // flag
635 Bool_t fUseESDTrack; // flag
636 Bool_t fDoMC; // flag
639 Double_t fMaxR; //r cut
640 Double_t fEtaCut; //eta cut
641 Double_t fPtCut; // pt cut
642 Double_t fMaxZ; //z cut
643 Double_t fLineCutZRSlope; //linecut
644 Double_t fLineCutZValue; //linecut
645 Double_t fChi2CutConversion; //chi2cut
646 Double_t fChi2CutMeson; //chi2cut
647 Double_t fPIDProbabilityCutNegativeParticle; //pid cut
648 Double_t fPIDProbabilityCutPositiveParticle; //pid cut
649 Bool_t fDodEdxSigmaCut; // flag to use the dEdxCut based on sigmas
650 Double_t fPIDnSigmaAboveElectronLine;
651 Double_t fPIDnSigmaBelowElectronLine;
652 Double_t fPIDnSigmaAbovePionLine;
653 Double_t fPIDMinPnSigmaAbovePionLine;
654 Double_t fXVertexCut; //vertex cut
655 Double_t fYVertexCut; //vertex cut
656 Double_t fZVertexCut; // vertexcut
658 Double_t fNSigmaMass; //nsigma cut
660 Bool_t fUseImprovedVertex; //flag
662 Bool_t fUseOwnXYZCalculation; //flag that determines if we use our own calculation of xyz (markus)
666 vector<AliKFParticle> fCurrentEventGoodV0s; //vector of good v0s
667 vector<AliKFParticle> fPreviousEventGoodV0s; // vector of good v0s from prevous events
669 ClassDef(AliV0Reader,5)