CMS 3D CMS Logo

IsolatorByDeposit.cc
Go to the documentation of this file.
2 
3 using reco::IsoDeposit;
4 using std::vector;
5 using namespace muonisolation;
6 
8  : theConeSizeFunction(nullptr), theConeSize(conesize), theWeights(weights) {
9  theDepThresholds = std::vector<double>(weights.size(), -1e12);
10 }
11 
13  : theConeSizeFunction(conesize), theConeSize(0.), theWeights(weights) {
14  theDepThresholds = std::vector<double>(weights.size(), -1e12);
15 }
16 
17 IsolatorByDeposit::IsolatorByDeposit(float conesize, const vector<double>& weights, const vector<double>& dThresh)
18  : theConeSizeFunction(nullptr), theConeSize(conesize), theWeights(weights), theDepThresholds(dThresh) {}
19 
21  const vector<double>& weights,
22  const vector<double>& dThresh)
23  : theConeSizeFunction(conesize), theConeSize(0.), theWeights(weights), theDepThresholds(dThresh) {}
24 
26  if (deposits.empty())
27  return Result(resultType());
28 
29  // To determine the threshold, the direction of the cone of the first
30  // set of deposits is used.
31  // For algorithms where different cone axis definitions are used
32  // for different types deposits (eg. HCAL and ECAL deposits for
33  // calorimeter isolation), the first one is used to determine the threshold
34  // value!
35  float eta = deposits.front().dep->eta();
36  float pt = deposits.front().dep->candEnergy();
37  float dr = coneSize(eta, pt);
38  float sumDep = weightedSum(deposits, dr);
39 
41  res.valFloat = sumDep;
42  return res;
43 }
44 
46  double sumDep = 0;
47 
48  assert(deposits.size() == theWeights.size());
49 
50  vector<double>::const_iterator w = theWeights.begin();
51  vector<double>::const_iterator dThresh = theDepThresholds.begin();
52 
53  typedef DepositContainer::const_iterator DI;
54  for (DI dep = deposits.begin(), depEnd = deposits.end(); dep != depEnd; ++dep) {
55  if (dep->vetos != nullptr) {
56  sumDep += dep->dep->depositAndCountWithin(dRcone, *dep->vetos, (*dThresh)).first * (*w);
57  } else {
58  sumDep += dep->dep->depositAndCountWithin(dRcone, Vetos(), (*dThresh)).first * (*w);
59  }
60  // cout << "IsolatorByDeposit: type = " << (*dep)->type() << " weight = " << (*w) << endl;
61  w++;
62  dThresh++;
63  }
64  return sumDep;
65 }
std::vector< double > theDepThresholds
double weightedSum(const DepositContainer &deposits, float dRcone) const
T w() const
virtual float coneSize(float eta, float pT) const
Get the cone size.
reco::IsoDeposit::Vetos Vetos
IsolatorByDeposit(float conesize, const std::vector< double > &weights)
construct with no addtnl thresholds on deposits
assert(be >=bs)
MuIsoBaseIsolator::DepositContainer DepositContainer
Definition: Electron.h:6
Result result(const DepositContainer &deposits, const edm::Event *=nullptr) const override
Compute the deposit within the cone and return the isolation result.
std::vector< double > theWeights
reco::IsoDeposit IsoDeposit
Definition: Isolation.h:7
ResultType resultType() const override