BmnRoot
26.10.0-18-g4e3414f9
Software framework of the BM@N experiment
Toggle main menu visibility
Loading...
Searching...
No Matches
MpdHypYPtGenerator.cxx
Go to the documentation of this file.
1
// -------------------------------------------------------------------------
2
// ----- CbmAnaHypYPtGenerator source file -----
3
// ----- Created 03/10/04 by E. Kryshen -----
4
// ----- Updated 10/02/10 by A. Zinchenko for MPD (with name change) -----
5
// -------------------------------------------------------------------------
6
7
#include "
MpdHypYPtGenerator.h
"
8
9
#include "FairPrimaryGenerator.h"
10
#include "
TDatabasePDG.h
"
11
#include "
TF1.h
"
12
#include "
TMath.h
"
13
#include "
TParticlePDG.h
"
14
#include "
TRandom.h
"
15
16
// ------------------------------------------------------------------------
17
MpdHypYPtGenerator::MpdHypYPtGenerator
()
18
:
FairGenerator
()
19
{
20
// Default constructor
21
22
fPDGType
= -1;
23
fMult
= 0;
24
}
25
26
// ------------------------------------------------------------------------
27
MpdHypYPtGenerator::MpdHypYPtGenerator
(
Int_t
pdgid,
Int_t
mult,
Double_t
yield)
28
:
FairGenerator
()
29
,
fPDGType
(pdgid)
30
,
fMult
(mult)
31
,
fYield
(yield)
32
{
33
// Constructor. Set default distributions
34
35
SetDistributionPt
();
36
SetDistributionY
();
37
SetRangePt
();
38
}
39
// ------------------------------------------------------------------------
40
Bool_t
MpdHypYPtGenerator::Init
()
41
{
42
// Initialize generator
43
44
// Check for particle type
45
TDatabasePDG
* pdgBase =
TDatabasePDG::Instance
();
46
TParticlePDG
* particle = pdgBase->
GetParticle
(
fPDGType
);
47
if
(!particle) {
48
Fatal
(
"CbmAnaHypYPtGenerator"
,
"PDG code %d not defined."
,
fPDGType
);
49
return
kFALSE
;
50
}
51
fPDGMass
= particle->
Mass
();
52
// gRandom->SetSeed(0);
53
fDistPt
=
new
TF1
(
"distPt"
,
"x*exp(-sqrt(x*x+[1]*[1])/[0])"
,
fPtMin
,
fPtMax
);
54
fDistPt
->SetParameters(
fT
,
fPDGMass
,
fY0
,
fSigma
);
55
Info
(
"Init"
,
"pdg=%i y0=%4.2f sigma_y=%4.2f T_pt=%6.4f"
,
fPDGType
,
fY0
,
fSigma
,
fT
);
56
return
kTRUE
;
57
}
58
59
// ------------------------------------------------------------------------
60
Bool_t
MpdHypYPtGenerator::ReadEvent
(FairPrimaryGenerator* primGen)
61
{
62
63
Double_t
phi, pt, y, mt, px, py, pz;
64
gRandom
->Rndm();
65
if
(
fYield
> 0 &&
gRandom
->Rndm() >
fYield
)
66
return
kTRUE
;
67
68
// Generate particles
69
70
for
(
Int_t
k = 0; k <
fMult
; k++) {
71
72
phi =
gRandom
->Uniform(0,
TMath::TwoPi
());
73
pt =
fDistPt
->GetRandom(
fPtMin
,
fPtMax
);
74
px = pt *
TMath::Cos
(phi);
75
py = pt *
TMath::Sin
(phi);
76
y =
gRandom
->Gaus(
fY0
,
fSigma
);
77
mt =
TMath::Sqrt
(
fPDGMass
*
fPDGMass
+ pt * pt);
78
pz = mt *
TMath::SinH
(y);
79
Info
(
"ReadEvent"
,
"Particle generated: pdg=%i pt=%f y=%f\n"
,
fPDGType
, pt, y);
80
primGen->AddTrack(
fPDGType
, px, py, pz, 0, 0, 0);
81
}
82
return
kTRUE
;
83
}
84
// ------------------------------------------------------------------------
Bool_t
bool Bool_t
Int_t
int Int_t
kFALSE
constexpr Bool_t kFALSE
Double_t
double Double_t
kTRUE
constexpr Bool_t kTRUE
TDatabasePDG.h
Info
void Info(const char *location, const char *msgfmt,...)
Fatal
void Fatal(const char *location, const char *msgfmt,...)
TF1.h
TMath.h
TParticlePDG.h
TRandom.h
gRandom
R__EXTERN TRandom * gRandom
FairGenerator
MpdHypYPtGenerator::fPDGType
Int_t fPDGType
Particle type (PDG encoding).
Definition
MpdHypYPtGenerator.h:68
MpdHypYPtGenerator::fYield
Double_t fYield
Pointer to the Pt function.
Definition
MpdHypYPtGenerator.h:77
MpdHypYPtGenerator::fPDGMass
Double_t fPDGMass
Particle mass [GeV].
Definition
MpdHypYPtGenerator.h:75
MpdHypYPtGenerator::fT
Double_t fT
Temperature in the Pt distribution.
Definition
MpdHypYPtGenerator.h:70
MpdHypYPtGenerator::fY0
Double_t fY0
Mean rapidity.
Definition
MpdHypYPtGenerator.h:71
MpdHypYPtGenerator::fSigma
Double_t fSigma
Simga in the rapidity distribution.
Definition
MpdHypYPtGenerator.h:72
MpdHypYPtGenerator::MpdHypYPtGenerator
MpdHypYPtGenerator()
Default constructor.
Definition
MpdHypYPtGenerator.cxx:17
MpdHypYPtGenerator::ReadEvent
virtual Bool_t ReadEvent(FairPrimaryGenerator *primGen)
Creates an event with given type and multiplicity.
Definition
MpdHypYPtGenerator.cxx:60
MpdHypYPtGenerator::SetDistributionPt
void SetDistributionPt(Double_t T=0.223)
Definition
MpdHypYPtGenerator.h:46
MpdHypYPtGenerator::SetRangePt
void SetRangePt(Double_t ptMin=0, Double_t ptMax=3)
Definition
MpdHypYPtGenerator.h:53
MpdHypYPtGenerator::fMult
Int_t fMult
Multiplicity.
Definition
MpdHypYPtGenerator.h:69
MpdHypYPtGenerator::fPtMax
Double_t fPtMax
Min value of Pt.
Definition
MpdHypYPtGenerator.h:74
MpdHypYPtGenerator::fPtMin
Double_t fPtMin
Max value of Pt.
Definition
MpdHypYPtGenerator.h:73
MpdHypYPtGenerator::SetDistributionY
void SetDistributionY(Double_t y0=0, Double_t sigma=0.72)
Definition
MpdHypYPtGenerator.h:48
MpdHypYPtGenerator::Init
Bool_t Init()
Initializer.
Definition
MpdHypYPtGenerator.cxx:40
MpdHypYPtGenerator::fDistPt
TF1 * fDistPt
Definition
MpdHypYPtGenerator.h:76
TDatabasePDG
TDatabasePDG::Instance
static TDatabasePDG * Instance()
TDatabasePDG::GetParticle
TParticlePDG * GetParticle(const char *name) const
TF1
TParticlePDG
TParticlePDG::Mass
Double_t Mass() const
MpdHypYPtGenerator.h
TMath::Sqrt
Double_t Sqrt(Double_t x)
TMath::Cos
Double_t Cos(Double_t)
TMath::Sin
Double_t Sin(Double_t)
TMath::TwoPi
constexpr Double_t TwoPi()
TMath::SinH
Double_t SinH(Double_t)
generators
MpdHypYPtGenerator.cxx
Generated on
for BmnRoot by
1.17.0