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 *=nullptr) 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 *=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 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 22 of file IsolatorByNominalEfficiency.h.

Member Typedef Documentation

◆ DepositContainer

Definition at line 24 of file IsolatorByNominalEfficiency.h.

◆ mapNomEff_Cone

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

Definition at line 61 of file IsolatorByNominalEfficiency.h.

Constructor & Destructor Documentation

◆ IsolatorByNominalEfficiency() [1/2]

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

Constructor.

◆ IsolatorByNominalEfficiency() [2/2]

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::~IsolatorByNominalEfficiency ( )
override

Definition at line 44 of file IsolatorByNominalEfficiency.cc.

References thresholds.

44 { delete thresholds; }

Member Function Documentation

◆ bestConeForEfficiencyIndex()

int IsolatorByNominalEfficiency::bestConeForEfficiencyIndex ( float  eff_thr) const
private

Definition at line 107 of file IsolatorByNominalEfficiency.cc.

References coneForEfficiency.

Referenced by cuts(), and result().

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

◆ cones()

IsolatorByNominalEfficiency::mapNomEff_Cone IsolatorByNominalEfficiency::cones ( const std::vector< std::string > &  names)
private

Definition at line 46 of file IsolatorByNominalEfficiency.cc.

References hltPFPuppi_cfi::cone, and result().

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

◆ cuts()

Cuts IsolatorByNominalEfficiency::cuts ( float  nominalEfficiency) const

Definition at line 144 of file IsolatorByNominalEfficiency.cc.

References bestConeForEfficiencyIndex(), muonisolation::NominalEfficiencyThresholds::bins(), PVValHelper::eta, f, EcalCondDBWriter_cfi::location, muonisolation::IsolatorByNominalEfficiency::ConeSizes::size(), theConesInfo, thresholds, and muonisolation::NominalEfficiencyThresholds::thresholdValueForEfficiency().

Referenced by L3NominalEfficiencyConfigurator::cuts().

144  {
145  vector<double> etaBounds = thresholds->bins();
146  vector<double> coneSizes;
147  vector<double> cutvalues;
148  for (vector<double>::const_iterator it = etaBounds.begin(), itEnd = etaBounds.end(); it < itEnd; ++it) {
149  float eta = (*it);
150  int icone = bestConeForEfficiencyIndex(nominalEfficiency);
151  coneSizes.push_back(theConesInfo.size(icone));
153  cutvalues.push_back(thresholds->thresholdValueForEfficiency(location, nominalEfficiency));
154  }
155  return Cuts(etaBounds, coneSizes, cutvalues);
156 }
float thresholdValueForEfficiency(ThresholdLocation location, float eff_thr) const
double f[11][100]

◆ findPath()

string IsolatorByNominalEfficiency::findPath ( const std::string &  fileName)
private

Definition at line 57 of file IsolatorByNominalEfficiency.cc.

References f, and MillePedeFileConverter_cfg::fileName.

57  {
58  // FIXME
60  return f.fullPath();
61 }
double f[11][100]

◆ result()

MuIsoBaseIsolator::Result IsolatorByNominalEfficiency::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 63 of file IsolatorByNominalEfficiency.cc.

References bestConeForEfficiencyIndex(), hltPFPuppi_cfi::cone, HLT_2023v12_cff::coneSize, gather_cfg::cout, CandIsolatorFromDeposits_cfi::deposits, EcalCondDBWriter_cfi::location, resultType(), muonisolation::IsolatorByNominalEfficiency::ConeSizes::size(), theConesInfo, thresholds, muonisolation::NominalEfficiencyThresholds::thresholdValueForEfficiency(), and weightedSum().

Referenced by cones().

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

◆ resultType()

ResultType muonisolation::IsolatorByNominalEfficiency::resultType ( ) const
inlineoverrideprivatevirtual

◆ weightedSum()

double IsolatorByNominalEfficiency::weightedSum ( const DepositContainer deposits,
float  dRcone 
) const
privatevirtual

Definition at line 123 of file IsolatorByNominalEfficiency.cc.

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

Referenced by result().

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

Member Data Documentation

◆ coneForEfficiency

mapNomEff_Cone muonisolation::IsolatorByNominalEfficiency::coneForEfficiency
private

Definition at line 69 of file IsolatorByNominalEfficiency.h.

Referenced by bestConeForEfficiencyIndex().

◆ theConesInfo

ConeSizes muonisolation::IsolatorByNominalEfficiency::theConesInfo
private

Definition at line 73 of file IsolatorByNominalEfficiency.h.

Referenced by cuts(), and result().

◆ theDepThresholds

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

Definition at line 72 of file IsolatorByNominalEfficiency.h.

Referenced by weightedSum().

◆ theWeights

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

Definition at line 71 of file IsolatorByNominalEfficiency.h.

Referenced by weightedSum().

◆ thresholds

NominalEfficiencyThresholds* muonisolation::IsolatorByNominalEfficiency::thresholds
private

Definition at line 70 of file IsolatorByNominalEfficiency.h.

Referenced by cuts(), result(), and ~IsolatorByNominalEfficiency().