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 *=0) 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 *=0) 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 *=0) 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 17 of file IsolatorByDeposit.h.

Member Typedef Documentation

Definition at line 19 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 {
10  theDepThresholds = std::vector<double>(weights.size(), -1e12);
11 }
std::vector< double > theDepThresholds
std::vector< double > theWeights
const ConeSizeFunction * theConeSizeFunction
IsolatorByDeposit::IsolatorByDeposit ( const ConeSizeFunction conesize,
const std::vector< double > &  weights 
)

Definition at line 13 of file IsolatorByDeposit.cc.

References theDepThresholds.

15 {
16  theDepThresholds = std::vector<double>(weights.size(), -1e12);
17 }
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 19 of file IsolatorByDeposit.cc.

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

Definition at line 36 of file IsolatorByDeposit.h.

36 {}

Member Function Documentation

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

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

Implements muonisolation::MuIsoBaseIsolator.

Definition at line 30 of file IsolatorByDeposit.cc.

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

Referenced by MuIsoByTrackPt::isolation(), and setWeights().

30  {
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 }
double weightedSum(const DepositContainer &deposits, float dRcone) const
ResultType resultType() const override
virtual float coneSize(float eta, float pT) const
Get the cone size.
Definition: Electron.h:4
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 49 of file IsolatorByDeposit.h.

References theConeSize, and theConeSizeFunction.

Referenced by MuIsoByTrackPt::setConeSize().

49 { theConeSize = conesize; theConeSizeFunction = nullptr;}
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 39 of file IsolatorByDeposit.h.

References CandIsolatorFromDeposits_cfi::deposits, result(), theWeights, and create_public_lumi_plots::weights.

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

Definition at line 51 of file IsolatorByDeposit.cc.

References theDepThresholds, theWeights, and w.

Referenced by result(), and resultType().

52  {
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 != nullptr){
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
reco::IsoDeposit::Vetos Vetos
std::vector< double > theWeights

Member Data Documentation

float muonisolation::IsolatorByDeposit::theConeSize
private

Definition at line 68 of file IsolatorByDeposit.h.

Referenced by coneSize(), and setConeSize().

const ConeSizeFunction* muonisolation::IsolatorByDeposit::theConeSizeFunction
private

Definition at line 67 of file IsolatorByDeposit.h.

Referenced by coneSize(), and setConeSize().

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

Definition at line 70 of file IsolatorByDeposit.h.

Referenced by IsolatorByDeposit(), and weightedSum().

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

Definition at line 69 of file IsolatorByDeposit.h.

Referenced by setWeights(), and weightedSum().