Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ funcName=generateLongLivedMultiple("${O2DPG_ROOT}/MC/config/PWGLF/pythia8/genera
# Deuteron Anti-Deuteron Triton Anti-Triton Helium3 Anti-Helium3

[GeneratorPythia8]
config=${O2_ROOT}/share/Generators/egconfig/pythia8_inel.cfg
# config=${O2_ROOT}/share/Generators/egconfig/pythia8_inel.cfg
config=${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator/nuclei.cfg

[DecayerPythia8]
config[0]=${O2DPG_ROOT}/MC/config/common/pythia8/decayer/base.cfg
config[1]=${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator/nuclei.cfg
12 changes: 12 additions & 0 deletions MC/config/PWGLF/ini/GeneratorLFStrangeness.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[GeneratorExternal]
fileName=${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_longlived_multiple.C
funcName=generateLongLivedMultiple("${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator/strangeparticlelist.gun")
; 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}})
# Deuteron Anti-Deuteron Triton Anti-Triton Helium3 Anti-Helium3

[GeneratorPythia8]
# config=${O2_ROOT}/share/Generators/egconfig/pythia8_inel.cfg
config=${O2DPG_ROOT}/MC/config/PWGLF/pythia8/generator/nuclei.cfg

[DecayerPythia8]
config[0]=${O2DPG_ROOT}/MC/config/common/pythia8/decayer/base.cfg
58 changes: 58 additions & 0 deletions MC/config/PWGLF/ini/tests/GeneratorLFStrangeness.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
int External()
{
std::string path{"o2sim_Kine.root"};
int numberOfInjectedSignalsPerEvent{1};
std::vector<int> injectedPDGs = {
3334,
-3334,
3312,
-3312};

auto nInjection = injectedPDGs.size();

TFile file(path.c_str(), "READ");
if (file.IsZombie()) {
std::cerr << "Cannot open ROOT file " << path << "\n";
return 1;
}

auto tree = (TTree*)file.Get("o2sim");
if (!tree) {
std::cerr << "Cannot find tree o2sim in file " << path << "\n";
return 1;
}
std::vector<o2::MCTrack>* tracks{};
tree->SetBranchAddress("MCTrack", &tracks);

std::vector<int> nSignal;
for (int i = 0; i < nInjection; i++) {
nSignal.push_back(0);
}

auto nEvents = tree->GetEntries();
for (int i = 0; i < nEvents; i++) {
auto check = tree->GetEntry(i);
for (int idxMCTrack = 0; idxMCTrack < tracks->size(); ++idxMCTrack) {
auto track = tracks->at(idxMCTrack);
auto pdg = track.GetPdgCode();
auto it = std::find(injectedPDGs.begin(), injectedPDGs.end(), pdg);
int index = std::distance(injectedPDGs.begin(), it); // index of injected PDG
if (it != injectedPDGs.end()) // found
{
// count signal PDG
nSignal[index]++;
}
}
}
std::cout << "--------------------------------\n";
std::cout << "# Events: " << nEvents << "\n";
for (int i = 0; i < nInjection; i++) {
std::cout << "# Injected nuclei \n";
std::cout << injectedPDGs[i] << ": " << nSignal[i] << "\n";
if (nSignal[i] == 0) {
std::cerr << "No generated: " << injectedPDGs[i] << "\n";
return 1; // At least one of the injected particles should be generated
}
}
return 0;
}
1 change: 1 addition & 0 deletions MC/config/PWGLF/pythia8/generator/nuclei.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### particle definition
### id:all = name antiName spinType chargeType colType m0 mWidth mMin mMax tau0
ProcessLevel:all = off

### deuteron
1000010020:all = deuteron deuteron_bar 0 3 0 1.8756134 0. 0. 0. 0.
Expand Down
2 changes: 1 addition & 1 deletion MC/config/PWGLF/pythia8/generator/particlelist.gun
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# PDG N ptMin ptMax
# PDG N ptMin ptMax genDecayed
1000010020 10 0.2 10
-1000010020 10 0.2 10
1000010030 10 0.2 10
Expand Down
5 changes: 5 additions & 0 deletions MC/config/PWGLF/pythia8/generator/strangeparticlelist.gun
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# PDG N ptMin ptMax genDecayed
3334 1 0.2 10
-3334 1 0.2 10
3312 1 0.2 10
-3312 1 0.2 10
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class GeneratorPythia8LongLivedGunMultiple : public GeneratorPythia8LongLivedGun
mConfigToUse = mOneInjectionPerEvent ? static_cast<int>(gRandom->Uniform(0.f, getNGuns())) : -1;
LOGF(info, "Using configuration %i out of %lli, %lli transport decayed, %lli generator decayed", mConfigToUse, getNGuns(), mGunConfigs.size(), mGunConfigsGenDecayed.size());

int nConfig = mGunConfigs.size();// We start counting from the configurations of the transport decayed particles
int nConfig = mGunConfigs.size(); // We start counting from the configurations of the transport decayed particles
for (const ConfigContainer& cfg : mGunConfigsGenDecayed) {
nConfig++;
if (mConfigToUse >= 0 && (nConfig - 1) != mConfigToUse) {
Expand Down
4 changes: 1 addition & 3 deletions MC/run/PWGLF/run_DeTrHeInjected.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,17 @@ export IGNORE_VALIDITYCHECK_OF_CCDB_LOCALCACHE=1
# ----------- START ACTUAL JOB -----------------------------

NWORKERS=${NWORKERS:-8}
MODULES="--skipModules ZDC"
SIMENGINE=${SIMENGINE:-TGeant4}
NSIGEVENTS=${NSIGEVENTS:-1}
NBKGEVENTS=${NBKGEVENTS:-1}
NTIMEFRAMES=${NTIMEFRAMES:-1}
INTRATE=${INTRATE:-50000}
SYSTEM=${SYSTEM:-pp}
ENERGY=${ENERGY:-900}
CFGINIFILE=${CFGINIFILE:-"${O2DPG_ROOT}/MC/config/PWGLF/ini/GeneratorLFDeTrHe_${SYSTEM}.ini"}
CFGINIFILE=${CFGINIFILE:-"${O2DPG_ROOT}/MC/config/PWGLF/ini/GeneratorLFDeTrHe.ini"}
[[ ${SPLITID} != "" ]] && SEED="-seed ${SPLITID}" || SEED=""

echo "NWORKERS = $NWORKERS"
echo "MODULES = $MODULES"

# create workflow
O2_SIM_WORKFLOW=${O2_SIM_WORKFLOW:-"${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py"}
Expand Down
46 changes: 46 additions & 0 deletions MC/run/PWGLF/run_DeTrHeInjected_PbPb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

#
# A example workflow MC->RECO->AOD for a simple pp min bias
# production, targetting test beam conditions.

# make sure O2DPG + O2 is loaded
[ ! "${O2DPG_ROOT}" ] && echo "Error: This needs O2DPG loaded" && exit 1
[ ! "${O2_ROOT}" ] && echo "Error: This needs O2 loaded" && exit 1

# ----------- CONFIGURE --------------------------
export IGNORE_VALIDITYCHECK_OF_CCDB_LOCALCACHE=1
#export ALICEO2_CCDB_LOCALCACHE=.ccdb

# ----------- LOAD UTILITY FUNCTIONS --------------------------
. ${O2_ROOT}/share/scripts/jobutils.sh

# ----------- START ACTUAL JOB -----------------------------

NWORKERS=${NWORKERS:-8}
SIMENGINE=${SIMENGINE:-TGeant4}
NSIGEVENTS=${NSIGEVENTS:-2}
NBKGEVENTS=${NBKGEVENTS:-1}
NTIMEFRAMES=${NTIMEFRAMES:-1}
INTRATE=${INTRATE:-50000}
SYSTEM=${SYSTEM:-PbPb}
ENERGY=${ENERGY:-5360}
CFGINIFILE=${CFGINIFILE:-"${O2DPG_ROOT}/MC/config/PWGLF/ini/GeneratorLFDeTrHe.ini"}
[[ ${SPLITID} != "" ]] && SEED="-seed ${SPLITID}" || SEED=""

echo "NWORKERS = $NWORKERS"

# create workflow
O2_SIM_WORKFLOW=${O2_SIM_WORKFLOW:-"${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py"}
$O2_SIM_WORKFLOW -eCM ${ENERGY} -col ${SYSTEM} -gen external \
-j ${NWORKERS} \
-ns ${NSIGEVENTS} -tf ${NTIMEFRAMES} -interactionRate ${INTRATE} \
-confKey "Diamond.width[2]=6." \
${SEED} \
-procBkg "heavy_ion" -colBkg $SYSTEM --embedding -nb ${NBKGEVENTS} -genBkg pythia8 \
-e ${SIMENGINE} \
-ini $CFGINIFILE

# run workflow
O2_SIM_WORKFLOW_RUNNER=${O2_SIM_WORKFLOW_RUNNER:-"${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py"}
$O2_SIM_WORKFLOW_RUNNER -f workflow.json -tt aod --cpu-limit $NWORKERS
46 changes: 46 additions & 0 deletions MC/run/PWGLF/run_StrangenessInjected.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

#
# A example workflow MC->RECO->AOD for a simple pp min bias
# production, targetting test beam conditions.

# make sure O2DPG + O2 is loaded
[ ! "${O2DPG_ROOT}" ] && echo "Error: This needs O2DPG loaded" && exit 1
[ ! "${O2_ROOT}" ] && echo "Error: This needs O2 loaded" && exit 1

# ----------- CONFIGURE --------------------------
export IGNORE_VALIDITYCHECK_OF_CCDB_LOCALCACHE=1
#export ALICEO2_CCDB_LOCALCACHE=.ccdb

# ----------- LOAD UTILITY FUNCTIONS --------------------------
. ${O2_ROOT}/share/scripts/jobutils.sh

# ----------- START ACTUAL JOB -----------------------------

NWORKERS=${NWORKERS:-8}
SIMENGINE=${SIMENGINE:-TGeant4}
NSIGEVENTS=${NSIGEVENTS:-2}
NBKGEVENTS=${NBKGEVENTS:-1}
NTIMEFRAMES=${NTIMEFRAMES:-1}
INTRATE=${INTRATE:-50000}
SYSTEM=${SYSTEM:-pp}
ENERGY=${ENERGY:-13600}
CFGINIFILE=${CFGINIFILE:-"${O2DPG_ROOT}/MC/config/PWGLF/ini/GeneratorLFStrangeness.ini"}
[[ ${SPLITID} != "" ]] && SEED="-seed ${SPLITID}" || SEED=""

echo "NWORKERS = $NWORKERS"

# create workflow
O2_SIM_WORKFLOW=${O2_SIM_WORKFLOW:-"${O2DPG_ROOT}/MC/bin/o2dpg_sim_workflow.py"}
$O2_SIM_WORKFLOW -eCM ${ENERGY} -col ${SYSTEM} -gen external \
-j ${NWORKERS} \
-ns ${NSIGEVENTS} -tf ${NTIMEFRAMES} -interactionRate ${INTRATE} \
-confKey "Diamond.width[2]=6." \
${SEED} \
-procBkg "inel" -colBkg $SYSTEM --embedding -nb ${NBKGEVENTS} -genBkg pythia8 \
-e ${SIMENGINE} \
-ini $CFGINIFILE

# run workflow
O2_SIM_WORKFLOW_RUNNER=${O2_SIM_WORKFLOW_RUNNER:-"${O2DPG_ROOT}/MC/bin/o2_dpg_workflow_runner.py"}
$O2_SIM_WORKFLOW_RUNNER -f workflow.json -tt aod --cpu-limit $NWORKERS