void convertRootCaptureData(string file="/data/chocula/villaa/cascadeSimData/normge_fast.root", string outfile="capture.txt") { //open the file TFile *f = new TFile(file.c_str()); if(!f){ cerr << "ERROR! (convertRootCaptureData): ROOT file could not be opened." << endl; return; } f->ls(); //get trees TTree *t = f->Get("cascade"); TTree *te = f->Get("escapeInfo"); t->AddFriend(te); //a way to get resolutions //t->SetAlias("rng","sin(2*pi*rndm)*sqrt(-2*log(rndm))"); //get the summed energy and didInteract value t->SetEstimate(4000000); t->Draw("Sum$(delE):didInteract","","goff"); //get the vectors Int_t n = t->GetSelectedRows(); cout << "Got " << n << " events. " << endl; Double_t *energy = t->GetV1(); Double_t *gamma_interact = t->GetV2(); //print the output ofstream out(outfile.c_str()); for(int i=0;i<10;i++){ cout << energy[i] << "\t" << gamma_interact[i] << endl; } out.close(); return; }