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 *=0) const override
 Compute and return the isolation variable. More...
 
Result result (const DepositContainer &deposits, const reco::Track &tk, const edm::Event *=0) 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 *=0) 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 ( const edm::ParameterSet par,
edm::ConsumesCollector &&  iC 
)

Definition at line 8 of file CutsIsolatorWithCorrection.cc.

References Exception, theCutAbsIso, and theCutRelativeIso.

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

Member Function Documentation

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

Definition at line 33 of file CutsIsolatorWithCorrection.cc.

References corr, and JetCorrectorParameters::size().

Referenced by result().

33  {
34  double dephlt = -corr;
35  unsigned int nDeps = deposits.size();
36  // edm::LogWarning("CutsIsolatorWithCorrection::depSumIn")
37  // << "add nDeposit "<< nDeps<< " \t dr "<<dr<<" \t corr "<<corr;
38  for(unsigned int iDep = 0; iDep < nDeps; ++iDep ){
39  double lDep = deposits[iDep].dep->depositWithin(dr);
40  dephlt += lDep;
41  // edm::LogWarning("CutsIsolatorWithCorrection::depSumIDep")
42  // <<"dep "<<iDep<<" \t added "<<lDep<<" \t sumnow "<<dephlt;
43  }
44 
45  return dephlt;
46 }
JetCorrectorParameters corr
Definition: classes.h:5
Result CutsIsolatorWithCorrection::result ( const DepositContainer deposits,
const edm::Event = 0 
) const
inlineoverridevirtual
MuIsoBaseIsolator::Result CutsIsolatorWithCorrection::result ( const DepositContainer deposits,
const reco::Track muon,
const edm::Event = 0 
) const
overridevirtual

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

Reimplemented from muonisolation::MuIsoBaseIsolator.

Definition at line 48 of file CutsIsolatorWithCorrection.cc.

References submit::answer, muonisolation::Cuts::CutSpec::conesize, depSum(), reco::TrackBase::eta(), objects.autophobj::float, edm::Event::getByToken(), muonisolation::MuIsoBaseIsolator::ISOL_BOOL_TYPE, pi, edm::Handle< T >::product(), reco::TrackBase::pt(), rho, egammaForCoreTracking_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.

48  {
49  Result answer(ISOL_BOOL_TYPE);
50 
51  bool absDecision = false;
52  bool relDecision = false;
53 
54  double rho = 0.0;
55  double effAreaSF = 1.0;
56 
57  static const double pi = 3.14159265358979323846;
58 
59  // edm::LogWarning("CutsIsolatorWithCorrection::resultIn")
60  // <<"Start tk.pt "<<tk.pt()<<" \t tk.eta "<<tk.eta()<<" \t tk.phi "<<tk.phi();
61 
62 
63 
65  edm::Handle<double> rhoHandle;
66  ev->getByToken(theRhoToken, rhoHandle);
67  rho = *(rhoHandle.product());
68  if (rho < 0.0) 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);
84  if (theReturnAbsoluteSum ) answer.valFloat = (float)dephlt;
85  if (dephlt<cuts_here.threshold) {
86  absDecision = true;
87  } else {
88  absDecision = false;
89  }
90  // edm::LogWarning("CutsIsolatorWithCorrection::resultOutAbsIso")
91  // <<"compared dephlt "<<dephlt<<" \t with "<<cuts_here.threshold;
92  } else absDecision = true;
93 
94  if (theCutRelativeIso){
95  muonisolation::Cuts::CutSpec cuts_here = theCutsRel(tk.eta());
96  double conesize = cuts_here.conesize;
97  double dephlt = depSum(deposits, conesize, rho*conesize*conesize*pi*effAreaSF)/tk.pt();
98  if (theReturnRelativeSum ) answer.valFloat = (float)dephlt;
99  if (dephlt<cuts_here.threshold) {
100  relDecision = true;
101  } else {
102  relDecision = false;
103  }
104  // edm::LogWarning("CutsIsolatorWithCorrection::resultOutRelIso")
105  // <<"compared dephlt "<<dephlt<<" \t with "<<cuts_here.threshold;
106  } else relDecision = true;
107 
108 
109  if (theAndOrCuts){
110  answer.valBool = absDecision && relDecision;
111  } else {
112  answer.valBool = absDecision || relDecision;
113  }
114 
115  // edm::LogWarning("CutsIsolatorWithCorrection::result")
116  // <<"isAbsIsolated "<<absDecision<<" \t isRelIsolated "<<relDecision
117  // <<" \t combined with AND "<<theAndOrCuts
118  // <<" = " << answer.valBool;
119 
120  return answer;
121 }
double depSum(const DepositContainer &deposits, double dr, double corr) const
bool ev
const Double_t pi
T const * product() const
Definition: Handle.h:74
edm::EDGetTokenT< double > theRhoToken
answer
Definition: submit.py:45
ResultType CutsIsolatorWithCorrection::resultType ( ) const
inlineoverridevirtual

Member Data Documentation

bool CutsIsolatorWithCorrection::theAndOrCuts
private

Definition at line 43 of file CutsIsolatorWithCorrection.h.

Referenced by result().

bool CutsIsolatorWithCorrection::theCutAbsIso
private

Definition at line 32 of file CutsIsolatorWithCorrection.h.

Referenced by CutsIsolatorWithCorrection(), and result().

bool CutsIsolatorWithCorrection::theCutRelativeIso
private

Definition at line 33 of file CutsIsolatorWithCorrection.h.

Referenced by CutsIsolatorWithCorrection(), and result().

muonisolation::Cuts CutsIsolatorWithCorrection::theCuts
private

Definition at line 29 of file CutsIsolatorWithCorrection.h.

Referenced by result().

muonisolation::Cuts CutsIsolatorWithCorrection::theCutsRel
private

Definition at line 30 of file CutsIsolatorWithCorrection.h.

Referenced by result().

double CutsIsolatorWithCorrection::theEffAreaSFBarrel
private

Definition at line 39 of file CutsIsolatorWithCorrection.h.

Referenced by result().

double CutsIsolatorWithCorrection::theEffAreaSFEndcap
private

Definition at line 40 of file CutsIsolatorWithCorrection.h.

Referenced by result().

bool CutsIsolatorWithCorrection::theReturnAbsoluteSum
private

Definition at line 41 of file CutsIsolatorWithCorrection.h.

Referenced by result().

bool CutsIsolatorWithCorrection::theReturnRelativeSum
private

Definition at line 42 of file CutsIsolatorWithCorrection.h.

Referenced by result().

double CutsIsolatorWithCorrection::theRhoMax
private

Definition at line 36 of file CutsIsolatorWithCorrection.h.

Referenced by result().

double CutsIsolatorWithCorrection::theRhoScaleBarrel
private

Definition at line 37 of file CutsIsolatorWithCorrection.h.

Referenced by result().

double CutsIsolatorWithCorrection::theRhoScaleEndcap
private

Definition at line 38 of file CutsIsolatorWithCorrection.h.

Referenced by result().

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

Definition at line 35 of file CutsIsolatorWithCorrection.h.

Referenced by result().

bool CutsIsolatorWithCorrection::theUseRhoCorrection
private

Definition at line 34 of file CutsIsolatorWithCorrection.h.

Referenced by result().