Skip to content

Commit 03936fa

Browse files
authored
LF: Add injector for strangeness and pbpb underlying event (#1024)
1 parent 305b00e commit 03936fa

11 files changed

Lines changed: 173 additions & 7 deletions

MC/config/PWGLF/ini/GeneratorLFDeTrHe_pp.ini renamed to MC/config/PWGLF/ini/GeneratorLFDeTrHe.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ funcName=generateLongLivedMultiple("${O2DPG_ROOT}/MC/config/PWGLF/pythia8/genera
55
# Deuteron Anti-Deuteron Triton Anti-Triton Helium3 Anti-Helium3
66

77
[GeneratorPythia8]
8-
config=${O2_ROOT}/share/Generators/egconfig/pythia8_inel.cfg
8+
# config=${O2_ROOT}/share/Generators/egconfig/pythia8_inel.cfg
9+
config=${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator/nuclei.cfg
910

1011
[DecayerPythia8]
1112
config[0]=${O2DPG_ROOT}/MC/config/common/pythia8/decayer/base.cfg
12-
config[1]=${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator/nuclei.cfg
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[GeneratorExternal]
2+
fileName=${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_longlived_multiple.C
3+
funcName=generateLongLivedMultiple("${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator/strangeparticlelist.gun")
4+
; funcName=generateLongLivedMultiple({{1000010020, 10, 0.2, 10}, {-1000010020, 10, 0.2, 10}, {1000010030, 10, 0.2, 10}, {-1000010030, 10, 0.2, 10}, {1000020030, 10, 0.2, 10}, {-1000020030, 10, 0.2, 10}})
5+
# Deuteron Anti-Deuteron Triton Anti-Triton Helium3 Anti-Helium3
6+
7+
[GeneratorPythia8]
8+
# config=${O2_ROOT}/share/Generators/egconfig/pythia8_inel.cfg
9+
config=${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator/nuclei.cfg
10+
11+
[DecayerPythia8]
12+
config[0]=${O2DPG_ROOT}/MC/config/common/pythia8/decayer/base.cfg
File renamed without changes.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
int External()
2+
{
3+
std::string path{"o2sim_Kine.root"};
4+
int numberOfInjectedSignalsPerEvent{1};
5+
std::vector<int> injectedPDGs = {
6+
3334,
7+
-3334,
8+
3312,
9+
-3312};
10+
11+
auto nInjection = injectedPDGs.size();
12+
13+
TFile file(path.c_str(), "READ");
14+
if (file.IsZombie()) {
15+
std::cerr << "Cannot open ROOT file " << path << "\n";
16+
return 1;
17+
}
18+
19+
auto tree = (TTree*)file.Get("o2sim");
20+
if (!tree) {
21+
std::cerr << "Cannot find tree o2sim in file " << path << "\n";
22+
return 1;
23+
}
24+
std::vector<o2::MCTrack>* tracks{};
25+
tree->SetBranchAddress("MCTrack", &tracks);
26+
27+
std::vector<int> nSignal;
28+
for (int i = 0; i < nInjection; i++) {
29+
nSignal.push_back(0);
30+
}
31+
32+
auto nEvents = tree->GetEntries();
33+
for (int i = 0; i < nEvents; i++) {
34+
auto check = tree->GetEntry(i);
35+
for (int idxMCTrack = 0; idxMCTrack < tracks->size(); ++idxMCTrack) {
36+
auto track = tracks->at(idxMCTrack);
37+
auto pdg = track.GetPdgCode();
38+
auto it = std::find(injectedPDGs.begin(), injectedPDGs.end(), pdg);
39+
int index = std::distance(injectedPDGs.begin(), it); // index of injected PDG
40+
if (it != injectedPDGs.end()) // found
41+
{
42+
// count signal PDG
43+
nSignal[index]++;
44+
}
45+
}
46+
}
47+
std::cout << "--------------------------------\n";
48+
std::cout << "# Events: " << nEvents << "\n";
49+
for (int i = 0; i < nInjection; i++) {
50+
std::cout << "# Injected nuclei \n";
51+
std::cout << injectedPDGs[i] << ": " << nSignal[i] << "\n";
52+
if (nSignal[i] == 0) {
53+
std::cerr << "No generated: " << injectedPDGs[i] << "\n";
54+
return 1; // At least one of the injected particles should be generated
55+
}
56+
}
57+
return 0;
58+
}

MC/config/PWGLF/pythia8/generator/nuclei.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### particle definition
22
### id:all = name antiName spinType chargeType colType m0 mWidth mMin mMax tau0
3+
ProcessLevel:all = off
34

45
### deuteron
56
1000010020:all = deuteron deuteron_bar 0 3 0 1.8756134 0. 0. 0. 0.

MC/config/PWGLF/pythia8/generator/particlelist.gun

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# PDG N ptMin ptMax
1+
# PDG N ptMin ptMax genDecayed
22
1000010020 10 0.2 10
33
-1000010020 10 0.2 10
44
1000010030 10 0.2 10
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# PDG N ptMin ptMax genDecayed
2+
3334 1 0.2 10
3+
-3334 1 0.2 10
4+
3312 1 0.2 10
5+
-3312 1 0.2 10

MC/config/PWGLF/pythia8/generator_pythia8_longlived_multiple.C

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class GeneratorPythia8LongLivedGunMultiple : public GeneratorPythia8LongLivedGun
4949
mConfigToUse = mOneInjectionPerEvent ? static_cast<int>(gRandom->Uniform(0.f, getNGuns())) : -1;
5050
LOGF(info, "Using configuration %i out of %lli, %lli transport decayed, %lli generator decayed", mConfigToUse, getNGuns(), mGunConfigs.size(), mGunConfigsGenDecayed.size());
5151

52-
int nConfig = mGunConfigs.size();// We start counting from the configurations of the transport decayed particles
52+
int nConfig = mGunConfigs.size(); // We start counting from the configurations of the transport decayed particles
5353
for (const ConfigContainer& cfg : mGunConfigsGenDecayed) {
5454
nConfig++;
5555
if (mConfigToUse >= 0 && (nConfig - 1) != mConfigToUse) {

MC/run/PWGLF/run_DeTrHeInjected.sh

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,17 @@ export IGNORE_VALIDITYCHECK_OF_CCDB_LOCALCACHE=1
1818
# ----------- START ACTUAL JOB -----------------------------
1919

2020
NWORKERS=${NWORKERS:-8}
21-
MODULES="--skipModules ZDC"
2221
SIMENGINE=${SIMENGINE:-TGeant4}
2322
NSIGEVENTS=${NSIGEVENTS:-1}
2423
NBKGEVENTS=${NBKGEVENTS:-1}
2524
NTIMEFRAMES=${NTIMEFRAMES:-1}
2625
INTRATE=${INTRATE:-50000}
2726
SYSTEM=${SYSTEM:-pp}
2827
ENERGY=${ENERGY:-900}
29-
CFGINIFILE=${CFGINIFILE:-"${O2DPG_ROOT}/MC/config/PWGLF/ini/GeneratorLFDeTrHe_${SYSTEM}.ini"}
28+
CFGINIFILE=${CFGINIFILE:-"${O2DPG_ROOT}/MC/config/PWGLF/ini/GeneratorLFDeTrHe.ini"}
3029
[[ ${SPLITID} != "" ]] && SEED="-seed ${SPLITID}" || SEED=""
3130

3231
echo "NWORKERS = $NWORKERS"
33-
echo "MODULES = $MODULES"
3432

3533
# create workflow
3634
O2_SIM_WORKFLOW=${O2_SIM_WORKFLOW:-"${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py"}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#!/bin/bash
2+
3+
#
4+
# A example workflow MC->RECO->AOD for a simple pp min bias
5+
# production, targetting test beam conditions.
6+
7+
# make sure O2DPG + O2 is loaded
8+
[ ! "${O2DPG_ROOT}" ] && echo "Error: This needs O2DPG loaded" && exit 1
9+
[ ! "${O2_ROOT}" ] && echo "Error: This needs O2 loaded" && exit 1
10+
11+
# ----------- CONFIGURE --------------------------
12+
export IGNORE_VALIDITYCHECK_OF_CCDB_LOCALCACHE=1
13+
#export ALICEO2_CCDB_LOCALCACHE=.ccdb
14+
15+
# ----------- LOAD UTILITY FUNCTIONS --------------------------
16+
. ${O2_ROOT}/share/scripts/jobutils.sh
17+
18+
# ----------- START ACTUAL JOB -----------------------------
19+
20+
NWORKERS=${NWORKERS:-8}
21+
SIMENGINE=${SIMENGINE:-TGeant4}
22+
NSIGEVENTS=${NSIGEVENTS:-2}
23+
NBKGEVENTS=${NBKGEVENTS:-1}
24+
NTIMEFRAMES=${NTIMEFRAMES:-1}
25+
INTRATE=${INTRATE:-50000}
26+
SYSTEM=${SYSTEM:-PbPb}
27+
ENERGY=${ENERGY:-5360}
28+
CFGINIFILE=${CFGINIFILE:-"${O2DPG_ROOT}/MC/config/PWGLF/ini/GeneratorLFDeTrHe.ini"}
29+
[[ ${SPLITID} != "" ]] && SEED="-seed ${SPLITID}" || SEED=""
30+
31+
echo "NWORKERS = $NWORKERS"
32+
33+
# create workflow
34+
O2_SIM_WORKFLOW=${O2_SIM_WORKFLOW:-"${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py"}
35+
$O2_SIM_WORKFLOW -eCM ${ENERGY} -col ${SYSTEM} -gen external \
36+
-j ${NWORKERS} \
37+
-ns ${NSIGEVENTS} -tf ${NTIMEFRAMES} -interactionRate ${INTRATE} \
38+
-confKey "Diamond.width[2]=6." \
39+
${SEED} \
40+
-procBkg "heavy_ion" -colBkg $SYSTEM --embedding -nb ${NBKGEVENTS} -genBkg pythia8 \
41+
-e ${SIMENGINE} \
42+
-ini $CFGINIFILE
43+
44+
# run workflow
45+
O2_SIM_WORKFLOW_RUNNER=${O2_SIM_WORKFLOW_RUNNER:-"${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py"}
46+
$O2_SIM_WORKFLOW_RUNNER -f workflow.json -tt aod --cpu-limit $NWORKERS

0 commit comments

Comments
 (0)