CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CutsIsolatorWithCorrection Class Reference

#include <CutsIsolatorWithCorrection.h>

Inheritance diagram for CutsIsolatorWithCorrection:
muonisolation::MuIsoBaseIsolator

Public Member Functions

 CutsIsolatorWithCorrection (const edm::ParameterSet &par, edm::ConsumesCollector &&iC)
 
Result result (const DepositContainer &deposits, const edm::Event *=nullptr) const override
 Compute and return the isolation variable. More...
 
Result result (const DepositContainer &deposits, const reco::Track &tk, const edm::Event *=nullptr) const override
 Compute and return the isolation variable, with vetoes and the muon. More...
 
ResultType resultType () const 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 ~MuIsoBaseIsolator ()
 

Private Member Functions

double depSum (const DepositContainer &deposits, double dr, double corr) const
 

Private Attributes

bool theAndOrCuts
 
bool theCutAbsIso
 
bool theCutRelativeIso
 
muonisolation::Cuts theCuts
 
muonisolation::Cuts theCutsRel
 
double theEffAreaSFBarrel
 
double theEffAreaSFEndcap
 
bool theReturnAbsoluteSum
 
bool theReturnRelativeSum
 
double theRhoMax
 
double theRhoScaleBarrel
 
double theRhoScaleEndcap
 
edm::EDGetTokenT< double > theRhoToken
 
bool theUseRhoCorrection
 

Additional Inherited Members

- 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
 

Detailed Description

Definition at line 9 of file CutsIsolatorWithCorrection.h.

Constructor & Destructor Documentation

◆ CutsIsolatorWithCorrection()

CutsIsolatorWithCorrection::CutsIsolatorWithCorrection ( const edm::ParameterSet par,
edm::ConsumesCollector &&  iC 
)

Definition at line 8 of file CutsIsolatorWithCorrection.cc.

References Exception, theCutAbsIso, and theCutRelativeIso.

9  : theCuts(par.getParameter<std::vector<double> >("EtaBounds"),
10  par.getParameter<std::vector<double> >("ConeSizes"),
11  par.getParameter<std::vector<double> >("Thresholds")),
12  theCutsRel(par.getParameter<std::vector<double> >("EtaBoundsRel"),
13  par.getParameter<std::vector<double> >("ConeSizesRel"),
14  par.getParameter<std::vector<double> >("ThresholdsRel")),
15  theCutAbsIso(par.getParameter<bool>("CutAbsoluteIso")),
16  theCutRelativeIso(par.getParameter<bool>("CutRelativeIso")),
17  theUseRhoCorrection(par.getParameter<bool>("UseRhoCorrection")),
18  theRhoToken(iC.consumes<double>(par.getParameter<edm::InputTag>("RhoSrc"))),
19  theRhoMax(par.getParameter<double>("RhoMax")),
20  theRhoScaleBarrel(par.getParameter<double>("RhoScaleBarrel")),
21  theRhoScaleEndcap(par.getParameter<double>("RhoScaleEndcap")),
22  theEffAreaSFBarrel(par.getParameter<double>("EffAreaSFBarrel")),
23  theEffAreaSFEndcap(par.getParameter<double>("EffAreaSFEndcap")),
24  theReturnAbsoluteSum(par.getParameter<bool>("ReturnAbsoluteSum")),
25  theReturnRelativeSum(par.getParameter<bool>("ReturnRelativeSum")),
26  theAndOrCuts(par.getParameter<bool>("AndOrCuts")) {
28  throw cms::Exception("BadConfiguration")
29  << "Something has to be cut: set either CutAbsoluteIso or CutRelativeIso to true";
30 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< double > theRhoToken

Member Function Documentation

◆ depSum()

double CutsIsolatorWithCorrection::depSum ( const DepositContainer deposits,
double  dr,
double  corr 
) const
private

Definition at line 32 of file CutsIsolatorWithCorrection.cc.

References alignCSCRings::corr, CandIsolatorFromDeposits_cfi::deposits, and l1ctLayer1_cff::dr.

Referenced by result().

32  {
33  double dephlt = -corr;
34  unsigned int nDeps = deposits.size();
35  // edm::LogWarning("CutsIsolatorWithCorrection::depSumIn")
36  // << "add nDeposit "<< nDeps<< " \t dr "<<dr<<" \t corr "<<corr;
37  for (unsigned int iDep = 0; iDep < nDeps; ++iDep) {
38  double lDep = deposits[iDep].dep->depositWithin(dr);
39  dephlt += lDep;
40  // edm::LogWarning("CutsIsolatorWithCorrection::depSumIDep")
41  // <<"dep "<<iDep<<" \t added "<<lDep<<" \t sumnow "<<dephlt;
42  }
43 
44  return dephlt;
45 }
dictionary corr

◆ result() [1/2]

Result CutsIsolatorWithCorrection::result ( const DepositContainer deposits,
const edm::Event = nullptr 
) const
inlineoverridevirtual

Compute and return the isolation variable.

Implements muonisolation::MuIsoBaseIsolator.

Definition at line 15 of file CutsIsolatorWithCorrection.h.

References muonisolation::MuIsoBaseIsolator::ISOL_BOOL_TYPE, and muonisolation::MuIsoBaseIsolator::Result::valBool.

15  {
16  Result answer(ISOL_BOOL_TYPE);
17  answer.valBool = false;
18  // fail miserably...
19  return answer;
20  }

◆ result() [2/2]

MuIsoBaseIsolator::Result CutsIsolatorWithCorrection::result ( const DepositContainer deposits,
const reco::Track muon,
const edm::Event = nullptr 
) const
overridevirtual

Compute and return the isolation variable, with vetoes and the muon.

Reimplemented from muonisolation::MuIsoBaseIsolator.

Definition at line 47 of file CutsIsolatorWithCorrection.cc.

References L1NNTauProducer_cff::conesize, muonisolation::Cuts::CutSpec::conesize, CandIsolatorFromDeposits_cfi::deposits, depSum(), reco::TrackBase::eta(), makeMEIFBenchmarkPlots::ev, nano_mu_digi_cff::float, muonisolation::MuIsoBaseIsolator::ISOL_BOOL_TYPE, pi, edm::Handle< T >::product(), reco::TrackBase::pt(), rho, HLT_2024v14_cff::rhoScale, theAndOrCuts, theCutAbsIso, theCutRelativeIso, theCuts, theCutsRel, theEffAreaSFBarrel, theEffAreaSFEndcap, theReturnAbsoluteSum, theReturnRelativeSum, theRhoMax, theRhoScaleBarrel, theRhoScaleEndcap, theRhoToken, theUseRhoCorrection, muonisolation::Cuts::CutSpec::threshold, muonisolation::MuIsoBaseIsolator::Result::valBool, and muonisolation::MuIsoBaseIsolator::Result::valFloat.

49  {
50  Result answer(ISOL_BOOL_TYPE);
51 
52  bool absDecision = false;
53  bool relDecision = false;
54 
55  double rho = 0.0;
56  double effAreaSF = 1.0;
57 
58  static const double pi = 3.14159265358979323846;
59 
60  // edm::LogWarning("CutsIsolatorWithCorrection::resultIn")
61  // <<"Start tk.pt "<<tk.pt()<<" \t tk.eta "<<tk.eta()<<" \t tk.phi "<<tk.phi();
62 
63  if (theUseRhoCorrection) {
64  edm::Handle<double> rhoHandle;
65  ev->getByToken(theRhoToken, rhoHandle);
66  rho = *(rhoHandle.product());
67  if (rho < 0.0)
68  rho = 0.0;
69  double rhoScale = fabs(tk.eta()) > 1.442 ? theRhoScaleEndcap : theRhoScaleBarrel;
70  effAreaSF = fabs(tk.eta()) > 1.442 ? theEffAreaSFEndcap : theEffAreaSFBarrel;
71  // edm::LogWarning("CutsIsolatorWithCorrection::resultInRho")
72  // << "got rho "<<rho<<" vs max "<<theRhoMax<<" will scale by "<<rhoScale;
73  if (rho > theRhoMax) {
74  rho = theRhoMax;
75  }
76  rho = rho * rhoScale;
77  // edm::LogWarning("CutsIsolatorWithCorrection::resultOutRho")<<" final rho "<<rho;
78  }
79 
80  if (theCutAbsIso) {
81  muonisolation::Cuts::CutSpec cuts_here = theCuts(tk.eta());
82  double conesize = cuts_here.conesize;
83  double dephlt = depSum(deposits, conesize, rho * conesize * conesize * pi * effAreaSF);
85  answer.valFloat = (float)dephlt;
86  if (dephlt < cuts_here.threshold) {
87  absDecision = true;
88  } else {
89  absDecision = false;
90  }
91  // edm::LogWarning("CutsIsolatorWithCorrection::resultOutAbsIso")
92  // <<"compared dephlt "<<dephlt<<" \t with "<<cuts_here.threshold;
93  } else
94  absDecision = true;
95 
96  if (theCutRelativeIso) {
97  muonisolation::Cuts::CutSpec cuts_here = theCutsRel(tk.eta());
98  double conesize = cuts_here.conesize;
99  double dephlt = depSum(deposits, conesize, rho * conesize * conesize * pi * effAreaSF) / tk.pt();
101  answer.valFloat = (float)dephlt;
102  if (dephlt < cuts_here.threshold) {
103  relDecision = true;
104  } else {
105  relDecision = false;
106  }
107  // edm::LogWarning("CutsIsolatorWithCorrection::resultOutRelIso")
108  // <<"compared dephlt "<<dephlt<<" \t with "<<cuts_here.threshold;
109  } else
110  relDecision = true;
111 
112  if (theAndOrCuts) {
113  answer.valBool = absDecision && relDecision;
114  } else {
115  answer.valBool = absDecision || relDecision;
116  }
117 
118  // edm::LogWarning("CutsIsolatorWithCorrection::result")
119  // <<"isAbsIsolated "<<absDecision<<" \t isRelIsolated "<<relDecision
120  // <<" \t combined with AND "<<theAndOrCuts
121  // <<" = " << answer.valBool;
122 
123  return answer;
124 }
T const * product() const
Definition: Handle.h:70
const Double_t pi
edm::EDGetTokenT< double > theRhoToken
double depSum(const DepositContainer &deposits, double dr, double corr) const

◆ resultType()

ResultType CutsIsolatorWithCorrection::resultType ( ) const
inlineoverridevirtual

Member Data Documentation

◆ theAndOrCuts

bool CutsIsolatorWithCorrection::theAndOrCuts
private

Definition at line 42 of file CutsIsolatorWithCorrection.h.

Referenced by result().

◆ theCutAbsIso

bool CutsIsolatorWithCorrection::theCutAbsIso
private

Definition at line 31 of file CutsIsolatorWithCorrection.h.

Referenced by CutsIsolatorWithCorrection(), and result().

◆ theCutRelativeIso

bool CutsIsolatorWithCorrection::theCutRelativeIso
private

Definition at line 32 of file CutsIsolatorWithCorrection.h.

Referenced by CutsIsolatorWithCorrection(), and result().

◆ theCuts

muonisolation::Cuts CutsIsolatorWithCorrection::theCuts
private

Definition at line 28 of file CutsIsolatorWithCorrection.h.

Referenced by result().

◆ theCutsRel

muonisolation::Cuts CutsIsolatorWithCorrection::theCutsRel
private

Definition at line 29 of file CutsIsolatorWithCorrection.h.

Referenced by result().

◆ theEffAreaSFBarrel

double CutsIsolatorWithCorrection::theEffAreaSFBarrel
private

Definition at line 38 of file CutsIsolatorWithCorrection.h.

Referenced by result().

◆ theEffAreaSFEndcap

double CutsIsolatorWithCorrection::theEffAreaSFEndcap
private

Definition at line 39 of file CutsIsolatorWithCorrection.h.

Referenced by result().

◆ theReturnAbsoluteSum

bool CutsIsolatorWithCorrection::theReturnAbsoluteSum
private

Definition at line 40 of file CutsIsolatorWithCorrection.h.

Referenced by result().

◆ theReturnRelativeSum

bool CutsIsolatorWithCorrection::theReturnRelativeSum
private

Definition at line 41 of file CutsIsolatorWithCorrection.h.

Referenced by result().

◆ theRhoMax

double CutsIsolatorWithCorrection::theRhoMax
private

Definition at line 35 of file CutsIsolatorWithCorrection.h.

Referenced by result().

◆ theRhoScaleBarrel

double CutsIsolatorWithCorrection::theRhoScaleBarrel
private

Definition at line 36 of file CutsIsolatorWithCorrection.h.

Referenced by result().

◆ theRhoScaleEndcap

double CutsIsolatorWithCorrection::theRhoScaleEndcap
private

Definition at line 37 of file CutsIsolatorWithCorrection.h.

Referenced by result().

◆ theRhoToken

edm::EDGetTokenT<double> CutsIsolatorWithCorrection::theRhoToken
private

Definition at line 34 of file CutsIsolatorWithCorrection.h.

Referenced by result().

◆ theUseRhoCorrection

bool CutsIsolatorWithCorrection::theUseRhoCorrection
private

Definition at line 33 of file CutsIsolatorWithCorrection.h.

Referenced by result().