Bug fix (I.Hrivnacova)
[u/mrichter/AliRoot.git] / STEER / AliGenerator.h
CommitLineData
fe4da5cc 1#ifndef ALIGENERATOR_H
2#define ALIGENERATOR_H
3da30618 3/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * See cxx source for full Copyright notice */
5
6/* $Id$ */
7
fe4da5cc 8///////////////////////////////////////////////////////////
9// //
10// Class to generate the particles for the MC //
11// The base class is empty //
12// //
13///////////////////////////////////////////////////////////
14
116cbefd 15#include <TArrayF.h>
16#include <TLorentzVector.h>
17#include <TMCProcess.h>
18
65fb704d 19#include "AliRndm.h"
eeb8ca4e 20
116cbefd 21class AliCollisionGeometry;
69a313ec 22class AliStack;
eeb8ca4e 23
116cbefd 24class TGenerator;
25
69a313ec 26
fe4da5cc 27
0b910a04 28typedef enum { kNoSmear, kPerEvent, kPerTrack } VertexSmear_t;
29typedef enum { kExternal, kInternal, kContainer} VertexSource_t;
fe4da5cc 30
69a313ec 31
65fb704d 32class AliGenerator : public TNamed, public AliRndm
fe4da5cc 33{
34
fe4da5cc 35 public:
36 AliGenerator();
37 AliGenerator(Int_t npart);
aee8290b 38 AliGenerator(const AliGenerator &gen);
fe4da5cc 39 virtual ~AliGenerator();
40 virtual void Init();
ef42d733 41 void Copy(AliGenerator &gen) const;
94de3818 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 SetMomentumRange(Float_t pmin=0, Float_t pmax=1.e10);
d48c5cd4 46 virtual void SetPtRange(Float_t ptmin=0, Float_t ptmax=1.e10);
05be135b 47 virtual void SetPhiRange(Float_t phimin = 0., Float_t phimax = 360.);
94de3818 48 virtual void SetYRange(Float_t ymin=-100, Float_t ymax=100);
fe4da5cc 49 virtual void SetVRange(Float_t vxmin, Float_t vxmax,
50 Float_t vymin, Float_t vymax,
94de3818 51 Float_t vzmin, Float_t vzmax);
fe4da5cc 52 virtual void SetNumberParticles(Int_t npart=100) {fNpart=npart;}
94de3818 53 virtual Int_t NumberParticles() const {return fNpart;}
54 virtual void SetThetaRange(Float_t thetamin=0, Float_t thetamax=180);
fe4da5cc 55 virtual void Generate()=0;
56 virtual void SetParentWeight(Float_t wgt) {fParentWeight=wgt;}
57 virtual void SetChildWeight(Float_t wgt) {fChildWeight=wgt;}
58 virtual void SetAnalog(Int_t flag=1) {fAnalog=flag;}
59 virtual void SetVertexSmear(VertexSmear_t smear) {fVertexSmear = smear;}
c34578e7 60 virtual void SetCutVertexZ(Float_t cut=999999.) {fCutVertexZ = cut;}
0b910a04 61 virtual void SetVertexSource(VertexSource_t source = kInternal) {fVertexSource = source;}
62 virtual void SetVertex(Float_t vx, Float_t vy, Float_t vz)
63 {fVertex[0] = vx; fVertex[1] = vy; fVertex[2] = vz;}
4a3ba9d2 64 virtual void SetTrackingFlag(Int_t flag=1) {fTrackIt=flag;}
f89cabfe 65 void Vertex();
66 void VertexExternal();
67 virtual void VertexInternal();
0b910a04 68 virtual void FinishRun();
fe4da5cc 69 virtual void SetMC(TGenerator *theMC)
70 {if (!fgMCEvGen) fgMCEvGen =theMC;}
c9001868 71
ef42d733 72 AliGenerator & operator=(const AliGenerator &gen);
aee8290b 73
c9001868 74 // Getters
75
94de3818 76 virtual void GetOrigin(Float_t &ox, Float_t &oy, Float_t &oz) const
77 {ox=fOrigin.At(0);oy=fOrigin.At(1);oz=fOrigin.At(2);}
78 virtual void GetOrigin(TLorentzVector &o) const
79 {o[0]=fOrigin.At(0);o[1]=fOrigin.At(1);o[2]=fOrigin.At(2);o[3]=0;}
2c5b3727 80 // Stack
69a313ec 81 void SetStack (AliStack *stack) {fStack = stack;}
82 AliStack* GetStack(){return fStack;}
2c5b3727 83 // Collision Geometry
116cbefd 84 virtual Bool_t ProvidesCollisionGeometry() const {return kFALSE;}
85 virtual Bool_t NeedsCollisionGeometry() const {return kFALSE;}
2c5b3727 86 virtual AliCollisionGeometry* CollisionGeometry() {return fCollisionGeometry;}
87 virtual void SetCollisionGeometry(AliCollisionGeometry* geom) {fCollisionGeometry = geom;}
69a313ec 88 protected:
89 virtual void SetTrack(Int_t done, Int_t parent, Int_t pdg,
90 Float_t *pmom, Float_t *vpos, Float_t *polar,
98490ea9 91 Float_t tof, TMCProcess mech, Int_t &ntr,
47c8bcbe 92 Float_t weight = 1, Int_t is = 0);
69a313ec 93 virtual void SetTrack(Int_t done, Int_t parent, Int_t pdg,
94 Double_t px, Double_t py, Double_t pz, Double_t e,
95 Double_t vx, Double_t vy, Double_t vz, Double_t tof,
96 Double_t polx, Double_t poly, Double_t polz,
98490ea9 97 TMCProcess mech, Int_t &ntr, Float_t weight = 1, Int_t is = 0);
69a313ec 98 virtual void KeepTrack(Int_t itrack);
99 virtual void SetHighWaterMark(Int_t nt);
100
101 protected:
47c8bcbe 102 static TGenerator* fgMCEvGen; //Pointer to the generator
aee8290b 103 Float_t fThetaMin; //Minimum theta of generation in radians
104 Float_t fThetaMax; //Maximum theta of generation in radians
105 Float_t fPhiMin; //Minimum phi of generation in radians
106 Float_t fPhiMax; //Maximum phi of generation in radians
107 Float_t fPMin; //Minimum momentum of generation in GeV/c
108 Float_t fPMax; //Minimum momentum of generation in GeV/c
109 Float_t fPtMin; //Minimum transverse momentum
110 Float_t fPtMax; //Maximum transverse momentum
111 Float_t fYMin; //Minimum rapidity
112 Float_t fYMax; //Maximum rapidity
113 TArrayF fVMin; //Minimum Decaylength
114 TArrayF fVMax; //Minimum Decaylength
115 Int_t fNpart; //Maximum number of particles per event
116 Float_t fParentWeight; //Parent Weight
117 Float_t fChildWeight; //ChildWeight
69a313ec 118 Int_t fAnalog; //Flag for anolog or pt-weighted generation
aee8290b 119 //
f89cabfe 120 VertexSmear_t fVertexSmear; //Vertex Smearing mode
c34578e7 121 VertexSource_t fVertexSource; //Vertex source (internal/external)
122 Float_t fCutVertexZ; // Vertex cut in units of sigma_z
6df200c3 123 Int_t fTrackIt; // if 1, Track final state particles
f89cabfe 124 TArrayF fOrigin; // Origin of event
6df200c3 125 TArrayF fOsigma; // Sigma of the Origin of event
f89cabfe 126 TArrayF fVertex; //! Vertex of current event
c34578e7 127
6df200c3 128 AliStack* fStack; //! Local pointer to stack
2c5b3727 129 AliCollisionGeometry* fCollisionGeometry; //!Collision geometry
69a313ec 130 /*************************************************************************/
5e34a898 131 enum {kThetaRange = BIT(14),
132 kVertexRange = BIT(15),
69a313ec 133 kPhiRange = BIT(16),
5e34a898 134 kPtRange = BIT(17),
69a313ec 135 kYRange = BIT(18),
136 kMomentumRange = BIT(19)
5e34a898 137 };
2c5b3727 138 ClassDef(AliGenerator,3) // Base class for event generators
fe4da5cc 139};
140
141#endif
69a313ec 142
143
144
c34578e7 145
146
147
148
149
150
151
152
153
154
155