CMS 3D CMS Logo

Public Member Functions | Static Public Member Functions | Private Attributes

EtaPtBin Class Reference

#include <EtaPtBin.h>

List of all members.

Public Member Functions

 EtaPtBin (const bool &etaActive_, const double &etaMin_, const double &etaMax_, const bool &ptActive_, const double &ptMin_, const double &ptMax_)
std::string getDescriptionString () const
 String describes rapidity/pt range.
bool getEtaActive () const
 Get rapidity/pt ranges and check whether rapidity/pt cuts are active.
double getEtaMax () const
double getEtaMin () const
bool getPtActive () const
double getPtMax () const
double getPtMin () const
bool inBin (const reco::Jet &jet) const
bool inBin (const double &eta, const double &pt) const
 Check if jet/parton are within rapidity/pt cuts.
 ~EtaPtBin ()

Static Public Member Functions

static std::string buildDescriptionString (const bool &etaActive_, const double &etaMin_, const double &etaMax_, const bool &ptActive_, const double &ptMin_, const double &ptMax_)

Private Attributes

std::string descriptionString
bool etaActive
double etaMax
double etaMin
bool ptActive
double ptMax
double ptMin

Detailed Description

Decide if jet/parton lie within desired rapidity/pt range.

Definition at line 15 of file EtaPtBin.h.


Constructor & Destructor Documentation

EtaPtBin::EtaPtBin ( const bool &  etaActive_,
const double &  etaMin_,
const double &  etaMax_,
const bool &  ptActive_,
const double &  ptMin_,
const double &  ptMax_ 
)

Definition at line 9 of file EtaPtBin.cc.

References buildDescriptionString(), descriptionString, etaActive, etaMax, etaMin, ptActive, ptMax, and ptMin.

  : etaActive ( etaActive_ ) , etaMin ( etaMin_ ) , etaMax ( etaMax_ ) ,
    ptActive  (  ptActive_ ) , ptMin  (  ptMin_ ) , ptMax  (  ptMax_ )   {

  descriptionString = buildDescriptionString ( etaActive , etaMin , etaMax ,
                                               ptActive  , ptMin  , ptMax  );
}
EtaPtBin::~EtaPtBin ( ) [inline]

Definition at line 22 of file EtaPtBin.h.

{} ;

Member Function Documentation

std::string EtaPtBin::buildDescriptionString ( const bool &  etaActive_,
const double &  etaMin_,
const double &  etaMax_,
const bool &  ptActive_,
const double &  ptMin_,
const double &  ptMax_ 
) [static]

method to build the string from other quantities (static for easy external use)

Definition at line 21 of file EtaPtBin.cc.

References python::multivaluedict::remove(), and linker::replace().

Referenced by EtaPtBin().

{
  // create string only from the active parts
  std::stringstream stream ( "" );

  if ( etaActive_ ) {
    stream << "_ETA_" << etaMin_ << "-" << etaMax_;
  }

  if ( ptActive_ ) {
    stream << "_PT_" << ptMin_ << "-" << ptMax_;
  }
  if (!(etaActive_||ptActive_)) stream << "_GLOBAL";

  std::string descr(stream.str());
  // remove blanks which are introduced when adding doubles
  std::remove(descr.begin(), descr.end(), ' ');
  std::replace(descr.begin(), descr.end(), '.' , 'v' );

  return descr;
}
std::string EtaPtBin::getDescriptionString ( ) const [inline]

String describes rapidity/pt range.

Definition at line 25 of file EtaPtBin.h.

References descriptionString.

{ return descriptionString ; } 
bool EtaPtBin::getEtaActive ( ) const [inline]

Get rapidity/pt ranges and check whether rapidity/pt cuts are active.

Definition at line 35 of file EtaPtBin.h.

References etaActive.

Referenced by BTagDifferentialPlot::fillHisto().

{ return etaActive ; }
double EtaPtBin::getEtaMax ( ) const [inline]

Definition at line 37 of file EtaPtBin.h.

References etaMax.

Referenced by BTagDifferentialPlot::fillHisto().

{ return etaMax    ; }
double EtaPtBin::getEtaMin ( ) const [inline]

Definition at line 36 of file EtaPtBin.h.

References etaMin.

Referenced by BTagDifferentialPlot::fillHisto().

{ return etaMin    ; }
bool EtaPtBin::getPtActive ( ) const [inline]

Definition at line 39 of file EtaPtBin.h.

References ptActive.

Referenced by BTagDifferentialPlot::fillHisto().

{ return ptActive ; }
double EtaPtBin::getPtMax ( ) const [inline]

Definition at line 41 of file EtaPtBin.h.

References ptMax.

Referenced by BTagDifferentialPlot::fillHisto().

{ return ptMax    ; }
double EtaPtBin::getPtMin ( ) const [inline]

Definition at line 40 of file EtaPtBin.h.

References ptMin.

Referenced by BTagDifferentialPlot::fillHisto().

{ return ptMin    ; }
bool EtaPtBin::inBin ( const double &  eta,
const double &  pt 
) const

Check if jet/parton are within rapidity/pt cuts.

Definition at line 56 of file EtaPtBin.cc.

References etaActive, etaMax, etaMin, ptActive, ptMax, and ptMin.

                                                                   {
  if ( etaActive ) {
    if ( fabs(eta) < etaMin ) return false;
    if ( fabs(eta) > etaMax ) return false;
  }

  if ( ptActive ) {
    if ( pt < ptMin ) return false;
    if ( pt > ptMax ) return false;
  }

  return true;
}
bool EtaPtBin::inBin ( const reco::Jet jet) const

Definition at line 44 of file EtaPtBin.cc.

References reco::LeafCandidate::eta(), inBin(), and reco::LeafCandidate::pt().

Referenced by inBin().

{
  return inBin(jet.eta(), jet.pt());
}

Member Data Documentation

std::string EtaPtBin::descriptionString [private]

Definition at line 63 of file EtaPtBin.h.

Referenced by EtaPtBin(), and getDescriptionString().

bool EtaPtBin::etaActive [private]

Definition at line 53 of file EtaPtBin.h.

Referenced by EtaPtBin(), getEtaActive(), and inBin().

double EtaPtBin::etaMax [private]

Definition at line 55 of file EtaPtBin.h.

Referenced by EtaPtBin(), getEtaMax(), and inBin().

double EtaPtBin::etaMin [private]

Definition at line 54 of file EtaPtBin.h.

Referenced by EtaPtBin(), getEtaMin(), and inBin().

bool EtaPtBin::ptActive [private]

Definition at line 57 of file EtaPtBin.h.

Referenced by EtaPtBin(), getPtActive(), and inBin().

double EtaPtBin::ptMax [private]

Definition at line 59 of file EtaPtBin.h.

Referenced by EtaPtBin(), getPtMax(), and inBin().

double EtaPtBin::ptMin [private]

Definition at line 58 of file EtaPtBin.h.

Referenced by EtaPtBin(), getPtMin(), and inBin().