ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Shapes/macros/makeShape.C
(Generate patch)

Comparing UserCode/MitHzz4l/Shapes/macros/makeShape.C (file contents):
Revision 1.1 by dkralph, Fri Dec 2 16:58:47 2011 UTC vs.
Revision 1.2 by dkralph, Fri Dec 2 17:09:03 2011 UTC

# Line 1 | Line 1
1 + //
2 + // make up and down m4l shapes from mcfm and powheg inputs.
3 + //
4 +
5   #if !defined(__CINT__) || defined(__MAKECINT__)
6   #include <TROOT.h>                   // access to gROOT, entry point to ROOT system
7   #include <TLegend.h>
# Line 20 | Line 24
24   TCanvas *c1 = new TCanvas("c1","c1");
25   vector<float> masses, widths;
26   map <TString,TString> binstrings;
27 + void formatBins();
28 + TH1F *getMCFM(TString mass, TString process, TString production, TString updown);
29 + TH1F *getPowheg(TString mass, TString process, TString production);
30 + void Draw_em(map<TString,TH1F*> hists, TString proc, TString production, TString mass);
31 + TH1F* makeRatio(TH1F *hm, TH1F *hpowheg);
32 + void writeHists(map<TString,TH1F*> hists, TString process, TString production, TString mass);
33 + void shapeficator(TString proc, TString production, TString mass);
34 + //----------------------------------------------------------------------------------------
35 + // main
36 + //----------------------------------------------------------------------------------------
37 + void makeShape()
38 + {
39 +  formatBins();
40 +  shapeficator("zz","gg","115");
41 +  shapeficator("zz","other","115");
42 +  for(unsigned i=0; i<masses.size(); i++) {
43 +    stringstream ss;
44 +    ss << masses[i];
45 +    shapeficator("higgs","gg",ss.str());
46 +  }
47 + }
48 +
49 + //----------------------------------------------------------------------------------------
50 + // functions
51   //----------------------------------------------------------------------------------------
52   void formatBins()
53   {
# Line 43 | Line 71 | void formatBins()
71    masses.push_back(500);
72    masses.push_back(600);
73  
74 +  // higgs mass widths
75    widths.push_back(0.0166566);
76    widths.push_back(0.0185038);
77    widths.push_back(0.0259764);
# Line 61 | Line 90 | void formatBins()
90    widths.push_back(266.492  );
91    widths.push_back(379.294  );
92  
93 +  // make strings of bin config (x,x,x) for each higgs mass
94    stringstream ss;
95    for(unsigned i=0; i<masses.size(); i++) {
96      float mass = masses[i];
# Line 181 | Line 211 | void Draw_em(map<TString,TH1F*> hists, T
211   //----------------------------------------------------------------------------------------
212   TH1F* makeRatio(TH1F *hm, TH1F *hpowheg)
213   {
214 +  // make ratio of hm/powheg
215    TH1F *ratio = new TH1F(*hm);
216    ratio->Divide(hm,hpowheg);
217    for(int ibin=0; ibin<hm->GetNbinsX()+2; ibin++) {
# Line 190 | Line 221 | TH1F* makeRatio(TH1F *hm, TH1F *hpowheg)
221    return ratio;
222   }
223   //----------------------------------------------------------------------------------------
193 TH1F* makeOppo(TH1F *hm, TH1F *hpowheg)
194 {
195  TH1F *hoppo = new TH1F(*hm);
196  for(int ibin=0; ibin<hm->GetNbinsX()+2; ibin++) {
197    float powheg = hpowheg->GetBinContent(ibin);
198    float mcfm   = hm->GetBinContent(ibin);
199    hoppo->SetBinContent(ibin,2*powheg - mcfm);
200  }
201
202  return hoppo;
203 }
204 //----------------------------------------------------------------------------------------
224   void writeHists(map<TString,TH1F*> hists, TString process, TString production, TString mass)
225   {
226    TString fname;
# Line 217 | Line 236 | void writeHists(map<TString,TH1F*> hists
236   //----------------------------------------------------------------------------------------
237   void shapeficator(TString proc, TString production, TString mass)
238   {
239 +  // draw histograms from ntuples, make ratio hists, make plots, and write hists to file
240    map<TString,TH1F*> hists;
241    hists["hm_def"]  = getMCFM(mass,proc,production,"def");      // mcfm shape
242    hists["hm_lo"]   = getMCFM(mass,proc,production,"lo");       // mcfm shape
# Line 229 | Line 249 | void shapeficator(TString proc, TString
249    Draw_em(hists,proc,production,mass);
250    writeHists(hists,proc,production,mass);
251   }
232 //----------------------------------------------------------------------------------------
233 // main
234 //----------------------------------------------------------------------------------------
235 void makeShape()
236 {
237  formatBins();
238  shapeficator("zz","gg","115");
239  shapeficator("zz","other","115");
240  for(unsigned i=0; i<masses.size(); i++) {
241    stringstream ss;
242    ss << masses[i];
243    shapeficator("higgs","gg",ss.str());
244  }
245 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines