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

#include <PndGasGenerator.h>

Inheritance diagram for PndGasGenerator:

Public Member Functions

 PndGasGenerator ()
 
 PndGasGenerator (Int_t pdgid, Int_t mult=1)
 
virtual ~PndGasGenerator ()
 
void SetPDGType (Int_t pdg)
 
void SetMultiplicity (Int_t mult)
 
void SetPRange (Double32_t pmin=0, Double32_t pmax=10)
 
void SetPhiRange (Double32_t phimin=0, Double32_t phimax=360)
 
void SetThetaRange (Double32_t thetamin=0, Double32_t thetamax=90)
 
void SetCosTheta ()
 
void SetZRange (Double32_t zmin=0, Double32_t zmax=10)
 
void SetRadius (Double32_t radius=0.2)
 
void SetDebug (Bool_t debug=0)
 
Bool_t Init ()
 
virtual Bool_t ReadEvent (FairPrimaryGenerator *primGen)
 

Private Member Functions

 ClassDef (PndGasGenerator, 1)
 

Private Attributes

Int_t fPDGType
 
Int_t fMult
 
Double32_t fPDGMass
 
Double32_t fPhiMin
 
Double32_t fPhiMax
 
Double32_t fPMin
 
Double32_t fPMax
 
Double32_t fThetaMin
 
Double32_t fThetaMax
 
Double32_t fX
 
Double32_t fY
 
Double32_t fZ
 
Double32_t fRadius
 
Bool_t fThetaRangeIsSet
 
Bool_t fCosThetaIsSet
 
Bool_t fPRangeIsSet
 
Double32_t fZMin
 
Double32_t fZMax
 
Bool_t fDebug
 
TF1 * fDensityProfile
 

Detailed Description

Definition at line 30 of file PndGasGenerator.h.

Constructor & Destructor Documentation

PndGasGenerator::PndGasGenerator ( )

Default constructor.

Definition at line 18 of file PndGasGenerator.cxx.

18  :
19  fPDGType(0),fMult(0),fPDGMass(0),
20  fPhiMin(0),fPhiMax(0),
21  fPMin(0),fPMax(0),fThetaMin(0),fThetaMax(0),fX(0),fY(0),fZ(0),
24  fZMin(0.), fZMax(10.), fDensityProfile(NULL)
25 {
26  // Default constructor
27 }
Double32_t fPDGMass
Double32_t fPhiMax
Double32_t fPMax
Double32_t fThetaMax
Double32_t fZMin
Double32_t fPMin
Double32_t fThetaMin
Double32_t fPhiMin
Double32_t fZMax
PndGasGenerator::PndGasGenerator ( Int_t  pdgid,
Int_t  mult = 1 
)

Constructor with PDG-ID, multiplicity

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

Definition at line 30 of file PndGasGenerator.cxx.

References SetPhiRange().

30  :
31  fPDGType(pdgid),fMult(mult),fPDGMass(0),
32  fPMin(0),fPMax(0),fX(0),fY(0),fZ(0),
35  fZMin(0.), fZMax(10.), fDensityProfile(NULL)
36 {
37  // Constructor. Set default kinematics limits
38  SetPhiRange ();
39 }
Double32_t fPDGMass
Double32_t fPMax
Double32_t fZMin
Double32_t fPMin
void SetPhiRange(Double32_t phimin=0, Double32_t phimax=360)
Double_t mult
Double32_t fZMax
virtual PndGasGenerator::~PndGasGenerator ( )
inlinevirtual

Destructor

Definition at line 45 of file PndGasGenerator.h.

45 {};

Member Function Documentation

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

Initializer

Definition at line 42 of file PndGasGenerator.cxx.

References fDensityProfile, fPDGMass, fPDGType, fPhiMax, fPhiMin, fZMax, fZMin, and particle.

43 {
44  // Initialize generator
45 
46  if (fPhiMax-fPhiMin>360)
47  Fatal("Init()","PndGasGenerator: phi range is too wide: %f<phi<%f",
49 
50  // Check for particle type
51  TDatabasePDG* pdgBase = TDatabasePDG::Instance();
52  TParticlePDG *particle = pdgBase->GetParticle(fPDGType);
53  if (! particle) Fatal("PndGasGenerator","PDG code %d not defined.",fPDGType);
54  fPDGMass = particle->Mass();
55 
56  // create the density profile histogram used later to get the random
57  // z position
58  fDensityProfile = new TF1("Density Profile","exp(-0.5*((x)/4)**2)",fZMin,fZMax);
59  return kTRUE;
60 }
Double32_t fPDGMass
Double32_t fPhiMax
const int particle
Double32_t fZMin
Double32_t fPhiMin
Double32_t fZMax
Bool_t PndGasGenerator::ReadEvent ( FairPrimaryGenerator *  primGen)
virtual

Creates an event with given type and multiplicity.

Parameters
primGenpointer to the FairPrimaryGenerator

Definition at line 63 of file PndGasGenerator.cxx.

References acos(), CAMath::Cos(), cos(), fCosThetaIsSet, fDebug, fDensityProfile, fMult, fPDGType, fPhiMax, fPhiMin, fPMax, fPMin, fRadius, fThetaMax, fThetaMin, fX, fY, fZ, phi, printf(), pt(), pz, CAMath::Sin(), and theta.

64 {
65  // Generate one event: produce primary particles emitted from one vertex.
66  // Primary particles are distributed uniformly along
67  // those kinematics variables which were limitted by setters.
68  // if SetCosTheta() function is used, the distribution will be uniform in cos(theta)
69 
70  Double32_t pabs, phi, pt, theta=0, px, py, pz;
71  //Double32_t eta, pinv, y, mt=0; //[R.K. 01/2017] unused variable?
72 
73  // Generate particles
74  for (Int_t k = 0; k < fMult; k++) {
75 
76  phi = gRandom->Uniform(fPhiMin,fPhiMax) * TMath::DegToRad();
77 
78  pabs = gRandom->Uniform(fPMin,fPMax);
79 
80 
81  if (fCosThetaIsSet) {
82  theta = acos(gRandom->Uniform(cos(fThetaMin* TMath::DegToRad()),cos(fThetaMax* TMath::DegToRad())));
83  } else {
84  theta = gRandom->Uniform(fThetaMin,fThetaMax) * TMath::DegToRad();
85  }
86 
87 
88 
89  pz = pabs*TMath::Cos(theta);
90  pt = pabs*TMath::Sin(theta);
91 
92  px = pt*TMath::Cos(phi);
93  py = pt*TMath::Sin(phi);
94 
95  // Random 2D point in a circle of radius r (simple beamprofile)
96  gRandom->Circle(fX, fY, fRadius);
97 
98  // calculate fZ according to some (probability) density function of the gas
99  fZ=fDensityProfile->GetRandom();
100 
101  if (fDebug)
102  printf("GasGen: kf=%d, p=(%.2f, %.2f, %.2f) GeV, x=(%.1f, %.1f, %.1f) cm\n",
103  fPDGType, px, py, pz, fX, fY, fZ);
104 
105 
106 
107  primGen->AddTrack(fPDGType, px, py, pz, fX, fY, fZ);
108 
109 
110 
111  }
112  return kTRUE;
113 
114 }
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 fPhiMax
static T Sin(const T &x)
Definition: PndCAMath.h:42
static T Cos(const T &x)
Definition: PndCAMath.h:43
Double32_t fPMax
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 fPMin
Double32_t fRadius
Double32_t fThetaMin
Double32_t fPhiMin
double pz[39]
Definition: pipisigmas.h:14
void PndGasGenerator::SetCosTheta ( )
inline

Definition at line 61 of file PndGasGenerator.h.

References fCosThetaIsSet.

62  {fCosThetaIsSet=kTRUE;};
void PndGasGenerator::SetDebug ( Bool_t  debug = 0)
inline

Definition at line 71 of file PndGasGenerator.h.

References fDebug.

71 {fDebug = debug;}
void PndGasGenerator::SetMultiplicity ( Int_t  mult)
inline

Definition at line 50 of file PndGasGenerator.h.

References fMult, and mult.

50 {fMult = mult; };
Double_t mult
void PndGasGenerator::SetPDGType ( Int_t  pdg)
inline

Modifiers

Definition at line 48 of file PndGasGenerator.h.

References fPDGType.

48 {fPDGType = pdg; };
void PndGasGenerator::SetPhiRange ( Double32_t  phimin = 0,
Double32_t  phimax = 360 
)
inline

Definition at line 55 of file PndGasGenerator.h.

References fPhiMax, and fPhiMin.

Referenced by PndGasGenerator().

56  {fPhiMin=phimin; fPhiMax=phimax;};
Double32_t fPhiMax
Double32_t fPhiMin
void PndGasGenerator::SetPRange ( Double32_t  pmin = 0,
Double32_t  pmax = 10 
)
inline

Definition at line 52 of file PndGasGenerator.h.

References fPMax, fPMin, and fPRangeIsSet.

53  {fPMin=pmin; fPMax=pmax; fPRangeIsSet=kTRUE;}
Double32_t fPMax
Double32_t fPMin
void PndGasGenerator::SetRadius ( Double32_t  radius = 0.2)
inline

Definition at line 67 of file PndGasGenerator.h.

References fRadius.

67 {fRadius=radius;}
Double32_t fRadius
void PndGasGenerator::SetThetaRange ( Double32_t  thetamin = 0,
Double32_t  thetamax = 90 
)
inline

Definition at line 58 of file PndGasGenerator.h.

References fThetaMax, fThetaMin, and fThetaRangeIsSet.

59  {fThetaMin=thetamin; fThetaMax=thetamax; fThetaRangeIsSet=kTRUE;};
Double32_t fThetaMax
Double32_t fThetaMin
void PndGasGenerator::SetZRange ( Double32_t  zmin = 0,
Double32_t  zmax = 10 
)
inline

Definition at line 64 of file PndGasGenerator.h.

References fZMax, and fZMin.

65  {fZMin=zmin; fZMax=zmax;}
Double32_t fZMin
Double32_t fZMax

Member Data Documentation

Bool_t PndGasGenerator::fCosThetaIsSet
private

Definition at line 93 of file PndGasGenerator.h.

Referenced by ReadEvent(), and SetCosTheta().

Bool_t PndGasGenerator::fDebug
private

Definition at line 96 of file PndGasGenerator.h.

Referenced by ReadEvent(), and SetDebug().

TF1* PndGasGenerator::fDensityProfile
private

Definition at line 99 of file PndGasGenerator.h.

Referenced by Init(), and ReadEvent().

Int_t PndGasGenerator::fMult
private

Definition at line 83 of file PndGasGenerator.h.

Referenced by ReadEvent(), and SetMultiplicity().

Double32_t PndGasGenerator::fPDGMass
private

Definition at line 85 of file PndGasGenerator.h.

Referenced by Init().

Int_t PndGasGenerator::fPDGType
private

Definition at line 82 of file PndGasGenerator.h.

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

Double32_t PndGasGenerator::fPhiMax
private

Definition at line 86 of file PndGasGenerator.h.

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

Double32_t PndGasGenerator::fPhiMin
private

Definition at line 86 of file PndGasGenerator.h.

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

Double32_t PndGasGenerator::fPMax
private

Definition at line 87 of file PndGasGenerator.h.

Referenced by ReadEvent(), and SetPRange().

Double32_t PndGasGenerator::fPMin
private

Definition at line 87 of file PndGasGenerator.h.

Referenced by ReadEvent(), and SetPRange().

Bool_t PndGasGenerator::fPRangeIsSet
private

Definition at line 94 of file PndGasGenerator.h.

Referenced by SetPRange().

Double32_t PndGasGenerator::fRadius
private

Definition at line 90 of file PndGasGenerator.h.

Referenced by ReadEvent(), and SetRadius().

Double32_t PndGasGenerator::fThetaMax
private

Definition at line 88 of file PndGasGenerator.h.

Referenced by ReadEvent(), and SetThetaRange().

Double32_t PndGasGenerator::fThetaMin
private

Definition at line 88 of file PndGasGenerator.h.

Referenced by ReadEvent(), and SetThetaRange().

Bool_t PndGasGenerator::fThetaRangeIsSet
private

Definition at line 92 of file PndGasGenerator.h.

Referenced by SetThetaRange().

Double32_t PndGasGenerator::fX
private

Definition at line 89 of file PndGasGenerator.h.

Referenced by ReadEvent().

Double32_t PndGasGenerator::fY
private

Definition at line 89 of file PndGasGenerator.h.

Referenced by ReadEvent().

Double32_t PndGasGenerator::fZ
private

Definition at line 89 of file PndGasGenerator.h.

Referenced by ReadEvent().

Double32_t PndGasGenerator::fZMax
private

Definition at line 95 of file PndGasGenerator.h.

Referenced by Init(), and SetZRange().

Double32_t PndGasGenerator::fZMin
private

Definition at line 95 of file PndGasGenerator.h.

Referenced by Init(), and SetZRange().


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