1+ int External ()
2+ {
3+ std ::string path {"o2sim_Kine.root" };
4+ const int pdgMother = 3124 ; // Lambda(1520)0 (sign randomized by the generator)
5+
6+ TFile file (path .c_str (), "READ ");
7+ if (file .IsZombie ()) {
8+ std ::cerr << "Cannot open ROOT file " << path << "\n" ;
9+ return 1 ;
10+ }
11+ auto tree = (TTree * )file .Get ("o2sim" );
12+ if (!tree ) {
13+ std ::cerr << "Cannot find tree o2sim in file " << path << "\n" ;
14+ return 1 ;
15+ }
16+ std ::vector < o2 ::MCTrack > * tracks {};
17+ tree -> SetBranchAddress ("MCTrack" , & tracks );
18+
19+ const auto nEvents = tree -> GetEntries ();
20+ int nMother = 0 ;
21+ int nNotDecayed = 0 ;
22+ int nBadDecay = 0 ; // mothers not decaying exactly to Lambda + gamma
23+ int nEventsWrongCount = 0 ; // events without exactly one injected mother
24+
25+ for (int i = 0 ; i < nEvents ; i ++ ) {
26+ tree -> GetEntry (i );
27+ int nInEvent = 0 ;
28+ for (auto & track : * tracks ) {
29+ const int pdg = track .GetPdgCode ();
30+ if (std ::abs (pdg ) != pdgMother ) {
31+ continue ;
32+ }
33+ nInEvent ++ ;
34+ nMother ++ ;
35+
36+ if (track .getFirstDaughterTrackId () < 0 ) {
37+ nNotDecayed ++ ;
38+ continue ;
39+ }
40+ const int expectedLambda = (pdg > 0 ) ? 3122 : -3122 ;
41+ int nLambda = 0 , nGamma = 0 , nDau = 0 ;
42+ for (int j = track .getFirstDaughterTrackId (); j <= track .getLastDaughterTrackId (); ++ j ) {
43+ const int pdgDau = tracks -> at (j ).GetPdgCode ();
44+ nDau ++ ;
45+ if (pdgDau == expectedLambda ) nLambda ++ ;
46+ if (pdgDau == 22 ) nGamma ++ ;
47+ }
48+ if (nDau != 2 || nLambda != 1 || nGamma != 1 ) {
49+ nBadDecay ++ ;
50+ std ::cerr << "Unexpected decay of " << pdg << " (" << nDau << " daughters)\n" ;
51+ }
52+ }
53+ if (nInEvent != 1 ) {
54+ nEventsWrongCount ++ ;
55+ }
56+ }
57+
58+ std ::cout << "--------------------------------\n" ;
59+ std ::cout << "# Events: " << nEvents << "\n" ;
60+ std ::cout << "# Lambda(1520) + anti: " << nMother << "\n" ;
61+ std ::cout << "# not decayed: " << nNotDecayed << "\n" ;
62+ std ::cout << "# unexpected decays: " << nBadDecay << "\n" ;
63+ std ::cout << "# events with != 1 mother: " << nEventsWrongCount << "\n" ;
64+ std ::cout << "--------------------------------\n" ;
65+
66+ if (nEventsWrongCount > 0 ) {
67+ std ::cerr << "Each event must contain exactly one injected Lambda(1520)\n" ;
68+ return 1 ;
69+ }
70+ if (nNotDecayed > 0 || nBadDecay > 0 ) {
71+ std ::cerr << "Lambda(1520) must always decay to Lambda + gamma\n" ;
72+ return 1 ;
73+ }
74+ return 0 ;
75+ }
76+
77+ void GeneratorLF_Strangeness_ppLStar () { External (); }
0 commit comments