Skip to content

Commit b448e9d

Browse files
authored
Add generator for V0s in jets with injection (#2459)
1 parent 2a8aa17 commit b448e9d

3 files changed

Lines changed: 76 additions & 0 deletions

File tree

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### V0s in jets - pp collisions at 5.36 TeV
2+
3+
[GeneratorExternal]
4+
# Generate jet-biased Pythia8 events and require the presence of one V0 particle
5+
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_LF.C
6+
funcName=generateLFTriggered("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/v0particlelist.gun", 2)
7+
8+
[GeneratorPythia8]
9+
# Underlying pp event: HardQCD production with jet-pT bias and rope hadronization
10+
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_jet_ropes_536tev.cfg
11+
includePartonEvent=false
12+
13+
[DecayerPythia8]
14+
# Standard Pythia8 decay configuration
15+
config[0]=${O2DPG_MC_CONFIG_ROOT}/MC/config/common/pythia8/decayer/base.cfg
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
int External()
2+
{
3+
std::string path{"o2sim_Kine.root"};
4+
int numberOfInjectedSignalsPerEvent{1};
5+
std::vector<int> injectedPDGs = {
6+
310, // K0S
7+
3122, // Lambda
8+
-3122 // Anti-Lambda
9+
};
10+
auto nInjection = injectedPDGs.size();
11+
12+
TFile file(path.c_str(), "READ");
13+
if (file.IsZombie()) {
14+
std::cerr << "Cannot open ROOT file " << path << "\n";
15+
return 1;
16+
}
17+
18+
auto tree = (TTree*)file.Get("o2sim");
19+
if (!tree) {
20+
std::cerr << "Cannot find tree o2sim in file " << path << "\n";
21+
return 1;
22+
}
23+
std::vector<o2::MCTrack>* tracks{};
24+
tree->SetBranchAddress("MCTrack", &tracks);
25+
26+
std::vector<int> nSignal;
27+
for (int i = 0; i < nInjection; i++) {
28+
nSignal.push_back(0);
29+
}
30+
31+
auto nEvents = tree->GetEntries();
32+
for (int i = 0; i < nEvents; i++) {
33+
auto check = tree->GetEntry(i);
34+
for (int idxMCTrack = 0; idxMCTrack < tracks->size(); ++idxMCTrack) {
35+
auto track = tracks->at(idxMCTrack);
36+
auto pdg = track.GetPdgCode();
37+
auto it = std::find(injectedPDGs.begin(), injectedPDGs.end(), pdg);
38+
int index = std::distance(injectedPDGs.begin(), it); // index of injected PDG
39+
if (it != injectedPDGs.end()) // found
40+
{
41+
// count signal PDG
42+
nSignal[index]++;
43+
}
44+
}
45+
}
46+
std::cout << "--------------------------------\n";
47+
std::cout << "# Events: " << nEvents << "\n";
48+
for (int i = 0; i < nInjection; i++) {
49+
std::cout << "# Injected nuclei \n";
50+
std::cout << injectedPDGs[i] << ": " << nSignal[i] << "\n";
51+
if (nSignal[i] == 0) {
52+
std::cerr << "No generated: " << injectedPDGs[i] << "\n";
53+
return 1; // At least one of the injected particles should be generated
54+
}
55+
}
56+
return 0;
57+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# PDG N ptMin ptMax etaMin etaMax genDecayed
2+
310 1 0.2 10 -1.2 1.2
3+
3122 1 0.2 10 -1.2 1.2
4+
-3122 1 0.2 10 -1.2 1.2

0 commit comments

Comments
 (0)