CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
IsolatorByDeposit.cc
Go to the documentation of this file.
2 
3 using std::vector;
4 using reco::IsoDeposit;
5 using namespace muonisolation;
6 
7 IsolatorByDeposit::IsolatorByDeposit(float conesize, const vector<double>& weights)
8  : theConeSizeFunction(0), theConeSize(conesize), theWeights(weights)
9 {
10  theDepThresholds = std::vector<double>(weights.size(), -1e12);
11 }
12 
13 IsolatorByDeposit::IsolatorByDeposit(const ConeSizeFunction * conesize, const vector<double>& weights)
14  : theConeSizeFunction(conesize), theConeSize(0.), theWeights(weights)
15 {
16  theDepThresholds = std::vector<double>(weights.size(), -1e12);
17 }
18 
19 IsolatorByDeposit::IsolatorByDeposit(float conesize, const vector<double>& weights, const vector<double>& dThresh)
20  : theConeSizeFunction(0), theConeSize(conesize), theWeights(weights),
21  theDepThresholds(dThresh)
22 { }
23 
25  const vector<double>& weights, const vector<double>& dThresh)
26  : theConeSizeFunction(conesize), theConeSize(0.), theWeights(weights),
27  theDepThresholds(dThresh)
28 { }
29 
31  if (deposits.empty()) return Result(resultType());
32 
33  // To determine the threshold, the direction of the cone of the first
34  // set of deposits is used.
35  // For algorithms where different cone axis definitions are used
36  // for different types deposits (eg. HCAL and ECAL deposits for
37  // calorimeter isolation), the first one is used to determine the threshold
38  // value!
39  float eta = deposits.front().dep->eta();
40  float pt = deposits.front().dep->candEnergy();
41  float dr= coneSize(eta,pt);
42  float sumDep = weightedSum(deposits,dr);
43 
44 
45  Result res(resultType());
46  res.valFloat = sumDep;
47  return res;
48 }
49 
50 double
52  float dRcone) const {
53  double sumDep=0;
54 
55  assert(deposits.size()==theWeights.size());
56 
57  vector<double>::const_iterator w = theWeights.begin();
58  vector<double>::const_iterator dThresh = theDepThresholds.begin();
59 
60  typedef DepositContainer::const_iterator DI;
61  for (DI dep = deposits.begin(), depEnd = deposits.end(); dep != depEnd; ++dep) {
62  if (dep->vetos != 0){
63  sumDep += dep->dep->depositAndCountWithin(dRcone, *dep->vetos, (*dThresh)).first * (*w);
64  } else {
65  sumDep += dep->dep->depositAndCountWithin(dRcone, Vetos(), (*dThresh)).first * (*w);
66  }
67 // cout << "IsolatorByDeposit: type = " << (*dep)->type() << " weight = " << (*w) << endl;
68  w++;
69  dThresh++;
70  }
71  return sumDep;
72 }
std::vector< double > theDepThresholds
const double w
Definition: UKUtility.cc:23
double weightedSum(const DepositContainer &deposits, float dRcone) const
assert(m_qm.get())
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
MuIsoBaseIsolator::DepositContainer DepositContainer
virtual Result result(const DepositContainer &deposits, const edm::Event *=0) const
Compute the deposit within the cone and return the isolation result.
virtual ResultType resultType() const
std::vector< double > theWeights
reco::IsoDeposit IsoDeposit
Definition: Isolation.h:7