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