CMS 3D CMS Logo

EgammaHcalIsolation.cc

Go to the documentation of this file.
00001 //*****************************************************************************
00002 // File:      EgammaHcalIsolation.cc
00003 // ----------------------------------------------------------------------------
00004 // OrigAuth:  Matthias Mozer
00005 // Institute: IIHE-VUB
00006 //=============================================================================
00007 //*****************************************************************************
00008 //C++ includes
00009 #include <vector>
00010 #include <functional>
00011 
00012 //ROOT includes
00013 #include <Math/VectorUtil.h>
00014 
00015 //CMSSW includes
00016 #include "RecoEgamma/EgammaIsolationAlgos/interface/EgammaHcalIsolation.h"
00017 #include "DataFormats/HcalDetId/interface/HcalDetId.h"
00018 #include "Geometry/CommonDetUnit/interface/TrackingGeometry.h"
00019 #include "Geometry/Records/interface/TrackerDigiGeometryRecord.h"
00020 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
00021 #include "DataFormats/GeometryVector/interface/GlobalVector.h"
00022 #include "RecoCaloTools/Selectors/interface/CaloConeSelector.h"
00023 #include "DataFormats/EgammaReco/interface/SuperCluster.h"
00024 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h"
00025 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00026 
00027 using namespace std;
00028 
00029 EgammaHcalIsolation::EgammaHcalIsolation (double extRadius,
00030                             double intRadius,
00031                             double etLow,
00032                             edm::ESHandle<CaloGeometry> theCaloGeom ,
00033                             HBHERecHitMetaCollection*  mhbhe) :
00034   extRadius_(extRadius),
00035   intRadius_(intRadius),
00036   etLow_(etLow),
00037   theCaloGeom_(theCaloGeom) ,  
00038   mhbhe_(mhbhe)
00039 {
00040   //set up the geometry and selector
00041   const CaloGeometry* caloGeom = theCaloGeom_.product();
00042   doubleConeSel_ = new CaloDualConeSelector (intRadius_ ,extRadius_, caloGeom, DetId::Hcal);
00043 }
00044 
00045 EgammaHcalIsolation::~EgammaHcalIsolation ()
00046 {
00047   delete doubleConeSel_;
00048 }
00049 
00050 double EgammaHcalIsolation::getHcalEtSum (const reco::Candidate* emObject) const
00051 {
00052 
00053   double hcalEt = 0.;
00054   if (mhbhe_) 
00055    {
00056       //Take the SC position
00057      reco::SuperClusterRef sc = emObject->get<reco::SuperClusterRef>();
00058      math::XYZPoint theCaloPosition = sc.get()->position();
00059      //      math::XYZPoint theCaloPosition = (emObject->get<reco::SuperClusterRef>())->position() ;
00060       GlobalPoint pclu (theCaloPosition.x () ,
00061                         theCaloPosition.y () ,
00062                         theCaloPosition.z () );
00063       //Compute the HCAL energy behind ECAL
00064       std::auto_ptr<CaloRecHitMetaCollectionV> chosen = doubleConeSel_->select(pclu,*mhbhe_);
00065       for (CaloRecHitMetaCollectionV::const_iterator i = chosen->begin () ; 
00066                                                      i!= chosen->end () ; 
00067                                                      ++i) 
00068        {
00069          double hcalHit_eta = theCaloGeom_.product()->getPosition(i->detid()).eta();
00070          double hcalHit_Et = i->energy()*sin(2*atan(exp(-hcalHit_eta)));
00071          if ( hcalHit_Et > etLow_)
00072               hcalEt += hcalHit_Et;
00073        }
00074     } 
00075   return hcalEt ;
00076 }

Generated on Tue Jun 9 17:43:25 2009 for CMSSW by  doxygen 1.5.4