File tree Expand file tree Collapse file tree 2 files changed +29
-9
lines changed
MC/config/ALICE3/ini/tests Expand file tree Collapse file tree 2 files changed +29
-9
lines changed Original file line number Diff line number Diff line change 11int External ()
22{
3- std ::string path = "o2sim_Kine.root" ;
3+ std ::string path { "o2sim_Kine.root" } ;
44 int pdgToCheck = 3312 ;
55
66 TFile file (path .c_str (), "read ");
@@ -11,8 +11,14 @@ int External()
1111
1212 int nInjectedParticles = 0 ;
1313 TTree * tree = (TTree * )file .Get ("o2sim" );
14- std ::vector < o2 ::MCTrack > * tracks {};
15- tree -> SetBranchAdress ("MCTrack" , & tracks )
14+
15+ if (!tree ) {
16+ std ::cerr << "Cannot find tree o2sim in file " << path << "\n" ;
17+ return 1 ;
18+ }
19+
20+ std ::vector < o2 ::MCTrack > * tracks {};
21+ tree -> SetBranchAddress ("MCTrack" , & tracks );
1622
1723 int nEvents = tree -> GetEntries ();
1824 for (int i = 0 ; i < nEvents ; i ++ ) {
@@ -27,10 +33,14 @@ int External()
2733 }
2834
2935 if (nInjectedParticles < nEvents ) {
30- // Check that we are correctly injecting one
36+ // Check that we are correctly injecting 15
3137 // particle per event
3238 return 1 ;
3339 }
3440
3541 return 0 ;
36- }
42+ }
43+
44+
45+
46+
Original file line number Diff line number Diff line change 11int External ()
22{
3- std ::string path = "o2sim_Kine.root" ;
3+ std ::string path { "o2sim_Kine.root" } ;
44 int pdgToCheck = 3312 ;
55
66 TFile file (path .c_str (), "read ");
@@ -11,8 +11,14 @@ int External()
1111
1212 int nInjectedParticles = 0 ;
1313 TTree * tree = (TTree * )file .Get ("o2sim" );
14- std ::vector < o2 ::MCTrack > * tracks ;
15- tree -> SetBranchAdress ("MCTrack" , & tracks )
14+
15+ if (!tree ) {
16+ std ::cerr << "Cannot find tree o2sim in file " << path << "\n" ;
17+ return 1 ;
18+ }
19+
20+ std ::vector < o2 ::MCTrack > * tracks {};
21+ tree -> SetBranchAddress ("MCTrack" , & tracks );
1622
1723 int nEvents = tree -> GetEntries ();
1824 for (int i = 0 ; i < nEvents ; i ++ ) {
@@ -27,10 +33,14 @@ int External()
2733 }
2834
2935 if (nInjectedParticles < nEvents ) {
30- // Check that we are correctly injecting 15
36+ // Check that we are correctly injecting one
3137 // particle per event
3238 return 1 ;
3339 }
3440
3541 return 0 ;
3642}
43+
44+
45+
46+
You can’t perform that action at this time.
0 commit comments