Skip to content

Commit

Permalink
Define mNumSigEvs depending on the collision impact parameter.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattia Faggin committed Jun 13, 2024
1 parent 41818a2 commit 85d064c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
37 changes: 27 additions & 10 deletions MC/config/PWGHF/external/generator/generator_pythia8_embed_hf.C
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ public:
GeneratorPythia8EmbedHF() = default;

/// constructor
GeneratorPythia8EmbedHF(int numSigEvs = 1) {
mNumSigEvs = numSigEvs;
//mGeneratedEvents = 0;
}
//GeneratorPythia8EmbedHF(int numSigEvs = 1) {
// mNumSigEvs = numSigEvs;
// //mGeneratedEvents = 0;
//}

/// Destructor
~GeneratorPythia8EmbedHF() = default;
Expand Down Expand Up @@ -67,6 +67,23 @@ public:
mGeneratorEvHF->Init();
}

// This function is called by the primary generator
// for each event in case we are in embedding mode.
// We use it to setup the number of signal events
// to be generated and to be embedded on the background.
void notifyEmbedding(const o2::dataformats::MCEventHeader* bkgHeader) override
{
LOG(info) << "[notifyEmbedding] ----- Function called";

/// Impact parameter between the two nuclei
const float x = bkgHeader->GetB();
LOG(info) << "[notifyEmbedding] ----- Collision impact parameter: " << x;

/// number of events to be embedded in a background event
mNumSigEvs = std::max(1.,120.*(x<5.)+80.*(1.-x/20.)*(x>5.)*(x<11.)+240.*(1.-x/13.)*(x>11.));
LOG(info) << "[notifyEmbedding] ----- generating " << mNumSigEvs << " signal events " << std::endl;
};

protected:

Bool_t importParticles() override
Expand Down Expand Up @@ -118,9 +135,9 @@ private:
};

// Charm enriched
FairGenerator * GeneratorPythia8EmbedHFCharm(int numSigEvs = 1, float yQuarkMin = -1.5, float yQuarkMax = 1.5, float yHadronMin = -1.5, float yHadronMax = 1.5, std::vector<int> hadronPdgList = {})
FairGenerator * GeneratorPythia8EmbedHFCharm(float yQuarkMin = -1.5, float yQuarkMax = 1.5, float yHadronMin = -1.5, float yHadronMax = 1.5, std::vector<int> hadronPdgList = {})
{
auto myGen = new GeneratorPythia8EmbedHF(numSigEvs);
auto myGen = new GeneratorPythia8EmbedHF();

/// setup the internal generator for HF events
myGen->setupGeneratorEvHF(hf_generators::GapTriggeredCharm, yQuarkMin, yQuarkMax, yHadronMin, yHadronMax, hadronPdgList);
Expand All @@ -129,9 +146,9 @@ FairGenerator * GeneratorPythia8EmbedHFCharm(int numSigEvs = 1, float yQuarkMin
}

// Beauty enriched
FairGenerator * GeneratorPythia8EmbedHFBeauty(int numSigEvs = 1, float yQuarkMin = -1.5, float yQuarkMax = 1.5, float yHadronMin = -1.5, float yHadronMax = 1.5, std::vector<int> hadronPdgList = {})
FairGenerator * GeneratorPythia8EmbedHFBeauty(float yQuarkMin = -1.5, float yQuarkMax = 1.5, float yHadronMin = -1.5, float yHadronMax = 1.5, std::vector<int> hadronPdgList = {})
{
auto myGen = new GeneratorPythia8EmbedHF(numSigEvs);
auto myGen = new GeneratorPythia8EmbedHF();

/// setup the internal generator for HF events
myGen->setupGeneratorEvHF(hf_generators::GapTriggeredBeauty, yQuarkMin, yQuarkMax, yHadronMin, yHadronMax, hadronPdgList);
Expand All @@ -140,9 +157,9 @@ FairGenerator * GeneratorPythia8EmbedHFBeauty(int numSigEvs = 1, float yQuarkMin
}

// Charm and beauty enriched (with same ratio)
FairGenerator * GeneratorPythia8EmbedHFCharmAndBeauty(int numSigEvs = 1, float yQuarkMin = -1.5, float yQuarkMax = 1.5, float yHadronMin = -1.5, float yHadronMax = 1.5, std::vector<int> hadronPdgList = {})
FairGenerator * GeneratorPythia8EmbedHFCharmAndBeauty(float yQuarkMin = -1.5, float yQuarkMax = 1.5, float yHadronMin = -1.5, float yHadronMax = 1.5, std::vector<int> hadronPdgList = {})
{
auto myGen = new GeneratorPythia8EmbedHF(numSigEvs);
auto myGen = new GeneratorPythia8EmbedHF();

/// setup the internal generator for HF events
myGen->setupGeneratorEvHF(hf_generators::GapTriggeredCharmAndBeauty, yQuarkMin, yQuarkMax, yHadronMin, yHadronMax, hadronPdgList);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### The external generator derives from GeneratorPythia8.
[GeneratorExternal]
fileName=${O2DPG_ROOT}/MC/config/PWGHF/external/generator/generator_pythia8_embed_hf.C
funcName=GeneratorPythia8EmbedHFCharmAndBeauty(10)
funcName=GeneratorPythia8EmbedHFCharmAndBeauty()

[GeneratorPythia8]
config=${O2DPG_ROOT}/MC/config/PWGHF/pythia8/generator/pythia8_charmhadronic_with_decays_Mode2_hardQCD_5TeV.cfg
Expand Down

0 comments on commit 85d064c

Please sign in to comment.