CMS 3D CMS Logo

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)
 
 Efficiency ()=delete
 
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
 
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 89 of file JetPlusTrackCorrector.h.

Member Typedef Documentation

◆ Pair

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

Definition at line 95 of file JetPlusTrackCorrector.h.

◆ VPair

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

Definition at line 119 of file JetPlusTrackCorrector.h.

◆ VVPair

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

Definition at line 120 of file JetPlusTrackCorrector.h.

Constructor & Destructor Documentation

◆ Efficiency() [1/2]

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

Definition at line 1610 of file JetPlusTrackCorrector.cc.

References reset().

1611  : response_(response), efficiency_(efficiency), leakage_(leakage) {
1612  reset();
1613 }
const jpt::Map & efficiency_
const jpt::Map & response_
const jpt::Map & leakage_

◆ Efficiency() [2/2]

jpt::Efficiency::Efficiency ( )
delete

Member Function Documentation

◆ addE()

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

Definition at line 1678 of file JetPlusTrackCorrector.cc.

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

Referenced by JetPlusTrackCorrector::calculateCorr().

1678  {
1679  if (check(eta_bin, pt_bin, __func__)) {
1680  data_[eta_bin][pt_bin].first++;
1681  data_[eta_bin][pt_bin].second += energy;
1682  }
1683 }
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const

◆ check()

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

Definition at line 1687 of file JetPlusTrackCorrector.cc.

References data_.

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

1687  {
1688  if (eta_bin < data_.size() && pt_bin < (data_.empty() ? 0 : data_[0].size())) {
1689  return true;
1690  } else {
1691  // edm::LogWarning("JetPlusTrackCorrector")
1692  // << "[jpt::Efficiency::" << method << "]"
1693  // << " Trying to access element (" << eta_bin << "," << pt_bin << ")"
1694  // << " of a vector with size (" << data_.size() << "," << ( data_.empty() ? 0 : data_[0].size() ) << ")"
1695  // << "!";
1696  return false;
1697  }
1698 }

◆ empty()

bool jpt::Efficiency::empty ( void  ) const
inline

Definition at line 131 of file JetPlusTrackCorrector.h.

References data_.

131 { return data_.empty(); }

◆ inConeCorr()

double Efficiency::inConeCorr ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const

Definition at line 1617 of file JetPlusTrackCorrector.cc.

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

Referenced by JetPlusTrackCorrector::pionEfficiency().

1617  {
1618  if (check(eta_bin, pt_bin, __func__)) {
1619  return (outOfConeCorr(eta_bin, pt_bin) * leakage_.value(eta_bin, pt_bin) * response_.value(eta_bin, pt_bin));
1620  } else {
1621  return 0.;
1622  }
1623 }
double value(uint32_t eta_bin, uint32_t pt_bin) const
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
const jpt::Map & leakage_

◆ meanE()

double Efficiency::meanE ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const
private

Definition at line 1663 of file JetPlusTrackCorrector.cc.

References check(), data_, and createJobs::tmp.

Referenced by outOfConeCorr().

1663  {
1664  if (check(eta_bin, pt_bin, __func__)) {
1665  Pair tmp = data_[eta_bin][pt_bin];
1666  if (tmp.first) {
1667  return tmp.second / tmp.first;
1668  } else {
1669  return 0.;
1670  }
1671  } else {
1672  return 0.;
1673  }
1674 }
std::pair< uint16_t, double > Pair
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const
tmp
align.sh
Definition: createJobs.py:716

◆ nEtaBins()

uint32_t jpt::Efficiency::nEtaBins ( ) const
inline

Definition at line 128 of file JetPlusTrackCorrector.h.

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

128 { return response_.nEtaBins(); }
const jpt::Map & response_
uint32_t nEtaBins() const

◆ nPtBins()

uint32_t jpt::Efficiency::nPtBins ( ) const
inline

Definition at line 129 of file JetPlusTrackCorrector.h.

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

129 { return response_.nPtBins(); }
uint32_t nPtBins() const
const jpt::Map & response_

◆ nTrks()

uint16_t Efficiency::nTrks ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const

Definition at line 1643 of file JetPlusTrackCorrector.cc.

References check(), and data_.

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

1643  {
1644  if (check(eta_bin, pt_bin, __func__)) {
1645  return data_[eta_bin][pt_bin].first;
1646  } else {
1647  return 0;
1648  }
1649 }
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const

◆ outOfConeCorr()

double Efficiency::outOfConeCorr ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const

Definition at line 1627 of file JetPlusTrackCorrector.cc.

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

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

1627  {
1628  if (check(eta_bin, pt_bin, __func__)) {
1629  uint16_t ntrks = nTrks(eta_bin, pt_bin);
1630  double mean = meanE(eta_bin, pt_bin);
1631  double eff = (1. - efficiency_.value(eta_bin, pt_bin)) / efficiency_.value(eta_bin, pt_bin);
1632  if (!ntrks) {
1633  return 0.;
1634  }
1635  return (ntrks * eff * mean);
1636  } else {
1637  return 0.;
1638  }
1639 }
double meanE(uint32_t eta_bin, uint32_t pt_bin) const
const jpt::Map & efficiency_
double value(uint32_t eta_bin, uint32_t pt_bin) const
uint16_t nTrks(uint32_t eta_bin, uint32_t pt_bin) const
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const

◆ print()

void Efficiency::print ( void  ) const

Definition at line 1709 of file JetPlusTrackCorrector.cc.

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

1709  {
1710  if (edm::isDebugEnabled()) {
1711  std::stringstream ss;
1712  ss << "[jpt::Efficiency::" << __func__ << "]"
1713  << " Contents of maps:" << std::endl;
1714  ss << "Response map: " << std::endl;
1715  response_.print(ss);
1716  ss << "Efficiency map: " << std::endl;
1717  efficiency_.print(ss);
1718  ss << "Leakage map: " << std::endl;
1719  leakage_.print(ss);
1720  LogTrace("JetPlusTrackCorrector") << ss.str();
1721  }
1722 }
bool isDebugEnabled()
const jpt::Map & efficiency_
#define LogTrace(id)
const jpt::Map & response_
void print(std::stringstream &ss) const
const jpt::Map & leakage_

◆ reset()

void Efficiency::reset ( void  )

Definition at line 1702 of file JetPlusTrackCorrector.cc.

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

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

1702  {
1703  data_.clear();
1704  data_.resize(response_.nEtaBins(), VPair(response_.nPtBins(), Pair(0, 0.)));
1705 }
uint32_t nPtBins() const
std::pair< uint16_t, double > Pair
const jpt::Map & response_
uint32_t nEtaBins() const
std::vector< Pair > VPair

◆ size()

uint32_t jpt::Efficiency::size ( void  ) const
inline

Definition at line 130 of file JetPlusTrackCorrector.h.

References data_.

Referenced by ntupleDataFormat._Collection::__iter__(), and ntupleDataFormat._Collection::__len__().

130 { return data_.size(); }

◆ sumE()

double Efficiency::sumE ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const
private

Definition at line 1653 of file JetPlusTrackCorrector.cc.

References check(), and data_.

1653  {
1654  if (check(eta_bin, pt_bin, __func__)) {
1655  return data_[eta_bin][pt_bin].second;
1656  } else {
1657  return 0.;
1658  }
1659 }
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const

Member Data Documentation

◆ data_

VVPair jpt::Efficiency::data_
private

Definition at line 121 of file JetPlusTrackCorrector.h.

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

◆ efficiency_

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

Definition at line 124 of file JetPlusTrackCorrector.h.

Referenced by outOfConeCorr(), and print().

◆ leakage_

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

Definition at line 125 of file JetPlusTrackCorrector.h.

Referenced by inConeCorr(), and print().

◆ response_

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

Definition at line 123 of file JetPlusTrackCorrector.h.

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