Skip to content

Commit 5f0a79c

Browse files
committed
tunable ccbar and bbbar
1 parent 5da6f99 commit 5f0a79c

3 files changed

Lines changed: 71 additions & 2 deletions

File tree

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

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ namespace hf_generators
1818
GapTriggeredBeauty, // --> GeneratorPythia8GapTriggeredBeauty: beauty enriched
1919
GapTriggeredCharmAndBeauty, // --> GeneratorPythia8GapTriggeredCharmAndBeauty: charm and beauty enriched (with same ratio)
2020
GapHF, // --> GeneratorPythia8GapHF
21+
GapHFRatio, // --> GeneratorPythia8GapHF, quark list built from b/c ratio
2122
NGenType
2223
};
2324
}
@@ -83,6 +84,12 @@ public:
8384
LOG(info) << "********** Default number of HF signal events to be merged (updated by notifyEmbedding): " << mNumSigEvs;
8485
mGeneratorEvHF = dynamic_cast<GeneratorPythia8GapTriggeredHF*>(GeneratorPythia8GapTriggeredBeauty(/*no gap trigger*/1, yQuarkMin, yQuarkMax, yHadronMin, yHadronMax, hadronPdgList, partPdgToReplaceList, freqReplaceList));
8586
break;
87+
88+
case hf_generators::GapHFRatio:
89+
LOG(info) << "********** [GeneratorPythia8EmbedHF] configuring GapHFRatio (custom b/c ratio) **********";
90+
LOG(info) << "********** Default number of HF signal events to be merged (updated by notifyEmbedding): " << mNumSigEvs;
91+
mGeneratorEvHF = dynamic_cast<GeneratorPythia8GapTriggeredHF*>(GeneratorPythia8GapHF(/*no gap trigger*/1, yQuarkMin, yQuarkMax, yHadronMin, yHadronMax, quarkPdgList, hadronPdgList, partPdgToReplaceList, freqReplaceList));
92+
break;
8693
default:
8794
LOG(fatal) << "********** [GeneratorPythia8EmbedHF] bad configuration, fix it! **********";
8895
break;
@@ -387,6 +394,44 @@ private:
387394

388395
};
389396

397+
// Helper: build quarkPdgList from bOverCRatio (= N(beauty)/N(charm), default 1 = 1:1)
398+
// Integer b/c: taken directly; fractional b/c: reduced to nearest nB:nC with nC+nB <= 20
399+
static std::vector<int> BuildQuarkListFromBOverC(float bOverCRatio)
400+
{
401+
if (bOverCRatio <= 0.f) {
402+
LOG(fatal) << "bOverCRatio (b/c) must be > 0";
403+
}
404+
if (bOverCRatio > 19.f) {
405+
bOverCRatio = 19.f;
406+
LOG(warn) << "bOverCRatio (b/c) too large, using 19:1";
407+
}else if (bOverCRatio < 1.f/19.f) {
408+
bOverCRatio = 1.f/19.f;
409+
LOG(warn) << "bOverCRatio (b/c) too small, using 1:19";
410+
}
411+
412+
int nC = 1, nB = 1;
413+
float bestErr = 1e9f;
414+
for (int c = 1; c <= 19; ++c) {
415+
int b = (int)std::lround(bOverCRatio * c);
416+
if (b < 1 || c + b > 20) {
417+
continue;
418+
}
419+
float err = std::fabs((float)b / c - bOverCRatio);
420+
if (err < bestErr) {
421+
bestErr = err;
422+
nC = c;
423+
nB = b;
424+
}
425+
}
426+
427+
std::vector<int> list;
428+
// Bresenham interleaving
429+
int len = nC + nB;
430+
for (int k = 0; k < len; ++k)
431+
list.push_back((((k + 1) * nC) / len > (k * nC) / len) ? 4 : 5);
432+
return list;
433+
}
434+
390435
// Charm enriched
391436
FairGenerator * GeneratorPythia8EmbedHFCharm(bool usePtHardBins = false, float yQuarkMin = -1.5, float yQuarkMax = 1.5, float yHadronMin = -1.5, float yHadronMax = 1.5, std::vector<int> quarkPdgList = {}, std::vector<int> hadronPdgList = {}, std::vector<std::array<int,2>> partPdgToReplaceList = {}, std::vector<float> freqReplaceList = {})
392437
{
@@ -420,3 +465,18 @@ FairGenerator * GeneratorPythia8EmbedHFCharmAndBeauty(bool usePtHardBins = false
420465
return myGen;
421466
}
422467

468+
// Charm and beauty enriched with tunable b/c ratio
469+
FairGenerator * GeneratorPythia8EmbedHFRatio(float bOverCRatio = 1.f, bool usePtHardBins = false, float yQuarkMin = -1.5, float yQuarkMax = 1.5, float yHadronMin = -1.5, float yHadronMax = 1.5, std::vector<int> hadronPdgList = {}, std::vector<std::array<int,2>> partPdgToReplaceList = {}, std::vector<float> freqReplaceList = {})
470+
{
471+
auto myGen = new GeneratorPythia8EmbedHF();
472+
473+
/// build the quark list from the b/c ratio
474+
auto quarkPdgList = BuildQuarkListFromBOverC(bOverCRatio);
475+
476+
/// setup the internal generator for HF events
477+
myGen->setupGeneratorEvHF(hf_generators::GapHFRatio,
478+
usePtHardBins, yQuarkMin, yQuarkMax, yHadronMin, yHadronMax,
479+
quarkPdgList, hadronPdgList, partPdgToReplaceList, freqReplaceList);
480+
481+
return myGen;
482+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#NEV_TEST> 10
2+
### The external generator derives from GeneratorPythia8.
3+
[GeneratorExternal]
4+
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGHF/external/generator/generator_pythia8_embed_hf.C
5+
funcName=GeneratorPythia8EmbedHFRatio(3.0)
6+
7+
[GeneratorPythia8]
8+
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGHF/pythia8/generator/pythia8_charmhadronic_with_decays_Mode2_hardQCD_5TeV.cfg
9+
includePartonEvent=true

MC/config/PWGHF/pythia8/generator/pythia8_charmhadronic_with_decays_Mode2_hardQCD_5TeV.cfg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ BeamRemnants:saturation 5
107107
4122:addChannel = 1 0.04500 100 2224 -321 ### Λc+ -> Delta++ K- 1.08%
108108
4122:addChannel = 1 0.09000 100 102134 211 ### Λc+ -> Lambda(1520) K- 2.20e-3
109109
### Λc+ -> p K0S (36%)
110-
4122:addChannel = 1 0.36000 0 2212 311 ### Λc+ -> p K0S 1.59%
110+
4122:addChannel = 1 0.36000 0 2212 310 ### Λc+ -> p K0S 1.59%
111111
### Λc+ -> p K- π+ π0 (small, 3%)
112112
4122:addChannel = 1 0.03000 0 2212 -321 211 111 ### Λc+ -> p K- π+ π0 (non-resonant) 4.6%
113113
### Λc+ -> p π- π+ (12.50%)
@@ -256,7 +256,7 @@ BeamRemnants:saturation 5
256256
431:onIfMatch = 221 211
257257

258258
### Λc -> pK0s
259-
4122:onIfMatch = 2212 311
259+
4122:onIfMatch = 2212 310
260260
### Λc -> p K- π+ π0
261261
4122:onIfMatch = 2212 321 211
262262
### Λc -> p K*

0 commit comments

Comments
 (0)