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 1608 of file JetPlusTrackCorrector.cc.

References reset().

1609  : response_(response), efficiency_(efficiency), leakage_(leakage) {
1610  reset();
1611 }
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 1676 of file JetPlusTrackCorrector.cc.

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

Referenced by JetPlusTrackCorrector::calculateCorr().

1676  {
1677  if (check(eta_bin, pt_bin, __func__)) {
1678  data_[eta_bin][pt_bin].first++;
1679  data_[eta_bin][pt_bin].second += energy;
1680  }
1681 }
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 1685 of file JetPlusTrackCorrector.cc.

References data_.

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

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

◆ 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 1615 of file JetPlusTrackCorrector.cc.

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

Referenced by JetPlusTrackCorrector::pionEfficiency().

1615  {
1616  if (check(eta_bin, pt_bin, __func__)) {
1617  return (outOfConeCorr(eta_bin, pt_bin) * leakage_.value(eta_bin, pt_bin) * response_.value(eta_bin, pt_bin));
1618  } else {
1619  return 0.;
1620  }
1621 }
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 1661 of file JetPlusTrackCorrector.cc.

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

Referenced by outOfConeCorr().

1661  {
1662  if (check(eta_bin, pt_bin, __func__)) {
1663  Pair tmp = data_[eta_bin][pt_bin];
1664  if (tmp.first) {
1665  return tmp.second / tmp.first;
1666  } else {
1667  return 0.;
1668  }
1669  } else {
1670  return 0.;
1671  }
1672 }
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 1641 of file JetPlusTrackCorrector.cc.

References check(), and data_.

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

1641  {
1642  if (check(eta_bin, pt_bin, __func__)) {
1643  return data_[eta_bin][pt_bin].first;
1644  } else {
1645  return 0;
1646  }
1647 }
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 1625 of file JetPlusTrackCorrector.cc.

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

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

1625  {
1626  if (check(eta_bin, pt_bin, __func__)) {
1627  uint16_t ntrks = nTrks(eta_bin, pt_bin);
1628  double mean = meanE(eta_bin, pt_bin);
1629  double eff = (1. - efficiency_.value(eta_bin, pt_bin)) / efficiency_.value(eta_bin, pt_bin);
1630  if (!ntrks) {
1631  return 0.;
1632  }
1633  return (ntrks * eff * mean);
1634  } else {
1635  return 0.;
1636  }
1637 }
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 1707 of file JetPlusTrackCorrector.cc.

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

1707  {
1708  if (edm::isDebugEnabled()) {
1709  std::stringstream ss;
1710  ss << "[jpt::Efficiency::" << __func__ << "]"
1711  << " Contents of maps:" << std::endl;
1712  ss << "Response map: " << std::endl;
1713  response_.print(ss);
1714  ss << "Efficiency map: " << std::endl;
1715  efficiency_.print(ss);
1716  ss << "Leakage map: " << std::endl;
1717  leakage_.print(ss);
1718  LogTrace("JetPlusTrackCorrector") << ss.str();
1719  }
1720 }
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 1700 of file JetPlusTrackCorrector.cc.

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

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

1700  {
1701  data_.clear();
1702  data_.resize(response_.nEtaBins(), VPair(response_.nPtBins(), Pair(0, 0.)));
1703 }
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 1651 of file JetPlusTrackCorrector.cc.

References check(), and data_.

1651  {
1652  if (check(eta_bin, pt_bin, __func__)) {
1653  return data_[eta_bin][pt_bin].second;
1654  } else {
1655  return 0.;
1656  }
1657 }
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().