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 (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

◆ 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.

References theDepThresholds, and HLT_2022v12_cff::weights.

◆ IsolatorByDeposit() [2/4]

IsolatorByDeposit::IsolatorByDeposit ( const ConeSizeFunction conesize,
const std::vector< double > &  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.

◆ IsolatorByDeposit() [4/4]

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

◆ ~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.

References coneSize(), CandIsolatorFromDeposits_cfi::deposits, flavorHistoryFilter_cfi::dr, PVValHelper::eta, DiDispStaMuonMonitor_cfi::pt, resultType(), 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.
Definition: Electron.h:6
ResultType resultType() const override

◆ resultType()

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

◆ setConeSize() [1/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.

References l1NNTauProducerPuppi_cfi::conesize, theConeSize, and theConeSizeFunction.

◆ setConeSize() [2/2]

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

◆ 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.

References theWeights, and HLT_2022v12_cff::weights.

◆ weightedSum()

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

Definition at line 45 of file IsolatorByDeposit.cc.

References cms::cuda::assert(), CandIsolatorFromDeposits_cfi::deposits, JetPlusTrackCorrections_cff::dRcone, 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
T w() const
reco::IsoDeposit::Vetos Vetos
assert(be >=bs)
std::vector< double > theWeights

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().