CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual Result result (const DepositContainer &deposits, const edm::Event *=0) const
 Compute and return the isolation variable. More...
 
virtual Result result (const DepositContainer &deposits, const reco::Track &tk, const edm::Event *=0) const
 Compute and return the isolation variable, with vetoes and the muon. More...
 
virtual ResultType resultType () const
 
- 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::InputTag theRhoSrc
 
bool theUseRhoCorrection
 

Additional Inherited Members

- Public Types inherited from muonisolation::MuIsoBaseIsolator
typedef std::vector
< DepositAndVetos
DepositContainer
 
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 8 of file CutsIsolatorWithCorrection.h.

Constructor & Destructor Documentation

CutsIsolatorWithCorrection::CutsIsolatorWithCorrection ( const edm::ParameterSet par)

Definition at line 8 of file CutsIsolatorWithCorrection.cc.

References edm::hlt::Exception, theCutAbsIso, and theCutRelativeIso.

8  :
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  theRhoSrc(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"))
27 {
28  if (! ( theCutAbsIso || theCutRelativeIso ) ) throw cms::Exception("BadConfiguration")
29  << "Something has to be cut: set either CutAbsoluteIso or CutRelativeIso to true";
30 }
T getParameter(std::string const &) const

Member Function Documentation

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

Definition at line 32 of file CutsIsolatorWithCorrection.cc.

References corr, and JetCorrectorParameters::size().

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 }
JetCorrectorParameters corr
Definition: classes.h:9
virtual Result CutsIsolatorWithCorrection::result ( const DepositContainer deposits,
const edm::Event = 0 
) const
inlinevirtual

Compute and return the isolation variable.

Implements muonisolation::MuIsoBaseIsolator.

Definition at line 14 of file CutsIsolatorWithCorrection.h.

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

14  {
15  Result answer(ISOL_BOOL_TYPE);
16  answer.valBool = false;
17  // fail miserably...
18  return answer;
19  }
answer
Definition: submit.py:44
MuIsoBaseIsolator::Result CutsIsolatorWithCorrection::result ( const DepositContainer deposits,
const reco::Track muon,
const edm::Event = 0 
) const
virtual

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

Reimplemented from muonisolation::MuIsoBaseIsolator.

Definition at line 47 of file CutsIsolatorWithCorrection.cc.

References submit::answer, muonisolation::Cuts::CutSpec::conesize, depSum(), reco::TrackBase::eta(), edm::Event::getByLabel(), muonisolation::MuIsoBaseIsolator::ISOL_BOOL_TYPE, pi, edm::Handle< T >::product(), reco::TrackBase::pt(), rho, theAndOrCuts, theCutAbsIso, theCutRelativeIso, theCuts, theCutsRel, theEffAreaSFBarrel, theEffAreaSFEndcap, theReturnAbsoluteSum, theReturnRelativeSum, theRhoMax, theRhoScaleBarrel, theRhoScaleEndcap, theRhoSrc, theUseRhoCorrection, muonisolation::Cuts::CutSpec::threshold, muonisolation::MuIsoBaseIsolator::Result::valBool, and muonisolation::MuIsoBaseIsolator::Result::valFloat.

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

Member Data Documentation

bool CutsIsolatorWithCorrection::theAndOrCuts
private

Definition at line 41 of file CutsIsolatorWithCorrection.h.

Referenced by result().

bool CutsIsolatorWithCorrection::theCutAbsIso
private

Definition at line 30 of file CutsIsolatorWithCorrection.h.

Referenced by CutsIsolatorWithCorrection(), and result().

bool CutsIsolatorWithCorrection::theCutRelativeIso
private

Definition at line 31 of file CutsIsolatorWithCorrection.h.

Referenced by CutsIsolatorWithCorrection(), and result().

muonisolation::Cuts CutsIsolatorWithCorrection::theCuts
private

Definition at line 27 of file CutsIsolatorWithCorrection.h.

Referenced by result().

muonisolation::Cuts CutsIsolatorWithCorrection::theCutsRel
private

Definition at line 28 of file CutsIsolatorWithCorrection.h.

Referenced by result().

double CutsIsolatorWithCorrection::theEffAreaSFBarrel
private

Definition at line 37 of file CutsIsolatorWithCorrection.h.

Referenced by result().

double CutsIsolatorWithCorrection::theEffAreaSFEndcap
private

Definition at line 38 of file CutsIsolatorWithCorrection.h.

Referenced by result().

bool CutsIsolatorWithCorrection::theReturnAbsoluteSum
private

Definition at line 39 of file CutsIsolatorWithCorrection.h.

Referenced by result().

bool CutsIsolatorWithCorrection::theReturnRelativeSum
private

Definition at line 40 of file CutsIsolatorWithCorrection.h.

Referenced by result().

double CutsIsolatorWithCorrection::theRhoMax
private

Definition at line 34 of file CutsIsolatorWithCorrection.h.

Referenced by result().

double CutsIsolatorWithCorrection::theRhoScaleBarrel
private

Definition at line 35 of file CutsIsolatorWithCorrection.h.

Referenced by result().

double CutsIsolatorWithCorrection::theRhoScaleEndcap
private

Definition at line 36 of file CutsIsolatorWithCorrection.h.

Referenced by result().

edm::InputTag CutsIsolatorWithCorrection::theRhoSrc
private

Definition at line 33 of file CutsIsolatorWithCorrection.h.

Referenced by result().

bool CutsIsolatorWithCorrection::theUseRhoCorrection
private

Definition at line 32 of file CutsIsolatorWithCorrection.h.

Referenced by result().