Skip to content

Commit f4ae7b5

Browse files
ffiondagconesab
authored andcommitted
update rapidity range settings (for b\bar{b} simulations in Muon Spectrometer)
1 parent 3a07564 commit f4ae7b5

File tree

6 files changed

+34
-29
lines changed

6 files changed

+34
-29
lines changed

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

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,20 @@ public:
7676
int findAncestor(Pythia8::Event& event) {
7777
for (int ipa = 0; ipa < event.size(); ++ipa) {
7878
auto daughterList = event[ipa].daughterList();
79-
bool hasq = false, hasqbar = false, atmidy = false;
79+
bool hasq = false, hasqbar = false, atSelectedY = false;
8080
for (auto ida : daughterList) {
8181
if (event[ida].id() == mPDG) hasq = true;
8282
if (event[ida].id() == -mPDG) hasqbar = true;
83-
if (fabs(event[ida].y()) < mRapidity) atmidy = true;
83+
if ( (event[ida].y() > mRapidityMin) && (event[ida].y() < mRapidityMax) ) atSelectedY = true;
8484
}
85-
if (hasc && hascbar && atmidy)
85+
if (hasq && hasqbar && atSelectedY)
8686
return ipa;
8787
}
8888
return -1;
8989
};
9090

91-
int setPDG(int val) { mPDG = val; };
92-
void setRapidity(double val) { mRapidity = val; };
91+
void setPDG(int val) { mPDG = val; };
92+
void setRapidity(double valMin, double valMax) { mRapidityMin = valMin; mRapidityMax = valMax; };
9393
void setVerbose(bool val) { mVerbose = val; };
9494
void setFormula(std::string val) { mFormula.Compile(val.c_str()); };
9595

@@ -99,7 +99,8 @@ private:
9999
int mEvents = 1;
100100
Pythia8::Event mOutputEvent;
101101
int mPDG = 4;
102-
double mRapidity = 1.5;
102+
double mRapidityMin = -1.5;
103+
double mRapidityMax = 1.5;
103104
bool mVerbose = false;
104105

105106
};
@@ -109,37 +110,37 @@ private:
109110
/** generator instance and settings **/
110111

111112
FairGenerator*
112-
GeneratorHF(double rapidity = 1.5, bool verbose = false)
113+
GeneratorHF(double rapidityMin = -1.5, double rapidityMax = 1.5, bool verbose = false)
113114
{
114115
auto gen = new o2::eventgen::GeneratorHF();
115-
gen->setRapidity(rapidity);
116+
gen->setRapidity(rapidityMin,rapidityMax);
116117
gen->setVerbose(verbose);
117118
gen->setFormula("max(1.,120.*(x<5.)+80.*(1.-x/20.)*(x>5.)*(x<11.)+240.*(1.-x/13.)*(x>11.))");
118119

119120
return gen;
120121
}
121122

122123
FairGenerator*
123-
GeneratorHF_ccbar(double rapidity = 1.5, bool verbose = false)
124+
GeneratorHF_ccbar(double rapidityMin = -1.5, double rapidityMax = 1.5, bool verbose = false)
124125
{
125126
auto gen = new o2::eventgen::GeneratorHF();
126127
gen->setPDG(4);
127-
gen->setRapidity(rapidity);
128+
gen->setRapidity(rapidityMin,rapidityMax);
128129
gen->setVerbose(verbose);
129130
gen->setFormula("max(1.,120.*(x<5.)+80.*(1.-x/20.)*(x>5.)*(x<11.)+240.*(1.-x/13.)*(x>11.))");
130131

131132
return gen;
132133
}
133134

134135
FairGenerator*
135-
GeneratorHF_bbbar(double rapidity = 1.5, bool verbose = false)
136+
GeneratorHF_bbbar(double rapidityMin = -1.5, double rapidityMax = 1.5, bool verbose = false)
136137
{
137138
auto gen = new o2::eventgen::GeneratorHF();
138139
gen->setPDG(5);
139-
gen->setRapidity(rapidity);
140+
gen->setRapidity(rapidityMin,rapidityMax);
140141
gen->setVerbose(verbose);
141142
gen->setFormula("max(1.,120.*(x<5.)+80.*(1.-x/20.)*(x>5.)*(x<11.)+240.*(1.-x/13.)*(x>11.))");
142-
143+
143144
return gen;
144145
}
145146

MC/config/PWGHF/ini/GeneratorHF.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ funcName = GeneratorHF()
99
### This part configures the bits of the interface: configuration and user hooks
1010

1111
[GeneratorPythia8]
12-
config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8.cfg
12+
config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8_hf.cfg
1313
hooksFileName = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C
14-
hooksFuncName = pythia8_userhooks_ccbar(1.5)
14+
hooksFuncName = pythia8_userhooks_ccbar(-1.5,1.5)
1515

1616
### The setup uses the base configuration of the decayer which is loaded from the file specified by config[0].
1717
### On top of the base configuration, two more sets of settings are loaded sequentially from config[1] and [2].

MC/config/PWGHF/ini/GeneratorHF_bbbar.ini

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
[GeneratorExternal]
55
fileName = ${O2DPG_ROOT}/MC/config/PWGHF/external/generator/GeneratorHF.C
6-
funcName = GeneratorHF_bbar()
6+
funcName = GeneratorHF_bbbar()
77

88
### The external generator derives from GeneratorPythia8.
99
### This part configures the bits of the interface: configuration and user hooks
1010

1111
[GeneratorPythia8]
12-
config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8.cfg
12+
config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8_hf.cfg
1313
hooksFileName = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C
14-
hooksFuncName = pythia8_userhooks_bbbar(1.5)
14+
hooksFuncName = pythia8_userhooks_bbbar(-1.5,1.5)
1515

1616
### The setup uses the base configuration of the decayer which is loaded from the file specified by config[0].
1717
### On top of the base configuration, two more sets of settings are loaded sequentially from config[1] and [2].

MC/config/PWGHF/ini/GeneratorHF_ccbar.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ funcName = GeneratorHF_ccbar()
99
### This part configures the bits of the interface: configuration and user hooks
1010

1111
[GeneratorPythia8]
12-
config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8.cfg
12+
config = ${O2DPG_ROOT}/MC/config/common/pythia8/generator/pythia8_hf.cfg
1313
hooksFileName = ${O2DPG_ROOT}/MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C
14-
hooksFuncName = pythia8_userhooks_ccbar(1.5)
14+
hooksFuncName = pythia8_userhooks_ccbar(-1.5,1.5)
1515

1616
### The setup uses the base configuration of the decayer which is loaded from the file specified by config[0].
1717
### On top of the base configuration, two more sets of settings are loaded sequentially from config[1] and [2].

MC/config/PWGHF/pythia8/hooks/pythia8_userhooks_qqbar.C

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,44 @@ class UserHooks_qqbar : public Pythia8::UserHooks
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();
21-
bool hasc = false, hascbar = false, atmidy = false;
21+
bool hasc = false, hascbar = false, atSelectedY = false;
2222
for (auto ida : daughterList) {
2323
if (event[ida].id() == mPDG) hasc = true;
2424
if (event[ida].id() == -mPDG) hascbar = true;
25-
if (fabs(event[ida].y()) < mRapidity) atmidy = true;
25+
if ( (event[ida].y() > mRapidityMin) && (event[ida].y() < mRapidityMax) ) atSelectedY = true;
2626
}
27-
if (hasc && hascbar && atmidy)
27+
if (hasc && hascbar && atSelectedY)
2828
return false; // found it, do not veto event
2929
}
3030
return true; // did not find it, veto event
3131
};
3232

3333
void setPDG(int val) { mPDG = val; };
34-
void setRapidity(double val) { mRapidity = val; };
34+
void setRapidity(double valMin, double valMax) { mRapidityMin = valMin; mRapidityMax = valMax; };
3535

3636
private:
3737

3838
int mPDG = 4;
39-
double mRapidity = 1.5;
39+
double mRapidityMin = -1.5;
40+
double mRapidityMax = 1.5;
4041

4142
};
4243

4344
Pythia8::UserHooks*
44-
pythia8_userhooks_ccbar(double rapidity = 1.5)
45+
pythia8_userhooks_ccbar(double rapidityMin = -1.5, double rapidityMax=1.5)
4546
{
4647
auto hooks = new UserHooks_qqbar();
4748
hooks->setPDG(4);
48-
hooks->setRapidity(rapidity);
49+
hooks->setRapidity(rapidityMin,rapidityMax);
4950
return hooks;
5051
}
5152

5253
Pythia8::UserHooks*
53-
pythia8_userhooks_bbbar(double rapidity = 1.5)
54+
pythia8_userhooks_bbbar(double rapidityMin = -1.5, double rapidityMax = 1.5)
5455
{
5556
auto hooks = new UserHooks_qqbar();
5657
hooks->setPDG(5);
57-
hooks->setRapidity(rapidity);
58+
hooks->setRapidity(rapidityMin,rapidityMax);
5859
return hooks;
5960
}
6061

MC/config/common/pythia8/decayer/base.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ Init:showChangedParticleData off
3232
4232:mayDecay off # Xi_c+
3333
4332:mayDecay off # Omega_c0
3434
5122:mayDecay off # Lambda_b0
35+
5132:mayDecay off # Xi_b-
36+
5232:mayDecay off # Xi_b0
37+
5332:mayDecay off # Omega_b-

0 commit comments

Comments
 (0)