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 
7 IsolatorByDeposit::IsolatorByDeposit(float conesize, const vector<double>& weights)
8  : theConeSizeFunction(nullptr), theConeSize(conesize), theWeights(weights) {
9  theDepThresholds = std::vector<double>(weights.size(), -1e12);
10 }
11 
12 IsolatorByDeposit::IsolatorByDeposit(const ConeSizeFunction* conesize, const vector<double>& weights)
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 }
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
muonisolation::MuIsoBaseIsolator::Result
Definition: MuIsoBaseIsolator.h:27
pat::IsoDeposit
reco::IsoDeposit IsoDeposit
Definition: Isolation.h:7
cms::cuda::assert
assert(be >=bs)
JetPlusTrackCorrections_cff.dRcone
dRcone
Definition: JetPlusTrackCorrections_cff.py:38
muonisolation::IsolatorByDeposit::ConeSizeFunction
Definition: IsolatorByDeposit.h:20
muonisolation::IsolatorByDeposit::weightedSum
double weightedSum(const DepositContainer &deposits, float dRcone) const
Definition: IsolatorByDeposit.cc:45
PVValHelper::eta
Definition: PVValidationHelpers.h:69
w
const double w
Definition: UKUtility.cc:23
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99178
muonisolation::MuIsoBaseIsolator::Vetos
reco::IsoDeposit::Vetos Vetos
Definition: MuIsoBaseIsolator.h:15
muonisolation::IsolatorByDeposit::resultType
ResultType resultType() const override
Definition: IsolatorByDeposit.h:58
muonisolation::IsolatorByDeposit::DepositContainer
MuIsoBaseIsolator::DepositContainer DepositContainer
Definition: IsolatorByDeposit.h:18
muonisolation::IsolatorByDeposit::coneSize
virtual float coneSize(float eta, float pT) const
Get the cone size.
Definition: IsolatorByDeposit.h:54
trackerHitRTTI::vector
Definition: trackerHitRTTI.h:21
muonisolation::IsolatorByDeposit::IsolatorByDeposit
IsolatorByDeposit(float conesize, const std::vector< double > &weights)
construct with no addtnl thresholds on deposits
Definition: IsolatorByDeposit.cc:7
res
Definition: Electron.h:6
muonisolation
Definition: CandViewExtractor.h:16
IsolatorByDeposit.h
muonisolation::IsolatorByDeposit::theDepThresholds
std::vector< double > theDepThresholds
Definition: IsolatorByDeposit.h:68
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
muonisolation::IsolatorByDeposit::result
Result result(const DepositContainer &deposits, const edm::Event *=nullptr) const override
Compute the deposit within the cone and return the isolation result.
Definition: IsolatorByDeposit.cc:25
muonisolation::IsolatorByDeposit::theWeights
std::vector< double > theWeights
Definition: IsolatorByDeposit.h:67
edm::Event
Definition: Event.h:73
CandIsolatorFromDeposits_cfi.deposits
deposits
Definition: CandIsolatorFromDeposits_cfi.py:4