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

Comparing UserCode/MitHzz4l/NonMCBackground/src/ElectronFakeRateMod.cc (file contents):
Revision 1.5 by dkralph, Mon Jul 9 08:53:53 2012 UTC vs.
Revision 1.8 by anlevin, Wed Sep 12 12:13:26 2012 UTC

# Line 1 | Line 1
1   #include "ElectronFakeRateMod.h"
2 + #include "SelectionFuncs.h"
3  
4  
5   //needed because of externs
# Line 7 | Line 8 | Float_t computePFMuonIso(const mithep::M
8                          const mithep::Vertex * vtx,
9                          const mithep::Array<mithep::PFCandidate> * pfCandidates,
10                          const Double_t dRMax);
10                        
11 unsigned makePFnoPUArray(const mithep::Array<mithep::PFCandidate> * fPFCandidates,
12                         vector<bool> &pfNoPileUpFlag,
13                         const mithep::Array<mithep::Vertex>     * vtxArr );
11                          
12   Bool_t passElectronDenominatorCuts(const mithep::Electron *ele, const mithep::Vertex * vtx, Int_t DenominatorType);
13  
# Line 134 | Line 131 | void mithep::ElectronFakeRateMod::Proces
131    
132    fillTriggerBits( GetHLTTable(), fTrigMask, fTriggerBits );
133    
134 +  PFnoPUflag.clear();
135    makePFnoPUArray(fPFCandidates, PFnoPUflag, fPrimVerts );
136      
137    vector<const Muon*> goodMuons;
# Line 154 | Line 152 | void mithep::ElectronFakeRateMod::Proces
152          fails_some_denominator = kTRUE;
153      }
154  
155 <    if(!fails_some_denominator && electronPOG2012CutBasedIDMedium(ele, fPrimVerts->At(0), fPFCandidates, fConversions, fPileupEnergyDensity))
155 >    if(!fails_some_denominator && electronPOG2012CutBasedIDMedium(ele, fPrimVerts->At(0), fPFCandidates, fConversions, fPileupEnergyDensity->At(0)->RhoLowEta(), mithep::ElectronTools::kEleEAData2011))
156        goodElectrons.push_back(ele);
157    }    
158  
# Line 312 | Line 310 | void mithep::ElectronFakeRateMod::Proces
310   }
311  
312  
315
316 unsigned makePFnoPUArray(const mithep::Array<mithep::PFCandidate> * fPFCandidates,
317                         vector<bool> &pfNoPileUpflag,
318                         const mithep::Array<mithep::Vertex>      * vtxArr )
319 {
320  for(UInt_t i = 0; i < fPFCandidates->GetEntries(); i++) {
321    const mithep::PFCandidate *pf = fPFCandidates->At(i);
322    assert(pf);
323
324    if(pf->PFType() == mithep::PFCandidate::eHadron) {
325      if(pf->HasTrackerTrk() &&
326         vtxArr->At(0)->HasTrack(pf->TrackerTrk()) &&
327         vtxArr->At(0)->TrackWeight(pf->TrackerTrk()) > 0) {
328
329        pfNoPileUpflag.push_back(1);
330
331      } else {
332
333        Bool_t vertexFound = kFALSE;
334        const mithep::Vertex *closestVtx = 0;
335        Double_t dzmin = 10000;
336        
337        // loop over vertices
338        for(UInt_t j = 0; j < vtxArr->GetEntries(); j++) {
339          const mithep::Vertex *vtx = vtxArr->At(j);
340          assert(vtx);
341          
342          if(pf->HasTrackerTrk() &&
343             vtx->HasTrack(pf->TrackerTrk()) &&
344             vtx->TrackWeight(pf->TrackerTrk()) > 0) {
345            vertexFound = kTRUE;
346            closestVtx = vtx;
347            break;
348          }
349          Double_t dz = fabs(pf->SourceVertex().Z() - vtx->Z());
350          if(dz < dzmin) {
351            closestVtx = vtx;
352            dzmin = dz;
353          }
354        }
355
356        //      if(fCheckClosestZVertex) {
357        if(1) {
358          // Fallback: if track is not associated with any vertex,
359          // associate it with the vertex closest in z
360          if(vertexFound || closestVtx != vtxArr->At(0)) {
361            //      pfPileUp->Add(pf);
362            pfNoPileUpflag.push_back(0);
363          } else {
364            pfNoPileUpflag.push_back(1);
365          }
366        } else {
367          if(vertexFound && closestVtx != vtxArr->At(0)) {
368            //      pfPileUp->Add(pf);
369            pfNoPileUpflag.push_back(0);
370          } else {
371            //      PFCandidate * pfNoPileUp->AddNew(); // Ridiculous but that's how it is
372            pfNoPileUpflag.push_back(1);
373          }
374        }
375      } //hadron & trk stuff
376    } else { // hadron
377      //      PFCandidate * ptr = pfNoPileUp->AddNew();
378      pfNoPileUpflag.push_back(1);
379    }
380  } // Loop over PF candidates
381
382  return pfNoPileUpflag.size();
383 }
384
313   std::bitset<1024> mithep::ElectronFakeRateMod::GetHLTMatchBits(const Double_t pt, const Double_t eta, const Double_t phi)
314   {
315    std::bitset<1024> object_bitset;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines