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