ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/VHbbAnalysis/additionalFiles/DataCards/IntermediateMassMakerWH.C
(Generate patch)

Comparing UserCode/VHbbAnalysis/additionalFiles/DataCards/IntermediateMassMakerWH.C (file contents):
Revision 1.1 by madfish, Thu Oct 11 09:47:34 2012 UTC vs.
Revision 1.2 by madfish, Sat Oct 27 20:34:50 2012 UTC

# Line 42 | Line 42 | std::string massS[51]={
42   "135"};
43  
44  
45 < void makeSystPlot( TFile * f, TString oldFolder, RooWorkspace *WS,  string channel, string syst, int toMassNo, int fromMassNo) //massNo 0-51, see xSec7TeV.h
45 > void makeSystPlot( TFile * f, TString myRooWS, RooWorkspace *WS,  string channel, string syst, int toMassNo, int fromMassNo) //massNo 0-51, see xSec7TeV.h
46   {
47  
48    RooArgList  * hobs = new RooArgList("hobs");
49    RooRealVar BDT("CMS_vhbb_BDT_Wln_8TeV", "CMS_vhbb_BDT_Wln_8TeV", -1, 1);///OLD VARIABLE NAME HERE
50    hobs->add(*WS->var("CMS_vhbb_BDT_Wln_8TeV"));  ///NEW VARIABLE NAME HERE
51 <  RooWorkspace *tempWS =  (RooWorkspace*) f->Get(oldFolder.Data());
51 >  RooWorkspace *tempWS =  (RooWorkspace*) f->Get(myRooWS.Data());
52    TString systT(syst);
53    TString chanT(channel);
54  
# Line 63 | Line 63 | void makeSystPlot( TFile * f, TString ol
63      kount++;
64      std::string namen  = channel;
65      
66 <    std::cout << oldFolder.Data() << std::endl;
66 >    std::cout << myRooWS.Data() << std::endl;
67      std::cout << namen << std::endl;
68      RooDataHist* tempRooDataHistNom = (RooDataHist*)  tempWS->data(namen.c_str());
69      TH1 *tempHistNom = tempRooDataHistNom->createHistogram(namen.c_str(),BDT,Binning(bins));
# Line 82 | Line 82 | void makeSystPlot( TFile * f, TString ol
82  
83    if(syst == "stat")
84    {
85 <   if(oldFolder.Contains("Wen"))
85 >   if(myRooWS.Contains("Wen"))
86     {
87       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_WenuUp";
88       namen  = channel;
# Line 119 | Line 119 | void makeSystPlot( TFile * f, TString ol
119    nameDown = channel + "_CMS_" + syst + "Down";
120    }
121  
122 <  if((syst == "stat") && (oldFolder.Contains("High")))
122 >  if((syst == "stat") && (myRooWS.Contains("High")))
123    {
124 <   if(oldFolder.Contains("Wen"))
124 >   if(myRooWS.Contains("Wen"))
125     {
126       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_Wenu2Up";
127       namen  = channel;
# Line 159 | Line 159 | void makeSystPlot( TFile * f, TString ol
159       nameDown  = channel + "_CMS_vhbb_WModelDown";
160    }
161  
162 <  if( systT.Contains("stat") && (oldFolder.Contains("Wen")) && IFILE.Contains("8TeV") && !(oldFolder.Contains("High")))
162 >  if( systT.Contains("stat") && (myRooWS.Contains("Wen")) && IFILE.Contains("8TeV") && !(myRooWS.Contains("High")))
163    {
164       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_Wenu_8TeVUp";
165       namen  = channel;
# Line 175 | Line 175 | void makeSystPlot( TFile * f, TString ol
175  
176    }
177  
178 <  if( systT.Contains("stat") && (oldFolder.Contains("Wmn")) && IFILE.Contains("8TeV") && !(oldFolder.Contains("High")))
178 >  if( systT.Contains("stat") && (myRooWS.Contains("Wmn")) && IFILE.Contains("8TeV") && !(myRooWS.Contains("High")))
179    {
180       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_Wmunu_8TeVUp";
181       namen  = channel;
# Line 192 | Line 192 | void makeSystPlot( TFile * f, TString ol
192    }
193  
194  
195 <  if( systT.Contains("stat") && (oldFolder.Contains("Wen")) && IFILE.Contains("8TeV") && (oldFolder.Contains("High")))
195 >  if( systT.Contains("stat") && (myRooWS.Contains("Wen")) && IFILE.Contains("8TeV") && (myRooWS.Contains("High")))
196    {
197       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_Wenu2_8TeVUp";
198       namen  = channel;
# Line 208 | Line 208 | void makeSystPlot( TFile * f, TString ol
208  
209    }
210  
211 <  if( systT.Contains("stat") && (oldFolder.Contains("Wmn")) && IFILE.Contains("8TeV") && (oldFolder.Contains("High")))
211 >  if( systT.Contains("stat") && (myRooWS.Contains("Wmn")) && IFILE.Contains("8TeV") && (myRooWS.Contains("High")))
212    {
213       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_Wmunu2_8TeVUp";
214       namen  = channel;
# Line 236 | Line 236 | if(writeIt)
236    RooDataHist* tempRooDataHistNom = (RooDataHist*)  tempWS->data(namen.c_str());
237  
238  
239 <  std::cout << oldFolder.Data() << std::endl;
239 >  std::cout << myRooWS.Data() << std::endl;
240    std::cout << nameUp.c_str() << std::endl;
241    
242  
# Line 297 | Line 297 | if(writeIt)
297  
298  
299  
300 < void Process(TString fname, TString oldFolder, int toMass, int fromMass)
300 > void Process(TString fname, TString myRooWS, int toMass, int fromMass)
301   {
302  
303  
# Line 319 | Line 319 | void Process(TString fname, TString oldF
319    TFile * outfile = new TFile(fname.Data(), "RECREATE");
320  
321    using namespace RooFit;
322 <  RooWorkspace *myWS = new RooWorkspace(oldFolder.Data(),oldFolder.Data());
322 >  RooWorkspace *myWS = new RooWorkspace(myRooWS.Data(),myRooWS.Data());
323    myWS->factory("CMS_vhbb_BDT_Wln_8TeV[-1.,1.]"); ///NEW VARIABLE NAME HERE
324  
325    
# Line 327 | Line 327 | void Process(TString fname, TString oldF
327    {
328       kount2 = 0;  
329      for (int s =0; s<5 ; s++ ){
330 <      makeSystPlot( file, oldFolder, myWS,  channels[c], systs[s], toMass, fromMass );
330 >      makeSystPlot( file, myRooWS, myWS,  channels[c], systs[s], toMass, fromMass );
331      }
332    }
333  
334  
335    if(!(IFILE.Contains("8TeV")))
336    {
337 <  makeSystPlot(file, oldFolder, myWS, "WjLF", "WModel",toMass, fromMass);
338 <  makeSystPlot(file, oldFolder, myWS, "WjHF", "WModel",toMass, fromMass);
337 >  makeSystPlot(file, myRooWS, myWS, "WjLF", "WModel",toMass, fromMass);
338 >  makeSystPlot(file, myRooWS, myWS, "WjHF", "WModel",toMass, fromMass);
339    }
340  
341    myWS->writeToFile(fname.Data());  
# Line 362 | Line 362 | maxCount=0;
362  
363   for(int i = 0; i < n; i++)
364   {
365 <  TString oldFolder;
365 >  TString myRooWS;
366    IFILE = files[i];
367  
368   if(IFILE.Contains("7TeV"))
369   {
370 <  if(IFILE.Contains("Wenu")) oldFolder = "Wenu";
371 <  if(IFILE.Contains("Wmn"))oldFolder = "Wmunu";
370 >  if(IFILE.Contains("Wenu")) myRooWS = "Wenu";
371 >  if(IFILE.Contains("Wmn"))myRooWS = "Wmunu";
372   }
373  
374 <  if(IFILE.Contains ("Wmn") && IFILE.Contains("Low") && IFILE.Contains("8TeV"))  oldFolder = "WmnLowPt_8TeV";
375 <  if(IFILE.Contains ("Wen") && IFILE.Contains("Low") && IFILE.Contains("8TeV"))  oldFolder = "WenLowPt_8TeV";
376 <  if(IFILE.Contains ("Wmn") && IFILE.Contains("High") && IFILE.Contains("8TeV"))  oldFolder = "WmnHighPt_8TeV";
377 <  if(IFILE.Contains ("Wen") && IFILE.Contains("High") && IFILE.Contains("8TeV"))  oldFolder = "WenHighPt_8TeV";
374 >  if(IFILE.Contains ("Wmn") && IFILE.Contains("Low") && IFILE.Contains("8TeV"))  myRooWS = "WmnLowPt_8TeV";
375 >  if(IFILE.Contains ("Wen") && IFILE.Contains("Low") && IFILE.Contains("8TeV"))  myRooWS = "WenLowPt_8TeV";
376 >  if(IFILE.Contains ("Wmn") && IFILE.Contains("High") && IFILE.Contains("8TeV"))  myRooWS = "WmnHighPt_8TeV";
377 >  if(IFILE.Contains ("Wen") && IFILE.Contains("High") && IFILE.Contains("8TeV"))  myRooWS = "WenHighPt_8TeV";
378  
379    if((IFILE.Contains("110")))
380    {
381 <     Process(IFILE, oldFolder, 0,0);
382 <     Process(IFILE, oldFolder, 1,0);
383 <     Process(IFILE, oldFolder, 2,0);
384 <     Process(IFILE, oldFolder, 3,0);
385 <     Process(IFILE, oldFolder, 4,0);
381 >     Process(IFILE, myRooWS, 0,0);
382 >     Process(IFILE, myRooWS, 1,0);
383 >     Process(IFILE, myRooWS, 2,0);
384 >     Process(IFILE, myRooWS, 3,0);
385 >     Process(IFILE, myRooWS, 4,0);
386    }
387    if((IFILE.Contains("115")))
388    {
389 <     for(int to = 5; to < 15; to++)   Process(IFILE, oldFolder, to , 10);
389 >     for(int to = 5; to < 15; to++)   Process(IFILE, myRooWS, to , 10);
390    }
391  
392    if((IFILE.Contains("120")))
393    {
394 <     for(int to = 15; to < 25; to++)   Process(IFILE, oldFolder,to , 20);
394 >     for(int to = 15; to < 25; to++)   Process(IFILE, myRooWS,to , 20);
395    }
396  
397    if((IFILE.Contains("125")))
398    {
399 <     for(int to = 25; to < 35; to++)   Process(IFILE, oldFolder,to , 30);
399 >     for(int to = 25; to < 35; to++)   Process(IFILE, myRooWS,to , 30);
400    }
401  
402    if((IFILE.Contains("130")))
403    {
404 <     for(int to = 35; to < 45; to++)   Process(IFILE, oldFolder,to , 40);
404 >     for(int to = 35; to < 45; to++)   Process(IFILE, myRooWS,to , 40);
405    }
406  
407  
408    if((IFILE.Contains("135")))
409    {
410 <     for(int to = 45; to < 51; to++)   Process(IFILE, oldFolder,to , 50);
410 >     for(int to = 45; to < 51; to++)   Process(IFILE, myRooWS,to , 50);
411    }
412  
413    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines