|
9 | 9 |
|
10 | 10 | R__ADD_INCLUDE_PATH($O2DPG_MC_CONFIG_ROOT) |
11 | 11 | #include "MC/config/common/external/generator/CoalescencePythia8.h" |
| 12 | +#include "MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C" |
12 | 13 |
|
13 | 14 | using namespace Pythia8; |
14 | 15 |
|
@@ -60,6 +61,16 @@ class GeneratorPythia8HFHadToNuclei : public o2::eventgen::GeneratorPythia8 |
60 | 61 | { |
61 | 62 | addSubGenerator(0, "Minimum bias"); |
62 | 63 | addSubGenerator(1, "HF + Coalescence"); |
| 64 | + |
| 65 | + // Bias parton-level generation towards bbbar production at midrapidity, but only |
| 66 | + // while generating the triggered events. Without this, finding the requested b-hadron |
| 67 | + // can stall the jobs for a very long time |
| 68 | + mBbbarBiasHook = new UserHooks_qqbar(); |
| 69 | + mBbbarBiasHook->setPDG(5); |
| 70 | + mBbbarBiasHook->setRapidity(mHadRapidityMin, mHadRapidityMax); |
| 71 | + mBbbarBiasHook->setActive(false); |
| 72 | + setUserHooks(mBbbarBiasHook); |
| 73 | + |
63 | 74 | return o2::eventgen::GeneratorPythia8::Init(); |
64 | 75 | } |
65 | 76 |
|
@@ -93,11 +104,13 @@ class GeneratorPythia8HFHadToNuclei : public o2::eventgen::GeneratorPythia8 |
93 | 104 |
|
94 | 105 | // Generate event of interest |
95 | 106 | bool genOk = false; |
| 107 | + mBbbarBiasHook->setActive(true); |
96 | 108 | while (!genOk) { |
97 | 109 | if (GeneratorPythia8::generateEvent()) { |
98 | 110 | genOk = selectEvent(mPythia.event); |
99 | 111 | } |
100 | 112 | } |
| 113 | + mBbbarBiasHook->setActive(false); |
101 | 114 | notifySubGenerator(1); |
102 | 115 | } else { |
103 | 116 | // Generate minimum-bias event |
@@ -178,6 +191,9 @@ class GeneratorPythia8HFHadToNuclei : public o2::eventgen::GeneratorPythia8 |
178 | 191 | float mHadRapidityMax; |
179 | 192 | unsigned int mUsedSeed; |
180 | 193 |
|
| 194 | + // Bias towards bbbar at midrapidity, active only while generating HF-triggered events |
| 195 | + UserHooks_qqbar* mBbbarBiasHook{nullptr}; |
| 196 | + |
181 | 197 | // Control gap-triggering |
182 | 198 | unsigned long long mGeneratedEvents; |
183 | 199 | int mInverseTriggerRatio; |
|
0 commit comments