Skip to content

Commit f8b2432

Browse files
committed
Fix seed initialisation of c-deuteron gun and status codes
1 parent b4a073b commit f8b2432

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

MC/config/PWGHF/external/generator/generator_pythia8_embed_charmnuclei.C

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class GeneratorPythia8HFEmbedCharmNuclei : public o2::eventgen::GeneratorPythia8
2222
public:
2323

2424
/// constructor
25-
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)
25+
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)
2626
{
2727
nNumberOfCharmNucleiPerEvent = nCharmNucleiPerEvent;
2828
mRapidityMinCharmNuclei = yMin;
@@ -33,6 +33,7 @@ class GeneratorPythia8HFEmbedCharmNuclei : public o2::eventgen::GeneratorPythia8
3333
mFractionFromBeauty = fracFromB;
3434
mPdgCharmNucleus = pdgCode;
3535
mSign = 1;
36+
mUsedSeed = seed;
3637
if (std::abs(mPdgCharmNucleus) == 2010010020) {
3738
mMassCharmNucleus = 3.226f;
3839
} else {
@@ -63,6 +64,9 @@ class GeneratorPythia8HFEmbedCharmNuclei : public o2::eventgen::GeneratorPythia8
6364
LOG(fatal) << "Failed to init \'GeneratorPythia8\': problems with configuration file " << cfg;
6465
}
6566

67+
mPythiaGun.readString("Random:setSeed = on");
68+
mPythiaGun.readString("Random:seed = " + std::to_string(seed));
69+
6670
if (!mPythiaGun.init()) {
6771
LOG(fatal) << "Failed to init \'GeneratorPythia8\': init returned with error";
6872
}
@@ -170,7 +174,8 @@ class GeneratorPythia8HFEmbedCharmNuclei : public o2::eventgen::GeneratorPythia8
170174
mPythiaGun.moreDecays();
171175
std::array<int, 2> dausToCoal = {-1, -1};
172176
std::vector<int> pdgShortLivedResos = {313, 2224, 102134};
173-
std::map<int, int> statusResoDecay = {{313, 95}, {2224, 96}, {102134, 97}}; // do not use 94, it is used by default for no resonances
177+
std::map<int, int> statusResoDecay = {{313, -85}, {2224, -86}, {102134, -87}}; // do not use 94, it is used by default for no resonances
178+
std::map<int, int> statusResoDecayFromB = {{313, -95}, {2224, -96}, {102134, -97}}; // do not use 94, it is used by default for no resonances
174179
int whichReso{0};
175180
int idxCharmNucleus{-1};
176181
for (int iPart{0}; iPart<mPythiaGun.event.size(); ++iPart) {
@@ -245,7 +250,11 @@ class GeneratorPythia8HFEmbedCharmNuclei : public o2::eventgen::GeneratorPythia8
245250
// we try the coalescence here, if successful we copy particles in the pythia event and we move to the next charm nucleus
246251
isCoalSuccess = CoalescencePythia8(mPythiaGun.event, std::vector<unsigned int>{1000010020}, mTrivialCoal, mCoalMomentum, dausToCoal[0], dausToCoal[1], 10.);
247252
if (whichReso > 0) {
248-
mPythiaGun.event[idxCharmNucleus].status(statusResoDecay[whichReso]);
253+
if (isFromB) {
254+
mPythiaGun.event[idxCharmNucleus].status(statusResoDecayFromB[whichReso]);
255+
} else {
256+
mPythiaGun.event[idxCharmNucleus].status(statusResoDecay[whichReso]);
257+
}
249258
}
250259
if (isCoalSuccess) {
251260
restoreEnergyConservation(mPythiaGun.event, idxCharmNucleus);
@@ -332,8 +341,8 @@ private:
332341
///___________________________________________________________
333342
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)
334343
{
335-
auto myGen = new GeneratorPythia8HFEmbedCharmNuclei(2010010020, lifetime, nCharmNucleiPerEvent, yMin, yMax, ptMax, trivialCoal, coalMomentum, fracFromB);
336344
auto seed = (gRandom->TRandom::GetSeed() % 900000000);
345+
auto myGen = new GeneratorPythia8HFEmbedCharmNuclei(2010010020, lifetime, nCharmNucleiPerEvent, yMin, yMax, ptMax, trivialCoal, coalMomentum, fracFromB, seed);
337346
myGen->readString("Random:setSeed on");
338347
myGen->readString("Random:seed " + std::to_string(seed));
339348
return myGen;

0 commit comments

Comments
 (0)