Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:27:05

0001 #include "RecoMuon/MuonIsolation/interface/IsolatorByDepositCount.h"
0002 
0003 using reco::IsoDeposit;
0004 using std::vector;
0005 using namespace muonisolation;
0006 
0007 IsolatorByDepositCount::IsolatorByDepositCount(float conesize, const vector<double>& dThresh)
0008     : theConeSizeFunction(nullptr), theConeSize(conesize), theDepThresholds(dThresh) {}
0009 
0010 IsolatorByDepositCount::IsolatorByDepositCount(const ConeSizeFunction* conesize, const vector<double>& dThresh)
0011     : theConeSizeFunction(conesize), theConeSize(0.), theDepThresholds(dThresh) {}
0012 
0013 MuIsoBaseIsolator::Result IsolatorByDepositCount::result(const DepositContainer& deposits, const edm::Event*) const {
0014   if (deposits.empty())
0015     return Result(resultType());
0016   if (deposits.size() > 1) {
0017     return Result(ISOL_INVALID_TYPE);
0018   }
0019 
0020   // To determine the threshold, the direction of the cone of the first
0021   // set of deposits is used.
0022   // For algorithms where different cone axis definitions are used
0023   // for different types deposits (eg. HCAL and ECAL deposits for
0024   // calorimeter isolation), the first one is used to determine the threshold
0025   // value!
0026   float eta = deposits.front().dep->eta();
0027   float pt = deposits.front().dep->candEnergy();
0028   float dr = coneSize(eta, pt);
0029   DepositAndVetos depVet = deposits.front();
0030   std::pair<double, int> sumAndCount = depVet.dep->depositAndCountWithin(dr, *depVet.vetos, theDepThresholds.front());
0031 
0032   Result res(resultType());
0033   res.valInt = sumAndCount.second;
0034   return res;
0035 }