CMS 3D CMS Logo

List of all members | Classes | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
muonisolation::IsolatorByNominalEfficiency Class Reference

#include <IsolatorByNominalEfficiency.h>

Inheritance diagram for muonisolation::IsolatorByNominalEfficiency:
muonisolation::MuIsoBaseIsolator

Classes

class  ConeSizes
 

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

Cuts cuts (float nominalEfficiency) const
 
 IsolatorByNominalEfficiency (const std::string &thrFile, const std::vector< std::string > &ceff, const std::vector< double > &weights)
 Constructor. More...
 
 IsolatorByNominalEfficiency (const std::string &thrFile, const std::vector< std::string > &ceff, 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...
 
 ~IsolatorByNominalEfficiency () 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 Types

typedef std::multimap< float, int > mapNomEff_Cone
 

Private Member Functions

int bestConeForEfficiencyIndex (float eff_thr) const
 
mapNomEff_Cone cones (const std::vector< std::string > &names)
 
std::string findPath (const std::string &fileName)
 
ResultType resultType () const override
 
virtual double weightedSum (const DepositContainer &deposits, float dRcone) const
 

Private Attributes

mapNomEff_Cone coneForEfficiency
 
ConeSizes theConesInfo
 
std::vector< double > theDepThresholds
 
std::vector< double > theWeights
 
NominalEfficiencyThresholdsthresholds
 

Detailed Description

Definition at line 20 of file IsolatorByNominalEfficiency.h.

Member Typedef Documentation

Definition at line 22 of file IsolatorByNominalEfficiency.h.

typedef std::multimap<float,int> muonisolation::IsolatorByNominalEfficiency::mapNomEff_Cone
private

Definition at line 59 of file IsolatorByNominalEfficiency.h.

Constructor & Destructor Documentation

muonisolation::IsolatorByNominalEfficiency::IsolatorByNominalEfficiency ( const std::string &  thrFile,
const std::vector< std::string > &  ceff,
const std::vector< double > &  weights 
)
muonisolation::IsolatorByNominalEfficiency::IsolatorByNominalEfficiency ( const std::string &  thrFile,
const std::vector< std::string > &  ceff,
const std::vector< double > &  weights,
const std::vector< double > &  thresh 
)
IsolatorByNominalEfficiency::~IsolatorByNominalEfficiency ( )
override

Definition at line 36 of file IsolatorByNominalEfficiency.cc.

References particleFlowRecHitECAL_cfi::thresholds.

37 {
38  delete thresholds;
39 }

Member Function Documentation

int IsolatorByNominalEfficiency::bestConeForEfficiencyIndex ( float  eff_thr) const
private

Definition at line 105 of file IsolatorByNominalEfficiency.cc.

Referenced by muonisolation::IsolatorByNominalEfficiency::ConeSizes::dim().

106 {
107 
108  //FIXME use upper_bound
109  int best_cone;
110  if (!coneForEfficiency.empty()) {
111  best_cone = (--(coneForEfficiency.end()))->second;
112  } else return 0;
113 
114  mapNomEff_Cone::const_reverse_iterator it;
115  for (it = coneForEfficiency.rbegin();
116  it != coneForEfficiency.rend(); it++) {
117  if (eff_thr <= (*it).first) best_cone = (*it).second;
118  }
119  return best_cone;
120 }
IsolatorByNominalEfficiency::mapNomEff_Cone IsolatorByNominalEfficiency::cones ( const std::vector< std::string > &  names)
private

Definition at line 42 of file IsolatorByNominalEfficiency.cc.

References mps_fire::result.

42  {
44  for (vector<string>::const_iterator is = usrVec.begin();
45  is != usrVec.end(); is++) {
46  char * evp = nullptr;
47  int cone = strtol( (*is).c_str(), &evp, 10);
48  float effic = strtod(evp+1, &evp);
49  result.insert(make_pair(effic,cone));
50  }
51  return result;
52 }
Result result(const DepositContainer &deposits, const edm::Event *=0) const override
Compute the deposit within the cone and return the isolation result.
Cuts IsolatorByNominalEfficiency::cuts ( float  nominalEfficiency) const

Definition at line 145 of file IsolatorByNominalEfficiency.cc.

References PVValHelper::eta, f, and particleFlowRecHitECAL_cfi::thresholds.

Referenced by L3NominalEfficiencyConfigurator::cuts().

146 {
147  vector<double> etaBounds = thresholds->bins();
148  vector<double> coneSizes;
149  vector<double> cutvalues;
150  for (vector<double>::const_iterator it=etaBounds.begin(),itEnd=etaBounds.end();it < itEnd;++it){
151  float eta = (*it);
152  int icone = bestConeForEfficiencyIndex(nominalEfficiency);
153  coneSizes.push_back( theConesInfo.size(icone));
154  NominalEfficiencyThresholds::ThresholdLocation location = {eta-1.e-3f, icone};
155  cutvalues.push_back( thresholds->thresholdValueForEfficiency(location, nominalEfficiency));
156  }
157  return Cuts(etaBounds,coneSizes,cutvalues);
158 }
double f[11][100]
float thresholdValueForEfficiency(ThresholdLocation location, float eff_thr) const
string IsolatorByNominalEfficiency::findPath ( const std::string &  fileName)
private

Definition at line 54 of file IsolatorByNominalEfficiency.cc.

References f, and edm::FileInPath::fullPath().

55 {
56  // FIXME
58  return f.fullPath();
59 }
double f[11][100]
MuIsoBaseIsolator::Result IsolatorByNominalEfficiency::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 62 of file IsolatorByNominalEfficiency.cc.

References highPtTrackIsolations_cff::coneSize, gather_cfg::cout, particleFlowRecHitECAL_cfi::thresholds, and muonisolation::MuIsoBaseIsolator::Result::valFloat.

62  {
63 
64  if (deposits.empty()) {
65  cout << "IsolatorByNominalEfficiency: no deposit" << endl;
66  return Result(resultType()); //FIXME
67  }
68 
69  // To determine the threshold, the direction of the cone of the first
70  // set of deposits is used.
71  // For algorithms where different cone axis definitions are used
72  // for different types deposits (eg. HCAL and ECAL deposits for
73  // calorimeter isolation), the first one is used to determine the threshold
74  // value!
75  float theEta = deposits.back().dep->eta();
76 
77  // Try descending efficiency values to find the point where the candidate
78  // becomes non isolated
79 
80  float nominalEfficiency = 1.;
81  const float deltaeff=0.005;
82  const float mineff=deltaeff;
83  for (float eff=.995; eff>mineff; eff-=deltaeff) {
84  int cone = bestConeForEfficiencyIndex(eff);
85  float coneSize = theConesInfo.size(cone);
86  NominalEfficiencyThresholds::ThresholdLocation location = {theEta,cone};
87  float thres = thresholds->thresholdValueForEfficiency(location, eff);
88  float sumDep = weightedSum(deposits,coneSize);
89 // cout << " Eff=" << eff
90 // << " eta=" << theEta
91 // << " cone=" << cone
92 // << " dR=" << coneSize
93 // << " thres=" << thres
94 // << " deposit=" << sumDep
95 // << " isolated=" << (sumDep < thres)
96 // << endl;
97  if (sumDep > thres) break;
98  nominalEfficiency = eff;
99  }
100  Result res(resultType());
101  res.valFloat = nominalEfficiency;
102  return res;
103 }
Definition: Electron.h:4
virtual double weightedSum(const DepositContainer &deposits, float dRcone) const
float thresholdValueForEfficiency(ThresholdLocation location, float eff_thr) const
ResultType muonisolation::IsolatorByNominalEfficiency::resultType ( ) const
inlineoverrideprivatevirtual
double IsolatorByNominalEfficiency::weightedSum ( const DepositContainer deposits,
float  dRcone 
) const
privatevirtual

Definition at line 123 of file IsolatorByNominalEfficiency.cc.

References w.

Referenced by muonisolation::IsolatorByNominalEfficiency::ConeSizes::dim().

124  {
125  double sumDep=0;
126 
127  assert(deposits.size()==theWeights.size());
128 
129  vector<double>::const_iterator w = theWeights.begin();
130  vector<double>::const_iterator dThresh = theDepThresholds.begin();
131  for (DepositContainer::const_iterator dep = deposits.begin();
132  dep != deposits.end(); dep++) {
133  if (dep->vetos != nullptr){
134  sumDep += dep->dep->depositAndCountWithin(dRcone, *dep->vetos, *dThresh).first * (*w);
135  } else {
136  sumDep += dep->dep->depositAndCountWithin(dRcone, Vetos(), *dThresh).first * (*w);
137  }
138  if (sumDep <0.) sumDep = 0.;
139  w++;
140  dThresh++;
141  }
142  return sumDep;
143 }
const double w
Definition: UKUtility.cc:23
reco::IsoDeposit::Vetos Vetos

Member Data Documentation

mapNomEff_Cone muonisolation::IsolatorByNominalEfficiency::coneForEfficiency
private

Definition at line 67 of file IsolatorByNominalEfficiency.h.

ConeSizes muonisolation::IsolatorByNominalEfficiency::theConesInfo
private

Definition at line 71 of file IsolatorByNominalEfficiency.h.

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

Definition at line 70 of file IsolatorByNominalEfficiency.h.

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

Definition at line 69 of file IsolatorByNominalEfficiency.h.

NominalEfficiencyThresholds* muonisolation::IsolatorByNominalEfficiency::thresholds
private

Definition at line 68 of file IsolatorByNominalEfficiency.h.