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.

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 }

References Exception, theCutAbsIso, and theCutRelativeIso.

Member Function Documentation

◆ depSum()

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

Definition at line 32 of file CutsIsolatorWithCorrection.cc.

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 }

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

Referenced by result().

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

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

References submit::answer, and muonisolation::MuIsoBaseIsolator::ISOL_BOOL_TYPE.

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

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 }

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

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

muonisolation::MuIsoBaseIsolator::ISOL_BOOL_TYPE
Definition: MuIsoBaseIsolator.h:25
CutsIsolatorWithCorrection::theRhoMax
double theRhoMax
Definition: CutsIsolatorWithCorrection.h:35
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
CutsIsolatorWithCorrection::theEffAreaSFBarrel
double theEffAreaSFBarrel
Definition: CutsIsolatorWithCorrection.h:38
edm::Handle::product
T const * product() const
Definition: Handle.h:70
CutsIsolatorWithCorrection::theCutAbsIso
bool theCutAbsIso
Definition: CutsIsolatorWithCorrection.h:31
CutsIsolatorWithCorrection::theAndOrCuts
bool theAndOrCuts
Definition: CutsIsolatorWithCorrection.h:42
CutsIsolatorWithCorrection::theRhoToken
edm::EDGetTokenT< double > theRhoToken
Definition: CutsIsolatorWithCorrection.h:34
CutsIsolatorWithCorrection::theReturnRelativeSum
bool theReturnRelativeSum
Definition: CutsIsolatorWithCorrection.h:41
edm::Handle< double >
CutsIsolatorWithCorrection::theEffAreaSFEndcap
double theEffAreaSFEndcap
Definition: CutsIsolatorWithCorrection.h:39
CutsIsolatorWithCorrection::theCutsRel
muonisolation::Cuts theCutsRel
Definition: CutsIsolatorWithCorrection.h:29
CutsIsolatorWithCorrection::theCutRelativeIso
bool theCutRelativeIso
Definition: CutsIsolatorWithCorrection.h:32
CutsIsolatorWithCorrection::theRhoScaleEndcap
double theRhoScaleEndcap
Definition: CutsIsolatorWithCorrection.h:37
alignCSCRings.corr
dictionary corr
Definition: alignCSCRings.py:124
edm::ConsumesCollector::consumes
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
Definition: ConsumesCollector.h:55
CutsIsolatorWithCorrection::theCuts
muonisolation::Cuts theCuts
Definition: CutsIsolatorWithCorrection.h:28
DDAxes::rho
submit.answer
answer
Definition: submit.py:45
CutsIsolatorWithCorrection::theUseRhoCorrection
bool theUseRhoCorrection
Definition: CutsIsolatorWithCorrection.h:33
CutsIsolatorWithCorrection::theRhoScaleBarrel
double theRhoScaleBarrel
Definition: CutsIsolatorWithCorrection.h:36
CutsIsolatorWithCorrection::depSum
double depSum(const DepositContainer &deposits, double dr, double corr) const
Definition: CutsIsolatorWithCorrection.cc:32
CutsIsolatorWithCorrection::theReturnAbsoluteSum
bool theReturnAbsoluteSum
Definition: CutsIsolatorWithCorrection.h:40
HLT_FULL_cff.rhoScale
rhoScale
Definition: HLT_FULL_cff.py:14991
ev
bool ev
Definition: Hydjet2Hadronizer.cc:95
flavorHistoryFilter_cfi.dr
dr
Definition: flavorHistoryFilter_cfi.py:37
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
muonisolation::Cuts::CutSpec::conesize
double conesize
Definition: Cuts.h:18
muonisolation::Cuts::CutSpec::threshold
double threshold
Definition: Cuts.h:19
pi
const Double_t pi
Definition: trackSplitPlot.h:36
muonisolation::Cuts::CutSpec
Definition: Cuts.h:16
CandIsolatorFromDeposits_cfi.deposits
deposits
Definition: CandIsolatorFromDeposits_cfi.py:4
edm::InputTag
Definition: InputTag.h:15