Skip to content

Commit 5a1d6ad

Browse files
committed
Add test macros
1 parent 4c0412e commit 5a1d6ad

File tree

3 files changed

+87
-0
lines changed

3 files changed

+87
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
int External() {
2+
std::string path{"o2sim_Kine.root"};
3+
4+
TFile file(path.c_str(), "READ");
5+
if (file.IsZombie()) {
6+
std::cerr << "Cannot open ROOT file " << path << "\n";
7+
return 1;
8+
}
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+
18+
auto nEvents = tree->GetEntries();
19+
if (nEvents == 0) {
20+
std::cerr << "No event of interest\n";
21+
return 1;
22+
}
23+
return 0;
24+
}
25+
26+
int Pythia8()
27+
{
28+
return External();
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
int External() {
2+
std::string path{"o2sim_Kine.root"};
3+
4+
TFile file(path.c_str(), "READ");
5+
if (file.IsZombie()) {
6+
std::cerr << "Cannot open ROOT file " << path << "\n";
7+
return 1;
8+
}
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+
18+
auto nEvents = tree->GetEntries();
19+
if (nEvents == 0) {
20+
std::cerr << "No event of interest\n";
21+
return 1;
22+
}
23+
return 0;
24+
}
25+
26+
int Pythia8()
27+
{
28+
return External();
29+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
int External() {
2+
std::string path{"o2sim_Kine.root"};
3+
4+
TFile file(path.c_str(), "READ");
5+
if (file.IsZombie()) {
6+
std::cerr << "Cannot open ROOT file " << path << "\n";
7+
return 1;
8+
}
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+
18+
auto nEvents = tree->GetEntries();
19+
if (nEvents == 0) {
20+
std::cerr << "No event of interest\n";
21+
return 1;
22+
}
23+
return 0;
24+
}
25+
26+
int Pythia8()
27+
{
28+
return External();
29+
}

0 commit comments

Comments
 (0)