Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009 #include <vector>
00010 #include <functional>
00011 #include <math.h>
00012
00013
00014 #include <Math/VectorUtil.h>
00015
00016
00017
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
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
00049 for(CaloTowerCollection::const_iterator trItr = towercollectionH->begin(), trEnd = towercollectionH->end(); trItr != trEnd; ++trItr){
00050 double depEt = 0;
00051
00052
00053
00054
00055
00056 if(depth_==AllDepths) depEt = trItr->hadEt();
00057 else if(depth_==Depth1) depEt = trItr->ietaAbs()<18 || trItr->ietaAbs()>29 ? trItr->hadEt() : trItr->hadEnergyHeInnerLayer()*sin(trItr->p4().theta());
00058 else if(depth_==Depth2) depEt = trItr->hadEnergyHeOuterLayer()*sin(trItr->p4().theta());
00059
00060 if ( depEt < etLow_ ) continue ;
00061
00062
00063 Direction towerDir( trItr->eta(), trItr->phi() );
00064 double dR2 = candDir.deltaR2(towerDir);
00065
00066 if (dR2 < extRadius2_) {
00067 deposit.addDeposit( towerDir, depEt);
00068 }
00069
00070 }
00071
00072 return deposit;
00073 }
00074