CMS 3D CMS Logo

Classes | Public Member Functions | Private Attributes

ElectronHcalHelper Class Reference

#include <ElectronHcalHelper.h>

List of all members.

Classes

struct  Configuration

Public Member Functions

void checkSetup (const edm::EventSetup &)
 ElectronHcalHelper (const Configuration &)
double hcalESum (const reco::SuperCluster &)
double hcalESumDepth1 (const reco::SuperCluster &)
double hcalESumDepth2 (const reco::SuperCluster &)
double hOverEConeSize () const
void readEvent (edm::Event &)
 ~ElectronHcalHelper ()

Private Attributes

edm::ESHandle< CaloGeometrycaloGeom_
unsigned long long caloGeomCacheId_
const Configuration cfg_
edm::Handle
< HBHERecHitCollection > * 
hbhe_
EgammaHcalIsolationhcalIso_
HBHERecHitMetaCollectionmhbhe_
EgammaTowerIsolationtowerIso1_
EgammaTowerIsolationtowerIso2_
edm::Handle
< CaloTowerCollection > * 
towersH_

Detailed Description

Definition at line 18 of file ElectronHcalHelper.h.


Constructor & Destructor Documentation

ElectronHcalHelper::ElectronHcalHelper ( const Configuration cfg)

Definition at line 11 of file ElectronHcalHelper.cc.

 : cfg_(cfg), caloGeomCacheId_(0), hbhe_(0), mhbhe_(0), hcalIso_(0), towersH_(0), towerIso1_(0), towerIso2_(0)
 {}
ElectronHcalHelper::~ElectronHcalHelper ( )

Definition at line 93 of file ElectronHcalHelper.cc.

References cfg_, hbhe_, hcalIso_, ElectronHcalHelper::Configuration::hOverEConeSize, mhbhe_, towerIso1_, towerIso2_, towersH_, and ElectronHcalHelper::Configuration::useTowers.

 {
  if (cfg_.hOverEConeSize==0)
   { return ; }
  if (cfg_.useTowers)
   {
    delete towerIso1_ ;
    delete towerIso2_ ;
    delete towersH_ ;
   }
  else
   {
    delete hcalIso_ ;
    delete mhbhe_ ;
    delete hbhe_ ;
   }
 }

Member Function Documentation

void ElectronHcalHelper::checkSetup ( const edm::EventSetup es)

Definition at line 15 of file ElectronHcalHelper.cc.

References caloGeom_, caloGeomCacheId_, cfg_, edm::EventSetup::get(), ElectronHcalHelper::Configuration::hOverEConeSize, and ElectronHcalHelper::Configuration::useTowers.

Referenced by GsfElectronAlgo::checkSetup(), and ElectronSeedProducer::produce().

 {
  if (cfg_.hOverEConeSize==0)
   { return ; }

  if (!cfg_.useTowers)
   {
    unsigned long long newCaloGeomCacheId_
     = es.get<CaloGeometryRecord>().cacheIdentifier() ;
    if (caloGeomCacheId_!=newCaloGeomCacheId_)
     {
      caloGeomCacheId_ = newCaloGeomCacheId_ ;
      es.get<CaloGeometryRecord>().get(caloGeom_) ;
     }
   }
 }
double ElectronHcalHelper::hcalESum ( const reco::SuperCluster sc)
double ElectronHcalHelper::hcalESumDepth1 ( const reco::SuperCluster sc)
double ElectronHcalHelper::hcalESumDepth2 ( const reco::SuperCluster sc)
double ElectronHcalHelper::hOverEConeSize ( ) const [inline]

Definition at line 48 of file ElectronHcalHelper.h.

References cfg_, and ElectronHcalHelper::Configuration::hOverEConeSize.

{ return cfg_.hOverEConeSize ; }
void ElectronHcalHelper::readEvent ( edm::Event evt)

Definition at line 32 of file ElectronHcalHelper.cc.

References caloGeom_, cfg_, edm::Event::getByLabel(), hbhe_, hcalIso_, ElectronHcalHelper::Configuration::hcalRecHits, ElectronHcalHelper::Configuration::hcalTowers, ElectronHcalHelper::Configuration::hOverEConeSize, ElectronHcalHelper::Configuration::hOverEHBMinE, ElectronHcalHelper::Configuration::hOverEHFMinE, ElectronHcalHelper::Configuration::hOverEPtMin, mhbhe_, edm::Handle< T >::product(), towerIso1_, towerIso2_, towersH_, and ElectronHcalHelper::Configuration::useTowers.

Referenced by GsfElectronAlgo::beginEvent(), and ElectronSeedProducer::produce().

 {
  if (cfg_.hOverEConeSize==0)
   { return ; }

  if (cfg_.useTowers)
   {
    delete towerIso1_ ; towerIso1_ = 0 ;
    delete towerIso2_ ; towerIso2_ = 0 ;
    delete towersH_ ; towersH_ = 0 ;

    towersH_ = new edm::Handle<CaloTowerCollection>() ;
    if (!evt.getByLabel(cfg_.hcalTowers,*towersH_))
     { edm::LogError("ElectronHcalHelper::readEvent")<<"failed to get the hcal towers of label "<<cfg_.hcalTowers ; }
    towerIso1_ = new EgammaTowerIsolation(cfg_.hOverEConeSize,0.,cfg_.hOverEPtMin,1,towersH_->product()) ;
    towerIso2_ = new EgammaTowerIsolation(cfg_.hOverEConeSize,0.,cfg_.hOverEPtMin,2,towersH_->product()) ;
   }
  else
   {
    delete hcalIso_ ; hcalIso_ = 0 ;
    delete mhbhe_ ; mhbhe_ = 0 ;
    delete hbhe_ ; hbhe_ = 0 ;

    hbhe_=  new edm::Handle<HBHERecHitCollection>() ;
    if (!evt.getByLabel(cfg_.hcalRecHits,*hbhe_))
     { edm::LogError("ElectronHcalHelper::readEvent")<<"failed to get the rechits of label "<<cfg_.hcalRecHits ; }
    mhbhe_=  new HBHERecHitMetaCollection(**hbhe_) ;
    hcalIso_ = new EgammaHcalIsolation(cfg_.hOverEConeSize,0.,cfg_.hOverEHBMinE,cfg_.hOverEHFMinE,0.,0.,caloGeom_,mhbhe_) ;
   }
 }

Member Data Documentation

Definition at line 57 of file ElectronHcalHelper.h.

Referenced by checkSetup(), and readEvent().

unsigned long long ElectronHcalHelper::caloGeomCacheId_ [private]

Definition at line 56 of file ElectronHcalHelper.h.

Referenced by checkSetup().

Definition at line 60 of file ElectronHcalHelper.h.

Referenced by readEvent(), and ~ElectronHcalHelper().

Definition at line 61 of file ElectronHcalHelper.h.

Referenced by readEvent(), and ~ElectronHcalHelper().

Definition at line 66 of file ElectronHcalHelper.h.

Referenced by hcalESumDepth1(), readEvent(), and ~ElectronHcalHelper().

Definition at line 67 of file ElectronHcalHelper.h.

Referenced by hcalESumDepth2(), readEvent(), and ~ElectronHcalHelper().

Definition at line 65 of file ElectronHcalHelper.h.

Referenced by readEvent(), and ~ElectronHcalHelper().