void s_union() { gROOT->GetListOfCanvases()->Delete(); TCanvas *c = new TCanvas("composite shape", "Union boolean operation", 700, 1000); c->Divide(1,2,0,0); c->cd(2); gPad->SetPad(0,0,1,0.4); c->cd(1); gPad->SetPad(0,0.4,1,1); if (gGeoManager) delete gGeoManager; new TGeoManager("xtru", "poza12"); TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7); TGeoMedium *med = new TGeoMedium("MED",1,mat); TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100); gGeoManager->SetTopVolume(top); // define shape components with names TGeoPgon *pgon = new TGeoPgon("pg",0.,360.,6,2); pgon->DefineSection(0,0,0,20); pgon->DefineSection(1, 30,0,20); TGeoSphere *sph = new TGeoSphere("sph", 40., 45., 5., 175., 0., 340.); // define named geometrical transformations with names TGeoTranslation *tr = new TGeoTranslation(0., 0., 45.); tr->SetName("tr"); // register all used transformations tr->RegisterYourself(); // create the composite shape based on a Boolean expression TGeoCompositeShape *cs = new TGeoCompositeShape("mir", "sph:tr + pg"); TGeoVolume *vol = new TGeoVolume("COMP1",cs); top->AddNode(vol,1); gGeoManager->CloseGeometry(); gGeoManager->SetNsegments(100); top->Draw(); MakePicture(); c->cd(2); TPaveText *pt = new TPaveText(0.01,0.01,0.99,0.99); pt->SetLineColor(1); TText *text = pt->AddText("TGeoCompositeShape - composite shape class"); text->SetTextColor(2); pt->AddText("----- It's an example of boolean union operation : A + B"); pt->AddText("----- A == part of sphere (5-175, 0-340), B == pgon"); pt->AddText(" "); pt->SetAllWith("-----","color",4); pt->SetAllWith("-----","font",72); pt->SetAllWith("-----","size",0.04); pt->SetTextAlign(12); pt->SetTextSize(.044); pt->Draw(); c->cd(1); }
void CreateDrawAndSaveHistogramFWHM(TH1* &histo, TString outputdir, TString outputname, bool saveoutput, bool close, bool log=false){ /** @brief saves Histogramm as *.root and *.png and if wanted closes the histograms at the end * @details This mehtod create a histogramm and save it as root and png file. If you choose close, the canvas is closed after the histogram was saved */ setPandaStyle(); // gStyle->SetOptStat(1111); TString name = TString(histo->GetName()); TString title = TString(histo->GetTitle()); TCanvas * canvas = new TCanvas("c_"+name, title, 0,0,1500,1000); histo->Draw(); //***** FWHM ****** double max = histo->GetMaximum(); int bin1 = histo->FindFirstBinAbove(max/2); int bin2 = histo->FindLastBinAbove(max/2); double lowerbin = histo->GetBinCenter(bin1); double upperbin = histo->GetBinCenter(bin2) ; double FWHM = upperbin - lowerbin; TPaveText * text = new TPaveText(0.2,1500,1,3500); TString name = TString::Format("FWHM %.4f", FWHM); text->InsertText(name); text->SetFillColor(kWhite); text->SetTextFont(4); text->SetTextSize(30); text->SetTextAlign(12); text->Draw("SAME"); if(log) canvas->SetLogy(); PandaSmartLabel("L"); if (saveoutput){ canvas->Print(outputdir + "root-files/" + outputname + ".root"); canvas->Print(outputdir + "png-files/" + outputname + ".png"); canvas->Print(outputdir + "pdf-files/" + outputname + ".pdf"); } if (close) canvas->Close(); }
void Plot10Mu(const char* text,float X, float Y, float size) { TPaveText* atext = new TPaveText(X,Y,X+size,Y+size); atext->AddText(text); atext->SetLineColor(0); atext->SetFillColor(0); atext->SetTextFont(42); atext->SetTextSize(0.04); atext->Draw(); }
TPaveText *text(const char *txt, float x1, float y1, float x2, float y2) { TPaveText *text = new TPaveText(x1,y1,x2,y2,"brNDC"); text->AddText(txt); text->SetBorderSize(0); text->SetFillStyle(0); text->SetTextAlign(12); text->SetTextFont(42); text->SetTextSize(0.05); return text; }
void OverlayAnalysis::PostDrawMultiGraph(GraphName graphName, TMultiGraph *pMultiGraph) const { if(NULL == pMultiGraph) return; // base customize pMultiGraph->GetXaxis()->SetTitle("Distance between showers [cm]"); pMultiGraph->GetXaxis()->SetLabelFont(42); pMultiGraph->GetXaxis()->SetTitleSize(0.05); pMultiGraph->GetXaxis()->SetTitleOffset(1.); pMultiGraph->GetXaxis()->SetTitleFont(42); pMultiGraph->GetXaxis()->SetRangeUser(std::max(static_cast<int>(m_startDistance) - 5, 0), m_endDistance + 5); pMultiGraph->GetYaxis()->SetTitle(""); pMultiGraph->GetYaxis()->SetLabelFont(42); pMultiGraph->GetYaxis()->SetTitleSize(0.045); pMultiGraph->GetYaxis()->SetTitleOffset(1.3); pMultiGraph->GetYaxis()->SetTitleFont(42); pMultiGraph->GetYaxis()->SetLabelSize(0.035); TPaveText *pt = new TPaveText(0.3, 0.2, 0.93, 0.3, "tbNDC"); pt->SetTextSize(0.05); pt->SetTextColor(kGray+2); pt->SetFillColor(0); pt->SetLineWidth(0); pt->SetBorderSize(0); pt->AddText("CALICE SDHCAL"); pt->SetTextFont(62); pt->Draw(); // plot per plot customize switch(graphName) { case N_PFOS: pMultiGraph->GetYaxis()->SetTitle("<N_{pfos}>"); pMultiGraph->GetYaxis()->SetRangeUser(1, 3); break; case NEUTRAL_PURITY: pMultiGraph->GetYaxis()->SetTitle("#rho_{neutral}"); pMultiGraph->GetYaxis()->SetRangeUser(0, 1); break; case NEUTRAL_EFFICIENCY: pMultiGraph->GetYaxis()->SetTitle("#varepsilon_{neutral}"); pMultiGraph->GetYaxis()->SetRangeUser(0, 1); break; case NEUTRAL_RECOVER_PROBA: pMultiGraph->GetYaxis()->SetTitle("P_{n>0}"); pMultiGraph->GetYaxis()->SetRangeUser(0, 1); break; case NEUTRAL_ENERGY_DIFFERENCE_EFFICIENT: pMultiGraph->GetYaxis()->SetTitle("<E_{n,rec} - E_{n,meas}>, n>0"); pMultiGraph->GetYaxis()->SetRangeUser(-5, 5); break; } }
TCanvas * plot (TH1F* histoDataIn, TString legendData, TH1F* histoSimulationIn, TString legendSimulation, TString & canvasName, Float_t maximum = 0.15, TString xAxisTitle = "#eta", TString yAxisTitle = "Number of Clusters", TString error = "", bool useLegend = true, TString text = "", Float_t textX = 0.7, Float_t textY = 0.4, Float_t rebin = 0 ) { TH1F * histoData = (TH1F*)histoDataIn->Clone(); TH1F * histoSimulation = (TH1F*)histoSimulationIn->Clone(); // histoData->Sumw2(); histoData->Scale(1/(histoData->Integral())); histoSimulation->Scale(1/(histoSimulation->Integral())); // Create also the legend and add the histograms TLegend * legend = new TLegend( 0.55, 0.65, 0.76, 0.82 ); legend->AddEntry( histoData, xAxisTitle ); legend->AddEntry( histoSimulation, yAxisTitle, "F" ); cout << "histoData = " << histoData << endl; cout << "histoSimulation = " << histoSimulation << endl; TCanvas * c = new TCanvas( canvasName, canvasName, 1000, 800 ); c->Draw(); histoSimulation->SetMaximum(maximum); histoSimulation->SetFillColor(kRed); // histoSimulation->SetLineWidth(0); histoSimulation->SetLineColor(kRed); histoSimulation->SetXTitle(xAxisTitle); histoSimulation->SetYTitle(yAxisTitle); histoSimulation->SetTitleOffset(1.6,"Y"); histoSimulation->SetTitle(); histoData->SetLineStyle(1); histoData->SetLineWidth(2.5); histoSimulation->Draw(); histoData->Draw("same"); legend->SetFillColor(kWhite); if (useLegend) legend->Draw("same"); if ( text != "" ) { TPaveText * pt = new TPaveText(textX, textY, textX+0.2, textY+0.17, "NDC" ); // "NDC" option sets coords relative to pad dimensions pt->SetFillColor(0); // text is black on white pt->SetTextSize(0.08); pt->SetBorderSize(0); pt->SetTextAlign(12); pt->AddText(text); pt->Draw("same"); //to draw your text object } return c; };
void s_difference() { gROOT->GetListOfCanvases()->Delete(); TCanvas *c = new TCanvas("composite shape", "Difference boolean operation", 700, 1000); c->Divide(1,2,0,0); c->cd(2); gPad->SetPad(0,0,1,0.4); c->cd(1); gPad->SetPad(0,0.4,1,1); if (gGeoManager) delete gGeoManager; new TGeoManager("xtru", "poza12"); TGeoMaterial *mat = new TGeoMaterial("Al", 26.98,13,2.7); TGeoMedium *med = new TGeoMedium("MED",1,mat); TGeoVolume *top = gGeoManager->MakeBox("TOP",med,100,100,100); gGeoManager->SetTopVolume(top); // define shape components with names TGeoTorus *tor = new TGeoTorus("tor", 45., 15., 20., 45., 145.); TGeoSphere *sph = new TGeoSphere("sph", 20., 45., 0., 180., 0., 270.); // create the composite shape based on a Boolean expression TGeoCompositeShape *cs = new TGeoCompositeShape("mir", "sph - tor"); TGeoVolume *vol = new TGeoVolume("COMP3",cs); top->AddNode(vol,1); gGeoManager->CloseGeometry(); gGeoManager->SetNsegments(60); top->Draw(); MakePicture(); c->cd(2); TPaveText *pt = new TPaveText(.01, .01, .99, .99); pt->SetLineColor(1); TText *text = pt->AddText("TGeoCompositeShape - composite shape class"); text->SetTextColor(2); pt->AddText("----- It's an example of boolean difference: A - B"); pt->AddText("----- A == part of sphere (0-180, 0-270), B == partial torus (45-145)"); pt->AddText(" "); pt->SetAllWith("-----","color",4); pt->SetAllWith("-----","font",72); pt->SetAllWith("-----","size",0.04); pt->SetTextAlign(12); pt->SetTextSize(0.044); pt->Draw(); c->cd(1); }
void CMSPrelim(const char* dataset, const char* channel,const char* cat) { double lowX=0.16; double lowY=0.835; int color=1; int font = 62; TPaveText* cmsprel = new TPaveText(lowX, lowY+0.06, lowX+0.30, lowY+0.16, "NDC"); cmsprel->SetBorderSize( 0 ); cmsprel->SetFillStyle( 0 ); cmsprel->SetTextAlign( 12 ); cmsprel->SetTextColor( color ); cmsprel->SetTextFont ( font ); //cmsprel->SetTextSize ( 0.035 ); //cmsprel->SetTextSize ( 0.027 ); cmsprel->SetTextSize ( 0.030 ); cmsprel->AddText(dataset); cmsprel->Draw(); TPaveText* chan = new TPaveText(lowX+0.05, lowY-0.002, lowX+0.45, lowY+0.028, "NDC"); chan->SetBorderSize( 0 ); chan->SetFillStyle( 0 ); chan->SetTextAlign( 12 ); chan->SetTextSize ( 0.035 ); chan->SetTextColor( color ); chan->SetTextFont ( font ); chan->AddText(channel); chan->Draw(); TPaveText* category = new TPaveText(lowX+0.05, lowY-0.002-0.06, lowX+0.45, lowY+0.028-0.06, "NDC"); category->SetBorderSize( 0 ); category->SetFillStyle( 0 ); category->SetTextAlign( 12 ); category->SetTextSize ( 0.035 ); category->SetTextColor( color ); category->SetTextFont ( font ); category->AddText(cat); category->Draw(); }
void banner4Plot (){ TPaveText* pt ; pt = new TPaveText(.14,0.91,.25,.94,"NDC"); pt->AddText("Preliminary"); pt->SetFillColor(0); pt->SetTextSize(0.035); pt->SetFillStyle(0); pt->SetLineColor(0); pt->SetLineWidth(0); pt->SetMargin(0); pt->SetShadowColor(0); pt->Draw(); }
TPaveText *GetAveragepavetext(Int_t identifier){ //TPaveText* pvAverage = new TPaveText(0.012/gPad->GetWNDC()+gPad->GetLeftMargin(),0.26/gPad->GetHNDC()+gPad->GetBottomMargin(),0.3/gPad->GetWNDC()+gPad->GetLeftMargin(),0.25/gPad->GetHNDC()+gPad->GetBottomMargin(),"NDC"); TPaveText *pvAverage = new TPaveText(0.005/gPad->GetWNDC()+gPad->GetLeftMargin(),0.255/gPad->GetHNDC()+gPad->GetBottomMargin(),0.17/gPad->GetWNDC()+gPad->GetLeftMargin(),0.28/gPad->GetHNDC()+gPad->GetBottomMargin(),"NDC"); // TPaveText * pvAverage= new TPaveText(0.22,0.77,0.64,0.83,"NDC"); //0.21,0.83,0.5,0.863,"NDC"); SetPaveStyle(pvAverage); pvAverage->SetTextFont(43); // pvAverage->SetTextSize(0.07/(gPad->GetHNDC())*scaleHeightPads); pvAverage->SetTextSize(30*innerPadHeight/referencePadHeight*resizeTextFactor); pvAverage->AddText("Average D^{0},D^{+},D^{*+}"); pvAverage->SetName(Form("paveAverage_%d",identifier)); return pvAverage; }
TPaveText* addLHCbLabel(TString footer){ TPaveText * label = new TPaveText(0.70,0.12,0.9,0.32,"BRNDC"); //TPaveText * label = new TPaveText(0.12, 0.58, 0.12, 0.43,"BRNDC"); //label->SetFillColor(0); label->SetFillStyle(0); label->SetBorderSize(0); label->SetTextAlign(11); label->SetTextSize(Float_t(0.04)); TText * labeltext = 0; labeltext = label->AddText("LHC#font[12]{b} 2011 Data"); labeltext = label->AddText("#sqrt{s} = 7TeV"); labeltext = label->AddText(footer); return label; }
TPaveText *GetALICEpavetext(Int_t identifier){ TPaveText *alice = new TPaveText(0.207/gPad->GetWNDC()+gPad->GetLeftMargin(),0.255/gPad->GetHNDC()+gPad->GetBottomMargin(),0.29/gPad->GetWNDC()+gPad->GetLeftMargin(),0.28/gPad->GetHNDC()+gPad->GetBottomMargin(),"NDC"); cout<<"gPad->GetLeftMargin()="<<gPad->GetLeftMargin()<<" gPad->GetBottomMargin()="<<gPad->GetBottomMargin()<<" gPad->GetWNDC="<<gPad->GetWNDC()<<" gPad->GetHNDC()="<<gPad->GetHNDC()<<" totX="<<0.33/gPad->GetWNDC()+gPad->GetLeftMargin()<<" totY="<<0.255/gPad->GetHNDC()+gPad->GetBottomMargin()<<endl; // TPaveText *alice = new TPaveText(0.78,0.77,0.9,0.83,"NDC"); //TPaveText *alice = new TPaveText(0.012/gPad->GetWNDC()+gPad->GetLeftMargin(),0.26/gPad->GetHNDC()+gPad->GetBottomMargin(),0.3/gPad->GetWNDC()+gPad->GetLeftMargin(),0.28/gPad->GetHNDC()+gPad->GetBottomMargin(),"NDC"); //0.72,0.78,0.85,0.83,"NDC"); SetPaveStyle(alice); alice->SetTextFont(43); // alice->SetTextSize(0.07/(gPad->GetHNDC())*scaleHeightPads); alice->SetTextSize(30*innerPadHeight/referencePadHeight*resizeTextFactor); alice->AddText("ALICE");//commented // fitvalueslow->AddText("D meson (average D^{0},D^{+},D^{*+}) - charged particle correlation"); alice->SetName(Form("paveALICE_%d",identifier)); return alice; }
// Originally Written by Conor Fitzpatrick TPaveText* addLHCbLabel(TString footer, bool DATA){ // TPaveText * label = new TPaveText(0.18, 0.73, 0.18, 0.88,"BRNDC"); label->SetFillStyle(0); //Transparent i.e. Opacity of 0 :D label->SetBorderSize(0); label->SetTextAlign(11); label->SetTextSize(Float_t(0.04)); TText * labeltext = 0; TString labeltstring( "LHC#font[12]{b} 2011" ); if( DATA ) labeltstring.Append( " Data" ); if( !DATA ) labeltstring.Append( " Simulation" ); labeltext = label->AddText( labeltstring ); labeltext = label->AddText("#sqrt{s} = 7TeV"); labeltext = label->AddText(footer); (void) labeltext; return label; }
// Draw label for Decay Channel in upper left corner of plot void DrawDecayChLabel(TString decaychannel, double textSize) { TPaveText *decch = new TPaveText(); decch->AddText(decaychannel); decch->SetX1NDC( gStyle->GetPadLeftMargin() + gStyle->GetTickLength() ); decch->SetY1NDC(1.0 - gStyle->GetPadTopMargin() - gStyle->GetTickLength() - 0.05 ); decch->SetX2NDC( gStyle->GetPadLeftMargin() + gStyle->GetTickLength() + 0.15 ); decch->SetY2NDC(1.0 - gStyle->GetPadTopMargin() - gStyle->GetTickLength() ); decch->SetFillStyle(0); decch->SetBorderSize(0); if (textSize!=0) decch->SetTextSize(textSize); decch->SetTextAlign(12); decch->Draw("same"); }
void DrawFreeCMSLabels(char* text, double textSize) { //const char *text = "%2.1f #times 10^{6} clusters (fiducial) (%1.1f GeV)"; //char *text = "%2.1f #times 10^{6} clusters (fiducial)"; TPaveText *label = new TPaveText(); label->SetX1NDC(gStyle->GetPadLeftMargin()); label->SetY1NDC(1.0-gStyle->GetPadTopMargin()); label->SetX2NDC(1.0-gStyle->GetPadRightMargin()); label->SetY2NDC(1.0); label->SetTextFont(42); label->AddText(text); label->SetFillStyle(0); label->SetBorderSize(0); if (textSize!=0) label->SetTextSize(textSize); label->SetTextAlign(32); label->Draw("same"); }
TPaveText *GetPaveKineInfo2(Int_t identifier){ //TPaveText *pvKineInfo = new TPaveText(0.01/gPad->GetWNDC()+gPad->GetLeftMargin(),0.18/gPad->GetHNDC()+gPad->GetBottomMargin(),0.3/gPad->GetWNDC()+gPad->GetLeftMargin(),0.22/gPad->GetHNDC()+gPad->GetBottomMargin(),"NDC"); // TPaveText *pvKineInfo = new TPaveText(0.4,0.56,0.7,0.65,"NDC");//in pad 0 // TPaveText *pvKineInfo = new TPaveText(0.24,0.56,0.6,0.65,"NDC");//in pad 0 // TPaveText *pvKineInfo = new TPaveText(0.01,0.6,0.5,0.8,"brNDC");//in pad 1 TPaveText * pvKineInfo = new TPaveText(0.02/gPad->GetWNDC()+gPad->GetLeftMargin(),0.197/gPad->GetHNDC()+gPad->GetBottomMargin(),0.19/gPad->GetWNDC()+gPad->GetLeftMargin(),0.21/gPad->GetHNDC()+gPad->GetBottomMargin(),"NDC"); SetPaveStyle(pvKineInfo); pvKineInfo->SetTextAlign(12); //pvKineInfo->SetTextSize(0.06/(gPad->GetHNDC())*scaleHeightPads); pvKineInfo->SetTextFont(43); pvKineInfo->SetTextSize(21.9*innerPadHeight/referencePadHeight*resizeTextFactor);// settings for font 42: 0.07/(gPad->GetHNDC())*scaleHeight pvKineInfo->AddText(strYText.Data()); // pvKineInfo->AddText("|#it{y}^{D}|<0.5, |#Delta#it{#eta}| < 1.0 "); pvKineInfo->SetName(Form("pvKineInf0_%d",identifier)); return pvKineInfo; }
int makeZPhiArrowPlot( TTree* data, const char* name, double zLim, double phiLim, double level, double sublevel, double zMin, double zMax, double rMin, double rMax, double barrelRPhiRescale){ TCanvas* OBPCanvas = new TCanvas(name,name,1050,875); OBPCanvas->DrawFrame(-zLim, -phiLim, 1.2*zLim, phiLim, ";module position z [cm];module position r*phi [cm]"); OBPCanvas->SetFillColor(0); OBPCanvas->SetFrameBorderMode(0); TFrame* aFrame = OBPCanvas->GetFrame(); aFrame->SetFillColor(0); int passcut = 0; for(int entry = 0;entry<data->GetEntries(); entry++) { data->GetEntry(entry); if ((level_ == level)&&(((sublevel_ == sublevel)&&(sublevel != 0))||(sublevel == 0))){ if ((z_ <= zMax)&&(z_ > zMin)&&(r_ <= rMax)&&(r_ > rMin)){ TArrow* aArraw = new TArrow( z_, r_*phi_ , z_ + barrelRPhiRescale*dz_, r_*phi_+barrelRPhiRescale*r_*dphi_,0.0075,">"); aArraw->Draw(); passcut++; } } } DrawRPhiLegend( zLim, phiLim, barrelRPhiRescale ); char sliceLeg[192]; sprintf( sliceLeg, "%s: %f < r <= %f", name, rMin, rMax ); //Plot10Mu( name, xLim/2, yLim, 0.2*xLim ); TPaveText* atext = new TPaveText(0.2*zLim,0.85*phiLim,0.66*zLim,0.99*phiLim); atext->AddText(sliceLeg); atext->SetLineColor(0); atext->SetFillColor(0); atext->SetTextFont(42); atext->SetTextSize(0.04); atext->Draw(); char outfile[192]; sprintf( outfile, "%s/%s.png", outputDir_, name ); OBPCanvas->Print( outfile ); return passcut; }
TPaveText* getHeader(double lumi, TString channelName) { TPaveText* pt = new TPaveText(0.18,0.75,0.18,0.88,"brNDC"); pt->SetBorderSize(1); pt->SetTextFont(42); pt->SetTextSize(0.04); pt->SetLineColor(0); pt->SetLineStyle(1); pt->SetLineWidth(1); pt->SetFillColor(0); pt->SetFillStyle(1001); pt->SetTextAlign(12); pt->AddText("CMS Preliminary"); pt->AddText(Form("%.1f fb^{-1} at #sqrt{s} = 7 TeV", lumi)); if ( channelName != "" ) pt->AddText(channelName); return pt; }
void benchmarks() { TString dir = gSystem->UnixPathName(__FILE__); dir.ReplaceAll("benchmarks.C",""); dir.ReplaceAll("/./","/"); bench1 = new TCanvas("bench1","Benchmarks Summary",-1000,50,200,500); TPaveText *summary = new TPaveText(0,0,1,1); summary->SetTextAlign(12); summary->SetTextSize(0.08); summary->Draw(); summary->AddText(" graphics/framework.C"); summary->AddText(" hsimple.C"); summary->AddText(" hist/hsum.C"); summary->AddText(" graphics/formula1.C"); summary->AddText(" hist/fillrandom.C"); summary->AddText(" fit/fit1.C"); summary->AddText(" hist/h1draw.C"); summary->AddText(" graphs/graph.C"); summary->AddText(" graphs/gerrors.C"); summary->AddText(" graphics/tornado.C"); summary->AddText(" graphs/surfaces.C"); summary->AddText(" graphs/zdemo.C"); summary->AddText(" geom/geometry.C"); summary->AddText(" geom/na49view.C"); summary->AddText(" tree/ntuple1.C"); summary->AddText(" "); bexec(dir,"graphics/framework.C"); bexec(dir,"hsimple.C"); bexec(dir,"hist/hsum.C"); bexec(dir,"graphics/formula1.C"); bexec(dir,"hist/fillrandom.C"); bexec(dir,"fit/fit1.C"); bexec(dir,"hist/h1draw.C"); bexec(dir,"graphs/graph.C"); bexec(dir,"graphs/gerrors.C"); bexec(dir,"graphics/tornado.C"); bexec(dir,"graphs/surfaces.C"); bexec(dir,"graphs/zdemo.C"); bexec(dir,"geom/geometry.C"); bexec(dir,"geom/na49view.C"); bexec(dir,"tree/ntuple1.C"); bexec(dir,"rootmarks.C"); }
/// /// Draw a horizontal line at given p-value, put a /// label on top of it stating the corresponding CL. /// void OneMinusClPlot::drawCLguideLine(float pvalue) { m_mainCanvas->cd(); m_mainCanvas->Update(); float ymin = gPad->GetUymin(); float ymax = gPad->GetUymax(); float xmin = gPad->GetUxmin(); float xmax = gPad->GetUxmax(); float labelPos = xmin+(xmax-xmin)*0.10; if ( arg->isQuickhack(2) ) labelPos = xmin+(xmax-xmin)*0.55; if ( arg->isQuickhack(23) ) labelPos = xmin+(xmax-xmin)*0.8; float labelPosYmin = 0; float labelPosYmax = 0; if ( arg->plotlog ) { labelPosYmin = pvalue; labelPosYmax = labelPosYmin * 2.; } else { labelPosYmin = pvalue + 0.02; labelPosYmax = labelPosYmin + 0.05; } TPaveText *t = new TPaveText(labelPos, labelPosYmin, labelPos+(xmax-xmin)*0.5, labelPosYmax, "BR"); t->SetBorderSize(0); t->SetFillStyle(0); t->SetTextAlign(12); t->SetTextFont(font); t->SetTextSize(labelsize); t->AddText(Form("%.1f%%",(1.-pvalue)*100.)); t->Draw(); TLine* l = new TLine(xmin, pvalue, xmax, pvalue); l->SetLineWidth(1); l->SetLineColor(kBlack); l->SetLineStyle(kDotted); l->Draw(); }
// Draw official labels (CMS Preliminary, luminosity and CM energy) above plot void DrawCMSLabels(int cmsprelim=1, double energy=8, double textSize=0.04) { const char *text; if(cmsprelim ==2 ) {//Private work for PhDs students text = "Private Work, Simulation at #sqrt{s} = %2.f TeV"; } else if (cmsprelim==1) {//CMS preliminary label text = "CMS Preliminary, Simulation at #sqrt{s} = %2.f TeV"; } else {//CMS label text = "CMS, Simulation at #sqrt{s} = %2.f TeV"; } TPaveText *label = new TPaveText(); label->SetX1NDC(gStyle->GetPadLeftMargin()); label->SetY1NDC(1.0-gStyle->GetPadTopMargin()); label->SetX2NDC(1.0-gStyle->GetPadRightMargin()); label->SetY2NDC(1.0); label->SetTextFont(42); label->AddText(Form(text, energy)); label->SetFillStyle(0); label->SetBorderSize(0); if (textSize!=0) label->SetTextSize(textSize); label->SetTextAlign(32); label->Draw("same"); }
void CMSPrelim() { TPaveText* cmsprel = new TPaveText(0.19, 0.895 , 0.19 + 0.30, 0.895 + 0.10, "NDC"); cmsprel->SetBorderSize( 0 ); cmsprel->SetFillStyle( 0 ); cmsprel->SetTextAlign( 12 ); cmsprel->SetTextColor( 1 ); cmsprel->SetTextFont ( 62 ); //cmsprel->SetTextSize ( 0.035 ); //cmsprel->AddText("CMS Preliminary, #sqrt{s}=7-8 TeV, L=24.3 fb^{-1}, H#rightarrow#tau#tau"); //cmsprel->SetTextSize ( 0.027 ); //cmsprel->AddText("CMS Preliminary, L=4.9 fb^{-1}@#sqrt{s}=7 TeV, L=19.3 fb^{-1}@#sqrt{s}=8 TeV, H#rightarrow#tau#tau"); //cmsprel->AddText("CMS Preliminary, #sqrt{s}=7 TeV, L=4.9 fb^{-1}; #sqrt{s}=8 TeV, L=19.3 fb^{-1}; H#rightarrow#tau#tau"); cmsprel->SetTextSize ( 0.030 ); cmsprel->AddText("CMS Preliminary, H#rightarrow#tau#tau, 4.9 fb^{-1} at 7 TeV, 19.4 fb^{-1} at 8 TeV"); cmsprel->Draw(); }
void effAndSmallSF_DATA_MC_Cracks_pT2() { //=========Macro generated from canvas: Canvas/Canvas //========= (Mon Feb 8 17:29:37 2016) by ROOT version6.02/05 TCanvas *Canvas = new TCanvas("Canvas", "Canvas",0,0,725,725); gStyle->SetOptFit(1); gStyle->SetOptStat(0); gStyle->SetOptTitle(0); Canvas->SetHighLightColor(2); Canvas->Range(0,0,1,1); Canvas->SetFillColor(0); Canvas->SetBorderMode(0); Canvas->SetBorderSize(2); Canvas->SetTickx(1); Canvas->SetTicky(1); Canvas->SetLeftMargin(0.15); Canvas->SetRightMargin(0.05); Canvas->SetTopMargin(0.07); Canvas->SetBottomMargin(0.17); Canvas->SetFrameFillStyle(0); Canvas->SetFrameBorderMode(0); // ------------>Primitives in pad: pad1 TPad *pad1 = new TPad("pad1", "pad1",0.01,0.3,0.99,0.99); pad1->Draw(); pad1->cd(); pad1->Range(-15.32432,-0.03620689,94.13513,1.17069); pad1->SetFillColor(0); pad1->SetBorderMode(0); pad1->SetBorderSize(2); pad1->SetGridx(); pad1->SetGridy(); pad1->SetTickx(1); pad1->SetTicky(1); pad1->SetLeftMargin(0.14); pad1->SetRightMargin(0.12); pad1->SetBottomMargin(0.03); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); pad1->SetFrameFillStyle(0); pad1->SetFrameBorderMode(0); Double_t Graph0_fx3001[3] = { 13.5, 25, 55}; Double_t Graph0_fy3001[3] = { 0.9387, 0.9652, 0.9863}; Double_t Graph0_felx3001[3] = { 6.5, 5, 25}; Double_t Graph0_fely3001[3] = { 0.0034, 0.0013, 0.0003}; Double_t Graph0_fehx3001[3] = { 6.5, 5, 25}; Double_t Graph0_fehy3001[3] = { 0.0034, 0.0013, 0.0003}; TGraphAsymmErrors *grae = new TGraphAsymmErrors(3,Graph0_fx3001,Graph0_fy3001,Graph0_felx3001,Graph0_fehx3001,Graph0_fely3001,Graph0_fehy3001); grae->SetName("Graph0"); grae->SetTitle("TGraphAsymmErrors for MC efficiencies"); Int_t ci; // for color index setting TColor *color; // for color definition with alpha ci = TColor::GetColor("#99ccff"); grae->SetFillColor(ci); ci = TColor::GetColor("#3399ff"); grae->SetLineColor(ci); ci = TColor::GetColor("#3399ff"); grae->SetMarkerColor(ci); grae->SetMarkerStyle(22); grae->SetMarkerSize(0.7); TH1F *Graph_TH1F3001 = new TH1F("Graph_TH1F3001","TH1F histogram",100,0,81); Graph_TH1F3001->SetMinimum(0); Graph_TH1F3001->SetMaximum(1.05); Graph_TH1F3001->SetFillStyle(0); Graph_TH1F3001->SetLineStyle(0); Graph_TH1F3001->SetMarkerStyle(20); Graph_TH1F3001->GetXaxis()->SetLabelFont(42); Graph_TH1F3001->GetXaxis()->SetLabelOffset(0.007); Graph_TH1F3001->GetXaxis()->SetLabelSize(0); Graph_TH1F3001->GetXaxis()->SetTitleSize(0.06); Graph_TH1F3001->GetXaxis()->SetTitleFont(42); Graph_TH1F3001->GetYaxis()->SetTitle("ID efficiency"); Graph_TH1F3001->GetYaxis()->SetLabelFont(42); Graph_TH1F3001->GetYaxis()->SetLabelOffset(0.007); Graph_TH1F3001->GetYaxis()->SetLabelSize(0.05); Graph_TH1F3001->GetYaxis()->SetTitleSize(0.06); Graph_TH1F3001->GetYaxis()->SetTitleOffset(0.85); Graph_TH1F3001->GetYaxis()->SetTitleFont(42); Graph_TH1F3001->GetZaxis()->SetLabelFont(42); Graph_TH1F3001->GetZaxis()->SetLabelOffset(0.007); Graph_TH1F3001->GetZaxis()->SetLabelSize(0.05); Graph_TH1F3001->GetZaxis()->SetTitleSize(0.06); Graph_TH1F3001->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_TH1F3001); grae->Draw("a2"); Double_t Graph0_fx3002[3] = { 13.5, 25, 55}; Double_t Graph0_fy3002[3] = { 0.9387, 0.9652, 0.9863}; Double_t Graph0_felx3002[3] = { 6.5, 5, 25}; Double_t Graph0_fely3002[3] = { 0.0034, 0.0013, 0.0003}; Double_t Graph0_fehx3002[3] = { 6.5, 5, 25}; Double_t Graph0_fehy3002[3] = { 0.0034, 0.0013, 0.0003}; grae = new TGraphAsymmErrors(3,Graph0_fx3002,Graph0_fy3002,Graph0_felx3002,Graph0_fehx3002,Graph0_fely3002,Graph0_fehy3002); grae->SetName("Graph0"); grae->SetTitle("TGraphAsymmErrors for MC efficiencies"); ci = TColor::GetColor("#99ccff"); grae->SetFillColor(ci); ci = TColor::GetColor("#3399ff"); grae->SetLineColor(ci); ci = TColor::GetColor("#3399ff"); grae->SetMarkerColor(ci); grae->SetMarkerStyle(22); grae->SetMarkerSize(0.7); TH1F *Graph_Graph_TH1F30013002 = new TH1F("Graph_Graph_TH1F30013002","TH1F histogram",100,0,81); Graph_Graph_TH1F30013002->SetMinimum(0); Graph_Graph_TH1F30013002->SetMaximum(1.05); Graph_Graph_TH1F30013002->SetFillStyle(0); Graph_Graph_TH1F30013002->SetLineStyle(0); Graph_Graph_TH1F30013002->SetMarkerStyle(20); Graph_Graph_TH1F30013002->GetXaxis()->SetLabelFont(42); Graph_Graph_TH1F30013002->GetXaxis()->SetLabelOffset(0.007); Graph_Graph_TH1F30013002->GetXaxis()->SetLabelSize(0); Graph_Graph_TH1F30013002->GetXaxis()->SetTitleSize(0.06); Graph_Graph_TH1F30013002->GetXaxis()->SetTitleFont(42); Graph_Graph_TH1F30013002->GetYaxis()->SetTitle("ID efficiency"); Graph_Graph_TH1F30013002->GetYaxis()->SetLabelFont(42); Graph_Graph_TH1F30013002->GetYaxis()->SetLabelOffset(0.007); Graph_Graph_TH1F30013002->GetYaxis()->SetLabelSize(0.05); Graph_Graph_TH1F30013002->GetYaxis()->SetTitleSize(0.06); Graph_Graph_TH1F30013002->GetYaxis()->SetTitleOffset(0.85); Graph_Graph_TH1F30013002->GetYaxis()->SetTitleFont(42); Graph_Graph_TH1F30013002->GetZaxis()->SetLabelFont(42); Graph_Graph_TH1F30013002->GetZaxis()->SetLabelOffset(0.007); Graph_Graph_TH1F30013002->GetZaxis()->SetLabelSize(0.05); Graph_Graph_TH1F30013002->GetZaxis()->SetTitleSize(0.06); Graph_Graph_TH1F30013002->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_Graph_TH1F30013002); grae->Draw("p"); Double_t Graph1_fx3003[3] = { 13.5, 25, 55}; Double_t Graph1_fy3003[3] = { 0.973, 0.9563, 0.9835}; Double_t Graph1_felx3003[3] = { 6.5, 5, 25}; Double_t Graph1_fely3003[3] = { 0.004, 0.0015, 0.0009}; Double_t Graph1_fehx3003[3] = { 6.5, 5, 25}; Double_t Graph1_fehy3003[3] = { 0.004, 0.0015, 0.0009}; grae = new TGraphAsymmErrors(3,Graph1_fx3003,Graph1_fy3003,Graph1_felx3003,Graph1_fehx3003,Graph1_fely3003,Graph1_fehy3003); grae->SetName("Graph1"); grae->SetTitle("TGraphAsymmErrors for Data efficiencies"); grae->SetFillColor(1); grae->SetMarkerStyle(9); grae->SetMarkerSize(0.7); TH1F *Graph_Graph3003 = new TH1F("Graph_Graph3003","TGraphAsymmErrors for Data efficiencies",100,0,87.3); Graph_Graph3003->SetMinimum(0.95184); Graph_Graph3003->SetMaximum(0.98736); Graph_Graph3003->SetDirectory(0); Graph_Graph3003->SetStats(0); Graph_Graph3003->SetFillStyle(0); Graph_Graph3003->SetLineStyle(0); Graph_Graph3003->SetMarkerStyle(20); Graph_Graph3003->GetXaxis()->SetLabelFont(42); Graph_Graph3003->GetXaxis()->SetLabelOffset(0.007); Graph_Graph3003->GetXaxis()->SetLabelSize(0.05); Graph_Graph3003->GetXaxis()->SetTitleSize(0.06); Graph_Graph3003->GetXaxis()->SetTitleFont(42); Graph_Graph3003->GetYaxis()->SetLabelFont(42); Graph_Graph3003->GetYaxis()->SetLabelOffset(0.007); Graph_Graph3003->GetYaxis()->SetLabelSize(0.05); Graph_Graph3003->GetYaxis()->SetTitleSize(0.06); Graph_Graph3003->GetYaxis()->SetTitleOffset(0.85); Graph_Graph3003->GetYaxis()->SetTitleFont(42); Graph_Graph3003->GetZaxis()->SetLabelFont(42); Graph_Graph3003->GetZaxis()->SetLabelOffset(0.007); Graph_Graph3003->GetZaxis()->SetLabelSize(0.05); Graph_Graph3003->GetZaxis()->SetTitleSize(0.06); Graph_Graph3003->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_Graph3003); grae->Draw("p"); TLegend *leg = new TLegend(0.63,0.2,0.87,0.33,NULL,"brNDC"); leg->SetBorderSize(0); leg->SetTextFont(62); leg->SetTextSize(0.03); leg->SetLineColor(1); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); TLegendEntry *entry=leg->AddEntry("Graph1","Data","p"); entry->SetLineColor(1); entry->SetLineStyle(1); entry->SetLineWidth(1); entry->SetMarkerColor(1); entry->SetMarkerStyle(9); entry->SetMarkerSize(0.7); entry->SetTextFont(62); entry=leg->AddEntry("Graph0","Simulation","fp"); ci = TColor::GetColor("#99ccff"); entry->SetFillColor(ci); entry->SetFillStyle(1001); ci = TColor::GetColor("#3399ff"); entry->SetLineColor(ci); entry->SetLineStyle(1); entry->SetLineWidth(1); ci = TColor::GetColor("#3399ff"); entry->SetMarkerColor(ci); entry->SetMarkerStyle(22); entry->SetMarkerSize(0.7); entry->SetTextFont(62); leg->Draw(); TPaveText *pt = new TPaveText(0.14,0.94,0.89,0.99,"brNDC"); pt->SetBorderSize(0); pt->SetFillStyle(0); pt->SetTextAlign(12); pt->SetTextSize(0.03); TText *AText = pt->AddText(0.01,0.3,"CMS Preliminary"); AText = pt->AddText(0.7,0.3,"#sqrt{s} = 13 TeV, L = 2.26 fb^{-1}"); pt->Draw(); tex = new TLatex(0.67,0.4,"Z #rightarrow e^{+} e^{-}"); tex->SetNDC(); tex->SetTextSize(0.03); tex->SetLineWidth(2); tex->Draw(); tex = new TLatex(0.63,0.35," Crack probes"); tex->SetNDC(); tex->SetTextSize(0.03); tex->SetLineWidth(2); tex->Draw(); pad1->Modified(); Canvas->cd(); // ------------>Primitives in pad: pad2 TPad *pad2 = new TPad("pad2", "pad2",0.01,0.01,0.99,0.3); pad2->Draw(); pad2->cd(); pad2->Range(-15.32432,0.4915493,94.13513,1.125352); pad2->SetFillColor(0); pad2->SetBorderMode(0); pad2->SetBorderSize(2); pad2->SetGridx(); pad2->SetGridy(); pad2->SetTickx(1); pad2->SetTicky(1); pad2->SetLeftMargin(0.14); pad2->SetRightMargin(0.12); pad2->SetTopMargin(0.04); pad2->SetBottomMargin(0.25); pad2->SetFrameFillStyle(0); pad2->SetFrameBorderMode(0); pad2->SetFrameFillStyle(0); pad2->SetFrameBorderMode(0); Double_t Graph0_fx3004[3] = { 13.5, 25, 55}; Double_t Graph0_fy3004[3] = { 1.0365, 0.9908, 0.9971}; Double_t Graph0_felx3004[3] = { 6.5, 5, 25}; Double_t Graph0_fely3004[3] = { 0.009, 0.0082, 0.0016}; Double_t Graph0_fehx3004[3] = { 6.5, 5, 25}; Double_t Graph0_fehy3004[3] = { 0.009, 0.0082, 0.0016}; grae = new TGraphAsymmErrors(3,Graph0_fx3004,Graph0_fy3004,Graph0_felx3004,Graph0_fehx3004,Graph0_fely3004,Graph0_fehy3004); grae->SetName("Graph0"); grae->SetTitle("TGraphAsymmErrors for scale factors"); ci = TColor::GetColor("#99ccff"); grae->SetFillColor(ci); ci = TColor::GetColor("#3399ff"); grae->SetLineColor(ci); ci = TColor::GetColor("#3399ff"); grae->SetMarkerColor(ci); grae->SetMarkerSize(0.7); TH1F *Graph_Small TH1F3004 = new TH1F("Graph_Small TH1F3004","Small TH1F histogram",100,0,81); Graph_Small TH1F3004->SetMinimum(0.65); Graph_Small TH1F3004->SetMaximum(1.1); Graph_Small TH1F3004->SetFillStyle(0); Graph_Small TH1F3004->SetLineStyle(0); Graph_Small TH1F3004->SetMarkerStyle(20); Graph_Small TH1F3004->GetXaxis()->SetTitle("p_{T} [GeV]"); Graph_Small TH1F3004->GetXaxis()->SetLabelFont(42); Graph_Small TH1F3004->GetXaxis()->SetLabelOffset(0.007); Graph_Small TH1F3004->GetXaxis()->SetLabelSize(0.08); Graph_Small TH1F3004->GetXaxis()->SetTitleSize(0.08); Graph_Small TH1F3004->GetXaxis()->SetTitleFont(42); Graph_Small TH1F3004->GetYaxis()->SetLabelFont(42); Graph_Small TH1F3004->GetYaxis()->SetLabelOffset(0.007); Graph_Small TH1F3004->GetYaxis()->SetLabelSize(0.08); Graph_Small TH1F3004->GetYaxis()->SetTitleSize(0.08); Graph_Small TH1F3004->GetYaxis()->SetTitleOffset(0.75); Graph_Small TH1F3004->GetYaxis()->SetTitleFont(42); Graph_Small TH1F3004->GetZaxis()->SetLabelFont(42); Graph_Small TH1F3004->GetZaxis()->SetLabelOffset(0.007); Graph_Small TH1F3004->GetZaxis()->SetLabelSize(0.05); Graph_Small TH1F3004->GetZaxis()->SetTitleSize(0.06); Graph_Small TH1F3004->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_Small TH1F3004); grae->Draw("a2"); Double_t Graph0_fx3005[3] = { 13.5, 25, 55}; Double_t Graph0_fy3005[3] = { 1.0365, 0.9908, 0.9971}; Double_t Graph0_felx3005[3] = { 6.5, 5, 25}; Double_t Graph0_fely3005[3] = { 0.009, 0.0082, 0.0016}; Double_t Graph0_fehx3005[3] = { 6.5, 5, 25}; Double_t Graph0_fehy3005[3] = { 0.009, 0.0082, 0.0016}; grae = new TGraphAsymmErrors(3,Graph0_fx3005,Graph0_fy3005,Graph0_felx3005,Graph0_fehx3005,Graph0_fely3005,Graph0_fehy3005); grae->SetName("Graph0"); grae->SetTitle("TGraphAsymmErrors for scale factors"); ci = TColor::GetColor("#99ccff"); grae->SetFillColor(ci); ci = TColor::GetColor("#3399ff"); grae->SetLineColor(ci); ci = TColor::GetColor("#3399ff"); grae->SetMarkerColor(ci); grae->SetMarkerSize(0.7); TH1F *Graph_Graph_Small TH1F30043005 = new TH1F("Graph_Graph_Small TH1F30043005","Small TH1F histogram",100,0,81); Graph_Graph_Small TH1F30043005->SetMinimum(0.65); Graph_Graph_Small TH1F30043005->SetMaximum(1.1); Graph_Graph_Small TH1F30043005->SetFillStyle(0); Graph_Graph_Small TH1F30043005->SetLineStyle(0); Graph_Graph_Small TH1F30043005->SetMarkerStyle(20); Graph_Graph_Small TH1F30043005->GetXaxis()->SetTitle("p_{T} [GeV]"); Graph_Graph_Small TH1F30043005->GetXaxis()->SetLabelFont(42); Graph_Graph_Small TH1F30043005->GetXaxis()->SetLabelOffset(0.007); Graph_Graph_Small TH1F30043005->GetXaxis()->SetLabelSize(0.08); Graph_Graph_Small TH1F30043005->GetXaxis()->SetTitleSize(0.08); Graph_Graph_Small TH1F30043005->GetXaxis()->SetTitleFont(42); Graph_Graph_Small TH1F30043005->GetYaxis()->SetLabelFont(42); Graph_Graph_Small TH1F30043005->GetYaxis()->SetLabelOffset(0.007); Graph_Graph_Small TH1F30043005->GetYaxis()->SetLabelSize(0.08); Graph_Graph_Small TH1F30043005->GetYaxis()->SetTitleSize(0.08); Graph_Graph_Small TH1F30043005->GetYaxis()->SetTitleOffset(0.75); Graph_Graph_Small TH1F30043005->GetYaxis()->SetTitleFont(42); Graph_Graph_Small TH1F30043005->GetZaxis()->SetLabelFont(42); Graph_Graph_Small TH1F30043005->GetZaxis()->SetLabelOffset(0.007); Graph_Graph_Small TH1F30043005->GetZaxis()->SetLabelSize(0.05); Graph_Graph_Small TH1F30043005->GetZaxis()->SetTitleSize(0.06); Graph_Graph_Small TH1F30043005->GetZaxis()->SetTitleFont(42); grae->SetHistogram(Graph_Graph_Small TH1F30043005); grae->Draw("p"); pad2->Modified(); Canvas->cd(); Canvas->Modified(); Canvas->cd(); Canvas->SetSelected(Canvas); }
void tree() { // // This macro displays the Tree data structures //Author: Rene Brun TCanvas* c1 = new TCanvas("c1","Tree Data Structure",200,10,750,940); c1->Range(0,-0.1,1,1.15); gBenchmark->Start("tree"); Int_t branchcolor = 26; Int_t leafcolor = 30; Int_t basketcolor = 42; Int_t offsetcolor = 43; TPaveLabel* title = new TPaveLabel(.3,1.05,.8,1.13,c1->GetTitle()); title->SetFillColor(16); title->Draw(); TPaveText* treePave = new TPaveText(.01,.75,.15,1.00); treePave->SetFillColor(18); treePave->SetTextAlign(12); TText *tnt = treePave->AddText("Tree"); tnt->SetTextAlign(22); tnt->SetTextSize(0.030); treePave->AddText("fScanField"); treePave->AddText("fMaxEventLoop"); treePave->AddText("fMaxVirtualSize"); treePave->AddText("fEntries"); treePave->AddText("fDimension"); treePave->AddText("fSelectedRows"); treePave->Draw(); TPavesText* farm = new TPavesText(.01,1.02,.15,1.1,9,"tr"); TText *tfarm = farm->AddText("CHAIN"); tfarm->SetTextSize(0.024); farm->AddText("Collection"); farm->AddText("of Trees"); farm->Draw(); TLine* llink = new TLine(.15,.92,.80,.92); llink->SetLineWidth(2); llink->SetLineColor(1); llink->Draw(); llink->DrawLine(.21,.87,.21,.275); llink->DrawLine(.23,.87,.23,.375); llink->DrawLine(.25,.87,.25,.775); llink->DrawLine(.41,.25,.41,-.025); llink->DrawLine(.43,.25,.43,.075); llink->DrawLine(.45,.25,.45,.175); TPaveLabel* branch0 = new TPaveLabel(.20,.87,.35,.97,"Branch 0"); branch0->SetTextSize(0.35); branch0->SetFillColor(branchcolor); branch0->Draw(); TPaveLabel* branch1 = new TPaveLabel(.40,.87,.55,.97,"Branch 1"); branch1->SetTextSize(0.35); branch1->SetFillColor(branchcolor); branch1->Draw(); TPaveLabel* branch2 = new TPaveLabel(.60,.87,.75,.97,"Branch 2"); branch2->SetTextSize(0.35); branch2->SetFillColor(branchcolor); branch2->Draw(); TPaveLabel* branch3 = new TPaveLabel(.80,.87,.95,.97,"Branch 3"); branch3->SetTextSize(0.35); branch3->SetFillColor(branchcolor); branch3->Draw(); TPaveLabel* leaf0 = new TPaveLabel(.4,.75,.5,.8,"Leaf 0"); leaf0->SetFillColor(leafcolor); leaf0->Draw(); TPaveLabel* leaf1 = new TPaveLabel(.6,.75,.7,.8,"Leaf 1"); leaf1->SetFillColor(leafcolor); leaf1->Draw(); TPaveLabel* leaf2 = new TPaveLabel(.8,.75,.9,.8,"Leaf 2"); leaf2->SetFillColor(leafcolor); leaf2->Draw(); TPaveText* firstevent = new TPaveText(.4,.35,.9,.4); firstevent->AddText("First event of each basket"); firstevent->AddText("Array of fMaxBaskets Integers"); firstevent->SetFillColor(basketcolor); firstevent->Draw(); TPaveLabel* basket0 = new TPaveLabel(.4,.25,.5,.3,"Basket 0"); basket0->SetFillColor(basketcolor); basket0->Draw(); TPaveLabel* basket1 = new TPaveLabel(.6,.25,.7,.3,"Basket 1"); basket1->SetFillColor(basketcolor); basket1->Draw(); TPaveLabel* basket2 = new TPaveLabel(.8,.25,.9,.3,"Basket 2"); basket2->SetFillColor(basketcolor); basket2->Draw(); TPaveText* offset = new TPaveText(.55,.15,.9,.2); offset->AddText("Offset of events in fBuffer"); offset->AddText("Array of fEventOffsetLen Integers"); offset->AddText("(if variable length structure)"); offset->SetFillColor(offsetcolor); offset->Draw(); TPaveText* buffer = new TPaveText(.55,.05,.9,.1); buffer->AddText("Basket buffer"); buffer->AddText("Array of fBasketSize chars"); buffer->SetFillColor(offsetcolor); buffer->Draw(); TPaveText* zipbuffer = new TPaveText(.55,-.05,.75,.0); zipbuffer->AddText("Basket compressed buffer"); zipbuffer->AddText("(if compression)"); zipbuffer->SetFillColor(offsetcolor); zipbuffer->Draw(); TArrow* ar1 = new TArrow(); ar1->SetLineWidth(2); ar1->SetLineColor(1); ar1->SetFillStyle(1001); ar1->SetFillColor(1); ar1->DrawArrow(.21,.275,.39,.275,0.015,"|>"); ar1->DrawArrow(.23,.375,.39,.375,0.015,"|>"); ar1->DrawArrow(.25,.775,.39,.775,0.015,"|>"); ar1->DrawArrow(.50,.775,.59,.775,0.015,"|>"); ar1->DrawArrow(.70,.775,.79,.775,0.015,"|>"); ar1->DrawArrow(.50,.275,.59,.275,0.015,"|>"); ar1->DrawArrow(.70,.275,.79,.275,0.015,"|>"); ar1->DrawArrow(.45,.175,.54,.175,0.015,"|>"); ar1->DrawArrow(.43,.075,.54,.075,0.015,"|>"); ar1->DrawArrow(.41,-.025,.54,-.025,0.015,"|>"); TLine* ldot = new TLine(.95,.92,.99,.92); ldot->SetLineStyle(3); ldot->Draw(); ldot->DrawLine(.9,.775,.99,.775); ldot->DrawLine(.9,.275,.99,.275); ldot->DrawLine(.55,.05,.55,0); ldot->DrawLine(.9,.05,.75,0); TText* pname = new TText(.46,.21,"fEventOffset"); pname->SetTextFont(72); pname->SetTextSize(0.018); pname->Draw(); pname->DrawText(.44,.11,"fBuffer"); pname->DrawText(.42,.01,"fZipBuffer"); pname->DrawText(.26,.81,"fLeaves = TObjArray of TLeaf"); pname->DrawText(.24,.40,"fBasketEvent"); pname->DrawText(.22,.31,"fBaskets = TObjArray of TBasket"); pname->DrawText(.20,1.0,"fBranches = TObjArray of TBranch"); TPaveText* ntleaf = new TPaveText(0.30,.42,.62,.7); ntleaf->SetTextSize(0.014); ntleaf->SetFillColor(leafcolor); ntleaf->SetTextAlign(12); ntleaf->AddText("fLen: number of fixed elements"); ntleaf->AddText("fLenType: number of bytes of data type"); ntleaf->AddText("fOffset: relative to Leaf0-fAddress"); ntleaf->AddText("fNbytesIO: number of bytes used for I/O"); ntleaf->AddText("fIsPointer: True if pointer"); ntleaf->AddText("fIsRange: True if leaf has a range"); ntleaf->AddText("fIsUnsigned: True if unsigned"); ntleaf->AddText("*fLeafCount: points to Leaf counter"); ntleaf->AddText(" "); ntleaf->AddLine(0,0,0,0); ntleaf->AddText("fName = Leaf name"); ntleaf->AddText("fTitle = Leaf type (see Type codes)"); ntleaf->Draw(); TPaveText* type = new TPaveText(.65,.42,.95,.7); type->SetTextAlign(12); type->SetFillColor(leafcolor); type->AddText(" "); type->AddText("C : a character string"); type->AddText("B : an 8 bit signed integer"); type->AddText("b : an 8 bit unsigned integer"); type->AddText("S : a 16 bit signed short integer"); type->AddText("s : a 16 bit unsigned short integer"); type->AddText("I : a 32 bit signed integer"); type->AddText("i : a 32 bit unsigned integer"); type->AddText("F : a 32 bit floating point"); type->AddText("D : a 64 bit floating point"); type->AddText("TXXXX : a class name TXXXX"); type->Draw(); TPaveLabel* typecode = new TPaveLabel(.7,.68,.9,.72,"fType codes"); typecode->SetFillColor(leafcolor); typecode->Draw(); ldot->DrawLine(.4,.75,.30,.7); ldot->DrawLine(.5,.75,.62,.7); TPaveText* ntbasket = new TPaveText(0.02,-0.07,0.35,.25); ntbasket->SetFillColor(basketcolor); ntbasket->SetTextSize(0.014); ntbasket->SetTextAlign(12); ntbasket->AddText("fNbytes: Size of compressed Basket"); ntbasket->AddText("fObjLen: Size of uncompressed Basket"); ntbasket->AddText("fDatime: Date/Time when written to store"); ntbasket->AddText("fKeylen: Number of bytes for the key"); ntbasket->AddText("fCycle : Cycle number"); ntbasket->AddText("fSeekKey: Pointer to Basket on file"); ntbasket->AddText("fSeekPdir: Pointer to directory on file"); ntbasket->AddText("fClassName: 'TBasket'"); ntbasket->AddText("fName: Branch name"); ntbasket->AddText("fTitle: TreePave name"); ntbasket->AddText(" "); ntbasket->AddLine(0,0,0,0); ntbasket->AddText("fNevBuf: Number of events in Basket"); ntbasket->AddText("fLast: pointer to last used byte in Basket"); ntbasket->Draw(); ldot->DrawLine(.4,.3,0.02,0.25); ldot->DrawLine(.5,.25,0.35,-.07); ldot->DrawLine(.5,.3,0.35,0.25); TPaveText* ntbranch = new TPaveText(0.02,0.40,0.18,0.68); ntbranch->SetFillColor(branchcolor); ntbranch->SetTextSize(0.015); ntbranch->SetTextAlign(12); ntbranch->AddText("fBasketSize"); ntbranch->AddText("fEventOffsetLen"); ntbranch->AddText("fMaxBaskets"); ntbranch->AddText("fEntries"); ntbranch->AddText("fAddress of Leaf0"); ntbranch->AddText(" "); ntbranch->AddLine(0,0,0,0); ntbranch->AddText("fName: Branchname"); ntbranch->AddText("fTitle: leaflist"); ntbranch->Draw(); ldot->DrawLine(.2,.97,.02,.68); ldot->DrawLine(.35,.97,.18,.68); ldot->DrawLine(.35,.87,.18,.40); TPavesText* basketstore = new TPavesText(.8,-0.088,0.952,-0.0035,7,"tr"); basketstore->SetFillColor(28); basketstore->AddText("Baskets"); basketstore->AddText("Stores"); basketstore->Draw(); c1->Update(); gBenchmark->Show("treePave"); }
void HTT_MT_X(bool scaled=true, bool log=true, float min=0.1, float max=-1., const char* inputfile="root/$HISTFILE", const char* directory="muTau_$CATEGORY") { // defining the common canvas, axes pad styles SetStyle(); gStyle->SetLineStyleString(11,"20 10"); // determine category tag const char* category_extra = ""; if(std::string(directory) == std::string("muTau_0jet_low" )){ category_extra = "0 jet, low p_{T}"; } if(std::string(directory) == std::string("muTau_0jet_high" )){ category_extra = "0 jet, high p_{T}"; } if(std::string(directory) == std::string("muTau_boost_low" )){ category_extra = "1 jet, low p_{T}"; } if(std::string(directory) == std::string("muTau_boost_high")){ category_extra = "1 jet, high p_{T}"; } if(std::string(directory) == std::string("muTau_vbf" )){ category_extra = "2 jet (VBF)"; } if(std::string(directory) == std::string("muTau_nobtag" )){ category_extra = "No B-Tag"; } if(std::string(directory) == std::string("muTau_btag" )){ category_extra = "B-Tag"; } const char* dataset; if(std::string(inputfile).find("7TeV")!=std::string::npos){dataset = "CMS Preliminary, H#rightarrow#tau#tau, 4.9 fb^{-1} at 7 TeV";} if(std::string(inputfile).find("8TeV")!=std::string::npos){dataset = "CMS Preliminary, H#rightarrow#tau#tau, 19.4 fb^{-1} at 8 TeV";} #ifdef MSSM if(std::string(inputfile).find("8TeV")!=std::string::npos){dataset = "CMS Preliminary, H#rightarrow#tau#tau, 12.1 fb^{-1} at 8 TeV";} #endif // open example histogram file TFile* input = new TFile(inputfile); TH1F* Fakes = refill((TH1F*)input->Get(TString::Format("%s/QCD" , directory)), "QCD"); InitHist(Fakes, "", "", kMagenta-10, 1001); TH1F* EWK1 = refill((TH1F*)input->Get(TString::Format("%s/W" , directory)), "W" ); InitHist(EWK1 , "", "", kRed + 2, 1001); #ifdef EXTRA_SAMPLES TH1F* EWK2 = refill((TH1F*)input->Get(TString::Format("%s/ZJ" , directory)), "ZJ" ); InitHist(EWK2 , "", "", kRed + 2, 1001); TH1F* EWK3 = refill((TH1F*)input->Get(TString::Format("%s/ZL" , directory)), "ZL" ); InitHist(EWK3 , "", "", kRed + 2, 1001); #else TH1F* EWK2 = refill((TH1F*)input->Get(TString::Format("%s/ZLL" , directory)), "ZLL"); InitHist(EWK2 , "", "", kRed + 2, 1001); #endif TH1F* EWK = refill((TH1F*)input->Get(TString::Format("%s/VV" , directory)), "VV" ); InitHist(EWK , "", "", kRed + 2, 1001); TH1F* ttbar = refill((TH1F*)input->Get(TString::Format("%s/TT" , directory)), "TT" ); InitHist(ttbar, "", "", kBlue - 8, 1001); TH1F* Ztt = refill((TH1F*)input->Get(TString::Format("%s/ZTT" , directory)), "ZTT"); InitHist(Ztt , "", "", kOrange - 4, 1001); #ifdef MSSM float ggHScale = 1., bbHScale = 1.; // scenario for MSSM, mhmax, mA=160, tanb=20, A + H for the time being if(std::string(inputfile).find("7TeV")!=std::string::npos){ ggHScale = ( 9157.9*0.119 + 10180.7*0.120)/1000.; bbHScale = (23314.3*0.119 + 21999.3*0.120)/1000.; } if(std::string(inputfile).find("8TeV")!=std::string::npos){ ggHScale = (11815.3*0.119 + 13124.9*0.120)/1000.; bbHScale = (31087.9*0.119 + 29317.8*0.120)/1000.; } // float ggHScale = 1., bbHScale = 1.; // scenario for MSSM, mhmax, mA=160, tanb=10, A + H for the time being // if(std::string(inputfile).find("7TeV")!=std::string::npos){ ggHScale = (2111.4*0.11 + 4022.9*0.11)/1000.; // bbHScale = (6211.6*0.11 + 5147.0*0.11)/1000.; } // if(std::string(inputfile).find("8TeV")!=std::string::npos){ ggHScale = (2729.9*0.11 + 5193.2*0.11)/1000.; // bbHScale = (8282.7*0.11 + 6867.8*0.11)/1000.; } TH1F* ggH = refill((TH1F*)input->Get(TString::Format("%s/ggH160", directory)), "ggH"); InitSignal(ggH); ggH ->Scale(ggHScale); TH1F* bbH = refill((TH1F*)input->Get(TString::Format("%s/bbH160", directory)), "bbH"); InitSignal(bbH); bbH ->Scale(bbHScale); #else #ifndef DROP_SIGNAL TH1F* ggH = refill((TH1F*)input->Get(TString::Format("%s/ggH125", directory)), "ggH"); InitSignal(ggH); ggH ->Scale(SIGNAL_SCALE); TH1F* qqH = refill((TH1F*)input->Get(TString::Format("%s/qqH125", directory)), "qqH"); InitSignal(qqH); qqH ->Scale(SIGNAL_SCALE); TH1F* VH = refill((TH1F*)input->Get(TString::Format("%s/VH125" , directory)), "VH" ); InitSignal(VH ); VH ->Scale(SIGNAL_SCALE); #endif #endif TH1F* data = refill((TH1F*)input->Get(TString::Format("%s/data_obs", directory)), "data", true); InitHist(data, "#bf{m_{#tau#tau} [GeV]}", "#bf{dN/dm_{#tau#tau} [1/GeV]}"); InitData(data); TH1F* ref=(TH1F*)Fakes->Clone("ref"); ref->Add(EWK1 ); ref->Add(EWK2 ); #ifdef EXTRA_SAMPLES ref->Add(EWK3 ); #endif ref->Add(EWK ); ref->Add(ttbar); ref->Add(Ztt ); double unscaled[7]; unscaled[0] = Fakes->Integral(); unscaled[1] = EWK ->Integral(); unscaled[1]+= EWK1 ->Integral(); unscaled[1]+= EWK2 ->Integral(); #ifdef EXTRA_SAMPLES unscaled[1]+= EWK3 ->Integral(); #endif unscaled[2] = ttbar->Integral(); unscaled[3] = Ztt ->Integral(); #ifdef MSSM unscaled[4] = ggH ->Integral(); unscaled[5] = bbH ->Integral(); unscaled[6] = 0; #else #ifndef DROP_SIGNAL unscaled[4] = ggH ->Integral(); unscaled[5] = qqH ->Integral(); unscaled[6] = VH ->Integral(); #endif #endif if(scaled){ rescale(Fakes, 7); rescale(EWK1 , 3); rescale(EWK2 , 4); #ifdef EXTRA_SAMPLES rescale(EWK3 , 5); #endif rescale(EWK , 6); rescale(ttbar, 2); rescale(Ztt , 1); #ifdef MSSM rescale(ggH , 8); rescale(bbH , 9); #else #ifndef DROP_SIGNAL rescale(ggH , 8); rescale(qqH , 9); rescale(VH ,10); #endif #endif } TH1F* scales[7]; scales[0] = new TH1F("scales-Fakes", "", 7, 0, 7); scales[0]->SetBinContent(1, unscaled[0]>0 ? (Fakes->Integral()/unscaled[0]-1.) : 0.); scales[1] = new TH1F("scales-EWK" , "", 7, 0, 7); scales[1]->SetBinContent(2, unscaled[1]>0 ? ((EWK ->Integral() +EWK1 ->Integral() +EWK2 ->Integral() #ifdef EXTRA_SAMPLES +EWK3 ->Integral() #endif )/unscaled[1]-1.) : 0.); scales[2] = new TH1F("scales-ttbar", "", 7, 0, 7); scales[2]->SetBinContent(3, unscaled[2]>0 ? (ttbar->Integral()/unscaled[2]-1.) : 0.); scales[3] = new TH1F("scales-Ztt" , "", 7, 0, 7); scales[3]->SetBinContent(4, unscaled[3]>0 ? (Ztt ->Integral()/unscaled[3]-1.) : 0.); #ifdef MSSM scales[4] = new TH1F("scales-ggH" , "", 7, 0, 7); scales[4]->SetBinContent(5, unscaled[4]>0 ? (ggH ->Integral()/unscaled[4]-1.) : 0.); scales[5] = new TH1F("scales-bbH" , "", 7, 0, 7); scales[5]->SetBinContent(6, unscaled[5]>0 ? (bbH ->Integral()/unscaled[5]-1.) : 0.); scales[6] = new TH1F("scales-NONE" , "", 7, 0, 7); scales[6]->SetBinContent(7, 0.); #else #ifndef DROP_SIGNAL scales[4] = new TH1F("scales-ggH" , "", 7, 0, 7); scales[4]->SetBinContent(5, unscaled[4]>0 ? (ggH ->Integral()/unscaled[4]-1.) : 0.); scales[5] = new TH1F("scales-qqH" , "", 7, 0, 7); scales[5]->SetBinContent(6, unscaled[5]>0 ? (qqH ->Integral()/unscaled[5]-1.) : 0.); scales[6] = new TH1F("scales-VH" , "", 7, 0, 7); scales[6]->SetBinContent(7, unscaled[6]>0 ? (VH ->Integral()/unscaled[6]-1.) : 0.); #endif #endif EWK1 ->Add(Fakes); EWK2 ->Add(EWK1 ); #ifdef EXTRA_SAMPLES EWK3 ->Add(EWK2 ); EWK ->Add(EWK3 ); #else EWK ->Add(EWK2 ); #endif ttbar->Add(EWK ); Ztt ->Add(ttbar); if(log){ #ifdef MSSM ggH ->Add(bbH); #else #ifndef DROP_SIGNAL qqH ->Add(VH ); ggH ->Add(qqH); #endif #endif } else{ #ifdef MSSM bbH ->Add(Ztt); ggH ->Add(bbH); #else #ifndef DROP_SIGNAL VH ->Add(Ztt); qqH ->Add(VH ); ggH ->Add(qqH); #endif #endif } /* Mass plot before and after fit */ TCanvas *canv = MakeCanvas("canv", "histograms", 600, 600); canv->cd(); if(log){ canv->SetLogy(1); } #if defined MSSM if(!log){ data->GetXaxis()->SetRange(0, data->FindBin(350)); } else{ data->GetXaxis()->SetRange(0, data->FindBin(1000)); }; #else data->GetXaxis()->SetRange(0, data->FindBin(350)); #endif data->SetNdivisions(505); data->SetMinimum(min); data->SetMaximum(max>0 ? max : std::max(maximum(data, log), maximum(Ztt, log))); data->Draw("e"); TH1F* errorBand = (TH1F*)Ztt ->Clone(); errorBand ->SetMarkerSize(0); errorBand ->SetFillColor(1); errorBand ->SetFillStyle(3013); errorBand ->SetLineWidth(1); for(int idx=0; idx<errorBand->GetNbinsX(); ++idx){ if(errorBand->GetBinContent(idx)>0){ std::cout << "Uncertainties on summed background samples: " << errorBand->GetBinError(idx)/errorBand->GetBinContent(idx) << std::endl; break; } } if(log){ Ztt ->Draw("histsame"); ttbar->Draw("histsame"); EWK ->Draw("histsame"); Fakes->Draw("histsame"); $DRAW_ERROR #ifndef DROP_SIGNAL ggH ->Draw("histsame"); #endif } else{ #ifndef DROP_SIGNAL ggH ->Draw("histsame"); #endif Ztt ->Draw("histsame"); ttbar->Draw("histsame"); EWK ->Draw("histsame"); Fakes->Draw("histsame"); $DRAW_ERROR } data->Draw("esame"); canv->RedrawAxis(); //CMSPrelim(dataset, "#tau_{#mu}#tau_{h}", 0.17, 0.835); CMSPrelim(dataset, "", 0.16, 0.835); TPaveText* chan = new TPaveText(0.20, 0.74+0.061, 0.32, 0.74+0.161, "NDC"); chan->SetBorderSize( 0 ); chan->SetFillStyle( 0 ); chan->SetTextAlign( 12 ); chan->SetTextSize ( 0.05 ); chan->SetTextColor( 1 ); chan->SetTextFont ( 62 ); chan->AddText("#mu#tau_{h}"); chan->Draw(); TPaveText* cat = new TPaveText(0.20, 0.68+0.061, 0.32, 0.68+0.161, "NDC"); cat->SetBorderSize( 0 ); cat->SetFillStyle( 0 ); cat->SetTextAlign( 12 ); cat->SetTextSize ( 0.05 ); cat->SetTextColor( 1 ); cat->SetTextFont ( 62 ); cat->AddText(category_extra); cat->Draw(); #ifdef MSSM TPaveText* massA = new TPaveText(0.75, 0.48+0.061, 0.85, 0.48+0.161, "NDC"); massA->SetBorderSize( 0 ); massA->SetFillStyle( 0 ); massA->SetTextAlign( 12 ); massA->SetTextSize ( 0.03 ); massA->SetTextColor( 1 ); massA->SetTextFont ( 62 ); massA->AddText("m_{A}=160GeV"); massA->Draw(); TPaveText* tanb = new TPaveText(0.75, 0.44+0.061, 0.85, 0.44+0.161, "NDC"); tanb->SetBorderSize( 0 ); tanb->SetFillStyle( 0 ); tanb->SetTextAlign( 12 ); tanb->SetTextSize ( 0.03 ); tanb->SetTextColor( 1 ); tanb->SetTextFont ( 62 ); tanb->AddText("tan#beta=20"); tanb->Draw(); TPaveText* scen = new TPaveText(0.75, 0.40+0.061, 0.85, 0.40+0.161, "NDC"); scen->SetBorderSize( 0 ); scen->SetFillStyle( 0 ); scen->SetTextAlign( 12 ); scen->SetTextSize ( 0.03 ); scen->SetTextColor( 1 ); scen->SetTextFont ( 62 ); scen->AddText("mhmax"); scen->Draw(); #endif #ifdef MSSM TLegend* leg = new TLegend(0.45, 0.65, 0.95, 0.90); SetLegendStyle(leg); leg->AddEntry(ggH , "#phi#rightarrow#tau#tau" , "L" ); #else TLegend* leg = new TLegend(0.50, 0.65, 0.95, 0.90); SetLegendStyle(leg); #ifndef DROP_SIGNAL if(SIGNAL_SCALE!=1){ leg->AddEntry(ggH , TString::Format("%.0f#timesH(125 GeV)#rightarrow#tau#tau", SIGNAL_SCALE) , "L" ); } else{ leg->AddEntry(ggH , "H(125 GeV)#rightarrow#tau#tau" , "L" ); } #endif #endif leg->AddEntry(data , "observed" , "LP"); leg->AddEntry(Ztt , "Z#rightarrow#tau#tau" , "F" ); leg->AddEntry(ttbar, "t#bar{t}" , "F" ); leg->AddEntry(EWK , "electroweak" , "F" ); leg->AddEntry(Fakes, "QCD" , "F" ); $ERROR_LEGEND leg->Draw(); //#ifdef MSSM // TPaveText* mssm = new TPaveText(0.69, 0.85, 0.90, 0.90, "NDC"); // mssm->SetBorderSize( 0 ); // mssm->SetFillStyle( 0 ); // mssm->SetTextAlign( 12 ); // mssm->SetTextSize ( 0.03 ); // mssm->SetTextColor( 1 ); // mssm->SetTextFont ( 62 ); // mssm->AddText("(m_{A}=120, tan#beta=10)"); // mssm->Draw(); //#else // TPaveText* mssm = new TPaveText(0.83, 0.85, 0.95, 0.90, "NDC"); // mssm->SetBorderSize( 0 ); // mssm->SetFillStyle( 0 ); // mssm->SetTextAlign( 12 ); // mssm->SetTextSize ( 0.03 ); // mssm->SetTextColor( 1 ); // mssm->SetTextFont ( 62 ); // mssm->AddText("m_{H}=125"); // mssm->Draw(); //#endif /* Ratio Data over MC */ TCanvas *canv0 = MakeCanvas("canv0", "histograms", 600, 400); canv0->SetGridx(); canv0->SetGridy(); canv0->cd(); TH1F* zero = (TH1F*)ref->Clone("zero"); zero->Clear(); TH1F* rat1 = (TH1F*)data->Clone("rat"); rat1->Divide(Ztt); for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){ if(rat1->GetBinContent(ibin+1)>0){ // catch cases of 0 bins, which would lead to 0-alpha*0-1 rat1->SetBinContent(ibin+1, rat1->GetBinContent(ibin+1)-1.); } zero->SetBinContent(ibin+1, 0.); } rat1->SetLineColor(kBlack); rat1->SetFillColor(kGray ); rat1->SetMaximum(+0.5); rat1->SetMinimum(-0.5); rat1->GetYaxis()->CenterTitle(); rat1->GetYaxis()->SetTitle("#bf{Data/MC-1}"); rat1->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}"); rat1->Draw(); zero->SetLineColor(kBlack); zero->Draw("same"); canv0->RedrawAxis(); /* Ratio After fit over Prefit */ TCanvas *canv1 = MakeCanvas("canv1", "histograms", 600, 400); canv1->SetGridx(); canv1->SetGridy(); canv1->cd(); TH1F* rat2 = (TH1F*) Ztt->Clone("rat2"); rat2->Divide(ref); for(int ibin=0; ibin<rat2->GetNbinsX(); ++ibin){ if(rat2->GetBinContent(ibin+1)>0){ // catch cases of 0 bins, which would lead to 0-alpha*0-1 rat2 ->SetBinContent(ibin+1, rat2->GetBinContent(ibin+1)-1.); } } rat2->SetLineColor(kRed+ 3); rat2->SetFillColor(kRed-10); rat2->SetMaximum(+0.3); rat2->SetMinimum(-0.3); rat2->GetYaxis()->SetTitle("#bf{Fit/Prefit-1}"); rat2->GetYaxis()->CenterTitle(); rat2->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}"); rat2->Draw(); zero->SetLineColor(kBlack); zero->Draw("same"); canv1->RedrawAxis(); /* Relative shift per sample */ TCanvas *canv2 = MakeCanvas("canv2", "histograms", 600, 400); canv2->SetGridx(); canv2->SetGridy(); canv2->cd(); InitHist (scales[0], "", "", kMagenta-10, 1001); InitHist (scales[1], "", "", kRed + 2, 1001); InitHist (scales[2], "", "", kBlue - 8, 1001); InitHist (scales[3], "", "", kOrange - 4, 1001); #ifndef DROP_SIGNAL InitSignal(scales[4]); InitSignal(scales[5]); InitSignal(scales[6]); #endif scales[0]->Draw(); scales[0]->GetXaxis()->SetBinLabel(1, "#bf{Fakes}"); scales[0]->GetXaxis()->SetBinLabel(2, "#bf{EWK}" ); scales[0]->GetXaxis()->SetBinLabel(3, "#bf{ttbar}"); scales[0]->GetXaxis()->SetBinLabel(4, "#bf{Ztt}" ); #ifdef MSSM scales[0]->GetXaxis()->SetBinLabel(5, "#bf{ggH}" ); scales[0]->GetXaxis()->SetBinLabel(6, "#bf{bbH}" ); scales[0]->GetXaxis()->SetBinLabel(7, "NONE" ); #else scales[0]->GetXaxis()->SetBinLabel(5, "#bf{ggH}" ); scales[0]->GetXaxis()->SetBinLabel(6, "#bf{qqH}" ); scales[0]->GetXaxis()->SetBinLabel(7, "#bf{VH}" ); #endif scales[0]->SetMaximum(+1.0); scales[0]->SetMinimum(-1.0); scales[0]->GetYaxis()->CenterTitle(); scales[0]->GetYaxis()->SetTitle("#bf{Fit/Prefit-1}"); scales[1]->Draw("same"); scales[2]->Draw("same"); scales[3]->Draw("same"); #ifndef DROP_SIGNAL scales[4]->Draw("same"); scales[5]->Draw("same"); scales[6]->Draw("same"); #endif zero->Draw("same"); canv2->RedrawAxis(); /* prepare output */ bool isSevenTeV = std::string(inputfile).find("7TeV")!=std::string::npos; canv ->Print(TString::Format("%s_%sscaled_%s_%s.png" , directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv ->Print(TString::Format("%s_%sscaled_%s_%s.pdf" , directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv ->Print(TString::Format("%s_%sscaled_%s_%s.eps" , directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv0->Print(TString::Format("%s_datamc_%sscaled_%s_%s.png", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv0->Print(TString::Format("%s_datamc_%sscaled_%s_%s.pdf", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv0->Print(TString::Format("%s_datamc_%sscaled_%s_%s.eps", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv1->Print(TString::Format("%s_prefit_%sscaled_%s_%s.png", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv1->Print(TString::Format("%s_prefit_%sscaled_%s_%s.pdf", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv1->Print(TString::Format("%s_prefit_%sscaled_%s_%s.eps", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv2->Print(TString::Format("%s_sample_%sscaled_%s_%s.png", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv2->Print(TString::Format("%s_sample_%sscaled_%s_%s.pdf", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv2->Print(TString::Format("%s_sample_%sscaled_%s_%s.eps", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); TFile* output = new TFile(TString::Format("%s_%sscaled_%s_%s.root", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : ""), "update"); output->cd(); data ->Write("data_obs"); Fakes->Write("Fakes" ); EWK ->Write("EWK" ); ttbar->Write("ttbar" ); Ztt ->Write("Ztt" ); #ifdef MSSM ggH ->Write("ggH" ); bbH ->Write("bbH" ); #else #ifndef DROP_SIGNAL ggH ->Write("ggH" ); qqH ->Write("qqH" ); VH ->Write("VH" ); #endif #endif if(errorBand){ errorBand->Write("errorBand"); } output->Close(); }
void plotRegrVsNoRegr(int channel, int massBin) { stringstream filenom, filenoregr; filenom << "m4lplots/nominal/fitM" << massBin << "_channel" << channel << ".root"; filenoregr << "m4lplots/noregr/fitM" << massBin << "_channel" << channel << ".root"; int col; if(channel==0) col=kOrange+7; if(channel==1) col=kAzure+2; if(channel==2) col=kGreen+3; TCanvas *c1 = new TCanvas("c1","c1",750,750); TFile *tfilenom = TFile::Open(filenom.str().c_str()); RooPlot *plotnom = (RooPlot*)tfilenom->Get("m4lplot"); plotnom->SetMarkerStyle(kOpenSquare); plotnom->Draw(); TPaveText *pavenom = (TPaveText*)tfilenom->Get("TPave"); pavenom->SetTextColor(col); pavenom->Draw("same"); TFile *tfilenoregr = TFile::Open(filenoregr.str().c_str()); RooPlot *plotnoregr = (RooPlot*)tfilenoregr->Get("m4lplot"); plotnoregr->Draw("same"); TPaveText *pavenoregr = (TPaveText*)tfilenoregr->Get("TPave"); pavenoregr->Draw("same"); // cosmetics TLegend *legend = new TLegend(0.20,0.45,0.45,0.60,NULL,"brNDC"); legend->SetBorderSize( 0); legend->SetFillColor ( 0); legend->SetTextAlign ( 12); legend->SetTextFont ( 42); legend->SetTextSize (0.03); TH1F *dummyPointsNom = new TH1F("dummyPNom","dummyPNom",1,0,1); TH1F *dummyPointsNoRegr = new TH1F("dummyPNoregr","dummyPNoregr",1,0,1); TH1F *dummyLine = new TH1F("dummyL","dummyL",1,0,1); dummyPointsNoRegr->SetMarkerStyle(kFullCircle); dummyPointsNoRegr->SetMarkerSize(1.1); dummyPointsNom->SetMarkerStyle(kFullSquare); dummyPointsNom->SetMarkerColor(col); dummyPointsNom->SetLineColor(col); dummyPointsNom->SetMarkerSize(1.1); dummyLine->SetLineColor(col); legend->AddEntry(dummyPointsNoRegr, "Simulation (E_{std}-p comb.)", "pel"); legend->AddEntry(dummyPointsNom, "Simulation (E_{regr}-p comb.)", "pel"); legend->Draw(); TPaveText *text = new TPaveText(0.15,0.90,0.77,0.98,"brNDC"); text->AddText("CMS Simulation"); text->SetBorderSize(0); text->SetFillStyle(0); text->SetTextAlign(12); text->SetTextFont(42); text->SetTextSize(0.03); text->Draw(); stringstream frameTitle; if(channel==0){frameTitle << "4#mu, m_{H} = ";} if(channel==1){frameTitle << "4e, m_{H} = ";} if(channel==2){frameTitle << "2e2#mu, m_{H} = ";} frameTitle << massBin << " GeV"; TPaveText *titlet = new TPaveText(0.15,0.80,0.60,0.85,"brNDC"); titlet->AddText(frameTitle.str().c_str()); titlet->SetBorderSize(0); titlet->SetFillStyle(0); titlet->SetTextAlign(12); titlet->SetTextFont(132); titlet->SetTextSize(0.045); titlet->Draw(); c1->SaveAs("comp.pdf"); }
void fitSignalShapeW(int massBin,int id, int channels,int categ, int sample, /* float lumi, bool doSfLepton, */double rangeLow, double rangeHigh, double bwSigma, double fitValues[9], double fitErrors[9], double covQual[1]){ // ------ root settings --------- gROOT->Reset(); gROOT->SetStyle("Plain"); gStyle->SetPadGridX(kFALSE); gStyle->SetPadGridY(kFALSE); //gStyle->SetOptStat("kKsSiourRmMen"); gStyle->SetOptStat("iourme"); //gStyle->SetOptStat("rme"); //gStyle->SetOptStat(""); gStyle->SetOptFit(11); gStyle->SetPadLeftMargin(0.14); gStyle->SetPadRightMargin(0.06); // ------------------------------ ROOT::Math::MinimizerOptions::SetDefaultTolerance( 1.E-7); stringstream FileName; //Insert the file here if(sample==1) FileName <<"root://lxcms03//data3/Higgs/150915/ZH125/ZZ4lAnalysis.root" ; else if(sample==2) FileName << "root://lxcms03//data3/Higgs/150915/WplusH125/ZZ4lAnalysis.root"; else if(sample==3) FileName << "root://lxcms03//data3/Higgs/150915/WminusH125/ZZ4lAnalysis.root"; else if(sample==4) FileName << "root://lxcms03//data3/Higgs/150915/ttH125/ZZ4lAnalysis.root"; else { cout << "Wrong sample." << endl; return; } cout << "Using " << FileName.str() << endl; TFile* ggFile = TFile::Open(FileName.str().c_str()); TTree* ggTree = (TTree*) ggFile->Get("ZZTree/candTree"); float m4l; Short_t z1flav, z2flav; float weight; Short_t nExtraLeptons; float ZZPt; Short_t nJets; Short_t nBTaggedJets; std::vector<float> * jetpt = 0; std::vector<float> * jeteta = 0; std::vector<float> * jetphi = 0; std::vector<float> * jetmass = 0; float jet30pt[10]; float jet30eta[10]; float jet30phi[10]; float jet30mass[10]; float Fisher; int nentries = ggTree->GetEntries(); //--- ggTree part ggTree->SetBranchAddress("ZZMass",&m4l); ggTree->SetBranchAddress("Z1Flav",&z1flav); ggTree->SetBranchAddress("Z2Flav",&z2flav); ggTree->SetBranchAddress("genHEPMCweight",&weight); ggTree->SetBranchAddress("nExtraLep",&nExtraLeptons); ggTree->SetBranchAddress("nCleanedJets",&nJets); ggTree->SetBranchAddress("nCleanedJetsPt30BTagged",&nBTaggedJets); ggTree->SetBranchAddress("DiJetFisher",&Fisher); ggTree->SetBranchAddress("JetPt",&jetpt); ggTree->SetBranchAddress("JetEta",&jeteta); ggTree->SetBranchAddress("JetPhi",&jetphi); ggTree->SetBranchAddress("JetMass",&jetmass); ggTree->SetBranchAddress("ZZPt",&ZZPt); //--- rooFit part double xMin,xMax,xInit; xInit = (double) massBin; xMin = rangeLow; xMax = rangeHigh ; cout << "Fit range: [" << xMin << " , " << xMax << "]. Init value = " << xInit << endl; TH1F *hmass = new TH1F("hmass","hmass",200,xMin,xMax); //--------- RooRealVar x("mass","m_{4l}",xInit,xMin,xMax,"GeV"); RooRealVar w("myW","myW",1.0,0.,1000.); RooArgSet ntupleVarSet(x,w); RooDataSet dataset("mass4l","mass4l",ntupleVarSet,WeightVar("myW")); for(int k=0; k<nentries; k++){ ggTree->GetEvent(k); int njet30 = 0; for (unsigned int ijet = 0; ijet < jetpt->size(); ijet++) { if ( (*jetpt)[ijet] > 30. ) { jet30pt[njet30] = (*jetpt)[ijet]; jet30eta[njet30] = (*jeteta)[ijet]; jet30phi[njet30] = (*jetphi)[ijet]; jet30mass[njet30] = (*jetmass)[ijet]; njet30++; } } int Cat = category(nExtraLeptons, ZZPt, m4l, njet30, nBTaggedJets, jet30pt, jet30eta, jet30phi,jet30mass, Fisher); if (categ >= 0 && categ != Cat ) continue; if(channels==0 && z1flav*z2flav != 28561) continue; if(channels==1 && z1flav*z2flav != 14641) continue; if (weight <= 0 ) cout << "Warning! Negative weight events" << endl; if(channels==2 && z1flav*z2flav != 20449) continue; ntupleVarSet.setRealValue("mass",m4l); ntupleVarSet.setRealValue("myW",weight); if(x.getVal()>xMin && x.getVal()<xMax) dataset.add(ntupleVarSet, weight); hmass->Fill(m4l); } //--------- cout << "dataset n entries: " << dataset.sumEntries() << endl; TCanvas *c1 = new TCanvas("c1","c1",725,725); c1->cd(); TPad *pad1 = new TPad("pad1","This is pad1",0.05,0.35,0.95,0.97); pad1->Draw(); TPad *pad2 = new TPad("pad2","This is pad2",0.05,0.02,0.95,0.35); pad2->Draw(); //--- double CrystalBall RooRealVar mean("bias","mean of gaussian",0,-5.,5.) ; RooRealVar sigma("sigma","width of gaussian",1.5,0.,30.); RooRealVar a1("a1","a1",1.46,0.5,5.); RooRealVar n1("n1","n1",1.92,0.,10.); RooRealVar a2("a2","a2",1.46,1.,10.); RooRealVar n2("n2","n2",20,1.,50.); RooDoubleCB DCBall("DCBall","Double Crystal ball",x,mean,sigma,a1,n1,a2,n2); if (channels== 1) mean.setVal(-1.); //--- Breit-Wigner float bwSigmaMax,bwSigmaMin; if(massBin<400) bwSigmaMin=bwSigmaMax=bwSigma; else { bwSigmaMin=bwSigma-20.; bwSigmaMax=bwSigma+20.; } RooRealVar mean3("mean3","mean3",xInit) ; RooRealVar sigma3("sigma3","width3",bwSigma,bwSigmaMin,bwSigmaMax); RooRealVar scale3("scale3","scale3 ",1.); RooRelBWUFParam bw("bw","bw",x,mean3,scale3); //Chebyshev-Polynomial RooRealVar A1("A1","A1",-1,-3,3.); RooRealVar A2("A2","A2",0.5,-3.,3.); RooChebychev BkgPDF("BkgPDF","BkgPDF",x ,RooArgList(A1,A2)); //Fraction RooRealVar frac("frac","Fraction for PDF",0.5,0.,1.); x.setBins(10000,"fft"); RooFFTConvPdf model("model","model",x,bw,DCBall); RooAddPdf totPDF("totPDF","Total PDF ",RooArgList(model,BkgPDF),RooArgList(frac)); RooArgSet* params = totPDF.getParameters(x); if(sample!=1 && categ!=0 && id!=125){ if(channels==0 ){params->readFromFile("Ch0_Cat0_paraT.txt");}// Read the Parameter for the Resonance + Bkg(ChebyChev) if(channels==1 ){params->readFromFile("Ch1_Cat0_paraT.txt");}// Read the Parameter for the Resonance + Bkg(ChebyChev) if(channels==2 ){params->readFromFile("Ch2_Cat0_paraT.txt");}// Read the Parameter for the Resonance + Bkg(ChebyChev) } RooFitResult *fitres = (RooFitResult*)totPDF.fitTo(dataset,SumW2Error(1),Range(xMin,xMax),Strategy(2),NumCPU(8),Save(true)); if (sample==1 && categ==0 && id==125){ mean.setConstant(kTRUE); sigma.setConstant(kTRUE); a1.setConstant(kTRUE); n1.setConstant(kTRUE); a2.setConstant(kTRUE); n2.setConstant(kTRUE); mean3.setConstant(kTRUE); sigma3.setConstant(kTRUE); scale3.setConstant(kTRUE); A1.setConstant(kTRUE); A2.setConstant(kTRUE); frac.setConstant(kTRUE); if(channels==0 ){ params->readFromFile("Ch0_Cat0_para.txt"); // Read the Parameter for the Resonance as ggH sample params->writeToFile("Ch0_Cat0_paraT.txt");} // Writing the Parameter for Full PDF including the Chebyshev-Polynomial if(channels==1 ) {params->readFromFile("Ch1_Cat0_para.txt"); // Read the Parameter for the Resonance as in ggH sample params->writeToFile("Ch1_Cat0_paraT.txt");}// Writing the Parameter for Full PDF including the Chebyshev-Polynomial if(channels==2 ){ params->readFromFile("Ch2_Cat0_para.txt"); // Read the Parameter for the Resonance as ggH sample params->writeToFile("Ch2_Cat0_paraT.txt");}// Writing the Parameter for Full PDF including the Chebyshev-Polynomial } stringstream frameTitle; if(channels==0){frameTitle << "4#mu, m_{H} = "; } if(channels==1){frameTitle << "4e, m_{H} = ";} if(channels==2){frameTitle << "2e2#mu, m_{H} = ";} frameTitle << massBin << " GeV"; stringstream nameFileRoot; nameFileRoot << "fitM" << massBin << ".root"; TFile *fileplot = TFile::Open(nameFileRoot.str().c_str(), "recreate"); RooPlot* xframe = x.frame() ; xframe->SetTitle(""); xframe->SetName("m4lplot"); dataset.plotOn(xframe,DataError(RooAbsData::SumW2), MarkerStyle(kOpenCircle), MarkerSize(1.1) ); int col; if(channels==0) col=kOrange+7; if(channels==1) col=kAzure+2; if(channels==2) col=kGreen+3; totPDF.plotOn(xframe,LineColor(col)); RooHist* hpull = xframe->pullHist(); RooPlot* frame3 = x.frame(Title("Pull Distribution")) ; frame3->addPlotable(hpull,"P"); // cosmetics TLegend *legend = new TLegend(0.20,0.45,0.45,0.60,NULL,"brNDC"); legend->SetBorderSize(0); legend->SetFillColor(0); legend->SetTextAlign(12); legend->SetTextFont (42); legend->SetTextSize (0.03); TH1F *dummyPoints = new TH1F("dummyP","dummyP",1,0,1); TH1F *dummyLine = new TH1F("dummyL","dummyL",1,0,1); dummyPoints->SetMarkerStyle(kOpenCircle); dummyPoints->SetMarkerSize(1.1); dummyLine->SetLineColor(col); legend->AddEntry(dummyPoints, "Simulation", "pe"); legend->AddEntry(dummyLine, "Parametric Model", "l"); TPaveText *text = new TPaveText(0.15,0.90,0.77,0.98,"brNDC"); text->AddText("CMS Simulation"); text->SetBorderSize(0); text->SetFillStyle(0); text->SetTextAlign(12); text->SetTextFont(42); text->SetTextSize(0.03); TPaveText *titlet = new TPaveText(0.15,0.80,0.60,0.85,"brNDC"); titlet->AddText(frameTitle.str().c_str()); titlet->SetBorderSize(0); titlet->SetFillStyle(0); titlet->SetTextAlign(12); titlet->SetTextFont(132); titlet->SetTextSize(0.045); TPaveText *sigmat = new TPaveText(0.15,0.65,0.77,0.78,"brNDC"); stringstream sigmaval0, sigmaval1, sigmaval2; sigmaval0 << fixed; sigmaval0 << setprecision(1); sigmaval0 << "m_{dCB} = " << mean.getVal() + massBin << " GeV"; sigmaval1 << fixed; sigmaval1 << setprecision(1); sigmaval1 << "#sigma_{dCB} = " << sigma.getVal() << " GeV"; sigmaval2 << fixed; sigmaval2 << setprecision(1); sigmaval2 << "RMS_{eff} = " << effSigma(hmass) << " GeV"; sigmat->AddText(sigmaval1.str().c_str()); sigmat->AddText(sigmaval2.str().c_str()); sigmat->SetBorderSize(0); sigmat->SetFillStyle(0); sigmat->SetTextAlign(12); sigmat->SetTextFont(132); sigmat->SetTextSize(0.04); xframe->GetYaxis()->SetTitleOffset(1.5); cout << "EFF RMS = " << effSigma(hmass) << " RMS = " << hmass->GetRMS() << endl; pad1->cd(); stringstream nameFile, nameFileC, nameFilePng; nameFile << "fitM" << massBin << "_channel" << channels<< "_category"<< categ << ".pdf"; nameFileC << "fitM" << massBin << "_channel" << channels << "_category"<< categ << ".C"; nameFilePng << "fitM" << massBin << "_channel" << channels << "_category"<< categ << ".png"; xframe->Draw(); gPad->Update(); legend->Draw(); text->Draw(); sigmat->Draw(); titlet->Draw(); pad2->cd() ; frame3->Draw() ; frame3->SetMinimum(-3); frame3->SetMaximum(3); TLine *line1 = new TLine(105,0,140,0); line1->SetLineColor(kRed); line1->Draw(); c1->Print(nameFile.str().c_str()); c1->SaveAs(nameFileC.str().c_str()); c1->SaveAs(nameFilePng.str().c_str()); fileplot->cd(); xframe->Write(); sigmat->Write(); hmass->Write(); fileplot->Close(); if(fitValues!=0){ fitValues[0] = a1.getVal(); fitValues[1] = a2.getVal(); fitValues[2] = mean.getVal(); fitValues[3] = mean3.getVal(); fitValues[4] = n1.getVal(); fitValues[5] = n2.getVal(); fitValues[6] = sigma.getVal(); fitValues[7] = A1.getVal(); fitValues[8] = A2.getVal(); } if(fitErrors!=0){ fitErrors[0] = a1.getError(); fitErrors[1] = a2.getError(); fitErrors[2] = mean.getError(); fitErrors[3] = mean3.getError(); fitErrors[4] = n1.getError(); fitErrors[5] = n2.getError(); fitErrors[6] = sigma.getError(); fitErrors[7] = A1.getError(); fitErrors[8] = A2.getError(); } covQual[0] = fitres->covQual(); }
void InclusiveJets_2010_mcdataRatio(){ //general root settings gROOT->SetStyle("Plain"); gStyle->SetOptStat(0); //get rid of statistics box // to set the errors of the histograms to sqrt(sum of squares of weights) TH1::SetDefaultSumw2() ; //Ranges for plots Float_t xmin=17.5 , ymin = 0.00001, xmax = 1684.0, ymax = 10000000000000000.; //for the linecolor and linestyle Int_t icol[8]={8,kViolet,7,4,12,46,6,7}; Int_t isty[8]={1,1,1,1,1,1,1,1}; Int_t imark[5] = {21,22,25,26,3}; //get the root files TFile *f[3]; f[0] = new TFile("out_aida_40times900kevents_errorcut50/Z2MPIHADONbornkt5ktsupp250_errorcut.root"); f[1] = new TFile("out_aida_40times900kevents_errorcut50/Z2MPIHADOFFbornkt5ktsupp250_errorcut.root"); f[2] = new TFile("out_aida_40times900kevents_errorcut50/NOTUNEbornkt5ktsupp250_errorcut.root"); //get the Tgraph and convert into histo TH1F _histotmp[6][3]; Int_t n = 3; //number of files Int_t nh = 6; // number of histograms = number of y bins for(const int ifile = 0; ifile < n; ifile++){ _histotmp[0][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d01_x01_y01;1")); // |y| <0.5 _histotmp[1][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d02_x01_y01;2")); // 0.5 < |y| < 1.0 _histotmp[2][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d03_x01_y01;2")); // 1.0 < |y| < 1.5 _histotmp[3][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d04_x01_y01;2")); // 1.5 < |y| < 2.0 _histotmp[4][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d05_x01_y01;1")); // 2.0 < |y| < 2.5 _histotmp[5][ifile] = Gr2Hi((TGraph*) f[ifile]->Get("d06_x01_y01;1")); // 2.5 < |y| < 3.0 for(const int ihisto = 0; ihisto < nh; ihisto++){ _histotmp[ihisto][ifile].SetName(""); } } //change the histo so that I can plot it and do the ratio TH1F *_histo[6][3]; for(const int ifile = 0; ifile < n; ifile++){ for(const int ihisto = 0; ihisto < nh; ihisto++){ TH1F *_histo[ihisto][ifile]= (TH1F*)_histotmp[ihisto][ifile].Clone(""); /* _histo[ihisto][ifile]->Divide((TH1*)_histo[ihisto][1]); //histo 0 / hsito 1 TH1F *_ratio1[ihisto]= (TH1F*)_ratiotmp1[ihisto]->Clone(""); _ratiotmp2[ihisto]->Divide((TH1*)_histo[ihisto][2]); //histo 0 / hsito 2 TH1F *_ratio2[ihisto]= (TH1F*)_ratiotmp2[ihisto]->Clone(""); */ _histo[ihisto][ifile]->SetLineWidth(2); _histo[ihisto][ifile]->SetLineColor(icol[ihisto]); _histo[ihisto][ifile]->SetMarkerStyle(2); _histo[ihisto][ifile]->SetMarkerColor(icol[ihisto]); } //scale the histos that it fits in one histogram _histo[0][ifile]->Scale(10000); _histo[1][ifile]->Scale(1000); _histo[2][ifile]->Scale(100); _histo[3][ifile]->Scale(10); _histo[4][ifile]->Scale(1); } //get the data 2010 //data = new TFile("out_aida/CMS_2011_S9086218.root"); //TH1F _histodata1 = Gr2Hi((TGraph*)data->Get("d01_x01_y01;1")); // |y| <0.5 //TH1F _histodata2 = Gr2Hi((TGraph*)data->Get("d02_x01_y01;1")); // 0.5 < |y| < 1.0 //TH1F _histodata3 = Gr2Hi((TGraph*)data->Get("d03_x01_y01;1")); // 1.0 < |y| < 1.5 //TH1F _histodata4 = Gr2Hi((TGraph*)data->Get("d04_x01_y01;1")); // 1.5 < |y| < 2.0 //TH1F _histodata5 = Gr2Hi((TGraph*)data->Get("d05_x01_y01;1")); // 2.0 < |y| < 2.5 //TH1F _histodata6 = Gr2Hi((TGraph*)data->Get("d06_x01_y01;1")); // 2.5 < |y| < 3.0 Double_t xAxis1[35] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 737, 846, 1684}; TH1F *d01_x01_y01_histo = new TH1F("d01_x01_y01_histo","d01_x01_y01_histo",34, xAxis1); d01_x01_y01_histo->SetBinContent(1,1.97e+11); d01_x01_y01_histo->SetBinContent(2,1.02e+11); d01_x01_y01_histo->SetBinContent(3,5.14e+10); d01_x01_y01_histo->SetBinContent(4,2.66e+10); d01_x01_y01_histo->SetBinContent(5,1.38e+10); d01_x01_y01_histo->SetBinContent(6,6.53e+09); d01_x01_y01_histo->SetBinContent(7,3.35e+09); d01_x01_y01_histo->SetBinContent(8,1.8e+09); d01_x01_y01_histo->SetBinContent(9,9.2e+08); d01_x01_y01_histo->SetBinContent(10,4.66e+08); d01_x01_y01_histo->SetBinContent(11,2.37e+08); d01_x01_y01_histo->SetBinContent(12,1.18e+08); d01_x01_y01_histo->SetBinContent(13,5.43e+07); d01_x01_y01_histo->SetBinContent(14,2.39e+07); d01_x01_y01_histo->SetBinContent(15,1.08e+07); d01_x01_y01_histo->SetBinContent(16,5240000); d01_x01_y01_histo->SetBinContent(17,2610000); d01_x01_y01_histo->SetBinContent(18,1360000); d01_x01_y01_histo->SetBinContent(19,716000); d01_x01_y01_histo->SetBinContent(20,381000); d01_x01_y01_histo->SetBinContent(21,207000); d01_x01_y01_histo->SetBinContent(22,117000); d01_x01_y01_histo->SetBinContent(23,66800); d01_x01_y01_histo->SetBinContent(24,37900); d01_x01_y01_histo->SetBinContent(25,22000); d01_x01_y01_histo->SetBinContent(26,12900); d01_x01_y01_histo->SetBinContent(27,7540); d01_x01_y01_histo->SetBinContent(28,4410); d01_x01_y01_histo->SetBinContent(29,2770); d01_x01_y01_histo->SetBinContent(30,1450); d01_x01_y01_histo->SetBinContent(31,846); d01_x01_y01_histo->SetBinContent(32,499); d01_x01_y01_histo->SetBinContent(33,205); d01_x01_y01_histo->SetBinContent(34,20.2); d01_x01_y01_histo->SetBinError(1,2.547782e+10); d01_x01_y01_histo->SetBinError(2,1.24325e+10); d01_x01_y01_histo->SetBinError(3,6.016764e+09); d01_x01_y01_histo->SetBinError(4,3.005329e+09); d01_x01_y01_histo->SetBinError(5,1.530463e+09); d01_x01_y01_histo->SetBinError(6,7.056178e+08); d01_x01_y01_histo->SetBinError(7,3.617535e+08); d01_x01_y01_histo->SetBinError(8,1.96072e+08); d01_x01_y01_histo->SetBinError(9,9.919588e+07); d01_x01_y01_histo->SetBinError(10,5.102008e+07); d01_x01_y01_histo->SetBinError(11,2.639067e+07); d01_x01_y01_histo->SetBinError(12,1.335539e+07); d01_x01_y01_histo->SetBinError(13,6258885); d01_x01_y01_histo->SetBinError(14,2836105); d01_x01_y01_histo->SetBinError(15,1319900); d01_x01_y01_histo->SetBinError(16,663920.6); d01_x01_y01_histo->SetBinError(17,342646.4); d01_x01_y01_histo->SetBinError(18,184642.2); d01_x01_y01_histo->SetBinError(19,100845.5); d01_x01_y01_histo->SetBinError(20,55764.14); d01_x01_y01_histo->SetBinError(21,31565.29); d01_x01_y01_histo->SetBinError(22,18614.95); d01_x01_y01_histo->SetBinError(23,11075.51); d01_x01_y01_histo->SetBinError(24,6579.499); d01_x01_y01_histo->SetBinError(25,4015.708); d01_x01_y01_histo->SetBinError(26,2479.083); d01_x01_y01_histo->SetBinError(27,1527.99); d01_x01_y01_histo->SetBinError(28,943.6936); d01_x01_y01_histo->SetBinError(29,627.92); d01_x01_y01_histo->SetBinError(30,350.3168); d01_x01_y01_histo->SetBinError(31,219.1467); d01_x01_y01_histo->SetBinError(32,139.7467); d01_x01_y01_histo->SetBinError(33,62.02427); d01_x01_y01_histo->SetBinError(34,7.233998); d01_x01_y01_histo->SetEntries(34); d01_x01_y01_histo->SetStats(0); //d01_x01_y01_histo->Scale(10000); d01_x01_y01_histo->SetLineWidth(2); d01_x01_y01_histo->SetMarkerStyle(21); d01_x01_y01_histo->SetMarkerSize(0.7); d01_x01_y01_histo->SetFillColor(kGray); Double_t xAxis2[34] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 790, 1684}; TH1F *d02_x01_y01_histo = new TH1F("d02_x01_y01_histo","d02_x01_y01_histo",33, xAxis2); d02_x01_y01_histo->SetBinContent(1,1.89e+10); d02_x01_y01_histo->SetBinContent(2,9.74e+09); d02_x01_y01_histo->SetBinContent(3,4.99e+09); d02_x01_y01_histo->SetBinContent(4,2.49e+09); d02_x01_y01_histo->SetBinContent(5,1.31e+09); d02_x01_y01_histo->SetBinContent(6,6.28e+08); d02_x01_y01_histo->SetBinContent(7,3.23e+08); d02_x01_y01_histo->SetBinContent(8,1.71e+08); d02_x01_y01_histo->SetBinContent(9,8.84e+07); d02_x01_y01_histo->SetBinContent(10,4.42e+07); d02_x01_y01_histo->SetBinContent(11,2.22e+07); d02_x01_y01_histo->SetBinContent(12,1.13e+07); d02_x01_y01_histo->SetBinContent(13,5130000); d02_x01_y01_histo->SetBinContent(14,2230000); d02_x01_y01_histo->SetBinContent(15,1010000); d02_x01_y01_histo->SetBinContent(16,482000); d02_x01_y01_histo->SetBinContent(17,238000); d02_x01_y01_histo->SetBinContent(18,122000); d02_x01_y01_histo->SetBinContent(19,64200); d02_x01_y01_histo->SetBinContent(20,34100); d02_x01_y01_histo->SetBinContent(21,18700); d02_x01_y01_histo->SetBinContent(22,10100); d02_x01_y01_histo->SetBinContent(23,5720); d02_x01_y01_histo->SetBinContent(24,3420); d02_x01_y01_histo->SetBinContent(25,1890); d02_x01_y01_histo->SetBinContent(26,1130); d02_x01_y01_histo->SetBinContent(27,590); d02_x01_y01_histo->SetBinContent(28,376); d02_x01_y01_histo->SetBinContent(29,196); d02_x01_y01_histo->SetBinContent(30,130); d02_x01_y01_histo->SetBinContent(31,62.4); d02_x01_y01_histo->SetBinContent(32,30.1); d02_x01_y01_histo->SetBinContent(33,2.14); d02_x01_y01_histo->SetBinError(1,2.47211e+09); d02_x01_y01_histo->SetBinError(2,1.196891e+09); d02_x01_y01_histo->SetBinError(3,5.890842e+08); d02_x01_y01_histo->SetBinError(4,2.837945e+08); d02_x01_y01_histo->SetBinError(5,1.465766e+08); d02_x01_y01_histo->SetBinError(6,6.848512e+07); d02_x01_y01_histo->SetBinError(7,3.536592e+07); d02_x01_y01_histo->SetBinError(8,1.879562e+07); d02_x01_y01_histo->SetBinError(9,9619569); d02_x01_y01_histo->SetBinError(10,4860292); d02_x01_y01_histo->SetBinError(11,2483524); d02_x01_y01_histo->SetBinError(12,1278948); d02_x01_y01_histo->SetBinError(13,596427.3); d02_x01_y01_histo->SetBinError(14,266851); d02_x01_y01_histo->SetBinError(15,124973); d02_x01_y01_histo->SetBinError(16,61551.8); d02_x01_y01_histo->SetBinError(17,31482.64); d02_x01_y01_histo->SetBinError(18,16749.58); d02_x01_y01_histo->SetBinError(19,9172.852); d02_x01_y01_histo->SetBinError(20,5077.065); d02_x01_y01_histo->SetBinError(21,2898.771); d02_x01_y01_histo->SetBinError(22,1633.017); d02_x01_y01_histo->SetBinError(23,965.8504); d02_x01_y01_histo->SetBinError(24,606.0352); d02_x01_y01_histo->SetBinError(25,351.8168); d02_x01_y01_histo->SetBinError(26,221.2594); d02_x01_y01_histo->SetBinError(27,122.0002); d02_x01_y01_histo->SetBinError(28,82.34314); d02_x01_y01_histo->SetBinError(29,45.69701); d02_x01_y01_histo->SetBinError(30,32.27314); d02_x01_y01_histo->SetBinError(31,16.82748); d02_x01_y01_histo->SetBinError(32,8.687436); d02_x01_y01_histo->SetBinError(33,0.745178); d02_x01_y01_histo->SetEntries(33); d02_x01_y01_histo->SetStats(0); d02_x01_y01_histo->SetLineStyle(0); d02_x01_y01_histo->SetLineWidth(2); d02_x01_y01_histo->SetMarkerStyle(22); d02_x01_y01_histo->SetMarkerSize(0.7); d02_x01_y01_histo->SetFillColor(kGray); Double_t xAxis3[33] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 592, 638, 686, 1410}; TH1F *d03_x01_y01_histo = new TH1F("d03_x01_y01_histo","d03_x01_y01_histo",32, xAxis3); d03_x01_y01_histo->SetBinContent(1,1.84e+09); d03_x01_y01_histo->SetBinContent(2,9.24e+08); d03_x01_y01_histo->SetBinContent(3,4.64e+08); d03_x01_y01_histo->SetBinContent(4,2.34e+08); d03_x01_y01_histo->SetBinContent(5,1.19e+08); d03_x01_y01_histo->SetBinContent(6,5.88e+07); d03_x01_y01_histo->SetBinContent(7,2.92e+07); d03_x01_y01_histo->SetBinContent(8,1.57e+07); d03_x01_y01_histo->SetBinContent(9,8090000); d03_x01_y01_histo->SetBinContent(10,4090000); d03_x01_y01_histo->SetBinContent(11,2050000); d03_x01_y01_histo->SetBinContent(12,994000); d03_x01_y01_histo->SetBinContent(13,452000); d03_x01_y01_histo->SetBinContent(14,192000); d03_x01_y01_histo->SetBinContent(15,86200); d03_x01_y01_histo->SetBinContent(16,40500); d03_x01_y01_histo->SetBinContent(17,20100); d03_x01_y01_histo->SetBinContent(18,10000); d03_x01_y01_histo->SetBinContent(19,5210); d03_x01_y01_histo->SetBinContent(20,2720); d03_x01_y01_histo->SetBinContent(21,1470); d03_x01_y01_histo->SetBinContent(22,803); d03_x01_y01_histo->SetBinContent(23,435); d03_x01_y01_histo->SetBinContent(24,252); d03_x01_y01_histo->SetBinContent(25,138); d03_x01_y01_histo->SetBinContent(26,75.7); d03_x01_y01_histo->SetBinContent(27,43.1); d03_x01_y01_histo->SetBinContent(28,23.5); d03_x01_y01_histo->SetBinContent(29,13.1); d03_x01_y01_histo->SetBinContent(30,6.96); d03_x01_y01_histo->SetBinContent(31,3.31); d03_x01_y01_histo->SetBinContent(32,0.263); d03_x01_y01_histo->SetBinError(1,3.267438e+08); d03_x01_y01_histo->SetBinError(2,1.460402e+08); d03_x01_y01_histo->SetBinError(3,6.756898e+07); d03_x01_y01_histo->SetBinError(4,3.169167e+07); d03_x01_y01_histo->SetBinError(5,1.534246e+07); d03_x01_y01_histo->SetBinError(6,7206299); d03_x01_y01_histo->SetBinError(7,3487964); d03_x01_y01_histo->SetBinError(8,1852766); d03_x01_y01_histo->SetBinError(9,937690); d03_x01_y01_histo->SetBinError(10,474695.6); d03_x01_y01_histo->SetBinError(11,239744.8); d03_x01_y01_histo->SetBinError(12,117028.5); d03_x01_y01_histo->SetBinError(13,54375.43); d03_x01_y01_histo->SetBinError(14,23751.81); d03_x01_y01_histo->SetBinError(15,11010.17); d03_x01_y01_histo->SetBinError(16,5355.962); d03_x01_y01_histo->SetBinError(17,2760.221); d03_x01_y01_histo->SetBinError(18,1428.408); d03_x01_y01_histo->SetBinError(19,775.8965); d03_x01_y01_histo->SetBinError(20,422.7916); d03_x01_y01_histo->SetBinError(21,238.9779); d03_x01_y01_histo->SetBinError(22,137.1344); d03_x01_y01_histo->SetBinError(23,78.10703); d03_x01_y01_histo->SetBinError(24,47.62767); d03_x01_y01_histo->SetBinError(25,27.54976); d03_x01_y01_histo->SetBinError(26,16.01829); d03_x01_y01_histo->SetBinError(27,9.722084); d03_x01_y01_histo->SetBinError(28,5.653863); d03_x01_y01_histo->SetBinError(29,3.37332); d03_x01_y01_histo->SetBinError(30,1.948179); d03_x01_y01_histo->SetBinError(31,1.026618); d03_x01_y01_histo->SetBinError(32,0.09205037); d03_x01_y01_histo->SetEntries(32); d03_x01_y01_histo->SetStats(0); d03_x01_y01_histo->SetLineStyle(0); d03_x01_y01_histo->SetLineWidth(2); d03_x01_y01_histo->SetMarkerStyle(25); d03_x01_y01_histo->SetMarkerSize(0.7); d03_x01_y01_histo->SetFillColor(kGray); Double_t xAxis4[30] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 468, 507, 548, 1032}; TH1F *d04_x01_y01_histo = new TH1F("d04_x01_y01_histo","d04_x01_y01_histo",29, xAxis4); d04_x01_y01_histo->SetBinContent(1,1.44e+08); d04_x01_y01_histo->SetBinContent(2,7.35e+07); d04_x01_y01_histo->SetBinContent(3,3.8e+07); d04_x01_y01_histo->SetBinContent(4,1.89e+07); d04_x01_y01_histo->SetBinContent(5,9700000); d04_x01_y01_histo->SetBinContent(6,4670000); d04_x01_y01_histo->SetBinContent(7,2280000); d04_x01_y01_histo->SetBinContent(8,1220000); d04_x01_y01_histo->SetBinContent(9,629000); d04_x01_y01_histo->SetBinContent(10,305000); d04_x01_y01_histo->SetBinContent(11,151000); d04_x01_y01_histo->SetBinContent(12,73400); d04_x01_y01_histo->SetBinContent(13,32900); d04_x01_y01_histo->SetBinContent(14,13900); d04_x01_y01_histo->SetBinContent(15,6160); d04_x01_y01_histo->SetBinContent(16,2860); d04_x01_y01_histo->SetBinContent(17,1400); d04_x01_y01_histo->SetBinContent(18,711); d04_x01_y01_histo->SetBinContent(19,356); d04_x01_y01_histo->SetBinContent(20,186); d04_x01_y01_histo->SetBinContent(21,94.5); d04_x01_y01_histo->SetBinContent(22,50.9); d04_x01_y01_histo->SetBinContent(23,25.6); d04_x01_y01_histo->SetBinContent(24,13.3); d04_x01_y01_histo->SetBinContent(25,7); d04_x01_y01_histo->SetBinContent(26,3.45); d04_x01_y01_histo->SetBinContent(27,1.73); d04_x01_y01_histo->SetBinContent(28,0.796); d04_x01_y01_histo->SetBinContent(29,0.066); d04_x01_y01_histo->SetBinError(1,3.637846e+07); d04_x01_y01_histo->SetBinError(2,1.67099e+07); d04_x01_y01_histo->SetBinError(3,7851714); d04_x01_y01_histo->SetBinError(4,3568673); d04_x01_y01_histo->SetBinError(5,1703586); d04_x01_y01_histo->SetBinError(6,750723.4); d04_x01_y01_histo->SetBinError(7,343490.2); d04_x01_y01_histo->SetBinError(8,173448.2); d04_x01_y01_histo->SetBinError(9,84294.21); d04_x01_y01_histo->SetBinError(10,39082.27); d04_x01_y01_histo->SetBinError(11,18979.5); d04_x01_y01_histo->SetBinError(12,9119.636); d04_x01_y01_histo->SetBinError(13,4140.893); d04_x01_y01_histo->SetBinError(14,1810.098); d04_x01_y01_histo->SetBinError(15,830.3785); d04_x01_y01_histo->SetBinError(16,399.9657); d04_x01_y01_histo->SetBinError(17,204.9602); d04_x01_y01_histo->SetBinError(18,109.8075); d04_x01_y01_histo->SetBinError(19,59.1287); d04_x01_y01_histo->SetBinError(20,33.42105); d04_x01_y01_histo->SetBinError(21,18.47046); d04_x01_y01_histo->SetBinError(22,10.88183); d04_x01_y01_histo->SetBinError(23,6.000047); d04_x01_y01_histo->SetBinError(24,3.41489); d04_x01_y01_histo->SetBinError(25,1.994767); d04_x01_y01_histo->SetBinError(26,1.086542); d04_x01_y01_histo->SetBinError(27,0.610451); d04_x01_y01_histo->SetBinError(28,0.3130872); d04_x01_y01_histo->SetBinError(29,0.03211142); d04_x01_y01_histo->SetEntries(29); d04_x01_y01_histo->SetStats(0); d04_x01_y01_histo->SetLineStyle(0); d04_x01_y01_histo->SetLineWidth(2); d04_x01_y01_histo->SetMarkerStyle(26); d04_x01_y01_histo->SetMarkerSize(0.7); d04_x01_y01_histo->SetFillColor(kGray); Double_t xAxis5[27] = {18, 21, 24, 28, 32, 37, 43, 49, 56, 64, 74, 84, 97, 114, 133, 153, 174, 196, 220, 245, 272, 300, 330, 362, 395, 430, 737}; TH1F *d05_x01_y01_histo = new TH1F("d05_x01_y01_histo","d05_x01_y01_histo",26, xAxis5); d05_x01_y01_histo->SetBinContent(1,1.05e+07); d05_x01_y01_histo->SetBinContent(2,5520000); d05_x01_y01_histo->SetBinContent(3,2720000); d05_x01_y01_histo->SetBinContent(4,1440000); d05_x01_y01_histo->SetBinContent(5,738000); d05_x01_y01_histo->SetBinContent(6,348000); d05_x01_y01_histo->SetBinContent(7,168000); d05_x01_y01_histo->SetBinContent(8,89800); d05_x01_y01_histo->SetBinContent(9,43800); d05_x01_y01_histo->SetBinContent(10,21800); d05_x01_y01_histo->SetBinContent(11,10300); d05_x01_y01_histo->SetBinContent(12,5030); d05_x01_y01_histo->SetBinContent(13,2180); d05_x01_y01_histo->SetBinContent(14,896); d05_x01_y01_histo->SetBinContent(15,384); d05_x01_y01_histo->SetBinContent(16,170); d05_x01_y01_histo->SetBinContent(17,78.5); d05_x01_y01_histo->SetBinContent(18,35.8); d05_x01_y01_histo->SetBinContent(19,16.5); d05_x01_y01_histo->SetBinContent(20,7.25); d05_x01_y01_histo->SetBinContent(21,3.27); d05_x01_y01_histo->SetBinContent(22,1.38); d05_x01_y01_histo->SetBinContent(23,0.579); d05_x01_y01_histo->SetBinContent(24,0.22); d05_x01_y01_histo->SetBinContent(25,0.0808); d05_x01_y01_histo->SetBinContent(26,0.00548); d05_x01_y01_histo->SetBinError(1,1978672); d05_x01_y01_histo->SetBinError(2,935188); d05_x01_y01_histo->SetBinError(3,421635.1); d05_x01_y01_histo->SetBinError(4,206618.7); d05_x01_y01_histo->SetBinError(5,100557.7); d05_x01_y01_histo->SetBinError(6,44514.08); d05_x01_y01_histo->SetBinError(7,20942.13); d05_x01_y01_histo->SetBinError(8,11048.87); d05_x01_y01_histo->SetBinError(9,5260.105); d05_x01_y01_histo->SetBinError(10,2634.555); d05_x01_y01_histo->SetBinError(11,1278.591); d05_x01_y01_histo->SetBinError(12,627.8137); d05_x01_y01_histo->SetBinError(13,282.1732); d05_x01_y01_histo->SetBinError(14,121.6466); d05_x01_y01_histo->SetBinError(15,55.24865); d05_x01_y01_histo->SetBinError(16,25.82574); d05_x01_y01_histo->SetBinError(17,12.76174); d05_x01_y01_histo->SetBinError(18,6.253124); d05_x01_y01_histo->SetBinError(19,3.142438); d05_x01_y01_histo->SetBinError(20,1.508923); d05_x01_y01_histo->SetBinError(21,0.7510828); d05_x01_y01_histo->SetBinError(22,0.3514478); d05_x01_y01_histo->SetBinError(23,0.1646418); d05_x01_y01_histo->SetBinError(24,0.071108); d05_x01_y01_histo->SetBinError(25,0.02988224); d05_x01_y01_histo->SetBinError(26,0.002567773); d05_x01_y01_histo->SetEntries(26); d05_x01_y01_histo->SetStats(0); d05_x01_y01_histo->SetLineStyle(0); d05_x01_y01_histo->SetLineWidth(2); d05_x01_y01_histo->SetMarkerStyle(3); d05_x01_y01_histo->SetMarkerSize(0.7); d05_x01_y01_histo->SetFillColor(kGray); // MC / Data TH1F *_ratio[6][3]; for(const int ifile = 0; ifile < n; ifile++){ for(const int ihisto = 0; ihisto < nh; ihisto++){ TH1F *_ratio[ihisto][ifile]= (TH1F*)_histo[ihisto][ifile]->Clone(""); _ratio[ihisto][ifile]->SetLineWidth(1); _ratio[ihisto][ifile]->SetLineColor(icol[ihisto]); _ratio[ihisto][ifile]->SetMarkerStyle(imark[ihisto]); _ratio[ihisto][ifile]->SetMarkerSize(0.5); _ratio[ihisto][ifile]->SetMarkerColor(icol[ihisto]); } _ratio[0][ifile]->Divide((TH1*)d01_x01_y01_histo); _ratio[1][ifile]->Divide((TH1*)d02_x01_y01_histo); _ratio[2][ifile]->Divide((TH1*)d03_x01_y01_histo); _ratio[3][ifile]->Divide((TH1*)d04_x01_y01_histo); _ratio[4][ifile]->Divide((TH1*)d05_x01_y01_histo); // TH1F *_ratio[ihisto]= (TH1F*)_ratiotmp1[ihisto]->Clone(""); // _ratiotmp2[ihisto]->Divide((TH1*)_histo[ihisto][2]); //histo 0 / hsito 2 // TH1F *_ratio2[ihisto]= (TH1F*)_ratiotmp2[ihisto]->Clone(""); } //create a canvas to draw TGraph and TH1F TCanvas *c1 = new TCanvas("c1", "c1",369,0,680,750); //pads (inclusive jet cross section, MC / data ) Pad_inclJet = new TPad("Pad_inclJet","xs",0.01,0.51,1.0,1.0); Pad_inclJet->Draw(); Pad_MCdata1 = new TPad("Pad_MCdata1","ratio",0.01,0.40,1.0,0.50); Pad_MCdata1->Draw(); Pad_MCdata2 = new TPad("Pad_MCdata2","ratio",0.01,0.30,1.0,0.40); Pad_MCdata2->Draw(); Pad_MCdata3 = new TPad("Pad_MCdata3","ratio",0.01,0.20,1.0,0.30); Pad_MCdata3->Draw(); Pad_MCdata4 = new TPad("Pad_MCdata4","ratio",0.01,0.10,1.0,0.20); Pad_MCdata4->Draw(); Pad_MCdata5 = new TPad("Pad_MCdata5","ratio",0.01,0.0,1.0,0.10); Pad_MCdata5->Draw(); // first pad style Pad_inclJet->cd(); gStyle->SetOptStat(0); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLogy(); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.03); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); //empty histo for border and style TH1F *shape = new TH1F("","",1, xmin, xmax); shape->SetMinimum(ymin); shape->SetMaximum(ymax); shape->GetXaxis()->SetTitle("Jet p_{T} (GeV/c)"); shape->GetXaxis()->SetLabelSize(0.03); shape->GetXaxis()->SetTitleSize(0.03); shape->GetXaxis()->SetNdivisions(508); shape->GetXaxis()->SetTitleOffset(1.3); shape->GetYaxis()->SetTitle("#frac{d^{2}#sigma}{dp_{T}d|y|} (pb/GeV)"); shape->GetYaxis()->SetLabelSize(0.03); shape->GetYaxis()->SetTitleSize(0.03); shape->GetYaxis()->SetTitleOffset(1.6); shape->Draw("e"); //data d01_x01_y01_histo->Draw("E2same"); d02_x01_y01_histo->Draw("E2same"); d03_x01_y01_histo->Draw("E2same"); d04_x01_y01_histo->Draw("E2same"); d05_x01_y01_histo->Draw("E2same"); _histo[0][0]->Draw("E1same"); _histo[1][0]->Draw("E1same"); _histo[2][0]->Draw("E1same"); _histo[3][0]->Draw("E1same"); _histo[4][0]->Draw("E1same"); gPad->SetLogy(); gPad->SetLogx(); TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.17,0.79,0.37,0.95,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.03); text = pt->AddText("CMS 2010"); text = pt->AddText("#sqrt{s} = 7 TeV"); text = pt->AddText("anti-k_{T} R = 0.5"); pt->Draw(); TLegend *leg = new TLegend(0.68,0.77,0.83,0.928); leg->SetBorderSize(1); leg->SetTextSize(0.025); leg->SetLineColor(0); leg->SetLineStyle(1); leg->SetLineWidth(1); leg->SetFillColor(0); leg->SetFillStyle(1001); leg->AddEntry((TH1F*)_histo[0][0],"POWHEG & Pythia6 Z2","pfl"); leg->AddEntry((TH1F*) d01_x01_y01_histo, "|y| <0.5 (x 10^{4})","pfl"); leg->AddEntry((TH1F*) d02_x01_y01_histo, "0.5 < |y| < 1.0 (x 10^{3})","pfl"); leg->AddEntry((TH1F*) d03_x01_y01_histo, "1.0 < |y| < 1.5 (x 10^{2})","pfl"); leg->AddEntry((TH1F*) d04_x01_y01_histo, "1.5 < |y| < 2.0 (x 10^{1})","pfl"); leg->AddEntry((TH1F*) d05_x01_y01_histo, "2.0 < |y| < 2.5 (x 10^{0})","pfl"); leg->Draw(); //second pad MC / Data Pad_MCdata1->cd(); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.0); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); gPad->SetLogx(); //AK Empty histo for style and borders TH1F *shape_MCdata = new TH1F("","",1, xmin, xmax); shape_MCdata->SetMinimum(0.5); shape_MCdata->SetMaximum(2.0); shape_MCdata->GetXaxis()->SetTitle("Jet p_{T} (GeV/c)"); shape_MCdata->GetXaxis()->SetLabelSize(0.0); shape_MCdata->GetXaxis()->SetTitleSize(0.0); shape_MCdata->GetXaxis()->SetTitleOffset(0.6); shape_MCdata->GetYaxis()->SetTitle("MC/Data"); shape_MCdata->GetYaxis()->SetLabelSize(0.15); shape_MCdata->GetYaxis()->SetTitleSize(0.15); shape_MCdata->GetYaxis()->SetTitleOffset(0.2); shape_MCdata->GetYaxis()->SetNdivisions(108, kTRUE); shape_MCdata->Draw("e"); // horizontal line at y = 1 TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.89,0.7,0.94,0.8,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.2); text = pt->AddText("|y| <0.5"); pt->Draw(); _ratio[0][0]->Draw("EhistSame"); Pad_MCdata2->cd(); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.0); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); gPad->SetLogx(); shape_MCdata->Draw("e"); // horizontal line at y = 1 TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.2); text = pt->AddText("0.5 < |y| < 1.0"); pt->Draw(); _ratio[1][0]->Draw("EhistSame"); Pad_MCdata3->cd(); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.0); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); gPad->SetLogx(); shape_MCdata->Draw("e"); // horizontal line at y = 1 TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.2); text = pt->AddText("1.0 < |y| < 1.5"); pt->Draw(); _ratio[2][0]->Draw("EhistSame"); Pad_MCdata4->cd(); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.0); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); gPad->SetLogx(); shape_MCdata->Draw("e"); // horizontal line at y = 1 TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.2); text = pt->AddText("1.5 < |y| < 2.0"); pt->Draw(); _ratio[3][0]->Draw("EhistSame"); Pad_MCdata5->cd(); gPad->SetFillColor(0); gPad->SetBorderMode(0); gPad->SetBorderSize(2); gPad->SetLeftMargin(0.14); gPad->SetRightMargin(0.03); gPad->SetTopMargin(0.0); gPad->SetFrameBorderMode(0); gPad->SetFrameBorderMode(0); gPad->SetLogx(); shape_MCdata->Draw("e"); // horizontal line at y = 1 TLine *line = new TLine(xmin,1,xmax,1); line->SetLineStyle(2); line->Draw(); TPaveText *pt = new TPaveText(0.84,0.7,0.89,0.8,"brNDC"); pt->SetBorderSize(0); pt->SetFillColor(0); pt->SetTextAlign(12); pt->SetTextSize(0.2); text = pt->AddText("2.0 < |y| < 2.5"); pt->Draw(); _ratio[4][0]->Draw("EhistSame"); //write in png file mysubpad1 =(TPad*)c1->GetPad(0); mysubpad1->Print("pics/InclusiveJets_10_mcdataRatio.png"); }
void plot_golfcourse_Asymptotic(bool unblind){ bool useNewStyle=true; if(useNewStyle) setFPStyle(); TFile *fFREQ=new TFile("higgsCombineEXOZZ.Asymptotic.TOTAL.root","READ"); TTree *t=(TTree*)fFREQ->Get("limit"); double mh,limit; float quant; t->SetBranchAddress("mh",&mh); t->SetBranchAddress("limit",&limit); t->SetBranchAddress("quantileExpected",&quant); //1st loop on tree for preparing mH ordered list vector<double> v_mhTMP; for(int i=0;i<t->GetEntries();i++){ t->GetEntry(i); if(quant>-1.01&&quant<-0.99){ v_mhTMP.push_back(mh); } } std::sort(v_mhTMP.begin(),v_mhTMP.end()); int nMH=v_mhTMP.size(); int iMH=0; vector<double> v_mh, v_median,v_68l,v_68h,v_95l,v_95h, v_obs; while(iMH<nMH){ double mhTMP=v_mhTMP.at(iMH); for(int i=0;i<t->GetEntries();i++){ // int i=j; // if(j==t->GetEntries())i=0; t->GetEntry(i); //cout<<"i "<<i<<flush<<" m = "<<mh<<endl; // if(mh==600)cout<<"$$$$$$$$$ TREE 600 $$$$$$$$$$$$$$"<<endl; if(mh!=mhTMP)continue;//follow exactly the order of v_mhTMP if(quant>-1.01&&quant<-0.99){ v_obs.push_back(limit); v_mh.push_back(mh); } else if(quant>0.02&&quant<0.03)v_95l.push_back(limit); else if(quant>0.15&&quant<0.17)v_68l.push_back(limit); else if(quant>0.49&&quant<0.51)v_median.push_back(limit); else if(quant>0.83&&quant<0.85)v_68h.push_back(limit); else if(quant>0.965&&quant<0.98){ // cout<<"95% -> at M="<<mh<<" I found "<<limit<<endl; v_95h.push_back(limit); } else {cout<<"Error! Quantile = "<<quant<<endl;} } iMH++; }//end while loop cout<<"Out of the loop !"<<endl; //////////////////////////////////////// /// //read in theoretical values from text files // bool applyExtraTherUnc=true; string xsect_file_th="../../../data/xsect_BulkG_ZZ_c0p5_xsect_in_pb.txt"; if(!isZZChannel)xsect_file_th="../../../data/xsect_BulkG_WW_c0p5_xsect_in_pb.txt"; // make_interpolated_xsect(xsect_file_th, xsect_file_interpol); // string xsect_file_interpol="./RSGravXSectTimesBRToZZ_AgasheHapola_c10_EXPOINTERP.txt"; ifstream xsect_file(xsect_file_th.c_str(),ios::in); if (! xsect_file.is_open()){ cout<<"Failed to open file with xsections"<<endl;} float mH, CS; vector<float> v_mhxs, v_xs, v_brzz2l2q,v_toterrh,v_toterrl; while(xsect_file.good()){ xsect_file >> mH>> CS; if(mH==1200)cout<<"~~~~~ 1200 theor ~~~~~~~~~~~~~"<<endl; if(mH<600.0)continue; v_mhxs.push_back(mH); v_xs.push_back(CS);//*BRZZ2l2q (multyply by BRZZ2l2q only if exp rates in cards are for process X->ZZ->2l2q !) //unavailable theor errors for graviton float tot_err_p=0.0; float tot_err_m=0.0; v_toterrh.push_back(1.0+(tot_err_p)); v_toterrl.push_back(1.0-(tot_err_m)); } cout<<"Size of theor "<<v_mhxs.size()<<endl; xsect_file.close(); string xsect_file_interpol2="../../../data/xsect_BulkG_ZZ_c0p2_xsect_in_pb.txt"; if(!isZZChannel)xsect_file_interpol2="../../../data/xsect_BulkG_WW_c0p2_xsect_in_pb.txt"; ifstream xsect_file2(xsect_file_interpol2.c_str(),ios::in); if (! xsect_file2.is_open()){ cout<<"Failed to open file with xsections (c=0.10)"<<endl;} float mH2,CS10; vector<float> v_xs10; while(xsect_file2.good()){ xsect_file2 >> mH2>> CS10; if(mH2==975)cout<<"~~~~~ 975 theor ~~~~~~~~~~~~~"<<endl; if(mH2<600.0)continue; v_xs10.push_back(CS10);//*BRZZ2l2q //unavailable theor errors for graviton float tot_err_p=0.0; float tot_err_m=0.0; // v_toterrh.push_back(1.0+(tot_err_p)); // v_toterrl.push_back(1.0-(tot_err_m)); } cout<<"Size of theor "<<v_xs10.size()<<endl; xsect_file2.close(); // //END THEOR INPUT PART /////////////// const int nMass= v_mh.size(); double mass[nMass],mass1[nMass],obs_lim_cls[nMass]; double medianD[nMass]; double up68err[nMass],down68err[nMass],up95err[nMass],down95err[nMass]; double xs[nMass], xs_uperr[nMass], xs_downerr[nMass]; double xs10[nMass], xs10_uperr[nMass], xs10_downerr[nMass]; int nMassEff=0,nMassEff1=0; int nM95=0; double mass95[nMass],median95[nMass]; int nexcluded=0; bool excl; for(int im=0;im<nMass;im++){ if( mass[nMassEff-1]>1600.) cout<<"Array "<<im<<flush<<" m = "<<v_mh.at(im)<<endl;; //protection against messed up jobs excl=false; if(v_68h.at(im)>=v_95h.at(im) || v_68l.at(im)<=v_95l.at(im) ){ cout<<"Point at M = "<<v_mh.at(im) <<" excluded: "<<v_95l.at(im)<<" "<<v_68l.at(im)<<" "<<v_median.at(im)<<" "<<v_68h.at(im)<<" "<<v_95h.at(im)<< endl; nexcluded++; // continue; excl=true; } // if(im%2==1)excl=true;//sample only one half of the points //search for right index in theor vectors bool found=false; int indtmp=0,ind=-1; while(!found){ if(v_mhxs.at(indtmp)==v_mh.at(im)){found=true;ind=indtmp;} indtmp++; if(indtmp==v_mhxs.size()){ cout<<"!!! m="<<flush<<v_mh.at(im)<<" NOT found in theor matrix."<<endl; break; } }//end while if(!found){ cout<<"(2) m="<<v_mh.at(im)<<" NOT found in theor matrix."<<endl; continue; } double fl_xs=double(v_xs.at(ind));//*1000.0 double fl_xs10=double(v_xs10.at(ind));//*1000.0 if(fl_xs<fl_xs10)cout<<"WARNING ABOUT XSECT! XS="<<fl_xs<<" XS10="<<fl_xs10<<endl; mass[nMassEff]=v_mh.at(im); //if( mass[nMassEff]==600.0)cout<<"=============> 600 !!!"<<endl; obs_lim_cls[nMassEff]=v_obs.at(im)*fl_xs; nMassEff++; if(!excl){ mass1[nMassEff1]=v_mh.at(im); medianD[nMassEff1]=v_median.at(im)*fl_xs; up68err[nMassEff1]=(v_68h.at(im)-v_median.at(im))*fl_xs; down68err[nMassEff1]=(v_median.at(im)-v_68l.at(im))*fl_xs; cout<<"M="<<mass1[nMassEff1]<<" Median="<<medianD[nMassEff1]<<endl; //scale factor 100 for making the xsect visible xs[nMassEff1]=fl_xs;//*100.0; xs_uperr[nMassEff1]=double( v_toterrh.at(ind))*xs[nMassEff1]- xs[nMassEff1]; xs_downerr[nMassEff1]= xs[nMassEff1]- double( v_toterrl.at(ind))* xs[nMassEff1]; xs10[nMassEff1]=fl_xs10;//*100.0; xs10_uperr[nMassEff1]=double( v_toterrh.at(ind))*xs10[nMassEff1]- xs10[nMassEff1]; xs10_downerr[nMassEff1]= xs10[nMassEff1]- double( v_toterrl.at(ind))* xs10[nMassEff1]; //cout<<"Theor err on 4g for M="<<mass[nMassEff]<<" "<< ggxs4g_downerr[nMassEff] << " "<<ggxs4g_uperr[nMassEff]<<endl; nMassEff1++; bool skip95= false;// // skip95=v_mh.at(im)==204||v_mh.at(im)==208||v_mh.at(im)==212||v_mh.at(im)==214|| v_mh.at(im)==232 || v_mh.at(im)==240 || v_mh.at(im)==240 || v_mh.at(im)==244 || v_mh.at(im)==252 || v_mh.at(im)==264 || v_mh.at(im)==272 || v_mh.at(im)==288 ; // skip95=false; if(skip95 )continue; mass95[nM95]=v_mh.at(im); median95[nM95]=v_median.at(im)*fl_xs; up95err[nM95]=(v_95h.at(im)-v_median.at(im))*fl_xs; down95err[nM95]=(v_median.at(im)-v_95l.at(im))*fl_xs; // cout<<"M95: "<< mass95[nM95]<<" "<<median95[nM95]<<" +"<<up95err[nM95]<<" -"<< down95err[nM95]<< // " ("<<v_95h.at(im) <<" - "<<v_median.at(im) <<")"<<endl; nM95++; }//end if not excluded mass point }//end loop over im (mass points) cout<<"Excluded "<<nexcluded<<" sick mass points."<<endl; // cout<<"Working on TGraph"<<endl; TGraphAsymmErrors *grobslim_cls=new TGraphAsymmErrors(nMassEff,mass,obs_lim_cls); grobslim_cls->SetName("LimitObservedCLs"); TGraphAsymmErrors *grmedian_cls=new TGraphAsymmErrors(nMassEff1,mass1,medianD); grmedian_cls->SetName("LimitExpectedCLs"); TGraphAsymmErrors *gr68_cls=new TGraphAsymmErrors(nMassEff1,mass1,medianD,0,0,down68err,up68err); gr68_cls->SetName("Limit68CLs"); TGraphAsymmErrors *gr95_cls=new TGraphAsymmErrors(nM95,mass95,median95,0,0,down95err,up95err); gr95_cls->SetName("Limit95CLs"); // TGraphAsymmErrors *grthSM=new TGraphAsymmErrors(nMassEff1,mass1,xs,0,0,0,0);//xs_downerr,xs_uperr); TGraph *grthSM=new TGraph(nMassEff1,mass1,xs);//xs_downerr,xs_uperr); grthSM->SetName("SMXSection"); // TGraphAsymmErrors *grthSM10=new TGraphAsymmErrors(nMassEff1,mass1,xs10,0,0,0,0); TGraph *grthSM10=new TGraph(nMassEff1,mass1,xs10); grthSM10->SetName("SMXSection_2nd"); // cout<<"Plotting"<<endl; double fr_left=590.0, fr_down=0.0005,fr_right=2020.0,fr_up=1.0; if(!isZZChannel){fr_left=1000.0, fr_down=0.0000005,fr_right=2500.0,fr_up=10.0;} TCanvas *cMCMC=new TCanvas("c_lim_Asymp","canvas with limits for Asymptotic CLs",630,600); cMCMC->cd(); cMCMC->SetGridx(1); cMCMC->SetGridy(1); // draw a frame to define the range TH1F *hr = cMCMC->DrawFrame(fr_left,fr_down,fr_right,fr_up,""); TString VV = "ZZ"; if(!isZZChannel)VV="WW"; hr->SetXTitle("M_{1} [GeV]"); hr->SetYTitle("#sigma_{95%} #times BR(G #rightarrow "+VV+") [pb]");// #rightarrow 2l2q // cMCMC->GetFrame()->SetFillColor(21); //cMCMC->GetFrame()->SetBorderSize(12); gr95_cls->SetFillColor(kYellow); gr95_cls->SetFillStyle(1001);//solid gr95_cls->SetLineStyle(kDashed); gr95_cls->SetLineWidth(3); gr95_cls->GetXaxis()->SetTitle("M_{1} [GeV]"); gr95_cls->GetYaxis()->SetTitle("#sigma_{95%} #times BR(G #rightarrow "+VV+") [pb]");// #rightarrow 2l2q gr95_cls->GetXaxis()->SetRangeUser(fr_left,fr_right); gr95_cls->Draw("3"); gr68_cls->SetFillColor(kGreen); gr68_cls->SetFillStyle(1001);//solid gr68_cls->SetLineStyle(kDashed); gr68_cls->SetLineWidth(3); gr68_cls->Draw("3same"); grmedian_cls->GetXaxis()->SetTitle("M_{1} [GeV]"); grmedian_cls->GetYaxis()->SetTitle("#sigma_{95%} #times BR(G #rightarrow "+VV+") [pb]");// #rightarrow 2l2q grmedian_cls->SetMarkerStyle(24);//25=hollow squre grmedian_cls->SetMarkerColor(kBlack); grmedian_cls->SetLineStyle(2); grmedian_cls->SetLineWidth(3); grmedian_cls->SetMinimum(0.0); grmedian_cls->SetMaximum(8.0); grobslim_cls->SetMarkerColor(kBlack); grobslim_cls->SetMarkerStyle(20);//24=hollow circle // 20 = solid circle grobslim_cls->SetMarkerSize(0.7); grobslim_cls->SetLineStyle(1); grobslim_cls->SetLineWidth(1); grthSM->SetLineColor(kRed); grthSM->SetLineWidth(2); grthSM->SetLineStyle(kSolid); grthSM->SetFillColor(kRed); grthSM->SetFillStyle(3344); grthSM10->SetLineColor(kRed); grthSM10->SetLineWidth(2); grthSM10->SetLineStyle(1); grthSM10->SetLineStyle(kDashed); grthSM10->SetFillColor(kRed); grthSM10->SetFillStyle(3344); grthSM->Draw("L3"); grthSM10->Draw("L3"); grmedian_cls->Draw("L"); if(unblind)grobslim_cls->Draw("LP"); /* TFile *fUnMPlus=new TFile("AsymptoticCLs_UnmatchedPlus_TGraph.root","READ"); TGraph *grobs_ump=(TGraph*)fUnMPlus->Get("LimitObservedCLs"); TGraph *grmedian_ump=(TGraph*)fUnMPlus->Get("LimitExpectedCLs"); grobs_ump->SetName("LimitObs_UnmatchedPlus"); grmedian_ump->SetName("LimitExp_UnmatchedPlus"); grobs_ump->SetMarkerColor(kBlue); grobs_ump->SetLineColor(kBlue); grobs_ump->SetMarkerStyle(25); grmedian_ump->SetMarkerColor(kBlue); grmedian_ump->SetLineColor(kBlue); grmedian_ump->SetMarkerStyle(25); grobs_ump->Draw("P"); grmedian_ump->Draw("L"); */ //draw grid on top of limits gStyle->SetOptStat(0); TH1D* postGrid = new TH1D("postGrid","",1,fr_left,fr_right); postGrid->GetYaxis()->SetRangeUser(fr_down,fr_up); postGrid->Draw("AXIGSAME"); TLine *l1=new TLine(); l1->SetLineStyle(1); l1->SetLineWidth(2.0); l1->SetLineColor(kRed); // l1->DrawLine(200.0,1.0,600.0,1.0); // cMCMC->Update(); cMCMC->RedrawAxis(""); gPad->RedrawAxis(""); // hr->GetYaxis()->DrawClone(); cMCMC->Update(); //more graphics TLegend *leg = new TLegend(.46,.75,.94,.92); // TLegend *leg = new TLegend(.35,.71,.90,.90); leg->SetFillColor(0); leg->SetShadowColor(0); leg->SetTextFont(42); leg->SetTextSize(0.025); // leg->SetBorderMode(0); if(unblind)leg->AddEntry(grobslim_cls, "Asympt. CL_{S} Observed", "LP"); leg->AddEntry(gr68_cls, "Asympt. CL_{S} Expected #pm 1#sigma", "LF"); leg->AddEntry(gr95_cls, "Asympt. CL_{S} Expected #pm 2#sigma", "LF"); leg->AddEntry(grthSM, "#sigma_{TH} x BR(G #rightarrow "+VV+"), #tilde{k}=0.50", "L" );// #rightarrow 2l2q leg->AddEntry(grthSM10, "#sigma_{TH} x BR(G #rightarrow "+VV+"), #tilde{k}=0.20", "L");// #rightarrow 2l2q leg->Draw(); if(useNewStyle){ TPaveText* cmslabel = new TPaveText( 0.145, 0.953, 0.6, 0.975, "brNDC"); cmslabel->SetFillColor(kWhite); cmslabel->SetTextSize(0.038); cmslabel->SetTextAlign(11); cmslabel->SetTextFont(62); cmslabel->SetBorderSize(0); // std::string leftText = "CMS Preliminary 2011"; std::string leftText = "CMS"; std::string units = "fb ^{-1}"; char lumiText[300]; sprintf( lumiText, "%.1f %s", intLumi, units.c_str()); cmslabel->AddText(Form("%s, #sqrt{s} = 8 TeV, %s", leftText.c_str(), lumiText)); //cmslabel->Draw(); TPaveText* label_sqrt = new TPaveText(0.4,0.953,0.96,0.975, "brNDC"); label_sqrt->SetFillColor(kWhite); label_sqrt->SetBorderSize(0); label_sqrt->SetTextSize(0.038); label_sqrt->SetTextFont(62); label_sqrt->SetTextAlign(31); // align right // label_sqrt->AddText("#sqrt{s} = 7 TeV"); label_sqrt->AddText(Form("%s, L = %s at #sqrt{s} = 8 TeV", leftText.c_str(), lumiText)); label_sqrt->Draw(); } else{ TLatex * latex = new TLatex(); latex->SetNDC(); latex->SetTextSize(0.04); latex->SetTextAlign(31); latex->SetTextAlign(11); // align left latex->DrawLatex(0.18, 0.96, "CMS preliminary 2012"); latex->DrawLatex(0.60,0.96,Form("%.1f fb^{-1} at #sqrt{s} = 8 TeV",intLumi)); } TLine *l1b=new TLine(); l1b->SetLineStyle(1); l1b->SetLineWidth(2.0); l1b->SetLineColor(kRed); //l1b->DrawLine(200.0,1.0,600.0,1.0); cMCMC->Update(); // cMCMC->RedrawAxis(""); gPad->RedrawAxis(""); // hr->GetYaxis()->DrawClone(); cMCMC->Update(); cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic.root"); cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic.eps"); cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic.png"); gPad->SetLogy(); cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic_log.eps"); cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic_log.png"); cMCMC->SaveAs("EXOZZ_2l2q_UL_Asymptotic_log.root"); // cMCMC->SaveAs("ClsLimit_1fb.png"); TFile *outfile=new TFile("AsymptoticCLs_TGraph.root","RECREATE"); outfile->cd(); if(unblind)grobslim_cls->Write(); grmedian_cls->Write(); outfile->Close(); }//end main
void HTT_TT_X(bool scaled=true, bool log=false, float min=0., float max=-1., const char* inputfile="root/$HISTFILE", const char* directory="$CATEGORY") { // define common canvas, axes pad styles SetStyle(); gStyle->SetLineStyleString(11,"20 10"); // determine category tag const char* category_extra = ""; if(std::string(directory) == std::string("emu_0jet_low" )){ category_extra = "0 jet, low p_{T}"; } if(std::string(directory) == std::string("emu_0jet_high" )){ category_extra = "0 jet, high p_{T}"; } if(std::string(directory) == std::string("emu_boost_low" )){ category_extra = "1 jet, low p_{T}"; } if(std::string(directory) == std::string("emu_boost_high")){ category_extra = "1 jet, high p_{T}"; } if(std::string(directory) == std::string("emu_vbf" )){ category_extra = "2 jet (VBF)"; } if(std::string(directory) == std::string("emu_nobtag" )){ category_extra = "No B-Tag"; } if(std::string(directory) == std::string("emu_btag" )){ category_extra = "B-Tag"; } const char* dataset; if(std::string(inputfile).find("7TeV")!=std::string::npos){dataset = "CMS Preliminary, ZH#rightarrow#lltau#tau, 4.9 fb^{-1} at 7 TeV";} if(std::string(inputfile).find("8TeV")!=std::string::npos){dataset = "CMS Preliminary, ZH#rightarrowll#tau#tau, 19.4 fb^{-1} at 8 TeV";} #ifdef MSSM if(std::string(inputfile).find("8TeV")!=std::string::npos){dataset = "CMS Preliminary, H#rightarrow#tau#tau, 19.4 fb^{-1} at 8 TeV";} #endif TFile* input = new TFile(inputfile); TH1F* ZZ = refill((TH1F*)input->Get(TString::Format("%s/ZZ" , directory)), "ZZ"); InitHist(ZZ, "", "", kMagenta-10, 1001); TH1F* GGToZZ2L2L = refill((TH1F*)input->Get(TString::Format("%s/GGToZZ2L2L" , directory)), "GGToZZ2L2L"); InitHist(GGToZZ2L2L, "", "", kMagenta-10, 1001); TH1F* Zjets = refill((TH1F*)input->Get(TString::Format("%s/Zjets" , directory)), "Zjets" ); InitHist(Zjets , "", "", kRed + 2, 1001); #ifndef DROP_SIGNAL TH1F* ZH_htt = refill((TH1F*)input->Get(TString::Format("%s/ZH_htt" , directory)+"125"), "ZH_htt" ); InitSignal(ZH_htt); ZH_htt->Scale(SIGNAL_SCALE); TH1F* ZH_hww = refill((TH1F*)input->Get(TString::Format("%s/ZH_hww" , directory)+"125"), "ZH_hww" ); InitSignal(ZH_hww); ZH_hww->Scale(SIGNAL_SCALE); #endif TH1F* data = refill((TH1F*)input->Get(TString::Format("%s/data_obs", directory)), "data", true); InitHist(data, "#bf{m_{#tau#tau} [GeV]}", "#bf{dN/dm_{#tau#tau} [1/GeV]}"); InitData(data); TH1F* ref=(TH1F*)ZZ->Clone("ref"); ref->Add(GGToZZ2L2L); ref->Add(Zjets ); double unscaled[5]; unscaled[0] = ZZ->Integral(); unscaled[1] = GGToZZ2L2L->Integral(); unscaled[2] = Zjets ->Integral(); #ifndef DROP_SIGNAL unscaled[3] = ZH_htt ->Integral(); unscaled[4] = ZH_hww ->Integral(); #endif if(scaled){ rescale(ZZ, 1); rescale(GGToZZ2L2L, 2); rescale(Zjets, 3); #ifndef DROP_SIGNAL rescale(ZH_htt, 4); rescale(ZH_hww, 5); #endif } TH1F* scales[5]; scales[0] = new TH1F("scales-ZZ", "", 5, 0, 5); scales[0]->SetBinContent(1, unscaled[0]>0 ? (ZZ->Integral()/unscaled[0]-1.) : 0.); scales[1] = new TH1F("scales-GGToZZ2L2L", "", 5, 0, 5); scales[1]->SetBinContent(2, unscaled[1]>0 ? (GGToZZ2L2L->Integral()/unscaled[1]-1.) : 0.); scales[2] = new TH1F("scales-Zjets" , "", 5, 0, 5); scales[2]->SetBinContent(3, unscaled[2]>0 ? (Zjets ->Integral()/unscaled[2]-1.) : 0.); #ifndef DROP_SIGNAL scales[3] = new TH1F("scales-ZH_htt" , "", 5, 0, 5); scales[3]->SetBinContent(4, unscaled[3]>0 ? (ZH_htt ->Integral()/unscaled[3]-1.) : 0.); scales[4] = new TH1F("scales-ZH_hww" , "", 5, 0, 5); scales[4]->SetBinContent(5, unscaled[4]>0 ? (ZH_hww ->Integral()/unscaled[4]-1.) : 0.); #endif GGToZZ2L2L->Add(Zjets); ZZ ->Add(GGToZZ2L2L); if(log){ #ifndef DROP_SIGNAL ZH_htt ->Add(ZH_hww ); #endif } else{ #ifndef DROP_SIGNAL ZH_htt ->Add(ZH_hww); #endif } /* mass plot before and after fit */ TCanvas* canv = MakeCanvas("canv", "histograms", 600, 600); canv->cd(); if(log){ canv->SetLogy(1); } #if defined MSSM if(!log){ data->GetXaxis()->SetRange(0, data->FindBin(350)); } else{ data->GetXaxis()->SetRange(0, data->FindBin(1000)); }; #else data->GetXaxis()->SetRange(0, data->FindBin(350)); #endif data->SetNdivisions(505); data->SetMinimum(min); float maxZZ=ZZ->GetBinContent(ZZ->GetMaximumBin()); float maxdata=data->GetBinContent(data->GetMaximumBin()); if (maxdata>maxZZ) data->SetMaximum(1.8*maxdata); else data->SetMaximum(1.8*maxZZ); data->Draw("e"); // TH1F* errorBand = (TH1F*)ZZ ->Clone(); TH1F* errorBand = (TH1F*)Zjets ->Clone(); errorBand ->SetMarkerSize(0); errorBand ->SetFillColor(1); errorBand ->SetFillStyle(3013); errorBand ->SetLineWidth(1); errorBand ->Scale(0.15); for(int idx=0; idx<errorBand->GetNbinsX(); ++idx){ if(errorBand->GetBinContent(idx)>0){ std::cout << "Uncertainties on summed background samples: " << errorBand->GetBinError(idx)/errorBand->GetBinContent(idx) << std::endl; break; } } //if(log){ ZZ ->Draw("histsame"); Zjets->Draw("histsame"); $DRAW_ERROR #ifndef DROP_SIGNAL ZH_htt ->Draw("histsame"); #endif //} //else{ //#ifndef DROP_SIGNAL // ggH ->Draw("histsame"); //#endif // Ztt ->Draw("histsame"); // ttbar->Draw("histsame"); // EWK ->Draw("histsame"); // Fakes->Draw("histsame"); // $DRAW_ERROR // } data->Draw("esame"); canv->RedrawAxis(); // //CMSPrelim(dataset, "#tau_{e}#tau_{#mu}", 0.17, 0.835); CMSPrelim(dataset, "", 0.16, 0.835); TPaveText* chan = new TPaveText(0.20, 0.74+0.061, 0.32, 0.74+0.161, "NDC"); chan->SetBorderSize( 0 ); chan->SetFillStyle( 0 ); chan->SetTextAlign( 12 ); chan->SetTextSize ( 0.05 ); chan->SetTextColor( 1 ); chan->SetTextFont ( 62 ); if (directory=="eett_zh") chan->AddText("#tau#tau"); else chan->AddText("#mu#mu#tau#tau"); chan->Draw(); // // TPaveText* cat = new TPaveText(0.20, 0.68+0.061, 0.32, 0.68+0.161, "NDC"); // cat->SetBorderSize( 0 ); // cat->SetFillStyle( 0 ); // cat->SetTextAlign( 12 ); // cat->SetTextSize ( 0.05 ); // cat->SetTextColor( 1 ); // cat->SetTextFont ( 62 ); // cat->AddText(category_extra); // cat->Draw(); // //#ifdef MSSM // TPaveText* massA = new TPaveText(0.75, 0.48+0.061, 0.85, 0.48+0.161, "NDC"); // massA->SetBorderSize( 0 ); // massA->SetFillStyle( 0 ); // massA->SetTextAlign( 12 ); // massA->SetTextSize ( 0.03 ); // massA->SetTextColor( 1 ); // massA->SetTextFont ( 62 ); // massA->AddText("m_{A}=$MAGeV"); // massA->Draw(); // // TPaveText* tanb = new TPaveText(0.75, 0.44+0.061, 0.85, 0.44+0.161, "NDC"); // tanb->SetBorderSize( 0 ); // tanb->SetFillStyle( 0 ); // tanb->SetTextAlign( 12 ); // tanb->SetTextSize ( 0.03 ); // tanb->SetTextColor( 1 ); // tanb->SetTextFont ( 62 ); // tanb->AddText("tan#beta=$TANB"); // tanb->Draw(); // // TPaveText* scen = new TPaveText(0.75, 0.40+0.061, 0.85, 0.40+0.161, "NDC"); // scen->SetBorderSize( 0 ); // scen->SetFillStyle( 0 ); // scen->SetTextAlign( 12 ); // scen->SetTextSize ( 0.03 ); // scen->SetTextColor( 1 ); // scen->SetTextFont ( 62 ); // scen->AddText("mhmax"); // scen->Draw(); //#endif // //#ifdef MSSM // TLegend* leg = new TLegend(0.45, 0.65, 0.95, 0.90); // SetLegendStyle(leg); // leg->AddEntry(ggH , "#phi#rightarrow#tau#tau" , "L" ); //#else TLegend* leg = new TLegend(0.50, 0.65, 0.95, 0.90); SetLegendStyle(leg); //#ifndef DROP_SIGNAL // if(SIGNAL_SCALE!=1){ leg->AddEntry(ZH_htt , TString::Format("%.0f#timesZH(125 GeV)#rightarrowll#tau#tau", SIGNAL_SCALE) , "L" ); // } // else{ // leg->AddEntry(ggH , "H(125 GeV)#rightarrow#tau#tau" , "L" ); // } //#endif //#endif leg->AddEntry(data , "observed" , "LP"); leg->AddEntry(ZZ , "ZZ" , "F" ); leg->AddEntry(Zjets, "Reducible" , "F" ); // leg->AddEntry(EWK , "electroweak" , "F" ); // leg->AddEntry(Fakes, "QCD" , "F" ); $ERROR_LEGEND leg->Draw(); // ////#ifdef MSSM //// TPaveText* mssm = new TPaveText(0.69, 0.85, 0.90, 0.90, "NDC"); //// mssm->SetBorderSize( 0 ); //// mssm->SetFillStyle( 0 ); //// mssm->SetTextAlign( 12 ); //// mssm->SetTextSize ( 0.03 ); //// mssm->SetTextColor( 1 ); //// mssm->SetTextFont ( 62 ); //// mssm->AddText("(m_{A}=250, tan#beta=5)"); //// mssm->Draw(); ////#else //// TPaveText* mssm = new TPaveText(0.83, 0.85, 0.95, 0.90, "NDC"); //// mssm->SetBorderSize( 0 ); //// mssm->SetFillStyle( 0 ); //// mssm->SetTextAlign( 12 ); //// mssm->SetTextSize ( 0.03 ); //// mssm->SetTextColor( 1 ); //// mssm->SetTextFont ( 62 ); //// mssm->AddText("m_{H}=125"); //// mssm->Draw(); ////#endif // // /* // Ratio Data over MC // */ // TCanvas *canv0 = MakeCanvas("canv0", "histograms", 600, 400); // canv0->SetGridx(); // canv0->SetGridy(); // canv0->cd(); // // TH1F* zero = (TH1F*)ref ->Clone("zero"); zero->Clear(); // TH1F* rat1 = (TH1F*)data->Clone("rat"); // rat1->Divide(Ztt); // for(int ibin=0; ibin<rat1->GetNbinsX(); ++ibin){ // if(rat1->GetBinContent(ibin+1)>0){ // // catch cases of 0 bins, which would lead to 0-alpha*0-1 // rat1->SetBinContent(ibin+1, rat1->GetBinContent(ibin+1)-1.); // } // zero->SetBinContent(ibin+1, 0.); // } // rat1->SetLineColor(kBlack); // rat1->SetFillColor(kGray ); // rat1->SetMaximum(+0.5); // rat1->SetMinimum(-0.5); // rat1->GetYaxis()->CenterTitle(); // rat1->GetYaxis()->SetTitle("#bf{Data/MC-1}"); // rat1->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}"); // rat1->Draw(); // zero->SetLineColor(kBlack); // zero->Draw("same"); // canv0->RedrawAxis(); // // /* // Ratio After fit over Prefit // */ // TCanvas *canv1 = MakeCanvas("canv1", "histograms", 600, 400); // canv1->SetGridx(); // canv1->SetGridy(); // canv1->cd(); // // TH1F* rat2 = (TH1F*) Ztt->Clone("rat2"); // rat2->Divide(ref); // for(int ibin=0; ibin<rat2->GetNbinsX(); ++ibin){ // if(rat2->GetBinContent(ibin+1)>0){ // // catch cases of 0 bins, which would lead to 0-alpha*0-1 // rat2 ->SetBinContent(ibin+1, rat2->GetBinContent(ibin+1)-1.); // } // } // rat2->SetLineColor(kRed+ 3); // rat2->SetFillColor(kRed-10); // rat2->SetMaximum(+0.3); // rat2->SetMinimum(-0.3); // rat2->GetYaxis()->SetTitle("#bf{Fit/Prefit-1}"); // rat2->GetYaxis()->CenterTitle(); // rat2->GetXaxis()->SetTitle("#bf{m_{#tau#tau} [GeV]}"); // rat2->GetXaxis()->SetRange(0, 28); // rat2->Draw(); // zero->SetLineColor(kBlack); // zero->Draw("same"); // canv1->RedrawAxis(); // // /* // Relative shift per sample // */ // TCanvas *canv2 = MakeCanvas("canv2", "histograms", 600, 400); // canv2->SetGridx(); // canv2->SetGridy(); // canv2->cd(); // // InitHist (scales[0], "", "", kMagenta-10, 1001); // InitHist (scales[1], "", "", kRed + 2, 1001); // InitHist (scales[2], "", "", kBlue - 8, 1001); // InitHist (scales[3], "", "", kOrange - 4, 1001); //#ifndef DROP_SIGNAL // InitSignal(scales[4]); // InitSignal(scales[5]); // InitSignal(scales[6]); //#endif // scales[0]->Draw(); // scales[0]->GetXaxis()->SetBinLabel(1, "#bf{Fakes}"); // scales[0]->GetXaxis()->SetBinLabel(2, "#bf{EWK}" ); // scales[0]->GetXaxis()->SetBinLabel(3, "#bf{ttbar}"); // scales[0]->GetXaxis()->SetBinLabel(4, "#bf{Ztt}" ); //#ifdef MSSM // scales[0]->GetXaxis()->SetBinLabel(5, "#bf{ggH}" ); // scales[0]->GetXaxis()->SetBinLabel(6, "#bf{bbH}" ); // scales[0]->GetXaxis()->SetBinLabel(7, "#bf{NONE}" ); //#else // scales[0]->GetXaxis()->SetBinLabel(5, "#bf{ggH}" ); // scales[0]->GetXaxis()->SetBinLabel(6, "#bf{qqH}" ); // scales[0]->GetXaxis()->SetBinLabel(7, "#bf{VH}" ); //#endif // scales[0]->SetMaximum(+1.0); // scales[0]->SetMinimum(-1.0); // scales[0]->GetYaxis()->CenterTitle(); // scales[0]->GetYaxis()->SetTitle("#bf{Fit/Prefit-1}"); // scales[1]->Draw("same"); // scales[2]->Draw("same"); // scales[3]->Draw("same"); //#ifndef DROP_SIGNAL // scales[4]->Draw("same"); // scales[5]->Draw("same"); // scales[6]->Draw("same"); //#endif // zero->Draw("same"); // canv2->RedrawAxis(); // // /* // prepare output // */ bool isSevenTeV = std::string(inputfile).find("7TeV")!=std::string::npos; canv ->Print(TString::Format("%s_%sscaled_%s_%s.png" , directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv ->Print(TString::Format("%s_%sscaled_%s_%s.pdf" , directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); canv ->Print(TString::Format("%s_%sscaled_%s_%s.eps" , directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); // canv0->Print(TString::Format("%s_datamc_%sscaled_%s_%s.png", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); // canv0->Print(TString::Format("%s_datamc_%sscaled_%s_%s.pdf", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); // canv0->Print(TString::Format("%s_datamc_%sscaled_%s_%s.eps", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); // canv1->Print(TString::Format("%s_prefit_%sscaled_%s_%s.png", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); // canv1->Print(TString::Format("%s_prefit_%sscaled_%s_%s.pdf", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); // canv1->Print(TString::Format("%s_prefit_%sscaled_%s_%s.eps", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); // canv2->Print(TString::Format("%s_sample_%sscaled_%s_%s.png", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); // canv2->Print(TString::Format("%s_sample_%sscaled_%s_%s.pdf", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); // canv2->Print(TString::Format("%s_sample_%sscaled_%s_%s.eps", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : "")); TFile* output = new TFile(TString::Format("%s_%sscaled_%s_%s.root", directory, scaled ? "re" : "un", isSevenTeV ? "7TeV" : "8TeV", log ? "LOG" : ""), "update"); output->cd(); data ->Write("data_obs"); ZZ->Write("ZZ" ); Zjets ->Write("Zjets" ); ZH_htt->Write("ZH_htt" ); ZH_hww ->Write("ZH_hww" ); //#ifdef MSSM // ggH ->Write("ggH" ); // bbH ->Write("bbH" ); //#else //#ifndef DROP_SIGNAL // ggH ->Write("ggH" ); // qqH ->Write("qqH" ); // VH ->Write("VH" ); //#endif //#endif if(errorBand){ errorBand->Write("errorBand"); } output->Close(); }