CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

CutsIsolatorWithCorrection Class Reference

#include <CutsIsolatorWithCorrection.h>

Inheritance diagram for CutsIsolatorWithCorrection:
muonisolation::MuIsoBaseIsolator

List of all members.

Public Member Functions

 CutsIsolatorWithCorrection (const edm::ParameterSet &par)
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.
virtual Result result (const DepositContainer &deposits, const edm::Event *=0) const
 Compute and return the isolation variable.
virtual ResultType resultType () const

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

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 Exception, theCutAbsIso, and theCutRelativeIso.

                                                                                 :
  theCuts(par.getParameter<std::vector<double> > ("EtaBounds"),
          par.getParameter<std::vector<double> > ("ConeSizes"),
          par.getParameter<std::vector<double> > ("Thresholds")),
  theCutsRel(par.getParameter<std::vector<double> > ("EtaBoundsRel"),
          par.getParameter<std::vector<double> > ("ConeSizesRel"),
          par.getParameter<std::vector<double> > ("ThresholdsRel")),
  theCutAbsIso(par.getParameter<bool>("CutAbsoluteIso")),
  theCutRelativeIso(par.getParameter<bool>("CutRelativeIso")),
  theUseRhoCorrection(par.getParameter<bool>("UseRhoCorrection")),
  theRhoSrc(par.getParameter<edm::InputTag>("RhoSrc")),
  theRhoMax(par.getParameter<double>("RhoMax")),
  theRhoScaleBarrel(par.getParameter<double>("RhoScaleBarrel")),
  theRhoScaleEndcap(par.getParameter<double>("RhoScaleEndcap")),
  theEffAreaSFBarrel(par.getParameter<double>("EffAreaSFBarrel")),
  theEffAreaSFEndcap(par.getParameter<double>("EffAreaSFEndcap")),
  theReturnAbsoluteSum(par.getParameter<bool>("ReturnAbsoluteSum")),
  theReturnRelativeSum(par.getParameter<bool>("ReturnRelativeSum")),
  theAndOrCuts(par.getParameter<bool>("AndOrCuts"))
{
  if (! ( theCutAbsIso || theCutRelativeIso ) ) throw cms::Exception("BadConfiguration")
    << "Something has to be cut: set either CutAbsoluteIso or CutRelativeIso to true";
}

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

                                                                                                        {
  double dephlt = -corr;
  unsigned int nDeps = deposits.size();
  //  edm::LogWarning("CutsIsolatorWithCorrection::depSumIn")
  //    << "add nDeposit "<< nDeps<< " \t dr "<<dr<<" \t corr "<<corr;
  for(unsigned int iDep = 0; iDep < nDeps; ++iDep ){
    double lDep = deposits[iDep].dep->depositWithin(dr);
    dephlt += lDep;
    //    edm::LogWarning("CutsIsolatorWithCorrection::depSumIDep")
    //      <<"dep "<<iDep<<" \t added "<<lDep<<" \t sumnow "<<dephlt;
  }

  return dephlt;
}
virtual Result CutsIsolatorWithCorrection::result ( const DepositContainer deposits,
const edm::Event = 0 
) const [inline, virtual]

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.

                                                                                     {
    Result answer(ISOL_BOOL_TYPE);
    answer.valBool = false;
    // fail miserably...
    return answer;
  }
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.

                                                                                                                                           {
  Result answer(ISOL_BOOL_TYPE);
  
  bool absDecision = false;
  bool relDecision = false;

  double rho = 0.0;
  double effAreaSF = 1.0;

  static const double pi = 3.14159265358979323846;

  //  edm::LogWarning("CutsIsolatorWithCorrection::resultIn")
  //    <<"Start tk.pt "<<tk.pt()<<" \t tk.eta "<<tk.eta()<<" \t tk.phi "<<tk.phi();



  if (theUseRhoCorrection){
    edm::Handle<double> rhoHandle; 
    ev->getByLabel(theRhoSrc, rhoHandle); 
    rho = *(rhoHandle.product());
    if (rho < 0.0) rho = 0.0;
    double rhoScale = fabs(tk.eta()) > 1.442 ? theRhoScaleEndcap : theRhoScaleBarrel;
    effAreaSF = fabs(tk.eta()) > 1.442 ? theEffAreaSFEndcap : theEffAreaSFBarrel;
    //    edm::LogWarning("CutsIsolatorWithCorrection::resultInRho")
    //      << "got rho "<<rho<<" vs max "<<theRhoMax<<" will scale by "<<rhoScale;
    if (rho > theRhoMax){
      rho = theRhoMax;
    }
    rho = rho*rhoScale;
    //    edm::LogWarning("CutsIsolatorWithCorrection::resultOutRho")<<" final rho "<<rho;
  }

  if (theCutAbsIso){
    muonisolation::Cuts::CutSpec cuts_here = theCuts(tk.eta());
    double conesize = cuts_here.conesize;
    double dephlt = depSum(deposits, conesize, rho*conesize*conesize*pi*effAreaSF);
    if (theReturnAbsoluteSum ) answer.valFloat = (float)dephlt;
    if (dephlt<cuts_here.threshold) {
      absDecision = true;
    } else {
      absDecision = false;
    }
    //    edm::LogWarning("CutsIsolatorWithCorrection::resultOutAbsIso")
    //      <<"compared dephlt "<<dephlt<<" \t with "<<cuts_here.threshold;
  } else absDecision = true;
  
  if (theCutRelativeIso){
    muonisolation::Cuts::CutSpec cuts_here = theCutsRel(tk.eta());
    double conesize = cuts_here.conesize;
    double dephlt = depSum(deposits, conesize, rho*conesize*conesize*pi*effAreaSF)/tk.pt();
    if (theReturnRelativeSum ) answer.valFloat = (float)dephlt;
    if (dephlt<cuts_here.threshold) {
      relDecision = true;
    } else {
      relDecision = false;
    }
    //    edm::LogWarning("CutsIsolatorWithCorrection::resultOutRelIso")
    //      <<"compared dephlt "<<dephlt<<" \t with "<<cuts_here.threshold;
  } else relDecision = true;
  

  if (theAndOrCuts){
    answer.valBool = absDecision && relDecision;
  } else {
    answer.valBool = absDecision || relDecision;
  }

  //  edm::LogWarning("CutsIsolatorWithCorrection::result")
  //    <<"isAbsIsolated "<<absDecision<<" \t isRelIsolated  "<<relDecision
  //    <<" \t combined with AND "<<theAndOrCuts
  //    <<" = "  << answer.valBool;
  
  return answer;
}
virtual ResultType CutsIsolatorWithCorrection::resultType ( ) const [inline, virtual]

Member Data Documentation

Definition at line 41 of file CutsIsolatorWithCorrection.h.

Referenced by result().

Definition at line 30 of file CutsIsolatorWithCorrection.h.

Referenced by CutsIsolatorWithCorrection(), and result().

Definition at line 31 of file CutsIsolatorWithCorrection.h.

Referenced by CutsIsolatorWithCorrection(), and result().

Definition at line 27 of file CutsIsolatorWithCorrection.h.

Referenced by result().

Definition at line 28 of file CutsIsolatorWithCorrection.h.

Referenced by result().

Definition at line 37 of file CutsIsolatorWithCorrection.h.

Referenced by result().

Definition at line 38 of file CutsIsolatorWithCorrection.h.

Referenced by result().

Definition at line 39 of file CutsIsolatorWithCorrection.h.

Referenced by result().

Definition at line 40 of file CutsIsolatorWithCorrection.h.

Referenced by result().

Definition at line 34 of file CutsIsolatorWithCorrection.h.

Referenced by result().

Definition at line 35 of file CutsIsolatorWithCorrection.h.

Referenced by result().

Definition at line 36 of file CutsIsolatorWithCorrection.h.

Referenced by result().

Definition at line 33 of file CutsIsolatorWithCorrection.h.

Referenced by result().

Definition at line 32 of file CutsIsolatorWithCorrection.h.

Referenced by result().