// Draw label for Decay Channel in upper left corner of plot void DrawPrelimLabel(int cmsprelim, double textSize) { TPaveText *cms = new TPaveText(); cms->AddText("CMS"); cms->SetX1NDC( gStyle->GetPadLeftMargin() + gStyle->GetTickLength() ); cms->SetY1NDC(1.0 - gStyle->GetPadTopMargin() - gStyle->GetTickLength() - 0.05 ); cms->SetX2NDC( gStyle->GetPadLeftMargin() + gStyle->GetTickLength() + 0.15 ); cms->SetY2NDC(1.0 - gStyle->GetPadTopMargin() - gStyle->GetTickLength() ); cms->SetFillStyle(0); cms->SetBorderSize(0); if (textSize!=0) cms->SetTextSize(textSize*1.1); cms->SetTextAlign(12); cms->SetTextFont(61); cms->Draw("same"); if(cmsprelim > 0) { TPaveText *extra = new TPaveText(); if(cmsprelim == 2) { extra->AddText("Private Work"); } else { extra->AddText("Preliminary"); } extra->SetX1NDC( gStyle->GetPadLeftMargin() + gStyle->GetTickLength() ); extra->SetY1NDC(1.0 - gStyle->GetPadTopMargin() - gStyle->GetTickLength() - 0.10 ); extra->SetX2NDC( gStyle->GetPadLeftMargin() + gStyle->GetTickLength() + 0.15 ); extra->SetY2NDC(1.0 - gStyle->GetPadTopMargin() - gStyle->GetTickLength() - 0.05 ); extra->SetFillStyle(0); extra->SetBorderSize(0); if (textSize!=0) extra->SetTextSize(textSize); extra->SetTextAlign(12); extra->SetTextFont(52); extra->Draw("same"); } }
void formatForCmsPublic(TPad * c, TLegend *leg, TString title, int nsamp, float legx, float legy, float legw, float legh, TString legopt) { if(title.Length()!=0) { TPaveText *pave = new TPaveText(0.5,0.96,0.94,0.99,"NDC"); pave->SetBorderSize(0); pave->SetFillStyle(0); pave->SetTextAlign(32); pave->SetTextFont(42); TObjArray * tokens = title.Tokenize("\\\\"); int nt = tokens->GetEntries(); for(int it=0; it<nt; ++it) { TObjString * t = (TObjString *)tokens->At(it); pave->AddText(t->GetString()); } pave->Draw("same"); } float legx1=legx, legx2=legx+legw; float legy1 = legy, legy2 = legy-legh*(float)(nsamp); if(leg==0) leg = ((TPad *)c)->BuildLegend(legx1,legy1,legx2,legy2); leg->SetBorderSize(0); leg->SetFillColor(0); leg->SetFillStyle(0); leg->SetLineWidth(1); leg->SetTextFont(42); leg->SetEntryOption(legopt); leg->SetX1NDC(legx1); leg->SetY1NDC(legy1);//-nsamp*legh); leg->SetX2NDC(legx2); leg->SetY2NDC(legy2); }
void makeScaleFactorHist(TCanvas* canvas, const std::string& name, const std::string& tag) { TMultiGraph* multigraph = NULL; std::stringstream graphName; graphName << name << "ScaleFactorMultigraph"; multigraph = (TMultiGraph*)canvas->GetPrimitive(graphName.str().c_str()); if (multigraph == NULL) { std::cerr << "Error: no object of TCanvas " << canvas->GetName() << " with name "; std::cerr << graphName.str() << std::endl; return; } multigraph->GetYaxis()->SetRangeUser(0.3, 1.7); multigraph->GetYaxis()->SetLabelSize(0.03); canvas->Draw(); canvas->SetCanvasSize(600,600); canvas->SetWindowSize(610,630); TPaveText* label = new TPaveText(0.25, 0.8, 0.55, 0.9, "NDC"); label->SetTextFont(62); label->SetTextSize(0.03); label->SetBorderSize(0); label->SetFillColor(0); label->AddText("CMS 2011"); label->AddText(""); label->AddText("#int L dt = 204 pb^{-1}"); label->SetTextAlign(11); label->Draw(); std::stringstream file; file << "/data2/yohay/scaleFactor_" << tag << "_" << name << ".pdf"; canvas->SaveAs(file.str().c_str()); }
void help() { new TCanvas("chelp","Help on gldemos",200,10,700,600); TPaveLabel *title = new TPaveLabel(0.04, 0.86, 0.96, 0.98, "These demos show different gl painters."); title->SetFillColor(32); title->Draw(); TPaveText *hdemo = new TPaveText(0.04, 0.04, 0.96, 0.8); hdemo->SetTextAlign(12); hdemo->SetTextFont(52); hdemo->SetTextColor(kBlue); hdemo->AddText("1. Glsurfaces demo shows glsurf4, glsurf1, glsurf3, glsurf1cyl, glsurfpol, gltf3 options."); hdemo->AddText("2. Glrose demontrates \"glsurf2pol\" drawing option and user-defined palette."); hdemo->AddText("3. Gltf3 demo shows \"gltf3\" option."); hdemo->AddText("4. Glbox demo shows \"glbox\" and \"glbox1\" options for TH3."); hdemo->AddText("5. Glparametric demo shows how to define and display parametric surfaces."); hdemo->AddText("You can zoom any plot: press 'J', 'K', 'j', 'k' keys, or use mouse wheel."); hdemo->AddText("Rotate any plot:"); hdemo->AddText(" ---select plot with mouse cursor,"); hdemo->AddText(" ---move mouse cursor, pressing and holding left mouse button "); hdemo->AddText("Pan plot:"); hdemo->AddText(" ---select with mouse cursor a part of a plot, other than back box planes ,"); hdemo->AddText(" ---move mouse cursor, pressing and holding middle mouse button "); hdemo->AddText("Selected part of a plot is higlighted (TF3 higlighting is not implemented yet.)"); hdemo->AddText("You can select one of back box planes, press middle mouse button and move cursor-"); hdemo->AddText("this will create \"slice\" (TF does not support yet)."); hdemo->AddText("After the slice was created, you can project it on a back box"); hdemo->AddText(" ---press key 'p' (now implemented only for surf options )."); hdemo->AddText("Left double click removes all slices/projections."); hdemo->Draw(); }
void tpcanalspectra(Int_t isec =1, Int_t r1= 2) { AliTPCParam * tpcparam = gtpc->GetParam(); //make window for displaying results TCanvas * c_occu = new TCanvas("occuhis","Occupancy dependence",700,900); c_occu->Update(); TPad * pad1 = new TPad("ocpad1","occupancy1",0.05,0.61,0.95,0.95,21); pad1->Draw(); TPad * pad2 = new TPad("ocpad2","occupancy",0.05,0.61,0.95,0.95,21); pad2->Draw(); TPad * pad3 = new TPad("ocpad3","occupancy1",0.05,0.25,0.95,0.60,21); pad3->Draw(); TPad * pad4 = new TPad("ocpad4","occupancy",0.05,0.25,0.95,0.60,21); pad4->Draw(); //add comments to the histograms TPaveText * comment = new TPaveText(0.05,0.03,0.95,0.2,"NDC"); comment->SetTextAlign(12); comment->SetFillColor(42); comment->ReadFile("comment.txt"); comment->Draw(); TH2F his //prepare histogram for (Int_t i=1;i<irow;i+=lstep) { tpcanal(isec,i,10,&res[0],kFALSE,tmin); } //plot occupancy histogram pad1->SetGridx(); pad1->SetGridy(); }
// Draw statistics info above plot void DrawCMSLabels(double lumi, double energy, double textSize) { //const char *text = "%2.1f #times 10^{6} clusters (fiducial) (%1.1f GeV)"; const char *text; if(lumi > 10000000) { lumi /= 10000000; text = "%2.1f #times 10^{7} tracks (%1.1f GeV)"; } else { lumi /= 1000000; text = "%2.1f #times 10^{6} tracks (%1.1f GeV)"; } 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, lumi, energy)); label->SetFillStyle(0); label->SetBorderSize(0); if (textSize!=0) label->SetTextSize(textSize); label->SetTextAlign(32); label->Draw("same"); }
void labels1() { Int_t i; const Int_t nx = 20; const char *people[nx] = {"Jean","Pierre","Marie","Odile", "Sebastien","Fons","Rene","Nicolas","Xavier","Greg", "Bjarne","Anton","Otto","Eddy","Peter","Pasha", "Philippe","Suzanne","Jeff","Valery"}; TCanvas *c1 = new TCanvas("c1","demo bin labels",10,10,900,500); c1->SetGrid(); c1->SetBottomMargin(0.15); TH1F *h = new TH1F("h","test",nx,0,nx); h->SetFillColor(38); for (i=0;i<5000;i++) h->Fill(gRandom->Gaus(0.5*nx,0.2*nx)); h->SetStats(0); for (i=1;i<=nx;i++) h->GetXaxis()->SetBinLabel(i,people[i-1]); h->Draw(); TPaveText *pt = new TPaveText(0.6,0.7,0.98,0.98,"brNDC"); pt->SetFillColor(18); pt->SetTextAlign(12); pt->AddText("Use the axis Context Menu LabelsOption"); pt->AddText(" \"a\" to sort by alphabetic order"); pt->AddText(" \">\" to sort by decreasing values"); pt->AddText(" \"<\" to sort by increasing values"); pt->Draw(); }
void DrawStatBox(TObject** Histos, std::vector<char*> legend, bool Mean, double X, double Y, double W, double H) { int N = legend.size(); char buffer[255]; if(Mean)H*=3; for(int i=0;i<N;i++){ TPaveText* stat = new TPaveText(X,Y-(i*H), X+W, Y-(i+1)*H, "NDC"); TH1* Histo = (TH1*)Histos[i]; sprintf(buffer,"Entries : %i\n",(int)Histo->GetEntries()); stat->AddText(buffer); if(Mean){ sprintf(buffer,"Mean : %6.2f\n",Histo->GetMean()); stat->AddText(buffer); sprintf(buffer,"RMS : %6.2f\n",Histo->GetRMS()); stat->AddText(buffer); } stat->SetFillColor(0); stat->SetLineColor(Color[i]); stat->SetTextColor(Color[i]); stat->SetBorderSize(0); stat->SetMargin(0.05); stat->SetTextAlign(12); stat->Draw(); } }
// 1-D histograms with alphanumeric labels // author; Rene Brun TCanvas *hlabels1() { const Int_t nx = 20; const char *people[nx] = {"Jean","Pierre","Marie","Odile","Sebastien", "Fons","Rene","Nicolas","Xavier","Greg","Bjarne","Anton","Otto", "Eddy","Peter","Pasha","Philippe","Suzanne","Jeff","Valery"}; TCanvas *c1 = new TCanvas("c1","demo bin labels",10,10,900,500); c1->SetGrid(); c1->SetTopMargin(0.15); TH1F *h = new TH1F("h","test",3,0,3); h->SetStats(0); h->SetFillColor(38); h->SetCanExtend(TH1::kAllAxes); for (Int_t i=0;i<5000;i++) { Int_t r = gRandom->Rndm()*20; h->Fill(people[r],1); } h->LabelsDeflate(); h->Draw(); TPaveText *pt = new TPaveText(0.7,0.85,0.98,0.98,"brNDC"); pt->SetFillColor(18); pt->SetTextAlign(12); pt->AddText("Use the axis Context Menu LabelsOption"); pt->AddText(" \"a\" to sort by alphabetic order"); pt->AddText(" \">\" to sort by decreasing values"); pt->AddText(" \"<\" to sort by increasing values"); pt->Draw(); return c1; }
void s_intersection() { gROOT->GetListOfCanvases()->Delete(); TCanvas *c = new TCanvas("composite shape", "Intersection 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 TGeoBBox *box = new TGeoBBox("bx", 40., 40., 40.); TGeoSphere *sph = new TGeoSphere("sph", 40., 45.); // 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 * bx"); TGeoVolume *vol = new TGeoVolume("COMP2",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("----- Here is an example of boolean intersection operation : A * B"); pt->AddText("----- A == sphere (with inner radius non-zero), B == box"); 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 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(); }
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; }
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 OnlineGUI::BadDraw(TString errMessage) { // Routine to display (in Pad) why a particular draw method has // failed. TPaveText *pt = new TPaveText(0.1,0.1,0.9,0.9,"brNDC"); pt->SetBorderSize(3); pt->SetFillColor(10); pt->SetTextAlign(22); pt->SetTextFont(72); pt->SetTextColor(2); pt->AddText(errMessage.Data()); pt->Draw(); // cout << errMessage << endl; }
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; }
// 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"); }
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; }
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* 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 tpcdraw(Int_t sec, Int_t row, Int_t pad) { gStyle->SetOptStat(0); //calculate occupancy for selected sector and pad row //for selected pad is obtained signal shape Double_t par[3]; gtpc.SetSecRowTime(sec,row); gtpc.SetHisto(pad); gtpc.Draw("box"); //plot histograms with specified options //move pads to another position be possible add text gtpc.GetPad1().SetPad(0.05,0.72,0.95,0.95); gtpc.GetPad2().SetPad(0.05,0.47,0.95,0.70); gtpc.GetPad3().SetPad(0.05,0.22,0.95,0.45); //fit histogram of occupancy on specified range <150,500> gtpc.GetPad2().cd(); g1 = new TF1("pol0_r","pol0",150,500); gtpc.GetHis3()->Fit("pol0_r","R0Q"); g1->GetParameters(&par[0]); Float_t error = g1->GetParError(0); fitText = new TPaveText(0.15,0.7,0.3,0.9,"NDC"); fitText->AddText("p0 fit on interval <150-500>"); char s[100]; sprintf(s,"%0.3f+- %0.3f",par[0],error); fitText->AddText(s); fitText->Draw(); gtpc.GetPad2().Update(); //set logarithmic gtpc.GetPad3().cd(); gtpc.GetPad3().SetLogy(); gtpc.GetPad3().Draw(); //add comments to the histograms gtpc.GetCanvas().cd(); TPaveText * comment = new TPaveText(0.05,0.03,0.95,0.2,"NDC"); comment->SetTextAlign(12); comment->SetFillColor(42); comment->ReadFile("comment.txt"); comment->Draw(); gtpc.GetCanvas().Update(); }
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"); }
TCanvas *hlabels2() { const Int_t nx = 12; const Int_t ny = 20; const char *month[nx] = {"January","February","March","April","May", "June","July","August","September","October","November", "December"}; const char *people[ny] = {"Jean","Pierre","Marie","Odile","Sebastien", "Fons","Rene","Nicolas","Xavier","Greg","Bjarne","Anton", "Otto","Eddy","Peter","Pasha","Philippe","Suzanne","Jeff", "Valery"}; TCanvas *c1 = new TCanvas("c1","demo bin labels",10,10,600,600); c1->SetGrid(); c1->SetLeftMargin(0.15); c1->SetBottomMargin(0.15); TH2F *h = new TH2F("h","test",3,0,3,2,0,2); h->SetCanExtend(TH1::kAllAxes); h->SetStats(0); gRandom->SetSeed(); for (Int_t i=0;i<15000;i++) { Int_t rx = gRandom->Rndm()*nx; Int_t ry = gRandom->Rndm()*ny; h->Fill(people[ry],month[rx],1); } h->LabelsDeflate("X"); h->LabelsDeflate("Y"); h->LabelsOption("v"); h->Draw("text"); TPaveText *pt = new TPaveText(0.6,0.85,0.98,0.98,"brNDC"); pt->SetFillColor(18); pt->SetTextAlign(12); pt->AddText("Use the axis Context Menu LabelsOption"); pt->AddText(" \"a\" to sort by alphabetic order"); pt->AddText(" \">\" to sort by decreasing values"); pt->AddText(" \"<\" to sort by increasing values"); pt->Draw(); return c1; }
/// /// 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 RooToyMCFit(){ stringstream out; out.str(""); out << "toyMC_" << _sigma_over_tau << "_" << _purity << "_" << mistag_rate << ".root"; TFile* file = TFile::Open(out.str().c_str()); TTree* tree = (TTree*)file->Get("ToyTree"); tree->Print(); // TFile* file = TFile::Open("ToyData/toyMC_453_0.912888_0.3_0.8_0.root"); // TFile* file = TFile::Open("ToyData/toyMC_10000_0.9_0.3_0.8_0.root"); // TTree* tree = (TTree*)file->Get("ToyTree1"); RooRealVar tau("tau","tau",_tau,"ps"); tau.setConstant(kTRUE); RooRealVar dm("dm","dm",_dm,"ps^{-1}"); dm.setConstant(kTRUE); RooAbsReal* sin2beta; RooAbsReal* cos2beta; if(softlimit){ RooRealVar x("x","x",_cos2beta,-3.,30000.); if(constBeta) x.setConstant(kTRUE); RooRealVar y("y","y",_sin2beta,-3.,30000.); if(constBeta) y.setConstant(kTRUE); cos2beta = new RooFormulaVar("cos2beta","cos2beta","@0/sqrt(@0*@0+@1*@1)",RooArgSet(x,y)); sin2beta = new RooFormulaVar("sin2beta","sin2beta","@0/sqrt(@0*@0+@1*@1)",RooArgSet(y,x)); // sin2beta = new RooFormulaVar("sin2beta","sin2beta","2/TMath::Pi()*TMath::ATan(@0)",RooArgSet(y)); // cos2beta = new RooFormulaVar("cos2beta","cos2beta","2/TMath::Pi()*TMath::ATan(@0)",RooArgSet(x)); } else{ sin2beta = new RooRealVar("sin2beta","sin2beta",_sin2beta,-3.,3.); if(constBeta) ((RooRealVar*)sin2beta)->setConstant(kTRUE); cos2beta = new RooRealVar("cos2beta","cos2beta",_cos2beta,-3.,3.); if(constBeta) ((RooRealVar*)cos2beta)->setConstant(kTRUE); } RooRealVar dt("dt","#Deltat",-5.,5.,"ps"); RooRealVar avgMisgat("avgMisgat","avgMisgat",mistag_rate,0.0,0.5); if(constMistag) avgMisgat.setConstant(kTRUE); RooRealVar delMisgat("delMisgat","delMisgat",0); delMisgat.setConstant(kTRUE); RooRealVar mu("mu","mu",0); mu.setConstant(kTRUE); tau.Print(); dm.Print(); sin2beta->Print(); cos2beta->Print(); avgMisgat.Print(); RooRealVar moment("moment","moment",0.); moment.setConstant(kTRUE); RooRealVar parity("parity","parity",-1.); parity.setConstant(kTRUE); RooRealVar* K[8]; RooAbsReal* Kb[8]; RooArgList Kset; RooRealVar* C[8]; RooRealVar* S[8]; RooFormulaVar* a1[2][8]; RooFormulaVar* b1[2][8]; RooFormulaVar* a2[2][8]; RooFormulaVar* b2[2][8]; for(int i=0; i<8; i++){ out.str(""); out << "K" << i+1; K[i] = new RooRealVar(out.str().c_str(),out.str().c_str(),_K[i],0.,1.); Kset.add(*K[i]); if(constK) K[i]->setConstant(kTRUE); K[i]->Print(); if(i!=7){ out.str(""); out << "Kb" << i+1; Kb[i] = new RooRealVar(out.str().c_str(),out.str().c_str(),_Kb[i],0.,1.); Kset.add(*Kb[i]); if(constK) ((RooRealVar*)Kb[i])->setConstant(kTRUE); Kb[i]->Print(); } out.str(""); out << "C" << i+1; C[i] = new RooRealVar(out.str().c_str(),out.str().c_str(),_C[i]); C[i]->setConstant(kTRUE); C[i]->Print(); out.str(""); out << "S" << i+1; S[i] = new RooRealVar(out.str().c_str(),out.str().c_str(),_S[i]); S[i]->setConstant(kTRUE); S[i]->Print(); } Kb[7] = new RooFormulaVar("K8b","K8b","1-@0-@1-@2-@3-@4-@5-@6-@7-@8-@9-@10-@11-@12-@13-@14",Kset); for(int i=0; i<8; i++){ out.str(""); out << "a10_" << i+1; a1[0][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"-(@0-@1)/(@0+@1)",RooArgList(*K[i],*Kb[i])); a1[0][i]->Print(); out.str(""); out << "a11_" << i+1; a1[1][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"(@0-@1)/(@0+@1)",RooArgList(*K[i],*Kb[i])); a1[1][i]->Print(); out.str(""); out << "a20_" << i+1; a2[0][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"(@0-@1)/(@0+@1)",RooArgList(*K[i],*Kb[i])); a2[0][i]->Print(); out.str(""); out << "a21_" << i+1; a2[1][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"-(@0-@1)/(@0+@1)",RooArgList(*K[i],*Kb[i])); a2[1][i]->Print(); out.str(""); out << "b10_" << i+1; b1[0][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"2.*(@2*@4+@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1)",RooArgList(*K[i],*Kb[i],*C[i],*S[i],*sin2beta,*cos2beta)); b1[0][i]->Print(); out.str(""); out << "b11_" << i+1; b1[1][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"2.*(@2*@4-@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1)",RooArgList(*K[i],*Kb[i],*C[i],*S[i],*sin2beta,*cos2beta)); b1[1][i]->Print(); out.str(""); out << "b20_" << i+1; b2[0][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"-2.*(@2*@4+@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1)",RooArgList(*K[i],*Kb[i],*C[i],*S[i],*sin2beta,*cos2beta)); b2[0][i]->Print(); out.str(""); out << "b21_" << i+1; b2[1][i] = new RooFormulaVar(out.str().c_str(),out.str().c_str(),"-2.*(@2*@4-@3*@5)*TMath::Sqrt(@0*@1)/(@0+@1)",RooArgList(*K[i],*Kb[i],*C[i],*S[i],*sin2beta,*cos2beta)); b2[1][i]->Print(); cout << "bin = " << i+1 << endl; cout << " a11 = " << a1[0][i]->getVal() << " b11 = " << b1[0][i]->getVal() << endl; cout << " a12 = " << a1[1][i]->getVal() << " b12 = " << b1[1][i]->getVal() << endl; cout << " a21 = " << a2[0][i]->getVal() << " b21 = " << b2[0][i]->getVal() << endl; cout << " a22 = " << a2[1][i]->getVal() << " b22 = " << b2[1][i]->getVal() << endl; } RooRealVar* dgamma = new RooRealVar("dgamma","dgamma",0.); dgamma->setConstant(kTRUE); RooRealVar* f0 = new RooRealVar("f0","f0",1.); f0->setConstant(kTRUE); RooRealVar* f1 = new RooRealVar("f1","f1",0.); f1->setConstant(kTRUE); RooCategory tag("tag","tag"); tag.defineType("B0",1); tag.defineType("anti-B0",-1); RooCategory bin("bin","bin"); bin.defineType("1",1); bin.defineType("2",2); bin.defineType("3",3); bin.defineType("4",4); bin.defineType("5",5); bin.defineType("6",6); bin.defineType("7",7); bin.defineType("8",8); bin.defineType("-1",-1); bin.defineType("-2",-2); bin.defineType("-3",-3); bin.defineType("-4",-4); bin.defineType("-5",-5); bin.defineType("-6",-6); bin.defineType("-7",-7); bin.defineType("-8",-8); RooSuperCategory bintag("bintag","bintag",RooArgSet(bin,tag)); tree->Print(); RooDataSet d("data","data",tree,RooArgSet(dt,bin,tag)); cout << "DataSet is ready." << endl; d.Print(); RooRealVar mean("mean","mean",0.,"ps"); mean.setConstant(kTRUE); RooRealVar sigma("sigma","sigma",_sigma_over_tau*_tau,0.,1.5*_tau,"ps"); if(constSigma) sigma.setConstant(kTRUE); RooGaussModel rf("rf","rf",dt,mean,sigma); // RooTruthModel rf("rf","rf",dt); RooGaussian rfpdf("rfpdf","rfpdf",dt,mean,sigma); cout << "Preparing PDFs..." << endl; // RooRealVar* fsigs1[8]; // RooRealVar* fsigs1b[8]; // RooRealVar* fsigs2[8]; // RooRealVar* fsigs2b[8]; RooBDecay* sigpdfs1[8]; RooBDecay* sigpdfs1b[8]; RooBDecay* sigpdfs2[8]; RooBDecay* sigpdfs2b[8]; RooAddPdf* PDFs1[8]; RooAddPdf* PDFs1b[8]; RooAddPdf* PDFs2[8]; RooAddPdf* PDFs2b[8]; RooAddPdf* pdfs1[8]; RooAddPdf* pdfs1b[8]; RooAddPdf* pdfs2[8]; RooAddPdf* pdfs2b[8]; RooSimultaneous pdf("pdf","pdf",bintag); RooRealVar fsig("fsig","fsig",_purity,0.,1.); if(constFSig) fsig.setConstant(kTRUE); fsig.Print(); for(int j=0; j<8; j++){ // out.str(""); // out << "fsig1" << j+1; // fsigs1[j] = new RooRealVar(out.str().c_str(),out.str().c_str(),_purity,0.,1.); if(constFSig) fsigs1[j]->setConstant(kTRUE); // out.str(""); // out << "fsig1b" << j+1; // fsigs1b[j] = new RooRealVar(out.str().c_str(),out.str().c_str(),_purity,0.,1.); if(constFSig) fsigs1b[j]->setConstant(kTRUE); // out.str(""); // out << "fsig2" << j+1; // fsigs2[j] = new RooRealVar(out.str().c_str(),out.str().c_str(),_purity,0.,1.); if(constFSig) fsigs2[j]->setConstant(kTRUE); // out.str(""); // out << "fsig2b" << j+1; // fsigs2b[j] = new RooRealVar(out.str().c_str(),out.str().c_str(),_purity,0.,1.); if(constFSig) fsigs2b[j]->setConstant(kTRUE); out.str(""); out << "sigpdf1" << j+1; sigpdfs1[j] = new RooBDecay(out.str().c_str(),out.str().c_str(),dt,tau,*dgamma,*f0,*f1,*a1[0][j],*b1[0][j],dm,rf,RooBDecay::DoubleSided); out.str(""); out << "sigpdf1b" << j+1; sigpdfs1b[j] = new RooBDecay(out.str().c_str(),out.str().c_str(),dt,tau,*dgamma,*f0,*f1,*a1[1][j],*b1[1][j],dm,rf,RooBDecay::DoubleSided); out.str(""); out << "sigpdf2" << j+1; sigpdfs2[j] = new RooBDecay(out.str().c_str(),out.str().c_str(),dt,tau,*dgamma,*f0,*f1,*a2[0][j],*b2[0][j],dm,rf,RooBDecay::DoubleSided); out.str(""); out << "sigpdf2b" << j+1; sigpdfs2b[j] = new RooBDecay(out.str().c_str(),out.str().c_str(),dt,tau,*dgamma,*f0,*f1,*a2[1][j],*b2[1][j],dm,rf,RooBDecay::DoubleSided); out.str(""); out << "PDF1" << j+1; PDFs1[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*sigpdfs1[j],rfpdf),RooArgList(fsig)); out.str(""); out << "PDF1b" << j+1; PDFs1b[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*sigpdfs1b[j],rfpdf),RooArgList(fsig)); out.str(""); out << "PDF2" << j+1; PDFs2[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*sigpdfs2[j],rfpdf),RooArgList(fsig)); out.str(""); out << "PDF2b" << j+1; PDFs2b[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*sigpdfs2b[j],rfpdf),RooArgList(fsig)); //Adding mistaging out.str(""); out << "pdf1" << j+1; pdfs1[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*PDFs2[j],*PDFs1[j]),RooArgList(avgMisgat)); out.str(""); out << "pdf1b" << j+1; pdfs1b[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*PDFs2b[j],*PDFs1b[j]),RooArgList(avgMisgat)); out.str(""); out << "pdf2" << j+1; pdfs2[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*PDFs1[j],*PDFs2[j]),RooArgList(avgMisgat)); out.str(""); out << "pdf2b" << j+1; pdfs2b[j] = new RooAddPdf(out.str().c_str(),out.str().c_str(),RooArgList(*PDFs1b[j],*PDFs2b[j]),RooArgList(avgMisgat)); out.str(""); out << "{" << j+1 << ";B0}"; pdf.addPdf(*pdfs1[j],out.str().c_str()); out.str(""); out << "{" << -(j+1) << ";B0}"; pdf.addPdf(*pdfs1b[j],out.str().c_str()); out.str(""); out << "{" << j+1 << ";anti-B0}"; pdf.addPdf(*pdfs2[j],out.str().c_str()); out.str(""); out << "{" << -(j+1) << ";anti-B0}"; pdf.addPdf(*pdfs2b[j],out.str().c_str()); } cout << "Fitting..." << endl; pdf.fitTo(d,Verbose(),Timer()); dt.setBins(50); cout << "Drawing plots." << endl; for(int i=0; i<8; i++){ RooPlot* dtFrame = dt.frame(); out.str(""); out << "tag == 1 && bin == " << i+1; RooDataSet* ds = d.reduce(out.str().c_str()); ds->plotOn(dtFrame,DataError(RooAbsData::SumW2),MarkerSize(1),Cut(out.str().c_str()),MarkerColor(kBlue)); out.str(""); out << "{" << j+1 << ";B0}"; bintag = out.str().c_str(); pdf.plotOn(dtFrame,ProjWData(*ds),Slice(bintag),LineColor(kBlue)); double chi2 = dtFrame->chiSquare(); out.str(""); out << "tag == -1 && bin == " << i+1; RooDataSet* dsb = d.reduce(out.str().c_str()); dsb->plotOn(dtFrame,DataError(RooAbsData::SumW2),MarkerSize(1),Cut(out.str().c_str()),MarkerColor(kRed)); out.str(""); out << "{" << j+1 << ";anti-B0}"; bintag = out.str().c_str(); pdf.plotOn(dtFrame,ProjWData(*dsb),Slice(bintag),LineColor(kRed)); double chi2b = dtFrame->chiSquare(); out.str(""); out << "#Delta t, toy MC, bin == " << i+1; TCanvas* cm = new TCanvas(out.str().c_str(),out.str().c_str(),600,400); cm->cd(); dtFrame->GetXaxis()->SetTitleSize(0.05); dtFrame->GetXaxis()->SetTitleOffset(0.85); dtFrame->GetXaxis()->SetLabelSize(0.05); dtFrame->GetYaxis()->SetTitleOffset(1.6); TPaveText *ptB = new TPaveText(0.7,0.65,0.98,0.99,"brNDC"); ptB->SetFillColor(0); ptB->SetTextAlign(12); out.str(""); out << "bin = " << (i+1); ptB->AddText(out.str().c_str()); out.str(""); out << "#chi^{2}(B^{0}) = " << chi2; ptB->AddText(out.str().c_str()); out.str(""); out << "#chi^{2}(#barB^{0}) = " << chi2b; ptB->AddText(out.str().c_str()); out.str(""); out << "#sigma/#tau = " << _sigma_over_tau; ptB->AddText(out.str().c_str()); out.str(""); out << "purity = " << _purity; ptB->AddText(out.str().c_str()); out.str(""); out << "mistag = " << mistag_rate; ptB->AddText(out.str().c_str()); dtFrame->Draw(); ptB->Draw(); out.str(""); out << "../Reports/cpfitfigs/dt_bin" << (i+1) << ".root"; cm->Print(out.str().c_str()); out.str(""); out << "../Reports/cpfitfigs/dt_bin" << (i+1) << ".png"; cm->Print(out.str().c_str()); } for(int i=0; i<8; i++){ RooPlot* dtFrame = dt.frame(); out.str(""); out << "tag == 1 && bin == " << -(i+1); RooDataSet* ds2 = (RooDataSet*)d.reduce(out.str().c_str()); ds2->plotOn(dtFrame,DataError(RooAbsData::SumW2),MarkerSize(1),Cut(out.str().c_str()),MarkerColor(kBlue)); out.str(""); out << "{" << -(j+1) << ";B0}"; bintag = out.str().c_str(); pdf.plotOn(dtFrame,ProjWData(*ds2),Slice(bintag),LineColor(kBlue)); double chi2 = dtFrame->chiSquare(); out.str(""); out << "tag == -1 && bin == " << -(i+1); RooDataSet* ds2b = (RooDataSet*)d.reduce(out.str().c_str()); ds2b->plotOn(dtFrame,DataError(RooAbsData::SumW2),MarkerSize(1),Cut(out.str().c_str()),MarkerColor(kRed)); out.str(""); out << "{" << -(j+1) << ";anti-B0}"; bin = out.str().c_str(); pdf.plotOn(dtFrame,ProjWData(*ds2b),Slice(bintag),LineColor(kRed)); double chi2b = dtFrame->chiSquare(); out.str(""); out << "#Delta t, toy MC, bin == " << -(i+1); TCanvas* cm = new TCanvas(out.str().c_str(),out.str().c_str(),600,400); cm->cd(); dtFrame->GetXaxis()->SetTitleSize(0.05); dtFrame->GetXaxis()->SetTitleOffset(0.85); dtFrame->GetXaxis()->SetLabelSize(0.05); dtFrame->GetYaxis()->SetTitleOffset(1.6); TPaveText *ptB = new TPaveText(0.7,0.65,0.98,0.99,"brNDC"); ptB->SetFillColor(0); ptB->SetTextAlign(12); out.str(""); out << "bin = " << -(i+1); ptB->AddText(out.str().c_str()); out.str(""); out << "#chi^{2}(B^{0}) = " << chi2; ptB->AddText(out.str().c_str()); out.str(""); out << "#chi^{2}(#barB^{0}) = " << chi2b; ptB->AddText(out.str().c_str()); out.str(""); out << "#sigma/#tau = " << _sigma_over_tau; ptB->AddText(out.str().c_str()); out.str(""); out << "purity = " << _purity; ptB->AddText(out.str().c_str()); out.str(""); out << "mistag = " << mistag_rate; ptB->AddText(out.str().c_str()); dtFrame->Draw(); ptB->Draw(); out.str(""); out << "../Reports/cpfitfigs/dt_bin" << -(i+1) << ".root"; cm->Print(out.str().c_str()); out.str(""); out << "../Reports/cpfitfigs/dt_bin" << -(i+1) << ".png"; cm->Print(out.str().c_str()); } return; }