PandaRoot
PndBoxGenerator.h
Go to the documentation of this file.
1 // -------------------------------------------------------------------------
2 // ----- PndBoxGenerator header file -----
3 // ----- Created 22/05/07 by S.Spataro -----
4 // -------------------------------------------------------------------------
5 
17 #ifndef PND_BOXGENERATOR_H
18 #define PND_BOXGENERATOR_H
19 
20 #include "PndTargetGenerator.h"
21 #include <iostream>
22 
23 class FairPrimaryGenerator;
24 
26  public:
29 
34  PndBoxGenerator(Int_t pdgid, Int_t mult = 1);
35 
37  virtual ~PndBoxGenerator(){};
38 
40  void SetPDGType(Int_t pdg) { fPDGType = pdg; };
41 
42  void SetMultiplicity(Int_t mult) { fMult = mult; };
43 
44  void SetPRange(Double32_t pmin = 0, Double32_t pmax = 10)
45  {
46  fPMin = pmin;
47  fPMax = pmax;
48  fPRangeIsSet = kTRUE;
49  }
50 
51  void SetPtRange(Double32_t ptmin = 0, Double32_t ptmax = 10)
52  {
53  fPtMin = ptmin;
54  fPtMax = ptmax;
55  fPtRangeIsSet = kTRUE;
56  };
57 
58  void SetPhiRange(Double32_t phimin = 0, Double32_t phimax = 360)
59  {
60  fPhiMin = phimin;
61  fPhiMax = phimax;
62  };
63 
64  void SetEtaRange(Double32_t etamin = -5, Double32_t etamax = 7)
65  {
66  fEtaMin = etamin;
67  fEtaMax = etamax;
68  fEtaRangeIsSet = kTRUE;
69  };
70 
71  void SetYRange(Double32_t ymin = -5, Double32_t ymax = 7)
72  {
73  fYMin = ymin;
74  fYMax = ymax;
75  fYRangeIsSet = kTRUE;
76  };
77 
78  void SetThetaRange(Double32_t thetamin = 0, Double32_t thetamax = 90)
79  {
80  fThetaMin = thetamin;
81  fThetaMax = thetamax;
82  fThetaRangeIsSet = kTRUE;
83  };
84 
85  void SetCosTheta() { fCosThetaIsSet = kTRUE; };
86 
87  void SetInverseP() { fInversePIsSet = kTRUE; };
88 
89  void SetXYZ(Double32_t x = 0, Double32_t y = 0, Double32_t z = 0)
90  {
91  fX = x;
92  fY = y;
93  fZ = z;
94  fPointVtxIsSet = kTRUE;
95  }
96 
97  void SetBoxXYZ(Double32_t x1 = 0, Double32_t y1 = 0, Double32_t x2 = 0, Double32_t y2 = 0, Double32_t z = 0)
98  {
99  fX1 = x1;
100  fY1 = y1;
101  fX2 = x2;
102  fY2 = y2;
103  fZ = z;
104  fBoxVtxIsSet = kTRUE;
105  }
106 
107  void SetDebug(Bool_t debug = 0) { fDebug = debug; }
108 
110  Bool_t Init();
111 
115  virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen);
116 
117  friend std::ostream& operator<< (std::ostream& out, PndBoxGenerator& gen)
118  {
119  out << "BoxGenerator settings:" << std::endl;
120  out << gen.fMult << " * " << gen.fPDGType << std::endl;
121  if (gen.fPRangeIsSet) out << "P Range: " << gen.fPMin << " < " << gen.fPMax << std::endl;
122  if (gen.fPtRangeIsSet) out << "Pt Range: " << gen.fPtMin << " < " << gen.fPtMax << std::endl;
123  if (gen.fInversePIsSet) out << "InverseP is set" << std::endl;
124  if (gen.fThetaRangeIsSet) out << "Theta Range: " << gen.fThetaMin << " < " << gen.fThetaMax << std::endl;
125  if (gen.fCosThetaIsSet) out << "CosTheta is set" << std::endl;
126  if (gen.fEtaRangeIsSet) out << "Eta Range: " << gen.fEtaMin << " < " << gen.fEtaMax << std::endl;
127  if (gen.fYRangeIsSet) out << "Y Range: " << gen.fYMin << " < " << gen.fYMax << std::endl;
128  out << "Phi Range: " << gen.fPhiMin << " < " << gen.fPhiMax << std::endl;
129  if (gen.fPointVtxIsSet) out << "Point Vertex: " << gen.fX << "/" << gen.fY << "/" << gen.fZ << std::endl;
130  if (gen.fBoxVtxIsSet) out << "Box Vertex: p1: " << gen.fX1 << "/" << gen.fY1 << " p2: " << gen.fX2 << "/" << gen.fY2 << " z " << gen.fZ << std::endl;
131 
132  return out;
133 
134  }
135 
136  private:
137  Int_t fPDGType; // Particle type (PDG encoding)
138  Int_t fMult; // Multiplicity
139 
140  Double32_t fPDGMass; // Particle mass [GeV]
141  Double32_t fPtMin, fPtMax; // Transverse momentum range [GeV]
142  Double32_t fPhiMin, fPhiMax; // Azimuth angle range [degree]
143  Double32_t fEtaMin, fEtaMax; // Pseudorapidity range in lab system
144  Double32_t fYMin, fYMax; // Rapidity range in lab system
145  Double32_t fPMin, fPMax; // Momentum range in lab system
146  Double32_t fThetaMin, fThetaMax; // Polar angle range in lab system [degree]
147  Double32_t fX, fY, fZ; // Point vertex coordinates [cm]
148  Double32_t fX1, fY1, fX2, fY2; // Box vertex coords (x1,y1)->(x2,y2)
149 
150  Bool_t fEtaRangeIsSet; // True if eta range is set
151  Bool_t fYRangeIsSet; // True if rapidity range is set
152  Bool_t fThetaRangeIsSet; // True if theta range is set
153  Bool_t fCosThetaIsSet; // True if uniform distribution in cos(theta) is set (default -> uniform theta)
154  Bool_t fInversePIsSet; // True if uniform distribution in 1/p
155  Bool_t fPtRangeIsSet; // True if transverse momentum range is set
156  Bool_t fPRangeIsSet; // True if abs.momentum range is set
157  Bool_t fPointVtxIsSet; // True if point vertex is set
158  Bool_t fBoxVtxIsSet; // True if box vertex is set
159  Bool_t fDebug; // Debug switch
160 
161  ClassDef(PndBoxGenerator, 1);
162 };
163 
164 #endif
void SetPDGType(Int_t pdg)
void SetThetaRange(Double32_t thetamin=0, Double32_t thetamax=90)
void SetBoxXYZ(Double32_t x1=0, Double32_t y1=0, Double32_t x2=0, Double32_t y2=0, Double32_t z=0)
void SetYRange(Double32_t ymin=-5, Double32_t ymax=7)
void SetXYZ(Double32_t x=0, Double32_t y=0, Double32_t z=0)
virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen)
void SetEtaRange(Double32_t etamin=-5, Double32_t etamax=7)
void SetPtRange(Double32_t ptmin=0, Double32_t ptmax=10)
void SetMultiplicity(Int_t mult)
void SetDebug(Bool_t debug=0)
friend std::ostream & operator<<(std::ostream &out, PndBoxGenerator &gen)
void SetPRange(Double32_t pmin=0, Double32_t pmax=10)
virtual ~PndBoxGenerator()
void SetPhiRange(Double32_t phimin=0, Double32_t phimax=360)