CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

HoECalculator Class Reference

#include <HoECalculator.h>

List of all members.

Public Member Functions

 HoECalculator ()
 HoECalculator (const edm::ESHandle< CaloGeometry > &)
double operator() (const reco::SuperCluster *, HBHERecHitMetaCollection *mhbhe, int ialgo=1)
double operator() (const reco::SuperCluster *, const edm::Event &e, const edm::EventSetup &c)
double operator() (const reco::BasicCluster *, const edm::Event &e, const edm::EventSetup &c)
double operator() (const reco::BasicCluster *, HBHERecHitMetaCollection *mhbhe)

Private Member Functions

double getHoE (GlobalPoint pos, float energy, const edm::Event &e, const edm::EventSetup &c)
double getHoE (GlobalPoint pos, float energy, HBHERecHitMetaCollection *mhbhe)

Private Attributes

const HBHERecHitCollectionhithbhe_
edm::ESHandle< CaloGeometrytheCaloGeom_

Detailed Description

Definition at line 16 of file HoECalculator.h.


Constructor & Destructor Documentation

HoECalculator::HoECalculator ( )

Definition at line 8 of file HoECalculator.cc.

                              :
               theCaloGeom_(0)
{
} 
HoECalculator::HoECalculator ( const edm::ESHandle< CaloGeometry > &  caloGeom)

Definition at line 12 of file HoECalculator.cc.

                                                                        :
               theCaloGeom_(caloGeom)
{
} 

Member Function Documentation

double HoECalculator::getHoE ( GlobalPoint  pos,
float  energy,
const edm::Event e,
const edm::EventSetup c 
) [private]

Definition at line 52 of file HoECalculator.cc.

References CaloRecHitMetaCollection::add(), CaloRecHitMetaCollectionV::end(), f, CaloRecHitMetaCollection::find(), geometry, edm::EventSetup::get(), edm::eventsetup::EventSetupRecord::get(), edm::Event::getByLabel(), CaloSubdetectorGeometry::getClosestCell(), CaloGeometry::getSubdetectorGeometry(), DetId::Hcal, hithbhe_, edm::ESHandleBase::isValid(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), and theCaloGeom_.

Referenced by operator()().

{
  if ( !theCaloGeom_.isValid() )
    c.get<CaloGeometryRecord>().get(theCaloGeom_) ;

  //product the geometry
  theCaloGeom_.product() ;

  //Create a CaloRecHitMetaCollection
  edm::Handle< HBHERecHitCollection > hbhe ;
  e.getByLabel("hbhereco","",hbhe);
  const HBHERecHitCollection* hithbhe_ = hbhe.product();

  double HoE=0.;
  const CaloGeometry& geometry = *theCaloGeom_ ;
  const CaloSubdetectorGeometry *geometry_p ; 
  geometry_p = geometry.getSubdetectorGeometry (DetId::Hcal,4) ;
  DetId hcalDetId ;
  hcalDetId = geometry_p->getClosestCell(pclu) ;
  double hcalEnergy = 0 ;
  CaloRecHitMetaCollection f;
  f.add(hithbhe_);
  CaloRecHitMetaCollection::const_iterator iterRecHit ; 
  iterRecHit = f.find(hcalDetId) ;
  if (iterRecHit!=f.end()) {
    hcalEnergy = iterRecHit->energy() ;
    HoE = hcalEnergy/ecalEnergy ;
  }

  return HoE ;
}
double HoECalculator::getHoE ( GlobalPoint  pos,
float  energy,
HBHERecHitMetaCollection mhbhe 
) [private]

Definition at line 84 of file HoECalculator.cc.

References CaloRecHitMetaCollectionV::end(), relval_parameters_module::energy, SimpleCaloRecHitMetaCollection< C >::find(), CaloSubdetectorGeometry::getClosestCell(), DetId::Hcal, i, and theCaloGeom_.

                                                              {
  
  double HoE=0.;
  
  if (mhbhe) {
    const CaloSubdetectorGeometry *geometry_p ; 
    geometry_p =  theCaloGeom_->getSubdetectorGeometry (DetId::Hcal,4) ;
    HcalDetId dB= geometry_p->getClosestCell(pos);
    CaloRecHitMetaCollectionV::const_iterator i=mhbhe->find(dB);
    if (i!=mhbhe->end()) {
      HoE =  i->energy()/energy;
    }
  }
  return HoE ;

}
double HoECalculator::operator() ( const reco::SuperCluster clus,
const edm::Event e,
const edm::EventSetup c 
)
double HoECalculator::operator() ( const reco::BasicCluster clus,
HBHERecHitMetaCollection mhbhe 
)

Definition at line 47 of file HoECalculator.cc.

References getHoE().

                                                              {
  return getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), mhbhe);
}
double HoECalculator::operator() ( const reco::SuperCluster clus,
HBHERecHitMetaCollection mhbhe,
int  ialgo = 1 
)

Definition at line 27 of file HoECalculator.cc.

References reco::SuperCluster::clustersBegin(), reco::SuperCluster::clustersEnd(), gather_cfg::cout, reco::CaloCluster::energy(), getHoE(), reco::CaloCluster::x(), reco::CaloCluster::y(), and reco::CaloCluster::z().

                                                                               {
  double HoE=0.;
  switch (ialgo) {
    case 1:
      for (reco::CaloCluster_iterator bc=clus->clustersBegin(); bc!=clus->clustersEnd(); bc++) {
        double HoEi = getHoE(GlobalPoint((*bc)->x(),(*bc)->y(),(*bc)->z()),clus->energy(), mhbhe);
        if (HoEi > HoE) HoE = HoEi;
      }
      break;
    case 2:
      HoE = getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), mhbhe);
      break;
    default:
      std::cout << "!!! algo for HoE should be 1 or 2 " << std::endl;
  } 
  return HoE;   
}
double HoECalculator::operator() ( const reco::BasicCluster clus,
const edm::Event e,
const edm::EventSetup c 
)

Definition at line 17 of file HoECalculator.cc.

References trackerHits::c, alignCSCRings::e, and getHoE().

{
  return getHoE(GlobalPoint(clus->x(),clus->y(),clus->z()), clus->energy(), e,c);
}

Member Data Documentation

Definition at line 48 of file HoECalculator.h.

Referenced by getHoE().

Definition at line 47 of file HoECalculator.h.

Referenced by getHoE().