Better control of momentum range in GenBox
[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
c9001868 15#include "TLorentzVector.h"
fe4da5cc 16#include "TArrayF.h"
17#include "TGenerator.h"
18
19typedef enum { none, perEvent, perTrack } VertexSmear_t;
20
21class AliGenerator : public TNamed
22{
23
24protected:
25 static TGenerator* fgMCEvGen;
26 Float_t fThetaMin; //Minimum theta of generation in radians
27 Float_t fThetaMax; //Maximum theta of generation in radians
28 Float_t fPhiMin; //Minimum phi of generation in radians
29 Float_t fPhiMax; //Maximum phi of generation in radians
30 Float_t fPMin; //Minimum momentum of generation in GeV/c
31 Float_t fPMax; //Minimum momentum of generation in GeV/c
32 Float_t fPtMin; //Minimum transverse momentum
33 Float_t fPtMax; //Maximum transverse momentum
34 Float_t fYMin; //Minimum rapidity
35 Float_t fYMax; //Maximum rapidity
36 TArrayF fVMin; //Minimum Decaylength
37 TArrayF fVMax; //Minimum Decaylength
38 Int_t fNpart; //Maximum number of particles per event
39 Float_t fParentWeight; //Parent Weight
40 Float_t fChildWeight; //ChildWeight
4a3ba9d2 41 Int_t fTrackit; // Track the generated final state particle if 1
fe4da5cc 42 Int_t fAnalog; //Flaf for anolog or pt-weighted generation
43 //
44 VertexSmear_t fVertexSmear; //Vertex Smearing mode
4a3ba9d2 45 Int_t fTrackIt; // if 1 Track final state particles
fe4da5cc 46 TArrayF fOrigin; //Origin of event
47 TArrayF fOsigma; //Sigma of the Origin of event
48
de6d59e3 49 enum {kThetaRange=1, kVertexRange=2, kPhiRange=4, kPtRange=8,
50 kYRange=32, kMomentumRange=16};
51
fe4da5cc 52 public:
53 AliGenerator();
54 AliGenerator(Int_t npart);
55 virtual ~AliGenerator();
56 virtual void Init();
57 virtual void SetOrigin(Float_t ox, Float_t oy, Float_t oz)
58 {fOrigin[0]=ox;fOrigin[1]=oy;fOrigin[2]=oz;}
c9001868 59 virtual void SetOrigin(const TLorentzVector &o)
60 {fOrigin[0]=o[0];fOrigin[1]=o[1];fOrigin[2]=o[2];}
fe4da5cc 61 virtual void SetSigma(Float_t sx, Float_t sy, Float_t sz)
62 {fOsigma[0]=sx;fOsigma[1]=sy;fOsigma[2]=sz;}
63 virtual void SetMomentumRange(Float_t pmin=0, Float_t pmax=1.e10)
de6d59e3 64 {fPMin = pmin; fPMax = pmax; SetBit(kMomentumRange);
65 printf("\n set bits p %d %d %f %f \n \n",TestBit(kMomentumRange), TestBit(kPtRange), pmin, pmax);
66 }
e3053494 67 virtual void SetPtRange(Float_t ptmin=0, Float_t ptmax=1.e10)
de6d59e3 68 {fPtMin = ptmin; fPtMax = ptmax; SetBit(kPtRange);
69 printf("\n set bits pt %d %d %f %f \n \n",TestBit(kMomentumRange), TestBit(kPtRange), ptmin, ptmax);
70 }
fe4da5cc 71 virtual void SetPhiRange(Float_t phimin=-180., Float_t phimax=180)
72 {fPhiMin = TMath::Pi()*phimin/180;
de6d59e3 73 fPhiMax = TMath::Pi()*phimax/180; SetBit(kPhiRange);}
fe4da5cc 74 virtual void SetYRange(Float_t ymin=-100, Float_t ymax=100)
de6d59e3 75 {fYMin=ymin; fYMax=ymax; SetBit(kYRange);}
fe4da5cc 76 virtual void SetVRange(Float_t vxmin, Float_t vxmax,
77 Float_t vymin, Float_t vymax,
78 Float_t vzmin, Float_t vzmax)
79 {
80 fVMin[0]=vxmin; fVMin[1]=vymin; fVMin[2]=vzmin;
81 fVMax[0]=vxmax; fVMax[1]=vymax; fVMax[2]=vzmax;
de6d59e3 82 SetBit(kVertexRange);
fe4da5cc 83 }
84 virtual void SetNumberParticles(Int_t npart=100) {fNpart=npart;}
85 virtual Int_t NumberParticles() {return fNpart;}
86 virtual void SetThetaRange(Float_t thetamin=0, Float_t thetamax=180)
87 {fThetaMin = TMath::Pi()*thetamin/180;
de6d59e3 88 fThetaMax = TMath::Pi()*thetamax/180; SetBit(kThetaRange);}
fe4da5cc 89 virtual void Generate()=0;
90 virtual void SetParentWeight(Float_t wgt) {fParentWeight=wgt;}
91 virtual void SetChildWeight(Float_t wgt) {fChildWeight=wgt;}
92 virtual void SetAnalog(Int_t flag=1) {fAnalog=flag;}
93 virtual void SetVertexSmear(VertexSmear_t smear) {fVertexSmear = smear;}
4a3ba9d2 94 virtual void SetTrackingFlag(Int_t flag=1) {fTrackIt=flag;}
95
fe4da5cc 96 virtual void SetMC(TGenerator *theMC)
97 {if (!fgMCEvGen) fgMCEvGen =theMC;}
c9001868 98
99 // Getters
100
101 virtual void GetOrigin(Float_t &ox, Float_t &oy, Float_t &oz)
102 {ox=fOrigin[0];oy=fOrigin[1];oz=fOrigin[2];}
103 virtual void GetOrigin(TLorentzVector &o)
104 {o[0]=fOrigin[0];o[1]=fOrigin[1];o[2]=fOrigin[2];o[3]=0;}
105
fe4da5cc 106 ClassDef(AliGenerator,1)
107};
108
109#endif