File tree Expand file tree Collapse file tree 2 files changed +70
-4
lines changed
MC/config/ALICE3/ini/tests Expand file tree Collapse file tree 2 files changed +70
-4
lines changed Original file line number Diff line number Diff line change 1- int External () {
2- return 0 ;
1+ int External ()
2+ {
3+ std ::string path = "o2sim_Kine.root" ;
4+ int pdgToCheck = 3312 ;
5+
6+ TFile file (path .c_str (), "read ");
7+ if (file .IsZombie ()) {
8+ std ::err << "Cannot open ROOT file " << path << std ::endl ;
9+ return 1 ;
10+ }
11+
12+ int nInjectedParticles = 0 ;
13+ TTree * tree = (TTree * )file .Get ("o2sim" );
14+ std ::vector < o2 ::MCTrack > * tracks ;
15+ tree -> SetBranchAdress ("MCTrack" , & tracks )
16+
17+ int nEvents = tree -> GetEntries ();
18+ for (int i = 0 ; i < nEvents ; i ++ ) {
19+ tree -> GetEntry (i );
20+ for (const auto& track : tracks ) {
21+ auto pdgCode = track .getPdgCode ();
22+ if (pdgCode == pdgToCheck ) {
23+ // not injecting anti-particle
24+ nInjectedParticles ++ ;
25+ }
26+ }
27+ }
28+
29+ if (nInjectedParticles < nEvents ) {
30+ // Check that we are correctly injecting one
31+ // particle per event
32+ return 1 ;
33+ }
34+
35+ return 0 ;
336}
Original file line number Diff line number Diff line change 1- int External () {
2- return 0 ;
1+ int External ()
2+ {
3+ std ::string path = "o2sim_Kine.root" ;
4+ int pdgToCheck = 3312 ;
5+
6+ TFile file (path .c_str (), "read ");
7+ if (file .IsZombie ()) {
8+ std ::err << "Cannot open ROOT file " << path << std ::endl ;
9+ return 1 ;
10+ }
11+
12+ int nInjectedParticles = 0 ;
13+ TTree * tree = (TTree * )file .Get ("o2sim" );
14+ std ::vector < o2 ::MCTrack > * tracks ;
15+ tree -> SetBranchAdress ("MCTrack" , & tracks )
16+
17+ int nEvents = tree -> GetEntries ();
18+ for (int i = 0 ; i < nEvents ; i ++ ) {
19+ tree -> GetEntry (i );
20+ for (const auto& track : tracks ) {
21+ auto pdgCode = track .getPdgCode ();
22+ if (pdgCode == pdgToCheck ) {
23+ // not injecting anti-particle
24+ nInjectedParticles ++ ;
25+ }
26+ }
27+ }
28+
29+ if (nInjectedParticles < nEvents ) {
30+ // Check that we are correctly injecting 15
31+ // particle per event
32+ return 1 ;
33+ }
34+
35+ return 0 ;
336}
You can’t perform that action at this time.
0 commit comments