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
0021
0022
0023
0024
0025
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 }