]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STEER/AliMCParticle.h
#75811 ZDC: changes to be ported to the release
[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);
93836e1b 69 // Navigation
70 Int_t GetMother() const {return fMother;}
71 Int_t GetFirstDaughter() const {return fFirstDaughter;}
72 Int_t GetLastDaughter() const {return fLastDaughter;}
73 void SetMother(Int_t idx) {fMother = idx;}
74 void SetFirstDaughter(Int_t idx) {fFirstDaughter = idx;}
75 void SetLastDaughter(Int_t idx) {fLastDaughter = idx;}
76 void SetLabel(Int_t label) {fLabel = label;}
77
415d9f5c 78 private:
93df0e9b 79 TParticle *fParticle; // The wrapped TParticle
80 TRefArray *fTrackReferences; // Reference array to track references
81 Int_t fNTrackRef; // Number of track references
eee13e8d 82 Int_t fLabel; // fParticle Label in the Stack
93836e1b 83 Int_t fMother; // Mother particles
84 Int_t fFirstDaughter; // First daughter
85 Int_t fLastDaughter; // LastDaughter
415d9f5c 86
87 ClassDef(AliMCParticle,0) // AliVParticle realisation for MCParticles
88};
89
90inline Double_t AliMCParticle::Px() const {return fParticle->Px();}
91inline Double_t AliMCParticle::Py() const {return fParticle->Py();}
92inline Double_t AliMCParticle::Pz() const {return fParticle->Pz();}
93inline Double_t AliMCParticle::Pt() const {return fParticle->Pt();}
94inline Double_t AliMCParticle::P() const {return fParticle->P(); }
95inline Double_t AliMCParticle::OneOverPt() const {return 1. / fParticle->Pt();}
c683ddc2 96inline Bool_t AliMCParticle::PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; }
415d9f5c 97inline Double_t AliMCParticle::Phi() const {return fParticle->Phi();}
98inline Double_t AliMCParticle::Theta() const {return fParticle->Theta();}
c683ddc2 99inline Double_t AliMCParticle::Xv() const {return fParticle->Vx();}
100inline Double_t AliMCParticle::Yv() const {return fParticle->Vy();}
101inline Double_t AliMCParticle::Zv() const {return fParticle->Vz();}
102inline Bool_t AliMCParticle::XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; }
415d9f5c 103inline Double_t AliMCParticle::E() const {return fParticle->Energy();}
104inline Double_t AliMCParticle::Eta() const {return fParticle->Eta();}
105
7162633f 106
415d9f5c 107inline Double_t AliMCParticle::M() const
108{
109 TParticlePDG* pdg = fParticle->GetPDG();
110 if (pdg) {
111 return (pdg->Mass());
112 } else {
113 return (fParticle->GetCalcMass());
114 }
115}
116
117
118inline Double_t AliMCParticle::Y() const
119{
120 Double_t e = E();
6a2ade18 121 Double_t pz = Pz();
122
123 if (e != TMath::Abs(pz)) {
415d9f5c 124 return 0.5*TMath::Log((e+pz)/(e-pz));
125 } else {
126 return -999.;
127 }
128}
129
130inline Short_t AliMCParticle::Charge() const
131{
132 TParticlePDG* pdg = fParticle->GetPDG();
133 if (pdg) {
134 return (Short_t (pdg->Charge()));
135 } else {
136 return -99;
137 }
138}
139
eee13e8d 140inline Int_t AliMCParticle::Label() const {return fLabel;}
141
415d9f5c 142#endif