9 #include "ERIonMixGenerator.h" 15 #include "TDatabasePDG.h" 16 #include "TObjArray.h" 17 #include "TParticle.h" 18 #include "TParticlePDG.h" 23 #include "FairParticle.h" 24 #include "FairPrimaryGenerator.h" 25 #include "FairRunSim.h" 26 #include "FairLogger.h" 57 FairRunSim* run = FairRunSim::Instance();
59 LOG(ERROR) <<
"No FairRun instantised!" 62 run->AddNewIon(
new FairIon(name, z, a, q));
72 Double_t gausRigidity, sigmaRigidity;
73 Double_t pMin = fPMin, pMax =
fPMax;
77 for (Int_t k = 0; k <
fMult; k++) {
82 [randResult](
const std::pair<Double_t, TString> &t)->
bool 84 return (t.first > randResult);
87 (it ==
fBgIons.end()) ? ionName =
fIon->GetName() : ionName = it->second;
89 TParticlePDG* thisPart =
90 TDatabasePDG::Instance()->GetParticle(ionName);
92 LOG(WARNING) <<
"ERIonGenerator: Ion " << ionName
93 <<
" not found in database!" << FairLogger::endl;
97 Double_t charge = thisPart->Charge();
100 rigidityMin = pMin /
fIon->GetZ() / 3;
101 rigidityMax = pMax /
fIon->GetZ() / 3;
102 fPMin = rigidityMin * charge;
103 fPMax = rigidityMax * charge;
107 gausRigidity = pGaus /
fIon->GetZ() / 3;
109 fGausP = gausRigidity * charge;
110 fSigmaP = sigmaRigidity * charge;
112 LOG(DEBUG) <<
"Pmin " << fPMin <<
" Pmax " <<
fPMax <<
" GausP " <<
fGausP << FairLogger::endl;
115 int pdgType = thisPart->PdgCode();
117 LOG(DEBUG) <<
"ERIonGenerator: Generating " << fMult <<
" ions of type " 118 << ionName <<
" (PDG code " << pdgType <<
")" 120 LOG(DEBUG) <<
" Momentum (" << fPx <<
", " << fPy <<
", " <<
fPz 121 <<
") Gev from vertex (" << fX <<
", " << fY
122 <<
", " <<
fZ <<
") cm" << FairLogger::endl;
123 primGen->AddTrack(pdgType, fPx, fPy,
fPz, fX, fY,
fZ);
Double32_t fGausP
Amplitude value of momentum in Gauss distibution [GeV].
std::map< Double_t, TString > fBgIons
Background ion names with emegence probability.
Int_t fMult
Multiplicity per event.
Double32_t fZ
Point vertex coordinates [cm].
Bool_t fPRangeIsSet
True if abs momentum range is set.
Double_t fSumProbability
Background ions summary probability.
virtual ~ERIonMixGenerator()
Destructor.
Bool_t ReadEvent(FairPrimaryGenerator *primGen)
Method ReadEvent Generates <mult> of the specified ions and hands hem to the FairPrimaryGenerator.
FairIon * fIon
Pointer to the FairIon to be generated.
Class for the generation different ions during one simulation.
void SpreadingParameters(void)
Spreads parameters recieved by accessor methods.
Double32_t fPz
Momentum projection [GeV].
void AddBackgroundIon(TString name, Int_t z, Int_t a, Int_t q, Double_t newIonProb)
Adds background ions with probability of appearance in simulation. Probability of primary ion is 1...
Double32_t fPMax
Momentum range in lab system.
void SetPhiRange(Double32_t phimin=0, Double32_t phimax=360)
Defines uniform distribution boundaries of ion azimuth angle[degree].
Double32_t fSigmaP
Momentum normal deviation [GeV].
Class for the generation ion.
Bool_t fSigmaPIsSet
True if Gauss distribution for momentum is set.