Skip to content

Commit 92074d3

Browse files
authored
Added and updated ini for Lambda1520 (#2279)
* Update generator function to use exoticAll.json * Add Lambda and anti-Lambda entries to resonance list * Added new generator for Lambda1520 * Added test code * Update PDG codes for Lambda(1520)
1 parent 1499939 commit 92074d3

File tree

4 files changed

+172
-2
lines changed

4 files changed

+172
-2
lines changed
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.C
3+
funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/lambda1520gun_inj.json", true, 1, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "")
4+
5+
[GeneratorPythia8]
6+
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg
7+
8+
[DecayerPythia8]
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/lambda1520.cfg

MC/config/PWGLF/ini/GeneratorLF_Resonances_pp_exoticAll.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[GeneratorExternal]
22
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF_rapidity.C
3-
funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_exotic.json", true, 4, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "")
3+
funcName=generateLFRapidity("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/resonancelistgun_exoticAll.json", true, 4, false, false, "${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg", "")
44

55
[GeneratorPythia8] # if triggered then this will be used as the background event
66
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_136tev.cfg
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
int External()
2+
{
3+
std::string path{"o2sim_Kine.root"};
4+
int numberOfInjectedSignalsPerEvent{1};
5+
int numberOfGapEvents{4};
6+
int numberOfEventsProcessed{0};
7+
int numberOfEventsProcessedWithoutInjection{0};
8+
std::vector<int> injectedPDGs = {
9+
102134, // Lambda(1520)0
10+
-102134, // Lambda(1520)0bar
11+
};
12+
std::vector<std::vector<int>> decayDaughters = {
13+
{2212, -321}, // Lambda(1520)0
14+
{-2212, 321}, // Lambda(1520)0bar
15+
};
16+
17+
auto nInjection = injectedPDGs.size();
18+
19+
TFile file(path.c_str(), "READ");
20+
if (file.IsZombie())
21+
{
22+
std::cerr << "Cannot open ROOT file " << path << "\n";
23+
return 1;
24+
}
25+
26+
auto tree = (TTree *)file.Get("o2sim");
27+
if (!tree)
28+
{
29+
std::cerr << "Cannot find tree o2sim in file " << path << "\n";
30+
return 1;
31+
}
32+
std::vector<o2::MCTrack> *tracks{};
33+
tree->SetBranchAddress("MCTrack", &tracks);
34+
35+
std::vector<int> nSignal;
36+
for (int i = 0; i < nInjection; i++)
37+
{
38+
nSignal.push_back(0);
39+
}
40+
std::vector<std::vector<int>> nDecays;
41+
std::vector<int> nNotDecayed;
42+
for (int i = 0; i < nInjection; i++)
43+
{
44+
std::vector<int> nDecay;
45+
for (int j = 0; j < decayDaughters[i].size(); j++)
46+
{
47+
nDecay.push_back(0);
48+
}
49+
nDecays.push_back(nDecay);
50+
nNotDecayed.push_back(0);
51+
}
52+
auto nEvents = tree->GetEntries();
53+
bool hasInjection = false;
54+
for (int i = 0; i < nEvents; i++)
55+
{
56+
hasInjection = false;
57+
numberOfEventsProcessed++;
58+
auto check = tree->GetEntry(i);
59+
for (int idxMCTrack = 0; idxMCTrack < tracks->size(); ++idxMCTrack)
60+
{
61+
auto track = tracks->at(idxMCTrack);
62+
auto pdg = track.GetPdgCode();
63+
auto it = std::find(injectedPDGs.begin(), injectedPDGs.end(), pdg);
64+
int index = std::distance(injectedPDGs.begin(), it); // index of injected PDG
65+
if (it != injectedPDGs.end()) // found
66+
{
67+
// count signal PDG
68+
nSignal[index]++;
69+
if (track.getFirstDaughterTrackId() < 0)
70+
{
71+
nNotDecayed[index]++;
72+
continue;
73+
}
74+
for (int j{track.getFirstDaughterTrackId()}; j <= track.getLastDaughterTrackId(); ++j)
75+
{
76+
auto pdgDau = tracks->at(j).GetPdgCode();
77+
bool foundDau = false;
78+
// count decay PDGs
79+
for (int idxDaughter = 0; idxDaughter < decayDaughters[index].size(); ++idxDaughter)
80+
{
81+
if (pdgDau == decayDaughters[index][idxDaughter])
82+
{
83+
nDecays[index][idxDaughter]++;
84+
foundDau = true;
85+
hasInjection = true;
86+
break;
87+
}
88+
}
89+
if (!foundDau)
90+
{
91+
std::cerr << "Decay daughter not found: " << pdg << " -> " << pdgDau << "\n";
92+
}
93+
}
94+
}
95+
}
96+
if (!hasInjection)
97+
{
98+
numberOfEventsProcessedWithoutInjection++;
99+
}
100+
}
101+
std::cout << "--------------------------------\n";
102+
std::cout << "# Events: " << nEvents << "\n";
103+
for (int i = 0; i < nInjection; i++)
104+
{
105+
std::cout << "# Mother \n";
106+
std::cout << injectedPDGs[i] << " generated: " << nSignal[i] << ", " << nNotDecayed[i] << " did not decay\n";
107+
if (nSignal[i] == 0)
108+
{
109+
std::cerr << "No generated: " << injectedPDGs[i] << "\n";
110+
// return 1; // At least one of the injected particles should be generated
111+
}
112+
for (int j = 0; j < decayDaughters[i].size(); j++)
113+
{
114+
std::cout << "# Daughter " << decayDaughters[i][j] << ": " << nDecays[i][j] << "\n";
115+
}
116+
// if (nSignal[i] != nEvents * numberOfInjectedSignalsPerEvent)
117+
// {
118+
// std::cerr << "Number of generated: " << injectedPDGs[i] << ", lower than expected\n";
119+
// // return 1; // Don't need to return 1, since the number of generated particles is not the same for each event
120+
// }
121+
}
122+
std::cout << "--------------------------------\n";
123+
std::cout << "Number of events processed: " << numberOfEventsProcessed << "\n";
124+
std::cout << "Number of input for the gap events: " << numberOfGapEvents << "\n";
125+
std::cout << "Number of events processed without injection: " << numberOfEventsProcessedWithoutInjection << "\n";
126+
// injected event + numberOfGapEvents*gap events + injected event + numberOfGapEvents*gap events + ...
127+
// total fraction of the gap event: numberOfEventsProcessedWithoutInjection/numberOfEventsProcessed
128+
float ratioOfNormalEvents = numberOfEventsProcessedWithoutInjection / numberOfEventsProcessed;
129+
if (ratioOfNormalEvents > 0.75)
130+
{
131+
std::cout << "The number of injected event is loo low!!" << std::endl;
132+
return 1;
133+
}
134+
135+
return 0;
136+
}
137+
138+
void GeneratorLF_Resonances_pp1360_injection() { External(); }

MC/config/PWGLF/pythia8/generator/resonancelistgun_exotic.json renamed to MC/config/PWGLF/pythia8/generator/resonancelistgun_exoticAll.json

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,28 @@
120120
"rapidityMax": 1.2,
121121
"genDecayed": true
122122
},
123+
"Lambda(1520)0" : {
124+
"pdg": 102134,
125+
"n": 1,
126+
"ptMin": 0.0,
127+
"ptMax": 20,
128+
"etaMin": -1.2,
129+
"etaMax": 1.2,
130+
"rapidityMin": -1.2,
131+
"rapidityMax": 1.2,
132+
"genDecayed": true
133+
},
134+
"anti-Lambda(1520)0" : {
135+
"pdg": -102134,
136+
"n": 1,
137+
"ptMin": 0.0,
138+
"ptMax": 20,
139+
"etaMin": -1.2,
140+
"etaMax": 1.2,
141+
"rapidityMin": -1.2,
142+
"rapidityMax": 1.2,
143+
"genDecayed": true
144+
},
123145
"Xi(1820)0": {
124146
"pdg": 123314,
125147
"n": 1,
@@ -164,4 +186,4 @@
164186
"rapidityMax": 1.2,
165187
"genDecayed": true
166188
}
167-
}
189+
}

0 commit comments

Comments
 (0)