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

References reset().

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

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

Referenced by JetPlusTrackCorrector::calculateCorr().

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

References data_.

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

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

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

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

Referenced by JetPlusTrackCorrector::pionEfficiency().

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

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

Referenced by outOfConeCorr().

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

References check(), and data_.

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

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

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

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

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

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

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

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

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

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

References check(), and data_.

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