void DrawNCLUSTER() { //=========Macro generated from canvas: r1/Energy //========= (Fri Apr 6 17:14:48 2012) by ROOT version5.28/00g TCanvas *r1 = new TCanvas("r1", "Ncluster",12,24,550,741); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); gStyle->SetFrameLineWidth(1); r1->Range(0,0,1,1); r1->SetFillColor(0); r1->SetBorderMode(0); r1->SetBorderSize(0); r1->SetTickx(1); r1->SetTicky(1); r1->SetLeftMargin(0.16); r1->SetRightMargin(0.01); r1->SetTopMargin(0.0256917); r1->SetBottomMargin(0.07692308); r1->SetFrameBorderMode(); // ------------>Primitives in pad: r1_1 TPad *r1_1 = new TPad("r1_1", "Energy_1",0.02,0.37,0.95,0.99); r1_1->Draw(); r1_1->cd(); r1_1->Range(-19,0.01,95,95); r1_1->SetFillColor(0); r1_1->SetBorderMode(0); r1_1->SetBorderSize(2); r1_1->SetTickx(1); r1_1->SetTicky(1); r1_1->SetLeftMargin(0.16); r1_1->SetRightMargin(0.01); r1_1->SetTopMargin(0.02); r1_1->SetBottomMargin(0); r1_1->SetFrameBorderMode(0); r1_1->SetFrameBorderMode(0); TH1D *he = new TH1D("he"," ",55,0,55); he->SetMinimum(0.01); he->SetMaximum(70); he->SetStats(0); he->GetXaxis()->SetTitle("E_{beam} [GeV]"); he->GetXaxis()->SetLabelFont(43); he->GetXaxis()->SetLabelSize(0); he->GetXaxis()->SetTitleFont(43); he->GetXaxis()->SetTitleSize(0); he->GetYaxis()->SetTitle("<N_{cluster}>"); he->GetYaxis()->SetLabelFont(43); he->GetYaxis()->SetTitleSize(30); he->GetYaxis()->SetLabelSize(20); he->GetYaxis()->SetTitleFont(43); he->GetYaxis()->SetTitleOffset(1.7); he->GetZaxis()->SetLabelFont(42); he->GetZaxis()->SetTitleSize(0.05); he->GetZaxis()->SetTitleFont(42); he->Draw(""); std::vector<result> resultData=readTXT(std::string("ncluster_augsep2012_electron.txt")); TGraphErrors *gre = new TGraphErrors(resultData.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); gre->SetLineColor(1); gre->SetFillStyle(1); gre->SetFillColor(1); gre->SetLineWidth(2); gre->SetMarkerColor(1); gre->SetMarkerStyle(34); gre->SetMarkerSize(1.2); for(unsigned int i=0; i<resultData.size(); i++){ gre->SetPoint(i,resultData.at(i).ebeam,resultData.at(i).ncluster); gre->SetPointError(i,0,resultData.at(i).nclusterError); } TH1F *Graph_Graph3 = new TH1F("Graph_Graph3","Graph",100,0,87.5); Graph_Graph3->SetMinimum(0); Graph_Graph3->SetMaximum(1193.483); Graph_Graph3->SetDirectory(0); Graph_Graph3->SetStats(0); Graph_Graph3->GetXaxis()->SetLabelFont(42); Graph_Graph3->GetXaxis()->SetTitleSize(0.05); Graph_Graph3->GetXaxis()->SetTitleFont(42); Graph_Graph3->GetYaxis()->SetLabelFont(42); Graph_Graph3->GetYaxis()->SetTitleSize(0.05); Graph_Graph3->GetYaxis()->SetTitleFont(42); Graph_Graph3->GetZaxis()->SetLabelFont(42); Graph_Graph3->GetZaxis()->SetTitleSize(0.05); Graph_Graph3->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph3); gre->Draw("p"); std::vector<result> resultFTFP=readTXT(std::string("ncluster_ftfp_bert_hp_electron.txt")); gre = new TGraphErrors(resultFTFP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); gre->SetFillColor(kRed-3); gre->SetMarkerColor(kRed-3); gre->SetLineWidth(2); gre->SetMarkerStyle(20); for(unsigned int i=0; i<resultFTFP.size(); i++){ gre->SetPoint(i,resultFTFP.at(i).ebeam,resultFTFP.at(i).ncluster); gre->SetPointError(i,0,resultFTFP.at(i).nclusterError); } TH1F *Graph1 = new TH1F("Graph1","Graph",100,0,87.17072); Graph1->SetMinimum(2.655724); Graph1->SetMaximum(88.56778); Graph1->SetDirectory(0); Graph1->SetStats(0); Graph1->GetXaxis()->SetLabelFont(42); Graph1->GetXaxis()->SetTitleSize(0.05); Graph1->GetXaxis()->SetTitleFont(42); Graph1->GetYaxis()->SetLabelFont(42); Graph1->GetYaxis()->SetTitleSize(0.05); Graph1->GetYaxis()->SetTitleFont(42); Graph1->GetZaxis()->SetLabelFont(42); Graph1->GetZaxis()->SetTitleSize(0.05); Graph1->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph1); gre->Draw("p"); std::vector<result> resultQGSP=readTXT(std::string("ncluster_qgsp_bert_hp_electron.txt")); gre = new TGraphErrors(resultQGSP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); gre->SetFillColor(kBlue-6); gre->SetMarkerColor(kBlue-6); gre->SetLineWidth(2); gre->SetMarkerStyle(25); for(unsigned int i=0; i<resultQGSP.size(); i++){ gre->SetPoint(i,resultQGSP.at(i).ebeam,resultQGSP.at(i).ncluster); gre->SetPointError(i,0,resultQGSP.at(i).nclusterError); } TH1F *Graph_Graph2 = new TH1F("Graph_Graph2","Graph",100,0,87.5); Graph_Graph2->SetMinimum(0); Graph_Graph2->SetMaximum(1193.483); Graph_Graph2->SetDirectory(0); Graph_Graph2->SetStats(0); Graph_Graph2->GetXaxis()->SetLabelFont(42); Graph_Graph2->GetXaxis()->SetTitleSize(0.05); Graph_Graph2->GetXaxis()->SetTitleFont(42); Graph_Graph2->GetYaxis()->SetLabelFont(42); Graph_Graph2->GetYaxis()->SetTitleSize(0.05); Graph_Graph2->GetYaxis()->SetTitleFont(42); Graph_Graph2->GetZaxis()->SetLabelFont(42); Graph_Graph2->GetZaxis()->SetTitleSize(0.05); Graph_Graph2->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph2); gre->Draw("p"); TLegend *leg = new TLegend(0.15,0.7,0.75,0.9,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextFont(62); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(0); TLegendEntry *entry=leg->AddEntry("Graph_Graph3","SDHCAL DATA (H6 Cern SPS)","p"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(34); entry->SetMarkerSize(1.2); entry=leg->AddEntry("Graph1","FTFP_BERT_HP","p"); entry->SetLineColor(kRed-3); entry->SetLineStyle(kRed-3); entry->SetLineWidth(kRed-3); entry->SetMarkerColor(kRed-3); entry->SetMarkerStyle(20); entry->SetMarkerSize(1.0); entry=leg->AddEntry("Graph_Graph2","QGSP_BERT_HP","p"); entry->SetLineColor(kBlue-6); entry->SetLineStyle(kBlue-6); entry->SetLineWidth(kBlue-6); entry->SetMarkerColor(kBlue-6); entry->SetMarkerStyle(25); entry->SetMarkerSize(0.9); leg->Draw(); TText *tex=new TText(); tex->SetTextSize(0.05); tex->SetTextColor(kGray+2); //tex->DrawTextNDC(0.5,0.05,"SDHCAL Preliminary"); tex->DrawTextNDC(0.3,0.05,"CALICE Fe-SDHCAL Preliminary"); r1_1->Modified(); r1->cd(); // ------------>Primitives in pad: r1_2 TPad *r1_2 = new TPad("r1_2", "Energy_2",0.02,0.0,0.95,0.38); r1_2->Draw(); r1_2->cd(); r1_2->Range(-19,-0.06545455,95,0.048); r1_2->SetFillColor(0); r1_2->SetBorderMode(0); r1_2->SetBorderSize(2); r1_2->SetTickx(1); r1_2->SetTicky(1); r1_2->SetLeftMargin(0.16); r1_2->SetRightMargin(0.01); r1_2->SetTopMargin(0.0); r1_2->SetBottomMargin(0.23); r1_2->SetFrameBorderMode(0); r1_2->SetFrameBorderMode(0); TH1D *hd = new TH1D("hd"," ",55,0,55); hd->SetMinimum(-0.20); hd->SetMaximum(0.20); hd->SetStats(0); hd->GetXaxis()->SetTitle("E_{beam} [GeV]"); hd->GetXaxis()->SetLabelFont(43); hd->GetXaxis()->SetLabelSize(20); hd->GetXaxis()->SetTitleFont(43); hd->GetXaxis()->SetTitleSize(30); hd->GetXaxis()->SetTitleOffset(2.); hd->GetYaxis()->SetTitle("(#DeltaN_{cluster})/N_{data}"); hd->GetYaxis()->SetLabelFont(43); hd->GetYaxis()->SetLabelSize(20); hd->GetYaxis()->SetTitleSize(30); hd->GetYaxis()->SetTitleOffset(1.7); hd->GetYaxis()->SetTitleFont(43); hd->GetYaxis()->SetNdivisions(505); hd->GetZaxis()->SetLabelFont(42); hd->GetZaxis()->SetTitleSize(0.05); hd->GetZaxis()->SetTitleFont(42); hd->Draw(""); float deltaError; float delta; gre = new TGraphErrors(resultQGSP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); for(unsigned int i=0; i<resultQGSP.size(); i++){ delta=(resultQGSP.at(i).ncluster-resultData.at(i).ncluster)/resultData.at(i).ncluster; deltaError=1/resultData.at(i).ncluster* sqrt(pow(resultQGSP.at(i).nclusterError,2) + pow(resultQGSP.at(i).ncluster/resultData.at(i).ncluster*resultData.at(i).nclusterError,2)); gre->SetPoint(i,resultQGSP.at(i).ebeam,delta); gre->SetPointError(i,0,deltaError); } gre->SetLineWidth(2); gre->SetLineColor(kBlue-6); gre->SetMarkerColor(kBlue-6); gre->SetMarkerSize(1.0); gre->SetMarkerStyle(25); gre->Draw("p"); gre = new TGraphErrors(resultFTFP.size()); gre->SetName("Graph"); gre->SetTitle("Graph"); for(unsigned int i=0; i<resultFTFP.size(); i++){ delta=(resultFTFP.at(i).ncluster-resultData.at(i).ncluster)/resultData.at(i).ncluster; deltaError=1/resultData.at(i).ncluster* sqrt(pow(resultFTFP.at(i).nclusterError,2) + pow(resultFTFP.at(i).ncluster/resultData.at(i).ncluster*resultData.at(i).nclusterError,2)); gre->SetPoint(i,resultFTFP.at(i).ebeam,delta); gre->SetPointError(i,0,deltaError); } gre->SetLineWidth(2); gre->SetLineColor(kRed-3); gre->SetMarkerColor(kRed-3); gre->SetMarkerSize(1.0); gre->SetMarkerStyle(20); gre->Draw("p"); TF1 *lin1 = new TF1("lin1","0",-0.01,95); lin1->SetFillColor(19); lin1->SetFillStyle(0); lin1->SetLineWidth(1); lin1->SetLineStyle(1); lin1->SetLineColor(1); lin1->GetXaxis()->SetLabelFont(42); lin1->GetXaxis()->SetTitleSize(0.05); lin1->GetXaxis()->SetTitleFont(42); lin1->GetYaxis()->SetLabelFont(42); lin1->GetYaxis()->SetTitleSize(0.05); lin1->GetYaxis()->SetTitleFont(42); lin1->Draw("same"); lin1 = new TF1("lin1","0.1",0.01,95); lin1->SetFillColor(1); lin1->SetFillStyle(0); lin1->SetLineWidth(1); lin1->SetLineStyle(2); lin1->SetLineColor(17); lin1->GetXaxis()->SetLabelFont(42); lin1->GetXaxis()->SetTitleSize(0.05); lin1->GetXaxis()->SetTitleFont(42); lin1->GetYaxis()->SetLabelFont(42); lin1->GetYaxis()->SetTitleSize(0.05); lin1->GetYaxis()->SetTitleFont(42); lin1->Draw("same"); lin1 = new TF1("lin1","-0.1",0.01,95); lin1->SetFillColor(1); lin1->SetFillStyle(0); lin1->SetLineWidth(1); lin1->SetLineStyle(2); lin1->SetLineColor(17); lin1->GetXaxis()->SetLabelFont(42); lin1->GetXaxis()->SetTitleSize(0.05); lin1->GetXaxis()->SetTitleFont(42); lin1->GetYaxis()->SetLabelFont(42); lin1->GetYaxis()->SetTitleSize(0.05); lin1->GetYaxis()->SetTitleFont(42); lin1->Draw("same"); r1_2->Modified(); r1->cd(); r1->Modified(); r1->cd(); r1->SetSelected(r1); r1->SaveAs("../plots/NCLUSTERELECTRON.pdf"); }
void makeNice(TString fileName, TString nice = "nicePlot"){ TFile *f = TFile::Open(fileName); // TFile *f = TFile::Open("out_Parameters_bkg1_3vtx.root"); TGraphErrors * gRgre = (TGraphErrors*)f->Get("gR"); TGraphErrors * gXgre = (TGraphErrors*)f->Get("gX"); TGraphErrors * gYgre = (TGraphErrors*)f->Get("gY"); TGraphErrors * rRgre = (TGraphErrors*)f->Get("rR"); TGraphErrors * rXgre = (TGraphErrors*)f->Get("rX"); TGraphErrors * rYgre = (TGraphErrors*)f->Get("rY"); //=========Macro generated from canvas: c1_n2/c1_n2 //========= (Fri May 27 11:43:08 2011) by ROOT version5.27/06b TCanvas *c1_n2 = new TCanvas("c1_n2","c1_n2",700,1500); gStyle->SetOptFit(0); gStyle->SetOptStat(0); c1_n2->Range(0,0,1,1); c1_n2->SetFillColor(0); c1_n2->SetBorderMode(0); c1_n2->SetBorderSize(2); c1_n2->SetTickx(1); c1_n2->SetTicky(1); c1_n2->SetLeftMargin(0.13); c1_n2->SetRightMargin(0.05); c1_n2->SetTopMargin(0.05); c1_n2->SetBottomMargin(0.13); c1_n2->SetFrameFillStyle(0); c1_n2->SetFrameBorderMode(0); // ------------>Primitives in pad: c1_n2_1 TPad *c1_n2_1 = new TPad("c1_n2_1", "c1_n2_1",0.01,0.67,0.99,0.99); c1_n2_1->Draw(); c1_n2_1->cd(); c1_n2_1->Range(-52.68293,-0.03170732,44.87805,0.2121951); c1_n2_1->SetFillColor(0); c1_n2_1->SetBorderMode(0); c1_n2_1->SetBorderSize(2); c1_n2_1->SetTickx(1); c1_n2_1->SetTicky(1); c1_n2_1->SetLeftMargin(0.12); c1_n2_1->SetRightMargin(0.02); c1_n2_1->SetTopMargin(0.05); c1_n2_1->SetBottomMargin(0.2); c1_n2_1->SetFrameFillStyle(0); c1_n2_1->SetFrameBorderMode(0); c1_n2_1->SetFrameFillStyle(0); c1_n2_1->SetFrameBorderMode(0); TH1D *PLOTTERX = new TH1D("PLOTTERX","",1,-40,40); PLOTTERX->SetMinimum(-0.19); PLOTTERX->SetMaximum(+0.19); PLOTTERX->SetFillColor(63); PLOTTERX->SetLineStyle(0); PLOTTERX->SetMarkerStyle(20); PLOTTERX->GetXaxis()->SetLabelFont(42); PLOTTERX->GetXaxis()->SetLabelOffset(0.007); PLOTTERX->GetXaxis()->SetLabelSize(0.09); PLOTTERX->GetXaxis()->SetTitleSize(0.1); PLOTTERX->GetXaxis()->SetTitleOffset(0.9); PLOTTERX->GetXaxis()->SetTitleFont(42); PLOTTERX->GetXaxis()->SetTitle("z [cm]"); PLOTTERX->GetYaxis()->SetNdivisions(505); PLOTTERX->GetYaxis()->SetTitle("x_{0} [cm] "); PLOTTERX->GetYaxis()->SetLabelFont(42); PLOTTERX->GetYaxis()->SetLabelOffset(0.007); PLOTTERX->GetYaxis()->SetLabelSize(0.09); PLOTTERX->GetYaxis()->SetTitleSize(0.1); PLOTTERX->GetYaxis()->SetTitleOffset(0.5); PLOTTERX->GetYaxis()->SetTitleFont(42); PLOTTERX->GetZaxis()->SetLabelFont(42); PLOTTERX->GetZaxis()->SetLabelOffset(0.007); PLOTTERX->GetZaxis()->SetLabelSize(0.05); PLOTTERX->GetZaxis()->SetTitleSize(0.06); PLOTTERX->GetZaxis()->SetTitleFont(42); PLOTTERX->Draw(""); gXgre->SetFillColor(kBlack); gXgre->SetMarkerStyle(20); gXgre->SetMarkerColor(kBlack); gXgre->SetLineColor(kBlack); gXgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel... gXgre->GetListOfFunctions()->RemoveLast(); //...and old fit gXgre->SetLineWidth(2); gXgre->Draw("P"); rXgre->SetFillColor(kBlue); rXgre->SetMarkerStyle(20); rXgre->SetMarkerColor(kBlue); rXgre->SetLineColor(kBlue); rXgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel... rXgre->GetListOfFunctions()->RemoveLast(); //...and old fit rXgre->SetLineWidth(2); rXgre->Draw("P"); TLatex *CMSPrel = new TLatex(-37.0,PLOTTERX->GetMaximum()-0.025,"CMS Preliminary 2011"); CMSPrel->SetTextSize(0.06); // CMSPrel->Draw(); c1_n2_1->Modified(); c1_n2->cd(); // ------------>Primitives in pad: c1_n2_2 TPad *c1_n2_2 = new TPad("c1_n2_1", "c1_n2_1",0.01,0.34,0.99,0.66); // TPad *c1_n2_1 = new TPad("c1_n2_1", "c1_n2_1",0.01,0.01,0.99,0.33); c1_n2_2->Draw(); c1_n2_2->cd(); c1_n2_2->Range(-52.68293,-0.3317073,44.87805,-0.08780488); c1_n2_2->SetFillColor(0); c1_n2_2->SetBorderMode(0); c1_n2_2->SetBorderSize(2); c1_n2_2->SetTickx(1); c1_n2_2->SetTicky(1); c1_n2_2->SetLeftMargin(0.12); c1_n2_2->SetRightMargin(0.02); c1_n2_2->SetTopMargin(0.05); c1_n2_2->SetBottomMargin(0.2); c1_n2_2->SetFrameFillStyle(0); c1_n2_2->SetFrameBorderMode(0); c1_n2_2->SetFrameFillStyle(0); c1_n2_2->SetFrameBorderMode(0); TH1D *PLOTTERY = new TH1D("PLOTTERY","",1,-40,40); PLOTTERY->SetMinimum(-0.29); PLOTTERY->SetMaximum(+0.09); PLOTTERY->SetFillColor(63); PLOTTERY->SetLineStyle(0); PLOTTERY->SetMarkerStyle(20); PLOTTERY->GetXaxis()->SetLabelFont(42); PLOTTERY->GetXaxis()->SetLabelOffset(0.007); PLOTTERY->GetXaxis()->SetLabelSize(0.09); PLOTTERY->GetXaxis()->SetTitleSize(0.1); PLOTTERY->GetXaxis()->SetTitleFont(42); PLOTTERY->GetXaxis()->SetTitleOffset(0.9); PLOTTERY->GetXaxis()->SetTitle("z [cm]"); PLOTTERY->GetYaxis()->SetNdivisions(505); PLOTTERY->GetYaxis()->SetTitle("y_{0} [cm] "); PLOTTERY->GetYaxis()->SetLabelFont(42); PLOTTERY->GetYaxis()->SetLabelOffset(0.007); PLOTTERY->GetYaxis()->SetLabelSize(0.09); PLOTTERY->GetYaxis()->SetTitleSize(0.1); PLOTTERY->GetYaxis()->SetTitleOffset(0.5); PLOTTERY->GetYaxis()->SetTitleFont(42); PLOTTERY->GetZaxis()->SetLabelFont(42); PLOTTERY->GetZaxis()->SetLabelOffset(0.007); PLOTTERY->GetZaxis()->SetLabelSize(0.05); PLOTTERY->GetZaxis()->SetTitleSize(0.06); PLOTTERY->GetZaxis()->SetTitleFont(42); PLOTTERY->Draw(""); gYgre->SetFillColor(kBlack); gYgre->SetMarkerStyle(20); gYgre->SetMarkerColor(kBlack); gYgre->SetLineColor(kBlack); gYgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel... gYgre->GetListOfFunctions()->RemoveLast(); //...and old fit gYgre->SetLineWidth(2); gYgre->Draw("P"); rYgre->SetFillColor(kBlue); rYgre->SetMarkerStyle(20); rYgre->SetMarkerColor(kBlue); rYgre->SetLineColor(kBlue); rYgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel... rYgre->GetListOfFunctions()->RemoveLast(); //...and old fit rYgre->SetLineWidth(2); rYgre->Draw("P"); TLatex *CMSPrel = new TLatex(-37.0,PLOTTERY->GetMaximum()-0.025,"CMS Preliminary 2011"); CMSPrel->SetTextSize(0.06); // CMSPrel->Draw(); c1_n2_2->Modified(); c1_n2->cd(); // ------------>Primitives in pad: c1_n2_2 TPad *c1_n2_3 = new TPad("c1_n2_1", "c1_n2_1",0.01,0.01,0.99,0.33); // TPad *c1_n2_1 = new TPad("c1_n2_1", "c1_n2_1",0.01,0.01,0.99,0.33); c1_n2_3->Draw(); c1_n2_3->cd(); c1_n2_3->Range(-52.68293,-0.3317073,44.87805,-0.08780488); c1_n2_3->SetFillColor(0); c1_n2_3->SetBorderMode(0); c1_n2_3->SetBorderSize(2); c1_n2_3->SetTickx(1); c1_n2_3->SetTicky(1); c1_n2_3->SetLeftMargin(0.12); c1_n2_3->SetRightMargin(0.02); c1_n2_3->SetTopMargin(0.05); c1_n2_3->SetBottomMargin(0.2); c1_n2_3->SetFrameFillStyle(0); c1_n2_3->SetFrameBorderMode(0); c1_n2_3->SetFrameFillStyle(0); c1_n2_3->SetFrameBorderMode(0); TH1D *PLOTTERR = new TH1D("PLOTTERR","",1,-40,40); PLOTTERR->SetMinimum(2.87); PLOTTERR->SetMaximum(2.97); PLOTTERR->SetFillColor(63); PLOTTERR->SetLineStyle(0); PLOTTERR->SetMarkerStyle(20); PLOTTERR->GetXaxis()->SetLabelFont(42); PLOTTERR->GetXaxis()->SetLabelOffset(0.007); PLOTTERR->GetXaxis()->SetLabelSize(0.09); PLOTTERR->GetXaxis()->SetTitleSize(0.1); PLOTTERR->GetXaxis()->SetTitleFont(42); PLOTTERR->GetXaxis()->SetTitleOffset(0.9); PLOTTERR->GetXaxis()->SetTitle("z [cm]"); PLOTTERR->GetYaxis()->SetNdivisions(505); PLOTTERR->GetYaxis()->SetTitle("R [cm] "); PLOTTERR->GetYaxis()->SetLabelFont(42); PLOTTERR->GetYaxis()->SetLabelOffset(0.007); PLOTTERR->GetYaxis()->SetLabelSize(0.09); PLOTTERR->GetYaxis()->SetTitleSize(0.1); PLOTTERR->GetYaxis()->SetTitleOffset(0.5); PLOTTERR->GetYaxis()->SetTitleFont(42); PLOTTERR->GetZaxis()->SetLabelFont(42); PLOTTERR->GetZaxis()->SetLabelOffset(0.007); PLOTTERR->GetZaxis()->SetLabelSize(0.05); PLOTTERR->GetZaxis()->SetTitleSize(0.06); PLOTTERR->GetZaxis()->SetTitleFont(42); PLOTTERR->Draw(""); gRgre->SetFillColor(kBlack); gRgre->SetMarkerStyle(20); gRgre->SetMarkerColor(kBlack); gRgre->SetLineColor(kBlack); gRgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel... gRgre->GetListOfFunctions()->RemoveLast(); //...and old fit gRgre->SetLineWidth(2); gRgre->Draw("P"); rRgre->SetFillColor(kBlue); rRgre->SetMarkerStyle(20); rRgre->SetMarkerColor(kBlue); rRgre->SetLineColor(kBlue); rRgre->GetListOfFunctions()->RemoveLast(); //to remove parameters panel... rRgre->GetListOfFunctions()->RemoveLast(); //...and old fit rRgre->SetLineWidth(2); rRgre->Draw("P"); TLatex *CMSPrel = new TLatex(-37.0,PLOTTERR->GetMaximum()-0.025,"CMS Preliminary 2011"); CMSPrel->SetTextSize(0.06); // CMSPrel->Draw(); c1_n2_3->Modified(); c1_n2->cd(); TF1* fX = new TF1("fX", "[0]+[1]*x", -35, 35); TF1* fY = new TF1("fY", "[0]+[1]*x", -35, 35); TF1* fR = new TF1("fR", "[0]+[1]*x", -35, 35); fX->SetParameter(0, 0.1); fX->SetParameter(1, -0.0007); fY->SetParameter(0, -0.2); fY->SetParameter(1, +0.0007); fR->SetParameter(0, 2.94); fR->SetParameter(1, 0.0); gXgre->Fit(fX); gYgre->Fit(fY); gRgre->Fit(fR); // c1_n2->cd(); c1_n2->Modified(); c1_n2->cd(); c1_n2->SetSelected(c1_n2); c1_n2->SaveAs(nice+".png"); //!Serve!!!! c1_n2->SaveAs(nice+".gif"); c1_n2->SaveAs(nice+".png"); }
void TreeReader::Loop() { if (fChain == 0) return; fChain->SetBranchStatus("*",0); // disable all branches fChain->SetBranchStatus("Photons",1); // activate branchname fChain->SetBranchStatus("firstContact",1); // activate branchname Long64_t nentries = fChain->GetEntriesFast(); // create Histos TCanvas* c1 = new TCanvas(); c1->SetLogy(); c1->SetLeftMargin(0.16); c1->SetBottomMargin(0.16); cout << "ok1"<< std::endl; TH1D* histEdep = new TH1D("histo_edep", "Energy deposition [keVee]", 60, 0, 600); TH1D* histEdep_full = new TH1D("histEdep_full", "", 600, 0, 6.); TH1D* histTiming = new TH1D("histo_time", "Entime", 100, 0, 200); TH1D *histEdep2 = new TH1D("histEdep2","Energy deposition [keVee]",60,0,600); cout << "ok2"<< std::endl; Long64_t nbytes = 0, nb = 0; for (Long64_t jentry=0; jentry<nentries;jentry++) { Long64_t ientry = LoadTree(jentry); if (ientry < 0) break; nb = fChain->GetEntry(jentry); nbytes += nb; histEdep_full->Fill(Photons/1000); if(Photons<=600) { histEdep->Fill(Photons); histTiming->Fill(firstContact); } } cout << "ok3"<< std::endl; //3,4*10**-10 => 29 double total=1000000; double scale = 1./total*29*0.55*60; //histEdep->GetYaxis()->SetRangeUser(0.001, 100.); histEdep->Scale(scale); histEdep->GetXaxis()->SetTitle("energy deposition [keVee]"); histEdep->GetXaxis()->CenterTitle(true); histEdep->GetXaxis()->SetNdivisions(506); histEdep->GetXaxis()->SetLabelFont(42); histEdep->GetXaxis()->SetLabelSize(0.06); histEdep->GetXaxis()->SetTitleSize(0.06); histEdep->GetXaxis()->SetTitleFont(42); histEdep->GetYaxis()->SetTitle("count / 10 keVee / 60 days"); histEdep->GetYaxis()->CenterTitle(true); histEdep->GetYaxis()->SetNdivisions(506); histEdep->GetYaxis()->SetLabelFont(42); histEdep->GetYaxis()->SetLabelSize(0.06); histEdep->GetYaxis()->SetTitleSize(0.06); histEdep->GetYaxis()->SetTitleOffset(1.05); histEdep->GetYaxis()->SetTitleFont(42); histEdep->GetZaxis()->SetLabelFont(42); histEdep->GetZaxis()->SetLabelSize(0.06); histEdep->GetZaxis()->SetTitleSize(0.07); histEdep->GetZaxis()->SetTitleFont(42); histEdep->Draw(); // Legend TLegend* leg1 = new TLegend(0.5,0.7,0.9,0.9); leg1->SetBorderSize(1); leg1->AddEntry(histEdep,"Geant4 non-linear and 5 #mus cutoff","l"); leg1->Draw("same"); //################ TCanvas* c2 = new TCanvas(); c2->SetLogy(); c2->SetLeftMargin(0.16); c2->SetBottomMargin(0.16); histEdep_full->Scale(scale); histEdep_full->GetXaxis()->SetTitle("energy deposition [MeVee]"); histEdep_full->GetXaxis()->CenterTitle(true); histEdep_full->GetXaxis()->SetNdivisions(506); histEdep_full->GetXaxis()->SetLabelFont(42); histEdep_full->GetXaxis()->SetLabelSize(0.06); histEdep_full->GetXaxis()->SetTitleSize(0.06); histEdep_full->GetXaxis()->SetTitleFont(42); histEdep_full->GetYaxis()->SetTitle("count / 10 keVee / 60 days"); histEdep_full->GetYaxis()->CenterTitle(true); histEdep_full->GetYaxis()->SetNdivisions(506); histEdep_full->GetYaxis()->SetLabelFont(42); histEdep_full->GetYaxis()->SetLabelSize(0.06); histEdep_full->GetYaxis()->SetTitleSize(0.06); histEdep_full->GetYaxis()->SetTitleOffset(1.05); histEdep_full->GetYaxis()->SetTitleFont(42); histEdep_full->GetZaxis()->SetLabelFont(42); histEdep_full->GetZaxis()->SetLabelSize(0.06); histEdep_full->GetZaxis()->SetTitleSize(0.07); histEdep_full->GetZaxis()->SetTitleFont(42); histEdep_full->Draw(); double values[] ={ 0,0,0,0.00,13.91,11.93,10.66,8.84,8.07,6.33,5.55,5.10,4.35,4.11,3.61,3.03,2.69,2.16,2.26,1.89,1.86,1.50,1.46,1.65,1.25,1.01,0.98,0.74,0.66,0.62,0.55,0.51,0.54,0.42, 0.49,0.33,0.32,0.26,0.28,0.27,0.26,0.17,0.20, 0.19, 0.18, 0.21, 0.19, 0.18, 0.14, 0.09, 0.19, 0.14, 0.12, 0.10, 0.08, 0.07, 0.12, 0.03, 0.05, 0.02, 0.05}; for(int i=1; i<=60; i++) histEdep2->SetBinContent(i,values[i]); histEdep2->SetMinimum(0.001); histEdep2->SetMaximum(100); histEdep2->SetLineColor(2); //histo_edep->Draw("same"); // Legend TLegend* leg = new TLegend(0.5,0.7,0.9,0.9); leg->SetBorderSize(1); leg->AddEntry(histEdep,"Geant4 non-linear and 5 #mus cutoff","l"); leg->Draw("same"); // Draw all //c1->Draw(); }