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.

44 { delete thresholds; }

References thresholds.

Member Function Documentation

◆ bestConeForEfficiencyIndex()

int IsolatorByNominalEfficiency::bestConeForEfficiencyIndex ( float  eff_thr) const
private

Definition at line 107 of file IsolatorByNominalEfficiency.cc.

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 }

References coneForEfficiency.

Referenced by cuts(), and result().

◆ cones()

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

Definition at line 46 of file IsolatorByNominalEfficiency.cc.

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 }

References result().

◆ cuts()

Cuts IsolatorByNominalEfficiency::cuts ( float  nominalEfficiency) const

Definition at line 144 of file IsolatorByNominalEfficiency.cc.

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 }

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

◆ findPath()

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

Definition at line 57 of file IsolatorByNominalEfficiency.cc.

57  {
58  // FIXME
60  return f.fullPath();
61 }

References f, and MillePedeFileConverter_cfg::fileName.

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

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) {
85  int cone = bestConeForEfficiencyIndex(eff);
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 }

References bestConeForEfficiencyIndex(), HLT_2018_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().

◆ resultType()

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

Implements muonisolation::MuIsoBaseIsolator.

Definition at line 66 of file IsolatorByNominalEfficiency.h.

66 { return ISOL_FLOAT_TYPE; }

References muonisolation::MuIsoBaseIsolator::ISOL_FLOAT_TYPE.

Referenced by result().

◆ weightedSum()

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

Definition at line 123 of file IsolatorByNominalEfficiency.cc.

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 }

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

Referenced by result().

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

muonisolation::MuIsoBaseIsolator::ISOL_FLOAT_TYPE
Definition: MuIsoBaseIsolator.h:25
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
gather_cfg.cout
cout
Definition: gather_cfg.py:144
cms::cuda::assert
assert(be >=bs)
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
muonisolation::IsolatorByNominalEfficiency::theDepThresholds
std::vector< double > theDepThresholds
Definition: IsolatorByNominalEfficiency.h:72
edm::FileInPath
Definition: FileInPath.h:64
HLT_2018_cff.coneSize
coneSize
Definition: HLT_2018_cff.py:49353
muonisolation::IsolatorByNominalEfficiency::theConesInfo
ConeSizes theConesInfo
Definition: IsolatorByNominalEfficiency.h:73
muonisolation::IsolatorByNominalEfficiency::ConeSizes::size
double size(int i) const
Definition: IsolatorByNominalEfficiency.cc:9
PVValHelper::eta
Definition: PVValidationHelpers.h:69
w
const double w
Definition: UKUtility.cc:23
muonisolation::MuIsoBaseIsolator::Vetos
reco::IsoDeposit::Vetos Vetos
Definition: MuIsoBaseIsolator.h:15
muonisolation::IsolatorByNominalEfficiency::coneForEfficiency
mapNomEff_Cone coneForEfficiency
Definition: IsolatorByNominalEfficiency.h:69
muonisolation::IsolatorByNominalEfficiency::bestConeForEfficiencyIndex
int bestConeForEfficiencyIndex(float eff_thr) const
Definition: IsolatorByNominalEfficiency.cc:107
muonisolation::Cuts
Definition: Cuts.h:14
muonisolation::IsolatorByNominalEfficiency::result
Result result(const DepositContainer &deposits, const edm::Event *=nullptr) const override
Compute the deposit within the cone and return the isolation result.
Definition: IsolatorByNominalEfficiency.cc:63
muonisolation::IsolatorByNominalEfficiency::weightedSum
virtual double weightedSum(const DepositContainer &deposits, float dRcone) const
Definition: IsolatorByNominalEfficiency.cc:123
muonisolation::IsolatorByNominalEfficiency::theWeights
std::vector< double > theWeights
Definition: IsolatorByNominalEfficiency.h:71
muonisolation::NominalEfficiencyThresholds::thresholdValueForEfficiency
float thresholdValueForEfficiency(ThresholdLocation location, float eff_thr) const
Definition: NominalEfficiencyThresholds.cc:124
res
Definition: Electron.h:6
muonisolation::NominalEfficiencyThresholds::bins
std::vector< double > bins() const
Definition: NominalEfficiencyThresholds.cc:44
muonisolation::IsolatorByNominalEfficiency::thresholds
NominalEfficiencyThresholds * thresholds
Definition: IsolatorByNominalEfficiency.h:70
EcalCondDBWriter_cfi.location
location
Definition: EcalCondDBWriter_cfi.py:63
PFRecoTauChargedHadronBuilderPlugins_cfi.dRcone
dRcone
Definition: PFRecoTauChargedHadronBuilderPlugins_cfi.py:46
muonisolation::IsolatorByNominalEfficiency::resultType
ResultType resultType() const override
Definition: IsolatorByNominalEfficiency.h:66
CandIsolatorFromDeposits_cfi.deposits
deposits
Definition: CandIsolatorFromDeposits_cfi.py:4
muonisolation::NominalEfficiencyThresholds::ThresholdLocation
threshold location
Definition: NominalEfficiencyThresholds.h:17
muonisolation::IsolatorByNominalEfficiency::mapNomEff_Cone
std::multimap< float, int > mapNomEff_Cone
Definition: IsolatorByNominalEfficiency.h:61