11int External ()
22{
33 std ::string path {"o2sim_Kine.root" };
4- const int pdgMother = 3124 ; // Lambda(1520)0 (sign randomized by the generator)
4+ const int pdgMother = 3124 ; // Lambda(1520)0
5+ const int triggerRatio = 5 ; // must match generator_Lstar(N) in the .ini file
56
67 TFile file (path .c_str (), "READ" );
78 if (file .IsZombie ()) {
@@ -20,10 +21,18 @@ int External()
2021 int nMother = 0 ;
2122 int nNotDecayed = 0 ;
2223 int nBadDecay = 0 ; // mothers not decaying exactly to Lambda + gamma
23- int nEventsWrongCount = 0 ; // events without exactly one injected mother
24+ int nEventsWrongCount = 0 ; // events with the wrong number of injected mothers
25+ int nGapEvents = 0 ; // events expected to contain the injected mother
2426
2527 for (int i = 0 ; i < nEvents ; i ++ ) {
2628 tree -> GetEntry (i );
29+
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+
2736 int nInEvent = 0 ;
2837 for (auto & track : * tracks ) {
2938 const int pdg = track .GetPdgCode ();
@@ -50,21 +59,30 @@ int External()
5059 std ::cerr << "Unexpected decay of " << pdg << " (" << nDau << " daughters)\n" ;
5160 }
5261 }
53- if (nInEvent != 1 ) {
62+
63+ const int nExpected = isGapEvent ? 1 : 0 ;
64+ if (nInEvent != nExpected ) {
5465 nEventsWrongCount ++ ;
66+ std ::cerr << "Event " << i << ": found " << nInEvent
67+ << " Lambda(1520), expected " << nExpected << "\n" ;
5568 }
5669 }
5770
5871 std ::cout << "--------------------------------\n" ;
5972 std ::cout << "# Events: " << nEvents << "\n" ;
73+ std ::cout << "# Gap-trigger events: " << nGapEvents << " (ratio " << triggerRatio << ")\n" ;
6074 std ::cout << "# Lambda(1520) + anti: " << nMother << "\n" ;
6175 std ::cout << "# not decayed: " << nNotDecayed << "\n" ;
6276 std ::cout << "# unexpected decays: " << nBadDecay << "\n" ;
63- std ::cout << "# events with != 1 mother: " << nEventsWrongCount << "\n" ;
77+ std ::cout << "# events wrong count: " << nEventsWrongCount << "\n" ;
6478 std ::cout << "--------------------------------\n" ;
6579
80+ if (nMother != nGapEvents ) {
81+ std ::cerr << "Expected one injected Lambda(1520) per gap-trigger event\n" ;
82+ return 1 ;
83+ }
6684 if (nEventsWrongCount > 0 ) {
67- std ::cerr << "Each event must contain exactly one injected Lambda(1520) \n" ;
85+ std ::cerr << "Lambda(1520) must appear in every gap-triggered events \n" ;
6886 return 1 ;
6987 }
7088 if (nNotDecayed > 0 || nBadDecay > 0 ) {
0 commit comments