Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class GeneratorPythia8HFEmbedCharmNuclei : public o2::eventgen::GeneratorPythia8
public:

/// constructor
GeneratorPythia8HFEmbedCharmNuclei(int pdgCode = 2010010020, float lifetime = 1.f, int nCharmNucleiPerEvent = 10, float yMin = -1.f, float yMax = 1.f, float ptMax = 25.f, bool trivialCoal = false, float coalMomentum = 0.2, float fracFromB = 0.f)
GeneratorPythia8HFEmbedCharmNuclei(int pdgCode = 2010010020, float lifetime = 1.f, int nCharmNucleiPerEvent = 10, float yMin = -1.f, float yMax = 1.f, float ptMax = 25.f, bool trivialCoal = false, float coalMomentum = 0.2, float fracFromB = 0.f, unsigned int seed = 0u)
{
nNumberOfCharmNucleiPerEvent = nCharmNucleiPerEvent;
mRapidityMinCharmNuclei = yMin;
Expand All @@ -33,6 +33,7 @@ class GeneratorPythia8HFEmbedCharmNuclei : public o2::eventgen::GeneratorPythia8
mFractionFromBeauty = fracFromB;
mPdgCharmNucleus = pdgCode;
mSign = 1;
mUsedSeed = seed;
if (std::abs(mPdgCharmNucleus) == 2010010020) {
mMassCharmNucleus = 3.226f;
} else {
Expand Down Expand Up @@ -63,6 +64,9 @@ class GeneratorPythia8HFEmbedCharmNuclei : public o2::eventgen::GeneratorPythia8
LOG(fatal) << "Failed to init \'GeneratorPythia8\': problems with configuration file " << cfg;
}

mPythiaGun.readString("Random:setSeed = on");
mPythiaGun.readString("Random:seed = " + std::to_string(seed));

if (!mPythiaGun.init()) {
LOG(fatal) << "Failed to init \'GeneratorPythia8\': init returned with error";
}
Expand Down Expand Up @@ -170,7 +174,8 @@ class GeneratorPythia8HFEmbedCharmNuclei : public o2::eventgen::GeneratorPythia8
mPythiaGun.moreDecays();
std::array<int, 2> dausToCoal = {-1, -1};
std::vector<int> pdgShortLivedResos = {313, 2224, 102134};
std::map<int, int> statusResoDecay = {{313, 95}, {2224, 96}, {102134, 97}}; // do not use 94, it is used by default for no resonances
std::map<int, int> statusResoDecay = {{313, -85}, {2224, -86}, {102134, -87}}; // do not use 94, it is used by default for no resonances
std::map<int, int> statusResoDecayFromB = {{313, -95}, {2224, -96}, {102134, -97}}; // do not use 94, it is used by default for no resonances
int whichReso{0};
int idxCharmNucleus{-1};
for (int iPart{0}; iPart<mPythiaGun.event.size(); ++iPart) {
Expand Down Expand Up @@ -245,7 +250,11 @@ class GeneratorPythia8HFEmbedCharmNuclei : public o2::eventgen::GeneratorPythia8
// we try the coalescence here, if successful we copy particles in the pythia event and we move to the next charm nucleus
isCoalSuccess = CoalescencePythia8(mPythiaGun.event, std::vector<unsigned int>{1000010020}, mTrivialCoal, mCoalMomentum, dausToCoal[0], dausToCoal[1], 10.);
if (whichReso > 0) {
mPythiaGun.event[idxCharmNucleus].status(statusResoDecay[whichReso]);
if (isFromB) {
mPythiaGun.event[idxCharmNucleus].status(statusResoDecayFromB[whichReso]);
} else {
mPythiaGun.event[idxCharmNucleus].status(statusResoDecay[whichReso]);
}
}
if (isCoalSuccess) {
restoreEnergyConservation(mPythiaGun.event, idxCharmNucleus);
Expand Down Expand Up @@ -332,8 +341,8 @@ private:
///___________________________________________________________
FairGenerator *GenerateHFEmbedCDeuteron(float lifetime = 1.f, int nCharmNucleiPerEvent = 10, float yMin = -1.f, float yMax = 1.f, float ptMax = 25.f, bool trivialCoal = false, float coalMomentum = 0.2f, float fracFromB = 0.25f)
{
auto myGen = new GeneratorPythia8HFEmbedCharmNuclei(2010010020, lifetime, nCharmNucleiPerEvent, yMin, yMax, ptMax, trivialCoal, coalMomentum, fracFromB);
auto seed = (gRandom->TRandom::GetSeed() % 900000000);
auto myGen = new GeneratorPythia8HFEmbedCharmNuclei(2010010020, lifetime, nCharmNucleiPerEvent, yMin, yMax, ptMax, trivialCoal, coalMomentum, fracFromB, seed);
myGen->readString("Random:setSeed on");
myGen->readString("Random:seed " + std::to_string(seed));
return myGen;
Expand Down
Loading