diff --git a/MC/config/PWGLF/ini/GeneratorLFDeTrHe_pp.ini b/MC/config/PWGLF/ini/GeneratorLFDeTrHe.ini similarity index 84% rename from MC/config/PWGLF/ini/GeneratorLFDeTrHe_pp.ini rename to MC/config/PWGLF/ini/GeneratorLFDeTrHe.ini index 099a1f2e3..9ec909806 100644 --- a/MC/config/PWGLF/ini/GeneratorLFDeTrHe_pp.ini +++ b/MC/config/PWGLF/ini/GeneratorLFDeTrHe.ini @@ -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 diff --git a/MC/config/PWGLF/ini/GeneratorLFStrangeness.ini b/MC/config/PWGLF/ini/GeneratorLFStrangeness.ini new file mode 100644 index 000000000..4e9d7e0df --- /dev/null +++ b/MC/config/PWGLF/ini/GeneratorLFStrangeness.ini @@ -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 diff --git a/MC/config/PWGLF/ini/tests/GeneratorLFDeTrHe_pp.C b/MC/config/PWGLF/ini/tests/GeneratorLFDeTrHe.C similarity index 100% rename from MC/config/PWGLF/ini/tests/GeneratorLFDeTrHe_pp.C rename to MC/config/PWGLF/ini/tests/GeneratorLFDeTrHe.C diff --git a/MC/config/PWGLF/ini/tests/GeneratorLFStrangeness.C b/MC/config/PWGLF/ini/tests/GeneratorLFStrangeness.C new file mode 100644 index 000000000..49ba5d4e2 --- /dev/null +++ b/MC/config/PWGLF/ini/tests/GeneratorLFStrangeness.C @@ -0,0 +1,58 @@ +int External() +{ + std::string path{"o2sim_Kine.root"}; + int numberOfInjectedSignalsPerEvent{1}; + std::vector 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* tracks{}; + tree->SetBranchAddress("MCTrack", &tracks); + + std::vector 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; +} \ No newline at end of file diff --git a/MC/config/PWGLF/pythia8/generator/nuclei.cfg b/MC/config/PWGLF/pythia8/generator/nuclei.cfg index dc83b355e..85f3b9a1a 100644 --- a/MC/config/PWGLF/pythia8/generator/nuclei.cfg +++ b/MC/config/PWGLF/pythia8/generator/nuclei.cfg @@ -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. diff --git a/MC/config/PWGLF/pythia8/generator/particlelist.gun b/MC/config/PWGLF/pythia8/generator/particlelist.gun index ab4564eb6..e70f291e1 100644 --- a/MC/config/PWGLF/pythia8/generator/particlelist.gun +++ b/MC/config/PWGLF/pythia8/generator/particlelist.gun @@ -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 diff --git a/MC/config/PWGLF/pythia8/generator/strangeparticlelist.gun b/MC/config/PWGLF/pythia8/generator/strangeparticlelist.gun new file mode 100644 index 000000000..f1e5a65d1 --- /dev/null +++ b/MC/config/PWGLF/pythia8/generator/strangeparticlelist.gun @@ -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 \ No newline at end of file diff --git a/MC/config/PWGLF/pythia8/generator_pythia8_longlived_multiple.C b/MC/config/PWGLF/pythia8/generator_pythia8_longlived_multiple.C index 99d33713f..eef6bcdb0 100644 --- a/MC/config/PWGLF/pythia8/generator_pythia8_longlived_multiple.C +++ b/MC/config/PWGLF/pythia8/generator_pythia8_longlived_multiple.C @@ -49,7 +49,7 @@ class GeneratorPythia8LongLivedGunMultiple : public GeneratorPythia8LongLivedGun mConfigToUse = mOneInjectionPerEvent ? static_cast(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) { diff --git a/MC/run/PWGLF/run_DeTrHeInjected.sh b/MC/run/PWGLF/run_DeTrHeInjected.sh index 9e6b9089a..6a003d24f 100755 --- a/MC/run/PWGLF/run_DeTrHeInjected.sh +++ b/MC/run/PWGLF/run_DeTrHeInjected.sh @@ -18,7 +18,6 @@ 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} @@ -26,11 +25,10 @@ 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"} diff --git a/MC/run/PWGLF/run_DeTrHeInjected_PbPb.sh b/MC/run/PWGLF/run_DeTrHeInjected_PbPb.sh new file mode 100755 index 000000000..cb93c5d78 --- /dev/null +++ b/MC/run/PWGLF/run_DeTrHeInjected_PbPb.sh @@ -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 diff --git a/MC/run/PWGLF/run_StrangenessInjected.sh b/MC/run/PWGLF/run_StrangenessInjected.sh new file mode 100755 index 000000000..8a2ee738b --- /dev/null +++ b/MC/run/PWGLF/run_StrangenessInjected.sh @@ -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