AliRoot Core  3dc7879 (3dc7879)
AliGenerator.h
Go to the documentation of this file.
1 #ifndef ALIGENERATOR_H
2 #define ALIGENERATOR_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice */
5 
6 /* $Id$ */
7 
9 // //
10 // Class to generate the particles for the MC //
11 // The base class is empty //
12 // //
14 
15 #include <TArrayF.h>
16 #include <TLorentzVector.h>
17 #include <TMCProcess.h>
18 
19 #include "AliRndm.h"
20 
21 class AliVertexGenerator;
23 class AliGenEventHeader;
24 class AliStack;
25 class TGenerator;
26 
27 
28 
31 
32 
33 class AliGenerator : public TNamed, public AliRndm
34 {
35 
36  public:
37 
38  AliGenerator();
39  AliGenerator(Int_t npart);
40  virtual ~AliGenerator();
41  virtual void Init();
42  virtual void SetOrigin(Float_t ox, Float_t oy, Float_t oz);
43  virtual void SetOrigin(const TLorentzVector &o);
44  virtual void SetSigma(Float_t sx, Float_t sy, Float_t sz);
45  virtual void SetSigmaZ(Float_t sz) {fOsigma[2] = sz;}
46  virtual void SetMomentumRange(Float_t pmin=0, Float_t pmax=1.e10);
47  virtual void SetPtRange(Float_t ptmin=0, Float_t ptmax=1.e10);
48  virtual void SetPhiRange(Float_t phimin = 0., Float_t phimax = 360.);
49  virtual void SetYRange(Float_t ymin=-100, Float_t ymax=100);
50  virtual void SetVRange(Float_t vxmin, Float_t vxmax,
51  Float_t vymin, Float_t vymax,
52  Float_t vzmin, Float_t vzmax);
53  virtual void SetNumberParticles(Int_t npart=100) {fNpart=npart;}
54  virtual Int_t NumberParticles() const {return fNpart;}
55  virtual void SetThetaRange(Float_t thetamin=0, Float_t thetamax=180);
56  virtual void GenerateN(Int_t ntimes);
57  virtual void Generate()=0;
58  virtual void SetParentWeight(Float_t wgt) {fParentWeight=wgt;}
59  virtual void SetChildWeight(Float_t wgt) {fChildWeight=wgt;}
60  virtual void SetAnalog(Int_t flag=1) {fAnalog=flag;}
61  virtual void SetVertexSmear(VertexSmear_t smear) {fVertexSmear = smear;}
62  virtual void SetCutVertexZ(Float_t cut=999999.) {fCutVertexZ = cut;}
63  virtual void SetVertexSource(VertexSource_t source = kInternal) {fVertexSource = source;}
64  virtual void SetVertex(Float_t vx, Float_t vy, Float_t vz, Float_t t = 0)
65  {fVertex[0] = vx; fVertex[1] = vy; fVertex[2] = vz; fTime = t;}
66  void SetVertexGenerator(AliVertexGenerator* vertexGenerator)
69  void SetPileUpTimeWindow(Float_t pileUpTimeW) {fPileUpTimeWindow = pileUpTimeW;}
70  virtual void SetTime(Float_t time)
71  {fTime = time;}
72  virtual void SetTimeOrigin(Float_t timeorig)
73  {fTimeOrigin = timeorig;}
74 
75  virtual void SetTrackingFlag(Int_t flag=1) {fTrackIt=flag;}
76  void Vertex();
77  void VertexExternal();
78  virtual void VertexInternal();
79  virtual void FinishRun();
80  virtual void SetMC(TGenerator *theMC) {fMCEvGen =theMC;}
81  virtual TGenerator* GetMC() const {return fMCEvGen;}
82  virtual void AddHeader(AliGenEventHeader* /*header*/) {;}
83  virtual void SetContainer(AliGenerator* container) {fContainer = container;}
84  virtual void SetEventPlane(Float_t evPlane) {fEvPlane = evPlane; }
85 
86  // Getters
87 
88  virtual void GetOrigin(Float_t &ox, Float_t &oy, Float_t &oz) const
89  {ox=fOrigin.At(0);oy=fOrigin.At(1);oz=fOrigin.At(2);}
90  virtual void GetOrigin(TLorentzVector &o) const
91  {o[0]=fOrigin.At(0);o[1]=fOrigin.At(1);o[2]=fOrigin.At(2);o[3]=0;}
92  // Stack
93  void SetStack (AliStack *stack) {fStack = stack;}
94  AliStack* GetStack(){return fStack;}
95  // Collision Geometry
96  virtual Bool_t ProvidesCollisionGeometry() const {return kFALSE;}
97  virtual Bool_t NeedsCollisionGeometry() const {return kFALSE;}
100 
101  virtual Float_t GetEnergyCMS() const { return fEnergyCMS; }
102  virtual void SetEnergyCMS(Float_t energy = 0) { fEnergyCMS = energy; }
103  virtual void GetProjectile(TString& tar, Int_t& a, Int_t& z) const
104  {tar = fProjectile; a = fAProjectile; z = fZProjectile;}
105  virtual void GetTarget(TString& tar, Int_t& a, Int_t& z) const
106  {tar = fTarget; a = fATarget; z = fZTarget;}
107  virtual void SetProjectile(TString proj="", Int_t a = 0, Int_t z = 0)
109  virtual void SetTarget(TString tar="", Int_t a = 0, Int_t z = 0)
110  {fTarget = tar; fATarget = a; fZTarget = z;}
111 
112  virtual void SetSeed(UInt_t seed);
113 
114  protected:
115  virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
116  Float_t *pmom, Float_t *vpos, Float_t *polar,
117  Float_t tof, TMCProcess mech, Int_t &ntr,
118  Float_t weight = 1, Int_t is = 0);
119  virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg,
120  Double_t px, Double_t py, Double_t pz, Double_t e,
121  Double_t vx, Double_t vy, Double_t vz, Double_t tof,
122  Double_t polx, Double_t poly, Double_t polz,
123  TMCProcess mech, Int_t &ntr, Float_t weight = 1, Int_t is = 0);
124  virtual void KeepTrack(Int_t itrack);
125  virtual void SetHighWaterMark(Int_t nt);
126 
127  protected:
128  TGenerator* fMCEvGen;
129  Float_t fThetaMin; //Minimum theta of generation in radians
130  Float_t fThetaMax; //Maximum theta of generation in radians
131  Float_t fPhiMin; //Minimum phi of generation in radians
132  Float_t fPhiMax; //Maximum phi of generation in radians
133  Float_t fPMin; //Minimum momentum of generation in GeV/c
134  Float_t fPMax; //Minimum momentum of generation in GeV/c
135  Float_t fPtMin; //Minimum transverse momentum
136  Float_t fPtMax; //Maximum transverse momentum
137  Float_t fYMin; //Minimum rapidity
138  Float_t fYMax; //Maximum rapidity
139  TArrayF fVMin; //Minimum Decaylength
140  TArrayF fVMax; //Minimum Decaylength
141  Int_t fNpart; //Maximum number of particles per event
142  Float_t fParentWeight; //Parent Weight
143  Float_t fChildWeight; //ChildWeight
144  Int_t fAnalog; //Flag for anolog or pt-weighted generation
145  //
146  VertexSmear_t fVertexSmear; //Vertex Smearing mode
147  VertexSource_t fVertexSource; //Vertex source (internal/external)
148  Float_t fCutVertexZ; //Vertex cut in units of sigma_z
149  Float_t fPileUpTimeWindow; //Time window for pile-up events
150  Int_t fTrackIt; // if 1, Track final state particles
152  TArrayF fOrigin; // Origin of event
153  TArrayF fOsigma; // Sigma of the Origin of event
154  TArrayF fVertex;
155 
156  Float_t fTimeOrigin; // Time0 origin in a run or event sample
157  Float_t fTime; // Event time smeared around time0 origin using sigma vertex
158  Float_t fEvPlane; // the event plane
159 
162 
164  /*************************************************************************/
165  enum {kThetaRange = BIT(14),
166  kVertexRange = BIT(15),
167  kPhiRange = BIT(16),
168  kPtRange = BIT(17),
169  kYRange = BIT(18),
170  kMomentumRange = BIT(19),
171  kEtaRange = BIT(20)
172  };
173 
174  Float_t fEnergyCMS; // Centre of mass energy
175  Int_t fAProjectile; // Projectile A
176  Int_t fZProjectile; // Projectile Z
177  Int_t fATarget; // Target A
178  Int_t fZTarget; // Target Z
179  TString fProjectile; // Projectile
180  TString fTarget; // Target
181 
182  private:
183  AliGenerator(const AliGenerator &gen);
185 
186  ClassDef(AliGenerator,6) // Base class for event generators
187 };
188 
189 #endif
190 
191 
192 
193 
194 
195 
196 
197 
198 
199 
200 
201 
202 
203 
void SetStack(AliStack *stack)
Definition: AliGenerator.h:93
virtual void SetChildWeight(Float_t wgt)
Definition: AliGenerator.h:59
virtual void GenerateN(Int_t ntimes)
virtual void SetAnalog(Int_t flag=1)
Definition: AliGenerator.h:60
Float_t fThetaMin
Pointer to the generator.
Definition: AliGenerator.h:129
virtual void SetSeed(UInt_t seed)
virtual void SetMC(TGenerator *theMC)
Definition: AliGenerator.h:80
virtual void SetCollisionGeometry(AliCollisionGeometry *geom)
Definition: AliGenerator.h:99
AliGenerator & operator=(const AliGenerator &gen)
virtual void GetTarget(TString &tar, Int_t &a, Int_t &z) const
Definition: AliGenerator.h:105
const Int_t nt
Definition: pdfIO.C:2
virtual Int_t NumberParticles() const
Definition: AliGenerator.h:54
Float_t fYMin
Definition: AliGenerator.h:137
virtual void SetParentWeight(Float_t wgt)
Definition: AliGenerator.h:58
virtual void SetVertexSource(VertexSource_t source=kInternal)
Definition: AliGenerator.h:63
Float_t fPMin
Definition: AliGenerator.h:133
Float_t fEvPlane
Definition: AliGenerator.h:158
virtual void SetPtRange(Float_t ptmin=0, Float_t ptmax=1.e10)
Int_t fZProjectile
Definition: AliGenerator.h:176
virtual Float_t GetEnergyCMS() const
Definition: AliGenerator.h:101
AliStack * GetStack()
Definition: AliGenerator.h:94
virtual void FinishRun()
virtual void SetNumberParticles(Int_t npart=100)
Definition: AliGenerator.h:53
virtual TGenerator * GetMC() const
Definition: AliGenerator.h:81
virtual void SetMomentumRange(Float_t pmin=0, Float_t pmax=1.e10)
VertexSource_t
Definition: AliGenerator.h:30
TGenerator * fMCEvGen
Definition: AliGenerator.h:128
Float_t fPhiMax
Definition: AliGenerator.h:132
TVectorD vz
Definition: driftITSTPC.C:87
virtual void GetOrigin(Float_t &ox, Float_t &oy, Float_t &oz) const
Definition: AliGenerator.h:88
Float_t fCutVertexZ
Definition: AliGenerator.h:148
virtual void SetEnergyCMS(Float_t energy=0)
Definition: AliGenerator.h:102
virtual ~AliGenerator()
virtual void SetHighWaterMark(Int_t nt)
VertexSmear_t
Definition: AliGenerator.h:29
virtual void SetProjectile(TString proj="", Int_t a=0, Int_t z=0)
Definition: AliGenerator.h:107
TArrayF fVMax
Definition: AliGenerator.h:140
virtual void GetProjectile(TString &tar, Int_t &a, Int_t &z) const
Definition: AliGenerator.h:103
Float_t fEnergyCMS
Definition: AliGenerator.h:174
virtual void SetCutVertexZ(Float_t cut=999999.)
Definition: AliGenerator.h:62
TString fTarget
Definition: AliGenerator.h:180
Float_t fYMax
Definition: AliGenerator.h:138
Float_t fChildWeight
Definition: AliGenerator.h:143
Float_t fPhiMin
Definition: AliGenerator.h:131
void VertexExternal()
void SetPileUpTimeWindow(Float_t pileUpTimeW)
Definition: AliGenerator.h:69
virtual Bool_t NeedsCollisionGeometry() const
Definition: AliGenerator.h:97
AliCollisionGeometry * fCollisionGeometry
Local pointer to container.
Definition: AliGenerator.h:163
VertexSource_t fVertexSource
Definition: AliGenerator.h:147
void gen(Int_t nev=1, const char *genConfig="$ALICE_ROOT/MUON/macros/genTestConfig.C")
Definition: gen.C:45
TArrayF fVMin
Definition: AliGenerator.h:139
virtual void SetContainer(AliGenerator *container)
Definition: AliGenerator.h:83
Float_t fPileUpTimeWindow
Definition: AliGenerator.h:149
Float_t fTime
Definition: AliGenerator.h:157
virtual void SetOrigin(Float_t ox, Float_t oy, Float_t oz)
virtual void SetTime(Float_t time)
Definition: AliGenerator.h:70
void polar()
Definition: polar.C:2
virtual void KeepTrack(Int_t itrack)
virtual void SetPhiRange(Float_t phimin=0., Float_t phimax=360.)
Int_t fAProjectile
Definition: AliGenerator.h:175
virtual AliCollisionGeometry * CollisionGeometry() const
Definition: AliGenerator.h:98
Float_t fThetaMax
Definition: AliGenerator.h:130
const int ntimes
Definition: kNNSpeed.C:14
Float_t fPtMax
Definition: AliGenerator.h:136
void SetVertexGenerator(AliVertexGenerator *vertexGenerator)
Definition: AliGenerator.h:66
virtual void SetVRange(Float_t vxmin, Float_t vxmax, Float_t vymin, Float_t vymax, Float_t vzmin, Float_t vzmax)
static UInt_t seed
Definition: pdc06_config.C:131
virtual void SetYRange(Float_t ymin=-100, Float_t ymax=100)
virtual void SetVertexSmear(VertexSmear_t smear)
Definition: AliGenerator.h:61
virtual void Generate()=0
AliVertexGenerator * fVertexGenerator
Definition: AliGenerator.h:151
TArrayF fVertex
Definition: AliGenerator.h:154
VertexSmear_t fVertexSmear
Definition: AliGenerator.h:146
virtual void GetOrigin(TLorentzVector &o) const
Definition: AliGenerator.h:90
virtual void SetTrackingFlag(Int_t flag=1)
Definition: AliGenerator.h:75
virtual Bool_t ProvidesCollisionGeometry() const
Definition: AliGenerator.h:96
TString fProjectile
Definition: AliGenerator.h:179
Float_t fPtMin
Definition: AliGenerator.h:135
virtual void AddHeader(AliGenEventHeader *)
Definition: AliGenerator.h:82
virtual void Init()
AliVertexGenerator * GetVertexGenerator() const
Definition: AliGenerator.h:68
virtual void SetSigma(Float_t sx, Float_t sy, Float_t sz)
virtual void SetThetaRange(Float_t thetamin=0, Float_t thetamax=180)
TEveProjectionManager * proj
Definition: tpc_tracks.C:9
TArrayF fOrigin
Generator for the vertex.
Definition: AliGenerator.h:152
TCut cut
Definition: MakeGlobalFit.C:75
TArrayF fOsigma
Definition: AliGenerator.h:153
Float_t fParentWeight
Definition: AliGenerator.h:142
virtual void VertexInternal()
virtual void SetVertex(Float_t vx, Float_t vy, Float_t vz, Float_t t=0)
Definition: AliGenerator.h:64
TEveGeoShape * geom
Definition: tpc_tracks.C:10
Float_t fTimeOrigin
Vertex of current event.
Definition: AliGenerator.h:156
AliGenerator * fContainer
Local pointer to stack.
Definition: AliGenerator.h:161
Float_t fPMax
Definition: AliGenerator.h:134
virtual void SetTarget(TString tar="", Int_t a=0, Int_t z=0)
Definition: AliGenerator.h:109
virtual void SetSigmaZ(Float_t sz)
Definition: AliGenerator.h:45
AliStack * fStack
Definition: AliGenerator.h:160
virtual void PushTrack(Int_t done, Int_t parent, Int_t pdg, Float_t *pmom, Float_t *vpos, Float_t *polar, Float_t tof, TMCProcess mech, Int_t &ntr, Float_t weight=1, Int_t is=0)
virtual void SetEventPlane(Float_t evPlane)
Definition: AliGenerator.h:84
virtual void SetTimeOrigin(Float_t timeorig)
Definition: AliGenerator.h:72