FairRoot/PandaRoot
PndFixStepParticleGun.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndFixStepParticleGun header file -----
3 // ----- Created 30/10/08 by Tobias Stockmanns -----
4 // -------------------------------------------------------------------------
5 
9 #ifndef Pnd_FLATPARTICLEGENERATOR_H
10 #define Pnd_FLATPARTICLEGENERATOR_H
11 
12 #include "FairGenerator.h"
13 
14 #include <iostream>
15 
16 class FairPrimaryGenerator;
17 
19 {
20 public :
21  PndRangeValues(Double32_t start = 0, Double32_t stop = 0, Double32_t step = 1): fStart(start), fStop(stop), fStep(step), fActualValue(start)
22  {}
23  virtual ~PndRangeValues(){};
24  Double32_t fStart;
25  Double32_t fStop;
26  Double32_t fStep;
27  Double32_t fActualValue;
28 
29  void SetStart(Double32_t val){fStart = val; fActualValue = val;};
30  void SetStop(Double32_t val){fStop = val;};
31  void SetStep(Double32_t val){fStep = val;};
32  void SetActualValue(Double32_t val){fActualValue = val;};
33 
34  int GetNSteps(){
35  if (fStep != 0)
36  return ((fStop - fStart) / fStep) + 1;
37  else
38  return 1;
39  }
40 
41  virtual Double32_t GetStep(){return fStep;}
42 
44 };
45 
46 
47 class PndFixStepParticleGun : public FairGenerator
48 {
49 public:
50 
53 
58  PndFixStepParticleGun(Int_t pdgid, Int_t mult=1);
59 
61  virtual ~PndFixStepParticleGun() {};
62 
64  void SetPDGType (Int_t pdg) {fPDGType = pdg; };
65 
66  void SetMultiplicity (Int_t mult) {fMult = mult; };
67 
68  void SetPRange(Double32_t pmin=0 , Double32_t pmax=10, Double32_t pstep = 1)
69  {fP.SetStart(pmin); fP.SetStop(pmax); fP.SetStep(pstep); fPRangeIsSet=kTRUE;}
70 
71  void SetPtRange (Double32_t ptmin=0 , Double32_t ptmax=10, Double32_t ptstep=1)
72  {fPt.SetStart(ptmin); fPt.SetStop(ptmax); fPt.SetStep(ptstep); fPtRangeIsSet=kTRUE;};
73 
74  void SetPhiRange (Double32_t phimin=0 , Double32_t phimax=360, Double32_t phistep = 1)
75  {fPhi.SetStart(phimin); fPhi.SetStop(phimax); fPhi.SetStep(phistep);};
76 
77  void SetEtaRange (Double32_t etamin=-5 , Double32_t etamax=7, Double32_t etastep=1)
78  {fEta.SetStart(etamin); fEta.SetStop(etamax); fEta.SetStep(etastep); fEtaRangeIsSet=kTRUE;};
79 
80  void SetYRange (Double32_t ymin=-5, Double32_t ymax=7, Double32_t ystep=1)
81  {fRapidity.SetStart(ymin); fRapidity.SetStop(ymax); fRapidity.SetStep(ystep); fYRangeIsSet=kTRUE;};
82 
83  void SetThetaRange (Double32_t thetamin=0, Double32_t thetamax=90, Double32_t thetastep=1)
84  {fTheta.SetStart(thetamin); fTheta.SetStop(thetamax); fTheta.SetStep(thetastep); fThetaRangeIsSet=kTRUE;};
85 
86  void SetCosThetaRange (Double32_t costhetamin=-1, Double32_t costhetamax=1, Double32_t costhetastep=0.1)
87  {fCosTheta.SetStart(costhetamin); fCosTheta.SetStop(costhetamax); fCosTheta.SetStep(costhetastep); fCosThetaIsSet=kTRUE; fThetaRangeIsSet=kTRUE;};
88 
89  void SetXYZ (Double32_t x=0, Double32_t y=0, Double32_t z=0) {
90  fX=x; fY=y; fZ=z; fPointVtxIsSet=kTRUE;}
91 
92  void SetBoxXYZ (Double32_t x1=0, Double32_t y1=0, Double32_t x2=0, Double32_t y2=0, Double32_t z=0) {
93  fX1=x1; fY1=y1; fX2=x2; fY2=y2; fZ=z; fBoxVtxIsSet=kTRUE;}
94 
95  void SetDebug(Bool_t debug=0) {fDebug = debug;}
96 
97  int GetNEvents();
98 
100  Bool_t Init();
101 
105  virtual Bool_t ReadEvent(FairPrimaryGenerator* primGen);
106 
107 private:
108  Int_t fPDGType; // Particle type (PDG encoding)
109  Int_t fMult; // Multiplicity
110  Int_t fEvent; // EventCounter
111 
112  Double32_t fPDGMass; // Particle mass [GeV]
113 // Double32_t fPtMin, fPtMax, fPtStep; // Transverse momentum range [GeV]
115 // Double32_t fPhiMin, fPhiMax, fPhiStep; // Azimuth angle range [degree]
117 // Double32_t fEtaMin, fEtaMax, fEtaStep; // Pseudorapidity range in lab system
119 // Double32_t fYMin, fYMax, fYStep; // Rapidity range in lab system
121 // Double32_t fPMin, fPMax, fPStep; // Momentum range in lab system
123 // Double32_t fThetaMin, fThetaMax, fThetaStep; // Polar angle range in lab system [degree]
126  Double32_t fX, fY, fZ; // Point vertex coordinates [cm]
127  Double32_t fX1, fY1, fX2, fY2; // Box vertex coords (x1,y1)->(x2,y2)
128 
129  Bool_t fEtaRangeIsSet; // True if eta range is set
130  Bool_t fYRangeIsSet; // True if rapidity range is set
131  Bool_t fThetaRangeIsSet; // True if theta range is set
132  Bool_t fCosThetaIsSet; // True if uniform distribution in
133  //cos(theta) is set (default -> not set)
134  Bool_t fPtRangeIsSet; // True if transverse momentum range is set
135  Bool_t fPRangeIsSet; // True if abs.momentum range is set
136  Bool_t fPointVtxIsSet; // True if point vertex is set
137  Bool_t fBoxVtxIsSet; // True if box vertex is set
138  Bool_t fDebug; // Debug switch
139  Bool_t fDoit; // Stop generating particles at the end of the range
140  Bool_t fFirstRun; // Used to indicate the first run. Otherwise the first event would be skipped
141  void CalcActValues(PndRangeValues* val1, PndRangeValues* val2, PndRangeValues* val3);
142  bool IsEndOfRanges(PndRangeValues* val1, PndRangeValues* val2, PndRangeValues* val3);
143 
145 
146 };
147 
148 
149 #endif
void SetStep(Double32_t val)
void SetPhiRange(Double32_t phimin=0, Double32_t phimax=360, Double32_t phistep=1)
void SetThetaRange(Double32_t thetamin=0, Double32_t thetamax=90, Double32_t thetastep=1)
Double_t val[nBoxes][nFEBox]
Definition: createCalib.C:11
bool IsEndOfRanges(PndRangeValues *val1, PndRangeValues *val2, PndRangeValues *val3)
void SetPRange(Double32_t pmin=0, Double32_t pmax=10, Double32_t pstep=1)
void SetEtaRange(Double32_t etamin=-5, Double32_t etamax=7, Double32_t etastep=1)
void SetPtRange(Double32_t ptmin=0, Double32_t ptmax=10, Double32_t ptstep=1)
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
PndRangeValues(Double32_t start=0, Double32_t stop=0, Double32_t step=1)
ClassDef(PndFixStepParticleGun, 1)
virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen)
void SetStop(Double32_t val)
void SetYRange(Double32_t ymin=-5, Double32_t ymax=7, Double32_t ystep=1)
void SetXYZ(Double32_t x=0, Double32_t y=0, Double32_t z=0)
ClassDef(PndRangeValues, 1)
Double_t z
void SetDebug(Bool_t debug=0)
void SetStart(Double32_t val)
virtual Double32_t GetStep()
void SetMultiplicity(Int_t mult)
Double_t x
void CalcActValues(PndRangeValues *val1, PndRangeValues *val2, PndRangeValues *val3)
Double_t y
void SetCosThetaRange(Double32_t costhetamin=-1, Double32_t costhetamax=1, Double32_t costhetastep=0.1)
void SetBoxXYZ(Double32_t x1=0, Double32_t y1=0, Double32_t x2=0, Double32_t y2=0, Double32_t z=0)
Double_t mult
void SetActualValue(Double32_t val)