ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/MitHzz4l/Selection/src/SelectionFuncs.cc
(Generate patch)

Comparing UserCode/MitHzz4l/Selection/src/SelectionFuncs.cc (file contents):
Revision 1.4 by khahn, Wed Jun 20 17:40:22 2012 UTC vs.
Revision 1.5 by khahn, Wed Jun 20 19:17:30 2012 UTC

# Line 9 | Line 9 | extern vector<vector<unsigned> > zzcutve
9   extern map<unsigned,float>       evtrhoMap;
10   extern bool passes_HLT_MC;
11  
12 + extern TH1D* hpu_2011;
13 + extern TH1D* hpu_2012;
14 +
15   //----------------------------------------------------------------------------
16   bool setPV(ControlFlags ctrl,
17             const mithep::Array<mithep::Vertex> * vtxArr,
# Line 246 | Line 249 | void initEvtRhoMap( map<unsigned, float>
249    cout << " done" << endl;
250   }
251  
252 + //----------------------------------------------------------------------------------------
253   void setEra(string fname, ControlFlags &ctrl)
254   {
255 + //----------------------------------------------------------------------------------------
256    if( ctrl.mc && (fname.find("f11-") != string::npos)  ) ctrl.era=2011 ;
257    if( ctrl.mc && (fname.find("s12-") != string::npos)  ) ctrl.era=2012 ;
258    if( !ctrl.mc && (fname.find("r11-") != string::npos)  ) ctrl.era=2011 ;
259    if( !ctrl.mc && (fname.find("r12-") != string::npos)  ) ctrl.era=2012 ;
260   }
261 +
262   //----------------------------------------------------------------------------------------
263   int getNPU(mithep::Array<mithep::PileupInfo> *puArr, int bx)
264 + //----------------------------------------------------------------------------------------
265   {
266  
267    cout << "size of puarr: " << puArr->GetEntries() << endl;
# Line 276 | Line 283 | int getNPU(mithep::Array<mithep::PileupI
283  
284    return -1;
285   }
286 +
287 +
288 + //----------------------------------------------------------------------------
289 + void initPUWeights()
290 + //----------------------------------------------------------------------------
291 + {
292 +  TFile * puf;
293 +
294 +  puf= new TFile("data/PileupReweighting.Summer11DYmm_To_Full2011.root");
295 +  hpu_2011 = (TH1D*)(puf->Get("puWeights"));
296 +  hpu_2011->SetDirectory(0);
297 +  puf->Close();
298 +
299 +  puf = new TFile("data/PUWeights_S12To2012_1616ipb_from_valentina.root");
300 +  hpu_2012 = (TH1D*)(puf->Get("puWeights"));
301 +  hpu_2012->SetDirectory(0);
302 +  puf->Close();
303 + }
304 +
305 + //----------------------------------------------------------------------------
306 + double getPUWeight(unsigned era,unsigned npu)
307 + //----------------------------------------------------------------------------
308 + {
309 +  if( era == 2011 )
310 +    return hpu_2011->GetBinContent(hpu_2011->FindBin(npu));
311 +  else if (era == 2012 )
312 +    return hpu_2012->GetBinContent(hpu_2012->FindBin(npu));
313 +  else return 1;
314 + }
315 +

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines