void compare_runs() { const int NFILES = 2; char * infiles[NFILES] = { "042.run5pp_MUIDHV/1.scripts/files/combine.root", "042.run4AuAu_MUIDHV/1.scripts/files/combine.root"}; char * inputfiles[NFILES] = { "042.run5pp_MUIDHV/1.scripts/files/muideff.dat", "042.run4AuAu_MUIDHV/1.scripts/files/muideff.dat"}; float eff, eff_err; int id; int nagleplane; int iarm, iplane, ipanel, iorient, ihvg, roads_hit, roads_tot; const int MAXHVGROUPS = 360; float store_eff[MAXHVGROUPS][NFILES] = {0}; float store_eff_err[MAXHVGROUPS][NFILES] = {0}; float store_eff_hv[MAXHVGROUPS][NFILES] = {0}; for (int ifile = 0; ifile> iarm >> nagleplane >> ipanel >> ihvg >> roads_hit >> roads_tot >> eff; if (!myfile.good()) break; if (roads_tot == 0) { } // do nothing else { iplane = nagleplane/2; iorient = nagleplane%2; eff_err = sqrt(eff*(1-eff)/roads_tot); id = iarm*180 + nagleplane*18 + ipanel*3 + ihvg; cout << " id " << id << " eff " << eff << " eff_err " << eff_err << endl; store_eff[id][ifile] = eff; store_eff_err[id][ifile] = eff_err; } } myfile.close(); TFile *f = (TFile*)gROOT->GetListOfFiles()->FindObject(infiles[ifile]); if (!f) { f = new TFile(infiles[ifile]); } TTree *ntuple = (TTree*)gDirectory->Get("ntuple"); //Declaration of leaves types Float_t ibin; Float_t extra_current0; Float_t extra_current1; Float_t extra_current0_exp; Float_t extra_current1_exp; Float_t VS0; Float_t VS1; Float_t VS0_exp; Float_t VS1_exp; Float_t eff_exp; // Set branch addresses. ntuple->SetBranchAddress("ibin",&ibin); ntuple->SetBranchAddress("extra_current0",&extra_current0); ntuple->SetBranchAddress("extra_current1",&extra_current1); ntuple->SetBranchAddress("extra_current0_exp",&extra_current0_exp); ntuple->SetBranchAddress("extra_current1_exp",&extra_current1_exp); ntuple->SetBranchAddress("VS0",&VS0); ntuple->SetBranchAddress("VS1",&VS1); ntuple->SetBranchAddress("VS0_exp",&VS0_exp); ntuple->SetBranchAddress("VS1_exp",&VS1_exp); ntuple->SetBranchAddress("eff",&eff); ntuple->SetBranchAddress("eff_exp",&eff_exp); Long64_t nentries = ntuple->GetEntries(); Int_t nbytes = 0; for (Long64_t i=0; iGetEntry(i); id = (int) ibin; store_eff_hv[id][ifile] = eff; } f->Close(); } const float maximum_err = 0.05; int nbins = 30; float min = -0.15; float max = 0.15; //creating histograms for plane by plane plots //=========================================== TH1F *h1subs_hv[2][5]; TH1F *h1tot_hv[2]; TH1F *h1subs_data[2][5]; TH1F *h1tot_data[2]; char hname[100]; for (int mm=0; mm<2; mm++){ // arm for (int nn=0; nn<5; nn++){ // gap sprintf(hname,"hv_arm%d_gap%d",mm,nn); h1subs_hv[mm][nn] = new TH1F(hname,hname,nbins,min,max); sprintf(hname,"data_arm%d_gap%d",mm,nn); h1subs_data[mm][nn] = new TH1F(hname,hname,nbins,min,max); } sprintf(hname,"hv_arm%d_allgaps",mm); h1tot_hv[mm] = new TH1F(hname,hname,nbins,min,max); sprintf(hname,"data_arm%d_allgaps",mm); h1tot_data[mm] = new TH1F(hname,hname,nbins,min,max); } //=========================================== int armid=0; int planeid=0; int gapid=0; for (id = 0; id0 && store_eff_err[id][1]0 ) { armid = id/180; planeid = (id%180)/18; gapid = planeid/2; h1subs_hv[armid][gapid]->Fill(store_eff_hv[id][1] - store_eff_hv[id][0]); h1tot_hv[armid]->Fill(store_eff_hv[id][1] - store_eff_hv[id][0]); h1subs_data[armid][gapid]->Fill(store_eff[id][1] - store_eff[id][0]); h1tot_data[armid]->Fill(store_eff[id][1] - store_eff[id][0]); } } // histograms should be filled now; make plots gStyle->SetOptStat(1001110); gStyle->SetStatH(0.22); gStyle->SetStatW(0.40); // HV TCanvas *cSouth_hv = new TCanvas("cSouth_hv","cSouth_hv",10,10,800,600); cSouth_hv->Divide(3,2); TCanvas *cNorth_hv = new TCanvas("cNorth_hv","cNorth_hv",810,10,800,600); cNorth_hv->Divide(3,2); for (int m=0; m<2; m++){ for (int n=0; n<5; n++){ if(m==0) cSouth_hv->cd(n+1); if(m==1) cNorth_hv->cd(n+1); h1subs_hv[m][n]->SetLabelSize(0.05,"X"); h1subs_hv[m][n]->SetLabelSize(0.05,"Y"); h1subs_hv[m][n]->SetXTitle("HV eff : AuAu - pp"); h1subs_hv[m][n]->SetTitleSize(0.05,"X"); h1subs_hv[m][n]->Draw(); } if(m==0) { cSouth_hv->cd(6); h1tot_hv[0]->SetXTitle("HV eff : AuAu - pp"); h1tot_hv[0]->SetTitleSize(0.05,"X"); h1tot_hv[0]->Draw(); }else if(m==1){ cNorth_hv->cd(6); h1tot_hv[1]->Draw(); h1tot_hv[1]->SetXTitle("HV eff : AuAu - pp"); h1tot_hv[1]->SetTitleSize(0.05,"X"); } } cSouth_hv->SaveAs("files/compare_hv_south.gif"); cNorth_hv->SaveAs("files/compare_hv_north.gif"); // DATA TCanvas *cSouth_data = new TCanvas("cSouth_data","cSouth_data",10,10,800,600); cSouth_data->Divide(3,2); TCanvas *cNorth_data = new TCanvas("cNorth_data","cNorth_data",810,10,800,600); cNorth_data->Divide(3,2); for (int m=0; m<2; m++){ for (int n=0; n<5; n++){ if(m==0) cSouth_data->cd(n+1); if(m==1) cNorth_data->cd(n+1); h1subs_data[m][n]->SetLabelSize(0.05,"X"); h1subs_data[m][n]->SetLabelSize(0.05,"Y"); h1subs_data[m][n]->SetXTitle("DATA eff : AuAu - pp"); h1subs_data[m][n]->SetTitleSize(0.05,"X"); h1subs_data[m][n]->Draw(); } if(m==0) { cSouth_data->cd(6); h1tot_data[0]->SetXTitle("DATA eff : AuAu - pp"); h1tot_data[0]->SetTitleSize(0.05,"X"); h1tot_data[0]->Draw(); }else if(m==1){ cNorth_data->cd(6); h1tot_data[1]->Draw(); h1tot_data[1]->SetXTitle("DATA eff : AuAu - pp"); h1tot_data[1]->SetTitleSize(0.05,"X"); } } cSouth_data->SaveAs("files/compare_data_south.gif"); cNorth_data->SaveAs("files/compare_data_north.gif"); }