Skip to content

Commit 633ed67

Browse files
authored
PWGHF: add ini for B-forced MCs for pp collisions (#1693)
* PWGHF: add ini for B-forced MCs for pp collisions * Fix typo * Add onIfMatch commands * Fix typo * Add pdg codes of B hadrons to check in test macro * Rename ini file * Fix test * Fix test
1 parent 1575edb commit 633ed67

File tree

3 files changed

+329
-0
lines changed

3 files changed

+329
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
### The external generator derives from GeneratorPythia8.
2+
[GeneratorExternal]
3+
fileName=${O2DPG_ROOT}/MC/config/PWGHF/external/generator/generator_pythia8_gaptriggered_hf.C
4+
funcName=GeneratorPythia8GapTriggeredBeauty(5, -1.5, 1.5)
5+
6+
[GeneratorPythia8]
7+
config=${O2DPG_ROOT}/MC/config/PWGHF/pythia8/generator/pythia8_beautyhadronic_with_decays_Mode2.cfg
8+
includePartonEvent=true
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
int External() {
2+
std::string path{"o2sim_Kine.root"};
3+
4+
int checkPdgQuark{5};
5+
float ratioTrigger = 1./5; // one event triggered out of 5
6+
7+
std::vector<int> checkPdgHadron{411, 421, 431, 4122, 4132, 4232, 4332, 511, 521, 531, 5122};
8+
std::map<int, std::vector<std::vector<int>>> checkHadronDecays{ // sorted pdg of daughters
9+
{411, {{-321, 211, 211}, {-313, 211}, {211, 311}, {211, 333}}}, // D+
10+
{421, {{-321, 211}, {-321, 111, 211}}}, // D0
11+
{431, {{211, 333}, {-313, 321}}}, // Ds+
12+
{4122, {{-313, 2212}, {-321, 2224}, {211, 102134}, {-321, 211, 2212}, {311, 2212}}}, // Lc+
13+
{4132, {{211, 3312}}}, // Xic0
14+
{4232, {{-313, 2212}, {-321, 3324}, {211, 211, 3312}, {-321, 211, 2212}}}, // Xic+
15+
{4332, {{211, 3334}}}, // Omegac+
16+
{511, {{-411, 211}, {-413, 211}, {-411, 213}, {431, -211}}}, // B0
17+
{521, {{-421, 211}, {-423, 211}, {-421, 213}}}, // B+
18+
{531, {{-431, 211}, {-433, 211}, {-431, 213}}}, // Bs0
19+
{5122, {{4122, -211}, {4122, -213}, {4122, 211, -211, -211}, {4212, -211}}} // Lb0
20+
};
21+
22+
TFile file(path.c_str(), "READ");
23+
if (file.IsZombie()) {
24+
std::cerr << "Cannot open ROOT file " << path << "\n";
25+
return 1;
26+
}
27+
28+
auto tree = (TTree *)file.Get("o2sim");
29+
std::vector<o2::MCTrack> *tracks{};
30+
tree->SetBranchAddress("MCTrack", &tracks);
31+
o2::dataformats::MCEventHeader *eventHeader = nullptr;
32+
tree->SetBranchAddress("MCEventHeader.", &eventHeader);
33+
34+
int nEventsMB{}, nEventsInj{};
35+
int nQuarks{}, nSignals{}, nSignalGoodDecay{};
36+
auto nEvents = tree->GetEntries();
37+
38+
for (int i = 0; i < nEvents; i++) {
39+
tree->GetEntry(i);
40+
41+
// check subgenerator information
42+
if (eventHeader->hasInfo(o2::mcgenid::GeneratorProperty::SUBGENERATORID)) {
43+
bool isValid = false;
44+
int subGeneratorId = eventHeader->getInfo<int>(o2::mcgenid::GeneratorProperty::SUBGENERATORID, isValid);
45+
if (subGeneratorId == 0) {
46+
nEventsMB++;
47+
} else if (subGeneratorId == checkPdgQuark) {
48+
nEventsInj++;
49+
}
50+
}
51+
52+
for (auto &track : *tracks) {
53+
auto pdg = track.GetPdgCode();
54+
if (std::abs(pdg) == checkPdgQuark) {
55+
nQuarks++;
56+
continue;
57+
}
58+
if (std::find(checkPdgHadron.begin(), checkPdgHadron.end(), std::abs(pdg)) != checkPdgHadron.end()) { // found signal
59+
nSignals++; // count signal PDG
60+
61+
std::vector<int> pdgsDecay{};
62+
std::vector<int> pdgsDecayAntiPart{};
63+
for (int j{track.getFirstDaughterTrackId()}; j <= track.getLastDaughterTrackId(); ++j) {
64+
auto pdgDau = tracks->at(j).GetPdgCode();
65+
pdgsDecay.push_back(pdgDau);
66+
if (pdgDau != 333) { // phi is antiparticle of itself
67+
pdgsDecayAntiPart.push_back(-pdgDau);
68+
} else {
69+
pdgsDecayAntiPart.push_back(pdgDau);
70+
}
71+
}
72+
73+
std::sort(pdgsDecay.begin(), pdgsDecay.end());
74+
std::sort(pdgsDecayAntiPart.begin(), pdgsDecayAntiPart.end());
75+
76+
for (auto &decay : checkHadronDecays[std::abs(pdg)]) {
77+
if (pdgsDecay == decay || pdgsDecayAntiPart == decay) {
78+
nSignalGoodDecay++;
79+
break;
80+
}
81+
}
82+
}
83+
}
84+
}
85+
86+
std::cout << "--------------------------------\n";
87+
std::cout << "# Events: " << nEvents << "\n";
88+
std::cout << "# MB events: " << nEventsMB << "\n";
89+
std::cout << Form("# events injected with %d quark pair: ", checkPdgQuark) << nEventsInj << "\n";
90+
std::cout << Form("# %d (anti)quarks: ", checkPdgQuark) << nQuarks << "\n";
91+
std::cout <<"# signal hadrons: " << nSignals << "\n";
92+
std::cout <<"# signal hadrons decaying in the correct channel: " << nSignalGoodDecay << "\n";
93+
94+
if (nEventsMB < nEvents * (1 - ratioTrigger) * 0.95 || nEventsMB > nEvents * (1 - ratioTrigger) * 1.05) { // we put some tolerance since the number of generated events is small
95+
std::cerr << "Number of generated MB events different than expected\n";
96+
return 1;
97+
}
98+
if (nEventsInj < nEvents * ratioTrigger * 0.95 || nEventsInj > nEvents * ratioTrigger * 1.05) {
99+
std::cerr << "Number of generated events injected with " << checkPdgQuark << " different than expected\n";
100+
return 1;
101+
}
102+
103+
if (nQuarks < nEvents * ratioTrigger) { // we expect anyway more because the same quark is repeated several time, after each gluon radiation
104+
std::cerr << "Number of generated (anti)quarks " << checkPdgQuark << " lower than expected\n";
105+
return 1;
106+
}
107+
108+
float fracForcedDecays = float(nSignalGoodDecay) / nSignals;
109+
if (fracForcedDecays < 0.85) { // we put some tolerance (e.g. due to oscillations which might change the final state)
110+
std::cerr << "Fraction of signals decaying into the correct channel " << fracForcedDecays << " lower than expected\n";
111+
return 1;
112+
}
113+
114+
return 0;
115+
}
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
### authors: Fabrizio Grosa (fabrizio.grosa@cern.ch)
2+
### Cristina Terrevoli (cristina.terrevoli@cern.ch)
3+
### Fabio Catalano (fabio.catalano@cern.ch)
4+
### last update: November 2023
5+
6+
### beams
7+
Beams:idA 2212 # proton
8+
Beams:idB 2212 # proton
9+
Beams:eCM 13600. # GeV
10+
11+
### processes
12+
SoftQCD:inelastic on # all inelastic processes
13+
14+
### decays
15+
ParticleDecays:limitTau0 on
16+
ParticleDecays:tau0Max 10.
17+
18+
### switching on Pythia Mode2
19+
ColourReconnection:mode 1
20+
ColourReconnection:allowDoubleJunRem off
21+
ColourReconnection:m0 0.3
22+
ColourReconnection:allowJunctions on
23+
ColourReconnection:junctionCorrection 1.20
24+
ColourReconnection:timeDilationMode 2
25+
ColourReconnection:timeDilationPar 0.18
26+
StringPT:sigma 0.335
27+
StringZ:aLund 0.36
28+
StringZ:bLund 0.56
29+
StringFlav:probQQtoQ 0.078
30+
StringFlav:ProbStoUD 0.2
31+
StringFlav:probQQ1toQQ0join 0.0275,0.0275,0.0275,0.0275
32+
MultiPartonInteractions:pT0Ref 2.15
33+
BeamRemnants:remnantMode 1
34+
BeamRemnants:saturation 5
35+
36+
# Correct decay lengths (wrong in PYTHIA8 decay table)
37+
# Lb
38+
5122:tau0 = 0.4390
39+
# Xic0
40+
4132:tau0 = 0.0455
41+
# OmegaC
42+
4332:tau0 = 0.0803
43+
44+
### Force golden charm hadrons decay modes for D2H studies
45+
### add D+ decays absent in PYTHIA8 decay table and set BRs from PDG for other
46+
411:oneChannel = 1 0.0752 0 -321 211 211
47+
411:addChannel = 1 0.0104 0 -313 211
48+
411:addChannel = 1 0.0156 0 311 211
49+
411:addChannel = 1 0.0752 0 333 211 # to have the same amount of D+->KKpi and D+->Kpipi
50+
## add Lc decays absent in PYTHIA8 decay table and set BRs from PDG for other
51+
4122:oneChannel = 1 0.0196 100 2212 -313
52+
4122:addChannel = 1 0.0108 100 2224 -321
53+
4122:addChannel = 1 0.022 100 102134 211
54+
4122:addChannel = 1 0.035 0 2212 -321 211
55+
4122:addChannel = 1 0.0159 0 2212 311
56+
### add Xic+ decays absent in PYTHIA8 decay table
57+
4232:addChannel = 1 0.2 0 2212 -313
58+
4232:addChannel = 1 0.2 0 2212 -321 211
59+
4232:addChannel = 1 0.2 0 3324 211
60+
4232:addChannel = 1 0.2 0 3312 211 211
61+
### add Xic0 decays absent in PYTHIA8 decay table
62+
4132:addChannel = 1 0.0143 0 3312 211
63+
### add OmegaC decays absent in PYTHIA8 decay table
64+
4332:addChannel = 1 0.5 0 3334 211
65+
4332:addChannel = 1 0.5 0 3312 211
66+
67+
### K* -> K pi
68+
313:onMode = off
69+
313:onIfAll = 321 211
70+
### for Ds -> Phi pi+
71+
333:onMode = off
72+
333:onIfAll = 321 321
73+
### for D0 -> rho0 pi+ k-
74+
113:onMode = off
75+
113:onIfAll = 211 211
76+
### for Lambda_c -> Delta++ K-
77+
2224:onMode = off
78+
2224:onIfAll = 2212 211
79+
### for Lambda_c -> Lambda(1520) K-
80+
102134:onMode = off
81+
102134:onIfAll = 2212 321
82+
### for Xic0 -> pi Xi -> pi pi Lambda -> pi pi pi p
83+
### and Omega_c -> pi Xi -> pi pi Lambda -> pi pi pi p
84+
3312:onMode = off
85+
3312:onIfAll = 3122 -211
86+
3122:onMode = off
87+
3122:onIfAll = 2212 -211
88+
### for Omega_c -> pi Omega -> pi K Lambda -> pi K pi p
89+
3334:onMode = off
90+
3334:onIfAll = 3122 -321
91+
92+
### switch off all decay channels
93+
411:onMode = off
94+
421:onMode = off
95+
431:onMode = off
96+
4112:onMode = off
97+
4122:onMode = off
98+
4232:onMode = off
99+
4132:onMode = off
100+
443:onMode = off
101+
4332:onMode = off
102+
511:onMode = off
103+
521:onMode = off
104+
531:onMode = off
105+
5122:onMode = off
106+
107+
### D0 -> K pi
108+
421:onIfMatch = 321 211
109+
110+
### D+/- -> K pi pi
111+
411:onIfMatch = 321 211 211
112+
### D+/- -> K* pi
113+
411:onIfMatch = 313 211
114+
### D+/- -> phi pi
115+
411:onIfMatch = 333 211
116+
117+
### D_s -> K K*
118+
431:onIfMatch = 321 313
119+
### D_s -> Phi pi
120+
431:onIfMatch = 333 211
121+
122+
### Lambda_c -> p K*
123+
4122:onIfMatch = 2212 313
124+
### Lambda_c -> Delta K
125+
4122:onIfMatch = 2224 321
126+
### Lambda_c -> Lambda(1520) pi
127+
4122:onIfMatch = 102134 211
128+
### Lambda_c -> p K pi
129+
4122:onIfMatch = 2212 321 211
130+
### Lambda_c -> pK0s
131+
4122:onIfMatch = 2212 311
132+
133+
### Xic+ -> pK*0
134+
4232:onIfMatch = 2212 313
135+
### Xic+ -> p K- pi+
136+
4232:onIfMatch = 2212 321 211
137+
### Xic+ -> Xi*0 pi+, Xi*->Xi- pi+
138+
4232:onIfMatch = 3324 211
139+
### Xic+ -> Xi- pi+ pi+
140+
4232:onIfMatch = 3312 211 211
141+
142+
### Xic0 -> Xi- pi+
143+
4132:onIfMatch = 3312 211
144+
145+
### Omega_c -> Omega pi
146+
4332:onIfMatch = 3334 211
147+
### Omega_c -> Xi pi
148+
4332:onIfMatch = 3312 211
149+
150+
### Force also golden beauty hadrons decay modes for D2H studies
151+
### add B0 decays
152+
511:oneChannel = 1 0.4 0 -411 211
153+
511:addChannel = 1 0.3 0 -413 211
154+
511:addChannel = 1 0.2 0 431 -211
155+
### add B+ decays
156+
521:oneChannel = 1 0.8 0 -421 211
157+
### add Bs0 decays
158+
531:oneChannel = 1 0.8 0 -431 211
159+
### add Lb decays
160+
5122:oneChannel = 1 0.8 0 4122 -211
161+
162+
### we also add channels useful for studies of partly reconstructed decays / correlated backgrounds
163+
### add B0 decays
164+
511:addChannel = 1 0.1 0 -411 213
165+
### add B+ decays
166+
521:addChannel = 1 0.1 0 -421 213
167+
521:addChannel = 1 0.1 0 -423 211
168+
### add Bs0 decays
169+
531:addChannel = 1 0.1 0 -431 213
170+
531:addChannel = 1 0.1 0 -433 211
171+
### add Lb decays
172+
5122:addChannel = 1 0.1 0 4122 -213
173+
5122:addChannel = 1 0.05 0 4122 211 -211 -211
174+
5122:addChannel = 1 0.05 0 4212 -211
175+
176+
### B0 -> D pi
177+
511:onIfMatch = 411 211
178+
### B0 -> D* pi
179+
511:onIfMatch = 413 211
180+
### B0 -> Ds pi
181+
511:onIfMatch = 431 211
182+
### B0 -> D rho
183+
511:onIfMatch = 411 213
184+
185+
### B+ -> D0 pi
186+
521:onIfMatch = 421 211
187+
### B+ -> D0 rho
188+
521:onIfMatch = 421 213
189+
### B+ -> D0* pi
190+
521:onIfMatch = 423 211
191+
192+
### Bs -> Ds pi
193+
531:onIfMatch = 431 211
194+
### Bs -> Ds rho
195+
531:onIfMatch = 431 213
196+
### Bs -> Ds* pi
197+
531:onIfMatch = 433 211
198+
199+
### Lb -> Lc pi
200+
5122:onIfMatch = 4122 211
201+
### Lb -> Lc rho
202+
5122:onIfMatch = 4122 213
203+
### Lb -> Lc pi pi pi
204+
5122:onIfMatch = 4122 211 211 211
205+
### Lb -> Sc pi
206+
5122:onIfMatch = 4212 211

0 commit comments

Comments
 (0)