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.6 by anlevin, Wed Jul 18 09:05:38 2012 UTC vs.
Revision 1.7 by anlevin, Wed Jul 18 12:35:27 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 313 | Line 310 | void mithep::ElectronFakeRateMod::Proces
310   }
311  
312  
316
317 unsigned makePFnoPUArray(const mithep::Array<mithep::PFCandidate> * fPFCandidates,
318                         vector<bool> &pfNoPileUpflag,
319                         const mithep::Array<mithep::Vertex>      * vtxArr )
320 {
321  for(UInt_t i = 0; i < fPFCandidates->GetEntries(); i++) {
322    const mithep::PFCandidate *pf = fPFCandidates->At(i);
323    assert(pf);
324
325    if(pf->PFType() == mithep::PFCandidate::eHadron) {
326      if(pf->HasTrackerTrk() &&
327         vtxArr->At(0)->HasTrack(pf->TrackerTrk()) &&
328         vtxArr->At(0)->TrackWeight(pf->TrackerTrk()) > 0) {
329
330        pfNoPileUpflag.push_back(1);
331
332      } else {
333
334        Bool_t vertexFound = kFALSE;
335        const mithep::Vertex *closestVtx = 0;
336        Double_t dzmin = 10000;
337        
338        // loop over vertices
339        for(UInt_t j = 0; j < vtxArr->GetEntries(); j++) {
340          const mithep::Vertex *vtx = vtxArr->At(j);
341          assert(vtx);
342          
343          if(pf->HasTrackerTrk() &&
344             vtx->HasTrack(pf->TrackerTrk()) &&
345             vtx->TrackWeight(pf->TrackerTrk()) > 0) {
346            vertexFound = kTRUE;
347            closestVtx = vtx;
348            break;
349          }
350          Double_t dz = fabs(pf->SourceVertex().Z() - vtx->Z());
351          if(dz < dzmin) {
352            closestVtx = vtx;
353            dzmin = dz;
354          }
355        }
356
357        //      if(fCheckClosestZVertex) {
358        if(1) {
359          // Fallback: if track is not associated with any vertex,
360          // associate it with the vertex closest in z
361          if(vertexFound || closestVtx != vtxArr->At(0)) {
362            //      pfPileUp->Add(pf);
363            pfNoPileUpflag.push_back(0);
364          } else {
365            pfNoPileUpflag.push_back(1);
366          }
367        } else {
368          if(vertexFound && closestVtx != vtxArr->At(0)) {
369            //      pfPileUp->Add(pf);
370            pfNoPileUpflag.push_back(0);
371          } else {
372            //      PFCandidate * pfNoPileUp->AddNew(); // Ridiculous but that's how it is
373            pfNoPileUpflag.push_back(1);
374          }
375        }
376      } //hadron & trk stuff
377    } else { // hadron
378      //      PFCandidate * ptr = pfNoPileUp->AddNew();
379      pfNoPileUpflag.push_back(1);
380    }
381  } // Loop over PF candidates
382
383  return pfNoPileUpflag.size();
384 }
385
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