void turnoncurves() { // Rem. to switch to binomial errors gROOT->SetStyle("Plain"); // Switches off the ROOT default style //gPad->UseCurrentStyle(); // this makes everything black and white, // removing the default red border on images gROOT->ForceStyle(); // forces the style chosen above to be used, // not the style the rootfile was made with gStyle->SetPalette(1); //gPad->UseCurrentStyle(); gStyle->SetOptStat(0); gStyle->SetOptTitle(kFALSE); TCanvas* cc1 = new TCanvas("cc1","Canvas 1"); cc1->cd(); TFile* File1 = TFile::Open("Results.root"); // NNZMMCurl_FitToMeanMass.root //TFile* File2 = TFile::Open("Current_ZMMPerf.root"); TH1* mu10_pt = (TH1*)File1->Get("/Mu_JetMET/tg10rnum"); TH1* mu15_pt = (TH1*)File1->Get("/Mu_JetMET/tg15rnum"); TH1* mu20_pt = (TH1*)File1->Get("/Mu_JetMET/tg20rnum"); TH1* muden_pt = (TH1*)File1->Get("/Mu_JetMET/tgrden"); TH1* trigseln = (TH1*)File1->Get("/Mu_JetMET/trigseln"); TH1* trigseld = (TH1*)File1->Get("/Mu_JetMET/trigseld"); mu10_pt->Sumw2(); mu15_pt->Sumw2(); mu20_pt->Sumw2(); muden_pt->Sumw2(); mu10_pt->Divide(muden_pt); mu10_pt->SetMarkerStyle(22); mu10_pt->SetMarkerColor(50); mu10_pt->GetXaxis()->SetTitle("Track p_{T} (GeV/c)"); mu10_pt->GetYaxis()->SetTitle("L1/L2/HLT Trigger Efficiency"); mu10_pt->SetMinimum(20.0f); // & Maximum() mu10_pt->GetXaxis()->SetRange(0,40); // bins not actual range btw ! mu10_pt->Scale(100.0f); mu10_pt->Draw(); mu15_pt->Divide(muden_pt); mu15_pt->SetMarkerStyle(22); mu15_pt->SetMarkerColor(9); mu15_pt->Scale(100.0f); mu15_pt->Draw("same"); mu20_pt->Divide(muden_pt); mu20_pt->SetMarkerStyle(22); mu20_pt->SetMarkerColor(42); mu20_pt->Scale(100.0f); mu20_pt->Draw("same"); TF1* f1 = new TF1("f1","[0] * (TMath::Erf( (x - [1])/(sqrt(2.0)*[2]) )+1.0)/2.0;",0.0f, 80.0f); f1->SetLineColor(50); f1->SetParameter( 0, 75.0f ); f1->SetParameter( 1, 10.0f ); f1->SetParameter( 2, 1.5f ); mu10_pt->Fit("f1"); //cc1->Print("ZMM_MomAsym_NormCurl.eps"); TF1* f2 = new TF1("f2","[0] * (TMath::Erf( (x - [1])/(sqrt(2.0)*[2]) )+1.0)/2.0;",0.0f, 80.0f); f2->SetLineColor(9); f2->SetParameter( 0, 75.0f ); f2->SetParameter( 1, 15.0f ); f2->SetParameter( 2, 1.5f ); mu15_pt->Fit("f2"); TF1* f3 = new TF1("f3","[0] * (TMath::Erf( (x - [1])/(sqrt(2.0)*[2]) )+1.0)/2.0;",0.0f, 80.0f); f3->SetLineColor(42); f3->SetParameter( 0, 75.0f ); f3->SetParameter( 1, 20.0f ); f3->SetParameter( 2, 1.5f ); mu20_pt->Fit("f3"); mu10_pt->Draw(); mu15_pt->Draw("same"); mu20_pt->Draw("same"); TCanvas* cc2 = new TCanvas("cc2","Canvas 2"); cc2->cd(); trigseln->Divide(trigseld); trigseln->GetYaxis()->SetTitle("L1/L2/HLT Event Trigger Efficiency"); trigseln->SetFillColor(42); trigseln->Draw(); cc2->Update(); //<============ PaintBin ( trigseln, 1, 46 ); PaintBin ( trigseln, 2, 44 ); cc2->RedrawAxis(); //<=========== //TCanvas* cc3 = new TCanvas("cc3","Canvas 3"); //cc3->cd(); //TH1F *h1 = new TH1F("h1","h1",100,-10,10); //h1->FillRandom("gaus"); //h1->Draw(); //PaintBin (h1, 60, kRed); //PaintBin (h1, 50, kBlue); //TMath::Erf(10.0f);// (x-a) / (sqrt(2 )*sigma) } void PaintBin (TH1 *h, Int_t bin, Int_t color) { printf("%d %d %d\n", bin, color, h->GetBinContent(bin)); TBox *b = new TBox( h->GetBinLowEdge(bin), gPad->GetUymin(), h->GetBinWidth(bin)+h->GetBinLowEdge(bin), h->GetBinContent(bin)); b->SetFillColor(color); b->Draw(); }