CMS 3D CMS Logo

Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes

jpt::Efficiency Class Reference

Generic container class. More...

#include <JetPlusTrackCorrector.h>

List of all members.

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 87 of file JetPlusTrackCorrector.h.


Member Typedef Documentation

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

Definition at line 95 of file JetPlusTrackCorrector.h.

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

Definition at line 122 of file JetPlusTrackCorrector.h.

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

Definition at line 123 of file JetPlusTrackCorrector.h.


Constructor & Destructor Documentation

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

Definition at line 1473 of file JetPlusTrackCorrector.cc.

References reset().

  : response_(response),
    efficiency_(efficiency),
    leakage_(leakage)
{
  reset();
}
jpt::Efficiency::Efficiency ( ) [private]

Member Function Documentation

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

Definition at line 1533 of file JetPlusTrackCorrector.cc.

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

Referenced by JetPlusTrackCorrector::calculateCorr().

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

Definition at line 1542 of file JetPlusTrackCorrector.cc.

References data_.

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

                                                                                  {
  if ( eta_bin < data_.size() && pt_bin < ( data_.empty() ? 0 : data_[0].size() ) ) { return true; }
  else { 
    edm::LogWarning("JetPlusTrackCorrector") 
      << "[jpt::Efficiency::" << method << "]"
      << " Trying to access element (" << eta_bin << "," << pt_bin << ")"
      << " of a vector with size (" << data_.size() << "," << ( data_.empty() ? 0 : data_[0].size() ) << ")"
      << "!";
    return false; 
  }
}
bool jpt::Efficiency::empty ( void  ) const [inline]

Definition at line 135 of file JetPlusTrackCorrector.h.

References data_.

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

Definition at line 1485 of file JetPlusTrackCorrector.cc.

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

Referenced by JetPlusTrackCorrector::pionEfficiency().

                                                                       {
  if ( check(eta_bin,pt_bin,__func__) ) { 
    return ( outOfConeCorr( eta_bin, pt_bin ) * 
             leakage_.value( eta_bin, pt_bin ) * 
             response_.value( eta_bin, pt_bin ) ); 
  } else { return 0.; }
}
double Efficiency::meanE ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const [private]

Definition at line 1523 of file JetPlusTrackCorrector.cc.

References check(), data_, and tmp.

Referenced by outOfConeCorr().

                                                                  {
  if ( check(eta_bin,pt_bin,__func__) ) { 
    Pair tmp = data_[eta_bin][pt_bin]; 
    if ( tmp.first ) { return tmp.second / tmp.first; }
    else { return 0.; }
  } else { return 0.; }
}
uint32_t jpt::Efficiency::nEtaBins ( ) const [inline]

Definition at line 132 of file JetPlusTrackCorrector.h.

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

{ return response_.nEtaBins(); }
uint32_t jpt::Efficiency::nPtBins ( ) const [inline]

Definition at line 133 of file JetPlusTrackCorrector.h.

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

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

Definition at line 1507 of file JetPlusTrackCorrector.cc.

References check(), and data_.

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

                                                                    {
  if ( check(eta_bin,pt_bin,__func__) ) { 
    return data_[eta_bin][pt_bin].first; 
  } else { return 0; }
}
double Efficiency::outOfConeCorr ( uint32_t  eta_bin,
uint32_t  pt_bin 
) const

Definition at line 1495 of file JetPlusTrackCorrector.cc.

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

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

                                                                          {
  if ( check(eta_bin,pt_bin,__func__) ) { 
    uint16_t ntrks = nTrks( eta_bin, pt_bin );
    double mean    = meanE( eta_bin, pt_bin );
    double eff     = ( 1. - efficiency_.value( eta_bin, pt_bin ) ) / efficiency_.value( eta_bin, pt_bin );
    if ( !ntrks ) { return 0.; }
    return ( ntrks * eff * mean ); 
  } else { return 0.; }
}
void Efficiency::print ( void  ) const

Definition at line 1563 of file JetPlusTrackCorrector.cc.

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

                             { 
  if ( edm::isDebugEnabled() ) { 
    std::stringstream ss;
    ss << "[jpt::Efficiency::" << __func__ << "]"
       << " Contents of maps:" << std::endl;
    ss << "Response map: " << std::endl;
    response_.print(ss);
    ss << "Efficiency map: " << std::endl;
    efficiency_.print(ss);
    ss << "Leakage map: " << std::endl;
    leakage_.print(ss);
    LogTrace("JetPlusTrackCorrector") << ss.str();
  } 
}
void Efficiency::reset ( void  )

Definition at line 1556 of file JetPlusTrackCorrector.cc.

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

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

                       { 
  data_.clear();
  data_.resize( response_.nEtaBins(), VPair( response_.nPtBins(), Pair(0,0.) ) );
}
uint32_t jpt::Efficiency::size ( void  ) const [inline]

Definition at line 134 of file JetPlusTrackCorrector.h.

References data_.

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

Definition at line 1515 of file JetPlusTrackCorrector.cc.

References check(), and data_.

                                                                 {
  if ( check(eta_bin,pt_bin,__func__) ) { 
    return data_[eta_bin][pt_bin].second; 
  } else { return 0.; }
}

Member Data Documentation

Definition at line 124 of file JetPlusTrackCorrector.h.

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

Definition at line 127 of file JetPlusTrackCorrector.h.

Referenced by outOfConeCorr(), and print().

Definition at line 128 of file JetPlusTrackCorrector.h.

Referenced by inConeCorr(), and print().

Definition at line 126 of file JetPlusTrackCorrector.h.

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