test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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)
 
virtual Result result (const DepositContainer &deposits, const edm::Event *=0) const
 Compute the deposit within the cone and return the isolation result. More...
 
virtual ResultType resultType () const
 
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...
 
virtual ~IsolatorByDeposit ()
 
- 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.

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 
)

Definition at line 24 of file IsolatorByDeposit.cc.

virtual muonisolation::IsolatorByDeposit::~IsolatorByDeposit ( )
inlinevirtual

Definition at line 35 of file IsolatorByDeposit.h.

35 {}

Member Function Documentation

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

Get the cone size.

Definition at line 54 of file IsolatorByDeposit.h.

References muonisolation::IsolatorByDeposit::ConeSizeFunction::coneSize(), theConeSize, and theConeSizeFunction.

Referenced by result().

54  {
56  }
virtual float coneSize(float eta, float pt) const =0
const ConeSizeFunction * theConeSizeFunction
MuIsoBaseIsolator::Result IsolatorByDeposit::result ( const DepositContainer deposits,
const edm::Event = 0 
) const
virtual

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

Implements muonisolation::MuIsoBaseIsolator.

Definition at line 30 of file IsolatorByDeposit.cc.

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

Referenced by MuIsoByTrackPt::isolation().

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
virtual float coneSize(float eta, float pT) const
Get the cone size.
virtual ResultType resultType() const
virtual ResultType muonisolation::IsolatorByDeposit::resultType ( ) const
inlinevirtual
void muonisolation::IsolatorByDeposit::setConeSize ( float  conesize)
inline

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

Definition at line 48 of file IsolatorByDeposit.h.

References theConeSize, and theConeSizeFunction.

Referenced by MuIsoByTrackPt::setConeSize().

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

Definition at line 50 of file IsolatorByDeposit.h.

References theConeSizeFunction.

50 { 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 create_public_pileup_plots::weights.

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

Definition at line 51 of file IsolatorByDeposit.cc.

References assert(), theDepThresholds, theWeights, and w.

Referenced by result().

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 != 0){
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
assert(m_qm.get())
reco::IsoDeposit::Vetos Vetos
std::vector< double > theWeights

Member Data Documentation

float muonisolation::IsolatorByDeposit::theConeSize
private

Definition at line 67 of file IsolatorByDeposit.h.

Referenced by coneSize(), and setConeSize().

const ConeSizeFunction* muonisolation::IsolatorByDeposit::theConeSizeFunction
private

Definition at line 66 of file IsolatorByDeposit.h.

Referenced by coneSize(), and setConeSize().

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

Definition at line 69 of file IsolatorByDeposit.h.

Referenced by IsolatorByDeposit(), and weightedSum().

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

Definition at line 68 of file IsolatorByDeposit.h.

Referenced by setWeights(), and weightedSum().