FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndBoxGenerator Class Reference

#include <PndBoxGenerator.h>

Inheritance diagram for PndBoxGenerator:

Public Member Functions

 PndBoxGenerator ()
 
 PndBoxGenerator (Int_t pdgid, Int_t mult=1)
 
virtual ~PndBoxGenerator ()
 
void SetPDGType (Int_t pdg)
 
void SetMultiplicity (Int_t mult)
 
void SetPRange (Double32_t pmin=0, Double32_t pmax=10)
 
void SetPtRange (Double32_t ptmin=0, Double32_t ptmax=10)
 
void SetPhiRange (Double32_t phimin=0, Double32_t phimax=360)
 
void SetEtaRange (Double32_t etamin=-5, Double32_t etamax=7)
 
void SetYRange (Double32_t ymin=-5, Double32_t ymax=7)
 
void SetThetaRange (Double32_t thetamin=0, Double32_t thetamax=90)
 
void SetCosTheta ()
 
void SetInverseP ()
 
void SetXYZ (Double32_t x=0, Double32_t y=0, Double32_t z=0)
 
void SetBoxXYZ (Double32_t x1=0, Double32_t y1=0, Double32_t x2=0, Double32_t y2=0, Double32_t z=0)
 
void SetDebug (Bool_t debug=0)
 
Bool_t Init ()
 
virtual Bool_t ReadEvent (FairPrimaryGenerator *primGen)
 

Private Member Functions

 ClassDef (PndBoxGenerator, 1)
 

Private Attributes

Int_t fPDGType
 
Int_t fMult
 
Double32_t fPDGMass
 
Double32_t fPtMin
 
Double32_t fPtMax
 
Double32_t fPhiMin
 
Double32_t fPhiMax
 
Double32_t fEtaMin
 
Double32_t fEtaMax
 
Double32_t fYMin
 
Double32_t fYMax
 
Double32_t fPMin
 
Double32_t fPMax
 
Double32_t fThetaMin
 
Double32_t fThetaMax
 
Double32_t fX
 
Double32_t fY
 
Double32_t fZ
 
Double32_t fX1
 
Double32_t fY1
 
Double32_t fX2
 
Double32_t fY2
 
Bool_t fEtaRangeIsSet
 
Bool_t fYRangeIsSet
 
Bool_t fThetaRangeIsSet
 
Bool_t fCosThetaIsSet
 
Bool_t fInversePIsSet
 
Bool_t fPtRangeIsSet
 
Bool_t fPRangeIsSet
 
Bool_t fPointVtxIsSet
 
Bool_t fBoxVtxIsSet
 
Bool_t fDebug
 

Detailed Description

Definition at line 25 of file PndBoxGenerator.h.

Constructor & Destructor Documentation

PndBoxGenerator::PndBoxGenerator ( )

Default constructor.

Definition at line 15 of file PndBoxGenerator.cxx.

15  :
16  fPDGType(0),fMult(0),fPDGMass(0),fPtMin(0),fPtMax(0),
17  fPhiMin(0),fPhiMax(0),fEtaMin(0),fEtaMax(0),fYMin(0),fYMax(0),
18  fPMin(0),fPMax(0),fThetaMin(0),fThetaMax(0),fX(0),fY(0),fZ(0),
19  fX1(0),fY1(0),fX2(0),fY2(0),
23 {
24  // Default constructor
25 }
Double32_t fYMax
Double32_t fPtMin
Double32_t fPhiMin
Double32_t fEtaMin
Double32_t fPMax
Double32_t fPhiMax
Double32_t fThetaMax
Double32_t fPDGMass
Double32_t fThetaMin
Double32_t fPMin
Double32_t fEtaMax
Double32_t fYMin
Double32_t fPtMax
PndBoxGenerator::PndBoxGenerator ( Int_t  pdgid,
Int_t  mult = 1 
)

Constructor with PDG-ID, multiplicity

Parameters
pdgidParticle type (PDG encoding)
multMultiplicity (default is 1)

Definition at line 28 of file PndBoxGenerator.cxx.

References SetPhiRange().

28  :
29  fPDGType(pdgid),fMult(mult),fPDGMass(0),fPtMin(0),fPtMax(0),
30  fPhiMin(0),fPhiMax(0), fEtaMin(0),fEtaMax(0),fYMin(0),fYMax(0),
31  fPMin(0),fPMax(0),fThetaMin(0),fThetaMax(0),fX(0),fY(0),fZ(0),
32  fX1(0),fY1(0),fX2(0),fY2(0),
36 
37 {
38  // Constructor. Set default kinematics limits
39  SetPhiRange ();
40 }
Double32_t fYMax
Double32_t fPtMin
Double32_t fPhiMin
Double32_t fEtaMin
Double32_t fPMax
Double32_t fPhiMax
Double32_t fThetaMax
Double32_t fPDGMass
Double32_t fThetaMin
Double32_t fPMin
Double32_t fEtaMax
Double32_t fYMin
Double32_t fPtMax
Double_t mult
void SetPhiRange(Double32_t phimin=0, Double32_t phimax=360)
virtual PndBoxGenerator::~PndBoxGenerator ( )
inlinevirtual

Destructor

Definition at line 39 of file PndBoxGenerator.h.

39 {};

Member Function Documentation

PndBoxGenerator::ClassDef ( PndBoxGenerator  ,
 
)
private
Bool_t PndBoxGenerator::Init ( )

Initializer

Definition at line 42 of file PndBoxGenerator.cxx.

References fBoxVtxIsSet, fEtaRangeIsSet, fInversePIsSet, fPDGMass, fPDGType, fPhiMax, fPhiMin, fPMax, fPMin, fPointVtxIsSet, fPRangeIsSet, fPtMax, fPtMin, fPtRangeIsSet, fThetaRangeIsSet, fYRangeIsSet, and particle.

43 {
44  // Initialize generator
45 
46  if (fPhiMax-fPhiMin>360)
47  Fatal("Init()","PndBoxGenerator: phi range is too wide: %f<phi<%f",
50  Fatal("Init()","PndBoxGenerator: Cannot set P and Pt ranges simultaneously");
52  Fatal("Init()","PndBoxGenerator: Cannot set P and Y ranges simultaneously");
53  if ( (fThetaRangeIsSet && fYRangeIsSet) ||
56  Fatal("Init()","PndBoxGenerator: Cannot set Y, Theta or Eta ranges simultaneously");
58  Fatal("Init()","PndBoxGenerator: Cannot set point and box vertices simultaneously");
59  if (fInversePIsSet && ( ( fPRangeIsSet && ( fPMin==0 || fPMax==0 ) ) || ( fPRangeIsSet && ( fPtMin==0 || fPtMax==0 ) ) ) )
60  Fatal("Init()","PndBoxGenerator: Cannot use P == 0 as limit for inverse momentum distribution");
61 
62  // Check for particle type
63  TDatabasePDG* pdgBase = TDatabasePDG::Instance();
64  TParticlePDG *particle = pdgBase->GetParticle(fPDGType);
65  if (! particle) Fatal("PndBoxGenerator","PDG code %d not defined.",fPDGType);
66  fPDGMass = particle->Mass();
67  return kTRUE;
68 }
Double32_t fPtMin
Double32_t fPhiMin
Double32_t fPMax
Double32_t fPhiMax
const int particle
Double32_t fPDGMass
Double32_t fPMin
Double32_t fPtMax
Bool_t PndBoxGenerator::ReadEvent ( FairPrimaryGenerator *  primGen)
virtual

Creates an event with given type and multiplicity.

Parameters
primGenpointer to the FairPrimaryGenerator

Definition at line 71 of file PndBoxGenerator.cxx.

References acos(), CAMath::Cos(), cos(), eta, fBoxVtxIsSet, fCosThetaIsSet, fDebug, fEtaMax, fEtaMin, fEtaRangeIsSet, fInversePIsSet, fMult, fPDGMass, fPDGType, fPhiMax, fPhiMin, fPMax, fPMin, fPRangeIsSet, fPtMax, fPtMin, fPtRangeIsSet, fThetaMax, fThetaMin, fThetaRangeIsSet, fX, fX1, fX2, fY, fY1, fY2, fYMax, fYMin, fYRangeIsSet, fZ, phi, printf(), pt(), pz, CAMath::Sin(), CAMath::Sqrt(), CAMath::Tan(), theta, and y.

72 {
73  // Generate one event: produce primary particles emitted from one vertex.
74  // Primary particles are distributed uniformly along
75  // those kinematics variables which were limitted by setters.
76  // if SetCosTheta() function is used, the distribution will be uniform in cos(theta)
77 
78  Double32_t pabs, phi, pt, theta=0, eta, y, mt, px, py, pz, pinv=0;
79 
80  // Generate particles
81  for (Int_t k = 0; k < fMult; k++) {
82  phi = gRandom->Uniform(fPhiMin,fPhiMax) * TMath::DegToRad();
83 
84  if (fPRangeIsSet ) {
85  if (fInversePIsSet)
86  {
87  pinv = gRandom->Uniform(1./fPMax, 1./fPMin);
88  pabs = 1./pinv;
89  }
90  else
91  {
92  pabs = gRandom->Uniform(fPMin,fPMax);
93  }
94  }
95  else if (fPtRangeIsSet) {
96  if (fInversePIsSet)
97  {
98  pinv = gRandom->Uniform(1./fPtMax, 1./fPtMin);
99  pt = 1./pinv;
100  }
101  else
102  {
103  pt = gRandom->Uniform(fPtMin,fPtMax);
104  }
105  }
106 
107  if (fThetaRangeIsSet) {
108  if (fCosThetaIsSet)
109  theta = acos(gRandom->Uniform(cos(fThetaMin* TMath::DegToRad()),cos(fThetaMax* TMath::DegToRad())));
110  else
111  theta = gRandom->Uniform(fThetaMin,fThetaMax) * TMath::DegToRad();
112  }
113  else if (fEtaRangeIsSet) {
114  eta = gRandom->Uniform(fEtaMin,fEtaMax);
115  theta = 2*TMath::ATan(TMath::Exp(-eta));
116  }
117  else if (fYRangeIsSet) {
118  y = gRandom->Uniform(fYMin,fYMax);
119  mt = TMath::Sqrt(fPDGMass*fPDGMass + pt*pt);
120  pz = mt * TMath::SinH(y);
121  }
122 
124  if (fPRangeIsSet ) {
125  pz = pabs*TMath::Cos(theta);
126  pt = pabs*TMath::Sin(theta);
127  }
128  else if (fPtRangeIsSet)
129  pz = pt/TMath::Tan(theta);
130  }
131 
132  px = pt*TMath::Cos(phi);
133  py = pt*TMath::Sin(phi);
134 
135  if (fBoxVtxIsSet) {
136  fX = gRandom->Uniform(fX1,fX2);
137  fY = gRandom->Uniform(fY1,fY2);
138  }
139 
140  if (fDebug)
141  printf("BoxGen: kf=%d, p=(%.2f, %.2f, %.2f) GeV, x=(%.1f, %.1f, %.1f) cm\n",
142  fPDGType, px, py, pz, fX, fY, fZ);
143 
144  primGen->AddTrack(fPDGType, px, py, pz, fX, fY, fZ);
145  }
146  return kTRUE;
147 
148 }
friend F32vec4 acos(const F32vec4 &a)
Definition: P4_F32vec4.h:113
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
friend F32vec4 cos(const F32vec4 &a)
Definition: P4_F32vec4.h:112
Double32_t fYMax
Double32_t fPtMin
Double32_t fPhiMin
static T Sqrt(const T &x)
Definition: PndCAMath.h:37
Double32_t fEtaMin
Double32_t fPMax
static T Sin(const T &x)
Definition: PndCAMath.h:42
float Tan(float x)
Definition: PndCAMath.h:165
static T Cos(const T &x)
Definition: PndCAMath.h:43
Double32_t fPhiMax
FairPrimaryGenerator * primGen
Definition: sim_emc_apd.C:81
TString pt(TString pts, TString exts="px py pz")
Definition: invexp.C:133
Double32_t fThetaMax
Double32_t fPDGMass
Double32_t fThetaMin
Double32_t fPMin
Double32_t fEtaMax
Double32_t fYMin
TParticlePDG * eta
Double_t y
Double32_t fPtMax
double pz[39]
Definition: pipisigmas.h:14
void PndBoxGenerator::SetBoxXYZ ( Double32_t  x1 = 0,
Double32_t  y1 = 0,
Double32_t  x2 = 0,
Double32_t  y2 = 0,
Double32_t  z = 0 
)
inline

Definition at line 73 of file PndBoxGenerator.h.

References fBoxVtxIsSet, fX1, fX2, fY1, fY2, fZ, and z.

73  {
74  fX1=x1; fY1=y1; fX2=x2; fY2=y2; fZ=z; fBoxVtxIsSet=kTRUE;}
Double_t z
void PndBoxGenerator::SetCosTheta ( )
inline

Definition at line 64 of file PndBoxGenerator.h.

References fCosThetaIsSet.

Referenced by quickfsimana(), runMC(), sim_Gamma(), and PndMasterRunSim::UseBoxGenerator().

65  {fCosThetaIsSet=kTRUE;};
void PndBoxGenerator::SetDebug ( Bool_t  debug = 0)
inline

Definition at line 76 of file PndBoxGenerator.h.

References fDebug.

Referenced by quickfsimana(), and PndMasterRunSim::UseBoxGenerator().

76 {fDebug = debug;}
void PndBoxGenerator::SetEtaRange ( Double32_t  etamin = -5,
Double32_t  etamax = 7 
)
inline

Definition at line 55 of file PndBoxGenerator.h.

References fEtaMax, fEtaMin, and fEtaRangeIsSet.

56  {fEtaMin=etamin; fEtaMax=etamax; fEtaRangeIsSet=kTRUE;};
Double32_t fEtaMin
Double32_t fEtaMax
void PndBoxGenerator::SetInverseP ( )
inline

Definition at line 67 of file PndBoxGenerator.h.

References fInversePIsSet.

68  {fInversePIsSet=kTRUE;};
void PndBoxGenerator::SetMultiplicity ( Int_t  mult)
inline

Definition at line 44 of file PndBoxGenerator.h.

References fMult, and mult.

44 {fMult = mult; };
Double_t mult
void PndBoxGenerator::SetPDGType ( Int_t  pdg)
inline

Modifiers

Definition at line 42 of file PndBoxGenerator.h.

References fPDGType.

42 {fPDGType = pdg; };
void PndBoxGenerator::SetPhiRange ( Double32_t  phimin = 0,
Double32_t  phimax = 360 
)
inline
void PndBoxGenerator::SetPRange ( Double32_t  pmin = 0,
Double32_t  pmax = 10 
)
inline
void PndBoxGenerator::SetPtRange ( Double32_t  ptmin = 0,
Double32_t  ptmax = 10 
)
inline

Definition at line 49 of file PndBoxGenerator.h.

References fPtMax, fPtMin, and fPtRangeIsSet.

Referenced by PndMasterRunSim::UseBoxGenerator().

50  {fPtMin=ptmin; fPtMax=ptmax; fPtRangeIsSet=kTRUE;};
Double32_t fPtMin
Double32_t fPtMax
void PndBoxGenerator::SetThetaRange ( Double32_t  thetamin = 0,
Double32_t  thetamax = 90 
)
inline
void PndBoxGenerator::SetXYZ ( Double32_t  x = 0,
Double32_t  y = 0,
Double32_t  z = 0 
)
inline
void PndBoxGenerator::SetYRange ( Double32_t  ymin = -5,
Double32_t  ymax = 7 
)
inline

Definition at line 58 of file PndBoxGenerator.h.

References fYMax, fYMin, and fYRangeIsSet.

59  {fYMin=ymin; fYMax=ymax; fYRangeIsSet=kTRUE;};
Double32_t fYMax
Double32_t fYMin

Member Data Documentation

Bool_t PndBoxGenerator::fBoxVtxIsSet
private

Definition at line 108 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetBoxXYZ().

Bool_t PndBoxGenerator::fCosThetaIsSet
private

Definition at line 103 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetCosTheta().

Bool_t PndBoxGenerator::fDebug
private

Definition at line 109 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetDebug().

Double32_t PndBoxGenerator::fEtaMax
private

Definition at line 93 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetEtaRange().

Double32_t PndBoxGenerator::fEtaMin
private

Definition at line 93 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetEtaRange().

Bool_t PndBoxGenerator::fEtaRangeIsSet
private

Definition at line 100 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetEtaRange().

Bool_t PndBoxGenerator::fInversePIsSet
private

Definition at line 104 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetInverseP().

Int_t PndBoxGenerator::fMult
private

Definition at line 88 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetMultiplicity().

Double32_t PndBoxGenerator::fPDGMass
private

Definition at line 90 of file PndBoxGenerator.h.

Referenced by Init(), and ReadEvent().

Int_t PndBoxGenerator::fPDGType
private

Definition at line 87 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetPDGType().

Double32_t PndBoxGenerator::fPhiMax
private

Definition at line 92 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetPhiRange().

Double32_t PndBoxGenerator::fPhiMin
private

Definition at line 92 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetPhiRange().

Double32_t PndBoxGenerator::fPMax
private

Definition at line 95 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetPRange().

Double32_t PndBoxGenerator::fPMin
private

Definition at line 95 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetPRange().

Bool_t PndBoxGenerator::fPointVtxIsSet
private

Definition at line 107 of file PndBoxGenerator.h.

Referenced by Init(), and SetXYZ().

Bool_t PndBoxGenerator::fPRangeIsSet
private

Definition at line 106 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetPRange().

Double32_t PndBoxGenerator::fPtMax
private

Definition at line 91 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetPtRange().

Double32_t PndBoxGenerator::fPtMin
private

Definition at line 91 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetPtRange().

Bool_t PndBoxGenerator::fPtRangeIsSet
private

Definition at line 105 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetPtRange().

Double32_t PndBoxGenerator::fThetaMax
private

Definition at line 96 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetThetaRange().

Double32_t PndBoxGenerator::fThetaMin
private

Definition at line 96 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetThetaRange().

Bool_t PndBoxGenerator::fThetaRangeIsSet
private

Definition at line 102 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetThetaRange().

Double32_t PndBoxGenerator::fX
private

Definition at line 97 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetXYZ().

Double32_t PndBoxGenerator::fX1
private

Definition at line 98 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetBoxXYZ().

Double32_t PndBoxGenerator::fX2
private

Definition at line 98 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetBoxXYZ().

Double32_t PndBoxGenerator::fY
private

Definition at line 97 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetXYZ().

Double32_t PndBoxGenerator::fY1
private

Definition at line 98 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetBoxXYZ().

Double32_t PndBoxGenerator::fY2
private

Definition at line 98 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetBoxXYZ().

Double32_t PndBoxGenerator::fYMax
private

Definition at line 94 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetYRange().

Double32_t PndBoxGenerator::fYMin
private

Definition at line 94 of file PndBoxGenerator.h.

Referenced by ReadEvent(), and SetYRange().

Bool_t PndBoxGenerator::fYRangeIsSet
private

Definition at line 101 of file PndBoxGenerator.h.

Referenced by Init(), ReadEvent(), and SetYRange().

Double32_t PndBoxGenerator::fZ
private

Definition at line 97 of file PndBoxGenerator.h.

Referenced by ReadEvent(), SetBoxXYZ(), and SetXYZ().


The documentation for this class was generated from the following files: