--- UserCode/rootEWKanalyzer/plotDataMCwSignal.C 2010/07/20 15:32:44 1.2 +++ UserCode/rootEWKanalyzer/plotDataMCwSignal.C 2010/12/21 15:25:39 1.4 @@ -18,11 +18,14 @@ void plotDataMCwSignal(){ char *legMCsigTitle = "W #rightarrow e #nu"; //"Signal"; TString dataset=""; TString overallTitle="CMS preliminary 2010"; - TString CMen="#sqrt{s}=7TeV, #int L = 130 nb^{-1}"; + TString CMen="#sqrt{s}=7TeV, #int L = 890 nb^{-1}"; TString cuts1=""; - TString cuts2=""; - double rebin=2.; + Tstring cuts2=""; + double rebin=1.; bool isptplot; + + bool normalizeToArea=false; + //--------------------------------------------------------------------------- setTDRStyle(); gROOT->ForceStyle(); @@ -77,7 +80,10 @@ void plotDataMCwSignal(){ // } - islog=1; + + cout<<"here"<-1||name.Index(phi)>-1||name.Index(hits)>-1 || name.Index(emf)>-1 || name.Index(CHF)>-1 || name.Index(NHF)>-1|| name.Index(NEF)>-1||name.Index(cons)>-1) islog=0; TH1D * h_data= data->Get(key->GetName()); TH1D * h_mc=mc->Get(key->GetName()); @@ -85,17 +91,21 @@ void plotDataMCwSignal(){ TH1D * h_ttbar=mcTTbar->Get(key->GetName()); TH1D * h_sig=mcSignal->Get(key->GetName()); // only for filled histos -// if( h_mc->GetEntries()!=0) { + if( h_mc->GetEntries()!=0) { + // -// cout<<"here"<SetTitle(overallTitle); +// h_mc->SetTitle(overallTitle); +// h_other->SetTitle(overallTitle); +// h_ttbar->SetTitle(overallTitle); +// h_sig->SetTitle(overallTitle); + + - h_data->SetTitle(overallTitle); - h_mc->SetTitle(overallTitle); - h_other->SetTitle(overallTitle); - h_ttbar->SetTitle(overallTitle); - h_sig->SetTitle(overallTitle); // if(name.Index(pt)>-1) { // h_data->SetYTitle("Jets/GeV"); // h_mc->SetYTitle("Jets/GeV"); @@ -139,21 +149,24 @@ void plotDataMCwSignal(){ // h_mc->Scale(scalefactor); -// h_mc->Rebin(rebin); -// h_sig->Rebin(rebin); -// h_data->Rebin(rebin); + + +// h_mc->Rebin(rebin); +// h_sig->Rebin(rebin); +// h_data->Rebin(rebin); + // h_mc->SetMaximum(1.5*h_data->GetMaximum()); - h_mc->SetFillColor(colour); - h_mc->SetLineColor(1); + h_data->SetMarkerStyle(20); h_other->SetFillColor(8); h_other->SetLineColor(1); h_ttbar->SetFillColor(15); h_ttbar->SetLineColor(1); h_sig->SetFillColor(46); h_sig->SetLineColor(1); - h_data->SetMarkerStyle(20); + h_mc->SetFillColor(colour); + h_mc->SetLineColor(1); // h_data->SetTitle(overallTitle); @@ -165,10 +178,10 @@ void plotDataMCwSignal(){ //draw title - MoveStatsAndDraw(h_data , h_mc, h_other, h_ttbar, h_sig, legDataTitle, legMCTitle, legMCsigTitle, legMCotherTitle, legMCttbarTitle, overallTitle, CMen, islog, colour, false, cuts1, cuts2, isptplot); + MoveStatsAndDraw(h_data , h_mc, h_other, h_ttbar, h_sig, legDataTitle, legMCTitle, legMCsigTitle, legMCotherTitle, legMCttbarTitle, overallTitle, CMen, islog, colour, false, cuts1, cuts2, isptplot, normalizeToArea); char histname [256]; - sprintf (histname, "plotting/%s.gif", key->GetName()); + sprintf (histname, "plottingTest/%s.gif", key->GetName()); // cout<GetName()<SetLogy(log); + if(normalizeToArea) { + double S=sig->Integral(); + double N=mc->Integral(); + double f=1; + if(N!=0) f = S/N; + mc->Scale(f); + other->Scale(f); + ttbar->Scale(f); + sig->Scale(f); + } + + + // maximumData; // double maximumMc; int maximumData=data->GetBinContent(data->GetMaximumBin()); @@ -230,7 +256,8 @@ void MoveStatsAndDraw (TH1 *data, TH1 *m // if(data->GetBinContent(data->GetMaximum())GetBinContent(mc->GetMaximum())) { if(maximumDataSetMaximum(maximumMc * 1.6); +// sig->SetMaximum(maximumMc * 2.5); + mc->SetMaximum(maximumMc * 2.5); if(log==1) sig->SetMinimum(0.0001); if(log==0) sig->SetMinimum(0.); mc->Draw(""); @@ -240,7 +267,7 @@ void MoveStatsAndDraw (TH1 *data, TH1 *m data->Draw("pe1sames"); } else { - data->SetMaximum(maximumData * 1.6); + data->SetMaximum(maximumData * 2.5); if(log==1) data->SetMinimum(0.0001); if(log==0) data->SetMinimum(0.); data->Draw("pe1");