#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; void bkg() { gStyle->SetOptStat(0); gStyle->SetGridStyle(2); gStyle->SetGridWidth(1); gStyle->SetLabelSize(0.040,"x"); gStyle->SetLabelSize(0.040,"y"); //gStyle->SetTitleOffset(1.,"x"); //gStyle->SetTitleOffset(1.,"y"); gStyle->SetTitleSize(0.045,"x"); gStyle->SetTitleSize(0.045,"y"); gStyle->SetPadRightMargin(0.075); /* TFile *file0[3], *file1[3]; file0[0] = TFile::Open("ecal1500BKG-0.18T_EST120deg_DIOBLK350mm.root"); // default file0[1] = TFile::Open("ecal1600BKG-0.18T_EST120deg_DIOBLK350mm.root"); file0[2] = TFile::Open("ecal1700BKG-0.18T_EST120deg_DIOBLK350mm.root"); file1[0] = TFile::Open("ecal1500BKG-0.19T_EST120deg_DIOBLK500mm.root"); // new file1[1] = TFile::Open("ecal1600BKG-0.19T_EST120deg_DIOBLK500mm.root"); file1[2] = TFile::Open("ecal1700BKG-0.19T_EST120deg_DIOBLK500mm.root");*/ TChain *tree0[3], *tree1[3], *tree2[3], *tree3[3]; for (Int_t i=0;i<3;i++) { tree0[i] = new TChain("CaloHits"); tree1[i] = new TChain("CaloHits"); tree2[i] = new TChain("CaloHits"); tree3[i] = new TChain("CaloHits"); } tree0[0]->Add("data/outStrECALPhaseIIBKG_ECAL1500mm_EST-0.18T_ESTTotPhi120deg_DIOBLK350mm_*.root"); tree0[1]->Add("data/outStrECALPhaseIIBKG_ECAL1600mm_EST-0.18T_ESTTotPhi120deg_DIOBLK350mm_*.root"); tree0[2]->Add("data/outStrECALPhaseIIBKG_ECAL1700mm_EST-0.18T_ESTTotPhi120deg_DIOBLK350mm_*.root"); tree1[0]->Add("data/outStrECALPhaseIIBKG_ECAL1500mm_EST-0.19T_ESTTotPhi120deg_DIOBLK500mm_*.root"); tree1[1]->Add("data/outStrECALPhaseIIBKG_ECAL1600mm_EST-0.19T_ESTTotPhi120deg_DIOBLK500mm_*.root"); tree1[2]->Add("data/outStrECALPhaseIIBKG_ECAL1700mm_EST-0.19T_ESTTotPhi120deg_DIOBLK500mm_*.root"); tree2[0]->Add("data/outStrECALPhaseIIBKG_ECAL1500mm_EST-0.18T_ESTTotPhi120deg_DIOBLK500mm_*.root"); tree2[1]->Add("data/outStrECALPhaseIIBKG_ECAL1600mm_EST-0.18T_ESTTotPhi120deg_DIOBLK500mm_*.root"); tree2[2]->Add("data/outStrECALPhaseIIBKG_ECAL1700mm_EST-0.18T_ESTTotPhi120deg_DIOBLK500mm_*.root"); tree3[0]->Add("data/outStrECALPhaseIIBKG_ECAL1500mm_EST-0.185T_ESTTotPhi120deg_DIOBLK500mm_*.root"); tree3[1]->Add("data/outStrECALPhaseIIBKG_ECAL1600mm_EST-0.185T_ESTTotPhi120deg_DIOBLK500mm_*.root"); tree3[2]->Add("data/outStrECALPhaseIIBKG_ECAL1700mm_EST-0.185T_ESTTotPhi120deg_DIOBLK500mm_*.root"); Int_t mcolor[3] = {kRed,kBlue,kBlack}; // marker color TH1F *h0[3], *h1[3], *h2[3], *h3[3]; TCanvas *c0[3], *c1[3], *c2[3], *c3[3]; Double_t scale(0); for (Int_t i=0;i<3;i++) { c0[i] = new TCanvas(Form("c0_%d",i),Form("c0_%d",i),1000,600); h0[i] = new TH1F(Form("h0_%d",i),Form("Z_{ECAL}=%dmm, B_{ESD}=-0.18T, H_{DIOBLK}=35cm",(1500+i*100)),20,50,90); h0[i]->SetXTitle("Initial Momentum [MeV/c]"); h0[i]->SetYTitle("Absolute #Omega [/(2MeV)]"); //tree0[i] = (TTree*)file0[i]->Get("CaloHits"); c0[i]->cd(); tree0[i]->Draw(Form("TMath::Sqrt(iniPx*iniPx+iniPy*iniPy+iniPz*iniPz)>>h0_%d",i), "sumE>0.5&&TMath::Abs(iniX-6800)<110&&TMath::Abs(iniY)<110&&TMath::Sqrt(iniPx*iniPx+iniPy*iniPy+iniPz*iniPz)>49.9"); scale = 500000./20.; h0[i]->Scale(1./scale); for (Int_t j=0;j<40;j++) { h0[i]->SetBinError(j+1,h0[i]->GetBinError(j+1)/scale); } h0[i]->SetMarkerStyle(8); h0[i]->SetMarkerSize(1.3); h0[i]->SetMarkerColor(mcolor[i]); h0[i]->Draw("EP"); c1[i] = new TCanvas(Form("c1_%d",i),Form("c1_%d",i),1000,600); h1[i] = new TH1F(Form("h1_%d",i),Form("Z_{ECAL}=%dmm, B_{ESD}=-0.19T, H_{DIOBLK}=20cm",(1500+i*100)),20,50,90); h1[i]->SetXTitle("Initial Momentum [MeV/c]"); h1[i]->SetYTitle("Absolute #Omega [/(2MeV)]"); //tree1[i] = (TTree*)file1[i]->Get("CaloHits"); c1[i]->cd(); tree1[i]->Draw(Form("TMath::Sqrt(iniPx*iniPx+iniPy*iniPy+iniPz*iniPz)>>h1_%d",i), "sumE>0.5&&TMath::Abs(iniX-6800)<110&&TMath::Abs(iniY)<110&&TMath::Sqrt(iniPx*iniPx+iniPy*iniPy+iniPz*iniPz)>49.9"); h1[i]->Scale(1./scale); for (Int_t j=0;j<40;j++) { h1[i]->SetBinError(j+1,h1[i]->GetBinError(j+1)/scale); } h1[i]->SetMarkerStyle(4); h1[i]->SetMarkerColor(mcolor[i]); h1[i]->SetMarkerSize(1.3); h1[i]->Draw("EP"); c2[i] = new TCanvas(Form("c2_%d",i),Form("c2_%d",i),1000,600); h2[i] = new TH1F(Form("h2_%d",i),Form("Z_{ECAL}=%dmm, B_{ESD}=-0.18T, H_{DIOBLK}=20cm",(1500+i*100)),20,50,90); h2[i]->SetXTitle("Initial Momentum [MeV/c]"); h2[i]->SetYTitle("Absolute #Omega [/(2MeV)]"); //tree2[i] = (TTree*)file2[i]->Get("CaloHits"); c2[i]->cd(); tree2[i]->Draw(Form("TMath::Sqrt(iniPx*iniPx+iniPy*iniPy+iniPz*iniPz)>>h2_%d",i), "sumE>0.5&&TMath::Abs(iniX-6800)<110&&TMath::Abs(iniY)<110&&TMath::Sqrt(iniPx*iniPx+iniPy*iniPy+iniPz*iniPz)>49.9"); h2[i]->Scale(1./scale); for (Int_t j=0;j<40;j++) { h2[i]->SetBinError(j+1,h2[i]->GetBinError(j+1)/scale); } h2[i]->SetMarkerStyle(22); h2[i]->SetMarkerColor(mcolor[i]); h2[i]->SetMarkerSize(1.3); h2[i]->Draw("EP"); c3[i] = new TCanvas(Form("c3_%d",i),Form("c3_%d",i),1000,600); h3[i] = new TH1F(Form("h3_%d",i),Form("Z_{ECAL}=%dmm, B_{ESD}=-0.185T, H_{DIOBLK}=20cm",(1500+i*100)),20,50,90); h3[i]->SetXTitle("Initial Momentum [MeV/c]"); h3[i]->SetYTitle("Absolute #Omega [/(2MeV)]"); c3[i]->cd(); tree3[i]->Draw(Form("TMath::Sqrt(iniPx*iniPx+iniPy*iniPy+iniPz*iniPz)>>h3_%d",i), "sumE>0.5&&TMath::Abs(iniX-6800)<110&&TMath::Abs(iniY)<110&&TMath::Sqrt(iniPx*iniPx+iniPy*iniPy+iniPz*iniPz)>49.9"); h3[i]->Scale(1./scale); for (Int_t j=0;j<40;j++) { h3[i]->SetBinError(j+1,h3[i]->GetBinError(j+1)/scale); } h3[i]->SetMarkerStyle(26); h3[i]->SetMarkerColor(mcolor[i]); h3[i]->SetMarkerSize(1.3); h3[i]->Draw("EP"); } gStyle->SetPadGridX("true"); gStyle->SetPadGridY("true"); TCanvas *canv = new TCanvas("canv","canv",1000,550); canv->cd(); TH1F *frame = gPad->DrawFrame(50,0,90,0.25); frame->SetXTitle("Initial Momentum [MeV/c]"); frame->SetYTitle("#Omega [/(2MeV)]"); h0[2]->Draw("EPsame"); // h0[1]->Draw("EPsame"); h0[0]->Draw("EPsame"); // h1[2]->Draw("EPsame"); // h1[1]->Draw("EPsame"); h1[0]->Draw("EPsame"); // h2[2]->Draw("EPsame"); // h2[1]->Draw("EPsame"); h2[0]->Draw("EPsame"); // h3[2]->Draw("EPsame"); // h3[1]->Draw("EPsame"); h3[0]->Draw("EPsame"); TLegend *leg = new TLegend(0.1,0.61,0.67,0.9); leg->AddEntry(h0[0],h0[0]->GetTitle(),"LP"); leg->AddEntry(h0[2],h0[2]->GetTitle(),"LP"); leg->AddEntry(h1[0],h1[0]->GetTitle(),"LP"); // leg->AddEntry(h1[2],h1[2]->GetTitle(),"LP"); leg->AddEntry(h2[0],h2[0]->GetTitle(),"LP"); // leg->AddEntry(h2[2],h2[2]->GetTitle(),"LP"); leg->AddEntry(h3[0],h3[0]->GetTitle(),"LP"); // leg->AddEntry(h3[2],h3[2]->GetTitle(),"LP"); leg->Draw(); canv->Print("ecalBKG_acceptance.eps"); }