From 10623d9ac93e6869624221fc1d33b6660c10d277 Mon Sep 17 00:00:00 2001 From: Gauthier Legras Date: Mon, 14 Sep 2026 17:45:57 +0200 Subject: [PATCH 1/6] [PWGDQ] possiblity to trigger all quarkonia --- .../BTOPSIJPSITODIELECTRON.DEC | 42 +++++++++-- ...enerator_pythia8_HadronTriggered_withGap.C | 73 +++++++++++++++++-- .../pythia8/decayer/switchOffAllQuarkonia.cfg | 18 +++++ .../PWGDQ/pythia8/decayer/switchOffJpsi.cfg | 1 + .../generator/pythia8_oniaAll_triggerGap.cfg | 12 +++ 5 files changed, 136 insertions(+), 10 deletions(-) create mode 100644 MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg create mode 100644 MC/config/PWGDQ/pythia8/generator/pythia8_oniaAll_triggerGap.cfg diff --git a/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC index 4c3e5a129..6abb55931 100644 --- a/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC +++ b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC @@ -335,28 +335,60 @@ Decay anti-Omega_b+ 0.00047 anti-Omega+ J/psi PHSP; Enddecay +Decay B_c- +# SemiLeptonic Decays +0.01900 J/psi e- anti-nu_e PHOTOS BC_VMN 1; +0.00094 psi(2S) e- anti-nu_e PHOTOS BC_VMN 1; +Enddecay + +Decay B_c+ +# SemiLeptonic Decays +0.01900 J/psi e+ nu_e PHOTOS BC_VMN 1; +0.00094 psi(2S) e+ nu_e PHOTOS BC_VMN 1; +Enddecay + # ============================================================================================================================= -# JPsi, Psi(2S), ChiC Decays +# JPsi, Psi(2S), ChiC, Upsilon Decays # ============================================================================================================================= +### +Decay chi_c0 +0.0135 gamma J/psi PHSP; +0.000129 J/psi e+ e- PHOTOS PHSP; +Enddecay + ### Decay chi_c1 - 1.000 J/psi gamma PHSP; +0.339 J/psi gamma VVP 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; +0.00342 J/psi e+ e- PHOTOS PHSP; Enddecay ### Decay chi_c2 - 1.000 J/psi gamma PHSP; +0.190 gamma J/psi PHSP; +0.00214 J/psi e+ e- PHOTOS PHSP; Enddecay Decay psi(2S) -### from DECAY.DEC -1.000 e+ e- PHOTOS VLL; +0.00795 e+ e- PHOTOS VLL; +0.3478 J/psi pi+ pi- VVPIPI; Enddecay Decay J/psi 1.000 e+ e- PHOTOS VLL; Enddecay +Decay Upsilon +1.000 e+ e- PHOTOS VLL; +Enddecay + +Decay Upsilon(2S) +1.000 e+ e- PHOTOS VLL; +Enddecay + +Decay Upsilon(3S) +1.000 e+ e- PHOTOS VLL; +Enddecay + End diff --git a/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C b/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C index d34092a8c..08f6b3cf5 100644 --- a/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C +++ b/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C @@ -19,14 +19,14 @@ class GeneratorPythia8HadronTriggeredWithGap : public o2::eventgen::GeneratorPyt public: /// constructor - GeneratorPythia8HadronTriggeredWithGap(int inputTriggerRatio = 5) { + GeneratorPythia8HadronTriggeredWithGap(int inputTriggerRatio = 5, bool useOniaShower = false) { mGeneratedEvents = 0; mInverseTriggerRatio = inputTriggerRatio; // define minimum bias event generator auto seed = (gRandom->TRandom::GetSeed() % 900000000); // main physics option for the min bias pythia events: SoftQCD:Inelastic - TString pathconfigMB = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_inel_triggerGap.cfg"); + TString pathconfigMB = useOniaShower ? gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_oniaAll_triggerGap.cfg") : gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_inel_triggerGap.cfg"); pythiaMBgen.readFile(pathconfigMB.Data()); pythiaMBgen.readString("Random:setSeed on"); pythiaMBgen.readString("Random:seed " + std::to_string(seed)); @@ -221,7 +221,7 @@ GeneratorInclusiveJpsiPsi2SChiC_EvtGenMidY(int triggerGap, double rapidityMin = gen->addHadronPDGs(443); gen->addHadronPDGs(100443); gen->addHadronPDGs(445); - gen->addHadronPDGs(200443); + gen->addHadronPDGs(20443); gen->setVerbose(verbose); TString pathO2table = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg"); @@ -232,8 +232,8 @@ GeneratorInclusiveJpsiPsi2SChiC_EvtGenMidY(int triggerGap, double rapidityMin = gen->SetSizePdg(4); gen->AddPdg(443, 0); gen->AddPdg(100443, 1); - gen->AddPdg(443, 2); - gen->AddPdg(100443, 3); + gen->AddPdg(445, 2); + gen->AddPdg(20443, 3); gen->SetForceDecay(kEvtDiElectron); @@ -250,3 +250,66 @@ GeneratorInclusiveJpsiPsi2SChiC_EvtGenMidY(int triggerGap, double rapidityMin = return gen; } +FairGenerator * +GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double rapidityMin = -1.0, double rapidityMax = 1.0, bool verbose = false) +{ + auto gen = new o2::eventgen::GeneratorEvtGen(triggerGap, true); + gen->setTriggerGap(triggerGap); + gen->setRapidityRange(rapidityMin, rapidityMax); + gen->addHadronPDGs(443); // Jpsi + gen->addHadronPDGs(100443); // psi(2S) + gen->addHadronPDGs(10441); // chic0 + gen->addHadronPDGs(20443); // chic1 + gen->addHadronPDGs(445); // chic2 + gen->addHadronPDGs(553); // upsilon(1S) + gen->addHadronPDGs(100553); // upsilon(2S) + gen->addHadronPDGs(200553); // upsilon(3S) + // we also add B hadrons to trigger correct rapidity range (e.g. B is within |y|<1 but non-prompt J/psi has |y|>1) + gen->addHadronPDGs(511); // B0 + gen->addHadronPDGs(521); // B+ + gen->addHadronPDGs(531); // Bs + gen->addHadronPDGs(541); // Bc + gen->addHadronPDGs(5122); // Lambdab + gen->addHadronPDGs(5132); // Xib+ + gen->addHadronPDGs(5232); // Xib0 + gen->addHadronPDGs(5332); // Omegab + gen->setVerbose(verbose); + + TString pathO2table = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg"); + gen->readFile(pathO2table.Data()); + gen->setConfigMBdecays(pathO2table); + gen->PrintDebug(true); + + gen->SetSizePdg(16); + gen->AddPdg(443, 0); + gen->AddPdg(100443, 1); + gen->AddPdg(10441, 2); + gen->AddPdg(20443, 3); + gen->AddPdg(445, 4); + gen->AddPdg(553, 5); + gen->AddPdg(100553, 6); + gen->AddPdg(200553, 7); + gen->AddPdg(511, 8); + gen->AddPdg(521, 9); + gen->AddPdg(531, 10); + gen->AddPdg(541, 11); + gen->AddPdg(5122, 12); + gen->AddPdg(5132, 13); + gen->AddPdg(5232, 14); + gen->AddPdg(5332, 15); + + gen->SetForceDecay(kEvtBPsiAndJpsiDiElectron); + + // set random seed + gen->readString("Random:setSeed on"); + uint random_seed; + unsigned long long int random_value = 0; + ifstream urandom("/dev/urandom", ios::in | ios::binary); + urandom.read(reinterpret_cast(&random_value), sizeof(random_seed)); + gen->readString(Form("Random:seed = %llu", random_value % 900000001)); + + // print debug + // gen->PrintDebug(); + + return gen; +} diff --git a/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg b/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg new file mode 100644 index 000000000..2711096f1 --- /dev/null +++ b/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg @@ -0,0 +1,18 @@ +#switch off all quarkonia and B hadrons decays + +443:mayDecay off # J/psi +100443:mayDecay off # psi(2S) +10441:mayDecay off # chic0 +20443:mayDecay off # chic1 +445:mayDecay off # chic2 +553:mayDecay off # upsilon1S +100553:mayDecay off # upsilon2S +200553:mayDecay off # upsilon3S +511:mayDecay off # B0 +521:mayDecay off # B+ +531:mayDecay off # Bs +541:mayDecay off # Bc +5122:mayDecay off # Lambdab +5132:mayDecay off # Xib+ +5232:mayDecay off # Xib0 +5332:mayDecay off # Omegab diff --git a/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg b/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg index 2cc29e535..3787a9bb2 100644 --- a/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg +++ b/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg @@ -2,3 +2,4 @@ 443:mayDecay off # J/psi 100443:mayDecay off # psi(2S) + diff --git a/MC/config/PWGDQ/pythia8/generator/pythia8_oniaAll_triggerGap.cfg b/MC/config/PWGDQ/pythia8/generator/pythia8_oniaAll_triggerGap.cfg new file mode 100644 index 000000000..b72c19fb9 --- /dev/null +++ b/MC/config/PWGDQ/pythia8/generator/pythia8_oniaAll_triggerGap.cfg @@ -0,0 +1,12 @@ +### beams +Beams:idA 2212 # proton +Beams:idB 2212 # proton +Beams:eCM 13600. # GeV + +### processes +SoftQCD:inelastic on # all inelastic processes +OniaShower:all = on + +### decays +ParticleDecays:limitTau0 on +ParticleDecays:tau0Max 10. From 305f55e180dd0cbb8d571f02c41284473b201052 Mon Sep 17 00:00:00 2001 From: Gauthier Legras Date: Tue, 15 Sep 2026 19:58:09 +0200 Subject: [PATCH 2/6] possibility to pass rejection factors by string --- .../BTOPSIJPSITODIELECTRON.DEC | 2 +- ...enerator_pythia8_HadronTriggered_withGap.C | 189 ++++++++++++++---- ...dInclusiveQuarkonia_Pythia8_TriggerGap.ini | 7 + 3 files changed, 156 insertions(+), 42 deletions(-) create mode 100644 MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini diff --git a/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC index 6abb55931..fb8d81eb3 100644 --- a/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC +++ b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC @@ -371,7 +371,7 @@ Enddecay Decay psi(2S) 0.00795 e+ e- PHOTOS VLL; -0.3478 J/psi pi+ pi- VVPIPI; +0.0208 J/psi pi+ pi- VVPIPI; # multiplied by J/psi->ee BR to keep relative statistics, since J/psi->ee itself is also enhanced Enddecay Decay J/psi diff --git a/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C b/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C index 08f6b3cf5..a46b83cc3 100644 --- a/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C +++ b/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C @@ -19,14 +19,14 @@ class GeneratorPythia8HadronTriggeredWithGap : public o2::eventgen::GeneratorPyt public: /// constructor - GeneratorPythia8HadronTriggeredWithGap(int inputTriggerRatio = 5, bool useOniaShower = false) { + GeneratorPythia8HadronTriggeredWithGap(int inputTriggerRatio = 5) { mGeneratedEvents = 0; mInverseTriggerRatio = inputTriggerRatio; // define minimum bias event generator auto seed = (gRandom->TRandom::GetSeed() % 900000000); // main physics option for the min bias pythia events: SoftQCD:Inelastic - TString pathconfigMB = useOniaShower ? gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_oniaAll_triggerGap.cfg") : gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_inel_triggerGap.cfg"); + TString pathconfigMB = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_inel_triggerGap.cfg"); pythiaMBgen.readFile(pathconfigMB.Data()); pythiaMBgen.readString("Random:setSeed on"); pythiaMBgen.readString("Random:seed " + std::to_string(seed)); @@ -39,7 +39,23 @@ public: /// Destructor ~GeneratorPythia8HadronTriggeredWithGap() = default; - void addHadronPDGs(int pdg) { mHadronsPDGs.push_back(pdg); }; + void addHadronPDGs(int pdg) { mHadronsPDGs.push_back(pdg); mRejFactorPrompt.push_back(1.0); mRejFactorNonPrompt.push_back(1.0);} + + void setRejFactorPrompt(int pdg, float rejFactor) { + for (size_t i = 0; i < mHadronsPDGs.size(); i++) { + if (pdg == mHadronsPDGs[i]) { + mRejFactorPrompt[i] = rejFactor; + } + } + } + + void setRejFactorNonPrompt(int pdg, float rejFactor) { + for (size_t i = 0; i < mHadronsPDGs.size(); i++) { + if (pdg == mHadronsPDGs[i]) { + mRejFactorNonPrompt[i] = rejFactor; + } + } + } void setRapidityRange(double valMin, double valMax) { @@ -93,28 +109,72 @@ bool Init() override { addSubGenerator(1, "Hadron triggered"); GeneratorPythia8::Init(); pythiaMBgen.init(); + + for (size_t i = 0; i < mHadronsPDGs.size(); i++) { + LOGF(info, "triggering hadron %d with rejection factor (prompt/non-prompt) %f/%f", mHadronsPDGs[i], mRejFactorPrompt[i], mRejFactorNonPrompt[i]); + } + return true; } + +bool isOpenBhadron(int pdg) { + // all open beauty hadrons, no upsilon + return ((abs(pdg) >= 500 && abs(pdg) < 599) || (abs(pdg) >= 5000 && abs(pdg) < 5999)) && pdg != 553; +} + // search for the presence of at least one of the required hadrons in a selected rapidity window bool findHadrons(Pythia8::Event& event) { - + int ihad = 0; for (int ipa = 0; ipa < event.size(); ++ipa) { auto daughterList = event[ipa].daughterList(); for (auto ida : daughterList) { + ihad = 0; for (int pdg : mHadronsPDGs) { // check that at least one of the pdg code is found in the event if (event[ida].id() == pdg) { if ((event[ida].y() > mRapidityMin) && (event[ida].y() < mRapidityMax)) { - cout << "============= Found jpsi y,pt " << event[ida].y() << ", " << event[ida].pT() << endl; + cout << "============= Found jpsi y,pt,pdg " << event[ida].y() << ", " << event[ida].pT() << ", " << event[ida].pdg() << endl; std::vector daughters = event[ida].daughterList(); for (int d : daughters) { cout << "###### daughter " << d << ": code " << event[d].id() << ", pt " << event[d].pT() << endl; } - return true; + + // check whether particle is prompt or non-prompt, since rejection factor can depend on it + bool isNonPrompt = false; + if (isOpenBhadron(pdg)) { + isNonPrompt = true; + cout << "particle is non-prompt" << endl + } else { + // we check the mother + int mother = event[ida].mother1(); + if (mother >= 0 && isOpenBhadron(event[mother].id())) { + isNonPrompt = true; + cout << "particle is non-prompt, mother pdg: " << event[mother].id() << endl; + } + if (mother >= 0 && !isOpenBhadron(event[mother].id())) { + // we check the grand-mother + int grandmother = event[mother].mother1(); + if (grandmother >= 0 && isOpenBhadron(event[grandmother].id())) { + isNonPrompt = true; + cout << "particle is non-prompt, mother pdg: " << event[mother].id() << ", grand-mother pdg: "<< event[grandmother].id() << endl; + } + if (grandmother >= 0 && !isOpenBhadron(event[grandmother].id())) { + isNonPrompt = false; + cout << "particle is prompt, mother pdg: " << event[mother].id() << ", grand-mother pdg: "<< event[grandmother].id() << endl; + } + } + } + + // rejection factor given in the ini file + float randomNumber = gRandom->Rndm(); + if ((isPrompt && (randomNumber <= mRejFactorPrompt[ihad])) || (isNonPrompt && (randomNumber <= mRejFactorNonPrompt[ihad]))) { + return true; + } } } + ihad++; } } } @@ -133,6 +193,8 @@ private: Pythia8::Pythia pythiaMBgen; // minimum bias event TString mConfigMBdecays; std::vector mHadronsPDGs; + std::vector mRejFactorPrompt; // rejection factors for possibility to trigger a given particle only a fraction of the time, 1 by default + std::vector mRejFactorNonPrompt; double mRapidityMin; double mRapidityMax; bool mVerbose; @@ -251,52 +313,97 @@ GeneratorInclusiveJpsiPsi2SChiC_EvtGenMidY(int triggerGap, double rapidityMin = return gen; } FairGenerator * -GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double rapidityMin = -1.0, double rapidityMax = 1.0, bool verbose = false) +GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double rapidityMin = -1.0, double rapidityMax = 1.0, TString rejFactors = "", bool verbose = false) { - auto gen = new o2::eventgen::GeneratorEvtGen(triggerGap, true); + + int particleList[16] = {443, // Jpsi + 100443, // psi(2S) + 10441, // chic0 + 20443, // chic1 + 445, // chic2 + 553, // upsilon(1S) + 100553, // upsilon(2S) + 200553, // upsilon(3S) + // we also add B hadrons to trigger correct rapidity range (e.g. B is within |y|<1 but non-prompt J/psi has |y|>1) + 511, // B0 + 521, // B+ + 531, // Bs + 541, // Bc + 5122, // Lambdab + 5132, // Xib+ + 5232, // Xib0 + 5332 // Omegab + }; + + auto gen = new o2::eventgen::GeneratorEvtGen(); gen->setTriggerGap(triggerGap); gen->setRapidityRange(rapidityMin, rapidityMax); - gen->addHadronPDGs(443); // Jpsi - gen->addHadronPDGs(100443); // psi(2S) - gen->addHadronPDGs(10441); // chic0 - gen->addHadronPDGs(20443); // chic1 - gen->addHadronPDGs(445); // chic2 - gen->addHadronPDGs(553); // upsilon(1S) - gen->addHadronPDGs(100553); // upsilon(2S) - gen->addHadronPDGs(200553); // upsilon(3S) - // we also add B hadrons to trigger correct rapidity range (e.g. B is within |y|<1 but non-prompt J/psi has |y|>1) - gen->addHadronPDGs(511); // B0 - gen->addHadronPDGs(521); // B+ - gen->addHadronPDGs(531); // Bs - gen->addHadronPDGs(541); // Bc - gen->addHadronPDGs(5122); // Lambdab - gen->addHadronPDGs(5132); // Xib+ - gen->addHadronPDGs(5232); // Xib0 - gen->addHadronPDGs(5332); // Omegab + // specify particles to be triggered + for (int i = 0; i < 16; i++) { + gen->addHadronPDGs(particleList[i]); + } gen->setVerbose(verbose); + + // possibility to enhance a particle compared to another (or completely reject one particle) using rejection factors configured from a string + // the rejection factors can be kept in a comma separated list (e.g. "pdg1:rejFactor1,pdg2:rejFactor2") + // also the keywords "prompt" and "non-prompt" can be used to modify all prompt and all non-prompt (e.g. "prompt:rejFactor1,non-prompt:rejFactor2") + // or the keyword can be used for only one particle (e.g. "pdg1:rejFactor1:prompt,pdg1:rejFactor2:non-prompt") + TObjArray* objArray = rejFactors.Tokenize(","); + for (int i = 0; i < objArray->GetEntries(); i++) { + TString rejStr = objArray->At(i); + TObjArray* objArrayCurrent = rejStr.Tokenize(":"); + if (objArrayCurrent->GetEntries() != 2 && objArrayCurrent->GetEntries() != 3) { + LOGF(fatal, "Problem when configuring string for particle rejection factors: %s, incorrect length", rejStr.Data()); + } + if (!objArrayCurrent[1].IsFloat()) { + LOGF(fatal, "Problem when configuring string for particle rejection factors: %s, is not float", rejStr.Data()); + } + if (objArrayCurrent[0].CompareTo("prompt") == 0) { + // Common switch for all prompt particles + for (int ihad = 0; ihad < 16; i++) { + gen->setRejFactorPrompt(particleList[i], objArrayCurrent[1].Atof()); + } + continue; + } + if (objArrayCurrent[0].CompareTo("non-prompt") == 0) { + // Common switch for all non-prompt particles + for (int ihad = 0; ihad < 16; i++) { + gen->setRejFactorNonPrompt(particleList[i], objArrayCurrent[1].Atof()); + } + continue; + } + if (objArrayCurrent[0].IsDigit()) { + // Setting the rejection factor for a specific particle + if (objArrayCurrent->GetEntries() == 2) { + gen->setRejFactorPrompt(objArrayCurrent[0].Atoi(), objArrayCurrent[1].Atof()); + gen->setRejFactorNonPrompt(objArrayCurrent[0].Atoi(), objArrayCurrent[1].Atof()); + continue; + } + else { + if (objArrayCurrent[2].CompareTo("prompt") == 0) { + gen->setRejFactorPrompt(objArrayCurrent[0].Atoi(), objArrayCurrent[1].Atof()); + continue; + } + if (objArrayCurrent[2].CompareTo("non-prompt") == 0) { + gen->setRejFactorNonPrompt(objArrayCurrent[0].Atoi(), objArrayCurrent[1].Atof()); + continue; + } + } + } + LOGF(fatal, "Problem when configuring string for particle rejection factors: %s, incorrect template", rejStr.Data()); + } + TString pathO2table = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg"); gen->readFile(pathO2table.Data()); gen->setConfigMBdecays(pathO2table); gen->PrintDebug(true); + // specify particles to be decayed with EvtGen gen->SetSizePdg(16); - gen->AddPdg(443, 0); - gen->AddPdg(100443, 1); - gen->AddPdg(10441, 2); - gen->AddPdg(20443, 3); - gen->AddPdg(445, 4); - gen->AddPdg(553, 5); - gen->AddPdg(100553, 6); - gen->AddPdg(200553, 7); - gen->AddPdg(511, 8); - gen->AddPdg(521, 9); - gen->AddPdg(531, 10); - gen->AddPdg(541, 11); - gen->AddPdg(5122, 12); - gen->AddPdg(5132, 13); - gen->AddPdg(5232, 14); - gen->AddPdg(5332, 15); + for (int i = 0; i < 16; i++) { + gen->AddPdg(particleList[i], i); + } gen->SetForceDecay(kEvtBPsiAndJpsiDiElectron); diff --git a/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini b/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini new file mode 100644 index 000000000..c71973e17 --- /dev/null +++ b/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini @@ -0,0 +1,7 @@ +### The external generator derives from GeneratorPythia8. +[GeneratorExternal] +fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C +funcName=GeneratorInclusiveAllQuarkonia_EvtGenMidY(1,-1.0,1.0) + +[GeneratorPythia8] +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_oniaAll_triggerGap.cfg From 6b01bb21b3a26c4e641e3fefc20bda18bb07a084 Mon Sep 17 00:00:00 2001 From: Gauthier Legras Date: Thu, 17 Sep 2026 12:18:54 +0200 Subject: [PATCH 3/6] [PWGDQ] adding generator to trigger all inclusive quarkonia in pp --- .../BTOPSIJPSITODIELECTRON.DEC | 65 +++++----- ...enerator_pythia8_HadronTriggered_withGap.C | 117 ++++++++++++++---- ...dInclusiveQuarkonia_Pythia8_TriggerGap.ini | 2 +- ...redInclusiveQuarkonia_Pythia8_TriggerGap.C | 72 +++++++++++ 4 files changed, 200 insertions(+), 56 deletions(-) create mode 100644 MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.C diff --git a/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC index fb8d81eb3..cf3241a61 100644 --- a/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC +++ b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC @@ -1,9 +1,6 @@ ### Decay B0 ### -0.000310000 psi(2S) K_S0 SVS; #[Reconstructed PDG2011] -0.000310000 psi(2S) K_L0 SVS; #[Reconstructed PDG2011] -# # 0.000610000 psi(2S) K*0 SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] 0.0004 psi(2S) K+ pi- PHSP; @@ -15,8 +12,7 @@ Decay B0 ### 0.000620000 psi(2S) K0 SVS; #[New mode added] #[Reconstructed PDG2011] -0.000435500 J/psi K_S0 SVS; #[Reconstructed PDG2011] -0.000435500 J/psi K_L0 SVS; #[Reconstructed PDG2011] +0.000891000 J/psi K0 SVS; #[Reconstructed PDG2011] # # 0.001330000 J/psi K*0 SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] @@ -56,8 +52,6 @@ Enddecay Decay anti-B0 ### -0.000310000 psi(2S) K_S0 SVS; #[Reconstructed PDG2011] -0.000310000 psi(2S) K_L0 SVS; #[Reconstructed PDG2011] # 0.000610000 psi(2S) anti-K*0 SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] 0.0004 psi(2S) K- pi+ PHSP; @@ -69,8 +63,7 @@ Decay anti-B0 ### 0.000620000 psi(2S) anti-K0 SVS; #[New mode added] #[Reconstructed PDG2011] -0.000435500 J/psi K_S0 SVS; #[Reconstructed PDG2011] -0.000435500 J/psi K_L0 SVS; #[Reconstructed PDG2011] +0.000891000 J/psi anti-K0 SVS; #[Reconstructed PDG2011] # updated BR and corrected for double-couting (https://repo.hepforge.org/rEVTGEN16d483d4962aeeb93e857939666a9ba3383bb71f) # # 0.001330000 J/psi anti-K*0 SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] @@ -84,7 +77,6 @@ Decay anti-B0 0.0005 J/psi anti-K_2*0 PHSP; 0.000094000 J/psi phi anti-K0 PHSP; #[Reconstructed PDG2011] ### -0.000871000 J/psi anti-K0 SVS; #[New mode added] #[Reconstructed PDG2011] 0.000310000 J/psi omega anti-K0 PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000009500 J/psi eta PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000019000 J/psi pi- pi+ PHSP; #[New mode added] #[Reconstructed PDG2011] @@ -110,32 +102,34 @@ Enddecay Decay B+ ### -0.000646000 psi(2S) K+ SVS; #[Reconstructed PDG2011] -0.000620000 psi(2S) K*+ SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] +0.000625000 psi(2S) K+ SVS; #[Reconstructed PDG2011] +0.000670000 psi(2S) K*+ SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] 0.0004 psi(2S) K0 pi+ PHSP; 0.0002 psi(2S) K+ pi0 PHSP; -0.001900000 psi(2S) K+ pi- pi+ PHSP; #[Reconstructed PDG2011] +0.000430 psi(2S) K+ pi- pi+ PHSP; #[Reconstructed PDG2011] 0.0001 psi(2S) K+ pi0 pi0 PHSP; 0.0001 psi(2S) K0 pi+ pi0 PHSP; 0.0004 psi(2S) K_1+ PHSP; ### -0.000025800 psi(2S) pi+ PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000024400 psi(2S) pi+ PHSP; #[New mode added] #[Reconstructed PDG2011] -0.001014000 J/psi K+ SVS; #[Reconstructed PDG2011] +0.001019000 J/psi K+ SVS; #[Reconstructed PDG2011] 0.001430000 J/psi K*+ SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] -0.000049000 J/psi pi+ SVS; #[Reconstructed PDG2011] -0.000050000 J/psi rho+ SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] -0.0002 J/psi K0 pi+ PHSP; -0.0001 J/psi K+ pi0 PHSP; +0.000041000 J/psi pi+ SVS; #[Reconstructed PDG2011] +0.000041000 J/psi rho+ SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] +0.00113 J/psi K0 pi+ PHSP; +0.0001 J/psi K+ pi0 PHSP; 0.0001 J/psi K'_1+ SVV_HELAMP 0.5 0.0 1.0 0.0 0.5 0.0; 0.0005 J/psi K_2*+ PHSP; 0.001800000 J/psi K_1+ SVV_HELAMP 0.5 0.0 1.0 0.0 0.5 0.0; #[Reconstructed PDG2011] 0.000052000 J/psi phi K+ PHSP; #[Reconstructed PDG2011] # #### -0.001070000 J/psi K+ pi+ pi- PHSP; #[New mode added] #[Reconstructed PDG2011] -0.000108000 J/psi eta K+ PHSP; #[New mode added] #[Reconstructed PDG2011] -0.000350000 J/psi omega K+ PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000810000 J/psi K+ pi+ pi- PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000033700 J/psi K+ K- K+ PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000124000 J/psi eta K+ PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000031000 J/psi eta' K+ PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000320000 J/psi omega K+ PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000011800 J/psi p+ anti-Lambda0 PHSP; #[New mode added] #[Reconstructed PDG2011] # --- chi_c1 --- @@ -156,31 +150,33 @@ Enddecay Decay B- ### -0.000646000 psi(2S) K- SVS; #[Reconstructed PDG2011] -0.000620000 psi(2S) K*- SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] +0.000625000 psi(2S) K- SVS; #[Reconstructed PDG2011] +0.000670000 psi(2S) K*- SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] 0.0004 psi(2S) anti-K0 pi- PHSP; 0.0002 psi(2S) K- pi0 PHSP; -0.001900000 psi(2S) K- pi+ pi- PHSP; #[Reconstructed PDG2011] +0.000430 psi(2S) K- pi+ pi- PHSP; #[Reconstructed PDG2011] 0.0001 psi(2S) K- pi0 pi0 PHSP; 0.0001 psi(2S) anti-K0 pi- pi0 PHSP; 0.0004 psi(2S) K_1- PHSP; ### -0.000025800 psi(2S) pi- PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000024400 psi(2S) pi- PHSP; #[New mode added] #[Reconstructed PDG2011] -0.001014000 J/psi K- SVS; #[Reconstructed PDG2011] +0.001019000 J/psi K- SVS; #[Reconstructed PDG2011] 0.001430000 J/psi K*- SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] -0.000049000 J/psi pi- SVS; #[Reconstructed PDG2011] -0.000050000 J/psi rho- SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] -0.0002 J/psi anti-K0 pi- PHSP; +0.000041000 J/psi pi- SVS; #[Reconstructed PDG2011] +0.000041000 J/psi rho- SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] +0.00113 J/psi anti-K0 pi- PHSP; 0.0001 J/psi K- pi0 PHSP; 0.0001 J/psi K'_1- SVV_HELAMP 0.5 0.0 1.0 0.0 0.5 0.0; 0.0005 J/psi K_2*- PHSP; 0.001800000 J/psi K_1- SVV_HELAMP 0.5 0.0 1.0 0.0 0.5 0.0; #[Reconstructed PDG2011] 0.000052000 J/psi phi K- PHSP; #[Reconstructed PDG2011] # -0.001070000 J/psi K- pi- pi+ PHSP; #[New mode added] #[Reconstructed PDG2011] -0.000108000 J/psi eta K- PHSP; #[New mode added] #[Reconstructed PDG2011] -0.000350000 J/psi omega K- PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000810000 J/psi K- pi- pi+ PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000033700 J/psi K- K+ K- PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000124000 J/psi eta K- PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000031000 J/psi eta' K- PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000320000 J/psi omega K- PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000011800 J/psi anti-p- Lambda0 PHSP; #[New mode added] #[Reconstructed PDG2011] # --- chi_c1 --- @@ -372,6 +368,9 @@ Enddecay Decay psi(2S) 0.00795 e+ e- PHOTOS VLL; 0.0208 J/psi pi+ pi- VVPIPI; # multiplied by J/psi->ee BR to keep relative statistics, since J/psi->ee itself is also enhanced +0.0000819 gamma chi_c0 PHSP; # * BR(J/psi->ee) * BR(chi_c0->J/psi) +0.00201 gamma chi_c1 PHSP; # * BR(J/psi->ee) * BR(chi_c1->J/psi) +0.00110 gamma chi_c2 PHSP; # * BR(J/psi->ee) * BR(chi_c2->J/psi) Enddecay Decay J/psi diff --git a/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C b/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C index a46b83cc3..1ca9585d7 100644 --- a/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C +++ b/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C @@ -41,6 +41,8 @@ public: void addHadronPDGs(int pdg) { mHadronsPDGs.push_back(pdg); mRejFactorPrompt.push_back(1.0); mRejFactorNonPrompt.push_back(1.0);} + void decrementGeneratedEvents() {mGeneratedEvents--;} + void setRejFactorPrompt(int pdg, float rejFactor) { for (size_t i = 0; i < mHadronsPDGs.size(); i++) { if (pdg == mHadronsPDGs[i]) { @@ -68,6 +70,10 @@ public: void setConfigMBdecays(TString val){mConfigMBdecays = val;} void setVerbose(bool val) { mVerbose = val; }; + + int getNGeneratedEvents() { return mGeneratedEvents;} + + int getTriggerGap() { return mInverseTriggerRatio;} protected: @@ -123,6 +129,13 @@ bool isOpenBhadron(int pdg) { return ((abs(pdg) >= 500 && abs(pdg) < 599) || (abs(pdg) >= 5000 && abs(pdg) < 5999)) && pdg != 553; } +bool isCharmonium(int pdg) { + int firstQuark = ( abs(pdg) % 100 - abs(pdg) % 10 ) / 10; + int secondQuark = ( abs(pdg) % 1000 - abs(pdg) % 100 ) / 100; + int thirdQuark = ( abs(pdg) % 10000 - abs(pdg) % 1000 ) / 1000; + return ( firstQuark == 4 && secondQuark == 4 && thirdQuark == 0 ); +} + // search for the presence of at least one of the required hadrons in a selected rapidity window bool findHadrons(Pythia8::Event& event) { int ihad = 0; @@ -133,21 +146,42 @@ bool findHadrons(Pythia8::Event& event) { for (auto ida : daughterList) { ihad = 0; for (int pdg : mHadronsPDGs) { // check that at least one of the pdg code is found in the event - if (event[ida].id() == pdg) { + if (abs(event[ida].id()) == pdg) { if ((event[ida].y() > mRapidityMin) && (event[ida].y() < mRapidityMax)) { - cout << "============= Found jpsi y,pt,pdg " << event[ida].y() << ", " << event[ida].pT() << ", " << event[ida].pdg() << endl; + cout << "============= Found jpsi y,pt,pdg " << event[ida].y() << ", " << event[ida].pT() << ", " << event[ida].id() << endl; std::vector daughters = event[ida].daughterList(); for (int d : daughters) { cout << "###### daughter " << d << ": code " << event[d].id() << ", pt " << event[d].pT() << endl; } + if (event[ida].daughter1() == event[ida].daughter2() && event[ida].daughter1() > 0) { + continue; // particle has a carbon-copy as daughter, its daughter will already be considered for triggering + } // check whether particle is prompt or non-prompt, since rejection factor can depend on it bool isNonPrompt = false; if (isOpenBhadron(pdg)) { isNonPrompt = true; - cout << "particle is non-prompt" << endl + LOGF(info, "particle is non-prompt"); } else { - // we check the mother + // check history + int currentIdx = ida; + int currentPdg = pdg; + cout << "particle history: "; + while (isCharmonium(currentPdg) && currentIdx >= 0) { + currentIdx = event[currentIdx].mother1(); + if (currentIdx < 0) { + break; + } + currentPdg = abs(event[currentIdx].id()); + cout << currentPdg << " "; + if (isOpenBhadron(currentPdg)) { + isNonPrompt = true; + LOGF(info, "particle is non-prompt"); + break; + } + } + cout << endl; + /*// we check the mother int mother = event[ida].mother1(); if (mother >= 0 && isOpenBhadron(event[mother].id())) { isNonPrompt = true; @@ -164,12 +198,14 @@ bool findHadrons(Pythia8::Event& event) { isNonPrompt = false; cout << "particle is prompt, mother pdg: " << event[mother].id() << ", grand-mother pdg: "<< event[grandmother].id() << endl; } - } + }*/ } // rejection factor given in the ini file float randomNumber = gRandom->Rndm(); - if ((isPrompt && (randomNumber <= mRejFactorPrompt[ihad])) || (isNonPrompt && (randomNumber <= mRejFactorNonPrompt[ihad]))) { + cout << randomNumber << " rej factor: " << (isNonPrompt ? mRejFactorNonPrompt[ihad] : mRejFactorPrompt[ihad]) << endl; + if ((!isNonPrompt && (randomNumber <= mRejFactorPrompt[ihad])) || (isNonPrompt && (randomNumber <= mRejFactorNonPrompt[ihad]))) { + cout << "event triggered " << endl; return true; } } @@ -204,6 +240,25 @@ private: } + +o2::eventgen::Trigger triggerPDGRap(double rapMin, double rapMax, int pdg, GeneratorPythia8HadronTriggeredWithGap* gen) { + auto trigger = [rapMin, rapMax, pdg, gen](const std::vector& particles) -> bool { + if (gen->getTriggerGap() != 1 && gen->getNGeneratedEvents() % gen->getTriggerGap() != 1) { + // this is a MB event + return true; + } + for (const auto& p : particles) { + if (p.Y() > rapMin && p.Y() < rapMax && std::abs(p.GetPdgCode()) == pdg) { + return true; + } + } + return false; + }; + return trigger; +} + + + // Predefined generators: FairGenerator* GeneratorInclusiveJpsi_EvtGenMidY(int triggerGap, double rapidityMin = -1.5, double rapidityMax = 1.5, bool verbose = false) @@ -337,7 +392,9 @@ GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double rapidityMin = - auto gen = new o2::eventgen::GeneratorEvtGen(); gen->setTriggerGap(triggerGap); - gen->setRapidityRange(rapidityMin, rapidityMax); + // this is a trigger before EvtGen decays, after which the rapidities of the particles are modified. + // The rapidity cut is then only applied in the triggerEvent after the decays + gen->setRapidityRange(rapidityMin - 1., rapidityMax + 1.); // specify particles to be triggered for (int i = 0; i < 16; i++) { gen->addHadronPDGs(particleList[i]); @@ -350,42 +407,45 @@ GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double rapidityMin = - // or the keyword can be used for only one particle (e.g. "pdg1:rejFactor1:prompt,pdg1:rejFactor2:non-prompt") TObjArray* objArray = rejFactors.Tokenize(","); for (int i = 0; i < objArray->GetEntries(); i++) { - TString rejStr = objArray->At(i); + TString rejStr = TString(objArray->At(i)->GetName()); TObjArray* objArrayCurrent = rejStr.Tokenize(":"); if (objArrayCurrent->GetEntries() != 2 && objArrayCurrent->GetEntries() != 3) { LOGF(fatal, "Problem when configuring string for particle rejection factors: %s, incorrect length", rejStr.Data()); } - if (!objArrayCurrent[1].IsFloat()) { + TString str0 = TString(objArrayCurrent->At(0)->GetName()); + TString str1 = TString(objArrayCurrent->At(1)->GetName()); + if (!str1.IsFloat()) { LOGF(fatal, "Problem when configuring string for particle rejection factors: %s, is not float", rejStr.Data()); } - if (objArrayCurrent[0].CompareTo("prompt") == 0) { + if (str0.CompareTo("prompt") == 0) { // Common switch for all prompt particles - for (int ihad = 0; ihad < 16; i++) { - gen->setRejFactorPrompt(particleList[i], objArrayCurrent[1].Atof()); + for (int ihad = 0; ihad < 16; ihad++) { + gen->setRejFactorPrompt(particleList[ihad], str1.Atof()); } continue; } - if (objArrayCurrent[0].CompareTo("non-prompt") == 0) { + if (str0.CompareTo("non-prompt") == 0) { // Common switch for all non-prompt particles - for (int ihad = 0; ihad < 16; i++) { - gen->setRejFactorNonPrompt(particleList[i], objArrayCurrent[1].Atof()); + for (int ihad = 0; ihad < 16; ihad++) { + gen->setRejFactorNonPrompt(particleList[ihad], str1.Atof()); } continue; } - if (objArrayCurrent[0].IsDigit()) { + if (str0.IsDigit()) { // Setting the rejection factor for a specific particle if (objArrayCurrent->GetEntries() == 2) { - gen->setRejFactorPrompt(objArrayCurrent[0].Atoi(), objArrayCurrent[1].Atof()); - gen->setRejFactorNonPrompt(objArrayCurrent[0].Atoi(), objArrayCurrent[1].Atof()); + gen->setRejFactorPrompt(str0.Atoi(), str1.Atof()); + gen->setRejFactorNonPrompt(str0.Atoi(), str1.Atof()); continue; } else { - if (objArrayCurrent[2].CompareTo("prompt") == 0) { - gen->setRejFactorPrompt(objArrayCurrent[0].Atoi(), objArrayCurrent[1].Atof()); + TString str2 = TString(objArrayCurrent->At(2)->GetName()); + if (str2.CompareTo("prompt") == 0) { + gen->setRejFactorPrompt(str0.Atoi(), str1.Atof()); continue; } - if (objArrayCurrent[2].CompareTo("non-prompt") == 0) { - gen->setRejFactorNonPrompt(objArrayCurrent[0].Atoi(), objArrayCurrent[1].Atof()); + if (str2.CompareTo("non-prompt") == 0) { + gen->setRejFactorNonPrompt(str0.Atoi(), str1.Atof()); continue; } } @@ -417,6 +477,19 @@ GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double rapidityMin = - // print debug // gen->PrintDebug(); + + // add trigger on the correct rapidity range after EvtGen decays + gen->setTriggerMode(Generator::kTriggerOR); + for (int i = 0; i < 16; i++) { + gen->addTrigger(triggerPDGRap(rapidityMin, rapidityMax, particleList[i], gen)); + } + + // what to do if the trigger was rejected + gen->setTriggerFalseHook( + [gen](std::vector const& p, int eventCount) { + gen->decrementGeneratedEvents(); + } + ); return gen; } diff --git a/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini b/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini index c71973e17..f21831078 100644 --- a/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini +++ b/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini @@ -1,7 +1,7 @@ ### The external generator derives from GeneratorPythia8. [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C -funcName=GeneratorInclusiveAllQuarkonia_EvtGenMidY(1,-1.0,1.0) +funcName=GeneratorInclusiveAllQuarkonia_EvtGenMidY(5,-1.0,1.0,"non-prompt:0.2") [GeneratorPythia8] config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_oniaAll_triggerGap.cfg diff --git a/MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.C b/MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.C new file mode 100644 index 000000000..80ae5d71f --- /dev/null +++ b/MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.C @@ -0,0 +1,72 @@ +int External() +{ + int checkPdgSignal = 443; + int checkPdgDecay = 11; + std::string path{"o2sim_Kine.root"}; + std::cout << "Check for\nsignal PDG " << checkPdgSignal << "\ndecay PDG " << checkPdgDecay << "\n"; + TFile file(path.c_str(), "READ"); + if (file.IsZombie()) { + std::cerr << "Cannot open ROOT file " << path << "\n"; + return 1; + } + + auto tree = (TTree*)file.Get("o2sim"); + std::vector* tracks{}; + tree->SetBranchAddress("MCTrack", &tracks); + + int nLeptons{}; + int nAntileptons{}; + int nLeptonPairs{}; + int nLeptonPairsToBeDone{}; + int nSignal{}; + auto nEvents = tree->GetEntries(); + + for (int i = 0; i < nEvents; i++) { + tree->GetEntry(i); + for (auto& track : *tracks) { + auto pdg = track.GetPdgCode(); + if (pdg == checkPdgDecay) { + // count leptons + nLeptons++; + } else if(pdg == -checkPdgDecay) { + // count anti-leptons + nAntileptons++; + } else if (pdg == checkPdgSignal) { + // count signal PDG + nSignal++; + auto child0 = o2::mcutils::MCTrackNavigator::getDaughter0(track, *tracks); + auto child1 = o2::mcutils::MCTrackNavigator::getDaughter1(track, *tracks); + if (child0 != nullptr && child1 != nullptr) { + // check for parent-child relations + auto pdg0 = child0->GetPdgCode(); + auto pdg1 = child1->GetPdgCode(); + std::cout << "First and last children of parent " << checkPdgSignal << " are PDG0: " << pdg0 << " PDG1: " << pdg1 << "\n"; + if (std::abs(pdg0) == checkPdgDecay && std::abs(pdg1) == checkPdgDecay && pdg0 == -pdg1) { + nLeptonPairs++; + if (child0->getToBeDone() && child1->getToBeDone()) { + nLeptonPairsToBeDone++; + } + } + } + } + } + } + std::cout << "#events: " << nEvents << "\n" + << "#leptons: " << nLeptons << "\n" + << "#antileptons: " << nAntileptons << "\n" + << "#signal: " << nSignal << "\n" + << "#lepton pairs: " << nLeptonPairs << "\n" + << "#lepton pairs to be done: " << nLeptonPairs << "\n"; + + + if (nLeptonPairs == 0 || nLeptons == 0 || nAntileptons == 0) { + std::cerr << "Number of leptons, number of anti-leptons as well as number of lepton pairs should all be greater than 1.\n"; + return 1; + } + if (nLeptonPairs != nLeptonPairsToBeDone) { + std::cerr << "The number of lepton pairs should be the same as the number of lepton pairs which should be transported.\n"; + return 1; + } + + return 0; +} From c5fea7cb372cb55fda71310860aa6d136c1a7b79 Mon Sep 17 00:00:00 2001 From: Gauthier Legras Date: Thu, 17 Sep 2026 12:29:25 +0200 Subject: [PATCH 4/6] clang format --- ...enerator_pythia8_HadronTriggered_withGap.C | 309 +++++++++--------- ...redInclusiveQuarkonia_Pythia8_TriggerGap.C | 131 ++++---- .../PWGDQ/pythia8/decayer/switchOffJpsi.cfg | 1 - 3 files changed, 224 insertions(+), 217 deletions(-) diff --git a/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C b/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C index 1ca9585d7..861e3760c 100644 --- a/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C +++ b/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C @@ -39,10 +39,14 @@ public: /// Destructor ~GeneratorPythia8HadronTriggeredWithGap() = default; - void addHadronPDGs(int pdg) { mHadronsPDGs.push_back(pdg); mRejFactorPrompt.push_back(1.0); mRejFactorNonPrompt.push_back(1.0);} - - void decrementGeneratedEvents() {mGeneratedEvents--;} - + void addHadronPDGs(int pdg) { + mHadronsPDGs.push_back(pdg); + mRejFactorPrompt.push_back(1.0); + mRejFactorNonPrompt.push_back(1.0); + } + + void decrementGeneratedEvents() { mGeneratedEvents--; } + void setRejFactorPrompt(int pdg, float rejFactor) { for (size_t i = 0; i < mHadronsPDGs.size(); i++) { if (pdg == mHadronsPDGs[i]) { @@ -50,7 +54,7 @@ public: } } } - + void setRejFactorNonPrompt(int pdg, float rejFactor) { for (size_t i = 0; i < mHadronsPDGs.size(); i++) { if (pdg == mHadronsPDGs[i]) { @@ -70,10 +74,10 @@ public: void setConfigMBdecays(TString val){mConfigMBdecays = val;} void setVerbose(bool val) { mVerbose = val; }; - - int getNGeneratedEvents() { return mGeneratedEvents;} - - int getTriggerGap() { return mInverseTriggerRatio;} + + int getNGeneratedEvents() { return mGeneratedEvents; } + + int getTriggerGap() { return mInverseTriggerRatio; } protected: @@ -115,29 +119,32 @@ bool Init() override { addSubGenerator(1, "Hadron triggered"); GeneratorPythia8::Init(); pythiaMBgen.init(); - + for (size_t i = 0; i < mHadronsPDGs.size(); i++) { - LOGF(info, "triggering hadron %d with rejection factor (prompt/non-prompt) %f/%f", mHadronsPDGs[i], mRejFactorPrompt[i], mRejFactorNonPrompt[i]); + LOGF(info, + "triggering hadron %d with rejection factor (prompt/non-prompt) %f/%f", + mHadronsPDGs[i], mRejFactorPrompt[i], mRejFactorNonPrompt[i]); } - - return true; -} + return true; +} bool isOpenBhadron(int pdg) { // all open beauty hadrons, no upsilon - return ((abs(pdg) >= 500 && abs(pdg) < 599) || (abs(pdg) >= 5000 && abs(pdg) < 5999)) && pdg != 553; + return ((abs(pdg) >= 500 && abs(pdg) < 599) || + (abs(pdg) >= 5000 && abs(pdg) < 5999)) && + pdg != 553; } bool isCharmonium(int pdg) { - int firstQuark = ( abs(pdg) % 100 - abs(pdg) % 10 ) / 10; - int secondQuark = ( abs(pdg) % 1000 - abs(pdg) % 100 ) / 100; - int thirdQuark = ( abs(pdg) % 10000 - abs(pdg) % 1000 ) / 1000; - return ( firstQuark == 4 && secondQuark == 4 && thirdQuark == 0 ); + int firstQuark = (abs(pdg) % 100 - abs(pdg) % 10) / 10; + int secondQuark = (abs(pdg) % 1000 - abs(pdg) % 100) / 100; + int thirdQuark = (abs(pdg) % 10000 - abs(pdg) % 1000) / 1000; + return (firstQuark == 4 && secondQuark == 4 && thirdQuark == 0); } // search for the presence of at least one of the required hadrons in a selected rapidity window -bool findHadrons(Pythia8::Event& event) { +bool findHadrons(Pythia8::Event& event) { int ihad = 0; for (int ipa = 0; ipa < event.size(); ++ipa) { @@ -148,16 +155,20 @@ bool findHadrons(Pythia8::Event& event) { for (int pdg : mHadronsPDGs) { // check that at least one of the pdg code is found in the event if (abs(event[ida].id()) == pdg) { if ((event[ida].y() > mRapidityMin) && (event[ida].y() < mRapidityMax)) { - cout << "============= Found jpsi y,pt,pdg " << event[ida].y() << ", " << event[ida].pT() << ", " << event[ida].id() << endl; + cout << "============= Found jpsi y,pt,pdg " << event[ida].y() + << ", " << event[ida].pT() << ", " << event[ida].id() << endl; std::vector daughters = event[ida].daughterList(); for (int d : daughters) { cout << "###### daughter " << d << ": code " << event[d].id() << ", pt " << event[d].pT() << endl; } - if (event[ida].daughter1() == event[ida].daughter2() && event[ida].daughter1() > 0) { - continue; // particle has a carbon-copy as daughter, its daughter will already be considered for triggering + if (event[ida].daughter1() == event[ida].daughter2() && + event[ida].daughter1() > 0) { + continue; // particle has a carbon-copy as daughter, its daughter + // will already be considered for triggering } - // check whether particle is prompt or non-prompt, since rejection factor can depend on it + // check whether particle is prompt or non-prompt, since rejection + // factor can depend on it bool isNonPrompt = false; if (isOpenBhadron(pdg)) { isNonPrompt = true; @@ -181,30 +192,16 @@ bool findHadrons(Pythia8::Event& event) { } } cout << endl; - /*// we check the mother - int mother = event[ida].mother1(); - if (mother >= 0 && isOpenBhadron(event[mother].id())) { - isNonPrompt = true; - cout << "particle is non-prompt, mother pdg: " << event[mother].id() << endl; - } - if (mother >= 0 && !isOpenBhadron(event[mother].id())) { - // we check the grand-mother - int grandmother = event[mother].mother1(); - if (grandmother >= 0 && isOpenBhadron(event[grandmother].id())) { - isNonPrompt = true; - cout << "particle is non-prompt, mother pdg: " << event[mother].id() << ", grand-mother pdg: "<< event[grandmother].id() << endl; - } - if (grandmother >= 0 && !isOpenBhadron(event[grandmother].id())) { - isNonPrompt = false; - cout << "particle is prompt, mother pdg: " << event[mother].id() << ", grand-mother pdg: "<< event[grandmother].id() << endl; - } - }*/ } // rejection factor given in the ini file float randomNumber = gRandom->Rndm(); - cout << randomNumber << " rej factor: " << (isNonPrompt ? mRejFactorNonPrompt[ihad] : mRejFactorPrompt[ihad]) << endl; - if ((!isNonPrompt && (randomNumber <= mRejFactorPrompt[ihad])) || (isNonPrompt && (randomNumber <= mRejFactorNonPrompt[ihad]))) { + cout << randomNumber << " rej factor: " + << (isNonPrompt ? mRejFactorNonPrompt[ihad] + : mRejFactorPrompt[ihad]) + << endl; + if ((!isNonPrompt && (randomNumber <= mRejFactorPrompt[ihad])) || + (isNonPrompt && (randomNumber <= mRejFactorNonPrompt[ihad]))) { cout << "event triggered " << endl; return true; } @@ -229,7 +226,9 @@ private: Pythia8::Pythia pythiaMBgen; // minimum bias event TString mConfigMBdecays; std::vector mHadronsPDGs; - std::vector mRejFactorPrompt; // rejection factors for possibility to trigger a given particle only a fraction of the time, 1 by default + std::vector + mRejFactorPrompt; // rejection factors for possibility to trigger a given + // particle only a fraction of the time, 1 by default std::vector mRejFactorNonPrompt; double mRapidityMin; double mRapidityMax; @@ -240,14 +239,17 @@ private: } - -o2::eventgen::Trigger triggerPDGRap(double rapMin, double rapMax, int pdg, GeneratorPythia8HadronTriggeredWithGap* gen) { - auto trigger = [rapMin, rapMax, pdg, gen](const std::vector& particles) -> bool { - if (gen->getTriggerGap() != 1 && gen->getNGeneratedEvents() % gen->getTriggerGap() != 1) { +o2::eventgen::Trigger +triggerPDGRap(double rapMin, double rapMax, int pdg, + GeneratorPythia8HadronTriggeredWithGap *gen) { + auto trigger = [rapMin, rapMax, pdg, + gen](const std::vector &particles) -> bool { + if (gen->getTriggerGap() != 1 && + gen->getNGeneratedEvents() % gen->getTriggerGap() != 1) { // this is a MB event return true; } - for (const auto& p : particles) { + for (const auto &p : particles) { if (p.Y() > rapMin && p.Y() < rapMax && std::abs(p.GetPdgCode()) == pdg) { return true; } @@ -257,8 +259,6 @@ o2::eventgen::Trigger triggerPDGRap(double rapMin, double rapMax, int pdg, Gener return trigger; } - - // Predefined generators: FairGenerator* GeneratorInclusiveJpsi_EvtGenMidY(int triggerGap, double rapidityMin = -1.5, double rapidityMax = 1.5, bool verbose = false) @@ -367,129 +367,132 @@ GeneratorInclusiveJpsiPsi2SChiC_EvtGenMidY(int triggerGap, double rapidityMin = return gen; } -FairGenerator * -GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double rapidityMin = -1.0, double rapidityMax = 1.0, TString rejFactors = "", bool verbose = false) -{ +FairGenerator *GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double rapidityMin = -1.0, double rapidityMax = 1.0, TString rejFactors = "", bool verbose = false) { - int particleList[16] = {443, // Jpsi + int particleList[16] = { + 443, // Jpsi 100443, // psi(2S) - 10441, // chic0 - 20443, // chic1 - 445, // chic2 - 553, // upsilon(1S) + 10441, // chic0 + 20443, // chic1 + 445, // chic2 + 553, // upsilon(1S) 100553, // upsilon(2S) 200553, // upsilon(3S) - // we also add B hadrons to trigger correct rapidity range (e.g. B is within |y|<1 but non-prompt J/psi has |y|>1) - 511, // B0 - 521, // B+ - 531, // Bs - 541, // Bc + // we also add B hadrons to trigger correct rapidity range (e.g. B is + // within |y|<1 but non-prompt J/psi has |y|>1) + 511, // B0 + 521, // B+ + 531, // Bs + 541, // Bc 5122, // Lambdab 5132, // Xib+ 5232, // Xib0 - 5332 // Omegab - }; + 5332 // Omegab + }; - auto gen = new o2::eventgen::GeneratorEvtGen(); - gen->setTriggerGap(triggerGap); - // this is a trigger before EvtGen decays, after which the rapidities of the particles are modified. - // The rapidity cut is then only applied in the triggerEvent after the decays - gen->setRapidityRange(rapidityMin - 1., rapidityMax + 1.); - // specify particles to be triggered - for (int i = 0; i < 16; i++) { - gen->addHadronPDGs(particleList[i]); + auto gen = new o2::eventgen::GeneratorEvtGen(); + gen->setTriggerGap(triggerGap); + // this is a trigger before EvtGen decays, after which the rapidities of the + // particles are modified. The rapidity cut is then only applied in the + // triggerEvent after the decays + gen->setRapidityRange(rapidityMin - 1., rapidityMax + 1.); + // specify particles to be triggered + for (int i = 0; i < 16; i++) { + gen->addHadronPDGs(particleList[i]); + } + gen->setVerbose(verbose); + + // possibility to enhance a particle compared to another (or completely reject one particle) using rejection factors configured from a string + // The rejection factors can be kept in a comma separated list (e.g. "pdg1:rejFactor1,pdg2:rejFactor2") + // The keywords "prompt" and "non-prompt" can be used to modify all prompt and all non-prompt (e.g. "prompt:rejFactor1,non-prompt:rejFactor2") + // The keyword can be used for only one particle (e.g. "pdg1:rejFactor1:prompt,pdg1:rejFactor2:non-prompt") + TObjArray *objArray = rejFactors.Tokenize(","); + for (int i = 0; i < objArray->GetEntries(); i++) { + TString rejStr = TString(objArray->At(i)->GetName()); + TObjArray *objArrayCurrent = rejStr.Tokenize(":"); + if (objArrayCurrent->GetEntries() != 2 && objArrayCurrent->GetEntries() != 3) { + LOGF(fatal, "Problem when configuring string for particle rejection factors: %s, incorrect length", + rejStr.Data()); } - gen->setVerbose(verbose); - - // possibility to enhance a particle compared to another (or completely reject one particle) using rejection factors configured from a string - // the rejection factors can be kept in a comma separated list (e.g. "pdg1:rejFactor1,pdg2:rejFactor2") - // also the keywords "prompt" and "non-prompt" can be used to modify all prompt and all non-prompt (e.g. "prompt:rejFactor1,non-prompt:rejFactor2") - // or the keyword can be used for only one particle (e.g. "pdg1:rejFactor1:prompt,pdg1:rejFactor2:non-prompt") - TObjArray* objArray = rejFactors.Tokenize(","); - for (int i = 0; i < objArray->GetEntries(); i++) { - TString rejStr = TString(objArray->At(i)->GetName()); - TObjArray* objArrayCurrent = rejStr.Tokenize(":"); - if (objArrayCurrent->GetEntries() != 2 && objArrayCurrent->GetEntries() != 3) { - LOGF(fatal, "Problem when configuring string for particle rejection factors: %s, incorrect length", rejStr.Data()); - } - TString str0 = TString(objArrayCurrent->At(0)->GetName()); - TString str1 = TString(objArrayCurrent->At(1)->GetName()); - if (!str1.IsFloat()) { - LOGF(fatal, "Problem when configuring string for particle rejection factors: %s, is not float", rejStr.Data()); + TString str0 = TString(objArrayCurrent->At(0)->GetName()); + TString str1 = TString(objArrayCurrent->At(1)->GetName()); + if (!str1.IsFloat()) { + LOGF(fatal, + "Problem when configuring string for particle rejection factors: %s, is not float", + rejStr.Data()); + } + if (str0.CompareTo("prompt") == 0) { + // Common switch for all prompt particles + for (int ihad = 0; ihad < 16; ihad++) { + gen->setRejFactorPrompt(particleList[ihad], str1.Atof()); } - if (str0.CompareTo("prompt") == 0) { - // Common switch for all prompt particles - for (int ihad = 0; ihad < 16; ihad++) { - gen->setRejFactorPrompt(particleList[ihad], str1.Atof()); - } - continue; + continue; + } + if (str0.CompareTo("non-prompt") == 0) { + // Common switch for all non-prompt particles + for (int ihad = 0; ihad < 16; ihad++) { + gen->setRejFactorNonPrompt(particleList[ihad], str1.Atof()); } - if (str0.CompareTo("non-prompt") == 0) { - // Common switch for all non-prompt particles - for (int ihad = 0; ihad < 16; ihad++) { - gen->setRejFactorNonPrompt(particleList[ihad], str1.Atof()); - } + continue; + } + if (str0.IsDigit()) { + // Setting the rejection factor for a specific particle + if (objArrayCurrent->GetEntries() == 2) { + gen->setRejFactorPrompt(str0.Atoi(), str1.Atof()); + gen->setRejFactorNonPrompt(str0.Atoi(), str1.Atof()); continue; - } - if (str0.IsDigit()) { - // Setting the rejection factor for a specific particle - if (objArrayCurrent->GetEntries() == 2) { + } else { + TString str2 = TString(objArrayCurrent->At(2)->GetName()); + if (str2.CompareTo("prompt") == 0) { gen->setRejFactorPrompt(str0.Atoi(), str1.Atof()); - gen->setRejFactorNonPrompt(str0.Atoi(), str1.Atof()); continue; } - else { - TString str2 = TString(objArrayCurrent->At(2)->GetName()); - if (str2.CompareTo("prompt") == 0) { - gen->setRejFactorPrompt(str0.Atoi(), str1.Atof()); - continue; - } - if (str2.CompareTo("non-prompt") == 0) { - gen->setRejFactorNonPrompt(str0.Atoi(), str1.Atof()); - continue; - } + if (str2.CompareTo("non-prompt") == 0) { + gen->setRejFactorNonPrompt(str0.Atoi(), str1.Atof()); + continue; } } - LOGF(fatal, "Problem when configuring string for particle rejection factors: %s, incorrect template", rejStr.Data()); } - + LOGF(fatal, + "Problem when configuring string for particle rejection factors: %s, incorrect template", + rejStr.Data()); + } - TString pathO2table = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg"); - gen->readFile(pathO2table.Data()); - gen->setConfigMBdecays(pathO2table); - gen->PrintDebug(true); + TString pathO2table = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg"); + gen->readFile(pathO2table.Data()); + gen->setConfigMBdecays(pathO2table); + gen->PrintDebug(true); - // specify particles to be decayed with EvtGen - gen->SetSizePdg(16); - for (int i = 0; i < 16; i++) { - gen->AddPdg(particleList[i], i); - } - - gen->SetForceDecay(kEvtBPsiAndJpsiDiElectron); + // specify particles to be decayed with EvtGen + gen->SetSizePdg(16); + for (int i = 0; i < 16; i++) { + gen->AddPdg(particleList[i], i); + } - // set random seed - gen->readString("Random:setSeed on"); - uint random_seed; - unsigned long long int random_value = 0; - ifstream urandom("/dev/urandom", ios::in | ios::binary); - urandom.read(reinterpret_cast(&random_value), sizeof(random_seed)); - gen->readString(Form("Random:seed = %llu", random_value % 900000001)); + gen->SetForceDecay(kEvtBPsiAndJpsiDiElectron); - // print debug - // gen->PrintDebug(); - - // add trigger on the correct rapidity range after EvtGen decays - gen->setTriggerMode(Generator::kTriggerOR); - for (int i = 0; i < 16; i++) { - gen->addTrigger(triggerPDGRap(rapidityMin, rapidityMax, particleList[i], gen)); - } - - // what to do if the trigger was rejected - gen->setTriggerFalseHook( - [gen](std::vector const& p, int eventCount) { + // set random seed + gen->readString("Random:setSeed on"); + uint random_seed; + unsigned long long int random_value = 0; + ifstream urandom("/dev/urandom", ios::in | ios::binary); + urandom.read(reinterpret_cast(&random_value), sizeof(random_seed)); + gen->readString(Form("Random:seed = %llu", random_value % 900000001)); + + // print debug + // gen->PrintDebug(); + + // add trigger on the correct rapidity range after EvtGen decays + gen->setTriggerMode(Generator::kTriggerOR); + for (int i = 0; i < 16; i++) { + gen->addTrigger(triggerPDGRap(rapidityMin, rapidityMax, particleList[i], gen)); + } + + // what to do if the trigger was rejected + gen->setTriggerFalseHook( + [gen](std::vector const &p, int eventCount) { gen->decrementGeneratedEvents(); - } - ); + }); - return gen; + return gen; } diff --git a/MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.C b/MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.C index 80ae5d71f..d23d3e654 100644 --- a/MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.C +++ b/MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.C @@ -1,72 +1,77 @@ -int External() -{ - int checkPdgSignal = 443; - int checkPdgDecay = 11; - std::string path{"o2sim_Kine.root"}; - std::cout << "Check for\nsignal PDG " << checkPdgSignal << "\ndecay PDG " << checkPdgDecay << "\n"; - TFile file(path.c_str(), "READ"); - if (file.IsZombie()) { - std::cerr << "Cannot open ROOT file " << path << "\n"; - return 1; - } +int External() { + int checkPdgSignal = 443; + int checkPdgDecay = 11; + std::string path{"o2sim_Kine.root"}; + std::cout << "Check for\nsignal PDG " << checkPdgSignal << "\ndecay PDG " + << checkPdgDecay << "\n"; + TFile file(path.c_str(), "READ"); + if (file.IsZombie()) { + std::cerr << "Cannot open ROOT file " << path << "\n"; + return 1; + } - auto tree = (TTree*)file.Get("o2sim"); - std::vector* tracks{}; - tree->SetBranchAddress("MCTrack", &tracks); + auto tree = (TTree *)file.Get("o2sim"); + std::vector *tracks{}; + tree->SetBranchAddress("MCTrack", &tracks); - int nLeptons{}; - int nAntileptons{}; - int nLeptonPairs{}; - int nLeptonPairsToBeDone{}; - int nSignal{}; - auto nEvents = tree->GetEntries(); + int nLeptons{}; + int nAntileptons{}; + int nLeptonPairs{}; + int nLeptonPairsToBeDone{}; + int nSignal{}; + auto nEvents = tree->GetEntries(); - for (int i = 0; i < nEvents; i++) { - tree->GetEntry(i); - for (auto& track : *tracks) { - auto pdg = track.GetPdgCode(); - if (pdg == checkPdgDecay) { - // count leptons - nLeptons++; - } else if(pdg == -checkPdgDecay) { - // count anti-leptons - nAntileptons++; - } else if (pdg == checkPdgSignal) { - // count signal PDG - nSignal++; - auto child0 = o2::mcutils::MCTrackNavigator::getDaughter0(track, *tracks); - auto child1 = o2::mcutils::MCTrackNavigator::getDaughter1(track, *tracks); - if (child0 != nullptr && child1 != nullptr) { - // check for parent-child relations - auto pdg0 = child0->GetPdgCode(); - auto pdg1 = child1->GetPdgCode(); - std::cout << "First and last children of parent " << checkPdgSignal << " are PDG0: " << pdg0 << " PDG1: " << pdg1 << "\n"; - if (std::abs(pdg0) == checkPdgDecay && std::abs(pdg1) == checkPdgDecay && pdg0 == -pdg1) { - nLeptonPairs++; - if (child0->getToBeDone() && child1->getToBeDone()) { - nLeptonPairsToBeDone++; - } - } - } + for (int i = 0; i < nEvents; i++) { + tree->GetEntry(i); + for (auto &track : *tracks) { + auto pdg = track.GetPdgCode(); + if (pdg == checkPdgDecay) { + // count leptons + nLeptons++; + } else if (pdg == -checkPdgDecay) { + // count anti-leptons + nAntileptons++; + } else if (pdg == checkPdgSignal) { + // count signal PDG + nSignal++; + auto child0 = + o2::mcutils::MCTrackNavigator::getDaughter0(track, *tracks); + auto child1 = + o2::mcutils::MCTrackNavigator::getDaughter1(track, *tracks); + if (child0 != nullptr && child1 != nullptr) { + // check for parent-child relations + auto pdg0 = child0->GetPdgCode(); + auto pdg1 = child1->GetPdgCode(); + std::cout << "First and last children of parent " << checkPdgSignal + << " are PDG0: " << pdg0 << " PDG1: " << pdg1 << "\n"; + if (std::abs(pdg0) == checkPdgDecay && + std::abs(pdg1) == checkPdgDecay && pdg0 == -pdg1) { + nLeptonPairs++; + if (child0->getToBeDone() && child1->getToBeDone()) { + nLeptonPairsToBeDone++; } + } } + } } - std::cout << "#events: " << nEvents << "\n" - << "#leptons: " << nLeptons << "\n" - << "#antileptons: " << nAntileptons << "\n" - << "#signal: " << nSignal << "\n" - << "#lepton pairs: " << nLeptonPairs << "\n" - << "#lepton pairs to be done: " << nLeptonPairs << "\n"; - + } + std::cout << "#events: " << nEvents << "\n" + << "#leptons: " << nLeptons << "\n" + << "#antileptons: " << nAntileptons << "\n" + << "#signal: " << nSignal << "\n" + << "#lepton pairs: " << nLeptonPairs << "\n" + << "#lepton pairs to be done: " << nLeptonPairs << "\n"; - if (nLeptonPairs == 0 || nLeptons == 0 || nAntileptons == 0) { - std::cerr << "Number of leptons, number of anti-leptons as well as number of lepton pairs should all be greater than 1.\n"; - return 1; - } - if (nLeptonPairs != nLeptonPairsToBeDone) { - std::cerr << "The number of lepton pairs should be the same as the number of lepton pairs which should be transported.\n"; - return 1; - } + if (nLeptonPairs == 0 || nLeptons == 0 || nAntileptons == 0) { + std::cerr << "Number of leptons, number of anti-leptons as well as number " + "of lepton pairs should all be greater than 1.\n"; + return 1; + } + if (nLeptonPairs != nLeptonPairsToBeDone) { + std::cerr << "The number of lepton pairs should be the same as the number " + "of lepton pairs which should be transported.\n"; + return 1; + } - return 0; + return 0; } diff --git a/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg b/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg index 3787a9bb2..2cc29e535 100644 --- a/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg +++ b/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg @@ -2,4 +2,3 @@ 443:mayDecay off # J/psi 100443:mayDecay off # psi(2S) - From 2bbe70acc97bf5e980c7d1eaab25f17b049f92b1 Mon Sep 17 00:00:00 2001 From: Gauthier Legras Date: Thu, 17 Sep 2026 12:38:36 +0200 Subject: [PATCH 5/6] small fix --- .../PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC | 1 - 1 file changed, 1 deletion(-) diff --git a/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC index cf3241a61..6ab836f92 100644 --- a/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC +++ b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC @@ -26,7 +26,6 @@ Decay B0 0.0005 J/psi K_2*0 PHSP; 0.000094000 J/psi phi K0 PHSP; #[Reconstructed PDG2011] #### -0.000871000 J/psi K0 SVS; #[New mode added] #[Reconstructed PDG2011] 0.000310000 J/psi omega K0 PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000009500 J/psi eta PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000019000 J/psi pi+ pi- PHSP; #[New mode added] #[Reconstructed PDG2011] From 3d47337bd97b046d28cbbe1a7077dc3b98a03e73 Mon Sep 17 00:00:00 2001 From: Gauthier Legras Date: Thu, 17 Sep 2026 19:48:22 +0200 Subject: [PATCH 6/6] update with possibility to choose which decay table we want --- .../BTOPSIJPSITODIELECTRON.DEC | 116 +++++---- .../CHARMONIATOJPSIANDDIELECTRON.DEC | 42 ++++ MC/config/PWGDQ/EvtGen/GeneratorEvtGen.C | 6 +- ...enerator_pythia8_HadronTriggered_withGap.C | 227 +++++++++++------- ...dInclusiveQuarkonia_Pythia8_TriggerGap.ini | 2 +- ...konia_enhancedB_Pythia8_TriggerGap.ini.txt | 7 + ...veQuarkonia_enhancedB_Pythia8_TriggerGap.C | 77 ++++++ .../pythia8/decayer/switchOffAllQuarkonia.cfg | 8 - .../switchOffAllQuarkoniaAndBhadrons.cfg | 18 ++ .../PWGDQ/pythia8/decayer/switchOffJpsi.cfg | 4 +- .../pythia8/decayer/switchOffJpsiUpsilon.cfg | 7 + 11 files changed, 364 insertions(+), 150 deletions(-) create mode 100644 MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/CHARMONIATOJPSIANDDIELECTRON.DEC create mode 100644 MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_enhancedB_Pythia8_TriggerGap.ini.txt create mode 100644 MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_enhancedB_Pythia8_TriggerGap.C create mode 100644 MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkoniaAndBhadrons.cfg create mode 100644 MC/config/PWGDQ/pythia8/decayer/switchOffJpsiUpsilon.cfg diff --git a/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC index 6ab836f92..5d43c4ae4 100644 --- a/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC +++ b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/BTOPSIJPSITODIELECTRON.DEC @@ -2,34 +2,35 @@ Decay B0 ### # -0.000610000 psi(2S) K*0 SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] +0.000590000 psi(2S) K*0 SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] 0.0004 psi(2S) K+ pi- PHSP; 0.0002 psi(2S) K0 pi0 PHSP; -0.0002 psi(2S) K0 pi- pi+ PHSP; +0.000281 psi(2S) K0 pi- pi+ PHSP; 0.0001 psi(2S) K0 pi0 pi0 PHSP; 0.0001 psi(2S) K+ pi- pi0 PHSP; 0.0004 psi(2S) K_10 PHSP; ### -0.000620000 psi(2S) K0 SVS; #[New mode added] #[Reconstructed PDG2011] +0.000580000 psi(2S) K0 SVS; #[New mode added] #[Reconstructed PDG2011] 0.000891000 J/psi K0 SVS; #[Reconstructed PDG2011] # # -0.001330000 J/psi K*0 SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] -0.000017600 J/psi pi0 SVS; #[Reconstructed PDG2011] -0.000027000 J/psi rho0 SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] -0.00003 J/psi omega SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; +0.001270000 J/psi K*0 SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] +0.000017300 J/psi pi0 SVS; #[Reconstructed PDG2011] +0.000025500 J/psi rho0 SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; #[Reconstructed PDG2011] +0.0000208 J/psi omega SVV_HELAMP PKHplus PKphHplus PKHzero PKphHzero PKHminus PKphHminus; 0.000000000 J/psi K+ pi- PHSP; #[Reconstructed PDG2011] 0.0001 J/psi K0 pi0 PHSP; 0.001300000 J/psi K_10 SVV_HELAMP 0.5 0.0 1.0 0.0 0.5 0.0; #[Reconstructed PDG2011] 0.0001 J/psi K'_10 SVV_HELAMP 0.5 0.0 1.0 0.0 0.5 0.0; 0.0005 J/psi K_2*0 PHSP; -0.000094000 J/psi phi K0 PHSP; #[Reconstructed PDG2011] +0.000049000 J/psi phi K0 PHSP; #[Reconstructed PDG2011] #### -0.000310000 J/psi omega K0 PHSP; #[New mode added] #[Reconstructed PDG2011] -0.000009500 J/psi eta PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000230000 J/psi omega K0 PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000012300 J/psi eta PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000019000 J/psi pi+ pi- PHSP; #[New mode added] #[Reconstructed PDG2011] -0.000460000 J/psi K0 pi+ pi- PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000450000 J/psi K0 pi+ pi- PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000025000 J/psi K0 K+ K- PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000540000 J/psi K0 rho0 PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000800000 J/psi K*+ pi- PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000660000 J/psi K*0 pi+ pi- PHSP; #[New mode added] #[Reconstructed PDG2011] @@ -52,34 +53,35 @@ Enddecay Decay anti-B0 ### # -0.000610000 psi(2S) anti-K*0 SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] +0.000590000 psi(2S) anti-K*0 SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] 0.0004 psi(2S) K- pi+ PHSP; 0.0002 psi(2S) anti-K0 pi0 PHSP; -0.0002 psi(2S) anti-K0 pi+ pi- PHSP; +0.000281 psi(2S) anti-K0 pi+ pi- PHSP; 0.0001 psi(2S) anti-K0 pi0 pi0 PHSP; 0.0001 psi(2S) K- pi+ pi0 PHSP; 0.0004 psi(2S) anti-K_10 PHSP; ### -0.000620000 psi(2S) anti-K0 SVS; #[New mode added] #[Reconstructed PDG2011] +0.000580000 psi(2S) anti-K0 SVS; #[New mode added] #[Reconstructed PDG2011] 0.000891000 J/psi anti-K0 SVS; #[Reconstructed PDG2011] # updated BR and corrected for double-couting (https://repo.hepforge.org/rEVTGEN16d483d4962aeeb93e857939666a9ba3383bb71f) # # -0.001330000 J/psi anti-K*0 SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] -0.000017600 J/psi pi0 SVS; #[Reconstructed PDG2011] -0.000027000 J/psi rho0 SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] -0.000030 J/psi omega SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; +0.001270000 J/psi anti-K*0 SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] +0.000017300 J/psi pi0 SVS; #[Reconstructed PDG2011] +0.000025500 J/psi rho0 SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; #[Reconstructed PDG2011] +0.0000208 J/psi omega SVV_HELAMP PKHminus PKphHminus PKHzero PKphHzero PKHplus PKphHplus; 0.000000000 J/psi K- pi+ PHSP; #[Reconstructed PDG2011] 0.0001 J/psi anti-K0 pi0 PHSP; 0.001300000 J/psi anti-K_10 SVV_HELAMP 0.5 0.0 1.0 0.0 0.5 0.0; #[Reconstructed PDG2011] 0.0001 J/psi anti-K'_10 SVV_HELAMP 0.5 0.0 1.0 0.0 0.5 0.0; 0.0005 J/psi anti-K_2*0 PHSP; -0.000094000 J/psi phi anti-K0 PHSP; #[Reconstructed PDG2011] +0.000049000 J/psi phi anti-K0 PHSP; #[Reconstructed PDG2011] ### -0.000310000 J/psi omega anti-K0 PHSP; #[New mode added] #[Reconstructed PDG2011] -0.000009500 J/psi eta PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000230000 J/psi omega anti-K0 PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000012300 J/psi eta PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000019000 J/psi pi- pi+ PHSP; #[New mode added] #[Reconstructed PDG2011] -0.000460000 J/psi anti-K0 pi- pi+ PHSP; #[New mode added] #[Reconstructed PDG2011] +0.000450000 J/psi anti-K0 pi- pi+ PHSP; #[New mode added] #[Reconstructed PDG2011] +0.0000250000 J/psi anti-K0 K- K+ PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000540000 J/psi anti-K0 rho0 PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000800000 J/psi K*- pi+ PHSP; #[New mode added] #[Reconstructed PDG2011] 0.000660000 J/psi anti-K*0 pi- pi+ PHSP; #[New mode added] #[Reconstructed PDG2011] @@ -196,9 +198,9 @@ Enddecay Decay B_s0 ### psi' = 0.34% CLNS 94/1315 -0.000465 psi(2S) eta' SVS; -0.000235 psi(2S) eta SVS; -0.000680000 psi(2S) phi SVV_HELAMP 1.0 0.0 1.0 0.0 1.0 0.0; #[Reconstructed PDG2011] +0.000137 psi(2S) eta' SVS; +0.00037 psi(2S) eta SVS; +0.000510000 psi(2S) phi SVV_HELAMP 1.0 0.0 1.0 0.0 1.0 0.0; #[Reconstructed PDG2011] 0.0003 psi(2S) K- K+ PHSP; 0.0003 psi(2S) anti-K0 K0 PHSP; 0.0003 psi(2S) K0 K- pi+ PHSP; @@ -210,19 +212,22 @@ Decay B_s0 0.0002 psi(2S) eta pi0 pi0 PHSP; 0.0004 psi(2S) eta' pi+ pi- PHSP; 0.0004 psi(2S) eta' pi0 pi0 PHSP; -0.0002 psi(2S) pi+ pi- PHSP; +0.000068 psi(2S) pi+ pi- PHSP; 0.0002 psi(2S) pi0 pi0 PHSP; #### -0.00064 J/psi eta' SVS; -0.00032 J/psi eta SVS; -0.001300000 J/psi phi SVV_HELAMP 1.0 0.0 1.0 0.0 1.0 0.0; #[Reconstructed PDG2011] -0.00008 J/psi K0 SVS; -0.00070 J/psi K- K+ PHSP; +0.000353 J/psi eta' SVS; +0.000445 J/psi eta SVS; +0.00026 J/psi f'2 SVS; +0.001010000 J/psi phi SVV_HELAMP 1.0 0.0 1.0 0.0 1.0 0.0; #[Reconstructed PDG2011] +0.0000384 J/psi K0 SVS; +0.00079 J/psi K- K+ PHSP; 0.00070 J/psi anti-K0 K0 PHSP; -0.00070 J/psi K0 K- pi+ PHSP; +0.000475 J/psi K0 K- pi+ PHSP; +0.000475 J/psi K0 K+ pi- PHSP; 0.00070 J/psi anti-K0 K0 pi0 PHSP; 0.00070 J/psi K- K+ pi0 PHSP; +0.000107 J/psi K*0 anti-K*0 PHSP; # LHCb PR 04/02/04 Add (cc) phi n pi(+/0) 0.00039 J/psi phi pi+ pi- PHSP; 0.00039 J/psi phi pi0 pi0 PHSP; @@ -237,14 +242,14 @@ Decay B_s0 0.0000023 phi e+ e- BTOSLLALI; # --- chi_c1 --- - 0.0001970 chi_c1 phi SVV_HELAMP 1.0 0.0 1.0 0.0 1.0 0.0; + 0.0001920 chi_c1 phi SVV_HELAMP 1.0 0.0 1.0 0.0 1.0 0.0; Enddecay Decay anti-B_s0 ### -0.000465 psi(2S) eta' SVS; -0.000235 psi(2S) eta SVS; -0.000680000 psi(2S) phi SVV_HELAMP 1.0 0.0 1.0 0.0 1.0 0.0; #[Reconstructed PDG2011] +0.000137 psi(2S) eta' SVS; +0.00037 psi(2S) eta SVS; +0.000510000 psi(2S) phi SVV_HELAMP 1.0 0.0 1.0 0.0 1.0 0.0; #[Reconstructed PDG2011] 0.0003 psi(2S) K- K+ PHSP; 0.0003 psi(2S) anti-K0 K0 PHSP; 0.0003 psi(2S) anti-K0 K+ pi- PHSP; @@ -256,18 +261,21 @@ Decay anti-B_s0 0.0002 psi(2S) eta pi0 pi0 PHSP; 0.0004 psi(2S) eta' pi+ pi- PHSP; 0.0004 psi(2S) eta' pi0 pi0 PHSP; -0.0002 psi(2S) pi+ pi- PHSP; +0.000068 psi(2S) pi+ pi- PHSP; 0.0002 psi(2S) pi0 pi0 PHSP; ### -0.00064 J/psi eta' SVS; -0.00032 J/psi eta SVS; -0.001300000 J/psi phi SVV_HELAMP 1.0 0.0 1.0 0.0 1.0 0.0; #[Reconstructed PDG2011] -0.00008 J/psi K0 SVS; -0.00070 J/psi K- K+ PHSP; +0.000353 J/psi eta' SVS; +0.000445 J/psi eta SVS; +0.00026 J/psi f'2 SVS; +0.001010000 J/psi phi SVV_HELAMP 1.0 0.0 1.0 0.0 1.0 0.0; #[Reconstructed PDG2011] +0.0000384 J/psi K0 SVS; +0.00079 J/psi K- K+ PHSP; 0.00070 J/psi anti-K0 K0 PHSP; -0.00070 J/psi anti-K0 K+ pi- PHSP; +0.000475 J/psi anti-K0 K+ pi- PHSP; +0.000475 J/psi anti-K0 K- pi+ PHSP; 0.00070 J/psi anti-K0 K0 pi0 PHSP; 0.00070 J/psi K- K+ pi0 PHSP; +0.000107 J/psi K*0 anti-K*0 PHSP; # LHCb PR 04/02/04 Add (cc) phi n pi(+/0) 0.00039 J/psi phi pi+ pi- PHSP; 0.00039 J/psi phi pi0 pi0 PHSP; @@ -287,8 +295,13 @@ Enddecay Decay Lambda_b0 ### -0.00038 Lambda0 psi(2S) PHSP; -0.00047 Lambda0 J/psi PHSP; +0.00015 Lambda0 psi(2S) PHSP; +0.0003 Lambda0 J/psi PHSP; +0.000012 Lambda0 J/psi phi PHSP; +0.000026 p J/psi pi- PHSP; +0.00032 p J/psi K- PHSP; +0.000066 p J/psi pi- pi+ K- PHSP; +0.000066 p psi(2S) K- PHSP; 0.0000760 chi_c1 p+ K- PHSP; 0.0000050 chi_c1 p+ pi- PHSP; 0.0000770 chi_c2 p+ K- PHSP; @@ -297,8 +310,13 @@ Enddecay Decay anti-Lambda_b0 ### -0.00038 anti-Lambda0 psi(2S) PHSP; -0.00047 anti-Lambda0 J/psi PHSP; +0.00015 anti-Lambda0 psi(2S) PHSP; +0.0003 anti-Lambda0 J/psi PHSP; +0.000012 Lambda0 J/psi phi PHSP; +0.000026 anti-p J/psi pi+ PHSP; +0.00032 anti-p J/psi K+ PHSP; +0.000066 anti-p J/psi pi- pi+ K+ PHSP; +0.000066 anti-p psi(2S) K+ PHSP; 0.0000760 chi_c1 anti-p- K+ PHSP; 0.0000050 chi_c1 anti-p- pi+ PHSP; 0.0000770 chi_c2 anti-p- K+ PHSP; @@ -307,11 +325,15 @@ Enddecay Decay Xi_b- 0.00047 Xi- J/psi PHSP; + 0.000108 J/psi Lambda0 K- PHSP; + 0.000394 Xi- psi(2S) PHSP; Enddecay Decay anti-Xi_b+ 0.00047 anti-Xi+ J/psi PHSP; + 0.000108 J/psi anti-Lambda0 K+ PHSP; + 0.000394 anti-Xi+ psi(2S) PHSP; Enddecay Decay Xi_b0 diff --git a/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/CHARMONIATOJPSIANDDIELECTRON.DEC b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/CHARMONIATOJPSIANDDIELECTRON.DEC new file mode 100644 index 000000000..fc554fb28 --- /dev/null +++ b/MC/config/PWGDQ/EvtGen/DecayTablesEvtgen/CHARMONIATOJPSIANDDIELECTRON.DEC @@ -0,0 +1,42 @@ +Decay chi_c0 +0.0135 gamma J/psi PHSP; +0.000129 J/psi e+ e- PHOTOS PHSP; +Enddecay + +### +Decay chi_c1 +0.339 J/psi gamma VVP 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0; +0.00342 J/psi e+ e- PHOTOS PHSP; +Enddecay + +### +Decay chi_c2 +0.190 gamma J/psi PHSP; +0.00214 J/psi e+ e- PHOTOS PHSP; +Enddecay + +Decay psi(2S) +0.00795 e+ e- PHOTOS VLL; +0.0208 J/psi pi+ pi- VVPIPI; # multiplied by J/psi->ee BR to keep relative statistics, since J/psi->ee itself is also enhanced +0.0000819 gamma chi_c0 PHSP; # * BR(J/psi->ee) * BR(chi_c0->J/psi) +0.00201 gamma chi_c1 PHSP; # * BR(J/psi->ee) * BR(chi_c1->J/psi) +0.00110 gamma chi_c2 PHSP; # * BR(J/psi->ee) * BR(chi_c2->J/psi) +Enddecay + +Decay J/psi +1.000 e+ e- PHOTOS VLL; +Enddecay + +Decay Upsilon +1.000 e+ e- PHOTOS VLL; +Enddecay + +Decay Upsilon(2S) +1.000 e+ e- PHOTOS VLL; +Enddecay + +Decay Upsilon(3S) +1.000 e+ e- PHOTOS VLL; +Enddecay + +End diff --git a/MC/config/PWGDQ/EvtGen/GeneratorEvtGen.C b/MC/config/PWGDQ/EvtGen/GeneratorEvtGen.C index 1f6d6b867..9c073b5ea 100644 --- a/MC/config/PWGDQ/EvtGen/GeneratorEvtGen.C +++ b/MC/config/PWGDQ/EvtGen/GeneratorEvtGen.C @@ -43,7 +43,8 @@ enum DecayModeEvt { kEvtAll = 0, kEvtDiElectronEM, kEvtGammaEM, kEvtBtoPsi2SToJpsiPiPi, - kEvtBeautyUpgrade }; + kEvtBeautyUpgrade, + kCharmoniaToJpsiAndDielectron}; namespace o2 { @@ -359,6 +360,9 @@ class GeneratorEvtGen : public T case kEvtBtoPsi2SToJpsiPiPi: SetDecayTable(Form("%s/BTOPSITOJPSIPIPI.DEC", pathO2.Data())); break; + case kCharmoniaToJpsiAndDielectron: + SetDecayTable(Form("%s/CHARMONIATOJPSIANDDIELECTRON.DEC", pathO2.Data())); + break; } return; }; diff --git a/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C b/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C index 861e3760c..823b0b322 100644 --- a/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C +++ b/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C @@ -146,70 +146,79 @@ bool isCharmonium(int pdg) { // search for the presence of at least one of the required hadrons in a selected rapidity window bool findHadrons(Pythia8::Event& event) { int ihad = 0; - for (int ipa = 0; ipa < event.size(); ++ipa) { - - auto daughterList = event[ipa].daughterList(); - - for (auto ida : daughterList) { - ihad = 0; - for (int pdg : mHadronsPDGs) { // check that at least one of the pdg code is found in the event - if (abs(event[ida].id()) == pdg) { - if ((event[ida].y() > mRapidityMin) && (event[ida].y() < mRapidityMax)) { - cout << "============= Found jpsi y,pt,pdg " << event[ida].y() - << ", " << event[ida].pT() << ", " << event[ida].id() << endl; - std::vector daughters = event[ida].daughterList(); - for (int d : daughters) { - cout << "###### daughter " << d << ": code " << event[d].id() << ", pt " << event[d].pT() << endl; - } - if (event[ida].daughter1() == event[ida].daughter2() && - event[ida].daughter1() > 0) { - continue; // particle has a carbon-copy as daughter, its daughter - // will already be considered for triggering - } + for (int ida = 0; ida < event.size(); ++ida) { + //auto daughterList = event[ipa].daughterList(); + //for (auto ida : daughterList) { + ihad = 0; + for (int pdg : mHadronsPDGs) { // check that at least one of the pdg code is found in the event + if (abs(event[ida].id()) == pdg) { + if ((event[ida].y() > mRapidityMin) && (event[ida].y() < mRapidityMax)) { + cout << "============= Found jpsi y,pt,pdg " << event[ida].y() << ", " << event[ida].pT() << ", " << event[ida].id() << endl; + std::vector daughters = event[ida].daughterList(); + for (int d : daughters) { + cout << "###### daughter " << d << ": code " << event[d].id() << ", pt " << event[d].pT() << endl; + } + if (event[ida].daughter1() == event[ida].daughter2() && event[ida].daughter1() > 0) { + continue; // particle has a carbon-copy as daughter, its daughter will already be considered for triggering + } - // check whether particle is prompt or non-prompt, since rejection - // factor can depend on it - bool isNonPrompt = false; - if (isOpenBhadron(pdg)) { - isNonPrompt = true; - LOGF(info, "particle is non-prompt"); - } else { - // check history - int currentIdx = ida; - int currentPdg = pdg; - cout << "particle history: "; - while (isCharmonium(currentPdg) && currentIdx >= 0) { - currentIdx = event[currentIdx].mother1(); - if (currentIdx < 0) { - break; - } - currentPdg = abs(event[currentIdx].id()); - cout << currentPdg << " "; - if (isOpenBhadron(currentPdg)) { - isNonPrompt = true; - LOGF(info, "particle is non-prompt"); - break; + // check whether particle is prompt or non-prompt, since rejection + // factor can depend on it + bool isNonPrompt = false; + if (isOpenBhadron(pdg)) { + isNonPrompt = true; + LOGF(info, "particle is non-prompt"); + + // if the B hadron decays to something else than a charmonia, we don't trigger it + bool hasCharmoniaDecay = false; + if (daughters.size() == 0) { + // in this case B is left undecayed and will be decayed to enhanced charmonia BR with EVTGEN + hasCharmoniaDecay = true; + } + else { + for (int d : daughters) { + if (isCharmonium(event[d].id())) { + hasCharmoniaDecay = true; } } - cout << endl; } - - // rejection factor given in the ini file - float randomNumber = gRandom->Rndm(); - cout << randomNumber << " rej factor: " - << (isNonPrompt ? mRejFactorNonPrompt[ihad] - : mRejFactorPrompt[ihad]) - << endl; - if ((!isNonPrompt && (randomNumber <= mRejFactorPrompt[ihad])) || - (isNonPrompt && (randomNumber <= mRejFactorNonPrompt[ihad]))) { - cout << "event triggered " << endl; - return true; + if (!hasCharmoniaDecay) { + continue; + } + } else { + // check history + int currentIdx = ida; + int currentPdg = pdg; + cout << "particle history: "; + while (isCharmonium(currentPdg) && currentIdx >= 0) { + currentIdx = event[currentIdx].mother1(); + if (currentIdx < 0) { + break; + } + currentPdg = abs(event[currentIdx].id()); + cout << currentPdg << " "; + if (isOpenBhadron(currentPdg)) { + isNonPrompt = true; + LOGF(info, "particle is non-prompt"); + break; + } } + cout << endl; + } + + // rejection factor given in the ini file + float randomNumber = gRandom->Rndm(); + cout << randomNumber << " rej factor: " << (isNonPrompt ? mRejFactorNonPrompt[ihad] : mRejFactorPrompt[ihad]) << endl; + if ((!isNonPrompt && (randomNumber <= mRejFactorPrompt[ihad])) || + (isNonPrompt && (randomNumber <= mRejFactorNonPrompt[ihad]))) { + cout << "event triggered " << endl; + return true; } } - ihad++; } + ihad++; } + //} } return false; @@ -239,13 +248,9 @@ private: } -o2::eventgen::Trigger -triggerPDGRap(double rapMin, double rapMax, int pdg, - GeneratorPythia8HadronTriggeredWithGap *gen) { - auto trigger = [rapMin, rapMax, pdg, - gen](const std::vector &particles) -> bool { - if (gen->getTriggerGap() != 1 && - gen->getNGeneratedEvents() % gen->getTriggerGap() != 1) { +o2::eventgen::Trigger triggerPDGRap(double rapMin, double rapMax, int pdg, GeneratorPythia8HadronTriggeredWithGap *gen) { + auto trigger = [rapMin, rapMax, pdg, gen](const std::vector &particles) -> bool { + if (gen->getTriggerGap() != 1 && gen->getNGeneratedEvents() % gen->getTriggerGap() != 1) { // this is a MB event return true; } @@ -346,11 +351,11 @@ GeneratorInclusiveJpsiPsi2SChiC_EvtGenMidY(int triggerGap, double rapidityMin = gen->setConfigMBdecays(pathO2table); gen->PrintDebug(true); - gen->SetSizePdg(4); + gen->SetSizePdg(2); gen->AddPdg(443, 0); gen->AddPdg(100443, 1); - gen->AddPdg(445, 2); - gen->AddPdg(20443, 3); + //gen->AddPdg(445, 2); + //gen->AddPdg(20443, 3); gen->SetForceDecay(kEvtDiElectron); @@ -367,17 +372,33 @@ GeneratorInclusiveJpsiPsi2SChiC_EvtGenMidY(int triggerGap, double rapidityMin = return gen; } -FairGenerator *GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double rapidityMin = -1.0, double rapidityMax = 1.0, TString rejFactors = "", bool verbose = false) { +FairGenerator *GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double rapidityMin = -1.0, double rapidityMax = 1.0, TString rejFactors = "", int decayMode = 0, bool verbose = false) { + + // This generator allow to choose from the ini file which decay file is to be used (decayMode parameter) and implement rejection factors in order to enhance one particle with respect to others by randomly rejecting trigger (configured through a string) + // The rapidity cut triggers both on the B hadrons rapidities and on quarkonia rapidities + + // This generator should be able to satisfy any needs, although you might have to add some other decayModes and additional particles in the particleList to be triggered + + // decay mode: 0 = enhance B hadrons decays + charmonia to charmonia decays + dileptons decay + // decay mode: 1 = enhance charmonia to charmonia decays + dileptons decays + // decay mode: 2 = enhance only dilepton decays + + // rejFactors string: + // possibility to enhance a particle compared to another (or completely reject one particle) using rejection factors configured from a string + // The rejection factors can be kept in a comma separated list (e.g. "pdg1:rejFactor1,pdg2:rejFactor2") + // The keywords "prompt" and "non-prompt" can be used to modify all prompt and all non-prompt (e.g. "prompt:rejFactor1,non-prompt:rejFactor2") + // The keyword can be used for only one particle (e.g. "pdg1:rejFactor1:prompt,pdg1:rejFactor2:non-prompt") + // Example if you want only to trigger on a given particle p: "prompt:0,non-prompt:0,p:1" int particleList[16] = { 443, // Jpsi 100443, // psi(2S) - 10441, // chic0 - 20443, // chic1 - 445, // chic2 553, // upsilon(1S) 100553, // upsilon(2S) 200553, // upsilon(3S) + 10441, // chic0 + 20443, // chic1 + 445, // chic2 // we also add B hadrons to trigger correct rapidity range (e.g. B is // within |y|<1 but non-prompt J/psi has |y|>1) 511, // B0 @@ -392,20 +413,21 @@ FairGenerator *GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double auto gen = new o2::eventgen::GeneratorEvtGen(); gen->setTriggerGap(triggerGap); - // this is a trigger before EvtGen decays, after which the rapidities of the - // particles are modified. The rapidity cut is then only applied in the - // triggerEvent after the decays - gen->setRapidityRange(rapidityMin - 1., rapidityMax + 1.); + // this is a trigger before EvtGen decays. After EVTGEN decay the rapidities of the particles are modified. + // There is therefore a loose rapidity cut before EVTGEN, and the correct rapidity cut after EVTGEN decay + if (decayMode == 2) { + // In this case EvtGen will not affect charmonia rapidities, so no need to start with a looser rapidity cut + gen->setRapidityRange(rapidityMin, rapidityMax); + } + else { + gen->setRapidityRange(rapidityMin - 1., rapidityMax + 1.); + } // specify particles to be triggered for (int i = 0; i < 16; i++) { gen->addHadronPDGs(particleList[i]); } gen->setVerbose(verbose); - // possibility to enhance a particle compared to another (or completely reject one particle) using rejection factors configured from a string - // The rejection factors can be kept in a comma separated list (e.g. "pdg1:rejFactor1,pdg2:rejFactor2") - // The keywords "prompt" and "non-prompt" can be used to modify all prompt and all non-prompt (e.g. "prompt:rejFactor1,non-prompt:rejFactor2") - // The keyword can be used for only one particle (e.g. "pdg1:rejFactor1:prompt,pdg1:rejFactor2:non-prompt") TObjArray *objArray = rejFactors.Tokenize(","); for (int i = 0; i < objArray->GetEntries(); i++) { TString rejStr = TString(objArray->At(i)->GetName()); @@ -453,12 +475,20 @@ FairGenerator *GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double } } } - LOGF(fatal, - "Problem when configuring string for particle rejection factors: %s, incorrect template", + LOGF(fatal, "Problem when configuring string for particle rejection factors: %s, incorrect template", rejStr.Data()); } - TString pathO2table = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg"); + TString pathO2table; + if (decayMode == 0) { + pathO2table = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkoniaAndBhadrons.cfg"); + } + if (decayMode == 1) { + pathO2table = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg"); + } + if (decayMode == 2) { + pathO2table = gSystem->ExpandPathName("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/decayer/switchOffJpsiUpsilon.cfg"); + } gen->readFile(pathO2table.Data()); gen->setConfigMBdecays(pathO2table); gen->PrintDebug(true); @@ -466,10 +496,21 @@ FairGenerator *GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double // specify particles to be decayed with EvtGen gen->SetSizePdg(16); for (int i = 0; i < 16; i++) { - gen->AddPdg(particleList[i], i); + // Decay only what was left undecayed by Pythia + if (decayMode == 0 || (i <= 7 && decayMode == 1) || (i <= 4 && decayMode == 2)) { + gen->AddPdg(particleList[i], i); + } } - gen->SetForceDecay(kEvtBPsiAndJpsiDiElectron); + if (decayMode == 0) { + gen->SetForceDecay(kEvtBPsiAndJpsiDiElectron); + } + if (decayMode == 1) { + gen->SetForceDecay(kCharmoniaToJpsiAndDielectron); + } + if (decayMode == 2) { + gen->SetForceDecay(kEvtDiElectron); + } // set random seed gen->readString("Random:setSeed on"); @@ -483,16 +524,20 @@ FairGenerator *GeneratorInclusiveAllQuarkonia_EvtGenMidY(int triggerGap, double // gen->PrintDebug(); // add trigger on the correct rapidity range after EvtGen decays - gen->setTriggerMode(Generator::kTriggerOR); - for (int i = 0; i < 16; i++) { - gen->addTrigger(triggerPDGRap(rapidityMin, rapidityMax, particleList[i], gen)); - } + if (decayMode != 2) { + // In this case EvtGen will not affect charmonia rapidities, so no need to start with a looser rapidity cut, first trigger already does the job + gen->setTriggerMode(Generator::kTriggerOR); + for (int i = 0; i < 16; i++) { + // we trigger either on B hadron rapidity or on charmonia rapidity + gen->addTrigger(triggerPDGRap(rapidityMin, rapidityMax, particleList[i], gen)); + } - // what to do if the trigger was rejected - gen->setTriggerFalseHook( - [gen](std::vector const &p, int eventCount) { - gen->decrementGeneratedEvents(); - }); + // what to do if the trigger was rejected + gen->setTriggerFalseHook( + [gen](std::vector const &p, int eventCount) { + gen->decrementGeneratedEvents(); + }); + } return gen; } diff --git a/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini b/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini index f21831078..b79dcc87a 100644 --- a/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini +++ b/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_Pythia8_TriggerGap.ini @@ -1,7 +1,7 @@ ### The external generator derives from GeneratorPythia8. [GeneratorExternal] fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C -funcName=GeneratorInclusiveAllQuarkonia_EvtGenMidY(5,-1.0,1.0,"non-prompt:0.2") +funcName=GeneratorInclusiveAllQuarkonia_EvtGenMidY(5,-1.0,1.0,"",1) [GeneratorPythia8] config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_oniaAll_triggerGap.cfg diff --git a/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_enhancedB_Pythia8_TriggerGap.ini.txt b/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_enhancedB_Pythia8_TriggerGap.ini.txt new file mode 100644 index 000000000..cff8aa385 --- /dev/null +++ b/MC/config/PWGDQ/ini/Generator_TriggeredInclusiveQuarkonia_enhancedB_Pythia8_TriggerGap.ini.txt @@ -0,0 +1,7 @@ +### The external generator derives from GeneratorPythia8. +[GeneratorExternal] +fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/external/generator/generator_pythia8_HadronTriggered_withGap.C +funcName=GeneratorInclusiveAllQuarkonia_EvtGenMidY(5,-1.0,1.0,"non-prompt:0.2",0) + +[GeneratorPythia8] +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGDQ/pythia8/generator/pythia8_oniaAll_triggerGap.cfg diff --git a/MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_enhancedB_Pythia8_TriggerGap.C b/MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_enhancedB_Pythia8_TriggerGap.C new file mode 100644 index 000000000..d23d3e654 --- /dev/null +++ b/MC/config/PWGDQ/ini/tests/Generator_TriggeredInclusiveQuarkonia_enhancedB_Pythia8_TriggerGap.C @@ -0,0 +1,77 @@ +int External() { + int checkPdgSignal = 443; + int checkPdgDecay = 11; + std::string path{"o2sim_Kine.root"}; + std::cout << "Check for\nsignal PDG " << checkPdgSignal << "\ndecay PDG " + << checkPdgDecay << "\n"; + TFile file(path.c_str(), "READ"); + if (file.IsZombie()) { + std::cerr << "Cannot open ROOT file " << path << "\n"; + return 1; + } + + auto tree = (TTree *)file.Get("o2sim"); + std::vector *tracks{}; + tree->SetBranchAddress("MCTrack", &tracks); + + int nLeptons{}; + int nAntileptons{}; + int nLeptonPairs{}; + int nLeptonPairsToBeDone{}; + int nSignal{}; + auto nEvents = tree->GetEntries(); + + for (int i = 0; i < nEvents; i++) { + tree->GetEntry(i); + for (auto &track : *tracks) { + auto pdg = track.GetPdgCode(); + if (pdg == checkPdgDecay) { + // count leptons + nLeptons++; + } else if (pdg == -checkPdgDecay) { + // count anti-leptons + nAntileptons++; + } else if (pdg == checkPdgSignal) { + // count signal PDG + nSignal++; + auto child0 = + o2::mcutils::MCTrackNavigator::getDaughter0(track, *tracks); + auto child1 = + o2::mcutils::MCTrackNavigator::getDaughter1(track, *tracks); + if (child0 != nullptr && child1 != nullptr) { + // check for parent-child relations + auto pdg0 = child0->GetPdgCode(); + auto pdg1 = child1->GetPdgCode(); + std::cout << "First and last children of parent " << checkPdgSignal + << " are PDG0: " << pdg0 << " PDG1: " << pdg1 << "\n"; + if (std::abs(pdg0) == checkPdgDecay && + std::abs(pdg1) == checkPdgDecay && pdg0 == -pdg1) { + nLeptonPairs++; + if (child0->getToBeDone() && child1->getToBeDone()) { + nLeptonPairsToBeDone++; + } + } + } + } + } + } + std::cout << "#events: " << nEvents << "\n" + << "#leptons: " << nLeptons << "\n" + << "#antileptons: " << nAntileptons << "\n" + << "#signal: " << nSignal << "\n" + << "#lepton pairs: " << nLeptonPairs << "\n" + << "#lepton pairs to be done: " << nLeptonPairs << "\n"; + + if (nLeptonPairs == 0 || nLeptons == 0 || nAntileptons == 0) { + std::cerr << "Number of leptons, number of anti-leptons as well as number " + "of lepton pairs should all be greater than 1.\n"; + return 1; + } + if (nLeptonPairs != nLeptonPairsToBeDone) { + std::cerr << "The number of lepton pairs should be the same as the number " + "of lepton pairs which should be transported.\n"; + return 1; + } + + return 0; +} diff --git a/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg b/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg index 2711096f1..2d5c57ade 100644 --- a/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg +++ b/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkonia.cfg @@ -8,11 +8,3 @@ 553:mayDecay off # upsilon1S 100553:mayDecay off # upsilon2S 200553:mayDecay off # upsilon3S -511:mayDecay off # B0 -521:mayDecay off # B+ -531:mayDecay off # Bs -541:mayDecay off # Bc -5122:mayDecay off # Lambdab -5132:mayDecay off # Xib+ -5232:mayDecay off # Xib0 -5332:mayDecay off # Omegab diff --git a/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkoniaAndBhadrons.cfg b/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkoniaAndBhadrons.cfg new file mode 100644 index 000000000..2711096f1 --- /dev/null +++ b/MC/config/PWGDQ/pythia8/decayer/switchOffAllQuarkoniaAndBhadrons.cfg @@ -0,0 +1,18 @@ +#switch off all quarkonia and B hadrons decays + +443:mayDecay off # J/psi +100443:mayDecay off # psi(2S) +10441:mayDecay off # chic0 +20443:mayDecay off # chic1 +445:mayDecay off # chic2 +553:mayDecay off # upsilon1S +100553:mayDecay off # upsilon2S +200553:mayDecay off # upsilon3S +511:mayDecay off # B0 +521:mayDecay off # B+ +531:mayDecay off # Bs +541:mayDecay off # Bc +5122:mayDecay off # Lambdab +5132:mayDecay off # Xib+ +5232:mayDecay off # Xib0 +5332:mayDecay off # Omegab diff --git a/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg b/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg index 2cc29e535..4bc262efc 100644 --- a/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg +++ b/MC/config/PWGDQ/pythia8/decayer/switchOffJpsi.cfg @@ -1,4 +1,4 @@ #switch off jpsi decays -443:mayDecay off # J/psi -100443:mayDecay off # psi(2S) +443:mayDecay off # J/psi +100443:mayDecay off # psi(2S) diff --git a/MC/config/PWGDQ/pythia8/decayer/switchOffJpsiUpsilon.cfg b/MC/config/PWGDQ/pythia8/decayer/switchOffJpsiUpsilon.cfg new file mode 100644 index 000000000..e63c5365f --- /dev/null +++ b/MC/config/PWGDQ/pythia8/decayer/switchOffJpsiUpsilon.cfg @@ -0,0 +1,7 @@ +#switch off jpsi decays + +443:mayDecay off # J/psi +100443:mayDecay off # psi(2S) +553:mayDecay off # Upsilon(1S) +100553:mayDecay off # Upsilon(2S) +200553:mayDecay off # Upsilon(3S)