Skip to content

Commit d6d8aec

Browse files
committed
Revise injection targets due to resource limitaion and add QA codes
1 parent 20c90bc commit d6d8aec

3 files changed

Lines changed: 130 additions & 130 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[GeneratorExternal]
2+
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity_width.C
3+
funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_width_inj.json", true, 5, false, true, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "")
4+
5+
[GeneratorPythia8] # if triggered then this will be used as the background event
6+
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg
7+
8+
[DecayerPythia8] # after for transport code!
9+
config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg
10+
config[1]=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonances_width.cfg
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
2+
int External()
3+
{
4+
const std::string path{"o2sim_Kine.root"};
5+
const int numberOfGapEvents{4}; // generateLFRapidity(..., gap=5)
6+
const std::vector<int> injectedPDGs = {
7+
9010221, // f0(980)
8+
3324, -3324, // Xi(1530)0 and anti-Xi(1530)0
9+
123324, -123324, // Xi(1820)0 and anti-Xi(1820)0
10+
123314, -123314, // Xi(1820)- and Xi(1820)+
11+
123334, -123334 // Omega(2012)- and Omega(2012)+
12+
};
13+
const std::vector<std::vector<int>> decayDaughters = {
14+
{211, -211},
15+
{3312, 211}, {-3312, -211},
16+
{3122, 310}, {-3122, 310},
17+
{3122, -321}, {-3122, 321},
18+
{3312, 310}, {-3312, 310}
19+
};
20+
21+
TFile file(path.c_str(), "READ");
22+
if (file.IsZombie()) {
23+
std::cerr << "Cannot open ROOT file " << path << "\n";
24+
return 1;
25+
}
26+
auto tree = (TTree*)file.Get("o2sim");
27+
if (!tree) {
28+
std::cerr << "Cannot find tree o2sim in file " << path << "\n";
29+
return 1;
30+
}
31+
std::vector<o2::MCTrack>* tracks{};
32+
tree->SetBranchAddress("MCTrack", &tracks);
33+
34+
std::vector<int> nSignal(injectedPDGs.size(), 0);
35+
std::vector<int> nNotDecayed(injectedPDGs.size(), 0);
36+
std::vector<std::vector<int>> nDecays;
37+
for (const auto& daughters : decayDaughters) {
38+
nDecays.emplace_back(daughters.size(), 0);
39+
}
40+
41+
int numberOfEventsProcessed{0};
42+
int numberOfEventsProcessedWithoutInjection{0};
43+
for (Long64_t i = 0; i < tree->GetEntries(); ++i) {
44+
tree->GetEntry(i);
45+
++numberOfEventsProcessed;
46+
bool hasInjection{false};
47+
for (const auto& track : *tracks) {
48+
const auto pdg = track.GetPdgCode();
49+
const auto it = std::find(injectedPDGs.begin(), injectedPDGs.end(), pdg);
50+
if (it == injectedPDGs.end()) {
51+
continue;
52+
}
53+
const auto index = static_cast<size_t>(std::distance(injectedPDGs.begin(), it));
54+
++nSignal[index];
55+
if (track.getFirstDaughterTrackId() < 0) {
56+
++nNotDecayed[index];
57+
continue;
58+
}
59+
for (int j = track.getFirstDaughterTrackId(); j <= track.getLastDaughterTrackId(); ++j) {
60+
const auto pdgDau = tracks->at(j).GetPdgCode();
61+
bool foundDau{false};
62+
for (size_t k = 0; k < decayDaughters[index].size(); ++k) {
63+
if (pdgDau == decayDaughters[index][k]) {
64+
++nDecays[index][k];
65+
foundDau = true;
66+
hasInjection = true;
67+
break;
68+
}
69+
}
70+
if (!foundDau) {
71+
std::cerr << "Decay daughter not found: " << pdg << " -> " << pdgDau
72+
<< " (mother=" << track.getMotherTrackId()
73+
<< ", secondMother=" << track.getSecondMotherTrackId() << ")\n";
74+
}
75+
}
76+
}
77+
if (!hasInjection) {
78+
++numberOfEventsProcessedWithoutInjection;
79+
}
80+
}
81+
82+
std::cout << "--------------------------------\n";
83+
std::cout << "# Events: " << tree->GetEntries() << "\n";
84+
for (size_t i = 0; i < injectedPDGs.size(); ++i) {
85+
std::cout << "# Mother\n";
86+
std::cout << injectedPDGs[i] << " generated: " << nSignal[i]
87+
<< ", " << nNotDecayed[i] << " did not decay\n";
88+
for (size_t j = 0; j < decayDaughters[i].size(); ++j) {
89+
std::cout << "# Daughter " << decayDaughters[i][j] << ": " << nDecays[i][j] << "\n";
90+
}
91+
}
92+
std::cout << "--------------------------------\n";
93+
std::cout << "Number of events processed: " << numberOfEventsProcessed << "\n";
94+
std::cout << "Number of input for the gap events: " << numberOfGapEvents << "\n";
95+
std::cout << "Number of events processed without injection: "
96+
<< numberOfEventsProcessedWithoutInjection << "\n";
97+
const double ratioOfNormalEvents = numberOfEventsProcessed
98+
? static_cast<double>(numberOfEventsProcessedWithoutInjection) /
99+
numberOfEventsProcessed
100+
: 0.0;
101+
std::cout << "Fraction without injection: " << ratioOfNormalEvents << "\n";
102+
const double expectedRatio = static_cast<double>(numberOfGapEvents) / (numberOfGapEvents + 1);
103+
std::cout << "Expected fraction for 1+" << numberOfGapEvents << " pattern: " << expectedRatio << "\n";
104+
105+
// Same basic gap sanity check as the referenced O2DPG test.
106+
if (ratioOfNormalEvents > 0.90 || ratioOfNormalEvents < 0.70) {
107+
std::cerr << "The number of injected events is too low or too high\n";
108+
return 1;
109+
}
110+
return 0;
111+
}

MC/config/PWGLF/pythia8/generator/resonancelistgun_width_inj.json

Lines changed: 9 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,128 +1,7 @@
11
{
22
"f_0(980)" : {
33
"pdg": 9010221,
4-
"n": 10,
5-
"ptMin": 0.0,
6-
"ptMax": 20,
7-
"etaMin": -1.2,
8-
"etaMax": 1.2,
9-
"rapidityMin": -1.2,
10-
"rapidityMax": 1.2,
11-
"genDecayed": true
12-
},
13-
"phi(1020)" : {
14-
"pdg": 333,
15-
"n": 10,
16-
"ptMin": 0.0,
17-
"ptMax": 20,
18-
"etaMin": -1.2,
19-
"etaMax": 1.2,
20-
"rapidityMin": -1.2,
21-
"rapidityMax": 1.2,
22-
"genDecayed": true
23-
},
24-
"K1(1270)+": {
25-
"pdg": 10323,
26-
"n": 10,
27-
"ptMin": 0.0,
28-
"ptMax": 20,
29-
"etaMin": -1.2,
30-
"etaMax": 1.2,
31-
"rapidityMin": -1.2,
32-
"rapidityMax": 1.2,
33-
"genDecayed": true
34-
},
35-
"K1(1270)-": {
36-
"pdg": -10323,
37-
"n": 10,
38-
"ptMin": 0.0,
39-
"ptMax": 20,
40-
"etaMin": -1.2,
41-
"etaMax": 1.2,
42-
"rapidityMin": -1.2,
43-
"rapidityMax": 1.2,
44-
"genDecayed": true
45-
},
46-
"K1(1270)0": {
47-
"pdg": 10313,
48-
"n": 10,
49-
"ptMin": 0.0,
50-
"ptMax": 20,
51-
"etaMin": -1.2,
52-
"etaMax": 1.2,
53-
"rapidityMin": -1.2,
54-
"rapidityMax": 1.2,
55-
"genDecayed": true
56-
},
57-
"anti-K1(1270)0": {
58-
"pdg": -10313,
59-
"n": 10,
60-
"ptMin": 0.0,
61-
"ptMax": 20,
62-
"etaMin": -1.2,
63-
"etaMax": 1.2,
64-
"rapidityMin": -1.2,
65-
"rapidityMax": 1.2,
66-
"genDecayed": true
67-
},
68-
"Sigma(1385)-" : {
69-
"pdg": 3114,
70-
"n": 10,
71-
"ptMin": 0.0,
72-
"ptMax": 20,
73-
"etaMin": -1.2,
74-
"etaMax": 1.2,
75-
"rapidityMin": -1.2,
76-
"rapidityMax": 1.2,
77-
"genDecayed": true
78-
},
79-
"anti-Sigma(1385)+" : {
80-
"pdg": -3114,
81-
"n": 10,
82-
"ptMin": 0.0,
83-
"ptMax": 20,
84-
"etaMin": -1.2,
85-
"etaMax": 1.2,
86-
"rapidityMin": -1.2,
87-
"rapidityMax": 1.2,
88-
"genDecayed": true
89-
},
90-
"Sigma(1385)+" : {
91-
"pdg": 3224,
92-
"n": 10,
93-
"ptMin": 0.0,
94-
"ptMax": 20,
95-
"etaMin": -1.2,
96-
"etaMax": 1.2,
97-
"rapidityMin": -1.2,
98-
"rapidityMax": 1.2,
99-
"genDecayed": true
100-
},
101-
"anti-Sigma(1385)-" : {
102-
"pdg": -3224,
103-
"n": 10,
104-
"ptMin": 0.0,
105-
"ptMax": 20,
106-
"etaMin": -1.2,
107-
"etaMax": 1.2,
108-
"rapidityMin": -1.2,
109-
"rapidityMax": 1.2,
110-
"genDecayed": true
111-
},
112-
"Lambda(1520)0" : {
113-
"pdg": 102134,
114-
"n": 10,
115-
"ptMin": 0.0,
116-
"ptMax": 20,
117-
"etaMin": -1.2,
118-
"etaMax": 1.2,
119-
"rapidityMin": -1.2,
120-
"rapidityMax": 1.2,
121-
"genDecayed": true
122-
},
123-
"anti-Lambda(1520)0" : {
124-
"pdg": -102134,
125-
"n": 10,
4+
"n": 1,
1265
"ptMin": 0.0,
1276
"ptMax": 20,
1287
"etaMin": -1.2,
@@ -133,7 +12,7 @@
13312
},
13413
"Xi(1530)0" : {
13514
"pdg": 3324,
136-
"n": 10,
15+
"n": 1,
13716
"ptMin": 0.0,
13817
"ptMax": 20,
13918
"etaMin": -1.2,
@@ -144,7 +23,7 @@
14423
},
14524
"anti-Xi(1530)0" : {
14625
"pdg": -3324,
147-
"n": 10,
26+
"n": 1,
14827
"ptMin": 0.0,
14928
"ptMax": 20,
15029
"etaMin": -1.2,
@@ -155,7 +34,7 @@
15534
},
15635
"Xi(1820)0" : {
15736
"pdg": 123324,
158-
"n": 10,
37+
"n": 1,
15938
"ptMin": 0.0,
16039
"ptMax": 20,
16140
"etaMin": -1.2,
@@ -166,7 +45,7 @@
16645
},
16746
"Anti-Xi(1820)0" : {
16847
"pdg": -123324,
169-
"n": 10,
48+
"n": 1,
17049
"ptMin": 0.0,
17150
"ptMax": 20,
17251
"etaMin": -1.2,
@@ -177,7 +56,7 @@
17756
},
17857
"Xi(1820)-" : {
17958
"pdg": 123314,
180-
"n": 10,
59+
"n": 1,
18160
"ptMin": 0.0,
18261
"ptMax": 20,
18362
"etaMin": -1.2,
@@ -188,7 +67,7 @@
18867
},
18968
"Xi(1820)+" : {
19069
"pdg": -123314,
191-
"n": 10,
70+
"n": 1,
19271
"ptMin": 0.0,
19372
"ptMax": 20,
19473
"etaMin": -1.2,
@@ -199,7 +78,7 @@
19978
},
20079
"Omega(2012)-" : {
20180
"pdg": 123334,
202-
"n": 10,
81+
"n": 1,
20382
"ptMin": 0.0,
20483
"ptMax": 20,
20584
"etaMin": -1.2,
@@ -210,7 +89,7 @@
21089
},
21190
"Omega(2012)+" : {
21291
"pdg": -123334,
213-
"n": 10,
92+
"n": 1,
21493
"ptMin": 0.0,
21594
"ptMax": 20,
21695
"etaMin": -1.2,

0 commit comments

Comments
 (0)