File tree Expand file tree Collapse file tree
MC/config/common/ini/tests Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ int External ()
2+ {
3+ std ::string path {"o2sim_Kine.root" };
4+ // Check that file exists, can be opened and has the correct tree
5+ TFile file (path .c_str (), "READ ");
6+ if (file .IsZombie ()) {
7+ std ::cerr << "Cannot open ROOT file " << path << "\n" ;
8+ return 1 ;
9+ }
10+ auto tree = (TTree * )file .Get ("o2sim" );
11+ if (!tree ) {
12+ std ::cerr << "Cannot find tree o2sim in file " << path << "\n" ;
13+ return 1 ;
14+ }
15+ std ::vector < o2 ::MCTrack > * tracks {};
16+ tree -> SetBranchAddress ("MCTrack" , & tracks );
17+ o2 ::dataformats ::MCEventHeader * eventHeader = nullptr ;
18+ tree -> SetBranchAddress ("MCEventHeader." , & eventHeader );
19+
20+ // Check if there are 100 events, as simulated in the o2dpg-test
21+ auto nEvents = tree -> GetEntries ();
22+ if (nEvents != 100 ) {
23+ std ::cerr << "Expected 100 events, got " << nEvents << "\n" ;
24+ return 1 ;
25+ }
26+ // Beam momentum per nucleon for Pb-Pb at sqrt(s_NN) = 5.36 TeV
27+ for (Long64_t i = 0 ; i < nEvents ; ++ i ) {
28+ tree -> GetEntry (i );
29+ if (tracks -> empty ()) {
30+ std ::cerr << "Empty entry found at event " << i << "\n" ;
31+ return 1 ;
32+ }
33+ }
34+ return 0 ;
35+ }
You can’t perform that action at this time.
0 commit comments