Skip to content

Commit bcd2f4c

Browse files
preghenellagconesab
authored andcommitted
Extend HF ccbar embedding becnhmark to bbbar as well
1 parent dcabe31 commit bcd2f4c

File tree

5 files changed

+117
-11
lines changed

5 files changed

+117
-11
lines changed

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

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ public:
7676
int findAncestor(Pythia8::Event& event) {
7777
for (int ipa = 0; ipa < event.size(); ++ipa) {
7878
auto daughterList = event[ipa].daughterList();
79-
bool hasc = false, hascbar = false, atmidy = false;
79+
bool hasq = false, hasqbar = false, atmidy = false;
8080
for (auto ida : daughterList) {
81-
if (event[ida].id() == 4) hasc = true;
82-
if (event[ida].id() == -4) hascbar = true;
81+
if (event[ida].id() == mPDG) hasq = true;
82+
if (event[ida].id() == -mPDG) hasqbar = true;
8383
if (fabs(event[ida].y()) < mRapidity) atmidy = true;
8484
}
8585
if (hasc && hascbar && atmidy)
@@ -88,6 +88,7 @@ public:
8888
return -1;
8989
};
9090

91+
int setPDG(int val) { mPDG = val; };
9192
void setRapidity(double val) { mRapidity = val; };
9293
void setVerbose(bool val) { mVerbose = val; };
9394
void setFormula(std::string val) { mFormula.Compile(val.c_str()); };
@@ -97,6 +98,7 @@ private:
9798
TFormula mFormula;
9899
int mEvents = 1;
99100
Pythia8::Event mOutputEvent;
101+
int mPDG = 4;
100102
double mRapidity = 1.5;
101103
bool mVerbose = false;
102104

@@ -117,4 +119,27 @@ GeneratorHF(double rapidity = 1.5, bool verbose = false)
117119
return gen;
118120
}
119121

122+
FairGenerator*
123+
GeneratorHF_ccbar(double rapidity = 1.5, bool verbose = false)
124+
{
125+
auto gen = new o2::eventgen::GeneratorHF();
126+
gen->setPDG(4);
127+
gen->setRapidity(rapidity);
128+
gen->setVerbose(verbose);
129+
gen->setFormula("max(1.,120.*(x<5.)+80.*(1.-x/20.)*(x>5.)*(x<11.)+240.*(1.-x/13.)*(x>11.))");
130+
131+
return gen;
132+
}
133+
134+
FairGenerator*
135+
GeneratorHF_bbbar(double rapidity = 1.5, bool verbose = false)
136+
{
137+
auto gen = new o2::eventgen::GeneratorHF();
138+
gen->setPDG(5);
139+
gen->setRapidity(rapidity);
140+
gen->setVerbose(verbose);
141+
gen->setFormula("max(1.,120.*(x<5.)+80.*(1.-x/20.)*(x>5.)*(x<11.)+240.*(1.-x/13.)*(x>11.))");
142+
143+
return gen;
144+
}
120145

MC/config/PWGHF/ini/GeneratorHF.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ funcName = GeneratorHF()
1010

1111
[GeneratorPythia8]
1212
config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8.cfg
13-
hooksFileName = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_ccbar.C
13+
hooksFileName = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C
1414
hooksFuncName = pythia8_userhooks_ccbar(1.5)
1515

1616
### The setup uses the base configuration of the decayer which is loaded from the file specified by config[0].
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
### The setup uses an external event generator
2+
### This part sets the path of the file and the function call to retrieve it
3+
4+
[GeneratorExternal]
5+
fileName = ${O2DPG_ROOT}/MC/config/PWGHF/external/generator/GeneratorHF.C
6+
funcName = GeneratorHF_bbar()
7+
8+
### The external generator derives from GeneratorPythia8.
9+
### This part configures the bits of the interface: configuration and user hooks
10+
11+
[GeneratorPythia8]
12+
config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8.cfg
13+
hooksFileName = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C
14+
hooksFuncName = pythia8_userhooks_bbbar(1.5)
15+
16+
### The setup uses the base configuration of the decayer which is loaded from the file specified by config[0].
17+
### On top of the base configuration, two more sets of settings are loaded sequentially from config[1] and [2].
18+
19+
[DecayerPythia8]
20+
config[0] = ${O2DPG_ROOT}/MC/config/common/pythia8/decayer/base.cfg
21+
config[1] = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/decayer/force_hadronic_D.cfg
22+
config[2] = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/decayer/force_hadronic_D_use4bodies.cfg
23+
24+
### The setup forces some particles to be decayed by the external decayer instead of Geant.
25+
### The PDG list of the particles is specified below.
26+
27+
[SimUserDecay]
28+
pdglist = 411 421 431 4112 4122 4232 4132
29+
30+
### The setup inhibits transport of primary particles which are produce at forward rapidity.
31+
### The settings below only transports particles in the barrel, which is currently defined as |eta| < 2
32+
33+
[Stack]
34+
transportPrimary = barrel
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
### The setup uses an external event generator
2+
### This part sets the path of the file and the function call to retrieve it
3+
4+
[GeneratorExternal]
5+
fileName = ${O2DPG_ROOT}/MC/config/PWGHF/external/generator/GeneratorHF.C
6+
funcName = GeneratorHF_ccbar()
7+
8+
### The external generator derives from GeneratorPythia8.
9+
### This part configures the bits of the interface: configuration and user hooks
10+
11+
[GeneratorPythia8]
12+
config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8.cfg
13+
hooksFileName = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C
14+
hooksFuncName = pythia8_userhooks_ccbar(1.5)
15+
16+
### The setup uses the base configuration of the decayer which is loaded from the file specified by config[0].
17+
### On top of the base configuration, two more sets of settings are loaded sequentially from config[1] and [2].
18+
19+
[DecayerPythia8]
20+
config[0] = ${O2DPG_ROOT}/MC/config/common/pythia8/decayer/base.cfg
21+
config[1] = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/decayer/force_hadronic_D.cfg
22+
config[2] = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/decayer/force_hadronic_D_use4bodies.cfg
23+
24+
### The setup forces some particles to be decayed by the external decayer instead of Geant.
25+
### The PDG list of the particles is specified below.
26+
27+
[SimUserDecay]
28+
pdglist = 411 421 431 4112 4122 4232 4132
29+
30+
### The setup inhibits transport of primary particles which are produce at forward rapidity.
31+
### The settings below only transports particles in the barrel, which is currently defined as |eta| < 2
32+
33+
[Stack]
34+
transportPrimary = barrel

MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_ccbar.C renamed to MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
/// \author R+Preghenella - July 2020
22

33
/// This Pythia8 UserHooks can veto the processing at parton level.
4-
/// The partonic event is scanned searching for a c-cbar mother
4+
/// The partonic event is scanned searching for a q-qbar mother
55
/// with at least one of the c quarks produced withing a fiducial
66
/// window around midrapidity that can be specified by the user.
77

88
#include "Pythia8/Pythia.h"
99

10-
class UserHooks_ccbar : public Pythia8::UserHooks
10+
class UserHooks_qqbar : public Pythia8::UserHooks
1111
{
1212

1313
public:
14-
UserHooks_ccbar() = default;
15-
~UserHooks_ccbar() = default;
14+
UserHooks_qqbar() = default;
15+
~UserHooks_qqbar() = default;
1616
bool canVetoPartonLevel() override { return true; };
1717
bool doVetoPartonLevel(const Pythia8::Event& event) override {
1818
// search for c-cbar mother with at least one c at midrapidity
1919
for (int ipa = 0; ipa < event.size(); ++ipa) {
2020
auto daughterList = event[ipa].daughterList();
2121
bool hasc = false, hascbar = false, atmidy = false;
2222
for (auto ida : daughterList) {
23-
if (event[ida].id() == 4) hasc = true;
24-
if (event[ida].id() == -4) hascbar = true;
23+
if (event[ida].id() == mPDG) hasc = true;
24+
if (event[ida].id() == -mPDG) hascbar = true;
2525
if (fabs(event[ida].y()) < mRapidity) atmidy = true;
2626
}
2727
if (hasc && hascbar && atmidy)
@@ -30,18 +30,31 @@ class UserHooks_ccbar : public Pythia8::UserHooks
3030
return true; // did not find it, veto event
3131
};
3232

33+
void setPDG(int val) { mPDG = val; };
3334
void setRapidity(double val) { mRapidity = val; };
3435

3536
private:
3637

38+
int mPDG = 4;
3739
double mRapidity = 1.5;
3840

3941
};
4042

4143
Pythia8::UserHooks*
4244
pythia8_userhooks_ccbar(double rapidity = 1.5)
4345
{
44-
auto hooks = new UserHooks_ccbar();
46+
auto hooks = new UserHooks_qqbar();
47+
hooks->setPDG(4);
4548
hooks->setRapidity(rapidity);
4649
return hooks;
4750
}
51+
52+
Pythia8::UserHooks*
53+
pythia8_userhooks_bbbar(double rapidity = 1.5)
54+
{
55+
auto hooks = new UserHooks_qqbar();
56+
hooks->setPDG(5);
57+
hooks->setRapidity(rapidity);
58+
return hooks;
59+
}
60+

0 commit comments

Comments
 (0)