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

Comparing UserCode/MitHzz4l/NonMCBackground/src/MuonFakeRateMod.cc (file contents):
Revision 1.5 by anlevin, Sat Jul 7 13:33:32 2012 UTC vs.
Revision 1.8 by anlevin, Wed Jul 18 12:35:27 2012 UTC

# Line 1 | Line 1
1   #include "MuonFakeRateMod.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);
11 <                        
11 < unsigned makePFnoPUArray(const mithep::Array<mithep::PFCandidate> * fPFCandidates,
12 <                         vector<bool> &pfNoPileUpFlag,
13 <                         const mithep::Array<mithep::Vertex>     * vtxArr );
14 <                        
11 >                                                
12   Bool_t passMuonDenominatorCuts(const mithep::Muon *mu, const mithep::Vertex * vtx, Int_t DenominatorType);
13  
14   string IntToString(int i) {
# Line 128 | Line 125 | void mithep::MuonFakeRateMod::Process()
125    
126    fillTriggerBits( GetHLTTable(), fTrigMask, fTriggerBits );
127    
128 +  PFnoPUflag.clear();
129    makePFnoPUArray(fPFCandidates, PFnoPUflag, fPrimVerts );
130      
131    if(fPFMet->At(0)->Et() >25) return;
# Line 152 | Line 150 | void mithep::MuonFakeRateMod::Process()
150    }
151    for(Int_t i=0; i<fElectrons->GetEntries(); i++) {
152      const Electron *ele = fElectrons->At(i);
153 <    if(electron2012CutBasedIDMedium(ele, fPrimVerts->At(0), fPFCandidates, fConversions, fPileupEnergyDensity)) goodElectrons.push_back(ele);
153 >    if(electronPOG2012CutBasedIDMedium(ele, fPrimVerts->At(0), fPFCandidates, fConversions, fPileupEnergyDensity)) goodElectrons.push_back(ele);
154  
155    }    
156    
# Line 302 | Line 300 | void mithep::MuonFakeRateMod::Process()
300    } //loop over muons
301   }
302  
305 unsigned makePFnoPUArray(const mithep::Array<mithep::PFCandidate> * fPFCandidates,
306                         vector<bool> &pfNoPileUpflag,
307                         const mithep::Array<mithep::Vertex>      * vtxArr )
308 {
309  for(UInt_t i = 0; i < fPFCandidates->GetEntries(); i++) {
310    const mithep::PFCandidate *pf = fPFCandidates->At(i);
311    assert(pf);
312
313    if(pf->PFType() == mithep::PFCandidate::eHadron) {
314      if(pf->HasTrackerTrk() &&
315         vtxArr->At(0)->HasTrack(pf->TrackerTrk()) &&
316         vtxArr->At(0)->TrackWeight(pf->TrackerTrk()) > 0) {
317
318        pfNoPileUpflag.push_back(1);
319
320      } else {
321
322        Bool_t vertexFound = kFALSE;
323        const mithep::Vertex *closestVtx = 0;
324        Double_t dzmin = 10000;
325        
326        // loop over vertices
327        for(UInt_t j = 0; j < vtxArr->GetEntries(); j++) {
328          const mithep::Vertex *vtx = vtxArr->At(j);
329          assert(vtx);
330          
331          if(pf->HasTrackerTrk() &&
332             vtx->HasTrack(pf->TrackerTrk()) &&
333             vtx->TrackWeight(pf->TrackerTrk()) > 0) {
334            vertexFound = kTRUE;
335            closestVtx = vtx;
336            break;
337          }
338          Double_t dz = fabs(pf->SourceVertex().Z() - vtx->Z());
339          if(dz < dzmin) {
340            closestVtx = vtx;
341            dzmin = dz;
342          }
343        }
344
345        //      if(fCheckClosestZVertex) {
346        if(1) {
347          // Fallback: if track is not associated with any vertex,
348          // associate it with the vertex closest in z
349          if(vertexFound || closestVtx != vtxArr->At(0)) {
350            //      pfPileUp->Add(pf);
351            pfNoPileUpflag.push_back(0);
352          } else {
353            pfNoPileUpflag.push_back(1);
354          }
355        } else {
356          if(vertexFound && closestVtx != vtxArr->At(0)) {
357            //      pfPileUp->Add(pf);
358            pfNoPileUpflag.push_back(0);
359          } else {
360            //      PFCandidate * pfNoPileUp->AddNew(); // Ridiculous but that's how it is
361            pfNoPileUpflag.push_back(1);
362          }
363        }
364      } //hadron & trk stuff
365    } else { // hadron
366      //      PFCandidate * ptr = pfNoPileUp->AddNew();
367      pfNoPileUpflag.push_back(1);
368    }
369  } // Loop over PF candidates
370
371  return pfNoPileUpflag.size();
372 }
373
303   std::bitset<1024> mithep::MuonFakeRateMod::GetHLTMatchBits(const Double_t pt, const Double_t eta, const Double_t phi)
304   {
305    std::bitset<1024> object_bitset;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines