From bcd2f4c3dd5edde27f6e0afa8ccd6ae980ac422c Mon Sep 17 00:00:00 2001 From: Roberto Preghenella Date: Sat, 10 Apr 2021 16:01:37 +0200 Subject: [PATCH] Extend HF ccbar embedding becnhmark to bbbar as well --- .../PWGHF/external/generator/GeneratorHF.C | 31 +++++++++++++++-- MC/config/PWGHF/ini/GeneratorHF.ini | 2 +- MC/config/PWGHF/ini/GeneratorHF_bbbar.ini | 34 +++++++++++++++++++ MC/config/PWGHF/ini/GeneratorHF_ccbar.ini | 34 +++++++++++++++++++ ...ooks_ccbar.C => pythia8_userhooks_qqbar.C} | 27 +++++++++++---- 5 files changed, 117 insertions(+), 11 deletions(-) create mode 100644 MC/config/PWGHF/ini/GeneratorHF_bbbar.ini create mode 100644 MC/config/PWGHF/ini/GeneratorHF_ccbar.ini rename MC/config/PWGHF/pythia8/hooks/{pythia8_userhooks_ccbar.C => pythia8_userhooks_qqbar.C} (66%) diff --git a/MC/config/PWGHF/external/generator/GeneratorHF.C b/MC/config/PWGHF/external/generator/GeneratorHF.C index 3eb5cf5e5..9e76086ef 100644 --- a/MC/config/PWGHF/external/generator/GeneratorHF.C +++ b/MC/config/PWGHF/external/generator/GeneratorHF.C @@ -76,10 +76,10 @@ public: int findAncestor(Pythia8::Event& event) { for (int ipa = 0; ipa < event.size(); ++ipa) { auto daughterList = event[ipa].daughterList(); - bool hasc = false, hascbar = false, atmidy = false; + bool hasq = false, hasqbar = false, atmidy = false; for (auto ida : daughterList) { - if (event[ida].id() == 4) hasc = true; - if (event[ida].id() == -4) hascbar = true; + if (event[ida].id() == mPDG) hasq = true; + if (event[ida].id() == -mPDG) hasqbar = true; if (fabs(event[ida].y()) < mRapidity) atmidy = true; } if (hasc && hascbar && atmidy) @@ -88,6 +88,7 @@ public: return -1; }; + int setPDG(int val) { mPDG = val; }; void setRapidity(double val) { mRapidity = val; }; void setVerbose(bool val) { mVerbose = val; }; void setFormula(std::string val) { mFormula.Compile(val.c_str()); }; @@ -97,6 +98,7 @@ private: TFormula mFormula; int mEvents = 1; Pythia8::Event mOutputEvent; + int mPDG = 4; double mRapidity = 1.5; bool mVerbose = false; @@ -117,4 +119,27 @@ GeneratorHF(double rapidity = 1.5, bool verbose = false) return gen; } +FairGenerator* +GeneratorHF_ccbar(double rapidity = 1.5, bool verbose = false) +{ + auto gen = new o2::eventgen::GeneratorHF(); + gen->setPDG(4); + gen->setRapidity(rapidity); + gen->setVerbose(verbose); + gen->setFormula("max(1.,120.*(x<5.)+80.*(1.-x/20.)*(x>5.)*(x<11.)+240.*(1.-x/13.)*(x>11.))"); + + return gen; +} + +FairGenerator* +GeneratorHF_bbbar(double rapidity = 1.5, bool verbose = false) +{ + auto gen = new o2::eventgen::GeneratorHF(); + gen->setPDG(5); + gen->setRapidity(rapidity); + gen->setVerbose(verbose); + gen->setFormula("max(1.,120.*(x<5.)+80.*(1.-x/20.)*(x>5.)*(x<11.)+240.*(1.-x/13.)*(x>11.))"); + + return gen; +} diff --git a/MC/config/PWGHF/ini/GeneratorHF.ini b/MC/config/PWGHF/ini/GeneratorHF.ini index 866bd0768..85c420f01 100644 --- a/MC/config/PWGHF/ini/GeneratorHF.ini +++ b/MC/config/PWGHF/ini/GeneratorHF.ini @@ -10,7 +10,7 @@ funcName = GeneratorHF() [GeneratorPythia8] config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8.cfg -hooksFileName = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_ccbar.C +hooksFileName = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C hooksFuncName = pythia8_userhooks_ccbar(1.5) ### The setup uses the base configuration of the decayer which is loaded from the file specified by config[0]. diff --git a/MC/config/PWGHF/ini/GeneratorHF_bbbar.ini b/MC/config/PWGHF/ini/GeneratorHF_bbbar.ini new file mode 100644 index 000000000..6e2509904 --- /dev/null +++ b/MC/config/PWGHF/ini/GeneratorHF_bbbar.ini @@ -0,0 +1,34 @@ +### The setup uses an external event generator +### This part sets the path of the file and the function call to retrieve it + +[GeneratorExternal] +fileName = ${O2DPG_ROOT}/MC/config/PWGHF/external/generator/GeneratorHF.C +funcName = GeneratorHF_bbar() + +### The external generator derives from GeneratorPythia8. +### This part configures the bits of the interface: configuration and user hooks + +[GeneratorPythia8] +config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8.cfg +hooksFileName = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C +hooksFuncName = pythia8_userhooks_bbbar(1.5) + +### The setup uses the base configuration of the decayer which is loaded from the file specified by config[0]. +### On top of the base configuration, two more sets of settings are loaded sequentially from config[1] and [2]. + +[DecayerPythia8] +config[0] = ${O2DPG_ROOT}/MC/config/common/pythia8/decayer/base.cfg +config[1] = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/decayer/force_hadronic_D.cfg +config[2] = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/decayer/force_hadronic_D_use4bodies.cfg + +### The setup forces some particles to be decayed by the external decayer instead of Geant. +### The PDG list of the particles is specified below. + +[SimUserDecay] +pdglist = 411 421 431 4112 4122 4232 4132 + +### The setup inhibits transport of primary particles which are produce at forward rapidity. +### The settings below only transports particles in the barrel, which is currently defined as |eta| < 2 + +[Stack] +transportPrimary = barrel diff --git a/MC/config/PWGHF/ini/GeneratorHF_ccbar.ini b/MC/config/PWGHF/ini/GeneratorHF_ccbar.ini new file mode 100644 index 000000000..0ecbad699 --- /dev/null +++ b/MC/config/PWGHF/ini/GeneratorHF_ccbar.ini @@ -0,0 +1,34 @@ +### The setup uses an external event generator +### This part sets the path of the file and the function call to retrieve it + +[GeneratorExternal] +fileName = ${O2DPG_ROOT}/MC/config/PWGHF/external/generator/GeneratorHF.C +funcName = GeneratorHF_ccbar() + +### The external generator derives from GeneratorPythia8. +### This part configures the bits of the interface: configuration and user hooks + +[GeneratorPythia8] +config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8.cfg +hooksFileName = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C +hooksFuncName = pythia8_userhooks_ccbar(1.5) + +### The setup uses the base configuration of the decayer which is loaded from the file specified by config[0]. +### On top of the base configuration, two more sets of settings are loaded sequentially from config[1] and [2]. + +[DecayerPythia8] +config[0] = ${O2DPG_ROOT}/MC/config/common/pythia8/decayer/base.cfg +config[1] = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/decayer/force_hadronic_D.cfg +config[2] = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/decayer/force_hadronic_D_use4bodies.cfg + +### The setup forces some particles to be decayed by the external decayer instead of Geant. +### The PDG list of the particles is specified below. + +[SimUserDecay] +pdglist = 411 421 431 4112 4122 4232 4132 + +### The setup inhibits transport of primary particles which are produce at forward rapidity. +### The settings below only transports particles in the barrel, which is currently defined as |eta| < 2 + +[Stack] +transportPrimary = barrel diff --git a/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_ccbar.C b/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C similarity index 66% rename from MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_ccbar.C rename to MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C index 6cba98017..cc5db8b39 100644 --- a/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_ccbar.C +++ b/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C @@ -1,18 +1,18 @@ /// \author R+Preghenella - July 2020 /// This Pythia8 UserHooks can veto the processing at parton level. -/// The partonic event is scanned searching for a c-cbar mother +/// The partonic event is scanned searching for a q-qbar mother /// with at least one of the c quarks produced withing a fiducial /// window around midrapidity that can be specified by the user. #include "Pythia8/Pythia.h" -class UserHooks_ccbar : public Pythia8::UserHooks +class UserHooks_qqbar : public Pythia8::UserHooks { public: - UserHooks_ccbar() = default; - ~UserHooks_ccbar() = default; + UserHooks_qqbar() = default; + ~UserHooks_qqbar() = default; bool canVetoPartonLevel() override { return true; }; bool doVetoPartonLevel(const Pythia8::Event& event) override { // search for c-cbar mother with at least one c at midrapidity @@ -20,8 +20,8 @@ class UserHooks_ccbar : public Pythia8::UserHooks auto daughterList = event[ipa].daughterList(); bool hasc = false, hascbar = false, atmidy = false; for (auto ida : daughterList) { - if (event[ida].id() == 4) hasc = true; - if (event[ida].id() == -4) hascbar = true; + if (event[ida].id() == mPDG) hasc = true; + if (event[ida].id() == -mPDG) hascbar = true; if (fabs(event[ida].y()) < mRapidity) atmidy = true; } if (hasc && hascbar && atmidy) @@ -30,10 +30,12 @@ class UserHooks_ccbar : public Pythia8::UserHooks return true; // did not find it, veto event }; + void setPDG(int val) { mPDG = val; }; void setRapidity(double val) { mRapidity = val; }; private: + int mPDG = 4; double mRapidity = 1.5; }; @@ -41,7 +43,18 @@ private: Pythia8::UserHooks* pythia8_userhooks_ccbar(double rapidity = 1.5) { - auto hooks = new UserHooks_ccbar(); + auto hooks = new UserHooks_qqbar(); + hooks->setPDG(4); hooks->setRapidity(rapidity); return hooks; } + +Pythia8::UserHooks* + pythia8_userhooks_bbbar(double rapidity = 1.5) +{ + auto hooks = new UserHooks_qqbar(); + hooks->setPDG(5); + hooks->setRapidity(rapidity); + return hooks; +} +