CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
muonisolation::IsolatorByDeposit Class Reference

#include <IsolatorByDeposit.h>

Inheritance diagram for muonisolation::IsolatorByDeposit:
muonisolation::MuIsoBaseIsolator

Classes

struct  ConeSizeFunction
 

Public Types

typedef
MuIsoBaseIsolator::DepositContainer 
DepositContainer
 
- Public Types inherited from muonisolation::MuIsoBaseIsolator
typedef std::vector
< DepositAndVetos
DepositContainer
 
enum  ResultType { ISOL_INT_TYPE = 0, ISOL_FLOAT_TYPE, ISOL_BOOL_TYPE, ISOL_INVALID_TYPE }
 
typedef reco::IsoDeposit::Veto Veto
 
typedef reco::IsoDeposit::Vetos Vetos
 

Public Member Functions

virtual float coneSize (float eta, float pT) const
 Get the cone size. More...
 
 IsolatorByDeposit (float conesize, const std::vector< double > &weights)
 construct with no addtnl thresholds on deposits More...
 
 IsolatorByDeposit (const ConeSizeFunction *conesize, const std::vector< double > &weights)
 
 IsolatorByDeposit (float conesize, const std::vector< double > &weights, const std::vector< double > &thresh)
 construct with non-default thresholds per deposit More...
 
 IsolatorByDeposit (const ConeSizeFunction *conesize, const std::vector< double > &weights, const std::vector< double > &thresh)
 
Result result (const DepositContainer &deposits, const edm::Event *=nullptr) const override
 Compute the deposit within the cone and return the isolation result. More...
 
ResultType resultType () const override
 
void setConeSize (float conesize)
 Compute the count of deposit within the cone and return the isolation result. More...
 
void setConeSize (ConeSizeFunction *conesize)
 
virtual void setWeights (const std::vector< double > &weights)
 Set the weights for summing deposits of different types. More...
 
 ~IsolatorByDeposit () override
 
- Public Member Functions inherited from muonisolation::MuIsoBaseIsolator
virtual Result result (const DepositContainer &deposits, const reco::Candidate &muon, const edm::Event *=nullptr) const
 Compute and return the isolation variable, with vetoes and the muon. More...
 
virtual Result result (const DepositContainer &deposits, const reco::Track &muon, const edm::Event *=nullptr) const
 Compute and return the isolation variable, with vetoes and the muon. More...
 
virtual ~MuIsoBaseIsolator ()
 

Private Member Functions

double weightedSum (const DepositContainer &deposits, float dRcone) const
 

Private Attributes

float theConeSize
 
const ConeSizeFunctiontheConeSizeFunction
 
std::vector< double > theDepThresholds
 
std::vector< double > theWeights
 

Detailed Description

Definition at line 16 of file IsolatorByDeposit.h.

Member Typedef Documentation

Definition at line 18 of file IsolatorByDeposit.h.

Constructor & Destructor Documentation

IsolatorByDeposit::IsolatorByDeposit ( float  conesize,
const std::vector< double > &  weights 
)

construct with no addtnl thresholds on deposits

Definition at line 7 of file IsolatorByDeposit.cc.

References theDepThresholds.

8  : theConeSizeFunction(nullptr), theConeSize(conesize), theWeights(weights) {
9  theDepThresholds = std::vector<double>(weights.size(), -1e12);
10 }
std::vector< double > theDepThresholds
std::vector< double > theWeights
const ConeSizeFunction * theConeSizeFunction
IsolatorByDeposit::IsolatorByDeposit ( const ConeSizeFunction conesize,
const std::vector< double > &  weights 
)

Definition at line 12 of file IsolatorByDeposit.cc.

References theDepThresholds.

14  theDepThresholds = std::vector<double>(weights.size(), -1e12);
15 }
std::vector< double > theDepThresholds
std::vector< double > theWeights
const ConeSizeFunction * theConeSizeFunction
IsolatorByDeposit::IsolatorByDeposit ( float  conesize,
const std::vector< double > &  weights,
const std::vector< double > &  thresh 
)

construct with non-default thresholds per deposit

Definition at line 17 of file IsolatorByDeposit.cc.

18  : theConeSizeFunction(nullptr), theConeSize(conesize), theWeights(weights), theDepThresholds(dThresh) {}
std::vector< double > theDepThresholds
std::vector< double > theWeights
const ConeSizeFunction * theConeSizeFunction
IsolatorByDeposit::IsolatorByDeposit ( const ConeSizeFunction conesize,
const std::vector< double > &  weights,
const std::vector< double > &  thresh 
)

Definition at line 20 of file IsolatorByDeposit.cc.

muonisolation::IsolatorByDeposit::~IsolatorByDeposit ( )
inlineoverride

Definition at line 35 of file IsolatorByDeposit.h.

35 {}

Member Function Documentation

virtual float muonisolation::IsolatorByDeposit::coneSize ( float  eta,
float  pT 
) const
inlinevirtual
MuIsoBaseIsolator::Result IsolatorByDeposit::result ( const DepositContainer deposits,
const edm::Event = nullptr 
) const
overridevirtual

Compute the deposit within the cone and return the isolation result.

Implements muonisolation::MuIsoBaseIsolator.

Definition at line 25 of file IsolatorByDeposit.cc.

References coneSize(), runTauDisplay::dr, PVValHelper::eta, DiDispStaMuonMonitor_cfi::pt, resultType(), muonisolation::MuIsoBaseIsolator::Result::valFloat, and weightedSum().

25  {
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 
40  Result res(resultType());
41  res.valFloat = sumDep;
42  return res;
43 }
double weightedSum(const DepositContainer &deposits, float dRcone) const
virtual float coneSize(float eta, float pT) const
Get the cone size.
ResultType resultType() const override
ResultType muonisolation::IsolatorByDeposit::resultType ( ) const
inlineoverridevirtual
void muonisolation::IsolatorByDeposit::setConeSize ( float  conesize)
inline

Compute the count of deposit within the cone and return the isolation result.

Definition at line 46 of file IsolatorByDeposit.h.

References theConeSize, and theConeSizeFunction.

46  {
47  theConeSize = conesize;
48  theConeSizeFunction = nullptr;
49  }
const ConeSizeFunction * theConeSizeFunction
void muonisolation::IsolatorByDeposit::setConeSize ( ConeSizeFunction conesize)
inline

Definition at line 51 of file IsolatorByDeposit.h.

References theConeSizeFunction.

51 { theConeSizeFunction = conesize; }
const ConeSizeFunction * theConeSizeFunction
virtual void muonisolation::IsolatorByDeposit::setWeights ( const std::vector< double > &  weights)
inlinevirtual

Set the weights for summing deposits of different types.

Definition at line 38 of file IsolatorByDeposit.h.

References theWeights, and HLT_FULL_cff::weights.

38 { theWeights = weights; }
std::vector< double > theWeights
double IsolatorByDeposit::weightedSum ( const DepositContainer deposits,
float  dRcone 
) const
private

Definition at line 45 of file IsolatorByDeposit.cc.

References cms::cuda::assert(), theDepThresholds, theWeights, and w().

Referenced by result().

45  {
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
reco::IsoDeposit::Vetos Vetos
assert(be >=bs)
std::vector< double > theWeights
T w() const

Member Data Documentation

float muonisolation::IsolatorByDeposit::theConeSize
private

Definition at line 66 of file IsolatorByDeposit.h.

Referenced by coneSize(), and setConeSize().

const ConeSizeFunction* muonisolation::IsolatorByDeposit::theConeSizeFunction
private

Definition at line 65 of file IsolatorByDeposit.h.

Referenced by coneSize(), and setConeSize().

std::vector<double> muonisolation::IsolatorByDeposit::theDepThresholds
private

Definition at line 68 of file IsolatorByDeposit.h.

Referenced by IsolatorByDeposit(), and weightedSum().

std::vector<double> muonisolation::IsolatorByDeposit::theWeights
private

Definition at line 67 of file IsolatorByDeposit.h.

Referenced by setWeights(), and weightedSum().