- Three classes by MinJung Kweon AliHFEpriVtx, AliHFEsecVtx and AliHFEmcQA for primar...
[u/mrichter/AliRoot.git] / STEER / AliMCParticle.h
CommitLineData
415d9f5c 1#ifndef AliMCParticle_H
2#define AliMCParticle_H
3/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
8//-------------------------------------------------------------------------
9// AliVParticle realisation for MC Particles
93df0e9b 10// Author: Andreas Morsch, CERN
415d9f5c 11//-------------------------------------------------------------------------
12
13#include <Rtypes.h>
415d9f5c 14#include <TParticle.h>
15#include <TParticlePDG.h>
93df0e9b 16#include <TRefArray.h>
415d9f5c 17
93df0e9b 18#include "AliTrackReference.h"
19#include "AliVParticle.h"
415d9f5c 20
93df0e9b 21class AliMCParticle: public AliVParticle {
415d9f5c 22public:
23 AliMCParticle();
eee13e8d 24 AliMCParticle(TParticle* part, TRefArray* rarray = 0, Int_t label=-1);
f1ac8a97 25 virtual ~AliMCParticle();
415d9f5c 26 AliMCParticle(const AliMCParticle& mcPart);
27 AliMCParticle& operator=(const AliMCParticle& mcPart);
28
93df0e9b 29 // Kinematics
415d9f5c 30 virtual Double_t Px() const;
31 virtual Double_t Py() const;
32 virtual Double_t Pz() const;
33 virtual Double_t Pt() const;
34 virtual Double_t P() const;
c683ddc2 35 virtual Bool_t PxPyPz(Double_t p[3]) const;
36
415d9f5c 37 virtual Double_t OneOverPt() const;
38 virtual Double_t Phi() const;
39 virtual Double_t Theta() const;
40
7162633f 41 virtual Double_t Xv() const;
42 virtual Double_t Yv() const;
43 virtual Double_t Zv() const;
c683ddc2 44 virtual Bool_t XvYvZv(Double_t x[3]) const;
45
eee13e8d 46 virtual Double_t E() const;
47 virtual Double_t M() const;
415d9f5c 48
eee13e8d 49 virtual Double_t Eta() const;
50 virtual Double_t Y() const;
415d9f5c 51
eee13e8d 52 virtual Short_t Charge() const;
53
7162633f 54 virtual Int_t Label() const;
55 virtual Int_t GetLabel() const {return Label();}
56 virtual Int_t PdgCode() const {return fParticle->GetPdgCode();}
57 virtual TParticle* Particle() const {return fParticle;}
58
415d9f5c 59 // PID
60 virtual const Double_t *PID() const {return 0;} // return PID object (to be defined, still)
93df0e9b 61
62 // Track References
63 Int_t GetNumberOfTrackReferences() {return fNTrackRef;}
64 AliTrackReference* GetTrackReference(Int_t i)
f1ac8a97 65 {return dynamic_cast<AliTrackReference*>((*fTrackReferences)[i]);}
7162633f 66
67 // "Trackable" criteria
68 Float_t GetTPCTrackLength(Float_t bz, Float_t ptmin, Int_t &counter, Float_t deadWidth);
69
415d9f5c 70 private:
93df0e9b 71 TParticle *fParticle; // The wrapped TParticle
72 TRefArray *fTrackReferences; // Reference array to track references
73 Int_t fNTrackRef; // Number of track references
eee13e8d 74 Int_t fLabel; // fParticle Label in the Stack
415d9f5c 75
76 ClassDef(AliMCParticle,0) // AliVParticle realisation for MCParticles
77};
78
79inline Double_t AliMCParticle::Px() const {return fParticle->Px();}
80inline Double_t AliMCParticle::Py() const {return fParticle->Py();}
81inline Double_t AliMCParticle::Pz() const {return fParticle->Pz();}
82inline Double_t AliMCParticle::Pt() const {return fParticle->Pt();}
83inline Double_t AliMCParticle::P() const {return fParticle->P(); }
84inline Double_t AliMCParticle::OneOverPt() const {return 1. / fParticle->Pt();}
c683ddc2 85inline Bool_t AliMCParticle::PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; }
415d9f5c 86inline Double_t AliMCParticle::Phi() const {return fParticle->Phi();}
87inline Double_t AliMCParticle::Theta() const {return fParticle->Theta();}
c683ddc2 88inline Double_t AliMCParticle::Xv() const {return fParticle->Vx();}
89inline Double_t AliMCParticle::Yv() const {return fParticle->Vy();}
90inline Double_t AliMCParticle::Zv() const {return fParticle->Vz();}
91inline Bool_t AliMCParticle::XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; }
415d9f5c 92inline Double_t AliMCParticle::E() const {return fParticle->Energy();}
93inline Double_t AliMCParticle::Eta() const {return fParticle->Eta();}
94
7162633f 95
415d9f5c 96inline Double_t AliMCParticle::M() const
97{
98 TParticlePDG* pdg = fParticle->GetPDG();
99 if (pdg) {
100 return (pdg->Mass());
101 } else {
102 return (fParticle->GetCalcMass());
103 }
104}
105
106
107inline Double_t AliMCParticle::Y() const
108{
109 Double_t e = E();
6a2ade18 110 Double_t pz = Pz();
111
112 if (e != TMath::Abs(pz)) {
415d9f5c 113 return 0.5*TMath::Log((e+pz)/(e-pz));
114 } else {
115 return -999.;
116 }
117}
118
119inline Short_t AliMCParticle::Charge() const
120{
121 TParticlePDG* pdg = fParticle->GetPDG();
122 if (pdg) {
123 return (Short_t (pdg->Charge()));
124 } else {
125 return -99;
126 }
127}
128
eee13e8d 129inline Int_t AliMCParticle::Label() const {return fLabel;}
130
415d9f5c 131#endif