Line data Source code
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
10 : // Author: Andreas Morsch, CERN
11 : //-------------------------------------------------------------------------
12 :
13 : #include <Rtypes.h>
14 : #include <TParticle.h>
15 : #include <TParticlePDG.h>
16 : #include <TObjArray.h>
17 :
18 : #include "AliTrackReference.h"
19 : #include "AliVParticle.h"
20 :
21 : class AliMCParticle: public AliVParticle {
22 : public:
23 : AliMCParticle();
24 : AliMCParticle(TParticle* part, TObjArray* rarray = 0, Int_t label=-1);
25 : virtual ~AliMCParticle();
26 : AliMCParticle(const AliMCParticle& mcPart);
27 : AliMCParticle& operator=(const AliMCParticle& mcPart);
28 :
29 : // Kinematics
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;
35 : virtual Bool_t PxPyPz(Double_t p[3]) const;
36 :
37 : virtual Double_t OneOverPt() const;
38 : virtual Double_t Phi() const;
39 : virtual Double_t Theta() const;
40 :
41 : virtual Double_t Xv() const;
42 : virtual Double_t Yv() const;
43 : virtual Double_t Zv() const;
44 : virtual Bool_t XvYvZv(Double_t x[3]) const;
45 : virtual Double_t T() const;
46 :
47 : virtual Double_t E() const;
48 : virtual Double_t M() const;
49 :
50 : virtual Double_t Eta() const;
51 : virtual Double_t Y() const;
52 :
53 : virtual Short_t Charge() const;
54 :
55 : virtual Int_t Label() const;
56 0 : virtual Int_t GetLabel() const {return Label();}
57 0 : virtual Int_t PdgCode() const {return fParticle->GetPdgCode();}
58 14386 : virtual TParticle* Particle() const {return fParticle;}
59 :
60 : // PID
61 0 : virtual const Double_t *PID() const {return 0;} // return PID object (to be defined, still)
62 :
63 : // Track References
64 0 : Int_t GetNumberOfTrackReferences() const {return fNTrackRef;}
65 : AliTrackReference* GetTrackReference(Int_t i)
66 0 : {return dynamic_cast<AliTrackReference*>((*fTrackReferences)[i]);}
67 :
68 : // "Trackable" criteria
69 : Float_t GetTPCTrackLength(Float_t bz, Float_t ptmin, Int_t &counter, Float_t deadWidth, Float_t zMax=230. );
70 : // Navigation
71 2530 : virtual Int_t GetMother() const {return fMother;}
72 4736 : Int_t GetFirstDaughter() const {return fFirstDaughter;}
73 4736 : Int_t GetLastDaughter() const {return fLastDaughter;}
74 4298 : void SetMother(Int_t idx) {fMother = idx;}
75 4298 : void SetFirstDaughter(Int_t idx) {fFirstDaughter = idx;}
76 4298 : void SetLastDaughter(Int_t idx) {fLastDaughter = idx;}
77 0 : void SetLabel(Int_t label) {fLabel = label;}
78 4298 : virtual void SetGeneratorIndex(Short_t i) {fGeneratorIndex = i;}
79 438 : virtual Short_t GetGeneratorIndex() const {return fGeneratorIndex;}
80 :
81 : private:
82 : TParticle *fParticle; // The wrapped TParticle
83 : TObjArray *fTrackReferences; // Array to track references
84 : Int_t fNTrackRef; // Number of track references
85 : Int_t fLabel; // fParticle Label in the Stack
86 : Int_t fMother; // Mother particles
87 : Int_t fFirstDaughter; // First daughter
88 : Int_t fLastDaughter; // LastDaughter
89 : Short_t fGeneratorIndex; // !Generator index in cocktail
90 176 : ClassDef(AliMCParticle,0) // AliVParticle realisation for MCParticles
91 : };
92 :
93 0 : inline Double_t AliMCParticle::Px() const {return fParticle->Px();}
94 0 : inline Double_t AliMCParticle::Py() const {return fParticle->Py();}
95 0 : inline Double_t AliMCParticle::Pz() const {return fParticle->Pz();}
96 0 : inline Double_t AliMCParticle::Pt() const {return fParticle->Pt();}
97 0 : inline Double_t AliMCParticle::P() const {return fParticle->P(); }
98 0 : inline Double_t AliMCParticle::OneOverPt() const {return 1. / fParticle->Pt();}
99 0 : inline Bool_t AliMCParticle::PxPyPz(Double_t p[3]) const { p[0] = Px(); p[1] = Py(); p[2] = Pz(); return kTRUE; }
100 0 : inline Double_t AliMCParticle::Phi() const {return fParticle->Phi();}
101 0 : inline Double_t AliMCParticle::Theta() const {return fParticle->Theta();}
102 0 : inline Double_t AliMCParticle::Xv() const {return fParticle->Vx();}
103 0 : inline Double_t AliMCParticle::Yv() const {return fParticle->Vy();}
104 0 : inline Double_t AliMCParticle::Zv() const {return fParticle->Vz();}
105 0 : inline Bool_t AliMCParticle::XvYvZv(Double_t x[3]) const { x[0] = Xv(); x[1] = Yv(); x[2] = Zv(); return kTRUE; }
106 0 : inline Double_t AliMCParticle::T() const {return fParticle->T();}
107 0 : inline Double_t AliMCParticle::E() const {return fParticle->Energy();}
108 0 : inline Double_t AliMCParticle::Eta() const {return fParticle->Eta();}
109 :
110 :
111 : inline Double_t AliMCParticle::M() const
112 : {
113 0 : TParticlePDG* pdg = fParticle->GetPDG();
114 0 : if (pdg) {
115 0 : return (pdg->Mass());
116 : } else {
117 0 : return (fParticle->GetCalcMass());
118 : }
119 0 : }
120 :
121 :
122 : inline Double_t AliMCParticle::Y() const
123 : {
124 0 : Double_t e = E();
125 0 : Double_t pz = Pz();
126 :
127 0 : if ( TMath::Abs(e - TMath::Abs(pz)) > FLT_EPSILON ) {
128 0 : return 0.5*TMath::Log((e+pz)/(e-pz));
129 : } else {
130 0 : return -999.;
131 : }
132 0 : }
133 :
134 : inline Short_t AliMCParticle::Charge() const
135 : {
136 0 : TParticlePDG* pdg = fParticle->GetPDG();
137 0 : if (pdg) {
138 0 : return (Short_t (pdg->Charge()));
139 : } else {
140 0 : return -99;
141 : }
142 0 : }
143 :
144 0 : inline Int_t AliMCParticle::Label() const {return fLabel;}
145 :
146 : #endif
|