00001 //***************************************************************************** 00002 // File: EgammaTowerExtractor.cc 00003 // ---------------------------------------------------------------------------- 00004 // OrigAuth: Matthias Mozer 00005 // Institute: IIHE-VUB 00006 //============================================================================= 00007 //***************************************************************************** 00008 //C++ includes 00009 #include <vector> 00010 #include <functional> 00011 #include <math.h> 00012 00013 //ROOT includes 00014 #include <Math/VectorUtil.h> 00015 00016 00017 //CMSSW includes 00018 #include "RecoEgamma/EgammaIsolationAlgos/plugins/EgammaTowerExtractor.h" 00019 #include "DataFormats/GeometryVector/interface/GlobalPoint.h" 00020 #include "DataFormats/GeometryVector/interface/GlobalVector.h" 00021 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h" 00022 #include "DataFormats/EgammaReco/interface/SuperCluster.h" 00023 #include "DataFormats/EgammaReco/interface/SuperClusterFwd.h" 00024 #include "DataFormats/CaloTowers/interface/CaloTower.h" 00025 00026 using namespace ROOT::Math::VectorUtil ; 00027 00028 using namespace egammaisolation; 00029 using namespace reco::isodeposit; 00030 00031 EgammaTowerExtractor::~EgammaTowerExtractor(){} 00032 00033 reco::IsoDeposit EgammaTowerExtractor::deposit(const edm::Event & iEvent, 00034 const edm::EventSetup & iSetup, const reco::Candidate &emObject ) const { 00035 00036 edm::Handle<CaloTowerCollection> towercollectionH; 00037 iEvent.getByLabel(caloTowerTag_, towercollectionH); 00038 00039 //Take the SC position 00040 reco::SuperClusterRef sc = emObject.get<reco::SuperClusterRef>(); 00041 math::XYZPoint caloPosition = sc->position(); 00042 00043 Direction candDir(caloPosition.eta(), caloPosition.phi()); 00044 reco::IsoDeposit deposit( candDir ); 00045 deposit.setVeto( reco::IsoDeposit::Veto(candDir, intRadius_) ); 00046 deposit.addCandEnergy(sc->energy()*sin(2*atan(exp(-sc->eta())))); 00047 00048 //loop over tracks 00049 for(CaloTowerCollection::const_iterator trItr = towercollectionH->begin(), trEnd = towercollectionH->end(); trItr != trEnd; ++trItr){ 00050 double depEt = trItr->hadEt(); 00051 if ( depEt < etLow_ ) continue ; 00052 00053 Direction towerDir( trItr->eta(), trItr->phi() ); 00054 double dR2 = candDir.deltaR2(towerDir); 00055 00056 if (dR2 < extRadius2_) { 00057 deposit.addDeposit( towerDir, depEt); 00058 } 00059 00060 }//end loop over tracks 00061 00062 return deposit; 00063 } 00064