// Author: David Lawrence Sep. 29, 2006 // // // bcal_ped_tree.cc // #include #include #include using namespace std; #include #include //----------- // main //----------- int main(int narg, char *argv[]) { // Create ROOT file char fname[256]; sprintf(fname,"bcal_peds.root"); TFile *file = new TFile(fname, "RECREATE"); cout<<"Opened \""<SetMarkerStyle(20); ped->SetMarkerSize(0.5); stringstream s18, s19; for(int i=1; i<=32; i++){ s18<<"s18_"<Branch("slot18", ped_run.slot18,s18.str().c_str()); ped->Branch("slot19", ped_run.slot19,s19.str().c_str()); ped->Branch("run", &ped_run.run,"run/I"); // Loop of run numbers for(int run=2300; run<2470; run++){ // slot 18 char fname[256]; sprintf(fname,"ped_slot18_run%05d.txt", run); ifstream inf(fname); if(!inf.is_open())continue; for(int i=0;i<32; i++)inf>>ped_run.slot18[i]; inf.close(); // slot 19 sprintf(fname,"ped_slot19_run%05d.txt", run); inf.open(fname); if(!inf.is_open())continue; for(int i=0;i<32; i++)inf>>ped_run.slot19[i]; inf.close(); ped_run.run = run; ped->Fill(); cout<<"Added entry for run "<Write(); file->Close(); delete file; return 0; }