CMS 3D CMS Logo

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< DepositAndVetosDepositContainer
 
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 (const ConeSizeFunction *conesize, const std::vector< double > &weights)
 
 IsolatorByDeposit (const ConeSizeFunction *conesize, const std::vector< double > &weights, const std::vector< double > &thresh)
 
 IsolatorByDeposit (float conesize, const std::vector< double > &weights)
 construct with no addtnl thresholds on deposits More...
 
 IsolatorByDeposit (float conesize, const std::vector< double > &weights, const std::vector< double > &thresh)
 construct with non-default thresholds per deposit More...
 
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 (ConeSizeFunction *conesize)
 
void setConeSize (float conesize)
 Compute the count of deposit within the cone and return the isolation result. More...
 
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

◆ DepositContainer

Definition at line 18 of file IsolatorByDeposit.h.

Constructor & Destructor Documentation

◆ IsolatorByDeposit() [1/4]

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

construct with no addtnl thresholds on deposits

Definition at line 7 of file IsolatorByDeposit.cc.

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

References theDepThresholds, and HLT_FULL_cff::weights.

◆ IsolatorByDeposit() [2/4]

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

Definition at line 12 of file IsolatorByDeposit.cc.

14  theDepThresholds = std::vector<double>(weights.size(), -1e12);
15 }

References theDepThresholds, and HLT_FULL_cff::weights.

◆ IsolatorByDeposit() [3/4]

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) {}

◆ IsolatorByDeposit() [4/4]

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

Definition at line 20 of file IsolatorByDeposit.cc.

23  : theConeSizeFunction(conesize), theConeSize(0.), theWeights(weights), theDepThresholds(dThresh) {}

◆ ~IsolatorByDeposit()

muonisolation::IsolatorByDeposit::~IsolatorByDeposit ( )
inlineoverride

Definition at line 35 of file IsolatorByDeposit.h.

35 {}

Member Function Documentation

◆ coneSize()

virtual float muonisolation::IsolatorByDeposit::coneSize ( float  eta,
float  pT 
) const
inlinevirtual

◆ result()

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.

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 }

References coneSize(), CandIsolatorFromDeposits_cfi::deposits, flavorHistoryFilter_cfi::dr, PVValHelper::eta, DiDispStaMuonMonitor_cfi::pt, resultType(), and weightedSum().

◆ resultType()

ResultType muonisolation::IsolatorByDeposit::resultType ( ) const
inlineoverridevirtual

Implements muonisolation::MuIsoBaseIsolator.

Definition at line 58 of file IsolatorByDeposit.h.

58 { return ISOL_FLOAT_TYPE; }

References muonisolation::MuIsoBaseIsolator::ISOL_FLOAT_TYPE.

Referenced by result().

◆ setConeSize() [1/2]

void muonisolation::IsolatorByDeposit::setConeSize ( ConeSizeFunction conesize)
inline

Definition at line 51 of file IsolatorByDeposit.h.

51 { theConeSizeFunction = conesize; }

References theConeSizeFunction.

◆ setConeSize() [2/2]

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.

46  {
47  theConeSize = conesize;
48  theConeSizeFunction = nullptr;
49  }

References theConeSize, and theConeSizeFunction.

◆ setWeights()

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.

38 { theWeights = weights; }

References theWeights, and HLT_FULL_cff::weights.

◆ weightedSum()

double IsolatorByDeposit::weightedSum ( const DepositContainer deposits,
float  dRcone 
) const
private

Definition at line 45 of file IsolatorByDeposit.cc.

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 }

References cms::cuda::assert(), CandIsolatorFromDeposits_cfi::deposits, JetPlusTrackCorrections_cff::dRcone, theDepThresholds, theWeights, and w.

Referenced by result().

Member Data Documentation

◆ theConeSize

float muonisolation::IsolatorByDeposit::theConeSize
private

Definition at line 66 of file IsolatorByDeposit.h.

Referenced by coneSize(), and setConeSize().

◆ theConeSizeFunction

const ConeSizeFunction* muonisolation::IsolatorByDeposit::theConeSizeFunction
private

Definition at line 65 of file IsolatorByDeposit.h.

Referenced by coneSize(), and setConeSize().

◆ theDepThresholds

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

Definition at line 68 of file IsolatorByDeposit.h.

Referenced by IsolatorByDeposit(), and weightedSum().

◆ theWeights

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

Definition at line 67 of file IsolatorByDeposit.h.

Referenced by setWeights(), and weightedSum().

muonisolation::MuIsoBaseIsolator::ISOL_FLOAT_TYPE
Definition: MuIsoBaseIsolator.h:25
DiDispStaMuonMonitor_cfi.pt
pt
Definition: DiDispStaMuonMonitor_cfi.py:39
cms::cuda::assert
assert(be >=bs)
JetPlusTrackCorrections_cff.dRcone
dRcone
Definition: JetPlusTrackCorrections_cff.py:38
muonisolation::IsolatorByDeposit::theConeSizeFunction
const ConeSizeFunction * theConeSizeFunction
Definition: IsolatorByDeposit.h:65
muonisolation::IsolatorByDeposit::weightedSum
double weightedSum(const DepositContainer &deposits, float dRcone) const
Definition: IsolatorByDeposit.cc:45
PVValHelper::eta
Definition: PVValidationHelpers.h:70
PVValHelper::pT
Definition: PVValidationHelpers.h:71
w
const double w
Definition: UKUtility.cc:23
HLT_FULL_cff.weights
weights
Definition: HLT_FULL_cff.py:99207
muonisolation::MuIsoBaseIsolator::Vetos
reco::IsoDeposit::Vetos Vetos
Definition: MuIsoBaseIsolator.h:15
muonisolation::IsolatorByDeposit::theConeSize
float theConeSize
Definition: IsolatorByDeposit.h:66
muonisolation::IsolatorByDeposit::ConeSizeFunction::coneSize
virtual float coneSize(float eta, float pt) const =0
muonisolation::IsolatorByDeposit::resultType
ResultType resultType() const override
Definition: IsolatorByDeposit.h:58
muonisolation::IsolatorByDeposit::coneSize
virtual float coneSize(float eta, float pT) const
Get the cone size.
Definition: IsolatorByDeposit.h:54
res
Definition: Electron.h:6
muonisolation::IsolatorByDeposit::theDepThresholds
std::vector< double > theDepThresholds
Definition: IsolatorByDeposit.h:68
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
muonisolation::IsolatorByDeposit::theWeights
std::vector< double > theWeights
Definition: IsolatorByDeposit.h:67
CandIsolatorFromDeposits_cfi.deposits
deposits
Definition: CandIsolatorFromDeposits_cfi.py:4