File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed
run/SimExamples/Custom_EventInfo Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ void
2+ read_event_info(const char *fname)
3+ {
4+
5+ auto fin = TFile::Open(fname);
6+ auto tin = (TTree*)fin->Get("o2sim");
7+ auto head = new o2::dataformats::MCEventHeader;
8+ tin->SetBranchAddress("MCEventHeader.", &head);
9+
10+ bool isvalid;
11+
12+ for (int iev = 0; iev < tin->GetEntries(); ++iev) {
13+
14+ tin->GetEntry(iev);
15+
16+ std::cout << " ---------------" << std::endl;
17+ auto name = head->getInfo<std::string>("generator", isvalid);
18+ if (isvalid) std::cout << "generator = " << name << std::endl;
19+ auto Bimpact = head->getInfo<double>("Bimpact", isvalid);
20+ if (isvalid) std::cout << " Bimpact = " << Bimpact << std::endl;
21+ auto Ncoll = head->getInfo<int>("Ncoll", isvalid);
22+ if (isvalid) std::cout << " Ncoll = " << Ncoll << std::endl;
23+ auto Npart = head->getInfo<int>("Npart", isvalid);
24+ if (isvalid) std::cout << " Npart = " << Npart << std::endl;
25+ }
26+
27+ }
You can’t perform that action at this time.
0 commit comments