void extractEvents(const char *file) { TFile *f = new TFile(file); TTree *tree = (TTree*) f->Get("T"); RAT::DS::Root *rds = new RAT::DS::Root(); tree->SetBranchAddress("ds", &rds); int nEvents = tree->GetEntries(); cout << '{'; for (int i = 0; i < nEvents; i++) { tree->GetEntry(i); RAT::DS::MC *mc = rds->GetMC(); RAT::DS::MCParticle *prim = mc->GetMCParticle(0); cout << '{'; cout << mc->GetNumPE() << ','; cout << mc->GetMCPMTCount() << ','; cout << prim->GetKE() << ','; cout << '{' << prim->GetPosition().X() << ',' << prim->GetPosition().Y() << ',' << prim->GetPosition().Z() << "},"; cout << '{' << prim->GetMomentum().X() << ',' << prim->GetMomentum().Y() << ',' << prim->GetMomentum().Z() << "}"; cout << '}'; if (i != nEvents-1) cout << ','; } cout << "}\n"; }