// -*- C++ -*- // // File: envelopes2_make.C // Package: BtocStudies // Module: Root // // Description: Plot data histogram(s) with MC envelopes // // Implementation: // // // Author: Thomas Meyer // Created: Tue Oct 12 11:38:06 EDT 2004 // $Id$ // // Revision history // // $Log$ // ******************************************************************** // SYSTEM INCLUDE FILES // USER INCLUDE FILES { // Create nominal histogram int numbins = 20; TH1F* nom = new TH1F("nom", "nom", numbins, 0, 1); TRandom* rand = new TRandom(); for (int j = 1; j <= numbins; ++j) { nom->SetBinContent(j, rand->Rndm()-0.5); nom->SetBinError(j, 0.5); } // Create envelopes to compare against data TH1F* envHi = new TH1F("envhi", "envhi", numbins, 0, 1); TH1F* envLo = new TH1F("envhi", "envhi", numbins, 0, 1); for (int j = 1; j <= numbins; ++j) { double y = nom->GetBinContent(j); double ey = nom->GetBinError(j); envHi->SetBinContent(j, y+ey); envLo->SetBinContent(j, y-ey); } nom->SetMinimum(-2); nom->SetMaximum(2); envHi->SetLineStyle(2); envHi->SetLineColor(kRed); envHi->SetFillColor(19); envLo->SetLineStyle(2); envLo->SetLineColor(kRed); envLo->SetFillColor(10); nom->Draw(); envHi->Draw("hist same"); envLo->Draw("hist same"); nom->Draw("same"); // This almost works // nom->Draw(); // envHi->Draw("hist same lf2"); // envLo->Draw("hist same lf2"); // nom->Draw("same"); }