CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Attributes
EtaPtBin Class Reference

#include <EtaPtBin.h>

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. More...
 
bool getEtaActive () const
 Get rapidity/pt ranges and check whether rapidity/pt cuts are active. More...
 
double getEtaMax () const
 
double getEtaMin () const
 
bool getPtActive () const
 
double getPtMax () const
 
double getPtMin () const
 
bool inBin (const double &eta, const double &pt) const
 Check if jet/parton are within rapidity/pt cuts. More...
 
bool inBin (const reco::Jet &jet, const double jec) const
 
 ~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 abs(pseudo-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, ptMin, and AlCaHLTBitMon_QueryRunRegistry::string.

11  : etaActive ( etaActive_ ) , etaMin ( etaMin_ ) , etaMax ( etaMax_ ) ,
12  ptActive ( ptActive_ ) , ptMin ( ptMin_ ) , ptMax ( ptMax_ ) {
13 
15  ptActive , ptMin , ptMax );
16 }
double ptMin
Definition: EtaPtBin.h:58
std::string descriptionString
Definition: EtaPtBin.h:63
static std::string buildDescriptionString(const bool &etaActive_, const double &etaMin_, const double &etaMax_, const bool &ptActive_, const double &ptMin_, const double &ptMax_)
Definition: EtaPtBin.cc:21
double etaMax
Definition: EtaPtBin.h:55
double etaMin
Definition: EtaPtBin.h:54
bool ptActive
Definition: EtaPtBin.h:57
bool etaActive
Definition: EtaPtBin.h:53
double ptMax
Definition: EtaPtBin.h:59
EtaPtBin::~EtaPtBin ( )
inline

Definition at line 22 of file EtaPtBin.h.

22 {} ;

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 MatrixUtil::remove(), python.rootplot.root2matplotlib::replace(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by EtaPtBin(), and getDescriptionString().

23 {
24  // create string only from the active parts
25  std::stringstream stream ( "" );
26 
27  if ( etaActive_ ) {
28  stream << "_ETA_" << etaMin_ << "-" << etaMax_;
29  }
30 
31  if ( ptActive_ ) {
32  stream << "_PT_" << ptMin_ << "-" << ptMax_;
33  }
34  if (!(etaActive_||ptActive_)) stream << "_GLOBAL";
35 
36  std::string descr(stream.str());
37  // remove blanks which are introduced when adding doubles
38  std::remove(descr.begin(), descr.end(), ' ');
39  std::replace(descr.begin(), descr.end(), '.' , 'v' );
40 
41  return descr;
42 }
def replace(string, replacements)
def remove(d, key, TELL=False)
Definition: MatrixUtil.py:211
std::string EtaPtBin::getDescriptionString ( ) const
inline

String describes rapidity/pt range.

Definition at line 25 of file EtaPtBin.h.

References buildDescriptionString(), descriptionString, and AlCaHLTBitMon_QueryRunRegistry::string.

25 { return descriptionString ; }
std::string descriptionString
Definition: EtaPtBin.h:63
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::bookHisto(), and BTagDifferentialPlot::fillHisto().

35 { return etaActive ; }
bool etaActive
Definition: EtaPtBin.h:53
double EtaPtBin::getEtaMax ( ) const
inline
double EtaPtBin::getEtaMin ( ) const
inline

Definition at line 36 of file EtaPtBin.h.

References etaMin.

Referenced by BTagDifferentialPlot::bookHisto(), and BTagDifferentialPlot::fillHisto().

36 { return etaMin ; }
double etaMin
Definition: EtaPtBin.h:54
bool EtaPtBin::getPtActive ( ) const
inline

Definition at line 39 of file EtaPtBin.h.

References ptActive.

Referenced by BTagDifferentialPlot::bookHisto(), and BTagDifferentialPlot::fillHisto().

39 { return ptActive ; }
bool ptActive
Definition: EtaPtBin.h:57
double EtaPtBin::getPtMax ( ) const
inline
double EtaPtBin::getPtMin ( ) const
inline

Definition at line 40 of file EtaPtBin.h.

References ptMin.

Referenced by BTagDifferentialPlot::bookHisto(), and BTagDifferentialPlot::fillHisto().

40 { return ptMin ; }
double ptMin
Definition: EtaPtBin.h:58
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.

Referenced by getPtMax().

56  {
57  if ( etaActive ) {
58  if ( fabs(eta) < etaMin ) return false;
59  if ( fabs(eta) > etaMax ) return false;
60  }
61 
62  if ( ptActive ) {
63  if ( pt < ptMin ) return false;
64  if ( pt > ptMax ) return false;
65  }
66 
67  return true;
68 }
double ptMin
Definition: EtaPtBin.h:58
double etaMax
Definition: EtaPtBin.h:55
double etaMin
Definition: EtaPtBin.h:54
bool ptActive
Definition: EtaPtBin.h:57
bool etaActive
Definition: EtaPtBin.h:53
double ptMax
Definition: EtaPtBin.h:59
bool EtaPtBin::inBin ( const reco::Jet jet,
const double  jec 
) const

Definition at line 44 of file EtaPtBin.cc.

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

Referenced by inBin().

45 {
46  return inBin(jet.eta(), jet.pt()*jec);
47 }
double eta() const final
momentum pseudorapidity
double pt() const final
transverse momentum
bool inBin(const double &eta, const double &pt) const
Check if jet/parton are within rapidity/pt cuts.
Definition: EtaPtBin.cc:56

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