void ExpManager::GetSim1DGraphZ(TString NameTitle, double xmin, double xmax, double ymin, double ymax, TString grid ){ // do the same thing as for the polar interpolation TGraphErrors *fGraph = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez); fGraph->SetTitle("Simulated Data;Z (mm);Magnetic Field (mT)"); fGraph->SetMarkerSize(1.2); fGraph->SetMarkerStyle(20); fGraph->SetMarkerColor(kBlue); fGraph->SetLineColor(kBlue); fGraph->SetLineWidth(2); int graph_counter = 0 ; for (unsigned i=0; i< fExpY.size(); i++) { //cout << " X " << fExpX.at(i) ; if( (fExpX.at(i) >= xmin && fExpX.at(i) <= xmax) && (fExpY.at(i) >= ymin && fExpY.at(i) <= ymax) && fGrid.at(i)==grid ){ fGraph->SetPoint(graph_counter,fExpZ.at(i),fSimB.at(i)); fGraph->SetPointError(graph_counter,fExpZErr.at(i),0); graph_counter++; } } fGraph->SetTitle(NameTitle+Form(" Simulated Data : %.2f < X < %.2f mm __ %.2f < Y < %.2f mm;Z (mm);Magnetic Field (mT)",xmin,xmax,ymin,ymax)); fGraph->SetName(NameTitle+Form("_Sim_X_%.2f_%.2fmm_Y_%.2f_%.2fmm",xmin,xmax,ymin,ymax)); fGraph->Write(); }
//______________________________________________________________________________ // Construct a graph from vectors and y error vector TGraphErrors *LoadGraphFromVectorsWithError(vector<double> xVector, vector<double> yVector, vector<double> yErrorVector, string xTitle, string yTitle) { int n = xVector.size(); if ((xVector.size() == yVector.size()) && (yVector.size() == yErrorVector.size())) { //Create a graph TGraphErrors *gr = new TGraphErrors(n, &xVector[0], &yVector[0], 0, &yErrorVector[0]); gr->SetTitle(""); gr->SetMarkerStyle(20); gr->SetMarkerSize(1.2); gr->SetLineWidth(2); gr->GetXaxis()->SetTitle(xTitle.c_str()); gr->GetXaxis()->CenterTitle(); gr->GetYaxis()->SetTitle(yTitle.c_str()); gr->GetYaxis()->CenterTitle(); return gr; delete gr; } else { TGraphErrors *gr0 = new TGraphErrors(); return gr0; delete gr0; } }
void ExpManager::GetExp1DGraphX(TString NameTitle, double zmin, double zmax, double ymin, double ymax, TString grid){ // do the same thing as for the polar interpolation TGraphErrors *fGraph = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez); fGraph->SetTitle("Experimental Data;X (mm);Magnetic Field (mT)"); fGraph->SetMarkerSize(1.2); fGraph->SetMarkerStyle(20); fGraph->SetMarkerColor(kBlue); fGraph->SetLineColor(kBlue); fGraph->SetLineWidth(2); int graph_counter = 0 ; for (unsigned i=0; i< fExpY.size(); i++) { //cout << " X " << fExpX.at(i) ; if( (fExpY.at(i) >= ymin && fExpY.at(i) <= ymax) && (fExpZ.at(i) >= zmin && fExpZ.at(i) <= zmax) && fGrid.at(i)== grid ){ cout << " < ----- " ; fGraph->SetPoint(graph_counter,fExpX.at(i),fExpB.at(i)); // CHECK, add new the stuff for emag fGraph->SetPointError(graph_counter,fExpXErr.at(i),fExpBErr.at(i)); // CHECK, add new the stuff for emag graph_counter++; } cout << endl ; } fGraph->SetTitle(NameTitle+Form(" Experimental Data : %.2f < Depth < %.2f mm __ %.2f < Y < %.2f mm;X (mm);Magnetic Field (mT)",zmin,zmax,ymin,ymax)); fGraph->SetName(NameTitle+Form("_Exp_Depth_%.2f_%.2fmm_Y_%.2f_%.2fmm",zmin,zmax,ymin,ymax)); fGraph->Write(); }
void plot_mc(string name="g", double q2=1.9, Int_t n=0) { // SetAtlasStyle(); TGraphErrors *p; TString nn; nn.Form("ave_%s_vs_x_for_Q2=%g",name.c_str(),q2); gDirectory->GetObject(nn,p); // p->Print(); Double_t ratsize = 0.0; TCanvas *c = new TCanvas("PDF","pdf",600,600); TPad *pad1 = new TPad("pad1","pad1",0.,ratsize,1.,1.); pad1->SetLogx(); pad1->Draw(); pad1->cd(); p->GetXaxis()->Set(101,0.0001,1.); p->SetFillColor(kRed-2); p->SetFillStyle(3001); p->SetLineWidth(1); p->SetLineColor(kRed); p->GetYaxis()->SetTitle(name.c_str()); p->GetYaxis()->SetTitleSize(0.06); p->GetYaxis()->SetTitleOffset(1.); p->GetXaxis()->Set(101,0.0001,1.); p->Draw("ALE3"); Double_t av = 0; Double_t av2 = 0; for (Int_t i = 1; i<n+1 ; i++) { nn.Form("%s_vs_x_for_Q^{2}=%g_%i",name.c_str(),q2,i); TGraph *pp = NULL; gDirectory->GetObject(nn,pp); if (pp != NULL) { pp->SetLineColor(kGreen); pp->Draw("L"); av += pp->GetY()[0]; av2 += pp->GetY()[0]*pp->GetY()[0]; cout << i << " "<<pp->GetY()[0] << endl; } } av /= n; av2 = sqrt(av2/n - av*av); // cout << n << " "<<av << " "<< av2<<endl; p->Draw("E3C"); }
void ExpManager::DrawMap(TString NameTitle, double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) { TMultiGraph *mg = new TMultiGraph(); //Draw a cross TGraphErrors *frame = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez); frame->SetPoint(0,+0,+100); frame->SetPoint(1,+0,-100); frame->SetPoint(2,0,0); frame->SetPoint(3,-100,0); frame->SetPoint(4,+100,0); frame->SetPoint(5,+0,+0); frame->SetPoint(6,+0,-100); frame->SetMarkerColor(kWhite); frame->SetDrawOption("ap"); //Draw the map TGraphErrors *fGraph = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez); fGraph->SetMarkerSize(1.2); fGraph->SetMarkerStyle(20); fGraph->SetMarkerColor(kBlue); fGraph->SetLineColor(kBlue); fGraph->SetLineWidth(1); //fGraph->SetDrawOption("ap"); int graph_counter = 0 ; for (unsigned i=0; i< fExpY.size(); i++) { if( (fExpX.at(i) >= xmin && fExpX.at(i) <= xmax) && (fExpY.at(i) >= ymin && fExpY.at(i) <= ymax) && (fExpZ.at(i) >= zmin && fExpZ.at(i) <= zmax) ) { fGraph->SetPoint(graph_counter,fExpX.at(i),fExpY.at(i)); fGraph->SetPointError(graph_counter,fExpXErr.at(i),fExpYErr.at(i)); graph_counter++; } } //fGraph->Write(); mg->SetTitle(NameTitle+Form(" Map : %.2f < X < %.2f mm %.2f < Y < %.2f mm %.2f < Z < %.2f mm;X (mm);Y (mm)",xmin,xmax,ymin,ymax,zmin,zmax)); mg->SetName(NameTitle+Form("_Map__X_%.2f_%.2fmm__Y_%.2f_%.2fmm__Z_%.2f_%.2fmm",xmin,xmax,ymin,ymax,zmin,zmax)); mg->Add(frame); mg->Add(fGraph); mg->Write(); }
void ExpManager::GetExp1DGraphPolar(TString NameTitle, double zmin, double zmax, double anglemin, double anglemax, TString grid) { TGraphErrors *fGraph = new TGraphErrors(); //= new TGraph2DErrors(np, x_array, y_array, bz_array, ex, ey, ez); fGraph->SetTitle("Experimental Data;Radius (mm);Magnetic Field (mT)"); fGraph->SetMarkerSize(1.2); fGraph->SetMarkerStyle(20); fGraph->SetMarkerColor(kBlue); fGraph->SetLineColor(kBlue); fGraph->SetLineWidth(2); int graph_counter = 0 ; for (unsigned i=0; i< fExpR.size(); i++) { if( (fExpTheta.at(i) >= anglemin && fExpTheta.at(i) <= anglemax) && (fExpZ.at(i) >= zmin && fExpZ.at(i) <= zmax) && fGrid.at(i)== grid ){ fGraph->SetPoint(graph_counter,fExpR.at(i),fExpB.at(i)); fGraph->SetPointError(graph_counter,fExpRErr.at(i),fExpBErr.at(i)); graph_counter++; } } fGraph->SetTitle(NameTitle+Form(" Experimental Data : %.2f < Depth < %.2f mm __ %.2f#circ < Angle < %.2f#circ;Radius (mm);Magnetic Field (mT)",zmin,zmax,anglemin,anglemax)); fGraph->SetName(NameTitle+Form("_Exp_Depth_%.2f_%.2fmm_Angle_%.2f_%.2fdeg",zmin,zmax,anglemin,anglemax)); fGraph->Write(); }
void PlotParValVsLabelWithErr(TFile* f, TTree* tr, TString strMillepedeRes, TString strOutdir) { f->cd(); TString canvName="c_"; canvName+=strMillepedeRes; canvName+="_"; canvName+=StrPlotType(PARSwithERRvsLABEL); canvName.ReplaceAll(".res",""); TCanvas* canv = new TCanvas(canvName,canvName,900,600); canv->Divide(3,2); for (int ind=1; ind<=6; ind++){ canv->cd(ind); TPad* pad = (TPad*)canv->GetPad(ind); TString strCut="((label%20-1)%9+1)=="; strCut+=ind; int n = tr->Draw("label%700000:10000*parVal:10000*parErr:0.01*(label%700000)",strCut,"goff"); TGraphErrors *gr = new TGraphErrors(n,tr->GetV1(),tr->GetV2(),tr->GetV4(),tr->GetV3()); gr->SetMarkerStyle(20); gr->SetLineWidth(2); for (int i=0; i<n; i++){ std::cout<<tr->GetV1()[i]<<" "<<tr->GetV2()[i]<<"+-"<<tr->GetV3()[i]<<std::endl; } gr->SetTitle(StrPar(ind)+TString(", 10000*(par+-err)")); gr->GetXaxis()->SetTitle("label%700000"); gr->Draw("AP"); }// end of loop over ind canvName+=".png"; TString saveName=strOutdir+canvName; canv->SaveAs(saveName); saveName.ReplaceAll(".png",".pdf"); canv->SaveAs(saveName); }// end of PlotParValVsLabelWithErr
void getY0() { gROOT->Reset(); gROOT->LoadMacro("fitfun.C"); // fit function for localY, local Z const Int_t N = 120; //histograms to check the par2 and par3 distributions TH1D *hPar2 = new TH1D("Par2","",500,0., 5.); TH1D *hPar3 = new TH1D("Par3","",500,0., 1.); TFile *fin = new TFile("align.root"); TH2D *yLocal2D = (TH2D *)fin->Get("yLocal_all"); yLocal2D->RebinY(5); TH1D *yLocal[N]; for(int i=0;i<N;i++) { char hisname[100]; sprintf(hisname,"Tray_%d",i+1); yLocal[i] = yLocal2D->ProjectionY(hisname,i+1,i+1); yLocal[i]->Sumw2(); } TF1 *fitfun = new TF1("fitfun",fitfun,-5.,5.,5); double t[N]; double y0[N], ye[N]; gStyle->SetOptStat(101); gStyle->SetOptFit(100); gStyle->SetTextSize(0.06); gStyle->SetTextFont(42); TCanvas *c1 = new TCanvas("c1","c1",0,0,800,600); c1->SetFillColor(10); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->Divide(4,3); TPostScript *ps = new TPostScript("fig/yLocalFit.ps",112); for(int i=0;i<N;i++) { t[i] = i+1; // tray number if(i%12==0) ps->NewPage(); // 12 trays per page c1->cd(i%12+1); double par[5], err[5]; fitfun->SetParameters(0., yLocal[i]->GetBinContent(50), 0.1, 1., 0.); fitfun->SetLineWidth(2); yLocal[i]->Draw("e"); double entries = yLocal[i]->Integral(1,100); if(entries>10) { fitfun->SetParLimits(2, 1.55, 1.7); fitfun->SetParLimits(3, 0.1, 0.3); yLocal[i]->Fit("fitfun","R"); fitfun->GetParameters(&par[0]); err[0] = fitfun->GetParError(0); } else { par[0] = 0.; err[0] = 0.; } hPar2->Fill(par[2]); hPar3->Fill(par[3]); char text[100]; sprintf(text, "Y0 = %5.3f #pm %5.3f", par[0], err[0]); TLatex *tex = new TLatex(-3, par[1]/3., text); tex->SetTextSize(0.07); tex->SetTextFont(12); tex->Draw("same"); y0[i] = par[0]; ye[i] = err[0]; c1->Update(); } ps->NewPage(); gStyle->SetOptStat(0); gStyle->SetOptFit(0); gStyle->SetEndErrorSize(0.01); TCanvas *c1 = new TCanvas("c1","c1",0,0,800,600); c1->SetFillColor(10); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetLeftMargin(0.14); c1->SetBottomMargin(0.15); c1->SetTopMargin(0.02); c1->SetRightMargin(0.04); c1->Draw(); double x1 = 0.5; double x2 = 120.5; double y1 = -2.; double y2 = 2.; TH1D *h0 = new TH1D("h0","",1, x1, x2); h0->SetMinimum(y1); h0->SetMaximum(y2); h0->GetXaxis()->SetNdivisions(208); h0->GetXaxis()->CenterTitle(); h0->GetXaxis()->SetTitle("Tray #"); h0->GetXaxis()->SetTitleOffset(1.0); h0->GetXaxis()->SetTitleSize(0.07); h0->GetXaxis()->SetLabelOffset(0.01); h0->GetXaxis()->SetLabelSize(0.05); h0->GetXaxis()->SetLabelFont(42); h0->GetXaxis()->SetTitleFont(42); h0->GetYaxis()->SetNdivisions(210); h0->GetYaxis()->SetTitle("yLocal Offset"); h0->GetYaxis()->SetTitleOffset(1.0); h0->GetYaxis()->SetTitleSize(0.07); h0->GetYaxis()->SetLabelOffset(0.01); h0->GetYaxis()->SetLabelSize(0.045); h0->GetYaxis()->SetLabelFont(42); h0->GetYaxis()->SetTitleFont(42); h0->Draw(); TLine *l1 = new TLine(x1,y1,x2,y1); l1->SetLineWidth(3); l1->Draw("same"); TLine *l2 = new TLine(x1,y2,x2,y2); l2->SetLineWidth(3); l2->Draw("same"); TLine *l3 = new TLine(x1,y1,x1,y2); l3->SetLineWidth(3); l3->Draw("same"); TLine *l4 = new TLine(x2,y1,x2,y2); l4->SetLineWidth(3); l4->Draw("same"); TGraphErrors *gr = new TGraphErrors(N, t, y0, 0, ye); gr->SetMarkerStyle(20); gr->SetMarkerSize(1.5); gr->SetLineWidth(2); gr->Draw("p"); c1->Update(); ps->Close(); ofstream outData; outData.open("yOffset.dat"); for(int i=0;i<N;i++) { outData << setw(15) << y0[i] << setw(15) << ye[i] << endl; } outData.close(); TFile *fout = new TFile("yFitPar.root","recreate"); hPar2->Write(); hPar3->Write(); fout->Close(); }
v523pt_compareZb() { gROOT->Reset(); gROOT->SetStyle("MyStyle"); // gROOT->LoadMacro("v2pt_12cen_MyDef.C"); // gROOT->LoadMacro("MyDef.C"); gStyle->SetTextFont(43); gStyle->SetLabelFont(43,"x"); gStyle->SetLabelFont(43,"y"); gStyle->SetLabelFont(43,"z"); gStyle->SetTitleFont(43,"x"); gStyle->SetTitleFont(43,"y"); gStyle->SetTitleFont(43,"z"); gStyle->SetEndErrorSize(0); double textsize = 19; //int mcol[8]={kRed,kMagenta,kBlue,kCyan,kGreen,kYellow,kOrange,kGray}; int mcol[8]={kRed,kOrange+1,kBlue,kGreen+1,kCyan,kYellow,kOrange,kGray}; int mcol2[4]={6,2,4,8}; //int msty[8][2]={{20,20},{25,24},{22,22},{28,26},{29,30},{33,27},{34,28},{20,24}}; int msty[8][2]={{20,20},{21,24},{22,29},{23,30},{24,30},{25,27},{28,28},{30,24}}; //float msiz[8]={1.11,0.9,1.2,1.24,1.5,1,1,1}; float msiz[8]={1.11,1.0,1.5,1.2,1.2,1.2,1.2,1.6}; float msiz2[4]={1.5,1.5,1.5,1.5}; // // arrays // const int Mfiles=50; int ndp[Mfiles]; char *cfn[Mfiles]; char *cft[Mfiles]; const int Mpoints=40; double xa[Mfiles][Mpoints],xe[Mfiles][Mpoints]; double ya[Mfiles][Mpoints],ye[Mfiles][Mpoints]; double nxa[Mfiles][Mpoints],nxe[Mfiles][Mpoints]; double nya[Mfiles][Mpoints],nye[Mfiles][Mpoints]; double mxa[Mfiles][Mpoints],mxe[Mfiles][Mpoints]; double mya[Mfiles][Mpoints],mye[Mfiles][Mpoints]; double xesys[Mfiles][Mpoints], yesys[Mfiles][Mpoints]; double mxesys[Mfiles][Mpoints], myesys[Mfiles][Mpoints]; double aexl[Mfiles][Mpoints],aexh[Mfiles][Mpoints]; double aeyl[Mfiles][Mpoints],aeyh[Mfiles][Mpoints]; double ra[Mfiles][Mpoints],re[Mfiles][Mpoints]; const int Mpads=14; char *htit[Mpads]; char *atit[Mpads][3]; double ptit[Mpads][2]; double hxmin[Mpads],hxmax[Mpads]; double hymin[Mpads],hymax[Mpads]; double lxmin[Mpads],lxmax[Mpads]; double lymin[Mpads],lymax[Mpads]; // // Data input // char *cjob="v2pt_12cen_4x3"; int i=-1; // histogram parameter htit[0]="0-5%"; htit[1]="5-10%"; htit[2]="10-15%"; htit[3]="15-20%"; htit[4]="20-25%"; htit[5]="25-30%"; htit[6]="30-35%"; htit[7]="35-40%"; htit[8]="40-50%"; htit[9]="50-60%"; htit[10]="60-70%"; htit[11]="70-80%"; for (int ip=0;ip<Mpads;ip++) { // hxmin[ip]=0.0; hxmax[ip]=11.9; hxmin[ip]=0.0001; hxmax[ip]=4.3; hymin[ip]=-0.002; hymax[ip]=0.0219; lxmin[ip]=0.08; lxmax[ip]=0.35; lymin[ip]=0.4; lymax[ip]=0.65; ptit[ip][0]=4.0; ptit[ip][1]=0.06;// position legends atit[ip][0]="p_{T} (GeV/c)"; atit[ip][1]="v_{5}{#Psi_{23}}"; } // // Read data and create vector files // double sysXYZ[12]; double sysEach[12]; double tmp; const int nw=12; const int npt=20; ifstream inEP; inEP.open("../outv523_corrFlow.txt"); for(int i=0; i<nw-2; i++){ sysXYZ[i]=6; sysEach[i]=0.0002; inEP>>tmp; inEP>>tmp; for(int j=0; j<npt; j++){ inEP>>tmp; inEP>>tmp; inEP>>xa[i][j]; inEP>>tmp; inEP>>ya[i][j]; inEP>>ye[i][j]; //inEP>>xa[i][j]; inEP>>ya[i][j]; inEP>>ye[i][j]; inEP>>tmp; xe[i][j]=0.0; xesys[i][j]=0.2; yesys[i][j]=sqrt(sysEach[i]*sysEach[i] + (ya[i][j]*sysXYZ[i]*0.01)*(ya[i][j]*sysXYZ[i]*0.01)); } } inEP.close(); ifstream inSP; inSP.open("/Users/shengquantuo/Downloads/tmp3/figures_-0.8_00.8/outv523steve.txt"); for(int i=0; i<nw-2; i++){ for(int j=0; j<npt-2; j++){ inSP>>mxa[i][j]; inSP>>mya[i][j]; inSP>>mye[i][j]; mxe[i][j]=0.0; mxesys[i][j]=0.2; myesys[i][j]=sqrt(sysEach[i]*sysEach[i] + (mya[i][j]*sysXYZ[i]*0.01)*(mya[i][j]*sysXYZ[i]*0.01)); } } inSP.close(); for(int i=0; i<nw-2; i++){ cout<<"sys for cent: "<<i<<endl; for(int j=0; j<10; j++){ cout<<nxa[i][j]<<" "<<fabs(ya[i][j]-nya[i][j])/fabs(ya[i][j])<<endl; } } TCanvas *can=new TCanvas("can","can",10,10,1050*0.9,800*0.85); can->Divide(4,3,0,0); //sticks the pads with no space inbetween TH1D *h1[nw]; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); if(iw==3||iw==7||iw==11) gPad->SetRightMargin(0.02); char ch1[8]; sprintf(ch1,"h1_%d",iw); h1[iw] = new TH1D(ch1,"",500,hxmin[iw],hxmax[iw]); h1[iw]->SetMinimum(hymin[iw]); h1[iw]->SetMaximum(hymax[iw]); h1[iw]->SetXTitle(atit[iw][0]); h1[iw]->SetYTitle(atit[iw][1]); h1[iw]->GetXaxis()->CenterTitle(1); h1[iw]->GetYaxis()->CenterTitle(1); // futz with the axes h1[iw]->GetYaxis()->SetNdivisions(606); h1[iw]->GetXaxis()->SetNdivisions(606); h1[iw]->GetYaxis()->SetTitleSize(textsize); h1[iw]->GetYaxis()->SetTitleOffset(3.5); h1[iw]->GetYaxis()->SetLabelSize(textsize); h1[iw]->GetXaxis()->SetTitleSize(textsize); h1[iw]->GetXaxis()->SetTitleOffset(3.0); h1[iw]->GetXaxis()->SetLabelSize(textsize); // h1[iw]->GetXaxis()->SetLabelOffset(1.2); h1[iw]->Draw(); } // // Draw! // cout << "Now Draw!" << endl; TGraphErrors *ge; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); // if (iw==0) { tex=new TLatex(0.7,0.05,"HIN11005 is 2.76TeV, EP"); tex->SetTextSize(textsize*0.9); //tex->Draw(); tex=new TLatex(1.5,0.07,"|#eta|<0.8"); tex->SetTextSize(textsize); //tex->Draw(); } if (iw < 4) tex=new TLatex(ptit[iw][0]*1.2,ptit[iw][1]*1.27,htit[iw]); else tex=new TLatex(ptit[iw][0]*1.2,ptit[iw][1]*1.27,htit[iw]); if ( iw == 0) tex->SetTextSize(textsize); else if (iw == 8) tex->SetTextSize(textsize); else tex->SetTextSize(textsize); tex->Draw(); // // Legend // TLegend *leg = new TLegend(lxmin[iw]*3.99,lymin[iw]*1.1,lxmax[iw]*1.99,lymax[iw]*1.2); leg->SetFillColor(0); leg->SetTextSize(textsize); // // Read data // for (int im=0;im<1;im++) { int j=im*12+iw; int col=2; //if (ndp[j]==0) continue; ge=new TGraphErrors(16,&mxa[j][0],&mya[j][0],&mxe[j][0],&mye[j][0]); drawSysBoxValue(ge,16,0.2, myesys[j]); ge->SetTitle(""); ge->SetMarkerStyle(25); // ge->SetMarkerStyle(msty[im]); ge->SetMarkerSize(msiz[im]); ge->SetMarkerColor(col); ge->SetLineWidth(1.2); ge->SetLineColor(col); ge->Draw("pe"); leg->AddEntry(ge,"v_{5}{#Psi_{23}} Steve","p"); } for (int im=0;im<1;im++) { int j=im*12+iw; int col=1; //if (ndp[j]==0) continue; ge=new TGraphErrors(19,&xa[j][0],&ya[j][0],&xe[j][0],&ye[j][0]); //drawSysBoxValue(ge,16,0.2, yesys[j]); ge->SetTitle(""); ge->SetMarkerStyle(msty[im][1]); // ge->SetMarkerStyle(msty[im]); ge->SetMarkerSize(msiz[im]); ge->SetMarkerColor(col); ge->SetLineWidth(1.2); ge->SetLineColor(col); ge->Draw("pe"); leg->AddEntry(ge,"v_{5}{#Psi_{23}} Shengquan","p"); } if (iw==0) leg->Draw(); } cout << "end of process" << endl; can->cd(); can->Print("./figures/v523_pt_ShengquanSteveb.png"); can->Print("./figures/v523_pt_ShengquanSteveb.pdf"); }
void AnalyzeClipping(TString inputWaveName = "sum trigger input ch5 960mV", TString outputWaveName = "sum trigger output ch5 - 2V clip - 960mV input", Double_t inputDelay = 1.1E-8, Double_t lowerCut = 16E-9, Double_t upperCut = 23E-9, const char *inFile = "Data.root",const char *WaveformsFile = "Waveforms.root") { //try to access data file and in case of failure return if(gSystem->AccessPathName(inFile,kFileExists)) { cout << "Error: file " << inFile << " does not exsist. Run .x DataParse.C to create it" << endl; return; } TFile *f = TFile::Open(inFile); TFolder *dataSet; TString dataFolderS = "SumTriggerBoardData"; dataFolderS.Append(";1"); dataSet = (TFolder*)f->Get(dataFolderS); cout << dataSet << endl; cout << dataSet->GetName() << endl; Int_t nScope = 150; // number of measurements done by the scope evey time //try to access waveforms file and in case of failure return if(gSystem->AccessPathName(WaveformsFile,kFileExists)) { cout << "Error: file " << WaveformsFile << " does not exsist. Run .x WaveformsFileMaker.C to create it" << endl; return; } TFile *f = TFile::Open(WaveformsFile); TList *listOfKeys = f->GetListOfKeys(); Int_t numberOfKeys = listOfKeys->GetEntries(); TList *listOfGraphs = new TList(); // if the waveform file name begins with the string "comparator" it goes in this list TList *listOfCompWaves = new TList(); // if the waveform file name begins with the string "sum output" it goes in this list TList *listOfAdderWaves = new TList(); for(Int_t i = 0; i < numberOfKeys; i++) { TString *keyName = new TString(listOfKeys->At(i)->GetName()); TTree *tree = (TTree*)f->Get(keyName->Data()); Float_t x = 0; Float_t y = 0; tree->SetBranchAddress("x",&x); tree->SetBranchAddress("y",&y); Int_t nentries = tree->GetEntries(); TString *gName = new TString(keyName->Data()); gName->Append(" graph"); TGraphErrors *gWave = new TGraphErrors(nentries); gWave->SetName(gName->Data()); gWave->SetTitle(gName->Data()); gWave->GetXaxis()->SetTitle("Time"); gWave->GetYaxis()->SetTitle("Voltage"); for (Int_t j = 0; j < nentries; j++) { tree->GetEntry(j); gWave->SetPoint(j,x,y); } listOfGraphs->Add(gWave); } // Global variables Double_t *xInput, *xOutput, *yInput, *yOutput; // V input 960 mV TString path = "Clipping/Output width analysis/Channel 5/V input 960mV/"; TGraphErrors *gClip960mV = TBGraphErrors(dataSet,path,"V clip","Output FWHM",1,nScope); gClip960mV->SetMarkerStyle(20); gClip960mV->SetMarkerSize(0.8); gClip960mV->GetXaxis()->SetTitle("V clipping (mV)"); gClip960mV->GetYaxis()->SetTitle("Output FWHM (ns)"); TCanvas *cClip960mV = new TCanvas("cClip960mV","Output FWHM in function of V clipping",800,600); gClip960mV->Draw("APEL"); // Expected output FWHM TGraphErrors *gInput960mV = listOfGraphs->FindObject("sum trigger input ch5 960mV graph"); Double_t *xClip = gClip960mV->GetX(); Int_t nClip = gClip960mV->GetN(); cout << "nClip = " << nClip << endl; Long64_t graphPoints = gInput960mV->GetN(); yInput = gInput960mV->GetY(); xInput = gInput960mV->GetX(); vector<double> xFirst(nClip); vector<double> xLast(nClip); Double_t half; Int_t flag = 0; vector<double> yConv(graphPoints); for(Int_t i = 0; i < graphPoints; i++) { yConv[i] = -(yInput[i]); yConv[i] *= 1000; if(xInput[i] + inputDelay < lowerCut || xInput[i] + inputDelay > upperCut) yConv[i] = 0; } Double_t yInput960mVMax = TMath::MaxElement(graphPoints,&yConv[0]); for(Int_t i = 0; i < nClip; i++) { if(xClip[i] > yInput960mVMax) half = yInput960mVMax; else half = xClip[i]; half /=2; cout << half << endl; flag = 0; for(Int_t j = 0; j < graphPoints - 3; j++) { if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 0) { xFirst[i] = xInput[j]; flag = 1; cout << "found first point! " << xFirst[i] << endl; continue; } if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 1) { xLast[i] = xInput[j]; cout << "found last point! " << xLast[i] << endl; break; } } } vector<double> expectedFWHM960mV(nClip); for(Int_t i = 0; i < expectedFWHM960mV.size(); i++) { expectedFWHM960mV[i] = xLast[i] - xFirst[i]; // convert from seconds to nanoseconds expectedFWHM960mV[i] *= 10E8; cout << "expectedFWHM960mV[" << i << "] = " << expectedFWHM960mV[i] << endl; } // expected FWHM 960 mV graph TGraphErrors *gExpClip960mV = new TGraphErrors(nClip,xClip,&expectedFWHM960mV[0],0,0); gExpClip960mV->SetLineStyle(7); gExpClip960mV->SetMarkerStyle(20); gExpClip960mV->SetMarkerSize(0.8); // V input 1.9 V path = "Clipping/Output width analysis/Channel 5/V input 1.9V/"; TGraphErrors *gClip1Point9V = TBGraphErrors(dataSet,path,"V clip","Output FWHM",1,nScope); gClip1Point9V->SetMarkerStyle(20); gClip1Point9V->SetMarkerSize(0.8); gClip1Point9V->SetLineColor(kRed); gClip1Point9V->GetXaxis()->SetTitle("V clipping (mV)"); gClip1Point9V->GetYaxis()->SetTitle("Output FWHM (ns)"); TCanvas *cClip1Point9V = new TCanvas("cClip1Point9V","Output FWHM in function of V clipping",800,600); gClip1Point9V->Draw("APEL"); // Expected output FWHM TGraphErrors *gInput1Point9V = listOfGraphs->FindObject("sum trigger input ch5 1900mV graph"); xClip = gClip1Point9V->GetX(); nClip = gClip1Point9V->GetN(); cout << "nClip = " << nClip << endl; graphPoints = gInput1Point9V->GetN(); yInput = gInput1Point9V->GetY(); xInput = gInput1Point9V->GetX(); vector<double> xFirst(nClip); vector<double> xLast(nClip); flag = 0; vector<double> yConv(graphPoints); for(Int_t i = 0; i < graphPoints; i++) { yConv[i] = -(yInput[i]); yConv[i] *= 1000; if(xInput[i] + inputDelay < lowerCut || xInput[i] + inputDelay > upperCut) yConv[i] = 0; } Double_t yInput1Point9VMax = TMath::MaxElement(graphPoints,&yConv[0]); for(Int_t i = 0; i < nClip; i++) { if(xClip[i] > yInput1Point9VMax) half = yInput1Point9VMax; else half = xClip[i]; half /= 2; cout << half << endl; flag = 0; for(Int_t j = 0; j < graphPoints - 3; j++) { if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 0) { xFirst[i] = xInput[j]; flag = 1; cout << "found first point! " << xFirst[i] << endl; continue; } if((yConv[j + 1] - half)*(yConv[j] - half) < 0 && flag == 1) { xLast[i] = xInput[j]; cout << "found last point! " << xLast[i] << endl; break; } } } vector<double> expectedFWHM1Point9V(nClip); for(Int_t i = 0; i < expectedFWHM1Point9V.size(); i++) { expectedFWHM1Point9V[i] = xLast[i] - xFirst[i]; // convert from seconds to nanoseconds expectedFWHM1Point9V[i] *= 10E8; cout << "expectedFWHM1Point9V[" << i << "] = " << expectedFWHM1Point9V[i] << endl; } // expected FWHM 960 mV graph TGraphErrors *gExpClip1Point9V = new TGraphErrors(nClip,xClip,&expectedFWHM1Point9V[0],0,0); gExpClip1Point9V->SetLineStyle(7); gExpClip1Point9V->SetLineColor(kRed); gExpClip1Point9V->SetMarkerStyle(20); gExpClip1Point9V->SetMarkerSize(0.8); // Collection of Output FWHM graphs, 2 amplitudes, serveral V clipping TMultiGraph *mgClipOutputFWHM = new TMultiGraph(); mgClipOutputFWHM->SetTitle("Collection of Output FWHM graphs, 2 amplitudes, serveral V clipping"); mgClipOutputFWHM->Add(gClip1Point9V); mgClipOutputFWHM->Add(gClip960mV); mgClipOutputFWHM->Add(gExpClip960mV); mgClipOutputFWHM->Add(gExpClip1Point9V); TCanvas *cmgClipOutputFWHM = new TCanvas("cmgClipOutputFWHM","Collection of Output FWHM graphs, 2 amplitudes, serveral V clipping"); mgClipOutputFWHM->Draw("APEL"); cmgClipOutputFWHM->Modified(); mgClipOutputFWHM->GetXaxis()->SetTitle("V clipping (mV)"); mgClipOutputFWHM->GetYaxis()->SetTitle("Output FWHM (ns)"); cmgClipOutputFWHM->Update(); legend = new TLegend(0.6,0.67,0.89,0.86,"V input"); legend->AddEntry(gClip1Point9V, "1.9 V", "lp"); legend->AddEntry(gClip960mV, "960 mV", "lp"); legend->AddEntry(gExpClip960mV, "Exp 960 mV", "lp"); legend->AddEntry(gExpClip1Point9V, "Exp 1.9 V", "lp"); legend->SetTextSize(0.04); legend->SetMargin(0.5); legend->Draw(); // Hysteresis plot: V output (t) in function of V input (t) for several clipping values // variables used in the analysis Long64_t iInputMax, iOutputMax; Float_t xInputMax, xOutputMax, xInputHalf, xOutputHalf; Double_t InputMax, OutputMax, InputHalf, OutputHalf; Long64_t firstIndex = 0; Long64_t lastIndex = 0; Long64_t inputGraphPoints = 0; Long64_t outputGraphPoints = 0; // hard coded values to cut the x axis of both waves // Input wave inputWaveName += " graph"; TGraphErrors *gInput = listOfGraphs->FindObject(inputWaveName); gInput->SetLineColor(kRed); gInput->SetLineWidth(2); xInput = gInput->GetX(); yInput = gInput->GetY(); inputGraphPoints = gInput->GetN(); cout << inputGraphPoints << endl; // Invert the input wave for(Int_t i = 0; i < inputGraphPoints; i++) { yInput[i] = -(yInput[i]); } // find the x at which the graph reaches the max value iInputMax = TMath::LocMax(inputGraphPoints, yInput); xInputMax = xInput[iInputMax]; cout << "iInputMax = " << iInputMax << endl; cout << "xInputMax = " << xInputMax << endl; InputMax = gInput->Eval(xInput[iInputMax]); cout << "InputMax = " << InputMax << endl; // Output wave outputWaveName += " graph"; TGraphErrors *gOutput = listOfGraphs->FindObject(outputWaveName); gOutput->SetLineWidth(2); xOutput = gOutput->GetX(); yOutput = gOutput->GetY(); outputGraphPoints = gOutput->GetN(); // find the x at which the graph reaches the max value iOutputMax = TMath::LocMax(outputGraphPoints, yOutput); xOutputMax = xOutput[iOutputMax]; cout << "iOutputMax = " << iOutputMax << endl; cout << "xOutputMax = " << xOutputMax << endl; OutputMax = gOutput->Eval(xOutput[iOutputMax]); cout << "OutputMax = " << OutputMax << endl; // compute x delay between max points Double_t delay = xOutputMax - xInputMax; cout << "delay = " << delay << endl; // Shift the x axis of the input graph and create a new graph with only a portion of the first graph for(Int_t i = 0; i < inputGraphPoints; i++) { xInput[i] += inputDelay; if(xInput[i] >= lowerCut) { if(firstIndex == 0) firstIndex = i; } if(xInput[i] <= upperCut) lastIndex = i; } cout << "firstIndex = " << firstIndex << endl; cout << "lastIndex = " << lastIndex << endl; cout << "xInput[firstIndex] = " << xInput[firstIndex] << endl; cout << lastIndex - firstIndex << endl; Long64_t input2GraphPoints = lastIndex - firstIndex; TGraphErrors *gInput2 = new TGraphErrors(input2GraphPoints); gInput2->SetTitle(inputWaveName); for(Int_t i = firstIndex; i <= lastIndex; i++) { gInput2->SetPoint(i - firstIndex,xInput[i],yInput[i]); } TCanvas *cgInput2 = new TCanvas("cgInput2", "cgInput2", 1200,800); gInput2->Draw("AL"); // create a new graph with only a portion of the first graph firstIndex = 0; lastIndex = 0; for(Int_t i = 0; i < outputGraphPoints; i++) { if(xOutput[i] >= lowerCut) { if(firstIndex == 0) firstIndex = i; } if(xOutput[i] <= upperCut) lastIndex = i; } cout << "firstIndex = " << firstIndex << endl; cout << "lastIndex = " << lastIndex << endl; cout << "xOutput[firstIndex] = " << xOutput[firstIndex] << endl; cout << lastIndex - firstIndex << endl; Long64_t output2GraphPoints = lastIndex - firstIndex; TGraphErrors *gOutput2 = new TGraphErrors(output2GraphPoints); gOutput2->SetTitle(outputWaveName); for(Int_t i = firstIndex; i <= lastIndex; i++) { gOutput2->SetPoint(i - firstIndex,xOutput[i],yOutput[i]); } TCanvas *cgOutput2 = new TCanvas("cgOutput2", "cgOutput2", 1200,800); gOutput2->Draw("AL"); // first hysteresis plot Double_t step; Double_t *xInput2; xInput2 = gInput2->GetX(); cout << "xInput2[input2GraphPoints - 1] = " << xInput2[input2GraphPoints - 1] << endl; cout << "xInput2[0] = " << xInput2[0] << endl; step = (xInput2[input2GraphPoints - 1] - xInput2[0])/output2GraphPoints; cout << "step = " << step << endl; // in case gInput2 and gOutput2 contain a different number of points create the hysteresis plot with gOutput2 points // and modify the yInput2 to match the number of points of yOutput2 vector<double> yInput2; for(Int_t i = 0; i < output2GraphPoints; i++) { yInput2.push_back(gInput2->Eval(xInput2[0] + i*step)); } Double_t *yOutput2; yOutput2 = gOutput2->GetY(); TGraphErrors *gHyst = new TGraphErrors(output2GraphPoints, &yInput2.at(0),yOutput2); gHyst->SetTitle("Hysteresis plot"); gHyst->GetXaxis()->SetTitle("Vin(t) [mV]"); gHyst->GetYaxis()->SetTitle("Vout(t) [mV]"); gHyst->GetYaxis()->SetTitleOffset(1.4); TCanvas *cgHyst = new TCanvas("cgHyst", "cgHyst", 1200,800); cgHyst->SetLeftMargin(0.12); gHyst->Draw("AL"); // collection of graphs TMultiGraph *mgInputOutput = new TMultiGraph(); mgInputOutput->Add(gInput); mgInputOutput->Add(gOutput); mgInputOutput->SetTitle("Input and output"); TCanvas *cmgInputOutput = new TCanvas("cmgInputOutput", "Input and output", 1200,800); mgInputOutput->Draw("AL"); cmgInputOutput->Update(); legend = new TLegend(0.65,0.68,0.86,0.86); legend->AddEntry(gInput, "Input", "lp"); legend->AddEntry(gOutput, "Output", "lp"); legend->SetMargin(0.4); legend->SetTextSize(0.04); legend->Draw(); cmgInputOutput->Modified(); }
void makeV2_DataOnly_Cen(const int flag=0) { gROOT->Reset(); const Double_t MassD = 1.865; const Double_t MassKs = 0.498; const Double_t MassPhi = 1.019; const Double_t MassLa = 1.1156; const Double_t MassXi = 1.3217; const Double_t MassOmega = 1.672; ifstream inData; // new data TFile *fin = new TFile("Systematics_D0vn_SL16d_2016-10-14.ME.root"); TGraphErrors *gr_data_0_80 = (TGraphErrors *)(fin->Get("vnStat_0_80")); gr_data_0_80->RemovePoint(0); TGraphErrors *gr_data_0_80_sys = (TGraphErrors *)(fin->Get("vnSyst_0_80")); gr_data_0_80_sys->RemovePoint(0); cout << gr_data_0_80->GetN() << endl; cout << gr_data_0_80_sys->GetN() << endl; const Double_t scale_w_Ks = 1.0; const Int_t n_data_new = 8; ////////////////////////////////////////////// // Read-in data points for 0-80% centrality ////////////////////////////////////////////// Double_t nonflow[n_data_new] = { 0.032629 , 0.0336555 , 0.0336555 , 0.033947 , 0.0346236 , 0.0353009 , 0.0361988 , 0.0382869}; // full range 0-80% Double_t x_data_new[n_data_new], y_data_new[n_data_new], ye_data_new[n_data_new], yes_data_new[n_data_new], yesL_data_new[n_data_new]; Double_t yeL_data_new[n_data_new], yeU_data_new[n_data_new]; Double_t x_mTScaled_data_new[n_data_new], yScaled_data_new[n_data_new], yeScaled_data_new[n_data_new], yesScaled_data_new[n_data_new], yesLScaled_data_new[n_data_new]; Double_t yeLScaled_data_new[n_data_new], yeUScaled_data_new[n_data_new]; for(int i=0;i<gr_data_0_80->GetN();i++) { cout << i << endl; x_data_new[i] = gr_data_0_80->GetX()[i]; y_data_new[i] = gr_data_0_80->GetY()[i]; ye_data_new[i] = gr_data_0_80->GetEY()[i]; yes_data_new[i] = gr_data_0_80_sys->GetEY()[i]; yesL_data_new[i] = nonflow[i]; x_mTScaled_data_new[i] = (sqrt(x_data_new[i]*x_data_new[i] + MassD*MassD) - MassD)/2; yScaled_data_new[i] = y_data_new[i]/2 * scale_w_Ks; yeScaled_data_new[i] = ye_data_new[i]/2 * scale_w_Ks; yesScaled_data_new[i] = yes_data_new[i]/2 * scale_w_Ks; yesLScaled_data_new[i] = yesL_data_new[i]/2 * scale_w_Ks; yeL_data_new[i] = sqrt(ye_data_new[i]**2+yes_data_new[i]**2+yesL_data_new[i]**2) * scale_w_Ks; yeU_data_new[i] = sqrt(ye_data_new[i]**2+yes_data_new[i]**2) * scale_w_Ks; yeLScaled_data_new[i] = yeL_data_new[i]/2 * scale_w_Ks; yeUScaled_data_new[i] = yeU_data_new[i]/2 * scale_w_Ks; } ////////////////////////////// // different centrality bins ////////////////////////////// const Int_t NCen = 3; TGraphErrors *gr_data_cen[NCen]; TGraphErrors *gr_data_cen_sys[NCen]; TGraphErrors *gr_data_mT_cen[NCen]; const Char_t *CenName[NCen] = {"40_80","10_40","0_10"}; for(int i=0;i<NCen;i++) { gr_data_cen[i] = (TGraphErrors *)(fin->Get(Form("vnStat_%s",CenName[i]))); gr_data_cen[i]->RemovePoint(0); gr_data_cen_sys[i] = (TGraphErrors *)(fin->Get(Form("vnSyst_%s",CenName[i]))); gr_data_cen_sys[i]->RemovePoint(0); } const Int_t n_data_cen = 8; Double_t nonflow_cen[NCen][n_data_cen] = {{ 0.115456 , 0.118967 , 0.118967 , 0.120065 , 0.122454 , 0.124808 , 0.128025 , 0.135539}, { 0.0210766 , 0.0217398 , 0.0217398 , 0.0219309 , 0.0223667 , 0.0228055 , 0.0233849 , 0.0247439}, { 0.0202398 , 0.0208774 , 0.0208774 , 0.0210541 , 0.0214741 , 0.021893 , 0.0224473 , 0.0237127}}; Double_t x_data_cen[NCen][n_data_cen], y_data_cen[NCen][n_data_cen], ye_data_cen[NCen][n_data_cen], yes_data_cen[NCen][n_data_cen], yesL_data_cen[NCen][n_data_cen]; Double_t yeL_data_cen[NCen][n_data_cen], yeU_data_cen[NCen][n_data_cen]; Double_t x_mTScaled_data_cen[NCen][n_data_cen], yScaled_data_cen[NCen][n_data_cen], yeScaled_data_cen[NCen][n_data_cen], yesScaled_data_cen[NCen][n_data_cen], yesLScaled_data_cen[NCen][n_data_cen]; Double_t yeLScaled_data_cen[NCen][n_data_cen], yeUScaled_data_cen[NCen][n_data_cen]; for(int ic=0;ic<NCen;ic++) { for(int i=0;i<gr_data_cen[ic]->GetN();i++) { x_data_cen[ic][i] = gr_data_cen[ic]->GetX()[i]; y_data_cen[ic][i] = gr_data_cen[ic]->GetY()[i]; ye_data_cen[ic][i] = gr_data_cen[ic]->GetEY()[i]; yes_data_cen[ic][i] = gr_data_cen_sys[ic]->GetEY()[i]; yesL_data_cen[ic][i] = nonflow_cen[ic][i]; x_mTScaled_data_cen[ic][i] = (sqrt(x_data_cen[ic][i]*x_data_cen[ic][i] + MassD*MassD) - MassD)/2; yScaled_data_cen[ic][i] = y_data_cen[ic][i]/2 * scale_w_Ks; yeScaled_data_cen[ic][i] = ye_data_cen[ic][i]/2 * scale_w_Ks; yesScaled_data_cen[ic][i] = yes_data_cen[ic][i]/2 * scale_w_Ks; yesLScaled_data_cen[ic][i] = yesL_data_cen[ic][i]/2 * scale_w_Ks; yeL_data_cen[ic][i] = sqrt(ye_data_cen[ic][i]**2+yes_data_cen[ic][i]**2+yesL_data_cen[ic][i]**2) * scale_w_Ks; yeU_data_cen[ic][i] = sqrt(ye_data_cen[ic][i]**2+yes_data_cen[ic][i]**2) * scale_w_Ks; yeLScaled_data_cen[ic][i] = yeL_data_cen[ic][i]/2 * scale_w_Ks; yeUScaled_data_cen[ic][i] = yeU_data_cen[ic][i]/2 * scale_w_Ks; } gr_data_mT_cen[ic] = new TGraphErrors(n_data_cen, x_mTScaled_data_cen[ic], yScaled_data_cen[ic], 0, yeScaled_data_cen[ic]); } cout << " Read-in D0 data done ..." << endl; /* const Int_t n_ks_cen = 19; const Int_t n_la_cen = 18; Double_t x_ks_cen[n_ks_cen], y_ks_cen[NCen][n_ks_cen], ye_ks_cen[NCen][n_ks_cen], yes_ks_cen[NCen][n_ks_cen]; Double_t x_la_cen[n_la_cen], y_la_cen[NCen][n_la_cen], ye_la_cen[NCen][n_la_cen], yes_la_cen[NCen][n_la_cen]; Double_t x_mTScaled_ks_cen[n_ks_cen], yScaled_ks_cen[NCen][n_ks_cen], yeScaled_ks_cen[NCen][n_ks_cen], yesScaled_ks_cen[NCen][n_ks_cen]; Double_t x_mTScaled_la_cen[n_la_cen], yScaled_la_cen[NCen][n_la_cen], yeScaled_la_cen[NCen][n_la_cen], yesScaled_la_cen[NCen][n_la_cen]; inData.open("Run14/ks_v2_cen_PRC77.txt"); for(int i=0;i<n_ks_cen;i++) { double a, b, c; inData >> x_ks_cen[i] >> a >> b >> c >> y_ks_cen[0][i] >> ye_ks_cen[0][i] >> yes_ks_cen[0][i] >> y_ks_cen[1][i] >> ye_ks_cen[1][i] >> yes_ks_cen[1][i] >> y_ks_cen[2][i] >> ye_ks_cen[2][i] >> yes_ks_cen[2][i]; x_mTScaled_ks_cen[i] = (sqrt(x_ks_cen[i]*x_ks_cen[i]+MassKs*MassKs)-MassKs)/2; for(int ic=0;ic<NCen;ic++) { yScaled_ks_cen[ic][i] = y_ks_cen[ic][i]/2.; yeScaled_ks_cen[ic][i] = ye_ks_cen[ic][i]/2.; yesScaled_ks_cen[ic][i] = yes_ks_cen[ic][i]/2.; } } inData.close(); TGraphErrors *gr_ks_cen[NCen], *gr_ks_mT_cen[NCen]; for(int ic=0;ic<NCen;ic++) { gr_ks_cen[ic] = new TGraphErrors(n_ks_cen, x_ks_cen, y_ks_cen[ic], 0, ye_ks_cen[ic]); gr_ks_mT_cen[ic] = new TGraphErrors(n_ks_cen, x_mTScaled_ks_cen, yScaled_ks_cen[ic], 0, yeScaled_ks_cen[ic]); // gr_ks_mT_cen[ic]->Print(); } cout << " Read-in Ks data points done ... " << endl; inData.open("Run14/lambda_v2_cen_PRC77.txt"); for(int i=0;i<n_la_cen;i++) { double a, b, c; inData >> x_la_cen[i] >> a >> b >> c >> y_la_cen[0][i] >> ye_la_cen[0][i] >> yes_la_cen[0][i] >> y_la_cen[1][i] >> ye_la_cen[1][i] >> yes_la_cen[1][i] >> y_la_cen[2][i] >> ye_la_cen[2][i] >> yes_la_cen[2][i]; x_mTScaled_la_cen[i] = (sqrt(x_la_cen[i]*x_la_cen[i]+MassLa*MassLa)-MassLa)/3; for(int ic=0;ic<NCen;ic++) { yScaled_la_cen[ic][i] = y_la_cen[ic][i]/3.; yeScaled_la_cen[ic][i] = ye_la_cen[ic][i]/3.; yesScaled_la_cen[ic][i] = yes_la_cen[ic][i]/3.; } } inData.close(); TGraphErrors *gr_la_cen[NCen], *gr_la_mT_cen[NCen]; for(int ic=0;ic<NCen;ic++) { gr_la_cen[ic] = new TGraphErrors(n_la_cen, x_la_cen, y_la_cen[ic], 0, ye_la_cen[ic]); gr_la_mT_cen[ic] = new TGraphErrors(n_la_cen, x_mTScaled_la_cen, yScaled_la_cen[ic], 0, yeScaled_la_cen[ic]); } cout << " Read-in Lambda data points done ... " << endl; // Xi data points, format is a bit different const Int_t n_xi_cenMax = 9; Int_t n_xi_cen[NCen]; Double_t x_xi_cen[NCen][n_xi_cenMax], y_xi_cen[NCen][n_xi_cenMax], ye_xi_cen[NCen][n_xi_cenMax]; Double_t x_mTScaled_xi_cen[NCen][n_xi_cenMax], yScaled_xi_cen[NCen][n_xi_cenMax], yeScaled_xi_cen[NCen][n_xi_cenMax]; TGraphErrors *gr_xi_cen[NCen]; TGraphErrors *gr_xi_mT_cen[NCen]; for(int ic=0;ic<NCen;ic++) { gr_xi_cen[ic] = new TGraphErrors(Form("Run14/xi_v2_%s.txt",CenName[ic]),"%lg %lg %lg"); n_xi_cen[ic] = gr_xi_cen[ic]->GetN(); for(int i=0;i<gr_xi_cen[ic]->GetN();i++) { x_xi_cen[ic][i] = gr_xi_cen[ic]->GetX()[i]; y_xi_cen[ic][i] = gr_xi_cen[ic]->GetY()[i]; ye_xi_cen[ic][i] = gr_xi_cen[ic]->GetEY()[i]; x_mTScaled_xi_cen[ic][i] = (sqrt(x_xi_cen[ic][i]*x_xi_cen[ic][i]+MassXi*MassXi)-MassXi)/3; yScaled_xi_cen[ic][i] = y_xi_cen[ic][i]/3.; yeScaled_xi_cen[ic][i] = ye_xi_cen[ic][i]/3.; } gr_xi_mT_cen[ic] = new TGraphErrors(n_xi_cen[ic], x_mTScaled_xi_cen[ic], yScaled_xi_cen[ic], 0, yeScaled_xi_cen[ic]); } cout << " Read-in Xi data points done ... " << endl; const Int_t n_phi_cenMax = 7; Int_t n_phi_cen[NCen]; Double_t x_phi_cen[NCen][n_phi_cenMax], y_phi_cen[NCen][n_phi_cenMax], ye_phi_cen[NCen][n_phi_cenMax], yes_phi_cen[NCen][n_phi_cenMax]; Double_t x_mTScaled_phi_cen[NCen][n_phi_cenMax], yScaled_phi_cen[NCen][n_phi_cenMax], yeScaled_phi_cen[NCen][n_phi_cenMax], yesScaled_phi_cen[NCen][n_phi_cenMax]; TGraphErrors *gr_phi_cen[NCen]; TGraphErrors *gr_phi_mT_cen[NCen]; const Char_t *CenName_Phi[NCen] = {"40_80","10_40","0_5"}; for(int ic=0;ic<NCen;ic++) { gr_phi_cen[ic] = new TGraphErrors(Form("Run14/phi_v2_%s_PRC.txt",CenName_Phi[ic]),"%lg %lg %lg"); n_phi_cen[ic] = gr_phi_cen[ic]->GetN(); inData.open(Form("Run14/phi_v2_%s_PRC.txt",CenName_Phi[ic])); for(int i=0;i<gr_phi_cen[ic]->GetN();i++) { x_phi_cen[ic][i] = gr_phi_cen[ic]->GetX()[i]; y_phi_cen[ic][i] = gr_phi_cen[ic]->GetY()[i]; ye_phi_cen[ic][i] = gr_phi_cen[ic]->GetEY()[i]; double a, b, c, d; inData >> a >> b >> c >> d; yes_phi_cen[ic][i] = d; x_mTScaled_phi_cen[ic][i] = (sqrt(x_phi_cen[ic][i]*x_phi_cen[ic][i]+MassPhi*MassPhi)-MassPhi)/2.; yScaled_phi_cen[ic][i] = y_phi_cen[ic][i]/2.; yeScaled_phi_cen[ic][i] = ye_phi_cen[ic][i]/2.; yesScaled_phi_cen[ic][i] = yes_phi_cen[ic][i]/2.; } gr_phi_mT_cen[ic] = new TGraphErrors(n_phi_cen[ic], x_mTScaled_phi_cen[ic], yScaled_phi_cen[ic], 0, yeScaled_phi_cen[ic]); } cout << " Read-in Phi data points done ... " << endl;*/ TCanvas *c1 = new TCanvas("c1", "c1",0,0,1600,900); gStyle->SetOptFit(0); gStyle->SetOptStat(0); gStyle->SetEndErrorSize(0); gStyle->SetTitleBorderSize(0); c1->SetFillColor(10); c1->SetFillStyle(0); c1->SetBorderMode(0); c1->SetBorderSize(0); c1->SetFrameFillColor(10); c1->SetFrameFillStyle(0); c1->SetFrameBorderMode(0); /*TPad* p1 = new TPad("p1","p1",0.,0.5,1.0,1.0); p1->SetFillColor(10); p1->SetFillStyle(0); p1->SetBorderMode(0); p1->SetBorderSize(0); p1->SetFrameFillColor(10); p1->SetFrameFillStyle(0); p1->SetFrameBorderMode(0); //p1->SetLogy(); p1->SetGridx(0); p1->SetGridy(0); p1->SetLeftMargin(0.16); p1->SetBottomMargin(0.15); p1->SetTopMargin(0.02); p1->SetRightMargin(0.02); p1->Draw(); //p1->cd();*/ double x1 = 0.0; double x2 = 6.8; double y1 = -0.05; double y2 = 0.38; TH1 *h0 = new TH1D("h0","",1,x1, x2); h0->SetMinimum(y1); h0->SetMaximum(y2); h0->GetXaxis()->SetNdivisions(208); h0->GetXaxis()->CenterTitle(); h0->GetXaxis()->SetTitle("p_{T} (GeV/c)"); h0->GetXaxis()->SetTitleOffset(.9); h0->GetXaxis()->SetTitleSize(0.05); h0->GetXaxis()->SetLabelOffset(0.005); h0->GetXaxis()->SetLabelSize(0.04); h0->GetXaxis()->SetLabelFont(42); h0->GetXaxis()->SetTitleFont(42); h0->GetYaxis()->SetNdivisions(505); h0->GetYaxis()->CenterTitle(); h0->GetYaxis()->SetTitle("Anisotropy Parameter, v_{2}"); h0->GetYaxis()->SetTitleOffset(.9); h0->GetYaxis()->SetTitleSize(0.05); h0->GetYaxis()->SetLabelOffset(0.005); h0->GetYaxis()->SetLabelSize(0.04); h0->GetYaxis()->SetLabelFont(42); h0->GetYaxis()->SetTitleFont(42); h0->Draw("c"); double pt[2] = {1.766, 4.459}; double pt1Bin[1] = {1.866}; double v2[2] = {0.08329931, 0.126231279}; double eptLow[2] = {.766, .459}; double eptHigh[2] = {2.234, 2.341}; double eptSyst[2] = { 0.0, 0.0}; double eptSyst1Bin[1] = { 0.0}; double ev2Low[2] = { 0.00736501, 0.012241649}; double ev2High[2] = { 0.00736501, 0.012241649}; double ev2Syst[2] = {.0124948965, .02145931743 }; TGraphAsymmErrors *AlexData = new TGraphAsymmErrors(2, pt, v2, eptLow, eptHigh, ev2Low, ev2High); AlexData->SetMarkerColor(2); AlexData->SetMarkerStyle(21); AlexData->SetMarkerSize(2); AlexData->SetLineColor(2); AlexData->SetLineWidth(3); TGraphErrors *AlexDataSyst = new TGraphErrors(2, pt, v2, eptSyst, ev2Syst); AlexDataSyst->SetMarkerColor(2); AlexDataSyst->SetMarkerStyle(21); AlexDataSyst->SetMarkerSize(1.1); AlexDataSyst->SetLineColor(2); AlexDataSyst->SetLineWidth(33); // 8 data points double weights[6] = {0.4034, .3058, .1696, .0778, .0316, .0119}; double avgV2[1] = {0}; double avgV2StatErrorSquared[1] = {0}; double avgV2SystErrorSquared[1] = {0}; double avgV2StatError[1] = {0}; double avgV2SystError[1] = {0}; for(int i = 0; i < 6; i++){ cout << "V2: " << y_data_cen[1][i] << endl; avgV2[0] = avgV2[0] + (weights[i]*y_data_cen[1][i]); avgV2StatErrorSquared[0] = avgV2StatErrorSquared[0] + (weights[i]*weights[i])*(ye_data_cen[1][i]*ye_data_cen[1][i]); avgV2SystErrorSquared[0] = avgV2SystErrorSquared[0] + (weights[i]*weights[i])*(yes_data_cen[1][i]*yes_data_cen[1][i]); } avgV2StatError[0] = TMath::Sqrt(avgV2StatErrorSquared[0]); avgV2SystError[0] = TMath::Sqrt(avgV2SystErrorSquared[0]); TGraphErrors *AvgV2Data = new TGraphErrors(1, pt1Bin, avgV2, eptSyst1Bin, avgV2StatError); AvgV2Data->SetMarkerColor(4); AvgV2Data->SetMarkerStyle(22); AvgV2Data->SetMarkerSize(2.5); AvgV2Data->SetLineColor(4); //AvgV2Data->SetLineWidth(15); TGraphErrors *AvgV2DataSyst = new TGraphErrors(1, pt1Bin, avgV2, eptSyst1Bin, avgV2SystError); AvgV2DataSyst->SetMarkerColor(4); AvgV2DataSyst->SetMarkerStyle(22); AvgV2DataSyst->SetMarkerSize(2.5); AvgV2DataSyst->SetLineColor(4); AvgV2DataSyst->SetLineWidth(29); /*TH1 *hAlex1 = new TH1D("","", 7, 0, 6.8); hAlex1->SetMarkerStyle(20); hAlex1->SetMarkerColor(2); hAlex1->SetMarkerSize(1.5); //hAlex->SetBinContent(3, 0.0801251); //hAlex->SetBinError(3, 0.00244519); hAlex1->SetBinContent(1, 0.122872); hAlex1->SetBinError(1, 0.0149516); // hAlex1->SetBinContent(5, 0.0789727); //hAlex1->SetBinError(5, 0.00444987); TH1 *hAlex2 = new TH1D("","", 1, 1, 4); hAlex2->SetMarkerStyle(20); hAlex2->SetMarkerColor(2); hAlex2->SetMarkerSize(1.5); hAlex2->SetBinContent(1, 0.0801251); hAlex2->SetBinError(1, 0.00244519); TH1 *hAlex3 = new TH1D("","", 1, 4, 6.8); hAlex3->SetMarkerStyle(20); hAlex3->SetMarkerColor(2); hAlex3->SetMarkerSize(1.5); hAlex3->SetBinContent(1, 0.0789727); hAlex3->SetBinError(1, 0.00444987); ////////////////////////////////////////////////////////////////// TH1 *hAlex1Syst = new TH1D("","", 7, 0, 6.8); hAlex1Syst->SetMarkerStyle(20); hAlex1Syst->SetMarkerColor(2); hAlex1Syst->SetMarkerSize(1.5); //hAlex1Syst->SetEndErrorSize(2); hAlex1Syst->SetBinContent(1, 0.122872); hAlex1Syst->SetBinError(1, 0.02); TH1 *hAlex2Syst = new TH1D("","", 1, 1, 4); hAlex2Syst->SetMarkerStyle(20); hAlex2Syst->SetMarkerColor(2); hAlex2Syst->SetMarkerSize(1.5); hAlex2Syst->SetBinContent(1, 0.0801251); hAlex2Syst->SetBinError(1, 0.006172166); TH1 *hAlex3Syst = new TH1D("","", 1, 4, 6.8); hAlex3Syst->SetMarkerStyle(20); hAlex3Syst->SetMarkerColor(2); hAlex3Syst->SetMarkerSize(1.5); hAlex3Syst->SetBinContent(1, 0.0789727); hAlex3Syst->SetBinError(1, 0.004869332);*/ /*TLine *l1 = new TLine(x1,y1,x2,y1); l1->SetLineWidth(2); l1->Draw("same"); TLine *l2 = new TLine(x1,y2,x2,y2); l2->SetLineWidth(2); l2->Draw("same"); TLine *l3 = new TLine(x1,y1,x1,y2); l3->SetLineWidth(2); l3->Draw("same"); TLine *l4 = new TLine(x2,y1,x2,y2); l4->SetLineWidth(2); l4->Draw("same"); TLine *l0 = new TLine(x1, 0, x2, 0); l0->SetLineWidth(2); l0->SetLineStyle(2); l0->Draw("same");*/ /*for(int i=0;i<n_ks_cen;i++) { double x1 = x_ks_cen[i]-0.08; double x2 = x_ks_cen[i]+0.08; double y1 = y_ks_cen[1][i]-yes_ks_cen[1][i]; double y2 = y_ks_cen[1][i]+yes_ks_cen[1][i]; TLine *la = new TLine(x1, y1, x1, y1+0.003); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.003); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.003); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.003); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->Draw("same"); }*/ /*gr_ks_cen[1]->Print(); gr_ks_cen[1]->SetMarkerStyle(25); gr_ks_cen[1]->SetMarkerColor(1); gr_ks_cen[1]->SetMarkerSize(1.2); gr_ks_cen[1]->SetLineColor(1); gr_ks_cen[1]->SetLineWidth(2); gr_ks_cen[1]->Draw("p");*/ /* for(int i=0;i<n_la_cen;i++) { double x1 = x_la_cen[i]-0.08; double x2 = x_la_cen[i]+0.08; double y1 = y_la_cen[1][i]-yes_la_cen[1][i]; double y2 = y_la_cen[1][i]+yes_la_cen[1][i]; TLine *la = new TLine(x1, y1, x1, y1+0.003); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.003); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.003); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.003); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->Draw("same"); } gr_la_cen[1]->Print(); gr_la_cen[1]->SetMarkerStyle(24); gr_la_cen[1]->SetMarkerColor(1); gr_la_cen[1]->SetMarkerSize(1.2); gr_la_cen[1]->SetLineColor(1); gr_la_cen[1]->SetLineWidth(2); gr_la_cen[1]->Draw("p"); gr_xi_cen[1]->Print(); gr_xi_cen[1]->SetMarkerStyle(26); gr_xi_cen[1]->SetMarkerColor(1); gr_xi_cen[1]->SetMarkerSize(1.2); gr_xi_cen[1]->SetLineColor(1); gr_xi_cen[1]->SetLineWidth(2); gr_xi_cen[1]->Draw("p"); gr_phi_cen[1]->Print(); gr_phi_cen[1]->SetMarkerStyle(25); gr_phi_cen[1]->SetMarkerColor(1); gr_phi_cen[1]->SetMarkerSize(1.2); gr_phi_cen[1]->SetLineColor(1); gr_phi_cen[1]->SetLineWidth(2); // gr_phi_cen[1]->Draw("p");*/ for(int i=0;i<n_data_cen[1];i++) { double x1 = x_data_cen[1][i]-0.08; double x2 = x_data_cen[1][i]+0.08; double y1 = y_data_cen[1][i]-yes_data_cen[1][i]; double y2 = y_data_cen[1][i]+yes_data_cen[1][i]; double y3 = y_data_cen[1][i] - yesL_data_cen[1][i]; double y4 = y_data_cen[1][i]; TBox *box = new TBox(x1, y3, x2, y4); box->SetLineColor(16); box->SetFillColor(16); box->Draw("same"); TLine *la = new TLine(x1, y1, x1, y1+0.003); la->SetLineColor(4); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.003); lb->SetLineColor(4); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.003); lc->SetLineColor(4); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.003); ld->SetLineColor(4); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->SetLineColor(4); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->SetLineColor(4); lf->Draw("same"); } gr_data_cen[1]->SetMarkerStyle(20); //gr_data_cen[1]->SetMarkerColorAlpha(4, 0.35); gr_data_cen[1]->SetMarkerColor(4); gr_data_cen[1]->SetMarkerSize(1.5); gr_data_cen[1]->SetLineWidth(2); gr_data_cen[1]->SetLineColor(4); gr_data_cen[1]->Draw("p"); /////MY DATA HERE//////////////////////// for(int i = 0; i < 2; i++) { double x1 = pt[i]-0.08; double x2 = pt[i]+0.08; double y1 = v2[i]-ev2Syst[i]; double y2 = v2[i]+ev2Syst[i]; TLine *la = new TLine(x1, y1, x1, y1+0.003); la->SetLineColor(2); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.003); lb->SetLineColor(2); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.003); lc->SetLineColor(2); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.003); ld->SetLineColor(2); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->SetLineColor(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->SetLineColor(2); lf->Draw("same"); } //TLatex *tex = new TLatex(5.5, 0.28, "10-40%"); //tex->SetTextFont(42); //tex->SetTextSize(0.055); //tex->Draw(); TLegend *leg = new TLegend(0.1, 0.72, 0.55, 0.9); leg->SetFillStyle(0); leg->SetLineStyle(4000); leg->SetLineColor(10); //leg->SetLineWidth(1.0); leg->SetBorderSize(0.0); leg->SetTextSize(0.045); leg->AddEntry(gr_data_cen[1], "D^{0} Event Plane, 10-40% ", "p"); leg->AddEntry(AlexData, "D^{0}-Hadron Angular Corr, 20-50%", "p"); //leg->AddEntry(AvgV2Data, "D^{0} Event Plane Avg. of 1 GeV/c < p_{t} < 4 GeV/c", "p"); //leg->AddEntry(gr_xi_cen[1], "#Xi^{-}", "p"); //leg->AddEntry(gr_la_cen[1], "#Lambda", "p"); //leg->AddEntry(gr_ks_cen[1], "K_{S}", "p"); // leg->AddEntry(gr_phi_cen[1], "#phi", "p"); leg->Draw(); AlexData->Draw("SAME P"); //AlexDataSyst->Draw("SAME []"); //AvgV2Data->Draw("SAME P"); //AvgV2DataSyst->Draw("SAME []"); TString starPrelim = "STAR Preliminary"; TPaveText *starPrelimTextBox = new TPaveText(0.7, 0.7, .8, .77, "NB NDC"); starPrelimTextBox->SetFillColor(0); starPrelimTextBox->AddText(starPrelim); starPrelimTextBox->GetLine(0)->SetTextSize(.055); starPrelimTextBox->GetLine(0)->SetTextColor(2); starPrelimTextBox->Draw("SAME"); TLatex *tex = new TLatex(4.2, 0.345, "STAR Au+Au @ 200 GeV"); tex->SetTextFont(42); tex->SetTextSize(0.05); tex->Draw(); //hAlex2->Draw("SAME"); //hAlex3->Draw("SAME"); //hAlex1Syst->Draw("SAME E1"); //hAlex2Syst->Draw("SAME E1"); //hAlex3Syst->Draw("SAME E1"); // tex = new TLatex(0.2, 0.34, "a)"); //tex->SetTextFont(42); //tex->SetTextSize(0.065); //tex->Draw(); //p1->Modified(); //c1->Update(); //c1->cd(); /*TPad* p2 = new TPad("p2","",0.,0.,1.0,0.5); p2->SetFillColor(10); p2->SetFillStyle(0); p2->SetBorderMode(0); p2->SetBorderSize(0); p2->SetFrameFillColor(10); p2->SetFrameFillStyle(0); p2->SetFrameBorderMode(0); //p2->SetLogy(); p2->SetGridx(0); p2->SetGridy(0); p2->SetLeftMargin(0.16); p2->SetBottomMargin(0.18); p2->SetTopMargin(0.01); p2->SetRightMargin(0.02); p2->Draw(); p2->cd();*/ /* double x1 = 0.; double x2 = 2.8; double y1 = -0.025; double y2 = 0.18; TH1 *h0 = new TH1D("h0","",1,x1, x2); h0->SetMinimum(y1); h0->SetMaximum(y2); h0->GetXaxis()->SetNdivisions(208); h0->GetXaxis()->CenterTitle(); h0->GetXaxis()->SetTitle("(m_{T} - m_{0}) / n_{q} (GeV/c^{ 2})"); h0->GetXaxis()->SetTitleOffset(1.1); h0->GetXaxis()->SetTitleSize(0.065); h0->GetXaxis()->SetLabelOffset(0.01); h0->GetXaxis()->SetLabelSize(0.055); h0->GetXaxis()->SetLabelFont(42); h0->GetXaxis()->SetTitleFont(42); h0->GetYaxis()->SetNdivisions(505); h0->GetYaxis()->CenterTitle(); h0->GetYaxis()->SetTitle("Anisotropy Parameter, v_{2} / n_{q}"); h0->GetYaxis()->SetTitleOffset(1.1); h0->GetYaxis()->SetTitleSize(0.065); h0->GetYaxis()->SetLabelOffset(0.015); h0->GetYaxis()->SetLabelSize(0.055); h0->GetYaxis()->SetLabelFont(42); h0->GetYaxis()->SetTitleFont(42); h0->Draw("c"); TLine *l1 = new TLine(x1,y1,x2,y1); l1->SetLineWidth(2); l1->Draw("same"); TLine *l2 = new TLine(x1,y2,x2,y2); l2->SetLineWidth(2); l2->Draw("same"); TLine *l3 = new TLine(x1,y1,x1,y2); l3->SetLineWidth(2); l3->Draw("same"); TLine *l4 = new TLine(x2,y1,x2,y2); l4->SetLineWidth(2); l4->Draw("same"); TLine *l0 = new TLine(x1, 0, x2, 0); l0->SetLineWidth(2); l0->SetLineStyle(2); l0->Draw("same");*/ /*for(int i=0;i<n_ks_cen;i++) { double x1 = x_mTScaled_ks_cen[i]-0.04; double x2 = x_mTScaled_ks_cen[i]+0.04; double y1 = yScaled_ks_cen[1][i]-yesScaled_ks_cen[1][i]; double y2 = yScaled_ks_cen[1][i]+yesScaled_ks_cen[1][i]; TLine *la = new TLine(x1, y1, x1, y1+0.0015); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.0015); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.0015); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.0015); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->Draw("same"); } gr_ks_mT_cen[1]->Print(); gr_ks_mT_cen[1]->SetMarkerStyle(25); gr_ks_mT_cen[1]->SetMarkerColor(1); gr_ks_mT_cen[1]->SetMarkerSize(1.2); gr_ks_mT_cen[1]->SetLineColor(1); gr_ks_mT_cen[1]->SetLineWidth(2); gr_ks_mT_cen[1]->Draw("p"); for(int i=0;i<n_la_cen;i++) { double x1 = x_mTScaled_la_cen[i]-0.04; double x2 = x_mTScaled_la_cen[i]+0.04; double y1 = yScaled_la_cen[1][i]-yesScaled_la_cen[1][i]; double y2 = yScaled_la_cen[1][i]+yesScaled_la_cen[1][i]; TLine *la = new TLine(x1, y1, x1, y1+0.0015); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.0015); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.0015); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.0015); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineWidth(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineWidth(2); lf->Draw("same"); } gr_la_mT_cen[1]->Print(); gr_la_mT_cen[1]->SetMarkerStyle(24); gr_la_mT_cen[1]->SetMarkerColor(1); gr_la_mT_cen[1]->SetMarkerSize(1.2); gr_la_mT_cen[1]->SetLineColor(1); gr_la_mT_cen[1]->SetLineWidth(2); gr_la_mT_cen[1]->Draw("p"); gr_xi_mT_cen[1]->Print(); gr_xi_mT_cen[1]->SetMarkerStyle(26); gr_xi_mT_cen[1]->SetMarkerColor(1); gr_xi_mT_cen[1]->SetMarkerSize(1.2); gr_xi_mT_cen[1]->SetLineColor(1); gr_xi_mT_cen[1]->SetLineWidth(2); gr_xi_mT_cen[1]->Draw("p"); gr_phi_mT_cen[1]->Print(); gr_phi_mT_cen[1]->SetMarkerStyle(25); gr_phi_mT_cen[1]->SetMarkerColor(1); gr_phi_mT_cen[1]->SetMarkerSize(1.2); gr_phi_mT_cen[1]->SetLineColor(1); gr_phi_mT_cen[1]->SetLineWidth(2); // gr_phi_mT_cen[1]->Draw("p");*/ /* for(int i=0;i<n_data_cen[1];i++) { double x1 = x_mTScaled_data_cen[1][i]-0.04; double x2 = x_mTScaled_data_cen[1][i]+0.04; double y1 = yScaled_data_cen[1][i]-yesScaled_data_cen[1][i]; double y2 = yScaled_data_cen[1][i]+yesScaled_data_cen[1][i]; double y3 = yScaled_data_cen[1][i] - yesLScaled_data_cen[1][i]; double y4 = yScaled_data_cen[1][i]; TBox *box = new TBox(x1, y3, x2, y4); box->SetLineColor(16); box->SetFillColor(16); box->Draw("same"); TLine *la = new TLine(x1, y1, x1, y1+0.0015); la->SetLineColor(4); la->Draw("same"); TLine *lb = new TLine(x2, y1, x2, y1+0.0015); lb->SetLineColor(4); lb->Draw("same"); TLine *lc = new TLine(x1, y2, x1, y2-0.0015); lc->SetLineColor(4); lc->Draw("same"); TLine *ld = new TLine(x2, y2, x2, y2-0.0015); ld->SetLineColor(4); ld->Draw("same"); TLine *le = new TLine(x1, y1, x2, y1); le->SetLineColor(4); le->SetLineWidth(2); le->Draw("same"); TLine *lf = new TLine(x1, y2, x2, y2); lf->SetLineColor(4); lf->SetLineWidth(2); lf->Draw("same"); }*/ //gr_data_mT_cen[1]->SetMarkerStyle(20); //gr_data_mT_cen[1]->SetMarkerColor(4); //gr_data_mT_cen[1]->SetMarkerSize(1.5); //gr_data_mT_cen[1]->SetLineWidth(2); //gr_data_mT_cen[1]->SetLineColor(4); //gr_data_mT_cen[1]->Draw("p"); //TLegend *leg = new TLegend(0.22, 0.66, 0.5, 0.96); //leg->SetFillStyle(0); //leg->SetLineStyle(4000); //leg->SetLineColor(-1); //leg->SetLineWidth(0); //leg->SetTextSize(0.06); //leg->AddEntry(gr_data_mT_cen[1], "D^{0}", "p"); //leg->AddEntry(gr_xi_mT_cen[1], "#Xi^{-}", "p"); //leg->AddEntry(gr_la_mT_cen[1], "#Lambda", "p"); //leg->AddEntry(gr_ks_mT_cen[1], "K_{S}", "p"); // leg->AddEntry(gr_phi_mT_cen[1], "#phi", "p"); //leg->Draw(); //TLatex *tex = new TLatex(1.2, 0.155, "STAR Au+Au @ 200 GeV"); // tex->SetTextFont(42); //tex->SetTextSize(0.065); //tex->Draw(); //TLatex *tex = new TLatex(2.27, 0.13, "10-40%"); //tex->SetTextFont(42); //tex->SetTextSize(0.065); //tex->Draw(); //tex = new TLatex(0.08, 0.155, "b)"); //tex->SetTextFont(42); //tex->SetTextSize(0.065); //tex->Draw(); //p2->Modified(); //c1->Update(); //c1->cd(); //c1->SaveAs("v2CompareWithData.eps"); c1->SaveAs("v2_plot.png"); }
void rateStudy() { const int NRUNS = 25; const int NCH = 32; const int NBINS = 32; TCanvas* c1 = new TCanvas("c1", "c1", 800, 600); TMultiGraph *mg = new TMultiGraph(); TLegend *legend=new TLegend(0.65,0.15,0.88,0.55); legend->SetNColumns(4); legend->SetFillColor(0); TH1F* hRate = new TH1F("hRate", "hist", 32.0, 0, 8.0); //Color buffer const int NCOLORS = 32; int color[NCOLORS] = {73, 2, 3, 4, 99, 6, 7, 8, 9, 12, 28, 32, 34, 28, 50, 51, 56, 58, 88, 99, 1, 208, 209, 218, 212, 210, 221, 224, 225, 226, 227, 228 }; ifstream fin; //fin.open("runlist.txt"); fin.open("filter_runlist.txt"); string line = ""; TFile* out = new TFile("outtemp.root", "REACREATE"); TH1F* h = new TH1F("h","hist", NBINS, 0, NBINS); TF1* pois = new TF1("pois","[0]*TMath::Poisson(x,[1])",0,50); TF1* ppp = new TF1("ppp","[0]*TMath::Power(0.5,x*[1])",0.01,1.0); for (int ch = 0; ch < NCH; ++ch) { //if ( ch==26 || ch==27 ) //continue; //Graph points and errors Double_t x[NRUNS]; Double_t y[NRUNS]; Double_t errX[NRUNS] = {0}; Double_t errY[NRUNS] = {0}; int fileCounter = 0; while(getline(fin, line)) { vector<double> data = parse(line); stringstream filePath; filePath << "pmtratestudy/run" << data[0] << "*.root"; cout << "opening file at " << filePath.str() << endl; cout << "file counter: " << fileCounter << " channel=" << ch << endl; //TFile* f = new TFile(filePath.str().c_str()); //TTree* t = (TTree *)f->Get("eventtree"); TChain* t = new TChain("eventtree"); t->Add( filePath.str().c_str() ); out->cd(); x[fileCounter] = data[1]; int nfires[NCH] = {0}; int samples = 0; float chmax = 0.0; t->SetBranchAddress("nfires", &nfires); t->SetBranchAddress("samples", &samples); t->SetBranchAddress("chmax", &chmax); h->Reset(); int nentries = t->GetEntries(); for (int entry = 0; entry < nentries; ++entry) { t->GetEntry(entry); if (chmax < 100.0) { h->Fill(nfires[ch]); } } pois->SetParameter(0,1); pois->SetParameter(1, h->GetMean()); h->Fit(pois,"RQ","",0,50); //TF1 *myfit = (TF1 *)h->GetFunction("pois"); TF1 *myfit = (TF1 *)pois; Double_t lambda = myfit->GetParameter(1); h->Draw(); stringstream histFileName; histFileName << "hist/h" << data[0] << "_ch" << ch << ".png"; c1->SaveAs(histFileName.str().c_str()); //Graph with poisson method #if 1 y[fileCounter] = lambda / ((samples - 1) * 15.625E-6); errY[fileCounter] = myfit->GetParError(1) / ((samples - 1) * 15.625E-6); #endif //Graph with mean method #if 0 y[fileCounter] = h->GetMean() / ((samples - 1) * 15.625E-6); errY[fileCounter] = h->GetMeanError() / ((samples - 1) * 15.625E-6); #endif cout << x[fileCounter] << ", " << y[fileCounter] << " | " << (samples - 1) << endl; delete t; //f->Close(); fileCounter++; } ppp->SetParameter(0,1); ppp->SetParameter(1,0.4); TGraphErrors* gr = new TGraphErrors(NRUNS, x, y, errX, errY); gr->SetLineColor(color[ch % NCOLORS]); cout << "color: " << color[ch % NCOLORS] << endl; gr->SetLineWidth(2); gr->SetMarkerStyle(7); gr->Fit("ppp","R0","Q0",0.045,2.0); TF1 *afit = (TF1 *)gr->GetFunction("ppp"); Double_t aRate = 1/afit->GetParameter(1); if (aRate > 0) { hRate->Fill(aRate); } gr->GetXaxis()->SetTitle("Run Date"); gr->GetYaxis()->SetTitle("Rate [kHz]"); stringstream entryName, fileName; entryName << "Channel" << ch; gr->SetTitle(entryName.str().c_str()); fileName << "plots/" << ch << ".png"; legend->AddEntry(gr, entryName.str().c_str()); gr->Draw("alp"); c1->SaveAs(fileName.str().c_str()); mg->Add(gr); cout << "added plot to mg\n"; fin.clear(); fin.seekg(0, ios::beg); } // loop over channel hRate->Draw(); hRate->Fit("gaus"); c1->SaveAs("hrate.pdf"); mg->Draw("alp"); mg->GetXaxis()->SetTitle("Days since first run"); mg->GetYaxis()->SetTitle("Rate [kHz]"); mg->SetTitle("All channels: Rate vs. Days since first Run"); legend->Draw(); c1->SaveAs("mg.pdf"); }
void make1DLimitHH(TString combine_dir,bool blind=true){ //TString combine_dir = "test_runSusyHgg/signalInj_sms_ChiHH_0_175/"; TGraph obser( (275-125)/25 ); TGraph graph( (275-125)/25 ); TGraphAsymmErrors error( (275-125)/25 ); for(int m=125;m<501;m+=25) { int i=(m-125)/25; TFile limit_file(Form("%s/higgsCombineChiHH_0_%d.Asymptotic.mH120.root",combine_dir.Data(),m) ); TTree *limit_tree = (TTree*)limit_file.Get("limit"); TTreeFormula limit_form("get_limit","limit",limit_tree); limit_tree->GetEntry(1); float down = limit_form.EvalInstance(); limit_tree->GetEntry(2); float exp = limit_form.EvalInstance(); limit_tree->GetEntry(3); float up = limit_form.EvalInstance(); limit_tree->GetEntry(5); float obs = limit_form.EvalInstance(); graph.SetPoint(i,float(m),exp); error.SetPoint(i,float(m),exp); error.SetPointError(i,0,0,exp-down,up-exp); obser.SetPoint(i,float(m),obs); } TGraphErrors* theo = getTheoXSec("/home/amott/HggApp/SusyHgg/xsecs/Higgsino.txt"); TCanvas cv; cv.SetLogy(); theo->SetMaximum(1e2); theo->SetMinimum(1e-2); theo->GetYaxis()->SetTitle("95% CL #sigma upper limit (pb)"); theo->GetXaxis()->SetTitle("m_{chargino}"); theo->SetFillColor(kBlue); theo->SetLineStyle(kDotted); theo->SetLineWidth(2.0); error.SetMaximum(1e2); error.SetMinimum(1e-2); error.GetYaxis()->SetTitle("95% CL #sigma upper limit (pb)"); error.GetXaxis()->SetTitle("m_{chargino}"); error.SetFillColor(kGreen); error.Draw("A3"); theo->Draw("3C"); graph.SetLineStyle(kDashed); graph.SetLineWidth(2); graph.Draw("C"); obser.SetLineStyle(1); obser.SetLineWidth(2); if(!blind) obser.Draw("C"); TLegend leg(0.7,0.7,0.85,0.85); leg.SetFillColor(0); leg.SetBorderSize(0); leg.AddEntry(&graph,"expected","l"); leg.AddEntry(&error,"expected #pm1#sigma","F"); leg.AddEntry(theo,"theoretical","f"); if(!blind) leg.AddEntry(&obser,"observed","l"); leg.Draw("SAME"); TLatex prelim(0.65,0.96,"CMS Preliminary"); prelim.SetNDC(); prelim.SetTextSize(0.045); prelim.Draw(); TLatex lbl(0.5,0.86,"#sqrt{s} = 8 TeV #int L dt = 19.78 fb^{-1}"); lbl.SetNDC(); lbl.SetTextSize(0.045); lbl.Draw(); cv.SaveAs(combine_dir+"expected_exclusion_HH_1D.png"); }
void pionContaminationVeta(){ gStyle->SetOptStat(0); gStyle->SetOptFit(1); gStyle->SetPalette(1); char hist [100]; char hfile [100]; sprintf(hfile,"~/Desktop/Research/2012IFF/rootFiles/nsigma20bintest35mil.root"); TFile* file = TFile::Open(hfile,"read"); assert(file); double totalYieldWhole = 0; double pionYieldWhole = 0; double kpYieldWhole = 0; double electYieldWhile = 0; double pionFrac [20]; double kpFrac [20]; double electFrac [20]; double pionCent [20]; double kpCent [20]; double electCent [20]; double pionMax [20]; double kpMax [20]; double electMax [20]; double pionSig [20]; double kpSig [20]; double electSig [20]; double etastart[20]; double etaend[20]; double eta[20]; double piYield[20]; double highestYield = 0; double totalYeild[20]; TH1F* hTotal = new TH1F("hTotal","hTotal",300,-10,10); for (int ihist=0; ihist<20; ihist++) { /* if (ihist != 0 || ihist != 1 || ihist != 2 || ihist != 3 ||) { cou } */ sprintf(hist,"nSigmaPionBin_%i",ihist); cout << hist << endl; TH1F *hNsigma = (TH1F*) file->Get(hist); assert(hNsigma); hTotal->Add(hNsigma, 1); cout << hTotal->GetEntries() << endl; TF1 *fitFunc = new TF1("fitFunc","gaus(0)+gaus(3)+gaus(6)",-10,10); TF1 *piFunc = new TF1("piFunc","gaus(0)",-10,10); TF1 *kpFunc = new TF1("kpFunc","gaus(0)",-10,10); TF1 *eFunc = new TF1( "eFunc","gaus(0)",-10,10); fitFunc->SetParName(0, "A_{#pi}"); fitFunc->SetParName(1, "#LTn_{#pi}#GT"); fitFunc->SetParName(2, "#sigma_{#pi}"); fitFunc->SetParName(3, "A_{K/p}"); fitFunc->SetParName(4, "#LTn_{K/p}#GT"); fitFunc->SetParName(5, "#sigma_{K/p}"); fitFunc->SetParName(6, "A_{e}"); fitFunc->SetParName(7, "#LTn_{e}#GT"); fitFunc->SetParName(8, "#sigma_{e}"); fitFunc->SetParameter(0, hNsigma->GetMaximum()); fitFunc->SetParameter(1, 0.); fitFunc->SetParameter(2, 1.); fitFunc->SetParameter(3, 0.05*hNsigma->GetMaximum()); fitFunc->SetParameter(4,-3.); fitFunc->SetParameter(5, 1.5); fitFunc->SetParameter(6, 0.05*hNsigma->GetMaximum()); fitFunc->SetParameter(7, 4.); //was at 5. but it seems like 4. works better fitFunc->SetParameter(8, 3.); hNsigma->Fit("fitFunc"); float ampPi = fitFunc->GetParameter(0); float centPi = fitFunc->GetParameter(1); float sigPi = fitFunc->GetParameter(2); piFunc->SetParameters(ampPi,centPi,sigPi); piFunc->SetLineColor(kViolet+1); float ampKP = fitFunc->GetParameter(3); float centKP = fitFunc->GetParameter(4); float sigKP = fitFunc->GetParameter(5); kpFunc->SetParameters(ampKP,centKP,sigKP); kpFunc->SetLineColor(kGreen+2); float ampE = fitFunc->GetParameter(6); float centE = fitFunc->GetParameter(7); float sigE = fitFunc->GetParameter(8); eFunc->SetParameters(ampE,centE,sigE); eFunc->SetLineColor(kBlue); piFunc->Draw("same"); kpFunc->Draw("same"); eFunc->Draw("same"); TLine *l1 = new TLine( 2.5,0, 2.5,0.9*hNsigma->GetMaximum()); TLine *l2 = new TLine(-1.0,0,-1.0,0.9*hNsigma->GetMaximum()); l1->SetLineColor(kOrange+2); l2->SetLineColor(kOrange+2); l1->SetLineWidth(2); l2->SetLineWidth(2); l1->Draw(); l2->Draw(); //* float totYield = fitFunc->Integral(-1.,2.5); float pionYield = piFunc->Integral(-1.,2.5); float kpYield = kpFunc->Integral(-1.,2.5); float eYield = eFunc->Integral(-1.,2.5); //*/ /* float totYield = fitFunc->Integral(-2.,2.); float pionYield = piFunc->Integral(-2.,2.); float kpYield = kpFunc->Integral(-2.,2.); float eYield = eFunc->Integral(-2.,2.); //*/ totalYieldWhole += totYield; pionYieldWhole += pionYield; kpYieldWhole += kpYield; electYieldWhile += eYield; printf("\nTotal Yield\tPion Yield\tK/p Yield\tElect Yield\n"); printf("%e\t%e\t%e\t%e\n",totYield,pionYield,kpYield,eYield); printf("Pion Fraction = %e\n",(pionYield/totYield)); totalYeild[ihist] = totYield; pionFrac[ihist] = pionYield/totYield; kpFrac[ihist] = kpYield/totYield; electFrac[ihist] = eYield/totYield; etastart[ihist] = -2+ihist*0.2; etaend[ihist] = -2+(ihist+1)*0.2; eta[ihist] = (etastart[ihist]+etaend[ihist])*.5; piYield[ihist] = pionYield; if (highestYield < pionYield){highestYield = pionYield;} } double normlzd_PiYield[20]; double sumPiYield = 0; for (int i=0; i<20; i++) { if (pionFrac[i] != pionFrac[i]) { cout << i << " " << eta[i] << " testFailed" << " highyeild " << highestYield << endl; pionFrac[i] = -.2; } else { cout << i << " " << eta[i] << " " << pionFrac[i] << " highyeild " << highestYield << endl; } normlzd_PiYield[i] = piYield[i]/highestYield; sumPiYield += piYield[i]; } double pionFracErr[20]; double kpFracErr[20]; double electFracErr[20]; for (int i=0; i<20; i++) { pionFracErr[i] = sqrt((1-pionFrac[i])*pionFrac[i]/totalYeild[i]); kpFracErr[i] = sqrt((1-kpFrac[i])*kpFrac[i]/totalYeild[i]); electFracErr[i] = sqrt((1-electFrac[i])*electFrac[i]/totalYeild[i]); } cout << "total Pion Yield = " << sumPiYield << endl; TGraphErrors* gPionYield = new TGraphErrors(20,eta,normlzd_PiYield,0,0); gPionYield->SetMarkerColor(kRed+2); gPionYield->SetMarkerStyle(24); TGraphErrors* gPionFrac = new TGraphErrors(20,eta,pionFrac,0,pionFracErr); TGraphErrors* gKpFrac = new TGraphErrors(20,eta,kpFrac,0,kpFracErr); TGraphErrors* gElecFrac = new TGraphErrors(20,eta,electFrac,0,electFracErr); gPionFrac->SetMarkerColor(kViolet+1); gPionFrac->SetLineColor(kViolet+1); gPionFrac->SetLineWidth(2); gKpFrac->SetMarkerColor(kGreen+2); gKpFrac->SetLineColor(kGreen+2); gKpFrac->SetLineWidth(2); gKpFrac->SetMarkerStyle(22); gElecFrac->SetMarkerColor(kBlue); gElecFrac->SetLineColor(kBlue); gElecFrac->SetLineWidth(2); gElecFrac->SetMarkerStyle(20); TMultiGraph* multiFracs = new TMultiGraph(); multiFracs->Add(gPionFrac); multiFracs->Add(gKpFrac); multiFracs->Add(gElecFrac); //multiFracs->Add(gPionYield); TCanvas* cMultiG = new TCanvas(); multiFracs->Draw("AP"); multiFracs->GetXaxis()->SetTitle("#eta^{#pi^{+}#pi^{-}}"); multiFracs->GetYaxis()->SetTitle("particle Fractions"); gPad->Modified(); TLegend* leg = new TLegend(0.52,0.17,0.89,0.30); leg->AddEntry(gPionFrac,"Pion","P"); leg->AddEntry(gKpFrac,"K/P","P"); leg->AddEntry(gElecFrac,"Electron","P"); // leg->Draw(); TCanvas* cPiYeild = new TCanvas(); TGraphErrors* gPionYield = new TGraphErrors(20,eta,piYield,0,0); gPionYield->Draw("AP"); gPionYield->SetMarkerColor(kRed+2); gPionYield->SetMarkerStyle(24); gPionYield->GetXaxis()->SetTitle("#eta^{#pi^{+}#pi^{-}}"); gPionYield->GetYaxis()->SetTitle("Pion Yield"); cout << pionYieldWhole/totalYieldWhole << endl; hTotal->Draw(); TF1 *fitFunc = new TF1("fitFunc","gaus(0)+gaus(3)+gaus(6)",-10,10); TF1 *piFunc = new TF1("piFunc","gaus(0)",-10,10); TF1 *kpFunc = new TF1("kpFunc","gaus(0)",-10,10); TF1 *eFunc = new TF1( "eFunc","gaus(0)",-10,10); fitFunc->SetParName(0, "A_{#pi}"); fitFunc->SetParName(1, "#LTn_{#pi}#GT"); fitFunc->SetParName(2, "#sigma_{#pi}"); fitFunc->SetParName(3, "A_{K/p}"); fitFunc->SetParName(4, "#LTn_{K/p}#GT"); fitFunc->SetParName(5, "#sigma_{K/p}"); fitFunc->SetParName(6, "A_{e}"); fitFunc->SetParName(7, "#LTn_{e}#GT"); fitFunc->SetParName(8, "#sigma_{e}"); fitFunc->SetParameter(0, hTotal->GetMaximum()); fitFunc->SetParameter(1, 0.); fitFunc->SetParameter(2, 1.); fitFunc->SetParameter(3, 0.05*hTotal->GetMaximum()); fitFunc->SetParameter(4,-3.); fitFunc->SetParameter(5, 1.5); fitFunc->SetParameter(6, 0.05*hTotal->GetMaximum()); fitFunc->SetParameter(7, 4.); //was at 5. but it seems like 4. works better fitFunc->SetParameter(8, 3.); hTotal->Fit("fitFunc"); float ampPi = fitFunc->GetParameter(0); float centPi = fitFunc->GetParameter(1); float sigPi = fitFunc->GetParameter(2); piFunc->SetParameters(ampPi,centPi,sigPi); piFunc->SetLineColor(kViolet+1); float ampKP = fitFunc->GetParameter(3); float centKP = fitFunc->GetParameter(4); float sigKP = fitFunc->GetParameter(5); kpFunc->SetParameters(ampKP,centKP,sigKP); kpFunc->SetLineColor(kGreen+2); float ampE = fitFunc->GetParameter(6); float centE = fitFunc->GetParameter(7); float sigE = fitFunc->GetParameter(8); eFunc->SetParameters(ampE,centE,sigE); eFunc->SetLineColor(kBlue); piFunc->Draw("same"); kpFunc->Draw("same"); eFunc->Draw("same"); TLine *l1 = new TLine( 2.5,0, 2.5,0.9*hNsigma->GetMaximum()); TLine *l2 = new TLine(-1.0,0,-1.0,0.9*hNsigma->GetMaximum()); l1->SetLineColor(kOrange+2); l2->SetLineColor(kOrange+2); l1->SetLineWidth(2); l2->SetLineWidth(2); l1->Draw(); l2->Draw(); //* float totYield = fitFunc->Integral(-1.,2.5); float pionYield = piFunc->Integral(-1.,2.5); float kpYield = kpFunc->Integral(-1.,2.5); float eYield = eFunc->Integral(-1.,2.5); double pionerr = sqrt((1-pionYield/totYield)*pionYield/totYield/totalYeild); cout << pionYield/totYield << " " << pionerr << endl; }
void genieta16calib() { glob_t globbuf; int stat = glob (fileglob.c_str(), GLOB_MARK, NULL, &globbuf); if (stat) { switch (stat) { case GLOB_NOMATCH: cerr << "No file matching glob pattern "; break; case GLOB_NOSPACE: cerr << "glob ran out of memory "; break; case GLOB_ABORTED: cerr << "glob read error "; break; default: cerr << "unknown glob error stat=" << stat << " "; break; } cerr << fileglob << endl; exit(-1); } if (gl_verbose) cout<<globbuf.gl_pathc<<" files match the glob pattern"<<endl; for (size_t i=0; i<std::max((size_t)1,globbuf.gl_pathc); i++) { TVectorD vxday,vyfcamp,vzlumi; string path = globbuf.gl_pathv[i]; // pick out day of year and mean(sum(fC)) loadVectorsFromFile(path.c_str(),"%*lf %lf %lf %*lf %*s %*s %lf",vxday,vzlumi,vyfcamp); TGraph *pwg = new TGraph(vxday,vyfcamp); pwg->SetNameTitle(path.c_str(),path.c_str()); //pwg->Print(); v_graphs.push_back(pwg); optimizenorm(i,path); //pwg->Print(); } // calc average and rms int ngraphs = (int)v_graphs.size(); int npts = v_graphs[0]->GetN(); cout << ngraphs << " graphs, " << npts << " points per graph" << endl; TVectorD vx(npts),vyavg(npts),vyrms(npts), vxerr(npts); for (int i=0; i<npts; i++) { double x,y; v_graphs[0]->GetPoint(i,x,y); vx[i] = x; vxerr[i]=0; double yavg = y; for (int j=1; j<ngraphs; j++) { v_graphs[j]->GetPoint(i,x,y); if (x!=vx[i]) { cerr << x << " != " << vx[i] << endl; exit(-1); } yavg += y; } yavg /= (double)ngraphs; vyavg[i] = yavg; double var = 0.0; for (int j=0; j<ngraphs; j++) { v_graphs[j]->GetPoint(i,x,y); var += (y-yavg)*(y-yavg); } vyrms[i] = sqrt(var/(double)ngraphs); } TCanvas *c1 = new TCanvas("c1","c1",1500,600); v_graphs[0]->Draw("ALP"); v_graphs[0]->GetHistogram()->GetYaxis()->SetRangeUser(0.0,2.0); v_graphs[0]->SetTitle("Average laser response from i#eta=-16 depth 3 over 2016, selected channels; Day # ; Arbitrary norm"); for (int i=1; i<ngraphs; i++) { v_graphs[i]->Draw("LP same"); v_graphs[i]->SetLineColor(15); } TGraphErrors *gravg = new TGraphErrors(vx,vyavg,vxerr,vyrms); gravg->Draw("LPE same"); gravg->SetLineWidth(2); gPad->SetRightMargin(0.03); gPad->SetLeftMargin(0.08); gPad->Update(); gPad->SaveAs("ieta-16calib.png"); gravg->Print(); }
void MakePlots(TString filename, TString energy="8TeV", TString lumi=""){ TString outDir=filename; outDir.ReplaceAll("fitres","img"); outDir="tmp/"; //std::map<TString, TH2F *> deltaNLL_map; /*------------------------------ Plotto */ TCanvas *c = new TCanvas("c","c"); TFile f_in(filename, "read"); if(f_in.IsZombie()){ std::cerr << "File opening error: " << filename << std::endl; return; } TList *KeyList = f_in.GetListOfKeys(); std::cout << KeyList->GetEntries() << std::endl; for(int i =0; i < KeyList->GetEntries(); i++){ c->Clear(); TKey *key = (TKey *)KeyList->At(i); if(TString(key->GetClassName())!="RooDataSet") continue; RooDataSet *dataset = (RooDataSet *) key->ReadObj(); TString constTermName = dataset->GetName(); TString alphaName=constTermName; alphaName.ReplaceAll("constTerm","alpha"); TTree *tree = dataset2tree(dataset); TGraphErrors bestFit_ = bestFit(tree, alphaName, constTermName); TH2F *hist = prof2d(tree, alphaName, constTermName, "nll", "(12,-0.0005,0.0115,29,-0.0025,0.1425)",true); // // deltaNLL_map.insert(std::pair <TString, TH2F *>(keyName,hist)); hist->SaveAs(outDir+"/deltaNLL-"+constTermName+".root"); hist->Draw("colz"); bestFit_.Draw("P same"); bestFit_.SetMarkerSize(2); Int_t iBinX, iBinY; Double_t x,y; hist->GetBinWithContent2(0,iBinX,iBinY); x= hist->GetXaxis()->GetBinCenter(iBinX); y= hist->GetYaxis()->GetBinCenter(iBinY); TGraph nllBestFit(1,&x,&y); nllBestFit.SetMarkerStyle(3); nllBestFit.SetMarkerColor(kRed); TList* contour68 = contourFromTH2(hist, 0.68); hist->Draw("colz"); hist->GetZaxis()->SetRangeUser(0,50); bestFit_.Draw("P same"); nllBestFit.Draw("P same"); //contour68->Draw("same"); c->SaveAs(outDir+"/deltaNLL-"+constTermName+".png"); hist->SaveAs("tmp/hist-"+constTermName+".root"); nllBestFit.SaveAs("tmp/nllBestFit.root"); contour68->SaveAs("tmp/contour68.root"); delete hist; hist = prof2d(tree, alphaName, constTermName, "nll", "(12,-0.0005,0.0115,29,-0.0025,0.1425)"); RooHistPdf *histPdf = nllToL(hist); delete hist; RooDataSet *gen_dataset=histPdf->generate(*histPdf->getVariables(),1000000,kTRUE,kFALSE); TTree *genTree = dataset2tree(gen_dataset); genTree->SaveAs("tmp/genTree-"+constTermName+".root"); delete gen_dataset; delete histPdf; TGraphErrors toyGraph = g(genTree, constTermName); TGraphErrors bestFitGraph = g(tree,alphaName, constTermName); TGraphErrors bestFitScanGraph = g(y, x); delete genTree; delete tree; toyGraph.SetFillColor(kGreen); toyGraph.SetLineColor(kBlue); toyGraph.SetLineStyle(2); bestFitGraph.SetLineColor(kBlack); bestFitScanGraph.SetLineColor(kRed); bestFitScanGraph.SetLineWidth(2); TMultiGraph g_multi("multigraph",""); g_multi.Add(&toyGraph,"L3"); g_multi.Add(&toyGraph,"L"); g_multi.Add(&bestFitGraph, "L"); g_multi.Add(&bestFitScanGraph, "L"); g_multi.Draw("A"); c->Clear(); g_multi.Draw("A"); c->SaveAs(outDir+"/smearing_vs_energy-"+constTermName+".png"); // TPaveText *pv = new TPaveText(0.7,0.7,1, 0.8); // TLegend *legend = new TLegend(0.7,0.8,0.95,0.92); // legend->SetFillStyle(3001); // legend->SetFillColor(1); // legend->SetTextFont(22); // 132 // legend->SetTextSize(0.04); // l'ho preso mettendo i punti con l'editor e poi ho ricavato il valore con il metodo GetTextSize() // // legend->SetFillColor(0); // colore di riempimento bianco // legend->SetMargin(0.4); // percentuale della larghezza del simbolo // SetLegendStyle(legend); //Plot(c, data,mc,mcSmeared,legend, region, filename, energy, lumi); } f_in.Close(); return; }
void make1DLimit(TString combine_dir,TString type= "WH",bool blind=true){ //TString combine_dir = "test_runSusyHgg/signalInj_sms_ChiWH_0_175/"; //WH wh_limits.push_back(wh_125); wh_limits.push_back(wh_150); wh_limits.push_back(wh_175); wh_limits.push_back(wh_200); //HH hh_limits.push_back(hh_125); hh_limits.push_back(hh_150); hh_limits.push_back(hh_175); hh_limits.push_back(hh_200); TGraph obser( (200-125)/25 ); TGraph graph( (200-125)/25 ); TGraphAsymmErrors error( (200-125)/25 ); TGraphAsymmErrors error2S( (200-125)/25 ); TGraph obser_r( (200-125)/25 ); TGraph graph_r( (200-125)/25 ); TGraphAsymmErrors error_r( (200-125)/25 ); TGraphAsymmErrors error_r2S( (200-125)/25 ); TGraphErrors* theo = 0; if(type=="WH") theo = getTheoXSec("xsecs/CharginoNeutralino.txt"); else theo = getTheoXSec("xsecs/Higgsino_ElectroHiggs.txt"); //else theo = getTheoXSec("/home/amott/HggApp/SusyHgg/xsecs/Higgsino.txt"); for(int m=125;m<=200;m+=25) { int i=(m-125)/25; TFile limit_file(Form("%s/higgsCombineChi%s_0_%d.Asymptotic.mH120.root",combine_dir.Data(),type.Data(),m) ); TTree *limit_tree = (TTree*)limit_file.Get("limit"); TTreeFormula limit_form("get_limit","limit",limit_tree); float down_2s = -1; float down = -1; float exp = -1; float up = -1; float up_2s = -1; float obs = -1; if( type == "WH" ) { down_2s = wh_limits.at(i)[0]; down = wh_limits.at(i)[1]; exp = wh_limits.at(i)[2]; up = wh_limits.at(i)[3]; up_2s = wh_limits.at(i)[4]; obs = wh_limits.at(i)[5]; } else if ( type == "HH") { down_2s = hh_limits.at(i)[0]; down = hh_limits.at(i)[1]; exp = hh_limits.at(i)[2]; up = hh_limits.at(i)[3]; up_2s = hh_limits.at(i)[4]; obs = hh_limits.at(i)[5]; } else { std::cerr << "UNRECOGNIZED OPTION!!! QUITTING" << std::endl; } if(i==0) m+=5; //first point is actually at m=130 graph.SetPoint(i,float(m), exp); error.SetPoint(i,float(m), exp); error2S.SetPoint(i, float(m), exp); error.SetPointError(i, 0, 0, exp-down, up-exp); error2S.SetPointError(i, 0 , 0 , exp-down_2s, up_2s-exp); graph_r.SetPoint(i,float(m),exp/theo->Eval(m)); error_r.SetPoint(i,float(m),exp/theo->Eval(m)); error_r2S.SetPoint(i,float(m),exp/theo->Eval(m)); error_r.SetPointError(i,0,0,(exp-down)/theo->Eval(m),(up-exp)/theo->Eval(m)); error_r2S.SetPointError(i, 0, 0, (exp-down_2s)/theo->Eval(m), (up_2s-exp)/theo->Eval(m) ); obser.SetPoint(i,float(m),obs); obser_r.SetPoint(i,float(m),obs/theo->Eval(m)); if(i==0) m-=5; } TCanvas cv; cv.SetLogy(); cv.SetGrid(1,1); theo->SetMaximum(1e2); theo->SetMinimum(1e-2); theo->GetYaxis()->SetLabelSize(0.05); theo->GetYaxis()->SetTitleSize(0.06); theo->GetYaxis()->SetTitleOffset(0.8); theo->GetYaxis()->SetTitle("95% CL #sigma upper limit (pb)"); theo->GetXaxis()->SetTitle("m_{chargino} (GeV)"); if(type=="HH") theo->GetXaxis()->SetTitle("m_{neutralino} (GeV)"); theo->SetFillColor(kBlue); theo->SetLineStyle(kDotted); theo->SetLineWidth(2); error.SetMaximum(1e2); error.SetMinimum(1e-2); error.GetYaxis()->SetLabelSize(0.04); error.GetYaxis()->SetTitleSize(0.06); error.GetYaxis()->SetTitleOffset(0.8); error.GetXaxis()->SetLabelSize(0.04); error.GetXaxis()->SetTitleSize(0.05); error.GetXaxis()->SetTitleOffset(0.9); error.GetYaxis()->SetTitle("95% CL #sigma upper limit (pb)"); error.GetXaxis()->SetTitle("m_{chargino} (GeV)"); if(type=="HH") error.GetXaxis()->SetTitle("m_{neutralino} (GeV)"); error.SetFillColor(kGreen); error2S.SetFillColor(kYellow); error2S.SetTitle(""); error.SetTitle(""); error.Draw("A3"); error2S.Draw("3SAME"); error.Draw("3"); theo->SetTitle(""); theo->Draw("3C"); graph.SetLineStyle(kDashed); graph.SetLineWidth(2.0); graph.SetTitle(""); graph.Draw("C"); obser.SetLineStyle(1); obser.SetLineWidth(2.0); obser.SetTitle(""); if(!blind) obser.Draw("C"); TLegend leg(0.65,0.65,0.89,0.89); leg.SetFillColor(0); leg.SetBorderSize(0); leg.AddEntry(&graph,"expected","l"); leg.AddEntry(&error,"expected #pm1#sigma","F"); leg.AddEntry(&error2S,"expected #pm2#sigma","F"); leg.AddEntry(theo,"theoretical","f"); if(!blind) leg.AddEntry(&obser,"observed","l"); leg.Draw("SAME"); TLatex latex; latex.SetNDC(); latex.SetTextAngle(0); latex.SetTextColor(kBlack); float extraTextSize = extraOverCmsTextSize*cmsSize; latex.SetTextFont(lumifont); latex.SetTextAlign(31); latex.SetTextSize(cmsSize); latex.DrawLatex(lumix, lumiy,lumiText); latex.SetTextFont(cmsTextFont); latex.SetTextAlign(31); latex.SetTextSize(cmsSize); latex.DrawLatex(cmsx, cmsy, CMSText); latex.SetTextFont(extraTextFont); latex.SetTextAlign(31); latex.SetTextSize(extraTextSize); latex.DrawLatex(extrax, extray, extraText); TString infix=(blind ? "" : "_OBS"); cv.SaveAs(combine_dir+"/expected_exclusion_"+type+"_1D"+infix+"_v2.png"); cv.SaveAs(combine_dir+"/expected_exclusion_"+type+"_1D"+infix+"_v2.pdf"); cv.SaveAs(combine_dir+"/expected_exclusion_"+type+"_1D"+infix+"_v2.C"); error_r.SetMaximum(1e2); error_r.SetMinimum(1e-2); error_r.SetTitle(""); error_r.GetYaxis()->SetLabelSize(0.04); error_r.GetYaxis()->SetTitleSize(0.06); error_r.GetYaxis()->SetTitleOffset(0.8); error_r.GetXaxis()->SetLabelSize(0.04); error_r.GetXaxis()->SetTitleSize(0.05); error_r.GetXaxis()->SetTitleOffset(0.9); error_r.GetYaxis()->SetTitle("#sigma_{95%}/#sigma_{NLO}"); if(type=="HH") error_r.GetXaxis()->SetTitle("m_{neutralino} (GeV)"); else error_r.GetXaxis()->SetTitle("m_{chargino} (GeV)"); error_r.SetFillColor(kGreen); error_r2S.SetFillColor(kYellow); error_r2S.SetTitle(""); error_r.Draw("A3"); error_r2S.Draw("3SAME"); error_r.Draw("3SAME"); graph_r.SetLineStyle(kDashed); graph_r.SetLineWidth(2); graph_r.SetTitle(""); graph_r.Draw("C"); TLine l(125,1,205,1); l.SetLineWidth(3); l.SetLineColor(kBlue); //l.Draw("SAME"); obser_r.SetLineWidth(2); if(!blind) obser_r.Draw("C"); leg.Draw("SAME"); //lbl.SetY(0.20); //leg.SetY1NDC(0.28); //leg.SetY2NDC(0.43); //prelim.Draw(); //lbl.Draw(); latex.SetTextFont(lumifont); latex.SetTextAlign(31); latex.SetTextSize(cmsSize); latex.DrawLatex(lumix, lumiy,lumiText); latex.SetTextFont(cmsTextFont); latex.SetTextAlign(31); latex.SetTextSize(cmsSize); latex.DrawLatex(cmsx, cmsy, CMSText); latex.SetTextFont(extraTextFont); latex.SetTextAlign(31); latex.SetTextSize(extraTextSize); latex.DrawLatex(extrax, extray, extraText); cv.SaveAs(combine_dir+"/expected_exclusion_ratio_"+type+"_1D"+infix+"_v2.png"); cv.SaveAs(combine_dir+"/expected_exclusion_ratio_"+type+"_1D"+infix+"_v2.pdf"); cv.SaveAs(combine_dir+"/expected_exclusion_ratio_"+type+"_1D"+infix+"_v2.C"); }
void dnde() { ////// Load dnde amplitude data string prefix; string str_temp; prefix = "../chains/DmWoFermiLoglog8_3p0_0p3_"; str_temp = prefix + "dnde_mod1.dat"; TNtuple dndef( "dndef","dNdE","row:amplitude:sigma"); dndef.ReadFile( str_temp.c_str()); int sdim; sdim = dndef.GetEntries(); int sdimextra; int sdimT; sdimextra=3; sdimT= sdim; sdim = sdim-sdimextra; cout<<"sdim = " <<sdim<<endl; float log10e[sdim]; float eng[sdim]; float spectrum[sdim]; float spectrum2[sdim]; float sigma[sdim]; float errorL[sdim]; float errorR[sdim]; float *row ; int ii; float englogE = 3.0; float englogstep = 0.30; float etpar[sdimextra]; float etsig[sdimextra]; float slp, shift,normpri; slp = 0.; shift =0.; normpri =0.; for ( int i =0; i< sdim; i++) { ii= sdim -i-1; dndef.GetEntry(i); row = dndef.GetArgs(); log10e[i] = englogE-ii*englogstep; eng[i] = pow( 10., log10e[i]); cout<<"eng "<<ii<<" "<<eng[i]<<endl; spectrum[ii] = row[1]; cout<<"amp "<<ii<<" "<<spectrum[ii]<<endl; sigma[ii] = row[2]; cout<<"sigma "<<ii<<" "<<sigma[ii]<<endl; } for ( int i = sdim ; i< sdimT; i++) { dndef.GetEntry(i); row = dndef.GetArgs(); etpar[i-sdim] = row[1]; cout<<"addition "<<i<<" "<< etpar[i-sdim]; etsig[i-sdim] = row[2]; cout<<", sigma "<< etsig[i-sdim]<<endl;; } shift=etpar[0]; slp=etpar[1]; normpri = etpar[2]; for ( int i=0; i< sdim; i++) { spectrum2[i]=0.; for ( int j=i; j< sdim; j++) { spectrum2[i]=spectrum2[i]+spectrum[j]; } } ////// bestfit point float** bestamp; str_temp = prefix + "dnde_best.dat"; bestamp = read_file(str_temp.c_str(),sdimT,2); cout<<"===bestfit==="<<endl; for ( int i=0; i< sdim; i++) { ii= sdim -i-1; spectrum[ii] = bestamp[1][i]; cout<<"amp "<<ii<<" "<<spectrum[ii]<<endl; } shift=bestamp[1][sdim]; cout<<"shfit = " <<shift<<endl; slp=bestamp[1][sdim+1]; cout<<"slope = " <<slp<<endl; normpri = bestamp[1][sdim+2]; cout<<"primary electron normarlization = " <<normpri<<endl; ////// Load Fermi data float** fermidata; fermidata= read_file("../eptestF/FERMI_total_12months.dat",42,8); //TNtuple fermi( "dndef","dNdE" //,"Emin:Emax:Energy:Flux3:stat:sysp:sysm:smooth"); // fermi.Readfile("../eptestF/FERMI_total_12months.dat"); double Feng[42],Fflux3[42],Fstat[42],Fsysp[42],Fsysm[42], Ferrorp[42],Ferrorm[42]; double Fflux0[42],Fflux02[42],Ferrorp0[42],Ferrorp32[42]; double Feng2[42], Fflux32[42]; int Frow; Frow=42; for( int i = 0; i<42; i++) { Feng[i] = fermidata[2][i]; Feng2[i] = Feng[i]*(1.-shift); Fflux3[i] = fermidata[3][i]; Fflux0[i] = Fflux3[i]/pow( Feng[i],3); Fflux32[i] = Fflux3[i]*pow(1.-shift,3); Fstat[i] = fermidata[4][i]; Fsysp[i] = fermidata[5][i]; Fsysm[i] = fermidata[6][i]; Ferrorp[i]= sqrt( Fsysp[i]*Fsysp[i]+ Fstat[i] * Fstat[i]); Ferrorp0[i] = Ferrorp[i]/ pow( Feng[i],3); Ferrorm[i]= sqrt( Fsysp[i]*Fsysp[i]+ Fstat[i] * Fstat[i]); } ///// Load AMS electron + positron data float** AMSelectronData; int AMSeplnum=59; AMSelectronData = read_file("../eptestF/data/AllElectronFlux_AMS02_fromPlots_v2.data",AMSeplnum,4); double AMSepE[59],AMSepF[AMSeplnum],AMSepErru[AMSeplnum],AMSepErrd[AMSeplnum]; for ( int i =0 ; i < AMSeplnum; i++){ AMSepE[i] = AMSelectronData[0][i]; AMSepF[i] = AMSelectronData[2][i]; AMSepErru[i] = AMSelectronData[3][i]-AMSepF[i]; AMSepErrd[i] = -AMSelectronData[1][i]+AMSepF[i]; } ///// Spline of Fermi data ROOT::Math::Interpolator * interF = new ROOT::Math::Interpolator(42); ROOT::Math::Interpolator *interErr = new ROOT::Math::Interpolator(42); interF -> SetData( 42, Feng, Fflux0); interErr -> SetData( 42, Feng, Ferrorp0); for (int i = 0; i< 42; i++){ Feng2[i] = Feng[i]*(1.+shift); Fflux02[i] = ( interF-> Eval( Feng2[i])); Ferrorp32[i] = ( interErr-> Eval( Feng2[i])); Fflux32[i] = Fflux02[i]* pow( Feng[i],3); Ferrorp32[i] = Ferrorp32[i]* pow( Feng[i],3); //cout<<" Ferrorp32 "<< Ferrorp32[i] <<endl; Feng2[i] = Feng[i]; } ////// Load AMS data float** AMSdata; int AMSrow =65; AMSdata= read_file("../eptestF/AMS02.dat",65,5); float AMSerr1[65],AMSerr2[65],AMSerr[65],AMSpr[65], AMSEmin[65],AMSEmax[65],AMSE[65]; for( int i = 0; i<65; i++) { AMSEmin[i] = AMSdata[0][i] ; AMSEmax[i] = AMSdata[1][i] ; AMSE[i] = (AMSEmin[i]+AMSEmax[i])*0.5 ; AMSpr[i] = AMSdata[2][i] ; AMSerr1[i] = AMSdata[3][i] ; AMSerr2[i] = AMSdata[4][i] ; AMSerr[i] = sqrt( AMSerr1[i]*AMSerr1[i]+ AMSerr2[i]*AMSerr2[i]); // cout<<AMSerr[i]<<endl; } ////// Load pamela electron data float** pameladata; int pamelarow =39; pameladata= read_file("../eptestF/PAMELA_electrons_v2.dat",39,7); float Rmin[39],Rmax[39],pamelaerr[39],pamelaflux[39], pamelaE[39]; for( int i = 0; i<39; i++) { Rmin[i] = pameladata[0][i]; Rmax[i] = pameladata[1][i]; pamelaE[i] = pameladata[2][i]; pamelaflux[i] = pameladata[4][i]; pamelaerr[i] = sqrt( pow(pameladata[5][i],2) + pow(pameladata[6][i],2) ); // cout<<AMSerr[i]<<endl; } ////// Load HESS data float** hessdata; int hessrow =9; hessdata= read_file("../eptestF/HESS_v2.dat",9,6); float hessE[hessrow],hessflux3[hessrow], hesserr1m[hessrow],hesserr1p[hessrow],hesserrm[hessrow], hesserr2m[hessrow],hesserr2p[hessrow],hesserrp[hessrow]; for( int i = 0; i<hessrow; i++) { hessE[i] = hessdata[0][i]; hessflux3[i] = hessdata[1][i]; hesserr1m[i] = hessdata[2][i]; hesserr1p[i] = hessdata[3][i]; hesserr2p[i] = hessdata[4][i]; hesserr2m[i] = hessdata[5][i]; hesserrm[i] = sqrt( pow(hesserr1m[i],2) + pow(hesserr2m[i],2) ); hesserrp[i] = sqrt( pow(hesserr1p[i],2) + pow(hesserr2p[i],2) ); } ////// Load electron and positron background float** kradata; int bglnum = 146; cout<<prefix<<endl; string str_temp1; str_temp1 = prefix + "spectrum_kra.dat"; kradata = read_file( str_temp1.c_str(),bglnum,3); float bgeflux[bglnum],bgpflux[bglnum],bgeng[bglnum]; float bgepflux3[bglnum]; for ( int i =0; i< bglnum; i++) { bgeng[i] = kradata[0][i]; bgeflux[i] = kradata[1][i]*1.e4; bgpflux[i] = kradata[2][i]*1.e4; bgepflux3[i] = (bgpflux[i]+bgeflux[i])* pow( bgeng[i],3); } cout<<"test"<<endl; //TNtuple bge( "bge","KRA electron","flux"); //bge.ReadFile( "../eptestF/propmod/electronflux_KRA004_BG.dat"); //TNtuple bgp( "bgp","KRA positron","flux"); //bgp.ReadFile( "../eptestF/propmod/positronflux_KRA004_BG.dat"); //TNtuple bgeng0( "bgeng0","KRA Energy list","eng"); //bgeng0.ReadFile( "../eptestF/propmod/KRA004_ENG.dat"); /* for ( int i =0; i< bglnum; i++) { bgeng0.GetEntry(i); row = bgeng0.GetArgs(); bgeng[i]= row[0]; bge.GetEntry(i); row = bge.GetArgs(); bgeflux[i]= row[0]; if( i<10) cout<<setw(4)<<i<< setw(14)<<bgeflux[i]<<endl; bgeflux[i]= bgeflux[i]*pow( bgeng[i]/10., slp); if( i<10)cout<<setw(4)<<i<< setw(14)<<bgeflux[i]<<setw(8)<<slp<<endl; bgp.GetEntry(i); row = bgp.GetArgs(); bgpflux[i]= row[0]; bgepflux3[i] = (bgpflux[i]+bgeflux[i])* pow( bgeng[i],3); } */ /// Load DM fermi data str_temp = prefix + "spectrum_FERMI.dat" ; float** stepflux_F; stepflux_F= read_file(str_temp.c_str(),sdim,42); double dmflux_F[42]; double dmflux3_F[42]; for ( int j=0; j<42; j++) { dmflux_F[j] =0.; for ( int i = 0 ; i < sdim; i++) { ii= sdim -i-1; dmflux_F[j] = dmflux_F[j]+spectrum[ii]*stepflux_F[j][i]*1.e4; } dmflux3_F[j] = 2.*dmflux_F[j]*pow(Feng[j],3); } // Load DM AMS data str_temp = prefix + "spectrum_AMS.dat" ; float** stepflux_A; stepflux_A= read_file(str_temp.c_str(),sdim,65); double dmflux_A[65]; float dmflux3_A[65]; for ( int j=0; j<65; j++) { dmflux_A[j] =0.; for ( int i = 0 ; i < sdim; i++) { ii= sdim -i-1; dmflux_A[j] = dmflux_A[j]+spectrum[ii]*stepflux_A[j][i]*1.e4; //cout<< setw(4)<<ii< setw(15)<<spectrum[ii]<<endl; } dmflux3_A[j] = 2.*dmflux_A[j]*pow(AMSE[j],3); } ////// Load step function flux data float** stepffile; int dmnum; dmnum = 146; int stepnum=sdim; cout<<" sdim =???? "<<sdim<<endl; str_temp = prefix + "spectrum_stepf.dat" ; stepffile= read_file(str_temp.c_str(),stepnum,dmnum); float DMflux[dmnum]; float DMflux3[dmnum]; float DMeng[dmnum]; float epTotal[dmnum]; float eTotal[dmnum]; float epratio[dmnum]; // float DMengstep; // DMengstep = 0.025; for ( int j=0; j<dmnum; j++) { DMeng[j] = bgeng[j]; DMflux[j] =0.; for ( int i = 0 ; i < sdim; i++) { ii= sdim -i-1; DMflux[j] = DMflux[j]+spectrum[ii]*stepffile[j][i]*1.e4; //cout<<setw(5)<<i << setw(15)<<spectrum[ii]<<endl; } DMflux3[j] = 2.*DMflux[j]*pow(DMeng[j],3); epTotal [j] = DMflux3[j]+ bgepflux3[j]; eTotal [j] = DMflux[j]+ bgeflux[j]; epratio [j] =( DMflux[j]+ bgpflux[j]) / (2.* DMflux[j]+ bgpflux[j]+ bgeflux[j]) ; } ////// Load step function flux at Fermi energy float** stepffile2; str_temp = prefix + "spectrum_FERMI.dat" ; stepffile2= read_file(str_temp.c_str(), stepnum,42); float DMflux3_fermi[42]; for ( int j=0; j<42; j++) { DMflux3_fermi[j] =0.; for ( int i = 0 ; i < sdim; i++) { ii= sdim -i-1; DMflux3_fermi[j] = DMflux3_fermi[j]+ 2.*stepffile2[j][i]*1.e4*pow(Feng[j],3) ; //DMflux3_fermi[j] = 0.; } } TCanvas *mycanvas = new TCanvas("mycanvs","A Simple Graph with error bars",200,10,1200,1800); // mycanvas->SetFillColor(42); // mycanvas->SetGrid(); // mycanvas->GetFrame()->SetFillColor(18); // mycanvas -> Divide(1,2); // mycanvas -> cd(1); // mycanvas->GetFrame()->SetBorderSize(12); mycanvas->SetFillColor(18); TPad* pad1 = new TPad("pad1","dnde", 0.02,0.67,0.48,0.99,0); TPad* pad2 = new TPad("pad2","Fermi data",0.02,0.34,0.48,0.66,0); TPad* pad3 = new TPad("pad3","dnde data", 0.52,0.67,0.98,0.99,0); TPad* pad4 = new TPad("pad4","AMS data", 0.52,0.34,0.98,0.66,0); TPad* pad5 =new TPad("pad5","pamela data",0.02,0.01,0.48,0.33,0); TPad* pad6 = new TPad("pad6","Fermi data",0.52,0.01,0.98,0.33,0); //TH1F *hr = mycanvas->DrawFrame(10,10,4000,100); //mycanvas->DrawFrame(10,0,4000,200); pad1 -> Draw(); pad2 -> Draw(); pad3 -> Draw(); pad4 -> Draw(); pad5 -> Draw(); pad6 -> Draw(); ////// ////// Pad 1 ////// pad1->cd(); // TGraphErrors graph(n_points,x_vals,y_vals,NULL,y_errs); gROOT -> SetStyle("Plain"); //mycanvas-> GetPad(1)->SetBorderMode(-1); pad1->GetFrame()->SetBorderMode(-1); //mycanvas-> GetPad(1)->SetBorderSize(5); pad1->GetFrame()->SetBorderSize(5); // mycanvas-> GetPad(1)->SetFillColor(0); // pad1->GetFrame()->SetFillColor(42); pad1-> SetLogx(); pad1-> SetLogy(); TGraphErrors *gr = new TGraphErrors(sdim,eng,spectrum,NULL,sigma); TGraph * dNdEp = new TGraph(sdim,eng, spectrum2); gr->SetTitle("dNdE Mode1"); gr->GetXaxis() -> SetTitle("Energy [GeV]"); gr->GetXaxis() -> CenterTitle(1); gr->GetYaxis() -> SetTitle("dN/dE [GeV^{-1}]"); gr->GetYaxis() -> CenterTitle(1); // gr->SetMarkerColor(kBlue); gr->SetMarkerColor ( 4 ) ; gr->SetMarkerStyle(2); gr->SetLineColor ( 4 ) ; // gr->SetMarkerStyle(kOpenCircle); // gr->SetLineColor ( kBlue ) ; // gr->SetLineColor ( 4 ) ; gr->SetLineWidth(1); // gr->Draw("CLP"); gr->Draw("ALP"); // dNdEp -> Draw("C"); /////////////////// Pad 2 ////////////////// Fermi + HESS data // mycanvas -> cd(2); pad2 -> cd(); TGraphAsymmErrors *fermiP = new TGraphAsymmErrors(Frow,Feng, Fflux3,NULL,NULL,Ferrorm,Ferrorp); TGraphAsymmErrors *fermiP2 = new TGraphAsymmErrors(Frow,Feng2, Fflux32,NULL,NULL,Ferrorp32,Ferrorp32); TGraphAsymmErrors *hessP = new TGraphAsymmErrors(hessrow,hessE, hessflux3,NULL,NULL,hesserrm,hesserrp); TGraphAsymmErrors *AMSepP = new TGraphAsymmErrors(AMSeplnum,AMSepE, AMSepF,NULL,NULL,AMSepErrd,AMSepErru); fermiP->SetTitle("Fermi"); pad2-> SetLogx(); //pad2-> SetLogy(); fermiP->GetXaxis() -> SetTitle("Energy [GeV]"); fermiP->GetXaxis() -> CenterTitle(1); fermiP->GetYaxis() -> SetTitle("#Phi E^{3} [m^{-2}s^{-1}sr^{-1}GeV^{2}]"); fermiP2->SetMarkerStyle(2); fermiP2->SetLineColor ( 4 ) ; fermiP2->SetMarkerColor ( 4 ) ; hessP->SetLineColor ( 6 ) ; hessP->SetMarkerColor ( 6 ) ; hessP->SetMarkerStyle(33); AMSepP->SetLineColor ( 1 ) ; AMSepP->SetMarkerColor ( 1 ) ; AMSepP->SetMarkerStyle(33); fermiP->SetMarkerStyle(2); fermiP->SetLineColor ( 2 ) ; fermiP->SetMarkerColor ( 2 ) ; fermiP->GetYaxis() -> CenterTitle(1); TAxis *axis = fermiP -> GetXaxis(); axis -> SetLimits(10.,5000.); fermiP -> GetHistogram()->SetMaximum(250.); fermiP -> GetHistogram()->SetMinimum(30.); // mycanvas-> GetPad(2)->SetLogy(); fermiP -> Draw("AP"); fermiP2 -> Draw("P"); hessP -> Draw("P"); AMSepP -> Draw("P"); TGraph * bgepP = new TGraph(bglnum,bgeng, bgepflux3); bgepP -> Draw("C"); TGraph * DMepP = new TGraph(dmnum,DMeng, DMflux3); DMepP -> Draw("C"); TGraph * TepP = new TGraph(dmnum,DMeng, epTotal); TepP->SetLineColor ( 2 ) ; TepP -> Draw("C"); //TGraph *dmFermi = new TGraph(42, Feng, dmflux3_F); //dmFermi -> Draw("C*"); //TGraph *dmAMS = new TGraph(65, AMSE, dmflux3_A); //dmAMS -> SetMarkerColor(4); //dmAMS -> Draw("C*"); //TGraph * spc1 = new TGraph(42,Feng, Ftest1); //TGraph * spc2 = new TGraph(42,Feng, Ftest2); //TGraph * spc3 = new TGraph(42,Feng, Ftest3); //spc1 -> SetMarkerColor(2); //spc1 -> Draw("*"); //spc2 -> SetLineColor(2); //spc2 -> Draw("CP"); //TGraph * DMepP2 = new TGraph(42,Feng, DMflux3_fermi); //DMepP2 -> Draw("C"); mycanvas->Update(); /////////////////// Pad 3 ////////////////// step function spectrum pad3 -> cd(); float stfluxtemp[dmnum]; TGraph *stepfP0; TGraph *stepfP; pad3-> SetLogx(); pad3-> SetLogy(); for ( int j= 0; j< stepnum; j++){ for ( int i = 0; i< dmnum; i++) { stfluxtemp[i] =stepffile[i][j]*pow(DMeng[i],2); //cout<<stfluxtemp[i]<<" "<<DMeng[i]<<endl; } if (j==0) { stepfP0= new TGraph(dmnum,DMeng,stfluxtemp ); stepfP0->Draw("AC"); stepfP0 -> GetHistogram()->SetMaximum(1.e-4); stepfP0 -> GetHistogram()->SetMinimum(1.e-12); } else { stepfP= new TGraph(dmnum,DMeng,stfluxtemp ); stepfP->Draw("C"); } } stepfP0->SetTitle("dNdE"); TAxis *axis3 = stepfP0 -> GetXaxis(); axis3 -> SetLimits(5.,5000.); float Feng_f[42],stepflux_i[sdim][42]; for (int ii= 0 ; ii< 42 ; ii++){ Feng_f[ii] = Feng[ii]; for ( int jj = 0 ; jj< sdim; jj++) stepflux_i[jj][ii] = stepflux_F[ii][jj]* pow( Feng[ii],2); } //TGraph *dmF_spc = NULL; //for ( int i = 0; i< sdim ; i++) { //dmF_spc = new TGraph(42, Feng_f, stepflux_i[i]); //dmF_spc -> SetMarkerColor(4); //dmF_spc -> Draw("*"); //} mycanvas->Update(); /////////////////// Pad 4 ///////////////// AMS data pad4 -> cd(); pad4-> SetLogx(); pad4-> SetLogy(); TGraphErrors *amsP = new TGraphErrors(AMSrow,AMSE,AMSpr,NULL,AMSerr); amsP->SetTitle("AMS"); amsP->GetXaxis() -> SetTitle("Energy [GeV]"); amsP->GetXaxis() -> CenterTitle(1); amsP->GetYaxis() -> SetTitle("#Phi (e^{+}) / ( #Phi(e^{-})+ #Phi(e^{+}) )"); amsP->GetYaxis() -> CenterTitle(1); amsP->SetMarkerStyle(2); amsP->SetLineColor ( 2 ) ; amsP->SetMarkerColor ( 2 ) ; amsP -> Draw("AP"); TAxis *axisams = amsP -> GetXaxis(); axisams -> SetLimits(5.,5000.); TGraph * eprP = new TGraph(bglnum,bgeng, epratio); eprP -> Draw("C"); /////////////////// Pad 5 ///////////////// pamela electron data pad5 -> cd(); pad5-> SetLogx(); pad5-> SetLogy(); TGraphErrors *pamelaP = new TGraphErrors(pamelarow,pamelaE, pamelaflux,NULL,pamelaerr); pamelaP->SetTitle("PAMELA electron"); pamelaP->GetXaxis() -> SetTitle("Energy [GeV]"); pamelaP->GetXaxis() -> CenterTitle(1); pamelaP->GetYaxis() -> SetTitle("#Phi (e^{-}) "); pamelaP->GetYaxis() -> CenterTitle(1); pamelaP->SetMarkerStyle(2); pamelaP->SetLineColor ( 2 ) ; pamelaP->SetMarkerColor ( 2 ) ; TAxis *axis5 = pamelaP -> GetXaxis(); axis5 -> SetLimits(5.,5000.); // pamelaP -> GetHistogram()->SetMaximum(250.); pamelaP -> GetHistogram()->SetMinimum(1.e-8); pamelaP -> Draw("AP"); TGraph * etotalP = new TGraph(bglnum,bgeng, eTotal); etotalP -> Draw("C"); // Build and Draw a legend // TLegend leg(.1 ,.7 ,.3 ,.9 ,"Lab. Lesson 1"); // leg.SetFillColor (0) ; //gr->SetFillColor (0) ; //leg.AddEntry(gr,"Exp. Points"); //leg.AddEntry(&f,"Th. Law"); //leg.DrawClone("Same"); // Draw an arrow on the canvas mycanvas->Update(); mycanvas -> Print("dnde_mod1_fermi.pdf"); }
void draw_R2m(void) { const double er[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; double ccnt[9]; double eccnt[9]; double dcnt[9]; TGraphErrors *gr; TGraphErrors *grd; TH1D *hst; TH1D *hstd; double effUp, effDown, C, shift, size; double eeffUp, eeffDown, eC, eshift, esize; double fmin, fedm, errdef; int npari, nparx; int i, irc; char str[1024]; TF1 *fR2; TVirtualPad *pd; gStyle->SetOptStat(0); gStyle->SetOptFit(0); MyMinuit = new TMinuit(5); MyMinuit->SetFCN(chi2fun); MyMinuit->DefineParameter(0, "Const", 1000, 10, 0, 1E10); MyMinuit->DefineParameter(1, "EffUp", 1, 0.1, 0.5, 1.5); MyMinuit->DefineParameter(2, "EffDown", 1, 0.1, 0.5, 1.5); MyMinuit->DefineParameter(3, "Shift", 0, 0.1, -10, 10); MyMinuit->DefineParameter(4, "Size", 3, 1, 0, 10); MyMinuit->FixParameter(3); MyMinuit->FixParameter(4); MyMinuit->Migrad(); MyMinuit->GetParameter(0, C, eC); MyMinuit->GetParameter(1, effUp, eeffUp); MyMinuit->GetParameter(2, effDown, eeffDown); MyMinuit->GetParameter(3, shift, eshift); MyMinuit->GetParameter(4, size, esize); MyMinuit->mnstat(fmin, fedm, errdef, npari, nparx, irc); // Renorm top and bottom sections to the middle for (i=0; i<3; i++) { ccnt[i] = DataArray.cnt[i] / effUp; ccnt[i+3] = DataArray.cnt[i+3]; ccnt[i+6] = DataArray.cnt[i+6] / effDown; eccnt[i] = DataArray.ecnt[i] / effUp; eccnt[i+3] = DataArray.ecnt[i+3]; eccnt[i+6] = DataArray.ecnt[i+6] / effDown; } // for (i=0; i<9; i++) printf("L = %8.3f CNT = %6.1f +- %4.1f\n", r[i], cnt[i], ecnt[i]); gr = new TGraphErrors(9, DataArray.r, ccnt, er, eccnt); gr->SetLineColor(kBlue); gr->SetLineWidth(4); gr->SetMarkerStyle(20); gr->SetMarkerColor(kBlue); gr->SetMarkerSize(2); fR2 = new TF1("fR2", "[0] / ((x - [1]) * (x - [1]) - [2] * [2] / 4.0)", 1, 100); fR2->SetParameter(0, C); fR2->SetParameter(1, shift); fR2->SetParameter(2, size); fR2->SetLineColor(kRed); fR2->SetLineWidth(3); hst = new TH1D("H", ";Distance to reactor core center, m;Events per day", 35, 10, 13.5); hst->SetMinimum(DataArray.cnt[4] * 0.5); hst->SetMaximum(DataArray.cnt[4] * 1.5); hst->GetXaxis()->SetLabelSize(0.06); hst->GetYaxis()->SetLabelSize(0.06); hst->GetXaxis()->SetTitleSize(0.06); hst->GetYaxis()->SetTitleSize(0.06); hst->GetYaxis()->SetTitleOffset(1.25); hstd = new TH1D("H", ";Distance to reactor core center, m;Events per day", 35, 10, 13.5); hstd->SetMinimum(-40); hstd->SetMaximum(40); hstd->GetXaxis()->SetLabelSize(0.06); hstd->GetYaxis()->SetLabelSize(0.06); hstd->GetXaxis()->SetTitleSize(0.06); hstd->GetYaxis()->SetTitleSize(0.06); hstd->GetYaxis()->SetTitleOffset(1.25); TCanvas *cv = new TCanvas("CV", "R2", 800, 1200); cv->Divide(1, 2); // Do common fit and draw pd = cv->cd(1); pd->SetLeftMargin(0.15); pd->SetBottomMargin(0.15); pd->SetTopMargin(0.03); hst->Draw(); gr->Draw("p"); fR2->Draw("same"); TLatex txt; txt.SetTextSize(0.07); sprintf(str, "#chi^{2}/n.d.f. = %6.2f/5", fmin); txt.DrawLatex(11.3, DataArray.cnt[4] * 1.3, str); // Draw difference for (i=0; i<9; i++) dcnt[i] = ccnt[i] - fR2->Eval(DataArray.r[i]); grd = new TGraphErrors(9, DataArray.r, dcnt, er, eccnt); grd->SetLineColor(kBlue); grd->SetLineWidth(4); grd->SetMarkerStyle(20); grd->SetMarkerColor(kBlue); grd->SetMarkerSize(2); pd = cv->cd(2); pd->SetLeftMargin(0.15); pd->SetBottomMargin(0.15); pd->SetTopMargin(0.03); hstd->Draw(); grd->Draw("p"); }
void drawDifference(TH1* iH0,TH1 *iH1,TH1* iH2, TGraphErrors* iH3, int chnl,TGraphErrors* iH4,TGraphAsymmErrors* iH5,TH1* StatErrBand,TGraphErrors* iH6){ std::string lName = std::string(iH0->GetName()); TH1F *lHDiff = new TH1F((lName+"Diff").c_str(),(lName+"Diff").c_str(),nBins-1,WptLogBins);// lHDiff->Sumw2(); TH1F *lXHDiff1 = new TH1F((lName+"XDiff1").c_str(),(lName+"XDiff1").c_str(),iH0->GetNbinsX(),iH0->GetXaxis()->GetXmin(),iH0->GetXaxis()->GetXmax()); int i1 = 0; lXHDiff1->SetLineWidth(2); lXHDiff1->SetLineColor(kBlack); //lXHDiff1->SetLineStyle(2); StatErrBand->SetMarkerStyle(kFullCircle); StatErrBand->SetMarkerColor(kBlack);StatErrBand->SetMarkerSize(0.6); StatErrBand->SetLineWidth(2); StatErrBand->SetLineColor(kBlack); //lHDiff->GetYaxis()->SetRangeUser(0.2,1.8); lHDiff->GetYaxis()->SetRangeUser(0.6,1.5); if (chnl == 2) lHDiff->GetYaxis()->SetRangeUser(0.4,1.4); if (chnl == 3) lHDiff->GetYaxis()->SetRangeUser(0.3,1.3); lHDiff->GetYaxis()->SetTitleOffset(0.4); lHDiff->GetYaxis()->SetTitleSize(0.12); lHDiff->GetYaxis()->SetLabelSize(0.12); lHDiff->GetYaxis()->CenterTitle(); lHDiff->GetXaxis()->SetTitleOffset(1.); lHDiff->GetXaxis()->SetTitleSize(0.12); lHDiff->GetXaxis()->SetLabelSize(0); if(chnl==3) lHDiff->GetXaxis()->SetLabelSize(0.12); lHDiff->GetYaxis()->SetNdivisions(405); if (chnl == 3) lHDiff->GetXaxis()->SetTitle(" W p_{T} "); lHDiff->GetYaxis()->SetTitle("Theory/Data"); //lHDiff->GetYaxis()->SetTitle("Data/ResBos"); gStyle->SetOptStat(0); for(int i0 = 0; i0 < lHDiff->GetNbinsX()+1; i0++) { double lXCenter = lHDiff->GetBinCenter(i0); double lXVal = iH0 ->GetBinContent(i0); lXHDiff1->SetBinContent(i0, 1.0); while(iH1->GetBinCenter(i1) < lXCenter) {i1++;} if(iH1->GetBinContent(i0) > 0) lHDiff->SetBinContent(i0,lXVal/(iH1->GetBinContent(i0))); //if(iH1->GetBinContent(i0) > 0) lHDiff->SetBinError(i0,iH0->GetBinError(i0)/(iH1->GetBinContent(i0))); if(iH1->GetBinContent(i0) > 0) lHDiff->SetBinError(i0,0.00001); } TGraphErrors* ErrBand = new TGraphErrors(iH2); ErrBand->SetFillColor(kBlack); ErrBand->SetFillStyle(3354); ErrBand->SetLineWidth(1); if (chnl == 1) { lHDiff->SetMarkerStyle(kOpenCircle); lHDiff->SetMarkerColor(kBlue); lHDiff->SetLineColor(kBlue); } if (chnl == 2) { lHDiff->SetMarkerStyle(kOpenTriangleUp); lHDiff->SetMarkerColor(kRed); lHDiff->SetLineColor(kRed); } if (chnl == 3) { lHDiff->SetMarkerStyle(kOpenSquare); lHDiff->SetMarkerColor(kGreen+3); lHDiff->SetLineColor(kGreen+3); } lHDiff->SetMarkerSize(0.8); //lHDiff->SetLineColor(kBlack); lHDiff->SetMarkerColor(kBlack); lHDiff->SetTitle(""); lHDiff->Draw("E"); if (chnl == 1) iH5->Draw("2same"); if (chnl == 2 || chnl == 3) iH4->Draw("2same"); if (chnl == 2 || chnl == 3) iH3->Draw("2same"); if (chnl == 3) iH6->Draw("2"); lXHDiff1->Draw("histsame"); ErrBand->Draw("2same"); lHDiff->Draw("Esame"); StatErrBand->Draw("E1same"); }
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 advancedNoiseAnalysis( unsigned int runNumber, unsigned int loop = 1) { string inputFileName = "./histo/run00" + toString( runNumber ) + "-ped-histo.root"; string outputFileName = "./histo/run00" + toString( runNumber ) + "-adv-noise.root"; // before opening the input and the output files, try to see if they // are not opened yet and in case close them before continue TList * listOfOpenedFile = (TList*) gROOT->GetListOfFiles(); for ( int i = 0; i < listOfOpenedFile->GetSize() ; ++i ) { TFile * file = (TFile*) listOfOpenedFile->At( i ) ; TString fileName(file->GetName()); TString inputFileName1( inputFileName.c_str() ); TString outputFileName1( outputFileName.c_str() ); if ( ( fileName.Contains( inputFileName1 ) ) || ( inputFileName1.Contains( fileName ) ) || ( fileName.Contains( outputFileName1 ) ) || ( outputFileName1.Contains( fileName ) ) ) { cout << "Closing " << fileName << " before reopen " << endl; file->Close(); } } // close also all the previously opened canvas TList * listOfOpenedCanvas = (TList*) gROOT->GetListOfCanvases(); for ( int i = 0 ; i < listOfOpenedCanvas->GetSize() ; ++i ) { TCanvas * canvas = (TCanvas*) listOfOpenedCanvas->At( i ); TString canvasName2 = canvas->GetName(); if ( canvasName2.Contains( "det" ) ) { canvas->Close(); } } // now safely open the file TFile * inputFile = TFile::Open( inputFileName.c_str() ) ; TFile * outputFile = TFile::Open( outputFileName.c_str(), "RECREATE") ; TList * outputHistoList = new TList; // look into the inputFile for a folder named string pedeProcessorFolderName = "PedestalAndNoiseCalculator"; TDirectoryFile * pedeProcessorFolder = (TDirectoryFile*) inputFile->Get( pedeProcessorFolderName.c_str() ); if ( pedeProcessorFolder == 0 ) { cerr << "No pedestal processor folder found in file " << inputFileName << endl; return ; } // this folder should contain one folder for each loop. string loopFolderName = "loop-" + toString( loop ); TDirectoryFile * loopFolder = (TDirectoryFile *) pedeProcessorFolder->Get( loopFolderName.c_str() ); if ( loopFolder == 0 ) { cerr << "No " << loopFolderName << " found in file " << inputFileName << endl; return ; } // guess the number of sensors from the number of subfolder in the loopfolder size_t nDetector = loopFolder->GetListOfKeys()->GetSize(); cout << "This file contains " << nDetector << " detectors" << endl; // prepare arrays to store the mean and the rms of the noise distribution if ( noiseMean == NULL ) { delete [] noiseMean; noiseMean = NULL; } if ( noiseRMS == NULL ) { delete [] noiseRMS; noiseRMS = NULL; } if ( channel == NULL ) { delete [] channel; channel = NULL; } noiseMean = new double[ nDetector * kNChan ]; noiseRMS = new double[ nDetector * kNChan ]; channel = new double[ kNChan ]; string canvasName = "comparison"; string canvasTitle = "Noise comparison"; TCanvas * comparisonCanvas = new TCanvas( canvasName.c_str(), canvasTitle.c_str(), 1000, 500 ); comparisonCanvas->Divide(1,2); TPad * topPad = (TPad*) comparisonCanvas->cd(1); topPad->Divide( nDetector ); TPad * middlePad = (TPad *) comparisonCanvas->cd(2); middlePad->Divide( kNChan ); // for each detector we have to get the noise map and to prepare 4 // separe histos and maps for ( unsigned int iDetector = 0; iDetector < nDetector; iDetector++ ) { // get the noise map. string noiseMapName = "detector-" + toString( iDetector ) ; noiseMapName += "/NoiseMap-d" + toString( iDetector ) ; noiseMapName += "-l" + toString( loop ) ; TH2D * noiseMap = ( TH2D* ) loopFolder->Get( noiseMapName.c_str() ); // create a folder in the output file TDirectory * subfolder = outputFile->mkdir( string( "detector_" + toString( iDetector ) ).c_str(), string( "detector_" + toString( iDetector ) ).c_str() ); subfolder->cd(); string canvasName = "det" + toString( iDetector ); string canvasTitle = "Detector " + toString( iDetector ); TCanvas * canvas = new TCanvas( canvasName.c_str(), canvasTitle.c_str(), 1000, 500 ); canvas->Divide( kNChan, 2 ); // ok now start the loop on channels for ( size_t iChan = 0 ; iChan < kNChan ; ++iChan ) { if ( iDetector == 0 ) channel[iChan] = iChan - 0.5; string tempName = "NoiseMap_d" + toString( iDetector ) + "_l" + toString( loop ) + "_ch" + toString( iChan ) ; string tempTitle = "NoiseMap Det. " + toString( iDetector ) + " - Ch. " + toString( iChan ) ; TH2D * noiseMapCh = new TH2D ( tempName.c_str() , tempTitle.c_str(), kXPixel / kNChan , -0.5 + xLimit[ iChan ] , -0.5 + xLimit[ iChan + 1 ], kYPixel, -0.5, -0.5 + kYPixel ); noiseMapCh->SetXTitle("X [pixel]"); noiseMapCh->SetYTitle("Y [pixel]"); noiseMapCh->SetZTitle("Noise [ADC]"); noiseMapCh->SetStats( false ); outputHistoList->Add( noiseMapCh ) ; tempName = "NoiseDist_d" + toString( iDetector ) + "_l" + toString( loop ) + "_ch" + toString( iChan ) ; tempTitle = "NoiseDist Det. " + toString( iDetector ) + " - Ch. " + toString( iChan ) ; TH1D * noiseDistCh = new TH1D( tempName.c_str(), tempTitle.c_str(), 50, 0., 10. ); noiseDistCh->SetXTitle("Noise [ADC]"); noiseDistCh->SetLineColor( kColor[iDetector] ); noiseDistCh->SetLineStyle( iChan + 2 ); noiseDistCh->SetLineWidth( 2 ); outputHistoList->Add( noiseDistCh ); // let's start looping on pixels now for ( size_t yPixel = 1 ; yPixel <= kYPixel ; ++yPixel ) { for ( size_t xPixel = xLimit[ iChan ] + 1; xPixel <= xLimit[ iChan +1 ] ; ++xPixel ) { double noise = noiseMap->GetBinContent( xPixel , yPixel ); noiseMapCh->Fill( xPixel - 1 , yPixel - 1, noise ); noiseDistCh->Fill( noise ); } } canvas->cd( iChan + 1 ) ; noiseMapCh->Draw("colz"); canvas->cd( iChan + kNChan + 1 ); noiseDistCh->Draw(); topPad->cd( iDetector + 1 ); if ( iChan == 0 ) { noiseDistCh->Draw(); } else { noiseDistCh->Draw("same"); } middlePad->cd( iChan + 1 ); if ( iDetector == 0 ) { noiseDistCh->Draw(); } else { noiseDistCh->Draw("same"); } noiseMean[ kNChan * iDetector + iChan ] = noiseDistCh->GetMean(); noiseRMS[ kNChan * iDetector + iChan ] = noiseDistCh->GetRMS(); } canvas->Write(); } canvasName = "summary"; canvasTitle = "Noise summary"; TCanvas * summaryCanvas = new TCanvas( canvasName.c_str(), canvasTitle.c_str(), 1000, 500 ); summaryCanvas->SetGridx(1); TLegend * legend = new TLegend(0.5, 4.8, 1.5, 4.3,"","br");; for ( size_t iDetector = 0 ; iDetector < nDetector ; ++iDetector ) { TGraphErrors * gr = new TGraphErrors( kNChan, channel, &noiseMean[ iDetector * kNChan ], NULL, &noiseRMS[ iDetector * kNChan ] ); gr->SetName( string( "NoisePerChannel_d" + toString( iDetector )).c_str()); gr->SetTitle(string("Detector " + toString( iDetector )).c_str()); gr->GetXaxis()->SetTitle("Channel #"); gr->GetYaxis()->SetTitle("Noise [ADC]"); gr->GetXaxis()->SetNdivisions( 5 ); gr->GetXaxis()->SetLabelSize( 0 ); gr->SetMarkerStyle( iDetector + 1 ); gr->SetMarkerColor( kColor[iDetector] ); gr->SetLineColor( kColor[iDetector] ); gr->SetLineWidth( 2 ); legend->AddEntry( gr, string("Detector " + toString( iDetector )).c_str(), "LP"); if ( iDetector == 0 ) { gr->Draw("ALP"); } else { gr->Draw("LP"); } } legend->Draw(); for ( size_t iChan = 0 ; iChan < kNChan ; ++iChan ) { TPaveLabel * label = new TPaveLabel( iChan - 0.75 , 3.2 , iChan -0.25 , 3, string("Ch " + toString( iChan ) ).c_str()); label->Draw(); } summaryCanvas->Write(); comparisonCanvas->Write(); outputHistoList->Write(); }
/** @ingroup FMD_xsec_script @param scale @param filename @param var @param medName @param thick @param pdgName */ void DrawXsection(Bool_t scale=kFALSE, const char* filename="xsec.root", const char* var="LOSS", const char* medName="FMD_Si$", Double_t thick=.03, const char* pdgName="pi+") { TFile* file = TFile::Open(filename, "READ"); TTree* tree = static_cast<TTree*>(file->Get(Form("%s_%s",medName, pdgName))); TLeaf* tb = tree->GetLeaf("T"); TLeaf* vb = tree->GetLeaf(var); if (!vb) { std::cerr << "Leaf " << var << " not found" << std::endl; return; } Float_t tkine, value; tb->SetAddress(&tkine); vb->SetAddress(&value); Int_t n = tree->GetEntries(); Float_t xscale = 1; Float_t yscale = 1; if (scale) { TDatabasePDG* pdgDb = TDatabasePDG::Instance(); TParticlePDG* pdgP = pdgDb->GetParticle(pdgName); if (!pdgP) { std::cerr << "Couldn't find particle " << pdgName << std::endl; return; } Double_t m = pdgP->Mass(); Double_t q = pdgP->Charge() / 3; if (m == 0 || q == 0) { std::cerr << "Mass is 0" << std::endl; return; } xscale = 1 / m; yscale = 1 / (q * q); } TGraphErrors* graph = new TGraphErrors(n); for (Int_t i = 0; i < n; i++) { tree->GetEntry(i); Double_t x = tkine*xscale; Double_t y = value*yscale; graph->SetPoint(i, x, y); // 5 sigma graph->SetPointError(i, 0, 5 * .1 * y); } TCanvas* c = new TCanvas("c","c"); c->SetLogx(); c->SetLogy(); graph->SetLineWidth(2); graph->SetFillStyle(3001); graph->SetFillColor(6); graph->Draw("L"); graph->DrawClone("AL3"); c->Modified(); c->Update(); c->cd(); c->SaveAs("xsec.C"); }
void histos_pde(){ gStyle->SetOptFit(1); gStyle->SetOptStat(1110); std::string material[3] = {"lxe","lxe_tpb","lyso"}; std::string interaction[3] = {"","_noCher","_noScint"}; double sigmas[3][3][20]; // [mat][inter][pde] double errors[3][3][20]; // [mat][inter][pde] double pdeValues[20]; char pde[5]; TCanvas *c1 = new TCanvas("c1","multipads",900,700); for(int mat=0; mat<3;mat++){ for(int inter=0; inter<2;inter++){ for(int i=5;i<=100;i+=5){ pdeValues[i/5-1] = i; //There is an error with lsyo noScint pde 0.05 if((mat==2 && inter==2) && i==5)){ continue; } sprintf(pde, "%.2lf", i/100.0); if(i==100){ sprintf(pde, "0%.2lf", i/100.0); } std::string path = "/home/jmbenlloch/next/petalo/work/histo/pde/"; std::string fileName = path + material[mat] + interaction[inter] + std::string("_QE_") + std::string(pde) + std::string("_SPTR_0_ASIC_0_DT300_histos.root"); std::string(Form("%d", 1)); std::cout << fileName << std::endl; TFile *fIn = new TFile(fileName.c_str(), "read"); TH1F *h1 = (TH1F*) fIn->Get("DTOF.DTOF2"); TF1* gauF1 = new TF1("gauF1","gaus",-100,100); // h1->Scale(1/h1->Integral(), "width"); h1->Fit("gauF1","","e",-200,200); h1->Draw(); std::string histo = path + material[mat] + interaction[inter] + std::string("_pde_") + pde + std::string(".png"); std::cout << histo << std::endl; c1->Print(histo.c_str()); std::cout << "PDE: " << pde << "sigma: " << h1->GetFunction("gauF1")->GetParameter(2) << std::endl; sigmas[mat][inter][i/5-1] = h1->GetFunction("gauF1")->GetParameter(2); errors[mat][inter][i/5-1] = h1->GetFunction("gauF1")->GetParError(2); fIn->Close(); } } } c1->Close(); TCanvas *c2 = new TCanvas("c2","multipads",900,700); TGraphErrors *gLxe = new TGraphErrors(20, pdeValues, sigmas[0][0], 0, errors[0][0]); gLxe->SetLineColor(kRed); gLxe->SetLineWidth(2); TGraphErrors *gTpb = new TGraphErrors(20, pdeValues, sigmas[1][0], 0, errors[1][0]); gTpb->SetLineColor(kBlue); gTpb->SetLineWidth(2); TGraphErrors *gLyso = new TGraphErrors(20, pdeValues, sigmas[2][0], 0, errors[2][0]); gLyso->SetLineColor(kGreen); gLyso->SetLineWidth(2); std::cout << "LXe: "; for(int i=0;i<20;i++){ std::cout << sigmas[0][0][i] << ", "; } std::cout << std::endl; std::cout << "TPB: "; for(int i=0;i<20;i++){ std::cout << sigmas[1][0][i] << ", "; } std::cout << std::endl; std::cout << "LYSO: "; for(int i=0;i<20;i++){ std::cout << sigmas[2][0][i] << ", "; } std::cout << std::endl; gLyso->Draw(); gLyso->SetTitle(""); gLyso->GetXaxis().SetTitle("PDE (%)"); gLyso->GetXaxis()->SetLimits(0.,100.); gLyso->GetYaxis().SetTitle("CRT (ps)"); gLyso->SetMinimum(0.); gLyso->SetMaximum(150.); gTpb->Draw("same"); gLxe->Draw("same"); TLegend *leg = new TLegend(0.7, 0.7, 0.9, 0.9); leg->SetFillColor(0); leg->AddEntry(gLxe, "LXe", "lp"); leg->AddEntry(gTpb, "LXe-TPB", "lp"); leg->AddEntry(gLyso, "LYSO", "lp"); leg->Draw("same"); c2->Print("/home/jmbenlloch/next/petalo/work/histo/pde/pde.png"); /* TCanvas *c4 = new TCanvas("c4","multipads",900,700); TGraphErrors *gLxeErrors = new TGraphErrors(20, pdeValues, sigmas[0][0], 0, errors[0][0]); gLxeErrors->SetMinimum(0.); gLxeErrors->SetMaximum(200.); gLxeErrors->Draw(); c4->Print("/home/jmbenlloch/next/petalo/work/histo/pde/pdeErrors.png");*/ TCanvas *c3 = new TCanvas("c3","multipads",900,700); TGraphErrors *gLxe_noCher = new TGraphErrors(20, pdeValues, sigmas[0][1], 0, errors[0][1]); gLxe_noCher->SetLineColor(kRed); gLxe_noCher->SetLineWidth(2); TGraphErrors *gTpb_noCher = new TGraphErrors(20, pdeValues, sigmas[1][1], 0, errors[1][1]); gTpb_noCher->SetLineColor(kBlue); gTpb_noCher->SetLineWidth(2); TGraphErrors *gLyso_noCher = new TGraphErrors(20, pdeValues, sigmas[2][1], 0, errors[2][1]); gLyso_noCher->SetLineColor(kGreen); gLyso_noCher->SetLineWidth(2); gLyso_noCher->Draw(); gLyso_noCher->SetTitle("noCher"); gLyso_noCher->GetXaxis().SetTitle("PDE (%)"); gLyso_noCher->GetXaxis()->SetLimits(0.,100.); gLyso_noCher->GetYaxis().SetTitle("CRT (ps)"); gLyso_noCher->SetMinimum(0.); gLyso_noCher->SetMaximum(150.); gTpb_noCher->Draw("same"); gLxe_noCher->Draw("same"); TLegend *leg_noCher = new TLegend(0.7, 0.7, 0.9, 0.9); leg_noCher->SetFillColor(0); leg_noCher->AddEntry(gLxe, "LXe", "lp"); leg_noCher->AddEntry(gTpb, "LXe-TPB", "lp"); leg_noCher->AddEntry(gLyso, "LYSO", "lp"); leg_noCher->Draw("same"); c3->Print("/home/jmbenlloch/next/petalo/work/histo/pde/pde_noCher.png"); }
void ttbar_looseLep2Pt_logy() { //=========Macro generated from canvas: c1/c1 //========= (Sun Dec 11 15:16:17 2016) by ROOT version6.06/01 TCanvas *c1 = new TCanvas("c1", "c1",1,1,1200,1416); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); c1->SetHighLightColor(2); c1->Range(0,0,1,1); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetTickx(1); c1->SetTicky(1); c1->SetLeftMargin(0.15); c1->SetRightMargin(0.05); c1->SetTopMargin(0.07); c1->SetBottomMargin(0.13); c1->SetFrameFillStyle(0); c1->SetFrameBorderMode(0); // ------------>Primitives in pad: pad1 TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1); pad1->Draw(); pad1->cd(); pad1->Range(-93.75,-6.459411,531.25,2.538922); pad1->SetFillColor(0); pad1->SetBorderMode(0); pad1->SetBorderSize(2); pad1->SetLogy(); pad1->SetTickx(1); pad1->SetTicky(1); pad1->SetLeftMargin(0.15); pad1->SetRightMargin(0.05); pad1->SetTopMargin(0.07); pad1->SetBottomMargin(0); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); THStack *h = new THStack(); h->SetName("h"); h->SetTitle(""); h->SetMinimum(1.61613e-06); h->SetMaximum(32.94396); TH1F *h_stack_8 = new TH1F("h_stack_8","",20,0,500); h_stack_8->SetMinimum(3.472076e-07); h_stack_8->SetMaximum(81.10342); h_stack_8->SetDirectory(0); h_stack_8->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); h_stack_8->SetLineColor(ci); h_stack_8->GetXaxis()->SetLabelFont(42); h_stack_8->GetXaxis()->SetLabelOffset(0.007); h_stack_8->GetXaxis()->SetTitleSize(0.05); h_stack_8->GetXaxis()->SetTickLength(0.025); h_stack_8->GetXaxis()->SetTitleFont(42); h_stack_8->GetYaxis()->SetTitle("a.u./25 GeV"); h_stack_8->GetYaxis()->SetLabelFont(42); h_stack_8->GetYaxis()->SetLabelOffset(0.007); h_stack_8->GetYaxis()->SetTitleSize(0.05); h_stack_8->GetYaxis()->SetTickLength(0.025); h_stack_8->GetYaxis()->SetTitleOffset(1.5); h_stack_8->GetYaxis()->SetTitleFont(42); h_stack_8->GetZaxis()->SetLabelFont(42); h_stack_8->GetZaxis()->SetLabelOffset(0.007); h_stack_8->GetZaxis()->SetTitleSize(0.05); h_stack_8->GetZaxis()->SetTickLength(0.025); h_stack_8->GetZaxis()->SetTitleFont(42); h->SetHistogram(h_stack_8); TH1D *h_looseLep2Pt_QCD__85 = new TH1D("h_looseLep2Pt_QCD__85","",20,0,500); h_looseLep2Pt_QCD__85->SetBinContent(1,0.004168645); h_looseLep2Pt_QCD__85->SetBinContent(2,0.004299542); h_looseLep2Pt_QCD__85->SetBinContent(3,0.001765161); h_looseLep2Pt_QCD__85->SetBinContent(4,0.0008868067); h_looseLep2Pt_QCD__85->SetBinContent(6,0.0004026872); h_looseLep2Pt_QCD__85->SetBinContent(7,6.27175e-05); h_looseLep2Pt_QCD__85->SetBinError(1,0.001669574); h_looseLep2Pt_QCD__85->SetBinError(2,0.002080688); h_looseLep2Pt_QCD__85->SetBinError(3,0.001425843); h_looseLep2Pt_QCD__85->SetBinError(4,0.0005754946); h_looseLep2Pt_QCD__85->SetBinError(6,0.0004026872); h_looseLep2Pt_QCD__85->SetBinError(7,4.443558e-05); h_looseLep2Pt_QCD__85->SetEntries(25); h_looseLep2Pt_QCD__85->SetStats(0); ci = TColor::GetColor("#cccccc"); h_looseLep2Pt_QCD__85->SetFillColor(ci); h_looseLep2Pt_QCD__85->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); h_looseLep2Pt_QCD__85->GetXaxis()->SetLabelFont(42); h_looseLep2Pt_QCD__85->GetXaxis()->SetLabelOffset(0.007); h_looseLep2Pt_QCD__85->GetXaxis()->SetTitleSize(0.05); h_looseLep2Pt_QCD__85->GetXaxis()->SetTickLength(0.025); h_looseLep2Pt_QCD__85->GetXaxis()->SetTitleFont(42); h_looseLep2Pt_QCD__85->GetYaxis()->SetTitle("a.u./25 GeV"); h_looseLep2Pt_QCD__85->GetYaxis()->SetLabelFont(42); h_looseLep2Pt_QCD__85->GetYaxis()->SetLabelOffset(0.007); h_looseLep2Pt_QCD__85->GetYaxis()->SetTitleSize(0.05); h_looseLep2Pt_QCD__85->GetYaxis()->SetTickLength(0.025); h_looseLep2Pt_QCD__85->GetYaxis()->SetTitleFont(42); h_looseLep2Pt_QCD__85->GetZaxis()->SetLabelFont(42); h_looseLep2Pt_QCD__85->GetZaxis()->SetLabelOffset(0.007); h_looseLep2Pt_QCD__85->GetZaxis()->SetTitleSize(0.05); h_looseLep2Pt_QCD__85->GetZaxis()->SetTickLength(0.025); h_looseLep2Pt_QCD__85->GetZaxis()->SetTitleFont(42); h->Add(h_looseLep2Pt_QCD,""); TH1D *h_looseLep2Pt_Diboson__86 = new TH1D("h_looseLep2Pt_Diboson__86","",20,0,500); h_looseLep2Pt_Diboson__86->SetBinContent(1,0.01174144); h_looseLep2Pt_Diboson__86->SetBinContent(2,0.01187664); h_looseLep2Pt_Diboson__86->SetBinContent(3,0.004759406); h_looseLep2Pt_Diboson__86->SetBinContent(4,0.002930753); h_looseLep2Pt_Diboson__86->SetBinContent(5,0.00175143); h_looseLep2Pt_Diboson__86->SetBinContent(6,0.0008561466); h_looseLep2Pt_Diboson__86->SetBinContent(7,0.000727361); h_looseLep2Pt_Diboson__86->SetBinContent(8,0.0006566697); h_looseLep2Pt_Diboson__86->SetBinContent(9,0.0001931429); h_looseLep2Pt_Diboson__86->SetBinContent(10,0.0004155724); h_looseLep2Pt_Diboson__86->SetBinContent(11,0.0002518857); h_looseLep2Pt_Diboson__86->SetBinContent(14,0.0002218985); h_looseLep2Pt_Diboson__86->SetBinContent(15,0.0002412745); h_looseLep2Pt_Diboson__86->SetBinContent(19,0.0001695579); h_looseLep2Pt_Diboson__86->SetBinError(1,0.001495699); h_looseLep2Pt_Diboson__86->SetBinError(2,0.001560382); h_looseLep2Pt_Diboson__86->SetBinError(3,0.0009896295); h_looseLep2Pt_Diboson__86->SetBinError(4,0.0007445459); h_looseLep2Pt_Diboson__86->SetBinError(5,0.0005817517); h_looseLep2Pt_Diboson__86->SetBinError(6,0.00038167); h_looseLep2Pt_Diboson__86->SetBinError(7,0.0003371659); h_looseLep2Pt_Diboson__86->SetBinError(8,0.0003965161); h_looseLep2Pt_Diboson__86->SetBinError(9,0.0001370432); h_looseLep2Pt_Diboson__86->SetBinError(10,0.0002946848); h_looseLep2Pt_Diboson__86->SetBinError(11,0.0002518857); h_looseLep2Pt_Diboson__86->SetBinError(14,0.0002218985); h_looseLep2Pt_Diboson__86->SetBinError(15,0.0002412745); h_looseLep2Pt_Diboson__86->SetBinError(19,0.0001695579); h_looseLep2Pt_Diboson__86->SetEntries(227); h_looseLep2Pt_Diboson__86->SetStats(0); ci = TColor::GetColor("#9966cc"); h_looseLep2Pt_Diboson__86->SetFillColor(ci); h_looseLep2Pt_Diboson__86->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); h_looseLep2Pt_Diboson__86->GetXaxis()->SetLabelFont(42); h_looseLep2Pt_Diboson__86->GetXaxis()->SetLabelOffset(0.007); h_looseLep2Pt_Diboson__86->GetXaxis()->SetTitleSize(0.05); h_looseLep2Pt_Diboson__86->GetXaxis()->SetTickLength(0.025); h_looseLep2Pt_Diboson__86->GetXaxis()->SetTitleFont(42); h_looseLep2Pt_Diboson__86->GetYaxis()->SetTitle("a.u./25 GeV"); h_looseLep2Pt_Diboson__86->GetYaxis()->SetLabelFont(42); h_looseLep2Pt_Diboson__86->GetYaxis()->SetLabelOffset(0.007); h_looseLep2Pt_Diboson__86->GetYaxis()->SetTitleSize(0.05); h_looseLep2Pt_Diboson__86->GetYaxis()->SetTickLength(0.025); h_looseLep2Pt_Diboson__86->GetYaxis()->SetTitleFont(42); h_looseLep2Pt_Diboson__86->GetZaxis()->SetLabelFont(42); h_looseLep2Pt_Diboson__86->GetZaxis()->SetLabelOffset(0.007); h_looseLep2Pt_Diboson__86->GetZaxis()->SetTitleSize(0.05); h_looseLep2Pt_Diboson__86->GetZaxis()->SetTickLength(0.025); h_looseLep2Pt_Diboson__86->GetZaxis()->SetTitleFont(42); h->Add(h_looseLep2Pt_Diboson,""); TH1D *h_looseLep2Pt_ZpLjets__87 = new TH1D("h_looseLep2Pt_ZpLjets__87","",20,0,500); h_looseLep2Pt_ZpLjets__87->SetBinContent(1,0.02667925); h_looseLep2Pt_ZpLjets__87->SetBinContent(2,0.01473475); h_looseLep2Pt_ZpLjets__87->SetBinContent(3,0.003756899); h_looseLep2Pt_ZpLjets__87->SetBinContent(4,0.001254256); h_looseLep2Pt_ZpLjets__87->SetBinContent(5,0.0004467979); h_looseLep2Pt_ZpLjets__87->SetBinContent(6,0.0002317029); h_looseLep2Pt_ZpLjets__87->SetBinContent(7,0.0001188745); h_looseLep2Pt_ZpLjets__87->SetBinContent(8,5.180996e-05); h_looseLep2Pt_ZpLjets__87->SetBinContent(9,3.953698e-05); h_looseLep2Pt_ZpLjets__87->SetBinContent(10,5.25799e-05); h_looseLep2Pt_ZpLjets__87->SetBinContent(11,8.216096e-06); h_looseLep2Pt_ZpLjets__87->SetBinContent(12,1.278228e-05); h_looseLep2Pt_ZpLjets__87->SetBinContent(13,9.580175e-06); h_looseLep2Pt_ZpLjets__87->SetBinContent(14,1.588075e-06); h_looseLep2Pt_ZpLjets__87->SetBinContent(15,1.177547e-05); h_looseLep2Pt_ZpLjets__87->SetBinContent(16,1.223887e-06); h_looseLep2Pt_ZpLjets__87->SetBinContent(17,7.306459e-07); h_looseLep2Pt_ZpLjets__87->SetBinContent(20,1.45491e-06); h_looseLep2Pt_ZpLjets__87->SetBinError(1,0.0005258423); h_looseLep2Pt_ZpLjets__87->SetBinError(2,0.0003466748); h_looseLep2Pt_ZpLjets__87->SetBinError(3,0.0001526343); h_looseLep2Pt_ZpLjets__87->SetBinError(4,8.095507e-05); h_looseLep2Pt_ZpLjets__87->SetBinError(5,4.333559e-05); h_looseLep2Pt_ZpLjets__87->SetBinError(6,3.359842e-05); h_looseLep2Pt_ZpLjets__87->SetBinError(7,2.459211e-05); h_looseLep2Pt_ZpLjets__87->SetBinError(8,1.436585e-05); h_looseLep2Pt_ZpLjets__87->SetBinError(9,1.618837e-05); h_looseLep2Pt_ZpLjets__87->SetBinError(10,2.012392e-05); h_looseLep2Pt_ZpLjets__87->SetBinError(11,3.870226e-06); h_looseLep2Pt_ZpLjets__87->SetBinError(12,6.226944e-06); h_looseLep2Pt_ZpLjets__87->SetBinError(13,5.393688e-06); h_looseLep2Pt_ZpLjets__87->SetBinError(14,6.993857e-07); h_looseLep2Pt_ZpLjets__87->SetBinError(15,7.943273e-06); h_looseLep2Pt_ZpLjets__87->SetBinError(16,7.962562e-07); h_looseLep2Pt_ZpLjets__87->SetBinError(17,5.208535e-07); h_looseLep2Pt_ZpLjets__87->SetBinError(20,1.161384e-06); h_looseLep2Pt_ZpLjets__87->SetEntries(24915); h_looseLep2Pt_ZpLjets__87->SetStats(0); ci = TColor::GetColor("#3399cc"); h_looseLep2Pt_ZpLjets__87->SetFillColor(ci); h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetLabelFont(42); h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetLabelOffset(0.007); h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetTitleSize(0.05); h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetTickLength(0.025); h_looseLep2Pt_ZpLjets__87->GetXaxis()->SetTitleFont(42); h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetTitle("a.u./25 GeV"); h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetLabelFont(42); h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetLabelOffset(0.007); h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetTitleSize(0.05); h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetTickLength(0.025); h_looseLep2Pt_ZpLjets__87->GetYaxis()->SetTitleFont(42); h_looseLep2Pt_ZpLjets__87->GetZaxis()->SetLabelFont(42); h_looseLep2Pt_ZpLjets__87->GetZaxis()->SetLabelOffset(0.007); h_looseLep2Pt_ZpLjets__87->GetZaxis()->SetTitleSize(0.05); h_looseLep2Pt_ZpLjets__87->GetZaxis()->SetTickLength(0.025); h_looseLep2Pt_ZpLjets__87->GetZaxis()->SetTitleFont(42); h->Add(h_looseLep2Pt_Z+jets,""); TH1D *h_looseLep2Pt_WpLjets__88 = new TH1D("h_looseLep2Pt_WpLjets__88","",20,0,500); h_looseLep2Pt_WpLjets__88->SetBinContent(1,0.02932453); h_looseLep2Pt_WpLjets__88->SetBinContent(2,0.006497682); h_looseLep2Pt_WpLjets__88->SetBinContent(3,0.002693998); h_looseLep2Pt_WpLjets__88->SetBinContent(4,0.001997142); h_looseLep2Pt_WpLjets__88->SetBinContent(5,0.001838293); h_looseLep2Pt_WpLjets__88->SetBinContent(6,0.0008665013); h_looseLep2Pt_WpLjets__88->SetBinContent(7,0.001024588); h_looseLep2Pt_WpLjets__88->SetBinContent(8,0.0007202847); h_looseLep2Pt_WpLjets__88->SetBinContent(9,0.0001418163); h_looseLep2Pt_WpLjets__88->SetBinContent(10,0.0002837216); h_looseLep2Pt_WpLjets__88->SetBinContent(11,0.0001795552); h_looseLep2Pt_WpLjets__88->SetBinContent(12,1.395914e-05); h_looseLep2Pt_WpLjets__88->SetBinContent(13,1.974067e-05); h_looseLep2Pt_WpLjets__88->SetBinContent(14,5.586989e-06); h_looseLep2Pt_WpLjets__88->SetBinContent(15,4.838904e-05); h_looseLep2Pt_WpLjets__88->SetBinContent(16,8.80718e-06); h_looseLep2Pt_WpLjets__88->SetBinContent(17,2.15012e-06); h_looseLep2Pt_WpLjets__88->SetBinContent(18,3.517553e-06); h_looseLep2Pt_WpLjets__88->SetBinContent(19,3.815246e-07); h_looseLep2Pt_WpLjets__88->SetBinContent(20,1.212912e-05); h_looseLep2Pt_WpLjets__88->SetBinError(1,0.001351271); h_looseLep2Pt_WpLjets__88->SetBinError(2,0.0006213388); h_looseLep2Pt_WpLjets__88->SetBinError(3,0.0004390932); h_looseLep2Pt_WpLjets__88->SetBinError(4,0.0003469893); h_looseLep2Pt_WpLjets__88->SetBinError(5,0.0003545163); h_looseLep2Pt_WpLjets__88->SetBinError(6,0.0002163202); h_looseLep2Pt_WpLjets__88->SetBinError(7,0.0002255816); h_looseLep2Pt_WpLjets__88->SetBinError(8,0.0001927611); h_looseLep2Pt_WpLjets__88->SetBinError(9,6.565621e-05); h_looseLep2Pt_WpLjets__88->SetBinError(10,0.0001456303); h_looseLep2Pt_WpLjets__88->SetBinError(11,9.307131e-05); h_looseLep2Pt_WpLjets__88->SetBinError(12,4.209394e-06); h_looseLep2Pt_WpLjets__88->SetBinError(13,1.131021e-05); h_looseLep2Pt_WpLjets__88->SetBinError(14,3.172661e-06); h_looseLep2Pt_WpLjets__88->SetBinError(15,4.146079e-05); h_looseLep2Pt_WpLjets__88->SetBinError(16,5.369418e-06); h_looseLep2Pt_WpLjets__88->SetBinError(17,8.346041e-07); h_looseLep2Pt_WpLjets__88->SetBinError(18,2.861137e-06); h_looseLep2Pt_WpLjets__88->SetBinError(19,2.949137e-07); h_looseLep2Pt_WpLjets__88->SetBinError(20,6.047119e-06); h_looseLep2Pt_WpLjets__88->SetEntries(3309); h_looseLep2Pt_WpLjets__88->SetStats(0); ci = TColor::GetColor("#66cc66"); h_looseLep2Pt_WpLjets__88->SetFillColor(ci); h_looseLep2Pt_WpLjets__88->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); h_looseLep2Pt_WpLjets__88->GetXaxis()->SetLabelFont(42); h_looseLep2Pt_WpLjets__88->GetXaxis()->SetLabelOffset(0.007); h_looseLep2Pt_WpLjets__88->GetXaxis()->SetTitleSize(0.05); h_looseLep2Pt_WpLjets__88->GetXaxis()->SetTickLength(0.025); h_looseLep2Pt_WpLjets__88->GetXaxis()->SetTitleFont(42); h_looseLep2Pt_WpLjets__88->GetYaxis()->SetTitle("a.u./25 GeV"); h_looseLep2Pt_WpLjets__88->GetYaxis()->SetLabelFont(42); h_looseLep2Pt_WpLjets__88->GetYaxis()->SetLabelOffset(0.007); h_looseLep2Pt_WpLjets__88->GetYaxis()->SetTitleSize(0.05); h_looseLep2Pt_WpLjets__88->GetYaxis()->SetTickLength(0.025); h_looseLep2Pt_WpLjets__88->GetYaxis()->SetTitleFont(42); h_looseLep2Pt_WpLjets__88->GetZaxis()->SetLabelFont(42); h_looseLep2Pt_WpLjets__88->GetZaxis()->SetLabelOffset(0.007); h_looseLep2Pt_WpLjets__88->GetZaxis()->SetTitleSize(0.05); h_looseLep2Pt_WpLjets__88->GetZaxis()->SetTickLength(0.025); h_looseLep2Pt_WpLjets__88->GetZaxis()->SetTitleFont(42); h->Add(h_looseLep2Pt_W+jets,""); TH1D *h_looseLep2Pt_TopsPoPLFcP__89 = new TH1D("h_looseLep2Pt_TopsPoPLFcP__89","",20,0,500); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(1,0.09566986); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(2,0.1184424); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(3,0.0578968); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(4,0.02776582); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(5,0.01352875); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(6,0.006884179); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(7,0.003658057); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(8,0.001948227); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(9,0.001021047); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(10,0.000535609); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(11,0.000252071); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(12,0.0001040926); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(13,0.0002597359); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(14,4.685411e-05); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(15,2.316069e-05); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(16,7.098286e-06); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(17,1.098163e-05); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(18,5.405239e-06); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(19,1.254191e-05); h_looseLep2Pt_TopsPoPLFcP__89->SetBinContent(20,6.416628e-06); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(1,0.001032897); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(2,0.001159746); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(3,0.0008366751); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(4,0.0005883119); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(5,0.0003798421); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(6,0.0002961909); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(7,0.0002252512); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(8,0.0001593319); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(9,9.938102e-05); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(10,9.688184e-05); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(11,3.857011e-05); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(12,2.361438e-05); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(13,0.0001125534); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(14,1.684722e-05); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(15,1.087063e-05); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(16,7.098286e-06); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(17,7.125221e-06); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(18,3.836305e-06); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(19,8.954834e-06); h_looseLep2Pt_TopsPoPLFcP__89->SetBinError(20,4.538739e-06); h_looseLep2Pt_TopsPoPLFcP__89->SetEntries(45754); h_looseLep2Pt_TopsPoPLFcP__89->SetStats(0); ci = TColor::GetColor("#cc33cc"); h_looseLep2Pt_TopsPoPLFcP__89->SetFillColor(ci); h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetLabelFont(42); h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetLabelOffset(0.007); h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetTitleSize(0.05); h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetTickLength(0.025); h_looseLep2Pt_TopsPoPLFcP__89->GetXaxis()->SetTitleFont(42); h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetTitle("a.u./25 GeV"); h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetLabelFont(42); h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetLabelOffset(0.007); h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetTitleSize(0.05); h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetTickLength(0.025); h_looseLep2Pt_TopsPoPLFcP__89->GetYaxis()->SetTitleFont(42); h_looseLep2Pt_TopsPoPLFcP__89->GetZaxis()->SetLabelFont(42); h_looseLep2Pt_TopsPoPLFcP__89->GetZaxis()->SetLabelOffset(0.007); h_looseLep2Pt_TopsPoPLFcP__89->GetZaxis()->SetTitleSize(0.05); h_looseLep2Pt_TopsPoPLFcP__89->GetZaxis()->SetTickLength(0.025); h_looseLep2Pt_TopsPoPLFcP__89->GetZaxis()->SetTitleFont(42); h->Add(h_looseLep2Pt_Top (LF),""); TH1D *h_looseLep2Pt_TopsPoPHFcP__90 = new TH1D("h_looseLep2Pt_TopsPoPHFcP__90","",20,0,500); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(1,0.1041412); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(2,0.1735886); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(3,0.1116258); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(4,0.06454315); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(5,0.03441357); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(6,0.01992067); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(7,0.01014646); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(8,0.005947886); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(9,0.002876054); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(10,0.001475723); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(11,0.0007236292); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(12,0.0004357554); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(13,0.0002249375); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(14,0.0001475853); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(15,0.0001020681); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(16,6.402955e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(17,1.980568e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(18,2.33998e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinContent(20,2.517288e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(1,0.001126128); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(2,0.001474884); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(3,0.001116875); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(4,0.0008934187); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(5,0.0006246887); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(6,0.0005076532); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(7,0.0003555866); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(8,0.000286312); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(9,0.0001737097); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(10,0.0001517557); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(11,6.387877e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(12,5.265571e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(13,3.442087e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(14,2.732865e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(15,2.352865e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(16,1.915664e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(17,1.063003e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(18,1.102394e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetBinError(20,1.216417e-05); h_looseLep2Pt_TopsPoPHFcP__90->SetEntries(77950); h_looseLep2Pt_TopsPoPHFcP__90->SetStats(0); ci = TColor::GetColor("#ff9900"); h_looseLep2Pt_TopsPoPHFcP__90->SetFillColor(ci); h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetLabelFont(42); h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetLabelOffset(0.007); h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetTitleSize(0.05); h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetTickLength(0.025); h_looseLep2Pt_TopsPoPHFcP__90->GetXaxis()->SetTitleFont(42); h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetTitle("a.u./25 GeV"); h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetLabelFont(42); h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetLabelOffset(0.007); h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetTitleSize(0.05); h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetTickLength(0.025); h_looseLep2Pt_TopsPoPHFcP__90->GetYaxis()->SetTitleFont(42); h_looseLep2Pt_TopsPoPHFcP__90->GetZaxis()->SetLabelFont(42); h_looseLep2Pt_TopsPoPHFcP__90->GetZaxis()->SetLabelOffset(0.007); h_looseLep2Pt_TopsPoPHFcP__90->GetZaxis()->SetTitleSize(0.05); h_looseLep2Pt_TopsPoPHFcP__90->GetZaxis()->SetTickLength(0.025); h_looseLep2Pt_TopsPoPHFcP__90->GetZaxis()->SetTitleFont(42); h->Add(h_looseLep2Pt_Top (HF),""); h->Draw("hist"); TH1D *hsum__91 = new TH1D("hsum__91","",20,0,500); hsum__91->SetBinContent(1,0.271725); hsum__91->SetBinContent(2,0.3294396); hsum__91->SetBinContent(3,0.1824981); hsum__91->SetBinContent(4,0.09937792); hsum__91->SetBinContent(5,0.05197885); hsum__91->SetBinContent(6,0.02916189); hsum__91->SetBinContent(7,0.01573805); hsum__91->SetBinContent(8,0.009324878); hsum__91->SetBinContent(9,0.004271597); hsum__91->SetBinContent(10,0.002763206); hsum__91->SetBinContent(11,0.001415357); hsum__91->SetBinContent(12,0.0005665895); hsum__91->SetBinContent(13,0.0005139942); hsum__91->SetBinContent(14,0.000423513); hsum__91->SetBinContent(15,0.0004266677); hsum__91->SetBinContent(16,8.11589e-05); hsum__91->SetBinContent(17,3.366807e-05); hsum__91->SetBinContent(18,3.232259e-05); hsum__91->SetBinContent(19,0.0001824813); hsum__91->SetBinContent(20,4.517354e-05); hsum__91->SetBinError(1,0.003076049); hsum__91->SetBinError(2,0.003284904); hsum__91->SetBinError(3,0.002275067); hsum__91->SetBinError(4,0.001468607); hsum__91->SetBinError(5,0.001000255); hsum__91->SetBinError(6,0.0008373727); hsum__91->SetBinError(7,0.0005867939); hsum__91->SetBinError(8,0.0005494993); hsum__91->SetBinError(9,0.0002518041); hsum__91->SetBinError(10,0.0003753241); hsum__91->SetBinError(11,0.0002787325); hsum__91->SetBinError(12,5.819584e-05); hsum__91->SetBinError(13,0.0001183642); hsum__91->SetBinError(14,0.0002242324); hsum__91->SetBinError(15,0.0002463072); hsum__91->SetBinError(16,2.113829e-05); hsum__91->SetBinError(17,1.283488e-05); hsum__91->SetBinError(18,1.201793e-05); hsum__91->SetBinError(19,0.0001697944); hsum__91->SetBinError(20,1.436954e-05); hsum__91->SetEntries(65); hsum__91->SetStats(0); ci = 1187; color = new TColor(ci, 0, 0, 0, " ", 0.99); hsum__91->SetFillColor(ci); hsum__91->SetFillStyle(3003); hsum__91->SetLineWidth(0); hsum__91->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); hsum__91->GetXaxis()->SetLabelFont(42); hsum__91->GetXaxis()->SetLabelOffset(0.007); hsum__91->GetXaxis()->SetTitleSize(0.05); hsum__91->GetXaxis()->SetTickLength(0.025); hsum__91->GetXaxis()->SetTitleFont(42); hsum__91->GetYaxis()->SetTitle("a.u./25 GeV"); hsum__91->GetYaxis()->SetLabelFont(42); hsum__91->GetYaxis()->SetLabelOffset(0.007); hsum__91->GetYaxis()->SetTitleSize(0.05); hsum__91->GetYaxis()->SetTickLength(0.025); hsum__91->GetYaxis()->SetTitleFont(42); hsum__91->GetZaxis()->SetLabelFont(42); hsum__91->GetZaxis()->SetLabelOffset(0.007); hsum__91->GetZaxis()->SetTitleSize(0.05); hsum__91->GetZaxis()->SetTickLength(0.025); hsum__91->GetZaxis()->SetTitleFont(42); hsum__91->Draw("e2 same"); TH1D *h_looseLep2Pt_Data__92 = new TH1D("h_looseLep2Pt_Data__92","",20,0,500); h_looseLep2Pt_Data__92->SetBinContent(1,0.2915764); h_looseLep2Pt_Data__92->SetBinContent(2,0.3247432); h_looseLep2Pt_Data__92->SetBinContent(3,0.1760106); h_looseLep2Pt_Data__92->SetBinContent(4,0.0916329); h_looseLep2Pt_Data__92->SetBinContent(5,0.04946763); h_looseLep2Pt_Data__92->SetBinContent(6,0.02920946); h_looseLep2Pt_Data__92->SetBinContent(7,0.01620654); h_looseLep2Pt_Data__92->SetBinContent(8,0.008904174); h_looseLep2Pt_Data__92->SetBinContent(9,0.004805427); h_looseLep2Pt_Data__92->SetBinContent(10,0.002732498); h_looseLep2Pt_Data__92->SetBinContent(11,0.001837369); h_looseLep2Pt_Data__92->SetBinContent(12,0.001177801); h_looseLep2Pt_Data__92->SetBinContent(13,0.0008951286); h_looseLep2Pt_Data__92->SetBinContent(14,0.0002826722); h_looseLep2Pt_Data__92->SetBinContent(15,0.0001413361); h_looseLep2Pt_Data__92->SetBinContent(16,0.0001884481); h_looseLep2Pt_Data__92->SetBinContent(17,0.0001413361); h_looseLep2Pt_Data__92->SetBinContent(20,4.711203e-05); h_looseLep2Pt_Data__92->SetBinError(1,0.003706313); h_looseLep2Pt_Data__92->SetBinError(2,0.003911434); h_looseLep2Pt_Data__92->SetBinError(3,0.002879621); h_looseLep2Pt_Data__92->SetBinError(4,0.002077742); h_looseLep2Pt_Data__92->SetBinError(5,0.001526604); h_looseLep2Pt_Data__92->SetBinError(6,0.00117308); h_looseLep2Pt_Data__92->SetBinError(7,0.000873798); h_looseLep2Pt_Data__92->SetBinError(8,0.0006476834); h_looseLep2Pt_Data__92->SetBinError(9,0.0004758082); h_looseLep2Pt_Data__92->SetBinError(10,0.0003587945); h_looseLep2Pt_Data__92->SetBinError(11,0.0002942145); h_looseLep2Pt_Data__92->SetBinError(12,0.0002355602); h_looseLep2Pt_Data__92->SetBinError(13,0.0002053566); h_looseLep2Pt_Data__92->SetBinError(14,0.0001154004); h_looseLep2Pt_Data__92->SetBinError(15,8.160043e-05); h_looseLep2Pt_Data__92->SetBinError(16,9.422406e-05); h_looseLep2Pt_Data__92->SetBinError(17,8.160043e-05); h_looseLep2Pt_Data__92->SetBinError(20,4.711203e-05); h_looseLep2Pt_Data__92->SetEntries(21226); h_looseLep2Pt_Data__92->SetStats(0); h_looseLep2Pt_Data__92->SetLineWidth(3); h_looseLep2Pt_Data__92->SetMarkerStyle(20); h_looseLep2Pt_Data__92->SetMarkerSize(2); h_looseLep2Pt_Data__92->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); h_looseLep2Pt_Data__92->GetXaxis()->SetLabelFont(42); h_looseLep2Pt_Data__92->GetXaxis()->SetLabelOffset(0.007); h_looseLep2Pt_Data__92->GetXaxis()->SetTitleSize(0.05); h_looseLep2Pt_Data__92->GetXaxis()->SetTickLength(0.025); h_looseLep2Pt_Data__92->GetXaxis()->SetTitleFont(42); h_looseLep2Pt_Data__92->GetYaxis()->SetTitle("a.u./25 GeV"); h_looseLep2Pt_Data__92->GetYaxis()->SetLabelFont(42); h_looseLep2Pt_Data__92->GetYaxis()->SetLabelOffset(0.007); h_looseLep2Pt_Data__92->GetYaxis()->SetTitleSize(0.05); h_looseLep2Pt_Data__92->GetYaxis()->SetTickLength(0.025); h_looseLep2Pt_Data__92->GetYaxis()->SetTitleFont(42); h_looseLep2Pt_Data__92->GetZaxis()->SetLabelFont(42); h_looseLep2Pt_Data__92->GetZaxis()->SetLabelOffset(0.007); h_looseLep2Pt_Data__92->GetZaxis()->SetTitleSize(0.05); h_looseLep2Pt_Data__92->GetZaxis()->SetTickLength(0.025); h_looseLep2Pt_Data__92->GetZaxis()->SetTitleFont(42); h_looseLep2Pt_Data__92->Draw("elp same"); TLegend *leg = new TLegend(0.6,0.55,0.88,0.9,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(0); TLegendEntry *entry=leg->AddEntry("h_looseLep2Pt_Data","Data","ELP"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetMarkerColor(1); entry->SetMarkerStyle(20); entry->SetMarkerSize(2); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_Top (HF)","Top (HF)","F"); ci = TColor::GetColor("#ff9900"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_Top (LF)","Top (LF)","F"); ci = TColor::GetColor("#cc33cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_W+jets","W+jets","F"); ci = TColor::GetColor("#66cc66"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_Z+jets","Z+jets","F"); ci = TColor::GetColor("#3399cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_Diboson","Diboson","F"); ci = TColor::GetColor("#9966cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_QCD","QCD","F"); ci = TColor::GetColor("#cccccc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); leg = new TLegend(0.6,0.55,0.88,0.9,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(0); entry=leg->AddEntry("h_looseLep2Pt_Data","Data","ELP"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetMarkerColor(1); entry->SetMarkerStyle(20); entry->SetMarkerSize(2); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_Top (HF)","Top (HF)","F"); ci = TColor::GetColor("#ff9900"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_Top (LF)","Top (LF)","F"); ci = TColor::GetColor("#cc33cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_W+jets","W+jets","F"); ci = TColor::GetColor("#66cc66"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_Z+jets","Z+jets","F"); ci = TColor::GetColor("#3399cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_Diboson","Diboson","F"); ci = TColor::GetColor("#9966cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_looseLep2Pt_QCD","QCD","F"); ci = TColor::GetColor("#cccccc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); TLatex * tex = new TLatex(0.18,0.85,"CMS"); tex->SetNDC(); tex->SetTextSize(0.06); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.28,0.85,"Preliminary"); tex->SetNDC(); tex->SetTextFont(52); tex->SetTextSize(0.06); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.9,0.94,"36.6 fb^{-1} (13 TeV)"); tex->SetNDC(); tex->SetTextAlign(31); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); pad1->Modified(); c1->cd(); // ------------>Primitives in pad: pad2 TPad *pad2 = new TPad("pad2", "pad2",0,0.05,1,0.3); pad2->Draw(); pad2->cd(); pad2->Range(-93.75,-0.8914286,531.25,0.48); pad2->SetFillColor(0); pad2->SetBorderMode(0); pad2->SetBorderSize(2); pad2->SetGridy(); pad2->SetTickx(1); pad2->SetTicky(1); pad2->SetLeftMargin(0.15); pad2->SetRightMargin(0.05); pad2->SetTopMargin(0); pad2->SetBottomMargin(0.3); pad2->SetFrameFillStyle(0); pad2->SetFrameBorderMode(0); pad2->SetFrameFillStyle(0); pad2->SetFrameBorderMode(0); TH1D *ratio__93 = new TH1D("ratio__93","",20,0,500); ratio__93->SetBinContent(1,0.07305694); ratio__93->SetBinContent(2,-0.01425564); ratio__93->SetBinContent(3,-0.03554857); ratio__93->SetBinContent(4,-0.07793492); ratio__93->SetBinContent(5,-0.04831219); ratio__93->SetBinContent(6,0.00163126); ratio__93->SetBinContent(7,0.02976763); ratio__93->SetBinContent(8,-0.04511625); ratio__93->SetBinContent(9,0.1249721); ratio__93->SetBinContent(10,-0.01111317); ratio__93->SetBinContent(11,0.2981665); ratio__93->SetBinContent(12,1.078755); ratio__93->SetBinContent(13,0.741515); ratio__93->SetBinContent(14,-0.3325537); ratio__93->SetBinContent(15,-0.6687443); ratio__93->SetBinContent(16,1.321965); ratio__93->SetBinContent(17,3.197927); ratio__93->SetBinContent(18,-999); ratio__93->SetBinContent(19,-999); ratio__93->SetBinContent(20,0.04291213); ratio__93->SetBinError(1,0.0001); ratio__93->SetBinError(2,0.0001); ratio__93->SetBinError(3,0.0001); ratio__93->SetBinError(4,0.0001); ratio__93->SetBinError(5,0.0001); ratio__93->SetBinError(6,0.0001); ratio__93->SetBinError(7,0.0001); ratio__93->SetBinError(8,0.0001); ratio__93->SetBinError(9,0.0001); ratio__93->SetBinError(10,0.0001); ratio__93->SetBinError(11,0.0001); ratio__93->SetBinError(12,0.0001); ratio__93->SetBinError(13,0.0001); ratio__93->SetBinError(14,0.0001); ratio__93->SetBinError(15,0.0001); ratio__93->SetBinError(16,0.0001); ratio__93->SetBinError(17,0.0001); ratio__93->SetBinError(18,0.0001); ratio__93->SetBinError(19,0.0001); ratio__93->SetBinError(20,0.0001); ratio__93->SetMinimum(-0.48); ratio__93->SetMaximum(0.48); ratio__93->SetEntries(21246); ratio__93->SetStats(0); ratio__93->SetLineWidth(3); ratio__93->SetMarkerStyle(20); ratio__93->SetMarkerSize(2); ratio__93->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); ratio__93->GetXaxis()->SetLabelFont(43); ratio__93->GetXaxis()->SetLabelOffset(0.007); ratio__93->GetXaxis()->SetLabelSize(30); ratio__93->GetXaxis()->SetTitleSize(40); ratio__93->GetXaxis()->SetTickLength(0.025); ratio__93->GetXaxis()->SetTitleOffset(5); ratio__93->GetXaxis()->SetTitleFont(43); ratio__93->GetYaxis()->SetTitle("#frac{Data-Exp}{Exp}"); ratio__93->GetYaxis()->SetNdivisions(5); ratio__93->GetYaxis()->SetLabelFont(43); ratio__93->GetYaxis()->SetLabelOffset(0.007); ratio__93->GetYaxis()->SetLabelSize(30); ratio__93->GetYaxis()->SetTitleSize(40); ratio__93->GetYaxis()->SetTickLength(0.025); ratio__93->GetYaxis()->SetTitleOffset(2.5); ratio__93->GetYaxis()->SetTitleFont(43); ratio__93->GetZaxis()->SetLabelFont(42); ratio__93->GetZaxis()->SetLabelOffset(0.007); ratio__93->GetZaxis()->SetTitleSize(0.05); ratio__93->GetZaxis()->SetTickLength(0.025); ratio__93->GetZaxis()->SetTitleFont(42); ratio__93->Draw("elp"); TH1D *zero__94 = new TH1D("zero__94","",20,0,500); zero__94->SetBinError(1,0.003706313); zero__94->SetBinError(2,0.003911434); zero__94->SetBinError(3,0.002879621); zero__94->SetBinError(4,0.002077742); zero__94->SetBinError(5,0.001526604); zero__94->SetBinError(6,0.00117308); zero__94->SetBinError(7,0.000873798); zero__94->SetBinError(8,0.0006476834); zero__94->SetBinError(9,0.0004758082); zero__94->SetBinError(10,0.0003587945); zero__94->SetBinError(11,0.0002942145); zero__94->SetBinError(12,0.0002355602); zero__94->SetBinError(13,0.0002053566); zero__94->SetBinError(14,0.0001154004); zero__94->SetBinError(15,8.160043e-05); zero__94->SetBinError(16,9.422406e-05); zero__94->SetBinError(17,8.160043e-05); zero__94->SetBinError(20,4.711203e-05); zero__94->SetEntries(21246); zero__94->SetStats(0); zero__94->SetLineWidth(3); zero__94->SetMarkerStyle(20); zero__94->SetMarkerSize(2); zero__94->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); zero__94->GetXaxis()->SetLabelFont(42); zero__94->GetXaxis()->SetLabelOffset(0.007); zero__94->GetXaxis()->SetTitleSize(0.05); zero__94->GetXaxis()->SetTickLength(0.025); zero__94->GetXaxis()->SetTitleFont(42); zero__94->GetYaxis()->SetTitle("a.u./25 GeV"); zero__94->GetYaxis()->SetLabelFont(42); zero__94->GetYaxis()->SetLabelOffset(0.007); zero__94->GetYaxis()->SetTitleSize(0.05); zero__94->GetYaxis()->SetTickLength(0.025); zero__94->GetYaxis()->SetTitleFont(42); zero__94->GetZaxis()->SetLabelFont(42); zero__94->GetZaxis()->SetLabelOffset(0.007); zero__94->GetZaxis()->SetTitleSize(0.05); zero__94->GetZaxis()->SetTickLength(0.025); zero__94->GetZaxis()->SetTitleFont(42); zero__94->Draw("hist same"); TH1D *sumratioup__95 = new TH1D("sumratioup__95","",20,0,500); sumratioup__95->SetBinContent(1,0.01132045); sumratioup__95->SetBinContent(2,0.009971187); sumratioup__95->SetBinContent(3,0.01246625); sumratioup__95->SetBinContent(4,0.014778); sumratioup__95->SetBinContent(5,0.01924351); sumratioup__95->SetBinContent(6,0.02871463); sumratioup__95->SetBinContent(7,0.03728504); sumratioup__95->SetBinContent(8,0.05892831); sumratioup__95->SetBinContent(9,0.05894846); sumratioup__95->SetBinContent(10,0.1358292); sumratioup__95->SetBinContent(11,0.1969344); sumratioup__95->SetBinContent(12,0.1027125); sumratioup__95->SetBinContent(13,0.2302831); sumratioup__95->SetBinContent(14,0.5294582); sumratioup__95->SetBinContent(15,0.577281); sumratioup__95->SetBinContent(16,0.2604556); sumratioup__95->SetBinContent(17,0.3812182); sumratioup__95->SetBinContent(18,0.3718119); sumratioup__95->SetBinContent(19,0.9304757); sumratioup__95->SetBinContent(20,0.3180965); sumratioup__95->SetBinError(1,0.003076049); sumratioup__95->SetBinError(2,0.003284904); sumratioup__95->SetBinError(3,0.002275067); sumratioup__95->SetBinError(4,0.001468607); sumratioup__95->SetBinError(5,0.001000255); sumratioup__95->SetBinError(6,0.0008373727); sumratioup__95->SetBinError(7,0.0005867939); sumratioup__95->SetBinError(8,0.0005494993); sumratioup__95->SetBinError(9,0.0002518041); sumratioup__95->SetBinError(10,0.0003753241); sumratioup__95->SetBinError(11,0.0002787325); sumratioup__95->SetBinError(12,5.819584e-05); sumratioup__95->SetBinError(13,0.0001183642); sumratioup__95->SetBinError(14,0.0002242324); sumratioup__95->SetBinError(15,0.0002463072); sumratioup__95->SetBinError(16,2.113829e-05); sumratioup__95->SetBinError(17,1.283488e-05); sumratioup__95->SetBinError(18,1.201793e-05); sumratioup__95->SetBinError(19,0.0001697944); sumratioup__95->SetBinError(20,1.436954e-05); sumratioup__95->SetEntries(85); sumratioup__95->SetStats(0); ci = 1187; color = new TColor(ci, 0, 0, 0, " ", 0.99); sumratioup__95->SetFillColor(ci); sumratioup__95->SetFillStyle(3003); sumratioup__95->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); sumratioup__95->GetXaxis()->SetLabelFont(42); sumratioup__95->GetXaxis()->SetLabelOffset(0.007); sumratioup__95->GetXaxis()->SetTitleSize(0.05); sumratioup__95->GetXaxis()->SetTickLength(0.025); sumratioup__95->GetXaxis()->SetTitleFont(42); sumratioup__95->GetYaxis()->SetTitle("a.u./25 GeV"); sumratioup__95->GetYaxis()->SetLabelFont(42); sumratioup__95->GetYaxis()->SetLabelOffset(0.007); sumratioup__95->GetYaxis()->SetTitleSize(0.05); sumratioup__95->GetYaxis()->SetTickLength(0.025); sumratioup__95->GetYaxis()->SetTitleFont(42); sumratioup__95->GetZaxis()->SetLabelFont(42); sumratioup__95->GetZaxis()->SetLabelOffset(0.007); sumratioup__95->GetZaxis()->SetTitleSize(0.05); sumratioup__95->GetZaxis()->SetTickLength(0.025); sumratioup__95->GetZaxis()->SetTitleFont(42); sumratioup__95->Draw("hist same"); TH1D *sumratiodown__96 = new TH1D("sumratiodown__96","",20,0,500); sumratiodown__96->SetBinContent(1,-0.01132045); sumratiodown__96->SetBinContent(2,-0.009971187); sumratiodown__96->SetBinContent(3,-0.01246625); sumratiodown__96->SetBinContent(4,-0.014778); sumratiodown__96->SetBinContent(5,-0.01924351); sumratiodown__96->SetBinContent(6,-0.02871463); sumratiodown__96->SetBinContent(7,-0.03728504); sumratiodown__96->SetBinContent(8,-0.05892831); sumratiodown__96->SetBinContent(9,-0.05894846); sumratiodown__96->SetBinContent(10,-0.1358292); sumratiodown__96->SetBinContent(11,-0.1969344); sumratiodown__96->SetBinContent(12,-0.1027125); sumratiodown__96->SetBinContent(13,-0.2302831); sumratiodown__96->SetBinContent(14,-0.5294582); sumratiodown__96->SetBinContent(15,-0.577281); sumratiodown__96->SetBinContent(16,-0.2604556); sumratiodown__96->SetBinContent(17,-0.3812182); sumratiodown__96->SetBinContent(18,-0.3718119); sumratiodown__96->SetBinContent(19,-0.9304757); sumratiodown__96->SetBinContent(20,-0.3180965); sumratiodown__96->SetBinError(1,0.003076049); sumratiodown__96->SetBinError(2,0.003284904); sumratiodown__96->SetBinError(3,0.002275067); sumratiodown__96->SetBinError(4,0.001468607); sumratiodown__96->SetBinError(5,0.001000255); sumratiodown__96->SetBinError(6,0.0008373727); sumratiodown__96->SetBinError(7,0.0005867939); sumratiodown__96->SetBinError(8,0.0005494993); sumratiodown__96->SetBinError(9,0.0002518041); sumratiodown__96->SetBinError(10,0.0003753241); sumratiodown__96->SetBinError(11,0.0002787325); sumratiodown__96->SetBinError(12,5.819584e-05); sumratiodown__96->SetBinError(13,0.0001183642); sumratiodown__96->SetBinError(14,0.0002242324); sumratiodown__96->SetBinError(15,0.0002463072); sumratiodown__96->SetBinError(16,2.113829e-05); sumratiodown__96->SetBinError(17,1.283488e-05); sumratiodown__96->SetBinError(18,1.201793e-05); sumratiodown__96->SetBinError(19,0.0001697944); sumratiodown__96->SetBinError(20,1.436954e-05); sumratiodown__96->SetEntries(85); sumratiodown__96->SetStats(0); ci = 1187; color = new TColor(ci, 0, 0, 0, " ", 0.99); sumratiodown__96->SetFillColor(ci); sumratiodown__96->SetFillStyle(3003); sumratiodown__96->GetXaxis()->SetTitle("Sub-leading lep p_{T} [GeV]"); sumratiodown__96->GetXaxis()->SetLabelFont(42); sumratiodown__96->GetXaxis()->SetLabelOffset(0.007); sumratiodown__96->GetXaxis()->SetTitleSize(0.05); sumratiodown__96->GetXaxis()->SetTickLength(0.025); sumratiodown__96->GetXaxis()->SetTitleFont(42); sumratiodown__96->GetYaxis()->SetTitle("a.u./25 GeV"); sumratiodown__96->GetYaxis()->SetLabelFont(42); sumratiodown__96->GetYaxis()->SetLabelOffset(0.007); sumratiodown__96->GetYaxis()->SetTitleSize(0.05); sumratiodown__96->GetYaxis()->SetTickLength(0.025); sumratiodown__96->GetYaxis()->SetTitleFont(42); sumratiodown__96->GetZaxis()->SetLabelFont(42); sumratiodown__96->GetZaxis()->SetLabelOffset(0.007); sumratiodown__96->GetZaxis()->SetTitleSize(0.05); sumratiodown__96->GetZaxis()->SetTickLength(0.025); sumratiodown__96->GetZaxis()->SetTitleFont(42); sumratiodown__96->Draw("hist same"); Double_t Graph0_fx1008[20] = { 12.5, 37.5, 62.5, 87.5, 112.5, 137.5, 162.5, 187.5, 212.5, 237.5, 262.5, 287.5, 312.5, 337.5, 362.5, 387.5, 412.5, 437.5, 462.5, 487.5}; Double_t Graph0_fy1008[20] = { 0.07305694, -0.01425564, -0.03554857, -0.07793492, -0.04831219, 0.00163126, 0.02976763, -0.04511625, 0.1249721, -0.01111317, 0.2981665, 1.078755, 0.741515, -0.3325537, -0.6687443, 1.321965, 3.197927, -999, -999, 0.04291213}; Double_t Graph0_fex1008[20] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t Graph0_fey1008[20] = { 0.01363994, 0.01187299, 0.01577891, 0.02090748, 0.02936972, 0.04022648, 0.05552135, 0.06945757, 0.1113888, 0.1298472, 0.207873, 0.415751, 0.3995309, 0.2724838, 0.1912505, 1.160983, 2.423674, 0, 0, 1.042912}; TGraphErrors *gre = new TGraphErrors(20,Graph0_fx1008,Graph0_fy1008,Graph0_fex1008,Graph0_fey1008); gre->SetName("Graph0"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineWidth(3); TH1F *Graph_Graph1008 = new TH1F("Graph_Graph1008","Graph",100,0,535); Graph_Graph1008->SetMinimum(-1099.462); Graph_Graph1008->SetMaximum(106.0838); Graph_Graph1008->SetDirectory(0); Graph_Graph1008->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1008->SetLineColor(ci); Graph_Graph1008->GetXaxis()->SetLabelFont(42); Graph_Graph1008->GetXaxis()->SetLabelOffset(0.007); Graph_Graph1008->GetXaxis()->SetTitleSize(0.05); Graph_Graph1008->GetXaxis()->SetTickLength(0.025); Graph_Graph1008->GetXaxis()->SetTitleFont(42); Graph_Graph1008->GetYaxis()->SetLabelFont(42); Graph_Graph1008->GetYaxis()->SetLabelOffset(0.007); Graph_Graph1008->GetYaxis()->SetTitleSize(0.05); Graph_Graph1008->GetYaxis()->SetTickLength(0.025); Graph_Graph1008->GetYaxis()->SetTitleFont(42); Graph_Graph1008->GetZaxis()->SetLabelFont(42); Graph_Graph1008->GetZaxis()->SetLabelOffset(0.007); Graph_Graph1008->GetZaxis()->SetTitleSize(0.05); Graph_Graph1008->GetZaxis()->SetTickLength(0.025); Graph_Graph1008->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1008); gre->Draw("pe0"); pad2->Modified(); c1->cd(); c1->Modified(); c1->cd(); c1->SetSelected(c1); }
void Drawmethodcomp(){ const int nDil = 8; const double centDil[nDil+1] = {1.0,0.7,0.6,0.5,0.4,0.3,0.2,0.1,0}; double centDilbin[nDil]; for(int i=0;i<nDil;i++) centDilbin[i]=0.29+i+N-1-nDil; const double NpartDil[nDil] = {8.75,30.51,53.30,86.23,130.06,187.35,261.49,355.45}; const double NpartDilerr[nDil] = {1.13,3.02,3.95,4.35,4.60,4.44,3.96,2.83}; const double NcollDil[nDil] = {8.01,38.86,86.85,175.76,326.06,563.21,926.79,1484.49}; const double NcollDilerr[nDil] = {1.41,6.41,12.48,21.13,34.27,52.66,81.37,120.0}; TGraphErrors *graphNpartDil = new TGraphErrors(nDil,centDilbin,NpartDil,0,NpartDilerr); TGraphErrors *graphNcollDil = new TGraphErrors(nDil,centDilbin,NcollDil,0,NcollDilerr); TCanvas *c1 = new TCanvas("c1","c1",1,1,550,460); c1->SetLogy(); c1->SetFillColor(10); c1->SetFrameFillColor(0); c1->SetFrameBorderSize(0); c1->SetFrameBorderMode(0); c1->SetLeftMargin(0.15); c1->SetBottomMargin(0.15); c1->SetTopMargin(0.02); c1->SetRightMargin(0.02); gStyle->SetOptStat(0); c1->SetTicks(-1); N=N-1; TString str="Ncoll"; TH1D* hist = new TH1D("","",N,0,N); hist->GetXaxis()->SetNdivisions(502); if(method==0) hist->SetXTitle("Centrality"); else hist->SetXTitle("HF #Sigma E_{T} |#eta|>3"); hist->SetYTitle(Form("<%s> and systematic errors",str.Data())); hist->SetMinimum(1); hist->SetMaximum(3999.99); hist->GetXaxis()->CenterTitle(0); hist->GetYaxis()->CenterTitle(1); hist->GetYaxis()->SetTitleOffset(1.1); hist->GetXaxis()->SetTitleOffset(1.1); hist->GetXaxis()->SetTitleSize(0.056); hist->GetYaxis()->SetTitleSize(0.056); hist->GetXaxis()->SetLabelSize(0.05); hist->GetYaxis()->SetLabelSize(0.05); hist->GetXaxis()->SetLabelOffset(99); hist->Draw(); TFile *f=TFile::Open(outG); TGraphErrors* graph = (TGraphErrors*)f->Get(Form("std/%s_graph",str.Data())); // TGraphErrors* Gri055_graph = (TGraphErrors*)f->Get(Form("Gri055/%s_graph",str.Data())); // TGraphErrors* Gri101_graph = (TGraphErrors*)f->Get(Form("Gri101/%s_graph",str.Data())); TVectorD *centbin = (TVectorD*)f->Get(Form("std/G0/centbin")); TVectorD *kpoint = (TVectorD*)f->Get(Form("std/G0/kpoint")); TFile *f1=TFile::Open(Form("../../OneComp/double_side/%s",outG.Data())); TGraphErrors* graph1 = (TGraphErrors*)f1->Get(Form("std/%s_graph",str.Data())); // TGraphErrors* Gri055_graph = (TGraphErrors*)f->Get(Form("Gri055/%s_graph",str.Data())); // TGraphErrors* Gri101_graph = (TGraphErrors*)f->Get(Form("Gri101/%s_graph",str.Data())); TVectorD *centbin1 = (TVectorD*)f1->Get(Form("std/G0/centbin")); TVectorD *kpoint1 = (TVectorD*)f1->Get(Form("std/G0/kpoint")); graph->SetTitle("g1"); graph->SetMarkerStyle(20); graph->SetMarkerColor(1); graph->SetLineColor(1); graph->SetLineWidth(2); graph->SetMarkerSize(1.2); graph->Draw("Psameez"); graph1->SetMarkerStyle(24); graph1->SetMarkerColor(4); graph1->SetLineColor(4); graph1->SetLineWidth(2); graph1->SetMarkerSize(1.2); graph1->Draw("Psameez"); /* Gri055_graph->SetTitle("g2"); Gri055_graph->SetMarkerStyle(33); Gri055_graph->SetMarkerColor(2); Gri055_graph->SetLineColor(2); Gri055_graph->SetLineWidth(2); Gri055_graph->SetMarkerSize(1.2); Gri055_graph->Draw("Psameez"); Gri101_graph->SetTitle("g3"); Gri101_graph->SetMarkerStyle(34); Gri101_graph->SetMarkerColor(4); Gri101_graph->SetLineColor(4); Gri101_graph->SetLineWidth(2); Gri101_graph->SetMarkerSize(1.2); Gri101_graph->Draw("Psameez"); */ graphNpartDil->SetMarkerSize(1.2); graphNpartDil->SetLineColor(2); graphNpartDil->SetLineWidth(2); graphNpartDil->SetMarkerStyle(33); graphNpartDil->SetMarkerColor(2); graphNcollDil->SetMarkerSize(1.2); graphNcollDil->SetLineColor(2); graphNcollDil->SetLineWidth(2); graphNcollDil->SetMarkerStyle(33); graphNcollDil->SetMarkerColor(2); if(str=="Npart") graphNpartDil->Draw("Psame"); if(str=="Ncoll") graphNcollDil->Draw("Psame"); std::vector<TString> label(N); for(int i=0;i<N;i++) if(method==0)label[i] = Form("%.2f-%.2f%%",(*centbin)[i]*100,(*centbin)[i+1]*100); else label[i] = Form("%.2f-%.2f",(*kpoint)[i],(*kpoint)[i+1]); TLatex *tex1= new TLatex(0.2,0.9,"CMS Preliminary PbPb #sqrt{s_{NN}} = 2.76 TeV"); tex1->SetNDC(); tex1->SetTextColor(1); tex1->SetTextFont(42); tex1->SetTextSize(0.05); tex1->Draw(); double y = gPad->GetUymin(); // - 0.2*h->GetYaxis()->GetBinWidth(1); TText t; t.SetTextAngle(45); t.SetTextSize(0.03); t.SetTextAlign(33); for (int i=0;i<N;i++) { double x = hist->GetXaxis()->GetBinCenter(i+1); t.DrawText(x,y,label[i]); } TLegend *leg0 = new TLegend(0.18,0.70,0.50,0.85); leg0->SetFillColor(10); leg0->SetBorderSize(0); leg0->SetTextFont(42); leg0->SetTextSize(0.047); leg0->AddEntry(graph,"From Ancestor fitting","p"); leg0->AddEntry(graph1,"From One Comp fitting","p"); // leg0->AddEntry(Gri055_graph,"Gribov #Omega=0.55","p"); // leg0->AddEntry(Gri101_graph,"Gribov #Omega=1.01","p"); if(str=="Npart") leg0->AddEntry(graphNpartDil,"Npart from run I","p"); if(str=="Ncoll") leg0->AddEntry(graphNcollDil,"Ncoll from run I","p"); leg0->Draw(); c1->SaveAs(Form("%sGri.png",str.Data())); c1->SaveAs(Form("%sGri.pdf",str.Data())); TCanvas *c2 = new TCanvas("c2","c2",1,1,550,460); c2->SetFillColor(10); c2->SetFrameFillColor(0); c2->SetFrameBorderSize(0); c2->SetFrameBorderMode(0); c2->SetLeftMargin(0.15); c2->SetBottomMargin(0.15); c2->SetTopMargin(0.02); c2->SetRightMargin(0.02); c2->SetTicks(-1); c2->cd(); TGraphErrors* fdvf1 = (TGraphErrors*)graph->Clone("fdvf1"); TGraphErrors* f1dvDil = (TGraphErrors*)graph->Clone("f1dvDil"); TGraphErrors* fdvDil = (TGraphErrors*)graph->Clone("fdvDil"); TGraphErrors* Dilsys = (TGraphErrors*)graph->Clone("Dilsys"); TGraphErrors* Dilsys2 = (TGraphErrors*)graph->Clone("Dilsys2"); for(int ip = 0;ip<fdvf1->GetN();ip++){ double x = graph->GetX()[ip]; double ey = graph->GetEY()[ip]; double y = graph->GetY()[ip]; double ey1 = graph1->GetEY()[ip]; double y1 = graph1->GetY()[ip]; double eyNcoll = graphNcollDil->GetEY()[ip]; double yNcoll = graphNcollDil->GetY()[ip]; double eyNpart = graphNpartDil->GetEY()[ip]; double yNpart = graphNpartDil->GetY()[ip]; if(y1!=0 && y!=0){ fdvf1->SetPoint(ip,x,y/y1); fdvf1->SetPointError(ip,0,y/y1*sqrt((ey/y)**2+(ey1/y1)**2)); if(str=="Ncoll"){ fdvDil->SetPoint(ip,x,y/yNcoll); double yerr = y/yNcoll*sqrt((ey/y)**2+(eyNcoll/yNcoll)**2); fdvDil->SetPointError(ip,0,0); f1dvDil->SetPoint(ip,x,y1/yNcoll); double y1err = y1/yNcoll*sqrt((ey1/y1)**2+(eyNcoll/yNcoll)**2); f1dvDil->SetPointError(ip,0,0); Dilsys->SetPoint(ip,x,1.); Dilsys->SetPointError(ip,0,TMath::Max(fabs(y1/yNcoll-1),fabs(y/yNcoll-1))); Dilsys2->SetPoint(ip,x,1.); Dilsys2->SetPointError(ip,0,TMath::Max(yerr,y1err)); } else if(str=="Npart"){ fdvDil->SetPoint(ip,x,y/yNpart); double yerr = y/yNpart*sqrt((ey/y)**2+(eyNcoll/yNpart)**2); fdvDil->SetPointError(ip,0,0); f1dvDil->SetPoint(ip,x,y1/yNpart); double y1err = y1/yNpart*sqrt((ey1/y1)**2+(eyNcoll/yNcoll)**2); f1dvDil->SetPointError(ip,0,0); Dilsys->SetPoint(ip,x,1.); Dilsys->SetPointError(ip,0,TMath::Max(fabs(y1/yNpart-1),fabs(y/yNpart-1))); Dilsys2->SetPoint(ip,x,1.); Dilsys2->SetPointError(ip,0,TMath::Max(yerr,y1err)); } } } hist->SetMinimum(0.5); hist->SetMaximum(1.5); hist->SetYTitle(Form("<%s> ratio",str.Data())); hist->Draw(); fdvf1->SetMarkerStyle(20); fdvf1->SetMarkerColor(1); fdvf1->SetLineColor(1); fdvf1->SetLineWidth(2); fdvf1->SetMarkerSize(1.4); //fdvf1->Draw("Psameez"); f1dvDil->SetMarkerStyle(24); f1dvDil->SetMarkerColor(2); f1dvDil->SetLineColor(2); f1dvDil->SetLineWidth(2); f1dvDil->SetMarkerSize(1.4); fdvDil->SetMarkerStyle(20); fdvDil->SetMarkerColor(4); fdvDil->SetLineColor(4); fdvDil->SetLineWidth(2); fdvDil->SetMarkerSize(1.4); Dilsys->SetFillColor(kYellow+2); Dilsys2->SetFillColor(kYellow+1); //Dilsys2->Draw("e3same"); Dilsys->Draw("e3same"); fdvDil->Draw("Psameez"); f1dvDil->Draw("Psameez"); tex1->Draw(); TLine *l = new TLine(0,1,N,1); l->SetLineStyle(2); l->SetLineWidth(3); l->Draw("same"); TLegend *leg1 = new TLegend(0.38,0.72,0.75,0.86); leg1->SetFillColor(10); leg1->SetBorderSize(0); leg1->SetTextFont(42); leg1->SetTextSize(0.04); //leg1->AddEntry(fdvf1,"Ancestor fitting/One Comp fitting","p"); leg1->AddEntry(f1dvDil,"One Component fitting/Run I fitting","p"); leg1->AddEntry(fdvDil,"Two Component fitting/Run I fitting","p"); leg1->AddEntry(Dilsys,"RunI fitting systematics","f"); // leg1->AddEntry(Dilsys2,"RunI fitting ratio systematics","f"); double y = gPad->GetUymin()+0.5; for (int i=0;i<N;i++) { double x = hist->GetXaxis()->GetBinCenter(i+1); t.DrawText(x,y,label[i]); } leg1->Draw(); c2->SaveAs(Form("%sGriratio.png",str.Data())); c2->SaveAs(Form("%sGriratio.pdf",str.Data())); }
chi7223pt_compare() { gROOT->Reset(); gROOT->SetStyle("MyStyle"); // gROOT->LoadMacro("v2pt_12cen_MyDef.C"); // gROOT->LoadMacro("MyDef.C"); gStyle->SetTextFont(43); gStyle->SetLabelFont(43,"x"); gStyle->SetLabelFont(43,"y"); gStyle->SetLabelFont(43,"z"); gStyle->SetTitleFont(43,"x"); gStyle->SetTitleFont(43,"y"); gStyle->SetTitleFont(43,"z"); gStyle->SetEndErrorSize(0); double textsize = 19; //int mcol[8]={kRed,kMagenta,kBlue,kCyan,kGreen,kYellow,kOrange,kGray}; int mcol[8]={kRed,kOrange+1,kBlue,kGreen+1,kCyan,kYellow,kOrange,kGray}; int mcol2[4]={6,2,4,8}; //int msty[8][2]={{20,20},{25,24},{22,22},{28,26},{29,30},{33,27},{34,28},{20,24}}; int msty[8][2]={{20,20},{21,24},{22,29},{23,30},{24,30},{25,27},{28,28},{30,24}}; //float msiz[8]={1.11,0.9,1.2,1.24,1.5,1,1,1}; float msiz[8]={1.11,1.0,1.5,1.2,1.2,1.2,1.2,1.6}; float msiz2[4]={1.5,1.5,1.5,1.5}; // // arrays // const int Mfiles=50; int ndp[Mfiles]; char *cfn[Mfiles]; char *cft[Mfiles]; const int Mpoints=40; double xa[Mfiles][Mpoints],xe[Mfiles][Mpoints]; double ya[Mfiles][Mpoints],ye[Mfiles][Mpoints]; double nxa[Mfiles][Mpoints],nxe[Mfiles][Mpoints]; double nya[Mfiles][Mpoints],nye[Mfiles][Mpoints]; double aexl[Mfiles][Mpoints],aexh[Mfiles][Mpoints]; double aeyl[Mfiles][Mpoints],aeyh[Mfiles][Mpoints]; double ra[Mfiles][Mpoints],re[Mfiles][Mpoints]; const int Mpads=14; char *htit[Mpads]; char *atit[Mpads][3]; double ptit[Mpads][2]; double hxmin[Mpads],hxmax[Mpads]; double hymin[Mpads],hymax[Mpads]; double lxmin[Mpads],lxmax[Mpads]; double lymin[Mpads],lymax[Mpads]; // // Data input // char *cjob="v2pt_12cen_4x3"; int i=-1; // histogram parameter htit[0]="0-5%"; htit[1]="5-10%"; htit[2]="10-15%"; htit[3]="15-20%"; htit[4]="20-25%"; htit[5]="25-30%"; htit[6]="30-35%"; htit[7]="35-40%"; htit[8]="40-50%"; htit[9]="50-60%"; htit[10]="60-70%"; htit[11]="70-80%"; for (int ip=0;ip<Mpads;ip++) { // hxmin[ip]=0.0; hxmax[ip]=11.9; hxmin[ip]=0.0001; hxmax[ip]=10.8; hymin[ip]=0.0001; hymax[ip]=100.099; lxmin[ip]=0.08; lxmax[ip]=0.35; lymin[ip]=0.4; lymax[ip]=0.65; ptit[ip][0]=5.0; ptit[ip][1]=80.08;// position legends atit[ip][0]="p_{T} (GeV/c)"; atit[ip][1]="#chi_{7}{#Psi_{223}}"; } // // Read data and create vector files // double tmp; const int nw=12; const int npt=16; ifstream inEP; inEP.open("../../tight/outchi7223_corrFlow.txt"); for(int i=0; i<nw; i++){ inEP>>tmp; inEP>>tmp; for(int j=0; j<npt+4; j++){ inEP>>tmp; inEP>>tmp; inEP>>xa[i][j]; inEP>>tmp; inEP>>ya[i][j]; inEP>>ye[i][j]; xe[i][j]=0.0; } } inEP.close(); ifstream inSP; inSP.open("../../loose/outchi7223_corrFlow.txt"); for(int i=0; i<nw; i++){ inSP>>tmp; inSP>>tmp; for(int j=0; j<npt+4; j++){ inSP>>tmp; inSP>>tmp; inSP>>nxa[i][j]; inSP>>tmp; inSP>>nya[i][j]; inSP>>nye[i][j]; nxe[i][j]=0.0; } } inSP.close(); for(int i=0; i<nw-1; i++){ cout<<"sys for cent: "<<i<<endl; for(int j=0; j<10; j++){ cout<<nxa[i][j]<<" "<<fabs(ya[i][j]-nya[i][j])/fabs(ya[i][j])<<" "<<fabs(ye[i][j])/fabs(ya[i][j])<<endl; } } TCanvas *can=new TCanvas("can","can",10,10,1050*0.9,800*0.85); can->Divide(4,3,0,0); //sticks the pads with no space inbetween TH1D *h1[nw]; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); if(iw==3||iw==7||iw==11) gPad->SetRightMargin(0.02); char ch1[8]; sprintf(ch1,"h1_%d",iw); h1[iw] = new TH1D(ch1,"",500,hxmin[iw],hxmax[iw]); h1[iw]->SetMinimum(hymin[iw]); h1[iw]->SetMaximum(hymax[iw]); h1[iw]->SetXTitle(atit[iw][0]); h1[iw]->SetYTitle(atit[iw][1]); h1[iw]->GetXaxis()->CenterTitle(1); h1[iw]->GetYaxis()->CenterTitle(1); // futz with the axes h1[iw]->GetYaxis()->SetNdivisions(606); h1[iw]->GetXaxis()->SetNdivisions(606); h1[iw]->GetYaxis()->SetTitleSize(textsize); h1[iw]->GetYaxis()->SetTitleOffset(3.0); h1[iw]->GetYaxis()->SetLabelSize(textsize); h1[iw]->GetXaxis()->SetTitleSize(textsize); h1[iw]->GetXaxis()->SetTitleOffset(3.0); h1[iw]->GetXaxis()->SetLabelSize(textsize); // h1[iw]->GetXaxis()->SetLabelOffset(1.2); h1[iw]->Draw(); } // // Draw! // cout << "Now Draw!" << endl; TGraphErrors *ge; for (int iw=0;iw<nw;iw++) { can->cd(iw+1); // if (iw==0) { tex=new TLatex(1.5,80.08,"CMS PbPb #sqrt{s_{NN}}=2.76TeV"); tex->SetTextSize(textsize); //tex->Draw(); tex=new TLatex(1.5,70.07,"|#eta|<0.8"); tex->SetTextSize(textsize); tex->Draw(); } if (iw < 4) tex=new TLatex(ptit[iw][0]+2,70.07,htit[iw]); else tex=new TLatex(ptit[iw][0],ptit[iw][1],htit[iw]); if ( iw == 0) tex->SetTextSize(textsize); else if (iw == 8) tex->SetTextSize(textsize); else tex->SetTextSize(textsize); tex->Draw(); // // Legend // TLegend *leg = new TLegend(lxmin[iw],lymin[iw],lxmax[iw],lymax[iw]); leg->SetTextSize(textsize); // // Read data // for (int im=0;im<1;im++) { int j=im*12+iw; int col=1; //if (ndp[j]==0) continue; ge=new TGraphErrors(19,&xa[j][0],&ya[j][0],&xe[j][0],&ye[j][0]); ge->SetTitle(""); ge->SetMarkerStyle(msty[im][1]); // ge->SetMarkerStyle(msty[im]); ge->SetMarkerSize(msiz[im]); ge->SetMarkerColor(col); ge->SetLineWidth(1.2); ge->SetLineColor(col); ge->Draw("pe"); leg->AddEntry(ge,"#chi_{7223} (tight)","p"); } if (iw==1) leg->Draw(); for (int im=0;im<1;im++) { int j=im*12+iw; int col=2; //if (ndp[j]==0) continue; ge=new TGraphErrors(19,&nxa[j][0],&nya[j][0],&nxe[j][0],&nye[j][0]); ge->SetTitle(""); ge->SetMarkerStyle(25); // ge->SetMarkerStyle(msty[im]); ge->SetMarkerSize(msiz[im]); ge->SetMarkerColor(col); ge->SetLineWidth(1.2); ge->SetLineColor(col); ge->Draw("pe"); leg->AddEntry(ge,"#chi_{7223} (loose)","p"); } } cout << "end of process" << endl; can->cd(); can->Print("./figures/chi7223_pt_10cen_sysTrackCuts2760gev.png"); can->Print("./figures/chi7223_pt_10cen_sysTrackCuts2760gev.pdf"); }
int main(int argc, char** argv){ ///================================================== ///==== Draw Distribution with and without scale ==== ///================================================== ///=============================================================================== gROOT->Reset(); gROOT->SetStyle("Plain"); gStyle->SetPalette(1); gStyle->SetOptStat(0); gStyle->SetOptFit(0); const Int_t __NRGBs = 5; const Int_t __NCont = 76; Double_t __stops[__NRGBs] = { 0.00, 0.34, 0.61, 0.84, 1.00 }; Double_t __red[__NRGBs] = { 0.00, 0.00, 0.87, 1.00, 0.51 }; Double_t __green[__NRGBs] = { 0.00, 0.81, 1.00, 0.20, 0.00 }; Double_t __blue[__NRGBs] = { 0.51, 1.00, 0.12, 0.00, 0.00 }; TColor::CreateGradientColorTable(__NRGBs, __stops, __red, __green, __blue, __NCont); gStyle->SetNumberContours(__NCont); ///=============================================================================== if(argc != 2) { std::cerr << ">>>>> analysis.cpp::usage: " << argv[0] << " configFileName" << std::endl ; return 1; } // Parse the config file parseConfigFile (argv[1]) ; std::string treeNameDATA = gConfigParser -> readStringOption("InputDATA::treeName"); std::string inputFileDATA = gConfigParser -> readStringOption("InputDATA::inputFile"); double luminosity = gConfigParser -> readDoubleOption("InputDATA::luminosity"); std::cout << ">>>>> InputDATA::treeName " << treeNameDATA << std::endl; std::cout << ">>>>> InputDATA::inputFile " << inputFileDATA << std::endl; std::cout << ">>>>> InputDATA::luminosity " << luminosity << std::endl; std::string treeNameMC = gConfigParser -> readStringOption("InputMC::treeName"); std::vector< std::string > inputFileMC = gConfigParser -> readStringListOption("InputMC::inputFile"); std::vector< std::string > inputSampleMC = gConfigParser -> readStringListOption("InputMC::nameSample"); std::vector< double > xSecAndEfficiency = gConfigParser -> readDoubleListOption("InputMC::xsecEff"); std::cout << ">>>>> InputMC::treeName " << treeNameMC << std::endl; std::cout << ">>>>> InputMC::inputFile size " << inputFileMC.size() << std::endl; if (inputFileMC.size() != xSecAndEfficiency.size() || inputFileMC.size() != inputSampleMC.size()) { std::cerr << " >>>> Error: different number of samples and cross sections" << std::endl; return 0; } int nMC = inputFileMC.size(); for (int iMC = 0; iMC < nMC; iMC++) { std::cout << ">>>>> InputMC::inputFile[" << iMC << "] = " << inputSampleMC.at(iMC) << " => " << inputFileMC.at(iMC) << " : " << xSecAndEfficiency.at(iMC) << " : " << luminosity * xSecAndEfficiency.at(iMC) << std::endl; } int binX = gConfigParser -> readIntOption("Options::binX"); double minX = gConfigParser -> readDoubleOption("Options::minX"); double maxX = gConfigParser -> readDoubleOption("Options::maxX"); std::string variableX = gConfigParser -> readStringOption("Options::variableX"); std::cout << ">>>>> Options::binX " << binX << std::endl; std::cout << ">>>>> Options::minX " << minX << std::endl; std::cout << ">>>>> Options::maxX " << maxX << std::endl; std::cout << ">>>>> Options::variableX " << variableX.c_str() << std::endl; int binY = gConfigParser -> readIntOption("Options::binY"); double minY = gConfigParser -> readDoubleOption("Options::minY"); double maxY = gConfigParser -> readDoubleOption("Options::maxY"); std::string variableY = gConfigParser -> readStringOption("Options::variableY"); std::cout << ">>>>> Options::binY " << binY << std::endl; std::cout << ">>>>> Options::minY " << minY << std::endl; std::cout << ">>>>> Options::maxY " << maxY << std::endl; std::cout << ">>>>> Options::variableY " << variableY.c_str() << std::endl; int binRatio = gConfigParser -> readIntOption("Options::binRatio"); double minRatio = gConfigParser -> readDoubleOption("Options::minRatio"); double maxRatio = gConfigParser -> readDoubleOption("Options::maxRatio"); std::cout << ">>>>> Options::minRatio " << minRatio << std::endl; std::cout << ">>>>> Options::maxRatio " << maxRatio << std::endl; std::string outputFile = gConfigParser -> readStringOption("Output::outputFile"); std::cout << ">>>>> Output::outputFile " << outputFile << std::endl; // TString AdditionalCut = Form("eta > 1.5");// || eta < -1.5)");// && eleFBrem<0.5"); TString AdditionalCut = Form("eta < -1.5");// || eta < -1.5)");// && eleFBrem<0.5"); // TString AdditionalCut = Form("(eta > 1.5 || eta < -1.5)");// && abs(eleFBrem)<1"); EColor vColor[100] = { kBlue,(EColor)(kBlue+1),(EColor) (kBlue+2), kRed,(EColor) (kRed+1),(EColor) (kRed+2), kGreen,(EColor) (kGreen+1),(EColor) (kGreen+2), kTeal,(EColor) (kTeal+1), kOrange,(EColor) (kOrange+1), kMagenta,(EColor) (kMagenta+1),(EColor) (kViolet),(EColor) (kYellow),(EColor) (kGray)}; ///==== DATA ==== TFile* fileInDATA = new TFile(inputFileDATA.c_str(),"READ"); ///==== W ==== TFile* fileInMC[nMC]; for (int iMC = 0; iMC < nMC; iMC++) { fileInMC[iMC] = new TFile(inputFileMC.at(iMC).c_str(),"READ"); } ///==== output ==== TFile* outFile = new TFile(outputFile.c_str(),"RECREATE"); outFile->cd(); ///==== Prepare input trees ==== TLegend* leg = new TLegend(0.55,0.7,0.95,0.95); leg->SetFillColor(0); TLegend* legDown = new TLegend(0.55,0.1,0.95,0.35); legDown->SetFillColor(0); TTree* MyTreeDATA = (TTree*) fileInDATA->Get(treeNameDATA.c_str()); int initialNumber; TH2F* HistoDATA = new TH2F("DATA","DATA",binX,minX,maxX,binY,minY,maxY); TH1F* HistoRatioDATA = new TH1F("RatioDATA","RatioDATA",binRatio,minRatio,maxRatio); TString DrawDATA = Form("%s:%s >> DATA",variableY.c_str(),variableX.c_str()); MyTreeDATA->Draw(DrawDATA.Data(),AdditionalCut.Data()); HistoDATA->SetMarkerSize(1); HistoDATA->SetMarkerStyle(20); HistoDATA->GetXaxis()->SetTitle(variableX.c_str()); HistoDATA->GetYaxis()->SetTitle(variableY.c_str()); leg->AddEntry(HistoDATA,HistoDATA->GetTitle(),"p"); legDown->AddEntry(HistoDATA,HistoDATA->GetTitle(),"p"); DrawDATA = Form("(%s) / (%s) >> RatioDATA",variableY.c_str(),variableX.c_str()); MyTreeDATA->Draw(DrawDATA.Data(),AdditionalCut.Data()); HistoRatioDATA->SetMarkerSize(1); HistoRatioDATA->SetMarkerStyle(20); HistoRatioDATA->GetXaxis()->SetTitle(Form("(%s)/(%s)",variableY.c_str(),variableX.c_str())); TH2F* HistoMC[nMC]; TH1F* HistoRatioMC[nMC]; TH2F* HistoMC_SUM = new TH2F("HistoMC_SUM","HistoMC_SUM",binX,minX,maxX,binY,minY,maxY); TH1F* HistoRatioMC_SUM = new TH1F("HistoRatioMC_SUM","HistoRatioMC_SUM",binRatio,minRatio,maxRatio); SetColorAndStyleHisto(*(HistoRatioMC_SUM),kBlue); TTree* MyTreeMC[nMC]; THStack* hsMC = new THStack("hsMC","hsMC"); double MC_Expected = 0; for (int iMC = 0; iMC < nMC; iMC++) { // for (int iMC = nMC-1; iMC >= 0; iMC--) { MyTreeMC[iMC] = (TTree*) fileInMC[iMC]->Get(treeNameMC.c_str()); MyTreeMC[iMC]->SetBranchAddress("initialNumber",&initialNumber); MyTreeMC[iMC]->GetEntry(0); xSecAndEfficiency.at(iMC) = xSecAndEfficiency.at(iMC) / initialNumber; ///==== normalize to initial number of events HistoMC[iMC] = new TH2F(inputSampleMC.at(iMC).c_str(),inputSampleMC.at(iMC).c_str(),binX,minX,maxX,binY,minY,maxY); HistoRatioMC[iMC] = new TH1F(Form("%s_Ratio",inputSampleMC.at(iMC).c_str()),Form("%s_Ratio",inputSampleMC.at(iMC).c_str()),binRatio,minRatio,maxRatio); TString Draw = Form("%s:%s >> %s",variableY.c_str(),variableX.c_str(),inputSampleMC.at(iMC).c_str()); MyTreeMC[iMC]->Draw(Draw.Data(),AdditionalCut.Data()); Draw = Form("(%s) / (%s) >> %s",variableY.c_str(),variableX.c_str(),Form("%s_Ratio",inputSampleMC.at(iMC).c_str())); MyTreeMC[iMC]->Draw(Draw.Data(),AdditionalCut.Data()); HistoRatioMC[iMC]->GetXaxis()->SetTitle(Form("(%s)/(%s)",variableY.c_str(),variableX.c_str())); std::cout << ">>>>>> " << inputSampleMC.at(iMC) << " : " << xSecAndEfficiency.at(iMC) << " : " << luminosity << " : " << HistoMC[iMC]->GetEntries() << " = " << luminosity * xSecAndEfficiency.at(iMC) * HistoMC[iMC]->GetEntries() << std::endl; std::cout << " >> " << Draw.Data() << std::endl; std::cout << " >> " << HistoMC[iMC]->GetEntries() << " Entries" << std::endl; MC_Expected += luminosity * xSecAndEfficiency.at(iMC) * HistoMC[iMC]->GetEntries(); HistoMC[iMC]->Scale(luminosity * xSecAndEfficiency.at(iMC)); // / HistoMC[iMC]->GetEntries()); HistoRatioMC[iMC]->Scale(luminosity * xSecAndEfficiency.at(iMC)); // / HistoMC[iMC]->GetEntries()); SetColorAndStyleHisto(*(HistoMC[iMC]),vColor[iMC]); SetColorAndStyleHisto(*(HistoRatioMC[iMC]),vColor[iMC]); HistoMC[iMC]->GetXaxis()->SetTitle(variableX.c_str()); HistoMC[iMC]->GetYaxis()->SetTitle(variableY.c_str()); HistoMC_SUM->Add(HistoMC[iMC]); HistoMC_SUM->GetXaxis()->SetTitle(variableX.c_str()); HistoMC_SUM->GetYaxis()->SetTitle(variableY.c_str()); HistoRatioMC_SUM->Add(HistoRatioMC[iMC]); HistoRatioMC_SUM->GetXaxis()->SetTitle(Form("(%s)/(%s)",variableY.c_str(),variableX.c_str())); hsMC->Add(HistoMC[iMC]); if (iMC == 0) hsMC->Add(HistoMC[iMC]); leg->AddEntry(HistoMC[iMC],HistoMC[iMC]->GetTitle(),"f"); legDown->AddEntry(HistoMC[iMC],HistoMC[iMC]->GetTitle(),"f"); } ///==== make fit ==== TH1D* htemp_prof = smartGausProfileXSQRTN(HistoDATA,2); TGraphErrors grH = buildGEfromH_Personalized(*htemp_prof); grH.SetMarkerStyle(22); grH.SetMarkerSize(0.7); grH.SetMarkerColor(kBlue); grH.SetFillColor(kBlue); grH.SetFillStyle(3335); grH.SetLineWidth(1); grH.SetLineColor(kBlue); grH.GetXaxis()->SetTitle(variableX.c_str()); grH.GetYaxis()->SetTitle(variableY.c_str()); ///---------------------- ///---- Plot results ---- ///---------------------- std::cerr << " MC expected : DATA = " << MC_Expected << " : " << HistoDATA->GetEntries() << std::endl; std::cerr << " HistoDATA->GetMaximum() = " << HistoDATA->GetMaximum() << std::endl; std::cerr << " HistoDATA->GetEntries() = " << HistoDATA->GetEntries() << std::endl; outFile->cd(); TCanvas cResultDistro("cResultDistro","cResultDistro",900,900); cResultDistro.Divide(2,2); cResultDistro.cd(1); HistoDATA->DrawClone("colz"); gPad->SetGrid(); TString tLumiName = Form("#int L = %.4f pb^{-1}",luminosity); TLatex tLumi(1.5 * HistoDATA->GetMean(1),0.2 * HistoDATA->GetMaximum(),tLumiName.Data()); tLumi.DrawClone(); cResultDistro.cd(2); HistoRatioMC_SUM->Draw(); HistoRatioDATA->Draw("E1same"); TString tEleName = Form("%d electrons",(int) HistoDATA->GetEntries()); TLatex tEle(2.0 * HistoRatioDATA->GetMean(1),0.3 * HistoRatioDATA->GetMaximum(),tEleName.Data()); tEle.DrawClone(); gPad->SetGrid(); cResultDistro.cd(3); grH.Draw("APL"); double minFit = gConfigParser -> readDoubleOption("Options::minFit"); double maxFit = gConfigParser -> readDoubleOption("Options::maxFit"); std::cout << ">>>>> Options::minFit " << minFit << std::endl; std::cout << ">>>>> Options::maxFit " << maxFit << std::endl; TF1* funz = new TF1 ("funz","pol1",minFit,maxFit); // funz->FixParameter(0,0); funz->SetParameter(0,0); funz->SetParameter(1,1); grH.Fit("funz","RMQ"); std::cerr << " Y = [0] + [1] * X " << std::endl; std::cerr << " [0] = " << funz->GetParameter(0) << " +/- " << funz->GetParError(0) << std::endl; std::cerr << " [1] = " << funz->GetParameter(1) << " +/- " << funz->GetParError(1) << std::endl; double coeffDATA = funz->GetParameter(1); double errCoeffDATA = funz->GetParError(1); gPad->SetGrid(); cResultDistro.cd(4); HistoRatioMC_SUM->Draw(); HistoRatioDATA->Draw("E1same"); tEle.DrawClone(); gPad->SetGrid(); gPad->SetLogy(); TString nameImage = Form("%s_%s_%d.png",variableY.c_str(),variableX.c_str(),1); cResultDistro.SaveAs(nameImage.Data()); TString nameImageRoot = Form("%s_%s_%d.root",variableY.c_str(),variableX.c_str(),1); cResultDistro.SaveAs(nameImageRoot.Data()); TCanvas cResultDistroMC("cResultDistroMC","cResultDistroMC",800,800); cResultDistroMC.Divide(2,2); // cResultDistroMC.Divide(2,nMC); // for (int iMC = 0; iMC < nMC; iMC++) { // cResultDistroMC.cd(2*iMC+1); // HistoMC[iMC]->DrawClone("colz"); // HistoDATA->DrawClone("BOXsame"); // cResultDistroMC.cd(2*iMC+2); // HistoRatioMC[iMC]->DrawNormalized(""); // HistoRatioDATA->DrawNormalized("E1same"); // } cResultDistroMC.cd(1); HistoMC_SUM->DrawClone("colz"); HistoDATA->DrawClone("BOXsame"); gPad->SetGrid(); ///==== make fit ==== cResultDistroMC.cd(3); TH1D* MChtemp_prof = smartGausProfileXSQRTN(HistoMC_SUM,2); TGraphErrors MCgrH = buildGEfromH_Personalized(*MChtemp_prof); MCgrH.SetMarkerStyle(22); MCgrH.SetMarkerSize(0.7); MCgrH.SetMarkerColor(kRed); MCgrH.SetFillColor(kRed); MCgrH.SetFillStyle(3335); MCgrH.SetLineWidth(1); MCgrH.SetLineColor(kRed); MCgrH.GetXaxis()->SetTitle(variableX.c_str()); MCgrH.GetYaxis()->SetTitle(variableY.c_str()); funz->SetParameter(0,0); funz->SetParameter(1,1); MCgrH.Fit("funz","RMQ"); std::cerr << " ================= " << std::endl; std::cerr << " ======= MC ====== " << std::endl; std::cerr << " Y = [0] + [1] * X " << std::endl; std::cerr << " [0] = " << funz->GetParameter(0) << " +/- " << funz->GetParError(0) << std::endl; std::cerr << " [1] = " << funz->GetParameter(1) << " +/- " << funz->GetParError(1) << std::endl; double coeffMC = funz->GetParameter(1); double errCoeffMC = funz->GetParError(1); MCgrH.Draw("APL"); gPad->SetGrid(); cResultDistroMC.cd(4); MCgrH.Draw("APL"); grH.Draw("PLSAME"); gPad->SetGrid(); TString nameImageLog = Form("%s_%s_%d_MC.png",variableY.c_str(),variableX.c_str(),1); cResultDistroMC.SaveAs(nameImageLog.Data()); std::cerr << " 1 - alpha = " << coeffDATA / coeffMC << " +/- " << sqrt( (errCoeffDATA/coeffMC)*(errCoeffDATA/coeffMC) + (errCoeffMC*coeffDATA/coeffMC/coeffMC)*(errCoeffMC*coeffDATA/coeffMC/coeffMC) ) << std::endl; std::cerr << " alpha = " << 1-coeffDATA / coeffMC << " +/- " << sqrt( (errCoeffDATA/coeffMC)*(errCoeffDATA/coeffMC) + (errCoeffMC*coeffDATA/coeffMC/coeffMC)*(errCoeffMC*coeffDATA/coeffMC/coeffMC) ) << std::endl; // TCanvas cResultDistro_1("cResultDistro_1","cResultDistro_1",800,800); // HistoRatioMC_SUM->Draw(); // HistoRatioDATA->Draw("E1same"); // tEle.DrawClone(); // gPad->SetGrid(); // gPad->SetLogy(); }
void ttbar_isojet1CSV() { //=========Macro generated from canvas: c1/c1 //========= (Sun Dec 11 15:16:19 2016) by ROOT version6.06/01 TCanvas *c1 = new TCanvas("c1", "c1",1,1,1200,1416); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); c1->SetHighLightColor(2); c1->Range(0,0,1,1); c1->SetFillColor(0); c1->SetBorderMode(0); c1->SetBorderSize(2); c1->SetTickx(1); c1->SetTicky(1); c1->SetLeftMargin(0.15); c1->SetRightMargin(0.05); c1->SetTopMargin(0.07); c1->SetBottomMargin(0.13); c1->SetFrameFillStyle(0); c1->SetFrameBorderMode(0); // ------------>Primitives in pad: pad1 TPad *pad1 = new TPad("pad1", "pad1",0,0.3,1,1); pad1->Draw(); pad1->cd(); pad1->Range(-0.1875,0,1.0625,0.6289089); pad1->SetFillColor(0); pad1->SetBorderMode(0); pad1->SetBorderSize(2); pad1->SetTickx(1); pad1->SetTicky(1); pad1->SetLeftMargin(0.15); pad1->SetRightMargin(0.05); pad1->SetTopMargin(0.07); pad1->SetBottomMargin(0); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); THStack *h = new THStack(); h->SetName("h"); h->SetTitle(""); h->SetMinimum(0); h->SetMaximum(0.5570336); TH1F *h_stack_23 = new TH1F("h_stack_23","",10,0,1); h_stack_23->SetMinimum(0); h_stack_23->SetMaximum(0.5848853); h_stack_23->SetDirectory(0); h_stack_23->SetStats(0); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#000099"); h_stack_23->SetLineColor(ci); h_stack_23->GetXaxis()->SetLabelFont(42); h_stack_23->GetXaxis()->SetLabelOffset(0.007); h_stack_23->GetXaxis()->SetTitleSize(0.05); h_stack_23->GetXaxis()->SetTickLength(0.025); h_stack_23->GetXaxis()->SetTitleFont(42); h_stack_23->GetYaxis()->SetTitle("a.u."); h_stack_23->GetYaxis()->SetLabelFont(42); h_stack_23->GetYaxis()->SetLabelOffset(0.007); h_stack_23->GetYaxis()->SetTitleSize(0.05); h_stack_23->GetYaxis()->SetTickLength(0.025); h_stack_23->GetYaxis()->SetTitleOffset(1.5); h_stack_23->GetYaxis()->SetTitleFont(42); h_stack_23->GetZaxis()->SetLabelFont(42); h_stack_23->GetZaxis()->SetLabelOffset(0.007); h_stack_23->GetZaxis()->SetTitleSize(0.05); h_stack_23->GetZaxis()->SetTickLength(0.025); h_stack_23->GetZaxis()->SetTitleFont(42); h->SetHistogram(h_stack_23); TH1D *h_isojet1CSV_QCD__265 = new TH1D("h_isojet1CSV_QCD__265","",10,0,1); h_isojet1CSV_QCD__265->SetBinContent(1,0.002129117); h_isojet1CSV_QCD__265->SetBinContent(2,0.001248327); h_isojet1CSV_QCD__265->SetBinContent(3,0.0006205357); h_isojet1CSV_QCD__265->SetBinContent(4,0.001430306); h_isojet1CSV_QCD__265->SetBinContent(5,0.001031553); h_isojet1CSV_QCD__265->SetBinContent(6,0.0005098467); h_isojet1CSV_QCD__265->SetBinContent(7,0.0002095089); h_isojet1CSV_QCD__265->SetBinContent(8,9.216642e-05); h_isojet1CSV_QCD__265->SetBinContent(10,0.004314199); h_isojet1CSV_QCD__265->SetBinError(1,0.001510477); h_isojet1CSV_QCD__265->SetBinError(2,0.0006911766); h_isojet1CSV_QCD__265->SetBinError(3,0.0004578373); h_isojet1CSV_QCD__265->SetBinError(4,0.0008388365); h_isojet1CSV_QCD__265->SetBinError(5,0.0008715622); h_isojet1CSV_QCD__265->SetBinError(6,0.0005098467); h_isojet1CSV_QCD__265->SetBinError(7,0.0002095089); h_isojet1CSV_QCD__265->SetBinError(8,9.216642e-05); h_isojet1CSV_QCD__265->SetBinError(10,0.002213733); h_isojet1CSV_QCD__265->SetEntries(25); h_isojet1CSV_QCD__265->SetStats(0); ci = TColor::GetColor("#cccccc"); h_isojet1CSV_QCD__265->SetFillColor(ci); h_isojet1CSV_QCD__265->GetXaxis()->SetTitle("isojet 1 CSV"); h_isojet1CSV_QCD__265->GetXaxis()->SetLabelFont(42); h_isojet1CSV_QCD__265->GetXaxis()->SetLabelOffset(0.007); h_isojet1CSV_QCD__265->GetXaxis()->SetTitleSize(0.05); h_isojet1CSV_QCD__265->GetXaxis()->SetTickLength(0.025); h_isojet1CSV_QCD__265->GetXaxis()->SetTitleFont(42); h_isojet1CSV_QCD__265->GetYaxis()->SetTitle("a.u."); h_isojet1CSV_QCD__265->GetYaxis()->SetLabelFont(42); h_isojet1CSV_QCD__265->GetYaxis()->SetLabelOffset(0.007); h_isojet1CSV_QCD__265->GetYaxis()->SetTitleSize(0.05); h_isojet1CSV_QCD__265->GetYaxis()->SetTickLength(0.025); h_isojet1CSV_QCD__265->GetYaxis()->SetTitleFont(42); h_isojet1CSV_QCD__265->GetZaxis()->SetLabelFont(42); h_isojet1CSV_QCD__265->GetZaxis()->SetLabelOffset(0.007); h_isojet1CSV_QCD__265->GetZaxis()->SetTitleSize(0.05); h_isojet1CSV_QCD__265->GetZaxis()->SetTickLength(0.025); h_isojet1CSV_QCD__265->GetZaxis()->SetTitleFont(42); h->Add(h_isojet1CSV_QCD,""); TH1D *h_isojet1CSV_Diboson__266 = new TH1D("h_isojet1CSV_Diboson__266","",10,0,1); h_isojet1CSV_Diboson__266->SetBinContent(1,0.006910874); h_isojet1CSV_Diboson__266->SetBinContent(2,0.01156259); h_isojet1CSV_Diboson__266->SetBinContent(3,0.00597142); h_isojet1CSV_Diboson__266->SetBinContent(4,0.003397186); h_isojet1CSV_Diboson__266->SetBinContent(5,0.003453268); h_isojet1CSV_Diboson__266->SetBinContent(6,0.001659304); h_isojet1CSV_Diboson__266->SetBinContent(7,0.001617052); h_isojet1CSV_Diboson__266->SetBinContent(8,0.001259235); h_isojet1CSV_Diboson__266->SetBinContent(9,0.000286628); h_isojet1CSV_Diboson__266->SetBinContent(10,0.00067562); h_isojet1CSV_Diboson__266->SetBinError(1,0.001086007); h_isojet1CSV_Diboson__266->SetBinError(2,0.001467728); h_isojet1CSV_Diboson__266->SetBinError(3,0.001077108); h_isojet1CSV_Diboson__266->SetBinError(4,0.0008370875); h_isojet1CSV_Diboson__266->SetBinError(5,0.0009085276); h_isojet1CSV_Diboson__266->SetBinError(6,0.000631351); h_isojet1CSV_Diboson__266->SetBinError(7,0.0006254813); h_isojet1CSV_Diboson__266->SetBinError(8,0.0005614698); h_isojet1CSV_Diboson__266->SetBinError(9,0.0001726014); h_isojet1CSV_Diboson__266->SetBinError(10,0.0003333104); h_isojet1CSV_Diboson__266->SetEntries(227); h_isojet1CSV_Diboson__266->SetStats(0); ci = TColor::GetColor("#9966cc"); h_isojet1CSV_Diboson__266->SetFillColor(ci); h_isojet1CSV_Diboson__266->GetXaxis()->SetTitle("isojet 1 CSV"); h_isojet1CSV_Diboson__266->GetXaxis()->SetLabelFont(42); h_isojet1CSV_Diboson__266->GetXaxis()->SetLabelOffset(0.007); h_isojet1CSV_Diboson__266->GetXaxis()->SetTitleSize(0.05); h_isojet1CSV_Diboson__266->GetXaxis()->SetTickLength(0.025); h_isojet1CSV_Diboson__266->GetXaxis()->SetTitleFont(42); h_isojet1CSV_Diboson__266->GetYaxis()->SetTitle("a.u."); h_isojet1CSV_Diboson__266->GetYaxis()->SetLabelFont(42); h_isojet1CSV_Diboson__266->GetYaxis()->SetLabelOffset(0.007); h_isojet1CSV_Diboson__266->GetYaxis()->SetTitleSize(0.05); h_isojet1CSV_Diboson__266->GetYaxis()->SetTickLength(0.025); h_isojet1CSV_Diboson__266->GetYaxis()->SetTitleFont(42); h_isojet1CSV_Diboson__266->GetZaxis()->SetLabelFont(42); h_isojet1CSV_Diboson__266->GetZaxis()->SetLabelOffset(0.007); h_isojet1CSV_Diboson__266->GetZaxis()->SetTitleSize(0.05); h_isojet1CSV_Diboson__266->GetZaxis()->SetTickLength(0.025); h_isojet1CSV_Diboson__266->GetZaxis()->SetTitleFont(42); h->Add(h_isojet1CSV_Diboson,""); TH1D *h_isojet1CSV_ZpLjets__267 = new TH1D("h_isojet1CSV_ZpLjets__267","",10,0,1); h_isojet1CSV_ZpLjets__267->SetBinContent(1,0.00997839); h_isojet1CSV_ZpLjets__267->SetBinContent(2,0.01450317); h_isojet1CSV_ZpLjets__267->SetBinContent(3,0.006432142); h_isojet1CSV_ZpLjets__267->SetBinContent(4,0.004194575); h_isojet1CSV_ZpLjets__267->SetBinContent(5,0.003727646); h_isojet1CSV_ZpLjets__267->SetBinContent(6,0.002569373); h_isojet1CSV_ZpLjets__267->SetBinContent(7,0.001898935); h_isojet1CSV_ZpLjets__267->SetBinContent(8,0.001314676); h_isojet1CSV_ZpLjets__267->SetBinContent(9,0.001323422); h_isojet1CSV_ZpLjets__267->SetBinContent(10,0.001471477); h_isojet1CSV_ZpLjets__267->SetBinError(1,0.0002843835); h_isojet1CSV_ZpLjets__267->SetBinError(2,0.0003526741); h_isojet1CSV_ZpLjets__267->SetBinError(3,0.0002379666); h_isojet1CSV_ZpLjets__267->SetBinError(4,0.0002075278); h_isojet1CSV_ZpLjets__267->SetBinError(5,0.0001971644); h_isojet1CSV_ZpLjets__267->SetBinError(6,0.0001564817); h_isojet1CSV_ZpLjets__267->SetBinError(7,0.0001321731); h_isojet1CSV_ZpLjets__267->SetBinError(8,0.0001133749); h_isojet1CSV_ZpLjets__267->SetBinError(9,0.0001162263); h_isojet1CSV_ZpLjets__267->SetBinError(10,0.0001379738); h_isojet1CSV_ZpLjets__267->SetEntries(24915); h_isojet1CSV_ZpLjets__267->SetStats(0); ci = TColor::GetColor("#3399cc"); h_isojet1CSV_ZpLjets__267->SetFillColor(ci); h_isojet1CSV_ZpLjets__267->GetXaxis()->SetTitle("isojet 1 CSV"); h_isojet1CSV_ZpLjets__267->GetXaxis()->SetLabelFont(42); h_isojet1CSV_ZpLjets__267->GetXaxis()->SetLabelOffset(0.007); h_isojet1CSV_ZpLjets__267->GetXaxis()->SetTitleSize(0.05); h_isojet1CSV_ZpLjets__267->GetXaxis()->SetTickLength(0.025); h_isojet1CSV_ZpLjets__267->GetXaxis()->SetTitleFont(42); h_isojet1CSV_ZpLjets__267->GetYaxis()->SetTitle("a.u."); h_isojet1CSV_ZpLjets__267->GetYaxis()->SetLabelFont(42); h_isojet1CSV_ZpLjets__267->GetYaxis()->SetLabelOffset(0.007); h_isojet1CSV_ZpLjets__267->GetYaxis()->SetTitleSize(0.05); h_isojet1CSV_ZpLjets__267->GetYaxis()->SetTickLength(0.025); h_isojet1CSV_ZpLjets__267->GetYaxis()->SetTitleFont(42); h_isojet1CSV_ZpLjets__267->GetZaxis()->SetLabelFont(42); h_isojet1CSV_ZpLjets__267->GetZaxis()->SetLabelOffset(0.007); h_isojet1CSV_ZpLjets__267->GetZaxis()->SetTitleSize(0.05); h_isojet1CSV_ZpLjets__267->GetZaxis()->SetTickLength(0.025); h_isojet1CSV_ZpLjets__267->GetZaxis()->SetTitleFont(42); h->Add(h_isojet1CSV_Z+jets,""); TH1D *h_isojet1CSV_WpLjets__268 = new TH1D("h_isojet1CSV_WpLjets__268","",10,0,1); h_isojet1CSV_WpLjets__268->SetBinContent(1,0.01060448); h_isojet1CSV_WpLjets__268->SetBinContent(2,0.01194981); h_isojet1CSV_WpLjets__268->SetBinContent(3,0.007295854); h_isojet1CSV_WpLjets__268->SetBinContent(4,0.004201536); h_isojet1CSV_WpLjets__268->SetBinContent(5,0.003315037); h_isojet1CSV_WpLjets__268->SetBinContent(6,0.002154035); h_isojet1CSV_WpLjets__268->SetBinContent(7,0.001704806); h_isojet1CSV_WpLjets__268->SetBinContent(8,0.001590696); h_isojet1CSV_WpLjets__268->SetBinContent(9,0.001506952); h_isojet1CSV_WpLjets__268->SetBinContent(10,0.00135957); h_isojet1CSV_WpLjets__268->SetBinError(1,0.0007760229); h_isojet1CSV_WpLjets__268->SetBinError(2,0.0008063374); h_isojet1CSV_WpLjets__268->SetBinError(3,0.0006567409); h_isojet1CSV_WpLjets__268->SetBinError(4,0.0005519722); h_isojet1CSV_WpLjets__268->SetBinError(5,0.0004860992); h_isojet1CSV_WpLjets__268->SetBinError(6,0.0003673486); h_isojet1CSV_WpLjets__268->SetBinError(7,0.0003806515); h_isojet1CSV_WpLjets__268->SetBinError(8,0.0003677212); h_isojet1CSV_WpLjets__268->SetBinError(9,0.0003252218); h_isojet1CSV_WpLjets__268->SetBinError(10,0.0002763251); h_isojet1CSV_WpLjets__268->SetEntries(3309); h_isojet1CSV_WpLjets__268->SetStats(0); ci = TColor::GetColor("#66cc66"); h_isojet1CSV_WpLjets__268->SetFillColor(ci); h_isojet1CSV_WpLjets__268->GetXaxis()->SetTitle("isojet 1 CSV"); h_isojet1CSV_WpLjets__268->GetXaxis()->SetLabelFont(42); h_isojet1CSV_WpLjets__268->GetXaxis()->SetLabelOffset(0.007); h_isojet1CSV_WpLjets__268->GetXaxis()->SetTitleSize(0.05); h_isojet1CSV_WpLjets__268->GetXaxis()->SetTickLength(0.025); h_isojet1CSV_WpLjets__268->GetXaxis()->SetTitleFont(42); h_isojet1CSV_WpLjets__268->GetYaxis()->SetTitle("a.u."); h_isojet1CSV_WpLjets__268->GetYaxis()->SetLabelFont(42); h_isojet1CSV_WpLjets__268->GetYaxis()->SetLabelOffset(0.007); h_isojet1CSV_WpLjets__268->GetYaxis()->SetTitleSize(0.05); h_isojet1CSV_WpLjets__268->GetYaxis()->SetTickLength(0.025); h_isojet1CSV_WpLjets__268->GetYaxis()->SetTitleFont(42); h_isojet1CSV_WpLjets__268->GetZaxis()->SetLabelFont(42); h_isojet1CSV_WpLjets__268->GetZaxis()->SetLabelOffset(0.007); h_isojet1CSV_WpLjets__268->GetZaxis()->SetTitleSize(0.05); h_isojet1CSV_WpLjets__268->GetZaxis()->SetTickLength(0.025); h_isojet1CSV_WpLjets__268->GetZaxis()->SetTitleFont(42); h->Add(h_isojet1CSV_W+jets,""); TH1D *h_isojet1CSV_TopsPoPLFcP__269 = new TH1D("h_isojet1CSV_TopsPoPLFcP__269","",10,0,1); h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(1,0.09097508); h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(2,0.09232326); h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(3,0.04269338); h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(4,0.02949662); h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(5,0.02281892); h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(6,0.01709603); h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(7,0.01404044); h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(8,0.009499499); h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(9,0.006095059); h_isojet1CSV_TopsPoPLFcP__269->SetBinContent(10,0.003040849); h_isojet1CSV_TopsPoPLFcP__269->SetBinError(1,0.0009372855); h_isojet1CSV_TopsPoPLFcP__269->SetBinError(2,0.0009857636); h_isojet1CSV_TopsPoPLFcP__269->SetBinError(3,0.0007155424); h_isojet1CSV_TopsPoPLFcP__269->SetBinError(4,0.0005977933); h_isojet1CSV_TopsPoPLFcP__269->SetBinError(5,0.0005373378); h_isojet1CSV_TopsPoPLFcP__269->SetBinError(6,0.0004781073); h_isojet1CSV_TopsPoPLFcP__269->SetBinError(7,0.0004489056); h_isojet1CSV_TopsPoPLFcP__269->SetBinError(8,0.0003875753); h_isojet1CSV_TopsPoPLFcP__269->SetBinError(9,0.0003337873); h_isojet1CSV_TopsPoPLFcP__269->SetBinError(10,0.0003173281); h_isojet1CSV_TopsPoPLFcP__269->SetEntries(45754); h_isojet1CSV_TopsPoPLFcP__269->SetStats(0); ci = TColor::GetColor("#cc33cc"); h_isojet1CSV_TopsPoPLFcP__269->SetFillColor(ci); h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetTitle("isojet 1 CSV"); h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetLabelFont(42); h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetLabelOffset(0.007); h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetTitleSize(0.05); h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetTickLength(0.025); h_isojet1CSV_TopsPoPLFcP__269->GetXaxis()->SetTitleFont(42); h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetTitle("a.u."); h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetLabelFont(42); h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetLabelOffset(0.007); h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetTitleSize(0.05); h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetTickLength(0.025); h_isojet1CSV_TopsPoPLFcP__269->GetYaxis()->SetTitleFont(42); h_isojet1CSV_TopsPoPLFcP__269->GetZaxis()->SetLabelFont(42); h_isojet1CSV_TopsPoPLFcP__269->GetZaxis()->SetLabelOffset(0.007); h_isojet1CSV_TopsPoPLFcP__269->GetZaxis()->SetTitleSize(0.05); h_isojet1CSV_TopsPoPLFcP__269->GetZaxis()->SetTickLength(0.025); h_isojet1CSV_TopsPoPLFcP__269->GetZaxis()->SetTitleFont(42); h->Add(h_isojet1CSV_Top (LF),""); TH1D *h_isojet1CSV_TopsPoPHFcP__270 = new TH1D("h_isojet1CSV_TopsPoPHFcP__270","",10,0,1); h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(1,0.01878166); h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(2,0.02708098); h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(3,0.01896531); h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(4,0.01870601); h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(5,0.01924485); h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(6,0.02077131); h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(7,0.02899544); h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(8,0.03698897); h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(9,0.07325594); h_isojet1CSV_TopsPoPHFcP__270->SetBinContent(10,0.2676551); h_isojet1CSV_TopsPoPHFcP__270->SetBinError(1,0.0004640739); h_isojet1CSV_TopsPoPHFcP__270->SetBinError(2,0.0005643558); h_isojet1CSV_TopsPoPHFcP__270->SetBinError(3,0.0004957084); h_isojet1CSV_TopsPoPHFcP__270->SetBinError(4,0.0004766015); h_isojet1CSV_TopsPoPHFcP__270->SetBinError(5,0.0004665302); h_isojet1CSV_TopsPoPHFcP__270->SetBinError(6,0.0005070097); h_isojet1CSV_TopsPoPHFcP__270->SetBinError(7,0.0006476121); h_isojet1CSV_TopsPoPHFcP__270->SetBinError(8,0.0007056579); h_isojet1CSV_TopsPoPHFcP__270->SetBinError(9,0.0009826258); h_isojet1CSV_TopsPoPHFcP__270->SetBinError(10,0.001744809); h_isojet1CSV_TopsPoPHFcP__270->SetEntries(77950); h_isojet1CSV_TopsPoPHFcP__270->SetStats(0); ci = TColor::GetColor("#ff9900"); h_isojet1CSV_TopsPoPHFcP__270->SetFillColor(ci); h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetTitle("isojet 1 CSV"); h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetLabelFont(42); h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetLabelOffset(0.007); h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetTitleSize(0.05); h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetTickLength(0.025); h_isojet1CSV_TopsPoPHFcP__270->GetXaxis()->SetTitleFont(42); h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetTitle("a.u."); h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetLabelFont(42); h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetLabelOffset(0.007); h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetTitleSize(0.05); h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetTickLength(0.025); h_isojet1CSV_TopsPoPHFcP__270->GetYaxis()->SetTitleFont(42); h_isojet1CSV_TopsPoPHFcP__270->GetZaxis()->SetLabelFont(42); h_isojet1CSV_TopsPoPHFcP__270->GetZaxis()->SetLabelOffset(0.007); h_isojet1CSV_TopsPoPHFcP__270->GetZaxis()->SetTitleSize(0.05); h_isojet1CSV_TopsPoPHFcP__270->GetZaxis()->SetTickLength(0.025); h_isojet1CSV_TopsPoPHFcP__270->GetZaxis()->SetTitleFont(42); h->Add(h_isojet1CSV_Top (HF),""); h->Draw("hist"); TH1D *hsum__271 = new TH1D("hsum__271","",10,0,1); hsum__271->SetBinContent(1,0.1393796); hsum__271->SetBinContent(2,0.1586681); hsum__271->SetBinContent(3,0.08197864); hsum__271->SetBinContent(4,0.06142623); hsum__271->SetBinContent(5,0.05359128); hsum__271->SetBinContent(6,0.0447599); hsum__271->SetBinContent(7,0.04846618); hsum__271->SetBinContent(8,0.05074524); hsum__271->SetBinContent(9,0.082468); hsum__271->SetBinContent(10,0.2785168); hsum__271->SetBinError(1,0.002288647); hsum__271->SetBinError(2,0.002167196); hsum__271->SetBinError(3,0.001617233); hsum__271->SetBinError(4,0.001528597); hsum__271->SetBinError(5,0.001538373); hsum__271->SetBinError(6,0.001141764); hsum__271->SetBinError(7,0.001103813); hsum__271->SetBinError(8,0.001058293); hsum__271->SetBinError(9,0.001107265); hsum__271->SetBinError(10,0.002872657); hsum__271->SetEntries(45); hsum__271->SetStats(0); ci = 1202; color = new TColor(ci, 0, 0, 0, " ", 0.99); hsum__271->SetFillColor(ci); hsum__271->SetFillStyle(3003); hsum__271->SetLineWidth(0); hsum__271->GetXaxis()->SetTitle("isojet 1 CSV"); hsum__271->GetXaxis()->SetLabelFont(42); hsum__271->GetXaxis()->SetLabelOffset(0.007); hsum__271->GetXaxis()->SetTitleSize(0.05); hsum__271->GetXaxis()->SetTickLength(0.025); hsum__271->GetXaxis()->SetTitleFont(42); hsum__271->GetYaxis()->SetTitle("a.u."); hsum__271->GetYaxis()->SetLabelFont(42); hsum__271->GetYaxis()->SetLabelOffset(0.007); hsum__271->GetYaxis()->SetTitleSize(0.05); hsum__271->GetYaxis()->SetTickLength(0.025); hsum__271->GetYaxis()->SetTitleFont(42); hsum__271->GetZaxis()->SetLabelFont(42); hsum__271->GetZaxis()->SetLabelOffset(0.007); hsum__271->GetZaxis()->SetTitleSize(0.05); hsum__271->GetZaxis()->SetTickLength(0.025); hsum__271->GetZaxis()->SetTitleFont(42); hsum__271->Draw("e2 same"); TH1D *h_isojet1CSV_Data__272 = new TH1D("h_isojet1CSV_Data__272","",10,0,1); h_isojet1CSV_Data__272->SetBinContent(1,0.138368); h_isojet1CSV_Data__272->SetBinContent(2,0.1592858); h_isojet1CSV_Data__272->SetBinContent(3,0.08381231); h_isojet1CSV_Data__272->SetBinContent(4,0.06152831); h_isojet1CSV_Data__272->SetBinContent(5,0.05196457); h_isojet1CSV_Data__272->SetBinContent(6,0.04475643); h_isojet1CSV_Data__272->SetBinContent(7,0.04833695); h_isojet1CSV_Data__272->SetBinContent(8,0.05059832); h_isojet1CSV_Data__272->SetBinContent(9,0.08235183); h_isojet1CSV_Data__272->SetBinContent(10,0.2789975); h_isojet1CSV_Data__272->SetBinError(1,0.002553194); h_isojet1CSV_Data__272->SetBinError(2,0.002739394); h_isojet1CSV_Data__272->SetBinError(3,0.0019871); h_isojet1CSV_Data__272->SetBinError(4,0.001702564); h_isojet1CSV_Data__272->SetBinError(5,0.001564659); h_isojet1CSV_Data__272->SetBinError(6,0.00145209); h_isojet1CSV_Data__272->SetBinError(7,0.001509057); h_isojet1CSV_Data__272->SetBinError(8,0.001543953); h_isojet1CSV_Data__272->SetBinError(9,0.001969711); h_isojet1CSV_Data__272->SetBinError(10,0.003625484); h_isojet1CSV_Data__272->SetEntries(21226); h_isojet1CSV_Data__272->SetStats(0); h_isojet1CSV_Data__272->SetLineWidth(3); h_isojet1CSV_Data__272->SetMarkerStyle(20); h_isojet1CSV_Data__272->SetMarkerSize(2); h_isojet1CSV_Data__272->GetXaxis()->SetTitle("isojet 1 CSV"); h_isojet1CSV_Data__272->GetXaxis()->SetLabelFont(42); h_isojet1CSV_Data__272->GetXaxis()->SetLabelOffset(0.007); h_isojet1CSV_Data__272->GetXaxis()->SetTitleSize(0.05); h_isojet1CSV_Data__272->GetXaxis()->SetTickLength(0.025); h_isojet1CSV_Data__272->GetXaxis()->SetTitleFont(42); h_isojet1CSV_Data__272->GetYaxis()->SetTitle("a.u."); h_isojet1CSV_Data__272->GetYaxis()->SetLabelFont(42); h_isojet1CSV_Data__272->GetYaxis()->SetLabelOffset(0.007); h_isojet1CSV_Data__272->GetYaxis()->SetTitleSize(0.05); h_isojet1CSV_Data__272->GetYaxis()->SetTickLength(0.025); h_isojet1CSV_Data__272->GetYaxis()->SetTitleFont(42); h_isojet1CSV_Data__272->GetZaxis()->SetLabelFont(42); h_isojet1CSV_Data__272->GetZaxis()->SetLabelOffset(0.007); h_isojet1CSV_Data__272->GetZaxis()->SetTitleSize(0.05); h_isojet1CSV_Data__272->GetZaxis()->SetTickLength(0.025); h_isojet1CSV_Data__272->GetZaxis()->SetTitleFont(42); h_isojet1CSV_Data__272->Draw("elp same"); TLegend *leg = new TLegend(0.6,0.55,0.88,0.9,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(0); TLegendEntry *entry=leg->AddEntry("h_isojet1CSV_Data","Data","ELP"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetMarkerColor(1); entry->SetMarkerStyle(20); entry->SetMarkerSize(2); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_Top (HF)","Top (HF)","F"); ci = TColor::GetColor("#ff9900"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_Top (LF)","Top (LF)","F"); ci = TColor::GetColor("#cc33cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_W+jets","W+jets","F"); ci = TColor::GetColor("#66cc66"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_Z+jets","Z+jets","F"); ci = TColor::GetColor("#3399cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_Diboson","Diboson","F"); ci = TColor::GetColor("#9966cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_QCD","QCD","F"); ci = TColor::GetColor("#cccccc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); leg = new TLegend(0.6,0.55,0.88,0.9,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(0); entry=leg->AddEntry("h_isojet1CSV_Data","Data","ELP"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(3); entry->SetMarkerColor(1); entry->SetMarkerStyle(20); entry->SetMarkerSize(2); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_Top (HF)","Top (HF)","F"); ci = TColor::GetColor("#ff9900"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_Top (LF)","Top (LF)","F"); ci = TColor::GetColor("#cc33cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_W+jets","W+jets","F"); ci = TColor::GetColor("#66cc66"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_Z+jets","Z+jets","F"); ci = TColor::GetColor("#3399cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_Diboson","Diboson","F"); ci = TColor::GetColor("#9966cc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); entry=leg->AddEntry("h_isojet1CSV_QCD","QCD","F"); ci = TColor::GetColor("#cccccc"); entry->SetFillColor(ci); entry->SetFillStyle(1001); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(21); entry->SetMarkerSize(1); entry->SetTextFont(42); leg->Draw(); TLatex * tex = new TLatex(0.18,0.85,"CMS"); tex->SetNDC(); tex->SetTextSize(0.06); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.28,0.85,"Preliminary"); tex->SetNDC(); tex->SetTextFont(52); tex->SetTextSize(0.06); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.9,0.94,"36.6 fb^{-1} (13 TeV)"); tex->SetNDC(); tex->SetTextAlign(31); tex->SetTextFont(42); tex->SetTextSize(0.04); tex->SetLineWidth(2); tex->Draw(); pad1->Modified(); c1->cd(); // ------------>Primitives in pad: pad2 TPad *pad2 = new TPad("pad2", "pad2",0,0.05,1,0.3); pad2->Draw(); pad2->cd(); pad2->Range(-0.1875,-0.8914286,1.0625,0.48); pad2->SetFillColor(0); pad2->SetBorderMode(0); pad2->SetBorderSize(2); pad2->SetGridy(); pad2->SetTickx(1); pad2->SetTicky(1); pad2->SetLeftMargin(0.15); pad2->SetRightMargin(0.05); pad2->SetTopMargin(0); pad2->SetBottomMargin(0.3); pad2->SetFrameFillStyle(0); pad2->SetFrameBorderMode(0); pad2->SetFrameFillStyle(0); pad2->SetFrameBorderMode(0); TH1D *ratio__273 = new TH1D("ratio__273","",10,0,1); ratio__273->SetBinContent(1,-0.00725764); ratio__273->SetBinContent(2,0.003892779); ratio__273->SetBinContent(3,0.0223676); ratio__273->SetBinContent(4,0.001661897); ratio__273->SetBinContent(5,-0.0303539); ratio__273->SetBinContent(6,-7.754564e-05); ratio__273->SetBinContent(7,-0.002666473); ratio__273->SetBinContent(8,-0.002895236); ratio__273->SetBinContent(9,-0.001408637); ratio__273->SetBinContent(10,0.001725793); ratio__273->SetBinError(1,0.0001); ratio__273->SetBinError(2,0.0001); ratio__273->SetBinError(3,0.0001); ratio__273->SetBinError(4,0.0001); ratio__273->SetBinError(5,0.0001); ratio__273->SetBinError(6,0.0001); ratio__273->SetBinError(7,0.0001); ratio__273->SetBinError(8,0.0001); ratio__273->SetBinError(9,0.0001); ratio__273->SetBinError(10,0.0001); ratio__273->SetMinimum(-0.48); ratio__273->SetMaximum(0.48); ratio__273->SetEntries(21236); ratio__273->SetStats(0); ratio__273->SetLineWidth(3); ratio__273->SetMarkerStyle(20); ratio__273->SetMarkerSize(2); ratio__273->GetXaxis()->SetTitle("isojet 1 CSV"); ratio__273->GetXaxis()->SetLabelFont(43); ratio__273->GetXaxis()->SetLabelOffset(0.007); ratio__273->GetXaxis()->SetLabelSize(30); ratio__273->GetXaxis()->SetTitleSize(40); ratio__273->GetXaxis()->SetTickLength(0.025); ratio__273->GetXaxis()->SetTitleOffset(5); ratio__273->GetXaxis()->SetTitleFont(43); ratio__273->GetYaxis()->SetTitle("#frac{Data-Exp}{Exp}"); ratio__273->GetYaxis()->SetNdivisions(5); ratio__273->GetYaxis()->SetLabelFont(43); ratio__273->GetYaxis()->SetLabelOffset(0.007); ratio__273->GetYaxis()->SetLabelSize(30); ratio__273->GetYaxis()->SetTitleSize(40); ratio__273->GetYaxis()->SetTickLength(0.025); ratio__273->GetYaxis()->SetTitleOffset(2.5); ratio__273->GetYaxis()->SetTitleFont(43); ratio__273->GetZaxis()->SetLabelFont(42); ratio__273->GetZaxis()->SetLabelOffset(0.007); ratio__273->GetZaxis()->SetTitleSize(0.05); ratio__273->GetZaxis()->SetTickLength(0.025); ratio__273->GetZaxis()->SetTitleFont(42); ratio__273->Draw("elp"); TH1D *zero__274 = new TH1D("zero__274","",10,0,1); zero__274->SetBinError(1,0.002553194); zero__274->SetBinError(2,0.002739394); zero__274->SetBinError(3,0.0019871); zero__274->SetBinError(4,0.001702564); zero__274->SetBinError(5,0.001564659); zero__274->SetBinError(6,0.00145209); zero__274->SetBinError(7,0.001509057); zero__274->SetBinError(8,0.001543953); zero__274->SetBinError(9,0.001969711); zero__274->SetBinError(10,0.003625484); zero__274->SetEntries(21236); zero__274->SetStats(0); zero__274->SetLineWidth(3); zero__274->SetMarkerStyle(20); zero__274->SetMarkerSize(2); zero__274->GetXaxis()->SetTitle("isojet 1 CSV"); zero__274->GetXaxis()->SetLabelFont(42); zero__274->GetXaxis()->SetLabelOffset(0.007); zero__274->GetXaxis()->SetTitleSize(0.05); zero__274->GetXaxis()->SetTickLength(0.025); zero__274->GetXaxis()->SetTitleFont(42); zero__274->GetYaxis()->SetTitle("a.u."); zero__274->GetYaxis()->SetLabelFont(42); zero__274->GetYaxis()->SetLabelOffset(0.007); zero__274->GetYaxis()->SetTitleSize(0.05); zero__274->GetYaxis()->SetTickLength(0.025); zero__274->GetYaxis()->SetTitleFont(42); zero__274->GetZaxis()->SetLabelFont(42); zero__274->GetZaxis()->SetLabelOffset(0.007); zero__274->GetZaxis()->SetTitleSize(0.05); zero__274->GetZaxis()->SetTickLength(0.025); zero__274->GetZaxis()->SetTitleFont(42); zero__274->Draw("hist same"); TH1D *sumratioup__275 = new TH1D("sumratioup__275","",10,0,1); sumratioup__275->SetBinContent(1,0.01642024); sumratioup__275->SetBinContent(2,0.01365867); sumratioup__275->SetBinContent(3,0.01972749); sumratioup__275->SetBinContent(4,0.02488509); sumratioup__275->SetBinContent(5,0.02870566); sumratioup__275->SetBinContent(6,0.02550863); sumratioup__275->SetBinContent(7,0.02277492); sumratioup__275->SetBinContent(8,0.02085501); sumratioup__275->SetBinContent(9,0.01342661); sumratioup__275->SetBinContent(10,0.01031412); sumratioup__275->SetBinError(1,0.002288647); sumratioup__275->SetBinError(2,0.002167196); sumratioup__275->SetBinError(3,0.001617233); sumratioup__275->SetBinError(4,0.001528597); sumratioup__275->SetBinError(5,0.001538373); sumratioup__275->SetBinError(6,0.001141764); sumratioup__275->SetBinError(7,0.001103813); sumratioup__275->SetBinError(8,0.001058293); sumratioup__275->SetBinError(9,0.001107265); sumratioup__275->SetBinError(10,0.002872657); sumratioup__275->SetEntries(55); sumratioup__275->SetStats(0); ci = 1202; color = new TColor(ci, 0, 0, 0, " ", 0.99); sumratioup__275->SetFillColor(ci); sumratioup__275->SetFillStyle(3003); sumratioup__275->GetXaxis()->SetTitle("isojet 1 CSV"); sumratioup__275->GetXaxis()->SetLabelFont(42); sumratioup__275->GetXaxis()->SetLabelOffset(0.007); sumratioup__275->GetXaxis()->SetTitleSize(0.05); sumratioup__275->GetXaxis()->SetTickLength(0.025); sumratioup__275->GetXaxis()->SetTitleFont(42); sumratioup__275->GetYaxis()->SetTitle("a.u."); sumratioup__275->GetYaxis()->SetLabelFont(42); sumratioup__275->GetYaxis()->SetLabelOffset(0.007); sumratioup__275->GetYaxis()->SetTitleSize(0.05); sumratioup__275->GetYaxis()->SetTickLength(0.025); sumratioup__275->GetYaxis()->SetTitleFont(42); sumratioup__275->GetZaxis()->SetLabelFont(42); sumratioup__275->GetZaxis()->SetLabelOffset(0.007); sumratioup__275->GetZaxis()->SetTitleSize(0.05); sumratioup__275->GetZaxis()->SetTickLength(0.025); sumratioup__275->GetZaxis()->SetTitleFont(42); sumratioup__275->Draw("hist same"); TH1D *sumratiodown__276 = new TH1D("sumratiodown__276","",10,0,1); sumratiodown__276->SetBinContent(1,-0.01642024); sumratiodown__276->SetBinContent(2,-0.01365867); sumratiodown__276->SetBinContent(3,-0.01972749); sumratiodown__276->SetBinContent(4,-0.02488509); sumratiodown__276->SetBinContent(5,-0.02870566); sumratiodown__276->SetBinContent(6,-0.02550863); sumratiodown__276->SetBinContent(7,-0.02277492); sumratiodown__276->SetBinContent(8,-0.02085501); sumratiodown__276->SetBinContent(9,-0.01342661); sumratiodown__276->SetBinContent(10,-0.01031412); sumratiodown__276->SetBinError(1,0.002288647); sumratiodown__276->SetBinError(2,0.002167196); sumratiodown__276->SetBinError(3,0.001617233); sumratiodown__276->SetBinError(4,0.001528597); sumratiodown__276->SetBinError(5,0.001538373); sumratiodown__276->SetBinError(6,0.001141764); sumratiodown__276->SetBinError(7,0.001103813); sumratiodown__276->SetBinError(8,0.001058293); sumratiodown__276->SetBinError(9,0.001107265); sumratiodown__276->SetBinError(10,0.002872657); sumratiodown__276->SetEntries(55); sumratiodown__276->SetStats(0); ci = 1202; color = new TColor(ci, 0, 0, 0, " ", 0.99); sumratiodown__276->SetFillColor(ci); sumratiodown__276->SetFillStyle(3003); sumratiodown__276->GetXaxis()->SetTitle("isojet 1 CSV"); sumratiodown__276->GetXaxis()->SetLabelFont(42); sumratiodown__276->GetXaxis()->SetLabelOffset(0.007); sumratiodown__276->GetXaxis()->SetTitleSize(0.05); sumratiodown__276->GetXaxis()->SetTickLength(0.025); sumratiodown__276->GetXaxis()->SetTitleFont(42); sumratiodown__276->GetYaxis()->SetTitle("a.u."); sumratiodown__276->GetYaxis()->SetLabelFont(42); sumratiodown__276->GetYaxis()->SetLabelOffset(0.007); sumratiodown__276->GetYaxis()->SetTitleSize(0.05); sumratiodown__276->GetYaxis()->SetTickLength(0.025); sumratiodown__276->GetYaxis()->SetTitleFont(42); sumratiodown__276->GetZaxis()->SetLabelFont(42); sumratiodown__276->GetZaxis()->SetLabelOffset(0.007); sumratiodown__276->GetZaxis()->SetTitleSize(0.05); sumratiodown__276->GetZaxis()->SetTickLength(0.025); sumratiodown__276->GetZaxis()->SetTitleFont(42); sumratiodown__276->Draw("hist same"); Double_t Graph0_fx1023[10] = { 0.05, 0.15, 0.25, 0.35, 0.45, 0.55, 0.65, 0.75, 0.85, 0.95}; Double_t Graph0_fy1023[10] = { -0.00725764, 0.003892779, 0.0223676, 0.001661897, -0.0303539, -7.754564e-05, -0.002666473, -0.002895236, -0.001408637, 0.001725793}; Double_t Graph0_fex1023[10] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; Double_t Graph0_fey1023[10] = { 0.01831827, 0.01726493, 0.02423924, 0.02771721, 0.02919614, 0.03244177, 0.03113628, 0.03042557, 0.02388455, 0.01301711}; TGraphErrors *gre = new TGraphErrors(10,Graph0_fx1023,Graph0_fy1023,Graph0_fex1023,Graph0_fey1023); gre->SetName("Graph0"); gre->SetTitle("Graph"); gre->SetFillColor(1); gre->SetLineWidth(3); TH1F *Graph_Graph1023 = new TH1F("Graph_Graph1023","Graph",100,0,1.04); Graph_Graph1023->SetMinimum(-0.07016574); Graph_Graph1023->SetMaximum(0.05722253); Graph_Graph1023->SetDirectory(0); Graph_Graph1023->SetStats(0); ci = TColor::GetColor("#000099"); Graph_Graph1023->SetLineColor(ci); Graph_Graph1023->GetXaxis()->SetLabelFont(42); Graph_Graph1023->GetXaxis()->SetLabelOffset(0.007); Graph_Graph1023->GetXaxis()->SetTitleSize(0.05); Graph_Graph1023->GetXaxis()->SetTickLength(0.025); Graph_Graph1023->GetXaxis()->SetTitleFont(42); Graph_Graph1023->GetYaxis()->SetLabelFont(42); Graph_Graph1023->GetYaxis()->SetLabelOffset(0.007); Graph_Graph1023->GetYaxis()->SetTitleSize(0.05); Graph_Graph1023->GetYaxis()->SetTickLength(0.025); Graph_Graph1023->GetYaxis()->SetTitleFont(42); Graph_Graph1023->GetZaxis()->SetLabelFont(42); Graph_Graph1023->GetZaxis()->SetLabelOffset(0.007); Graph_Graph1023->GetZaxis()->SetTitleSize(0.05); Graph_Graph1023->GetZaxis()->SetTickLength(0.025); Graph_Graph1023->GetZaxis()->SetTitleFont(42); gre->SetHistogram(Graph_Graph1023); gre->Draw("pe0"); pad2->Modified(); c1->cd(); c1->Modified(); c1->cd(); c1->SetSelected(c1); }
void dnde() { //////////////// Load Fermi data float** fermidata; fermidata= read_file("../eptestF/FERMI_total_12months.dat",42,8); //TNtuple fermi( "dndef","dNdE" //,"Emin:Emax:Energy:Flux3:stat:sysp:sysm:smooth"); // fermi.Readfile("../eptestF/FERMI_total_12months.dat"); float Feng[42],Fflux3[42],Fstat[42],Fsysp[42],Fsysm[42], Ferrorp[42],Ferrorm[42]; float *row ; int Frow; Frow=42; for( int i = 0; i<42; i++) { Feng[i] = fermidata[2][i]; Fflux3[i] = fermidata[3][i]; Fstat[i] = fermidata[4][i]; Fsysp[i] = fermidata[5][i]; Fsysm[i] = fermidata[6][i]; Ferrorp[i]= sqrt( Fsysp[i]*Fsysp[i]+ Fstat[i] * Fstat[i]); Ferrorm[i]= sqrt( Fsysp[i]*Fsysp[i]+ Fstat[i] * Fstat[i]); } //////////////// Load dnde amplitude data TNtuple dndef( "dndef","dNdE","row:amplitude:sigma"); dndef.ReadFile( "../chains/dnde_mod3.dat"); int sdim; sdim = dndef.GetEntries(); cout<<"sdim = " <<sdim<<endl; float log10e[sdim]; float eng[sdim]; float spectrum[sdim]; float sigma[sdim]; int ii; for ( int i =0; i< sdim; i++) { ii= sdim -i-1; dndef.GetEntry(i); row = dndef.GetArgs(); log10e[i] = 3.6-ii*0.2; eng[i] = pow( 10., log10e[i]); // cout<<"eng "<<eng[i]<<endl; spectrum[ii] = row[1]; cout<<"amp "<<ii<<" "<<spectrum[ii]<<endl; sigma[ii] = row[2]; cout<<"sigma "<<ii<<" "<<sigma[ii]<<endl; } //////////////// Load electron and positron background TNtuple bge( "bge","KRA electron","flux"); bge.ReadFile( "../eptestF/propmod/electronflux_KRA004_BG.dat"); TNtuple bgp( "bgp","KRA positron","flux"); bgp.ReadFile( "../eptestF/propmod/positronflux_KRA004_BG.dat"); TNtuple bgeng0( "bgeng0","KRA Energy list","eng"); bgeng0.ReadFile( "../eptestF/propmod/KRA004_ENG.dat"); int bglnum = 146; float bgeflux[bglnum],bgpflux[bglnum],bgeng[bglnum]; float bgepflux3[bglnum]; for ( int i =0; i< bglnum; i++) { bge.GetEntry(i); row = bge.GetArgs(); bgeflux[i]= row[0]; bgp.GetEntry(i); row = bgp.GetArgs(); bgpflux[i]= row[0]; bgeng0.GetEntry(i); row = bgeng0.GetArgs(); bgeng[i]= row[0]; bgepflux3[i] = (bgpflux[i]+bgeflux[i])* pow( bgeng[i],3); } //////////////// Load step function flux data float** stepffile; int dmnum; dmnum = 123; stepffile= read_file("../chains/spectrum_stepf.dat",20,dmnum); float DMflux[dmnum]; float DMflux3[dmnum]; float DMeng[dmnum]; float epTotal[dmnum]; // float DMengstep; // DMengstep = 0.025; for ( int j=0; j<dmnum; j++) { // DMeng[j] = pow( 10., DMengstep*(j-1)); DMeng[j] = bgeng[j]; // cout<< DMeng[j]<<" "<<endl; DMflux[j] =0.; for ( int i = 0 ; i < sdim; i++) { ii= sdim -i-1; DMflux[j] = DMflux[j]+spectrum[ii]*stepffile[j][i]*1.e4; } DMflux3[j] = 2.*DMflux[j]*pow(DMeng[j],3); epTotal [j] = DMflux3[j]+ bgepflux3[j]; } ///////////////// Load step function flux at Fermi energy float** stepffile2; stepffile2= read_file("../chains/spectrum_FERMI.dat",20,42); float DMflux3_fermi[42]; for ( int j=0; j<42; j++) { DMflux3_fermi[j] =0.; for ( int i = 0 ; i < sdim; i++) { ii= sdim -i-1; DMflux3_fermi[j] = DMflux3_fermi[j]+ 2.*spectrum[ii]*stepffile2[j][i]*1.e4*pow(Feng[j],3) ; } } TCanvas *mycanvas = new TCanvas("mycanvs","A Simple Graph with error bars",200,10,600,1200); // mycanvas->SetFillColor(42); // mycanvas->SetGrid(); // mycanvas->GetFrame()->SetFillColor(18); // mycanvas -> Divide(1,2); // mycanvas -> cd(1); // mycanvas->GetFrame()->SetBorderSize(12); mycanvas->SetFillColor(18); TPad* pad1 = new TPad("pad1","dnde Fermi",0.05,0.50,0.95,0.95,0); TPad* pad2 = new TPad("pad2","Fermi data",0.05,0.05,0.95,0.45,0); //TH1F *hr = mycanvas->DrawFrame(10,10,4000,100); //mycanvas->DrawFrame(10,0,4000,200); pad1 -> Draw(); pad2 -> Draw(); /////////////////// Pad 1 ////////////////// pad1->cd(); TGraphErrors *gr = new TGraphErrors(sdim,eng,spectrum,NULL,sigma); // TGraphErrors graph(n_points,x_vals,y_vals,NULL,y_errs); gROOT -> SetStyle("Plain"); gr->SetTitle("Fermi Mode1"); //mycanvas-> GetPad(1)->SetBorderMode(-1); pad1->GetFrame()->SetBorderMode(-1); //mycanvas-> GetPad(1)->SetBorderSize(5); pad1->GetFrame()->SetBorderSize(5); // mycanvas-> GetPad(1)->SetFillColor(0); // pad1->GetFrame()->SetFillColor(42); pad1-> SetLogx(); pad1-> SetLogy(); gr->GetXaxis() -> SetTitle("Energy [GeV]"); gr->GetXaxis() -> CenterTitle(1); gr->GetYaxis() -> SetTitle("dN/dE [GeV^{-1}]"); gr->GetYaxis() -> CenterTitle(1); // gr->SetMarkerColor(kBlue); gr->SetMarkerColor ( 2 ) ; gr->SetMarkerStyle(21); gr->SetLineColor ( 2 ) ; gr->SetMarkerStyle(kOpenCircle); // gr->SetLineColor ( kBlue ) ; gr->SetLineColor ( 4 ) ; gr->SetLineWidth(1); // gr->Draw("CLP"); gr->Draw("ALP"); /////////////////// Pad 2 ////////////////// Fermi Data // mycanvas -> cd(2); pad2 -> cd(); TGraphAsymmErrors *fermiP = new TGraphAsymmErrors(Frow,Feng, Fflux3,NULL,NULL,Ferrorm,Ferrorp); fermiP->SetTitle("Fermi"); pad2-> SetLogx(); fermiP->GetXaxis() -> SetTitle("Energy [GeV]"); fermiP->GetXaxis() -> CenterTitle(1); fermiP->GetYaxis() -> SetTitle("#Phi E^{3} [m^{-2}s^{-1}sr^{-1}GeV^{2}]"); fermiP->SetMarkerStyle(2); fermiP->SetLineColor ( 2 ) ; fermiP->SetMarkerColor ( 2 ) ; fermiP->GetYaxis() -> CenterTitle(1); // TAxis *axis = fermiP -> GetXaxis(); // axis -> SetLimits(10.,1000.); fermiP -> GetHistogram()->SetMaximum(250.); fermiP -> GetHistogram()->SetMinimum(30.); // mycanvas-> GetPad(2)->SetLogy(); fermiP -> Draw("AP"); TGraph * bgepP = new TGraph(bglnum,bgeng, bgepflux3); bgepP -> Draw("C"); TGraph * DMepP = new TGraph(dmnum,DMeng, DMflux3); DMepP -> Draw("C"); TGraph * TepP = new TGraph(dmnum,DMeng, epTotal); TepP->SetLineColor ( 2 ) ; TepP -> Draw("C"); //TGraph * DMepP2 = new TGraph(42,Feng, DMflux3_fermi); //DMepP2 -> Draw("C"); mycanvas->Update(); // Build and Draw a legend // TLegend leg(.1 ,.7 ,.3 ,.9 ,"Lab. Lesson 1"); // leg.SetFillColor (0) ; //gr->SetFillColor (0) ; //leg.AddEntry(gr,"Exp. Points"); //leg.AddEntry(&f,"Th. Law"); //leg.DrawClone("Same"); // Draw an arrow on the canvas mycanvas->Update(); mycanvas -> Print("dnde_mod3_fermi.pdf"); }