Skip to content

Commit 075a360

Browse files
authored
[PWGHF] Add the .ini file for pp reference without charm baryon pdg list (#2034)
* recover the pr * add .c test marco for pp reference and update the corresponding marcos for PbPb and pp * recover the path variable and update the comments of checkHadronDecays * update the format * correct the configuraton file for pp ref on Xic0 and OmegaC * correct the test files for pp, ppref and PbPb * correct the method of `addChannel`
1 parent df30b72 commit 075a360

7 files changed

+344
-22
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_MC_CONFIG_ROOT}/MC/config/PWGHF/external/generator/generator_pythia8_gaptriggered_hf.C
4+
funcName=GeneratorPythia8GapTriggeredCharmAndBeauty(5, -1.5, 1.5)
5+
6+
[GeneratorPythia8]
7+
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGHF/pythia8/generator/pythia8_charmhadronic_with_decays_Mode2_pp_ref.cfg
8+
includePartonEvent=true

MC/config/PWGHF/ini/tests/GeneratorHF_D2H_ccbar_and_bbbar_PbPb.C

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,74 @@ int External() {
88

99
std::vector<int> checkPdgHadron{411, 421, 431, 4122, 4132, 4232, 4332};
1010
std::map<int, std::vector<std::vector<int>>> checkHadronDecays{ // sorted pdg of daughters
11-
{411, {{-321, 211, 211}, {-313, 211}, {211, 311}, {211, 333}}}, // D+
12-
{421, {{-321, 211}, {-321, 111, 211}}}, // D0
13-
{431, {{211, 333}, {-313, 321}}}, // Ds+
14-
{4122, {{-313, 2212}, {-321, 2224}, {211, 102134}, {-321, 211, 2212}, {311, 2212}}}, // Lc+
15-
{4132, {{211, 3312}}}, // Xic0
16-
{4232, {{-313, 2212}, {-321, 3324}, {211, 211, 3312}, {-321, 211, 2212}}}, // Xic+
17-
{4332, {{211, 3334}}} // Omegac+
11+
{421, {
12+
{-321, 211}, // D0 -> K-, pi+
13+
{-321, 211, 111}, // D0 -> K-, pi+, pi0
14+
{213, -321}, // D0 -> rho(770)+, K-
15+
{-313, 111}, // D0 -> Kbar^*(892)0, pi0
16+
{-323, 211}, // D0 -> K^*(892)-, pi+
17+
{-211, 211}, // D0 -> pi-, pi+
18+
{213, -211}, // D0 -> rho(770)+, pi-
19+
{-211, 211, 111}, // D0 -> pi-, pi+, pi0
20+
{-321, 321}, // D0 -> K-, K+
21+
}},
22+
23+
{411, {
24+
{-321, 211, 211}, // D+ -> K-, pi+, pi+
25+
{-10311, 211}, // D+ -> Kbar0^*(1430)0, pi+
26+
{-313, 211}, // D+ -> Kbar^*(892)0, pi+
27+
{-321, 211, 211, 111}, // D+ -> K-, pi+, pi+, pi0
28+
{333, 211}, // D+ -> phi(1020)0, pi+
29+
{-313, 321}, // D+ -> Kbar^*(892)0, K+
30+
{-10311, 321}, // D+ -> Kbar0^*(1430)0, K+
31+
{-321, 321, 211}, // D+ -> K-, K+, pi+
32+
{113, 211}, // D+ -> rho(770)0, pi+
33+
{225, 211}, // D+ -> f2(1270)0, pi+
34+
{-211, 211, 211}, // D+ -> pi-, pi+, pi+
35+
}},
36+
37+
{431, {
38+
{333, 211}, // Ds+ -> phi(1020)0, pi+
39+
{-313, 321}, // Ds+ -> Kbar^*(892)0, K+
40+
{333, 213}, // Ds+ -> phi(1020)0, rho(770)+
41+
{113, 211}, // Ds+ -> rho(770)0, pi+
42+
{225, 211}, // Ds+ -> f2(1270)0, pi+
43+
{-211, 211, 211}, // Ds+ -> pi-, pi+, pi+
44+
{313, 211}, // Ds+ -> K^*(892)0, pi+
45+
{10221, 321}, // Ds+ -> f0(1370)0, K+
46+
{113, 321}, // Ds+ -> rho(770)0, K+
47+
{-211, 321, 211}, // Ds+ -> pi-, K+, pi+
48+
{221, 211}, // Ds+ -> eta, pi+
49+
}},
50+
51+
{4122, {
52+
{2212, -321, 211}, // Lambdac+ -> p, K-, pi+
53+
{2212, -313}, // Lambdac+ -> p, Kbar^*(892)0
54+
{2224, -321}, // Lambdac+ -> Delta(1232)++, K-
55+
{102134, 211}, // Lambdac+ -> 102134, pi+
56+
{2212, 311}, // Lambdac+ -> p, K0
57+
{2212, -321, 211, 111}, // Lambdac+ -> p, K-, pi+, pi0
58+
{2212, -211, 211}, // Lambdac+ -> p, pi-, pi+
59+
{2212, 333}, // Lambdac+ -> p, phi(1020)0
60+
}},
61+
62+
{4232, {
63+
{2212, -321, 211}, // Xic+ -> p, K-, pi+
64+
{2212, -313}, // Xic+ -> p, Kbar^*(892)0
65+
{3312, 211, 211}, // Xic+ -> Xi-, pi+, pi+
66+
{2212, 333}, // Xic+ -> p, phi(1020)0
67+
{3222, -211, 211}, // Xic+ -> Sigma+, pi-, pi+
68+
{3324, 211}, // Xic+ -> Xi(1530)0, pi+
69+
}},
70+
71+
{4132, {
72+
{3312, 211}, // Xic0 -> Xi-, pi+
73+
}},
74+
75+
{4332, {
76+
{3334, 211}, // Omegac0 -> Omega-, pi+
77+
{3312, 211}, // Omegac0 -> Xi-, pi+
78+
}},
1879
};
1980

2081
TFile file(path.c_str(), "READ");
@@ -67,7 +128,7 @@ int External() {
67128
for (int j{track.getFirstDaughterTrackId()}; j <= track.getLastDaughterTrackId(); ++j) {
68129
auto pdgDau = tracks->at(j).GetPdgCode();
69130
pdgsDecay.push_back(pdgDau);
70-
if (pdgDau != 333) { // phi is antiparticle of itself
131+
if (pdgDau != 333 && pdgDau != 111 && pdgDau != 221 && pdgDau != 113 && pdgDau != 225) { // phi is antiparticle of itself
71132
pdgsDecayAntiPart.push_back(-pdgDau);
72133
} else {
73134
pdgsDecayAntiPart.push_back(pdgDau);
@@ -78,6 +139,7 @@ int External() {
78139
std::sort(pdgsDecayAntiPart.begin(), pdgsDecayAntiPart.end());
79140

80141
for (auto &decay : checkHadronDecays[std::abs(pdg)]) {
142+
std::sort(decay.begin(), decay.end());
81143
if (pdgsDecay == decay || pdgsDecayAntiPart == decay) {
82144
nSignalGoodDecay++;
83145
break;

MC/config/PWGHF/ini/tests/GeneratorHF_D2H_ccbar_and_bbbar_gap5_Mode2.C

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,74 @@ int External() {
77

88
std::vector<int> checkPdgHadron{411, 421, 431, 4122, 4132, 4232, 4332};
99
std::map<int, std::vector<std::vector<int>>> checkHadronDecays{ // sorted pdg of daughters
10-
{411, {{-321, 211, 211}, {-313, 211}, {211, 311}, {211, 333}}}, // D+
11-
{421, {{-321, 211}, {-321, 111, 211}}}, // D0
12-
{431, {{211, 333}, {-313, 321}}}, // Ds+
13-
{4122, {{-313, 2212}, {-321, 2224}, {211, 102134}, {-321, 211, 2212}, {311, 2212}}}, // Lc+
14-
{4132, {{211, 3312}}}, // Xic0
15-
{4232, {{-313, 2212}, {-321, 3324}, {211, 211, 3312}, {-321, 211, 2212}}}, // Xic+
16-
{4332, {{211, 3334}}} // Omegac+
10+
{421, {
11+
{-321, 211}, // D0 -> K-, pi+
12+
{-321, 211, 111}, // D0 -> K-, pi+, pi0
13+
{213, -321}, // D0 -> rho(770)+, K-
14+
{-313, 111}, // D0 -> Kbar^*(892)0, pi0
15+
{-323, 211}, // D0 -> K^*(892)-, pi+
16+
{-211, 211}, // D0 -> pi-, pi+
17+
{213, -211}, // D0 -> rho(770)+, pi-
18+
{-211, 211, 111}, // D0 -> pi-, pi+, pi0
19+
{-321, 321}, // D0 -> K-, K+
20+
}},
21+
22+
{411, {
23+
{-321, 211, 211}, // D+ -> K-, pi+, pi+
24+
{-10311, 211}, // D+ -> Kbar0^*(1430)0, pi+
25+
{-313, 211}, // D+ -> Kbar^*(892)0, pi+
26+
{-321, 211, 211, 111}, // D+ -> K-, pi+, pi+, pi0
27+
{333, 211}, // D+ -> phi(1020)0, pi+
28+
{-313, 321}, // D+ -> Kbar^*(892)0, K+
29+
{-10311, 321}, // D+ -> Kbar0^*(1430)0, K+
30+
{-321, 321, 211}, // D+ -> K-, K+, pi+
31+
{113, 211}, // D+ -> rho(770)0, pi+
32+
{225, 211}, // D+ -> f2(1270)0, pi+
33+
{-211, 211, 211}, // D+ -> pi-, pi+, pi+
34+
}},
35+
36+
{431, {
37+
{333, 211}, // Ds+ -> phi(1020)0, pi+
38+
{-313, 321}, // Ds+ -> Kbar^*(892)0, K+
39+
{333, 213}, // Ds+ -> phi(1020)0, rho(770)+
40+
{113, 211}, // Ds+ -> rho(770)0, pi+
41+
{225, 211}, // Ds+ -> f2(1270)0, pi+
42+
{-211, 211, 211}, // Ds+ -> pi-, pi+, pi+
43+
{313, 211}, // Ds+ -> K^*(892)0, pi+
44+
{10221, 321}, // Ds+ -> f0(1370)0, K+
45+
{113, 321}, // Ds+ -> rho(770)0, K+
46+
{-211, 321, 211}, // Ds+ -> pi-, K+, pi+
47+
{221, 211}, // Ds+ -> eta, pi+
48+
}},
49+
50+
{4122, {
51+
{2212, -321, 211}, // Lambdac+ -> p, K-, pi+
52+
{2212, -313}, // Lambdac+ -> p, Kbar^*(892)0
53+
{2224, -321}, // Lambdac+ -> Delta(1232)++, K-
54+
{102134, 211}, // Lambdac+ -> 102134, pi+
55+
{2212, 311}, // Lambdac+ -> p, K0
56+
{2212, -321, 211, 111}, // Lambdac+ -> p, K-, pi+, pi0
57+
{2212, -211, 211}, // Lambdac+ -> p, pi-, pi+
58+
{2212, 333}, // Lambdac+ -> p, phi(1020)0
59+
}},
60+
61+
{4232, {
62+
{2212, -321, 211}, // Xic+ -> p, K-, pi+
63+
{2212, -313}, // Xic+ -> p, Kbar^*(892)0
64+
{3312, 211, 211}, // Xic+ -> Xi-, pi+, pi+
65+
{2212, 333}, // Xic+ -> p, phi(1020)0
66+
{3222, -211, 211}, // Xic+ -> Sigma+, pi-, pi+
67+
{3324, 211}, // Xic+ -> Xi(1530)0, pi+
68+
}},
69+
70+
{4132, {
71+
{3312, 211}, // Xic0 -> Xi-, pi+
72+
}},
73+
74+
{4332, {
75+
{3334, 211}, // Omegac0 -> Omega-, pi+
76+
{3312, 211}, // Omegac0 -> Xi-, pi+
77+
}},
1778
};
1879

1980
TFile file(path.c_str(), "READ");
@@ -66,7 +127,7 @@ int External() {
66127
for (int j{track.getFirstDaughterTrackId()}; j <= track.getLastDaughterTrackId(); ++j) {
67128
auto pdgDau = tracks->at(j).GetPdgCode();
68129
pdgsDecay.push_back(pdgDau);
69-
if (pdgDau != 333) { // phi is antiparticle of itself
130+
if (pdgDau != 333 && pdgDau != 111 && pdgDau != 221 && pdgDau != 113 && pdgDau != 225) { // phi is antiparticle of itself
70131
pdgsDecayAntiPart.push_back(-pdgDau);
71132
} else {
72133
pdgsDecayAntiPart.push_back(pdgDau);
@@ -77,6 +138,7 @@ int External() {
77138
std::sort(pdgsDecayAntiPart.begin(), pdgsDecayAntiPart.end());
78139

79140
for (auto &decay : checkHadronDecays[std::abs(pdg)]) {
141+
std::sort(decay.begin(), decay.end());
80142
if (pdgsDecay == decay || pdgsDecayAntiPart == decay) {
81143
nSignalGoodDecay++;
82144
break;
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
int External() {
2+
std::string path{"o2sim_Kine.root"};
3+
4+
int checkPdgQuarkOne{4};
5+
int checkPdgQuarkTwo{5};
6+
float ratioTrigger = 1./5; // one event triggered out of 5
7+
8+
std::vector<int> checkPdgHadron{411, 421, 431, 4122, 4132, 4232, 4332};
9+
std::map<int, std::vector<std::vector<int>>> checkHadronDecays{ // sorted pdg of daughters
10+
{421, {
11+
{-321, 211}, // D0 -> K-, pi+
12+
{-321, 211, 111}, // D0 -> K-, pi+, pi0
13+
{213, -321}, // D0 -> rho(770)+, K-
14+
{-313, 111}, // D0 -> Kbar^*(892)0, pi0
15+
{-323, 211}, // D0 -> K^*(892)-, pi+
16+
{-211, 211}, // D0 -> pi-, pi+
17+
{213, -211}, // D0 -> rho(770)+, pi-
18+
{-211, 211, 111}, // D0 -> pi-, pi+, pi0
19+
{-321, 321}, // D0 -> K-, K+
20+
}},
21+
22+
{411, {
23+
{-321, 211, 211}, // D+ -> K-, pi+, pi+
24+
{-10311, 211}, // D+ -> Kbar0^*(1430)0, pi+
25+
{-313, 211}, // D+ -> Kbar^*(892)0, pi+
26+
{-321, 211, 211, 111}, // D+ -> K-, pi+, pi+, pi0
27+
{333, 211}, // D+ -> phi(1020)0, pi+
28+
{-313, 321}, // D+ -> Kbar^*(892)0, K+
29+
{-10311, 321}, // D+ -> Kbar0^*(1430)0, K+
30+
{-321, 321, 211}, // D+ -> K-, K+, pi+
31+
{113, 211}, // D+ -> rho(770)0, pi+
32+
{225, 211}, // D+ -> f2(1270)0, pi+
33+
{-211, 211, 211}, // D+ -> pi-, pi+, pi+
34+
}},
35+
36+
{431, {
37+
{211, 333}, // Ds+ -> phi(1020)0, pi+
38+
{-313, 321}, // Ds+ -> Kbar^*(892)0, K+
39+
{333, 213}, // Ds+ -> phi(1020)0, rho(770)+
40+
{113, 211}, // Ds+ -> rho(770)0, pi+
41+
{225, 211}, // Ds+ -> f2(1270)0, pi+
42+
{-211, 211, 211}, // Ds+ -> pi-, pi+, pi+
43+
{313, 211}, // Ds+ -> K^*(892)0, pi+
44+
{10221, 321}, // Ds+ -> f0(1370)0, K+
45+
{113, 321}, // Ds+ -> rho(770)0, K+
46+
{-211, 321, 211}, // Ds+ -> pi-, K+, pi+
47+
{221, 211}, // Ds+ -> eta, pi+
48+
}},
49+
50+
{4122, {
51+
{2212, -321, 211}, // Lambdac+ -> p, K-, pi+
52+
{2212, -313}, // Lambdac+ -> p, Kbar^*(892)0
53+
{2224, -321}, // Lambdac+ -> Delta(1232)++, K-
54+
{102134, 211}, // Lambdac+ -> 102134, pi+
55+
{2212, 311}, // Lambdac+ -> p, K0
56+
{2212, -321, 211, 111}, // Lambdac+ -> p, K-, pi+, pi0
57+
{2212, -211, 211}, // Lambdac+ -> p, pi-, pi+
58+
{2212, 333}, // Lambdac+ -> p, phi(1020)0
59+
}},
60+
61+
{4232, {
62+
{2212, -321, 211}, // Xic+ -> p, K-, pi+
63+
{2212, -313}, // Xic+ -> p, Kbar^*(892)0
64+
{3312, 211, 211}, // Xic+ -> Xi-, pi+, pi+
65+
{2212, 333}, // Xic+ -> p, phi(1020)0
66+
{3222, -211, 211}, // Xic+ -> Sigma+, pi-, pi+
67+
{3324, 211}, // Xic+ -> Xi(1530)0, pi+
68+
}},
69+
70+
{4132, {
71+
{3312, 211}, // Xic0 -> Xi-, pi+
72+
}},
73+
74+
{4332, {
75+
{3334, 211}, // Omegac0 -> Omega-, pi+
76+
{3312, 211}, // Omegac0 -> Xi-, pi+
77+
}},
78+
};
79+
80+
TFile file(path.c_str(), "READ");
81+
if (file.IsZombie()) {
82+
std::cerr << "Cannot open ROOT file " << path << "\n";
83+
return 1;
84+
}
85+
86+
auto tree = (TTree *)file.Get("o2sim");
87+
std::vector<o2::MCTrack> *tracks{};
88+
tree->SetBranchAddress("MCTrack", &tracks);
89+
o2::dataformats::MCEventHeader *eventHeader = nullptr;
90+
tree->SetBranchAddress("MCEventHeader.", &eventHeader);
91+
92+
int nEventsMB{}, nEventsInjOne{}, nEventsInjTwo{};
93+
int nQuarksOne{}, nQuarksTwo{}, nSignals{}, nSignalGoodDecay{};
94+
auto nEvents = tree->GetEntries();
95+
96+
for (int i = 0; i < nEvents; i++) {
97+
tree->GetEntry(i);
98+
99+
// check subgenerator information
100+
if (eventHeader->hasInfo(o2::mcgenid::GeneratorProperty::SUBGENERATORID)) {
101+
bool isValid = false;
102+
int subGeneratorId = eventHeader->getInfo<int>(o2::mcgenid::GeneratorProperty::SUBGENERATORID, isValid);
103+
if (subGeneratorId == 0) {
104+
nEventsMB++;
105+
} else if (subGeneratorId == checkPdgQuarkOne) {
106+
nEventsInjOne++;
107+
} else if (subGeneratorId == checkPdgQuarkTwo) {
108+
nEventsInjTwo++;
109+
}
110+
}
111+
112+
for (auto &track : *tracks) {
113+
auto pdg = track.GetPdgCode();
114+
if (std::abs(pdg) == checkPdgQuarkOne) {
115+
nQuarksOne++;
116+
continue;
117+
}
118+
if (std::abs(pdg) == checkPdgQuarkTwo) {
119+
nQuarksTwo++;
120+
continue;
121+
}
122+
if (std::find(checkPdgHadron.begin(), checkPdgHadron.end(), std::abs(pdg)) != checkPdgHadron.end()) { // found signal
123+
nSignals++; // count signal PDG
124+
125+
std::vector<int> pdgsDecay{};
126+
std::vector<int> pdgsDecayAntiPart{};
127+
for (int j{track.getFirstDaughterTrackId()}; j <= track.getLastDaughterTrackId(); ++j) {
128+
auto pdgDau = tracks->at(j).GetPdgCode();
129+
pdgsDecay.push_back(pdgDau);
130+
if (pdgDau != 333 && pdgDau != 111 && pdgDau != 221 && pdgDau != 113 && pdgDau != 225) { // phi is antiparticle of itself
131+
pdgsDecayAntiPart.push_back(-pdgDau);
132+
} else {
133+
pdgsDecayAntiPart.push_back(pdgDau);
134+
}
135+
}
136+
137+
std::sort(pdgsDecay.begin(), pdgsDecay.end());
138+
std::sort(pdgsDecayAntiPart.begin(), pdgsDecayAntiPart.end());
139+
140+
for (auto &decay : checkHadronDecays[std::abs(pdg)]) {
141+
std::sort(decay.begin(), decay.end());
142+
if (pdgsDecay == decay || pdgsDecayAntiPart == decay) {
143+
nSignalGoodDecay++;
144+
break;
145+
}
146+
}
147+
}
148+
}
149+
}
150+
151+
std::cout << "--------------------------------\n";
152+
std::cout << "# Events: " << nEvents << "\n";
153+
std::cout << "# MB events: " << nEventsMB << "\n";
154+
std::cout << Form("# events injected with %d quark pair: ", checkPdgQuarkOne) << nEventsInjOne << "\n";
155+
std::cout << Form("# events injected with %d quark pair: ", checkPdgQuarkTwo) << nEventsInjTwo << "\n";
156+
std::cout << Form("# %d (anti)quarks: ", checkPdgQuarkOne) << nQuarksOne << "\n";
157+
std::cout << Form("# %d (anti)quarks: ", checkPdgQuarkTwo) << nQuarksTwo << "\n";
158+
std::cout <<"# signal hadrons: " << nSignals << "\n";
159+
std::cout <<"# signal hadrons decaying in the correct channel: " << nSignalGoodDecay << "\n";
160+
161+
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
162+
std::cerr << "Number of generated MB events different than expected\n";
163+
return 1;
164+
}
165+
if (nEventsInjOne < nEvents * ratioTrigger * 0.5 * 0.95 || nEventsInjOne > nEvents * ratioTrigger * 0.5 * 1.05) {
166+
std::cerr << "Number of generated events injected with " << checkPdgQuarkOne << " different than expected\n";
167+
return 1;
168+
}
169+
if (nEventsInjTwo < nEvents * ratioTrigger * 0.5 * 0.95 || nEventsInjTwo > nEvents * ratioTrigger * 0.5 * 1.05) {
170+
std::cerr << "Number of generated events injected with " << checkPdgQuarkTwo << " different than expected\n";
171+
return 1;
172+
}
173+
174+
if (nQuarksOne < nEvents * ratioTrigger) { // we expect anyway more because the same quark is repeated several time, after each gluon radiation
175+
std::cerr << "Number of generated (anti)quarks " << checkPdgQuarkOne << " lower than expected\n";
176+
return 1;
177+
}
178+
if (nQuarksTwo < nEvents * ratioTrigger) { // we expect anyway more because the same quark is repeated several time, after each gluon radiation
179+
std::cerr << "Number of generated (anti)quarks " << checkPdgQuarkTwo << " lower than expected\n";
180+
return 1;
181+
}
182+
183+
float fracForcedDecays = float(nSignalGoodDecay) / nSignals;
184+
if (fracForcedDecays < 0.9) { // we put some tolerance (e.g. due to oscillations which might change the final state)
185+
std::cerr << "Fraction of signals decaying into the correct channel " << fracForcedDecays << " lower than expected\n";
186+
return 1;
187+
}
188+
189+
return 0;
190+
}

0 commit comments

Comments
 (0)