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.1 by anlevin, Wed Jul 4 18:27:27 2012 UTC vs.
Revision 1.10 by dkralph, Tue Oct 23 12:43:31 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 30 | Line 27 | const Float_t g_muon_mass = 105.658369e-
27  
28   void mithep::MuonFakeRateMod::SlaveBegin()
29   {
30 +
31    denominatorType.push_back(1);
32    denominatorType.push_back(2);
33  
# Line 85 | Line 83 | void mithep::MuonFakeRateMod::SlaveBegin
83    }
84    
85    rlrm.AddJSONFile("/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions12/8TeV/Prompt/Cert_190456-194479_8TeV_PromptReco_Collisions12_JSON.txt");
86 +
87   }
88  
89   void mithep::MuonFakeRateMod::SlaveTerminate()
# Line 126 | 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 143 | Line 143 | void mithep::MuonFakeRateMod::Process()
143      if ( //maybe you should do a loop to make sure the muon passes all of the denominators? right now this is ok because 2 is tighter...
144          passMuonDenominatorCuts(mu, fPrimVerts->At(0), denominatorType[1])
145          &&
146 <        muon2012CutBasedIDTight(mu,fPrimVerts->At(0),fPFCandidates,fPileupEnergyDensity)          
146 >        muonPOG2012CutBasedIDTight(mu,fPrimVerts->At(0),fPFCandidates,fPileupEnergyDensity)      
147          )  
148        goodMuons.push_back(mu);
149      
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->At(0)->RhoLowEta(), mithep::ElectronTools::kEleEAData2011)) goodElectrons.push_back(ele);
154 >    assert(0); // doesn't compile
155  
156    }    
157    
# Line 290 | Line 291 | void mithep::MuonFakeRateMod::Process()
291          if(!muonIDPFSelection(ctrl,  mu, fPrimVerts->At(0), fPFCandidates ).looseID()) passNumerator = kFALSE;
292          if(fabs(mu->Ip3dPVSignificance()) > 4) passNumerator = kFALSE;  
293          if(!muonReferenceIsoSelection(ctrl,mu,fPrimVerts->At(0),fPFCandidates,fPileupEnergyDensity,eraMu,photonsToVeto).passLooseIso()) passNumerator = kFALSE;                
294 <        
295 <        if (passNumerator)
295 <          fake_muon_pass[denominatorTypeIndex] = passNumerator ? 1 : 0;
294 >      
295 >        fake_muon_pass[denominatorTypeIndex] = passNumerator ? 1 : 0;
296          
297          fOutputTrees[denominatorTypeIndex]->Fill();
298          
# Line 301 | Line 301 | void mithep::MuonFakeRateMod::Process()
301    } //loop over muons
302   }
303  
304 unsigned makePFnoPUArray(const mithep::Array<mithep::PFCandidate> * fPFCandidates,
305                         vector<bool> &pfNoPileUpflag,
306                         const mithep::Array<mithep::Vertex>      * vtxArr )
307 {
308  for(UInt_t i = 0; i < fPFCandidates->GetEntries(); i++) {
309    const mithep::PFCandidate *pf = fPFCandidates->At(i);
310    assert(pf);
311
312    if(pf->PFType() == mithep::PFCandidate::eHadron) {
313      if(pf->HasTrackerTrk() &&
314         vtxArr->At(0)->HasTrack(pf->TrackerTrk()) &&
315         vtxArr->At(0)->TrackWeight(pf->TrackerTrk()) > 0) {
316
317        pfNoPileUpflag.push_back(1);
318
319      } else {
320
321        Bool_t vertexFound = kFALSE;
322        const mithep::Vertex *closestVtx = 0;
323        Double_t dzmin = 10000;
324        
325        // loop over vertices
326        for(UInt_t j = 0; j < vtxArr->GetEntries(); j++) {
327          const mithep::Vertex *vtx = vtxArr->At(j);
328          assert(vtx);
329          
330          if(pf->HasTrackerTrk() &&
331             vtx->HasTrack(pf->TrackerTrk()) &&
332             vtx->TrackWeight(pf->TrackerTrk()) > 0) {
333            vertexFound = kTRUE;
334            closestVtx = vtx;
335            break;
336          }
337          Double_t dz = fabs(pf->SourceVertex().Z() - vtx->Z());
338          if(dz < dzmin) {
339            closestVtx = vtx;
340            dzmin = dz;
341          }
342        }
343
344        //      if(fCheckClosestZVertex) {
345        if(1) {
346          // Fallback: if track is not associated with any vertex,
347          // associate it with the vertex closest in z
348          if(vertexFound || closestVtx != vtxArr->At(0)) {
349            //      pfPileUp->Add(pf);
350            pfNoPileUpflag.push_back(0);
351          } else {
352            pfNoPileUpflag.push_back(1);
353          }
354        } else {
355          if(vertexFound && closestVtx != vtxArr->At(0)) {
356            //      pfPileUp->Add(pf);
357            pfNoPileUpflag.push_back(0);
358          } else {
359            //      PFCandidate * pfNoPileUp->AddNew(); // Ridiculous but that's how it is
360            pfNoPileUpflag.push_back(1);
361          }
362        }
363      } //hadron & trk stuff
364    } else { // hadron
365      //      PFCandidate * ptr = pfNoPileUp->AddNew();
366      pfNoPileUpflag.push_back(1);
367    }
368  } // Loop over PF candidates
369
370  return pfNoPileUpflag.size();
371 }
372
304   std::bitset<1024> mithep::MuonFakeRateMod::GetHLTMatchBits(const Double_t pt, const Double_t eta, const Double_t phi)
305   {
306    std::bitset<1024> object_bitset;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines