diff --git a/MC/config/PWGLF/ini/GeneratorLFAntideuteronInJets.ini b/MC/config/PWGLF/ini/GeneratorLFAntideuteronInJets.ini new file mode 100644 index 000000000..31463851b --- /dev/null +++ b/MC/config/PWGLF/ini/GeneratorLFAntideuteronInJets.ini @@ -0,0 +1,7 @@ +[GeneratorExternal] +fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_longlived_gaptriggered.C +funcName=generateLongLivedGapTriggered("${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/antideuteron.gun", 2, false) + +[GeneratorPythia8] +config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGGAJE/pythia8/generator/pythia8_jet.cfg +includePartonEvent=false \ No newline at end of file diff --git a/MC/config/PWGLF/ini/tests/GeneratorLFAntideuteronInJets.C b/MC/config/PWGLF/ini/tests/GeneratorLFAntideuteronInJets.C new file mode 100644 index 000000000..148a08c58 --- /dev/null +++ b/MC/config/PWGLF/ini/tests/GeneratorLFAntideuteronInJets.C @@ -0,0 +1,61 @@ +int External() +{ + std::string path{"o2sim_Kine.root"}; + int numberOfInjectedSignalsPerEvent{1}; + + std::vector injectedPDGs = { + -1000010020 // anti-deuteron + }; + + 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(nInjection, 0); + + auto nEvents = tree->GetEntries(); + + for (int i = 0; i < nEvents; i++) { + 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); + + if (it != injectedPDGs.end()) { + int index = std::distance(injectedPDGs.begin(), it); + nSignal[index]++; + } + } + } + + std::cout << "--------------------------------\n"; + std::cout << "# Events: " << nEvents << "\n"; + + for (int i = 0; i < nInjection; i++) { + std::cout << "# Injected particles\n"; + std::cout << injectedPDGs[i] << ": " << nSignal[i] << "\n"; + + if (nSignal[i] == 0) { + std::cerr << "No generated: " << injectedPDGs[i] << "\n"; + return 1; + } + } + + return 0; +} diff --git a/MC/config/PWGLF/pythia8/generator/antideuteron.gun b/MC/config/PWGLF/pythia8/generator/antideuteron.gun new file mode 100644 index 000000000..a3342f2c2 --- /dev/null +++ b/MC/config/PWGLF/pythia8/generator/antideuteron.gun @@ -0,0 +1,2 @@ +# PDG N ptMin ptMax yMin yMax +-1000010020 1 0.5 10 -1 1