]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliAODMCParticle.h
Print() implemented.
[u/mrichter/AliRoot.git] / STEER / AliAODMCParticle.h
1 #ifndef AliAODMCParticle_H
2 #define AliAODMCParticle_H
3 /* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6
7 //-------------------------------------------------------------------------
8 //     AliVParticle realisation for MC Particles in the AOD
9 //     Stripped dow AliMCParticle
10 //     Author: Christian Klein Bösing, CERN
11 //-------------------------------------------------------------------------
12
13 #include <Rtypes.h>
14 #include <TParticlePDG.h>
15 #include <TExMap.h>
16 #include <TString.h>
17
18
19 #include "AliTrackReference.h"
20 #include "AliVParticle.h"
21 #include "AliMCParticle.h"
22
23 class AliAODEvent;
24 class TParticle;
25 class TClonesArray;
26
27 class AliAODMCParticle: public AliVParticle {
28  public:
29   AliAODMCParticle();
30   AliAODMCParticle(AliMCParticle* part, Int_t label=0,Int_t flag = 0);
31   virtual ~AliAODMCParticle(){};
32   AliAODMCParticle(const AliAODMCParticle& mcPart); 
33   AliAODMCParticle& operator=(const AliAODMCParticle& mcPart);
34   
35   // Kinematics
36     virtual Double_t Px()        const;
37     virtual Double_t Py()        const;
38     virtual Double_t Pz()        const;
39     virtual Double_t Pt()        const;
40     virtual Double_t P()         const;
41     virtual Bool_t   PxPyPz(Double_t p[3]) const;
42     
43     virtual Double_t OneOverPt() const;
44     virtual Double_t Phi()       const;
45     virtual Double_t Theta()     const;
46     
47     virtual Double_t Xv() const;
48     virtual Double_t Yv() const;
49     virtual Double_t Zv() const;
50     virtual Bool_t   XvYvZv(Double_t x[3]) const;  
51     virtual Double_t T() const;
52
53     virtual Double_t E()          const;
54     virtual Double_t M()          const;
55     
56     virtual Double_t Eta()        const;
57     virtual Double_t Y()          const;
58     
59     virtual Short_t Charge()      const;
60
61     virtual Int_t   Label()       const;
62     virtual Int_t   GetLabel()    const {return Label();} 
63             
64     // PID
65     virtual const Double_t *PID() const {return 0;} // return PID object (to be defined, still)
66
67     // 
68     virtual Double_t GetCalcMass() const;
69     virtual void SetDaughter(Int_t i,Int_t id){if(i<2)fDaughter[i] = id;}
70     virtual Int_t GetDaughter(Int_t i) const {return fDaughter[i];}
71     virtual Int_t GetNDaughters  () const { return fDaughter[1]>0 ? fDaughter[1]-fDaughter[0]+1 : 0;}
72     virtual void SetMother(Int_t im){fMother = im;}
73     virtual Int_t GetMother() const {return fMother;}
74     virtual void Print(const Option_t *opt = "") const;
75     virtual Int_t GetPdgCode() const { return fPdgCode;}
76
77     enum { kPrimary = 1<<0, kPhysicalPrim = 1<<1 };
78     void SetFlag(Int_t flag){fFlag = flag;}
79     Int_t GetFlag() const {return fFlag;}
80
81     // Bitwise operations
82     void SetPrimary(Bool_t b = kTRUE){
83       if(b)fFlag |= kPrimary;
84       else fFlag &= ~kPrimary;
85     }
86     Bool_t IsPrimary() const {return ((fFlag&kPrimary)==kPrimary);} 
87
88     void SetPhysicalPrimary(Bool_t b = kTRUE){
89      if(b)fFlag |= kPhysicalPrim;
90      else fFlag &= ~kPhysicalPrim; 
91     } 
92     Bool_t IsPhysicalPrimary() const {return ((fFlag&kPhysicalPrim)==kPhysicalPrim);} 
93     static const char* StdBranchName(){return fgkStdBranchName.Data();}
94
95  private:
96
97     static TString fgkStdBranchName;      // Standard branch name
98
99
100   Int_t            fPdgCode;              // PDG code of the particle
101   Int_t            fFlag;                 // Flag for indication of primary etc
102   Int_t            fLabel;                // Label of the original MCParticle 
103   Int_t            fMother;               // Index of the mother particles
104   Int_t            fDaughter[2];          // Indices of the daughter particles
105   Double32_t       fPx;                   // x component of momentum
106   Double32_t       fPy;                   // y component of momentum
107   Double32_t       fPz;                   // z component of momentum
108   Double32_t       fE;                    // [0.,0.,12]
109
110   Double32_t       fVx;                   // [0.,0.,12] x of production vertex
111   Double32_t       fVy;                   // [0.,0.,12] y of production vertex
112   Double32_t       fVz;                   // [0.,0.,12] z of production vertex
113   Double32_t       fVt;                   // [0.,0.,12] t of production vertex
114
115   // Copy the uniquID to another data member? unique ID is correctly handled 
116   // via TOBject Copy construct but not by AliVParticle ctor (no passing of 
117   // TParicles
118   // Need a flag for primaries?
119
120   /*
121     const TMCProcess kMCprocesses[kMaxMCProcess] =
122     {
123      kPNoProcess, kPMultipleScattering, kPEnergyLoss, kPMagneticFieldL,
124      kPDecay, kPPair, kPCompton, kPPhotoelectric, kPBrem, kPDeltaRay,
125      kPAnnihilation, kPHadronic, kPNoProcess, kPEvaporation, kPNuclearFission,
126      kPNuclearAbsorption, kPPbarAnnihilation, kPNCapture, kPHElastic,
127      kPHInhelastic, kPMuonNuclear, kPTOFlimit,kPPhotoFission, kPNoProcess,
128      kPRayleigh, kPNoProcess, kPNoProcess, kPNoProcess, kPNull, kPStop
129     };
130   */
131
132  
133
134
135   ClassDef(AliAODMCParticle,3)  // AliVParticle realisation for AODMCParticles
136
137 };
138
139 inline Double_t AliAODMCParticle::Px()        const {return fPx;}
140 inline Double_t AliAODMCParticle::Py()        const {return fPy;}
141 inline Double_t AliAODMCParticle::Pz()        const {return fPz;}
142 inline Double_t AliAODMCParticle::Pt()        const {return TMath::Sqrt(fPx*fPx+fPy*fPy);}
143 inline Double_t AliAODMCParticle::P()         const {return TMath::Sqrt(fPx*fPx+fPy*fPy+fPz*fPz); }
144 inline Double_t AliAODMCParticle::OneOverPt() const {return 1. / Pt();}
145 inline Bool_t   AliAODMCParticle::PxPyPz(Double_t p[3]) const { p[0] = fPx; p[1] = fPy; p[2] = fPz; return kTRUE; }
146 inline Double_t AliAODMCParticle::Phi()       const {return TMath::Pi()+TMath::ATan2(-fPy,-fPx); }  // note that Phi() returns an angle between 0 and 2pi
147 inline Double_t AliAODMCParticle::Theta()     const {return (fPz==0)?TMath::PiOver2():TMath::ACos(fPz/P()); }
148 inline Double_t AliAODMCParticle::Xv()        const {return fVx;}
149 inline Double_t AliAODMCParticle::Yv()        const {return fVy;}
150 inline Double_t AliAODMCParticle::Zv()        const {return fVz;}
151 inline Bool_t   AliAODMCParticle::XvYvZv(Double_t x[3]) const { x[0] = fVx; x[1] = fVy; x[2] = fVz; return kTRUE; }
152 inline Double_t AliAODMCParticle::T()         const {return fVt;}
153 inline Double_t AliAODMCParticle::E()         const {return fE;}
154 inline Double_t AliAODMCParticle::Eta()       const {  
155   Double_t pmom = P();
156   if (pmom != TMath::Abs(fPz)) return 0.5*TMath::Log((pmom+fPz)/(pmom-fPz));
157   else                         return 1.e30;
158 }
159
160
161 inline Double_t AliAODMCParticle::Y()         const 
162 {
163     Double_t e  = E();
164     Double_t pz = Pz();
165     
166     if (e > TMath::Abs(pz)) { 
167         return 0.5*TMath::Log((e+pz)/(e-pz));
168     } else { 
169         return -999.;
170     }
171 }
172
173 inline Int_t AliAODMCParticle::Label()       const {return fLabel;}
174
175 inline Double_t AliAODMCParticle::GetCalcMass() const {
176
177   Double_t m2 = E()*E()-Px()*Px()-Py()*Py()-Pz()*Pz();
178   if(m2<0)return 0;
179   return TMath::Sqrt(m2);
180 }
181
182
183 #endif