Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:25:59

0001 #ifndef SimpleCutsIsolator_H
0002 #define SimpleCutsIsolator_H
0003 
0004 #include "RecoMuon/MuonIsolation/interface/MuIsoBaseIsolator.h"
0005 #include "RecoMuon/MuonIsolation/interface/Cuts.h"
0006 
0007 #include "FWCore/Framework/interface/ConsumesCollector.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 
0010 class SimpleCutsIsolator : public muonisolation::MuIsoBaseIsolator {
0011 public:
0012   SimpleCutsIsolator(const edm::ParameterSet& par, edm::ConsumesCollector&& iC)
0013       : theCuts(par.getParameter<std::vector<double> >("EtaBounds"),
0014                 par.getParameter<std::vector<double> >("ConeSizes"),
0015                 par.getParameter<std::vector<double> >("Thresholds")) {}
0016 
0017   ResultType resultType() const override { return ISOL_BOOL_TYPE; }
0018 
0019   Result result(const DepositContainer& deposits, const edm::Event* = nullptr) const override {
0020     Result answer(ISOL_BOOL_TYPE);
0021     answer.valBool = false;
0022     // fail miserably...
0023     return answer;
0024   }
0025 
0026   Result result(const DepositContainer& deposits, const reco::Track& tk, const edm::Event* = nullptr) const override {
0027     Result answer(ISOL_BOOL_TYPE);
0028 
0029     muonisolation::Cuts::CutSpec cuts_here = theCuts(tk.eta());
0030 
0031     double conesize = cuts_here.conesize;
0032     double dephlt = 0;
0033     unsigned int nDeps = deposits.size();
0034     for (unsigned int iDep = 0; iDep < nDeps; ++iDep) {
0035       dephlt += deposits[iDep].dep->depositWithin(conesize);
0036     }
0037     answer.valFloat = dephlt;
0038     if (dephlt < cuts_here.threshold) {
0039       answer.valBool = true;
0040     } else {
0041       answer.valBool = false;
0042     }
0043     return answer;
0044   }
0045 
0046 private:
0047   // Isolation cuts
0048   muonisolation::Cuts theCuts;
0049 };
0050 
0051 #endif