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.3 by madfish, Sun Oct 28 15:41:19 2012 UTC

# Line 33 | Line 33 | int kount;
33   int kount2;
34   TString IFILE;
35   int maxCount;
36 std::string massS[51]={
37 "110","110_5","111","111_5","112","112_5","113","113_5","114","114_5",
38 "115","115_5","116","116_5","117","117_5","118","118_5","119","119_5",
39 "120","120_5","121","121_5","122","122_5","123","123_5","124","124_5",
40 "125","125_5","126","126_5","127","127_5","128","128_5","129","129_5",
41 "130","130_5","131","131_5","132","132_5","133","133_5","134","134_5",
42 "135"};
36  
37 + std::string massS[67]={
38 + "110","110.5","111","111.5","112","112.5","113","113.5","114","114.5",
39 + "115","115.5","116","116.5","117","117.5","118","118.5","119","119.5",
40 + "120","120.5","121","121.5","122","122.5","123","123.5","124","124.5",
41 + "125","125.5","126","126.5","127","127.5","128","128.5","129","129.5",
42 + "130","130.5","131","131.5","132","132.5","133","133.5","134","134.5",
43 + "135","124.6","124.7","124.8","124.9","125.1","125.2","125.3","125.4",
44 + "125.6","125.7","125.8","125.9","126.1","126.2","126.3","126.4"
45 + };
46  
47 < void makeSystPlot( TFile * f, TString oldFolder, RooWorkspace *WS,  string channel, string syst, int toMassNo, int fromMassNo) //massNo 0-51, see xSec7TeV.h
47 >
48 >
49 > void makeSystPlot( TFile * f, TString myRooWS, RooWorkspace *WS,  string channel, string syst, int toMassNo, int fromMassNo) //massNo 0-51, see xSec7TeV.h
50   {
51  
52    RooArgList  * hobs = new RooArgList("hobs");
53    RooRealVar BDT("CMS_vhbb_BDT_Wln_8TeV", "CMS_vhbb_BDT_Wln_8TeV", -1, 1);///OLD VARIABLE NAME HERE
54    hobs->add(*WS->var("CMS_vhbb_BDT_Wln_8TeV"));  ///NEW VARIABLE NAME HERE
55 <  RooWorkspace *tempWS =  (RooWorkspace*) f->Get(oldFolder.Data());
55 >  RooWorkspace *tempWS =  (RooWorkspace*) f->Get(myRooWS.Data());
56    TString systT(syst);
57    TString chanT(channel);
58  
# Line 63 | Line 67 | void makeSystPlot( TFile * f, TString ol
67      kount++;
68      std::string namen  = channel;
69      
70 <    std::cout << oldFolder.Data() << std::endl;
70 >    std::cout << myRooWS.Data() << std::endl;
71      std::cout << namen << std::endl;
72      RooDataHist* tempRooDataHistNom = (RooDataHist*)  tempWS->data(namen.c_str());
73      TH1 *tempHistNom = tempRooDataHistNom->createHistogram(namen.c_str(),BDT,Binning(bins));
# Line 82 | Line 86 | void makeSystPlot( TFile * f, TString ol
86  
87    if(syst == "stat")
88    {
89 <   if(oldFolder.Contains("Wen"))
89 >   if(myRooWS.Contains("Wen"))
90     {
91       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_WenuUp";
92       namen  = channel;
# Line 119 | Line 123 | void makeSystPlot( TFile * f, TString ol
123    nameDown = channel + "_CMS_" + syst + "Down";
124    }
125  
126 <  if((syst == "stat") && (oldFolder.Contains("High")))
126 >  if((syst == "stat") && (myRooWS.Contains("High")))
127    {
128 <   if(oldFolder.Contains("Wen"))
128 >   if(myRooWS.Contains("Wen"))
129     {
130       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_Wenu2Up";
131       namen  = channel;
# Line 159 | Line 163 | void makeSystPlot( TFile * f, TString ol
163       nameDown  = channel + "_CMS_vhbb_WModelDown";
164    }
165  
166 <  if( systT.Contains("stat") && (oldFolder.Contains("Wen")) && IFILE.Contains("8TeV") && !(oldFolder.Contains("High")))
166 >  if( systT.Contains("stat") && (myRooWS.Contains("Wen")) && IFILE.Contains("8TeV") && !(myRooWS.Contains("High")))
167    {
168       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_Wenu_8TeVUp";
169       namen  = channel;
# Line 175 | Line 179 | void makeSystPlot( TFile * f, TString ol
179  
180    }
181  
182 <  if( systT.Contains("stat") && (oldFolder.Contains("Wmn")) && IFILE.Contains("8TeV") && !(oldFolder.Contains("High")))
182 >  if( systT.Contains("stat") && (myRooWS.Contains("Wmn")) && IFILE.Contains("8TeV") && !(myRooWS.Contains("High")))
183    {
184       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_Wmunu_8TeVUp";
185       namen  = channel;
# Line 192 | Line 196 | void makeSystPlot( TFile * f, TString ol
196    }
197  
198  
199 <  if( systT.Contains("stat") && (oldFolder.Contains("Wen")) && IFILE.Contains("8TeV") && (oldFolder.Contains("High")))
199 >  if( systT.Contains("stat") && (myRooWS.Contains("Wen")) && IFILE.Contains("8TeV") && (myRooWS.Contains("High")))
200    {
201       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_Wenu2_8TeVUp";
202       namen  = channel;
# Line 208 | Line 212 | void makeSystPlot( TFile * f, TString ol
212  
213    }
214  
215 <  if( systT.Contains("stat") && (oldFolder.Contains("Wmn")) && IFILE.Contains("8TeV") && (oldFolder.Contains("High")))
215 >  if( systT.Contains("stat") && (myRooWS.Contains("Wmn")) && IFILE.Contains("8TeV") && (myRooWS.Contains("High")))
216    {
217       nameUp  = channel + "_CMS_vhbb_stat" + channel + "_Wmunu2_8TeVUp";
218       namen  = channel;
# Line 236 | Line 240 | if(writeIt)
240    RooDataHist* tempRooDataHistNom = (RooDataHist*)  tempWS->data(namen.c_str());
241  
242  
243 <  std::cout << oldFolder.Data() << std::endl;
243 >  std::cout << myRooWS.Data() << std::endl;
244    std::cout << nameUp.c_str() << std::endl;
245    
246  
# Line 297 | Line 301 | if(writeIt)
301  
302  
303  
304 < void Process(TString fname, TString oldFolder, int toMass, int fromMass)
304 > void Process(TString fname, TString myRooWS, int toMass, int fromMass)
305   {
306  
307  
# Line 319 | Line 323 | void Process(TString fname, TString oldF
323    TFile * outfile = new TFile(fname.Data(), "RECREATE");
324  
325    using namespace RooFit;
326 <  RooWorkspace *myWS = new RooWorkspace(oldFolder.Data(),oldFolder.Data());
326 >  RooWorkspace *myWS = new RooWorkspace(myRooWS.Data(),myRooWS.Data());
327    myWS->factory("CMS_vhbb_BDT_Wln_8TeV[-1.,1.]"); ///NEW VARIABLE NAME HERE
328  
329    
# Line 327 | Line 331 | void Process(TString fname, TString oldF
331    {
332       kount2 = 0;  
333      for (int s =0; s<5 ; s++ ){
334 <      makeSystPlot( file, oldFolder, myWS,  channels[c], systs[s], toMass, fromMass );
334 >      makeSystPlot( file, myRooWS, myWS,  channels[c], systs[s], toMass, fromMass );
335      }
336    }
337  
338  
339    if(!(IFILE.Contains("8TeV")))
340    {
341 <  makeSystPlot(file, oldFolder, myWS, "WjLF", "WModel",toMass, fromMass);
342 <  makeSystPlot(file, oldFolder, myWS, "WjHF", "WModel",toMass, fromMass);
341 >  makeSystPlot(file, myRooWS, myWS, "WjLF", "WModel",toMass, fromMass);
342 >  makeSystPlot(file, myRooWS, myWS, "WjHF", "WModel",toMass, fromMass);
343    }
344  
345    myWS->writeToFile(fname.Data());  
# Line 362 | Line 366 | maxCount=0;
366  
367   for(int i = 0; i < n; i++)
368   {
369 <  TString oldFolder;
369 >  TString myRooWS;
370    IFILE = files[i];
371  
372   if(IFILE.Contains("7TeV"))
373   {
374 <  if(IFILE.Contains("Wenu")) oldFolder = "Wenu";
375 <  if(IFILE.Contains("Wmn"))oldFolder = "Wmunu";
374 >  if(IFILE.Contains("Wenu")) myRooWS = "Wenu";
375 >  if(IFILE.Contains("Wmn"))myRooWS = "Wmunu";
376   }
377  
378 <  if(IFILE.Contains ("Wmn") && IFILE.Contains("Low") && IFILE.Contains("8TeV"))  oldFolder = "WmnLowPt_8TeV";
379 <  if(IFILE.Contains ("Wen") && IFILE.Contains("Low") && IFILE.Contains("8TeV"))  oldFolder = "WenLowPt_8TeV";
380 <  if(IFILE.Contains ("Wmn") && IFILE.Contains("High") && IFILE.Contains("8TeV"))  oldFolder = "WmnHighPt_8TeV";
381 <  if(IFILE.Contains ("Wen") && IFILE.Contains("High") && IFILE.Contains("8TeV"))  oldFolder = "WenHighPt_8TeV";
378 >  if(IFILE.Contains ("Wmn") && IFILE.Contains("Low") && IFILE.Contains("8TeV"))  myRooWS = "WmnLowPt_8TeV";
379 >  if(IFILE.Contains ("Wen") && IFILE.Contains("Low") && IFILE.Contains("8TeV"))  myRooWS = "WenLowPt_8TeV";
380 >  if(IFILE.Contains ("Wmn") && IFILE.Contains("High") && IFILE.Contains("8TeV"))  myRooWS = "WmnHighPt_8TeV";
381 >  if(IFILE.Contains ("Wen") && IFILE.Contains("High") && IFILE.Contains("8TeV"))  myRooWS = "WenHighPt_8TeV";
382  
383    if((IFILE.Contains("110")))
384    {
385 <     Process(IFILE, oldFolder, 0,0);
386 <     Process(IFILE, oldFolder, 1,0);
387 <     Process(IFILE, oldFolder, 2,0);
388 <     Process(IFILE, oldFolder, 3,0);
389 <     Process(IFILE, oldFolder, 4,0);
385 >     Process(IFILE, myRooWS, 0,0);
386 >     Process(IFILE, myRooWS, 1,0);
387 >     Process(IFILE, myRooWS, 2,0);
388 >     Process(IFILE, myRooWS, 3,0);
389 >     Process(IFILE, myRooWS, 4,0);
390    }
391    if((IFILE.Contains("115")))
392    {
393 <     for(int to = 5; to < 15; to++)   Process(IFILE, oldFolder, to , 10);
393 >     for(int to = 5; to < 15; to++)   Process(IFILE, myRooWS, to , 10);
394    }
395  
396    if((IFILE.Contains("120")))
397    {
398 <     for(int to = 15; to < 25; to++)   Process(IFILE, oldFolder,to , 20);
398 >     for(int to = 15; to < 25; to++)   Process(IFILE, myRooWS,to , 20);
399    }
400  
401    if((IFILE.Contains("125")))
402    {
403 <     for(int to = 25; to < 35; to++)   Process(IFILE, oldFolder,to , 30);
403 >     for(int to = 25; to < 35; to++)   Process(IFILE, myRooWS,to , 30);
404 >     for(int to = 51; to < 67; to++)   Process(IFILE, myRooWS,to , 30);
405    }
406  
407    if((IFILE.Contains("130")))
408    {
409 <     for(int to = 35; to < 45; to++)   Process(IFILE, oldFolder,to , 40);
409 >     for(int to = 35; to < 45; to++)   Process(IFILE, myRooWS,to , 40);
410    }
411  
412  
413    if((IFILE.Contains("135")))
414    {
415 <     for(int to = 45; to < 51; to++)   Process(IFILE, oldFolder,to , 50);
415 >     for(int to = 45; to < 51; to++)   Process(IFILE, myRooWS,to , 50);
416    }
417  
418    

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines