test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes
jpt::Efficiency Class Reference

Generic container class. More...

#include <JetPlusTrackCorrector.h>

Public Types

typedef std::pair< uint16_t,
double > 
Pair
 

Public Member Functions

void addE (uint32_t eta_bin, uint32_t pt_bin, double energy)
 
 Efficiency (const jpt::Map &response, const jpt::Map &efficiency, const jpt::Map &leakage)
 
bool empty () const
 
double inConeCorr (uint32_t eta_bin, uint32_t pt_bin) const
 
uint32_t nEtaBins () const
 
uint32_t nPtBins () const
 
uint16_t nTrks (uint32_t eta_bin, uint32_t pt_bin) const
 
double outOfConeCorr (uint32_t eta_bin, uint32_t pt_bin) const
 
void print () const
 
void reset ()
 
uint32_t size () const
 

Private Types

typedef std::vector< PairVPair
 
typedef std::vector< VPairVVPair
 

Private Member Functions

bool check (uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const
 
 Efficiency ()
 
double meanE (uint32_t eta_bin, uint32_t pt_bin) const
 
double sumE (uint32_t eta_bin, uint32_t pt_bin) const
 

Private Attributes

VVPair data_
 
const jpt::Mapefficiency_
 
const jpt::Mapleakage_
 
const jpt::Mapresponse_
 

Detailed Description

Generic container class.

Definition at line 91 of file JetPlusTrackCorrector.h.

Member Typedef Documentation

typedef std::pair<uint16_t,double> jpt::Efficiency::Pair

Definition at line 99 of file JetPlusTrackCorrector.h.

typedef std::vector<Pair> jpt::Efficiency::VPair
private

Definition at line 126 of file JetPlusTrackCorrector.h.

typedef std::vector<VPair> jpt::Efficiency::VVPair
private

Definition at line 127 of file JetPlusTrackCorrector.h.

Constructor & Destructor Documentation

Efficiency::Efficiency ( const jpt::Map response,
const jpt::Map efficiency,
const jpt::Map leakage 
)

Definition at line 1660 of file JetPlusTrackCorrector.cc.

References reset().

1663  : response_(response),
1664  efficiency_(efficiency),
1665  leakage_(leakage)
1666 {
1667  reset();
1668 }
const jpt::Map & efficiency_
const jpt::Map & response_
const jpt::Map & leakage_
jpt::Efficiency::Efficiency ( )
private

Member Function Documentation

void Efficiency::addE ( uint32_t  eta_bin,
uint32_t  pt_bin,
double  energy 
)

Definition at line 1720 of file JetPlusTrackCorrector.cc.

References check(), data_, and relval_parameters_module::energy.

Referenced by JetPlusTrackCorrector::calculateCorr().

1720  {
1721  if ( check(eta_bin,pt_bin,__func__) ) {
1722  data_[eta_bin][pt_bin].first++;
1723  data_[eta_bin][pt_bin].second += energy;
1724  }
1725 }
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const
bool Efficiency::check ( uint32_t  eta_bin,
uint32_t  pt_bin,
std::string  name = "check" 
) const
private

Definition at line 1729 of file JetPlusTrackCorrector.cc.

References data_.

Referenced by addE(), inConeCorr(), meanE(), nTrks(), outOfConeCorr(), and sumE().

1729  {
1730  if ( eta_bin < data_.size() && pt_bin < ( data_.empty() ? 0 : data_[0].size() ) ) { return true; }
1731  else {
1732 // edm::LogWarning("JetPlusTrackCorrector")
1733 // << "[jpt::Efficiency::" << method << "]"
1734 // << " Trying to access element (" << eta_bin << "," << pt_bin << ")"
1735 // << " of a vector with size (" << data_.size() << "," << ( data_.empty() ? 0 : data_[0].size() ) << ")"
1736 // << "!";
1737  return false;
1738  }
1739 }
bool jpt::Efficiency::empty ( void  ) const
inline

Definition at line 139 of file JetPlusTrackCorrector.h.

References data_.

139 { return data_.empty(); }
double Efficiency::inConeCorr ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const

Definition at line 1672 of file JetPlusTrackCorrector.cc.

References check(), leakage_, outOfConeCorr(), response_, and jpt::Map::value().

Referenced by JetPlusTrackCorrector::pionEfficiency().

1672  {
1673  if ( check(eta_bin,pt_bin,__func__) ) {
1674  return ( outOfConeCorr( eta_bin, pt_bin ) *
1675  leakage_.value( eta_bin, pt_bin ) *
1676  response_.value( eta_bin, pt_bin ) );
1677  } else { return 0.; }
1678 }
const jpt::Map & response_
double outOfConeCorr(uint32_t eta_bin, uint32_t pt_bin) const
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const
double value(uint32_t eta_bin, uint32_t pt_bin) const
const jpt::Map & leakage_
double Efficiency::meanE ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const
private

Definition at line 1710 of file JetPlusTrackCorrector.cc.

References check(), data_, and tmp.

Referenced by outOfConeCorr().

1710  {
1711  if ( check(eta_bin,pt_bin,__func__) ) {
1712  Pair tmp = data_[eta_bin][pt_bin];
1713  if ( tmp.first ) { return tmp.second / tmp.first; }
1714  else { return 0.; }
1715  } else { return 0.; }
1716 }
std::pair< uint16_t, double > Pair
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
uint32_t jpt::Efficiency::nEtaBins ( ) const
inline

Definition at line 136 of file JetPlusTrackCorrector.h.

References jpt::Map::nEtaBins(), and response_.

136 { return response_.nEtaBins(); }
uint32_t nEtaBins() const
const jpt::Map & response_
uint32_t jpt::Efficiency::nPtBins ( ) const
inline

Definition at line 137 of file JetPlusTrackCorrector.h.

References jpt::Map::nPtBins(), and response_.

137 { return response_.nPtBins(); }
const jpt::Map & response_
uint32_t nPtBins() const
uint16_t Efficiency::nTrks ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const

Definition at line 1694 of file JetPlusTrackCorrector.cc.

References check(), and data_.

Referenced by outOfConeCorr(), and JetPlusTrackCorrector::pionEfficiency().

1694  {
1695  if ( check(eta_bin,pt_bin,__func__) ) {
1696  return data_[eta_bin][pt_bin].first;
1697  } else { return 0; }
1698 }
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const
double Efficiency::outOfConeCorr ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const

Definition at line 1682 of file JetPlusTrackCorrector.cc.

References check(), efficiency_, timingPdfMaker::mean, meanE(), nTrks(), and jpt::Map::value().

Referenced by inConeCorr(), and JetPlusTrackCorrector::pionEfficiency().

1682  {
1683  if ( check(eta_bin,pt_bin,__func__) ) {
1684  uint16_t ntrks = nTrks( eta_bin, pt_bin );
1685  double mean = meanE( eta_bin, pt_bin );
1686  double eff = ( 1. - efficiency_.value( eta_bin, pt_bin ) ) / efficiency_.value( eta_bin, pt_bin );
1687  if ( !ntrks ) { return 0.; }
1688  return ( ntrks * eff * mean );
1689  } else { return 0.; }
1690 }
double meanE(uint32_t eta_bin, uint32_t pt_bin) const
const jpt::Map & efficiency_
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const
uint16_t nTrks(uint32_t eta_bin, uint32_t pt_bin) const
double value(uint32_t eta_bin, uint32_t pt_bin) const
void Efficiency::print ( void  ) const

Definition at line 1750 of file JetPlusTrackCorrector.cc.

References efficiency_, edm::isDebugEnabled(), leakage_, LogTrace, jpt::Map::print(), response_, and contentValuesCheck::ss.

1750  {
1751  if ( edm::isDebugEnabled() ) {
1752  std::stringstream ss;
1753  ss << "[jpt::Efficiency::" << __func__ << "]"
1754  << " Contents of maps:" << std::endl;
1755  ss << "Response map: " << std::endl;
1756  response_.print(ss);
1757  ss << "Efficiency map: " << std::endl;
1758  efficiency_.print(ss);
1759  ss << "Leakage map: " << std::endl;
1760  leakage_.print(ss);
1761  LogTrace("JetPlusTrackCorrector") << ss.str();
1762  }
1763 }
bool isDebugEnabled()
const jpt::Map & efficiency_
const jpt::Map & response_
void print(std::stringstream &ss) const
#define LogTrace(id)
const jpt::Map & leakage_
void Efficiency::reset ( void  )

Definition at line 1743 of file JetPlusTrackCorrector.cc.

References data_, jpt::Map::nEtaBins(), jpt::Map::nPtBins(), and response_.

Referenced by JetPlusTrackCorrector::calculateCorr(), and Efficiency().

1743  {
1744  data_.clear();
1745  data_.resize( response_.nEtaBins(), VPair( response_.nPtBins(), Pair(0,0.) ) );
1746 }
uint32_t nEtaBins() const
std::pair< uint16_t, double > Pair
const jpt::Map & response_
std::vector< Pair > VPair
uint32_t nPtBins() const
uint32_t jpt::Efficiency::size ( void  ) const
inline

Definition at line 138 of file JetPlusTrackCorrector.h.

References data_.

138 { return data_.size(); }
double Efficiency::sumE ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const
private

Definition at line 1702 of file JetPlusTrackCorrector.cc.

References check(), and data_.

1702  {
1703  if ( check(eta_bin,pt_bin,__func__) ) {
1704  return data_[eta_bin][pt_bin].second;
1705  } else { return 0.; }
1706 }
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const

Member Data Documentation

VVPair jpt::Efficiency::data_
private

Definition at line 128 of file JetPlusTrackCorrector.h.

Referenced by addE(), check(), empty(), meanE(), nTrks(), reset(), size(), and sumE().

const jpt::Map& jpt::Efficiency::efficiency_
private

Definition at line 131 of file JetPlusTrackCorrector.h.

Referenced by outOfConeCorr(), and print().

const jpt::Map& jpt::Efficiency::leakage_
private

Definition at line 132 of file JetPlusTrackCorrector.h.

Referenced by inConeCorr(), and print().

const jpt::Map& jpt::Efficiency::response_
private

Definition at line 130 of file JetPlusTrackCorrector.h.

Referenced by inConeCorr(), nEtaBins(), nPtBins(), print(), and reset().