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)
 
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 ()=delete
 
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 93 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.

1609  : response_(response), efficiency_(efficiency), leakage_(leakage) {
1610  reset();
1611 }

References reset().

◆ Efficiency() [2/2]

jpt::Efficiency::Efficiency ( )
privatedelete

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.

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 }

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

Referenced by JetPlusTrackCorrector::calculateCorr().

◆ 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.

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 }

References data_.

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

◆ empty()

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

Definition at line 131 of file JetPlusTrackCorrector.h.

131 { return data_.empty(); }

References data_.

◆ inConeCorr()

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

Definition at line 1615 of file JetPlusTrackCorrector.cc.

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 }

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

Referenced by JetPlusTrackCorrector::pionEfficiency().

◆ meanE()

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

Definition at line 1661 of file JetPlusTrackCorrector.cc.

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 }

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

Referenced by outOfConeCorr().

◆ nEtaBins()

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

Definition at line 128 of file JetPlusTrackCorrector.h.

128 { return response_.nEtaBins(); }

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

◆ nPtBins()

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

Definition at line 129 of file JetPlusTrackCorrector.h.

129 { return response_.nPtBins(); }

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

◆ nTrks()

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

Definition at line 1641 of file JetPlusTrackCorrector.cc.

1641  {
1642  if (check(eta_bin, pt_bin, __func__)) {
1643  return data_[eta_bin][pt_bin].first;
1644  } else {
1645  return 0;
1646  }
1647 }

References check(), and data_.

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

◆ outOfConeCorr()

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

Definition at line 1625 of file JetPlusTrackCorrector.cc.

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 }

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

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

◆ print()

void Efficiency::print ( void  ) const

Definition at line 1707 of file JetPlusTrackCorrector.cc.

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 }

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

◆ reset()

void Efficiency::reset ( void  )

Definition at line 1700 of file JetPlusTrackCorrector.cc.

1700  {
1701  data_.clear();
1702  data_.resize(response_.nEtaBins(), VPair(response_.nPtBins(), Pair(0, 0.)));
1703 }

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

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

◆ size()

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

Definition at line 130 of file JetPlusTrackCorrector.h.

130 { return data_.size(); }

References data_.

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

◆ sumE()

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

Definition at line 1651 of file JetPlusTrackCorrector.cc.

1651  {
1652  if (check(eta_bin, pt_bin, __func__)) {
1653  return data_[eta_bin][pt_bin].second;
1654  } else {
1655  return 0.;
1656  }
1657 }

References check(), and data_.

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

jpt::Efficiency::nTrks
uint16_t nTrks(uint32_t eta_bin, uint32_t pt_bin) const
Definition: JetPlusTrackCorrector.cc:1641
SiStripPI::mean
Definition: SiStripPayloadInspectorHelper.h:169
jpt::Map::nEtaBins
uint32_t nEtaBins() const
Definition: JetPlusTrackCorrector.h:85
jpt::Efficiency::outOfConeCorr
double outOfConeCorr(uint32_t eta_bin, uint32_t pt_bin) const
Definition: JetPlusTrackCorrector.cc:1625
L1TObjectsTimingClient_cff.efficiency
efficiency
Definition: L1TObjectsTimingClient_cff.py:10
createJobs.tmp
tmp
align.sh
Definition: createJobs.py:716
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
jpt::Efficiency::reset
void reset()
Definition: JetPlusTrackCorrector.cc:1700
jpt::Efficiency::leakage_
const jpt::Map & leakage_
Definition: JetPlusTrackCorrector.h:125
jpt::Map::nPtBins
uint32_t nPtBins() const
Definition: JetPlusTrackCorrector.h:86
jpt::Efficiency::efficiency_
const jpt::Map & efficiency_
Definition: JetPlusTrackCorrector.h:124
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition: HCALHighEnergyHPDFilter_cfi.py:5
jpt::Map::value
double value(uint32_t eta_bin, uint32_t pt_bin) const
Definition: JetPlusTrackCorrector.cc:1543
jpt::Efficiency::check
bool check(uint32_t eta_bin, uint32_t pt_bin, std::string name="check") const
Definition: JetPlusTrackCorrector.cc:1685
jpt::Efficiency::VPair
std::vector< Pair > VPair
Definition: JetPlusTrackCorrector.h:119
jpt::Efficiency::data_
VVPair data_
Definition: JetPlusTrackCorrector.h:121
jpt::Map::print
void print(std::stringstream &ss) const
Definition: JetPlusTrackCorrector.cc:1558
jpt::Efficiency::meanE
double meanE(uint32_t eta_bin, uint32_t pt_bin) const
Definition: JetPlusTrackCorrector.cc:1661
edm::isDebugEnabled
bool isDebugEnabled()
Definition: MessageLogger.cc:12
jpt::Efficiency::response_
const jpt::Map & response_
Definition: JetPlusTrackCorrector.h:123
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
jpt::Efficiency::Pair
std::pair< uint16_t, double > Pair
Definition: JetPlusTrackCorrector.h:93