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