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 "PndTargetGenerator.h"
13 
14 #include <iostream>
15 
16 class FairPrimaryGenerator;
17 
19  public:
20  PndRangeValues(Double32_t start = 0, Double32_t stop = 0, Double32_t step = 1) : fStart(start), fStop(stop), fStep(step), fActualValue(start) {}
21  virtual ~PndRangeValues(){};
22  Double32_t fStart;
23  Double32_t fStop;
24  Double32_t fStep;
25  Double32_t fActualValue;
26 
27  void SetStart(Double32_t val)
28  {
29  fStart = val;
30  fActualValue = val;
31  };
32  void SetStop(Double32_t val) { fStop = val; };
33  void SetStep(Double32_t val) { fStep = val; };
34  void SetActualValue(Double32_t val) { fActualValue = val; };
35 
36  int GetNSteps()
37  {
38  if (fStep != 0)
39  return ((fStop - fStart) / fStep) + 1;
40  else
41  return 1;
42  }
43 
44  virtual Double32_t GetStep() { return fStep; }
45 
47 };
48 
50  public:
53 
58  PndFixStepParticleGun(Int_t pdgid, Int_t mult = 1);
59 
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  {
70  fP.SetStart(pmin);
71  fP.SetStop(pmax);
72  fP.SetStep(pstep);
73  fPRangeIsSet = kTRUE;
74  }
75 
76  void SetPtRange(Double32_t ptmin = 0, Double32_t ptmax = 10, Double32_t ptstep = 1)
77  {
78  fPt.SetStart(ptmin);
79  fPt.SetStop(ptmax);
80  fPt.SetStep(ptstep);
81  fPtRangeIsSet = kTRUE;
82  };
83 
84  void SetPhiRange(Double32_t phimin = 0, Double32_t phimax = 360, Double32_t phistep = 1)
85  {
86  fPhi.SetStart(phimin);
87  fPhi.SetStop(phimax);
88  fPhi.SetStep(phistep);
89  };
90 
91  void SetEtaRange(Double32_t etamin = -5, Double32_t etamax = 7, Double32_t etastep = 1)
92  {
93  fEta.SetStart(etamin);
94  fEta.SetStop(etamax);
95  fEta.SetStep(etastep);
96  fEtaRangeIsSet = kTRUE;
97  };
98 
99  void SetYRange(Double32_t ymin = -5, Double32_t ymax = 7, Double32_t ystep = 1)
100  {
101  fRapidity.SetStart(ymin);
102  fRapidity.SetStop(ymax);
103  fRapidity.SetStep(ystep);
104  fYRangeIsSet = kTRUE;
105  };
106 
107  void SetThetaRange(Double32_t thetamin = 0, Double32_t thetamax = 90, Double32_t thetastep = 1)
108  {
109  fTheta.SetStart(thetamin);
110  fTheta.SetStop(thetamax);
111  fTheta.SetStep(thetastep);
112  fThetaRangeIsSet = kTRUE;
113  };
114 
115  void SetCosThetaRange(Double32_t costhetamin = -1, Double32_t costhetamax = 1, Double32_t costhetastep = 0.1)
116  {
117  fCosTheta.SetStart(costhetamin);
118  fCosTheta.SetStop(costhetamax);
119  fCosTheta.SetStep(costhetastep);
120  fCosThetaIsSet = kTRUE;
121  fThetaRangeIsSet = kTRUE;
122  };
123 
124  void SetXYZ(Double32_t x = 0, Double32_t y = 0, Double32_t z = 0)
125  {
126  fX = x;
127  fY = y;
128  fZ = z;
129  fPointVtxIsSet = kTRUE;
130  }
131 
132  void SetBoxXYZ(Double32_t x1 = 0, Double32_t y1 = 0, Double32_t x2 = 0, Double32_t y2 = 0, Double32_t z = 0)
133  {
134  fX1 = x1;
135  fY1 = y1;
136  fX2 = x2;
137  fY2 = y2;
138  fZ = z;
139  fBoxVtxIsSet = kTRUE;
140  }
141 
142  void SetDebug(Bool_t debug = 0) { fDebug = debug; }
143 
144  int GetNEvents();
145 
147  Bool_t Init();
148 
152  virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen);
153 
154  private:
155  Int_t fPDGType; // Particle type (PDG encoding)
156  Int_t fMult; // Multiplicity
157  Int_t fEvent; // EventCounter
158 
159  Double32_t fPDGMass; // Particle mass [GeV]
160  // Double32_t fPtMin, fPtMax, fPtStep; // Transverse momentum range [GeV]
161  PndRangeValues fPt;
162  // Double32_t fPhiMin, fPhiMax, fPhiStep; // Azimuth angle range [degree]
163  PndRangeValues fPhi;
164  // Double32_t fEtaMin, fEtaMax, fEtaStep; // Pseudorapidity range in lab system
165  PndRangeValues fEta;
166  // Double32_t fYMin, fYMax, fYStep; // Rapidity range in lab system
167  PndRangeValues fRapidity;
168  // Double32_t fPMin, fPMax, fPStep; // Momentum range in lab system
169  PndRangeValues fP;
170  // Double32_t fThetaMin, fThetaMax, fThetaStep; // Polar angle range in lab system [degree]
171  PndRangeValues fTheta;
172  PndRangeValues fCosTheta;
173  Double32_t fX, fY, fZ; // Point vertex coordinates [cm]
174  Double32_t fX1, fY1, fX2, fY2; // Box vertex coords (x1,y1)->(x2,y2)
175 
176  Bool_t fEtaRangeIsSet; // True if eta range is set
177  Bool_t fYRangeIsSet; // True if rapidity range is set
178  Bool_t fThetaRangeIsSet; // True if theta range is set
179  Bool_t fCosThetaIsSet; // True if uniform distribution in
180  // cos(theta) is set (default -> not set)
181  Bool_t fPtRangeIsSet; // True if transverse momentum range is set
182  Bool_t fPRangeIsSet; // True if abs.momentum range is set
183  Bool_t fPointVtxIsSet; // True if point vertex is set
184  Bool_t fBoxVtxIsSet; // True if box vertex is set
185  Bool_t fDebug; // Debug switch
186  Bool_t fDoit; // Stop generating particles at the end of the range
187  Bool_t fFirstRun; // Used to indicate the first run. Otherwise the first event would be skipped
188  void CalcActValues(PndRangeValues *val1, PndRangeValues *val2, PndRangeValues *val3);
189  bool IsEndOfRanges(PndRangeValues *val1, PndRangeValues *val2, PndRangeValues *val3);
190 
192 };
193 
194 #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)
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)
PndRangeValues(Double32_t start=0, Double32_t stop=0, Double32_t step=1)
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)
void SetDebug(Bool_t debug=0)
void SetStart(Double32_t val)
virtual Double32_t GetStep()
void SetMultiplicity(Int_t mult)
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)
void SetActualValue(Double32_t val)