Skip to content

Commit 712da77

Browse files
Lstar ini files for gap trigger 3 and 4 (#2548)
* Lstar ini files for gap trigger 3 and 4 * test files * Delete MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap3.C * Delete MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar_gap4.C * Update GeneratorLF_Strangeness_ppLStar_gap3.ini * Add comment header to GeneratorLF_Strangeness_ini file --------- Co-authored-by: Nicolò Jacazio <njacazio@users.noreply.github.com>
1 parent dc51651 commit 712da77

4 files changed

Lines changed: 56 additions & 25 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#---> GeneratorLF_Strangeness_ppLStar
2+
[GeneratorExternal]
3+
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C
4+
funcName=generator_Lstar(3)
5+
6+
[GeneratorPythia8]
7+
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_forceLStar.cfg
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#---> GeneratorLF_Strangeness_ppLStar
2+
[GeneratorExternal]
3+
fileName=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C
4+
funcName=generator_Lstar(4)
5+
6+
[GeneratorPythia8]
7+
config=${O2DPG_MC_CONFIG_ROOT}/MC/config/PWGLF/pythia8/generator/pythia8_inel_forceLStar.cfg

‎MC/config/PWGLF/ini/tests/GeneratorLF_Strangeness_ppLStar.C‎

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
int External()
22
{
33
std::string path{"o2sim_Kine.root"};
4-
const int pdgMother = 3124; // Lambda(1520)0
5-
const int triggerRatio = 5; // must match generator_Lstar(N) in the .ini file
4+
const int pdgMother = 3124; // Lambda(1520)0
65

76
TFile file(path.c_str(), "READ");
87
if (file.IsZombie()) {
@@ -20,19 +19,12 @@ int External()
2019
const auto nEvents = tree->GetEntries();
2120
int nMother = 0;
2221
int nNotDecayed = 0;
23-
int nBadDecay = 0; // mothers not decaying exactly to Lambda + gamma
24-
int nEventsWrongCount = 0; // events with the wrong number of injected mothers
25-
int nGapEvents = 0; // events expected to contain the injected mother
22+
int nBadDecay = 0; // mothers not decaying exactly to Lambda + gamma
23+
std::vector<int> motherPerEvent; // number of injected mothers in each event
2624

2725
for (int i = 0; i < nEvents; i++) {
2826
tree->GetEntry(i);
2927

30-
// the generator injects in every triggerRatio-th event (it counts events from 1)
31-
const bool isGapEvent = ((i + 1) % triggerRatio == 0);
32-
if (isGapEvent) {
33-
nGapEvents++;
34-
}
35-
3628
int nInEvent = 0;
3729
for (auto &track : *tracks) {
3830
const int pdg = track.GetPdgCode();
@@ -59,30 +51,52 @@ int External()
5951
std::cerr << "Unexpected decay of " << pdg << " (" << nDau << " daughters)\n";
6052
}
6153
}
54+
motherPerEvent.push_back(nInEvent);
55+
}
6256

63-
const int nExpected = isGapEvent ? 1 : 0;
64-
if (nInEvent != nExpected) {
65-
nEventsWrongCount++;
66-
std::cerr << "Event " << i << ": found " << nInEvent
67-
<< " Lambda(1520), expected " << nExpected << "\n";
57+
// the trigger ratio is inferred from the first event containing a mother
58+
// (the generator counts events from 1 and injects every triggerRatio-th event)
59+
int triggerRatio = 0;
60+
for (int i = 0; i < nEvents; i++) {
61+
if (motherPerEvent[i] > 0) {
62+
triggerRatio = i + 1;
63+
break;
64+
}
65+
}
66+
67+
int nEventsWrongCount = 0;
68+
int nGapEvents = 0;
69+
if (triggerRatio > 0) {
70+
for (int i = 0; i < nEvents; i++) {
71+
const bool isGapEvent = ((i + 1) % triggerRatio == 0);
72+
if (isGapEvent) {
73+
nGapEvents++;
74+
}
75+
const int nExpected = isGapEvent ? 1 : 0;
76+
if (motherPerEvent[i] != nExpected) {
77+
nEventsWrongCount++;
78+
std::cerr << "Event " << i << ": found " << motherPerEvent[i]
79+
<< " Lambda(1520), expected " << nExpected << "\n";
80+
}
6881
}
6982
}
7083

7184
std::cout << "--------------------------------\n";
7285
std::cout << "# Events: " << nEvents << "\n";
73-
std::cout << "# Gap-trigger events: " << nGapEvents << " (ratio " << triggerRatio << ")\n";
86+
std::cout << "# Inferred trigger ratio: " << triggerRatio << "\n";
87+
std::cout << "# Gap-trigger events: " << nGapEvents << "\n";
7488
std::cout << "# Lambda(1520) + anti: " << nMother << "\n";
7589
std::cout << "# not decayed: " << nNotDecayed << "\n";
7690
std::cout << "# unexpected decays: " << nBadDecay << "\n";
7791
std::cout << "# events wrong count: " << nEventsWrongCount << "\n";
7892
std::cout << "--------------------------------\n";
7993

80-
if (nMother != nGapEvents) {
81-
std::cerr << "Expected one injected Lambda(1520) per gap-trigger event\n";
94+
if (triggerRatio == 0) {
95+
std::cerr << "No Lambda(1520) found in any event\n";
8296
return 1;
8397
}
84-
if (nEventsWrongCount > 0) {
85-
std::cerr << "Lambda(1520) must appear in every gap-triggered events\n";
98+
if (nMother != nGapEvents || nEventsWrongCount > 0) {
99+
std::cerr << "Lambda(1520) must appear exactly once every triggerRatio events\n";
86100
return 1;
87101
}
88102
if (nNotDecayed > 0 || nBadDecay > 0) {

‎MC/config/PWGLF/pythia8/generator_pythia8_Lstar.C‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1+
#include "Framework/Logger.h"
2+
3+
#if !defined(__CLING__) || defined(__ROOTCLING__)
4+
15
#include "Pythia8/Pythia.h"
26
#include "Pythia8/HeavyIons.h"
37
#include "FairGenerator.h"
48
#include "FairPrimaryGenerator.h"
59
#include "Generators/GeneratorPythia8.h"
610
#include "TF1.h"
711
#include "TRandom3.h"
8-
//#include "TParticlePDG.h"
9-
//#include "TDatabasePDG.h"
10-
1112
#include <map>
1213
#include <unordered_set>
1314

15+
#endif
16+
1417
class GeneratorPythia8ExtraStrangeness : public o2::eventgen::GeneratorPythia8
1518
{
1619
public:
@@ -268,4 +271,4 @@ private:
268271
{
269272
auto myGen = new GeneratorPythia8ExtraStrangeness(3124, inputTriggerRatio);
270273
return myGen;
271-
}
274+
}

0 commit comments

Comments
 (0)