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