Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #include <vector>
00011 #include <functional>
00012
00013
00014 #include <Math/VectorUtil.h>
00015
00016
00017 #include "RecoEgamma/EgammaIsolationAlgos/plugins/EgammaEcalExtractor.h"
00018 #include "DataFormats/RecoCandidate/interface/RecoCandidate.h"
00019
00020 using namespace egammaisolation;
00021 using namespace reco::isodeposit;
00022
00023 EgammaEcalExtractor::~EgammaEcalExtractor(){}
00024
00025 reco::IsoDeposit EgammaEcalExtractor::deposit(const edm::Event & ev, const edm::EventSetup & evSetup, const reco::Candidate & candidate) const {
00026 edm::Handle<reco::SuperClusterCollection> superClusterCollectionH;
00027 edm::Handle<reco::BasicClusterCollection> basicClusterCollectionH;
00028 ev.getByLabel(superClusterTag_, superClusterCollectionH);
00029 ev.getByLabel(basicClusterTag_, basicClusterCollectionH);
00030
00031 reco::SuperClusterRef sc = candidate.get<reco::SuperClusterRef>();
00032 math::XYZPoint position = sc->position();
00033
00034 double delta1=1000.;
00035 double deltacur=1000.;
00036 const reco::SuperCluster *matchedsupercluster=0;
00037 bool MATCHEDSC = false;
00038
00039 Direction candDir(position.eta(), position.phi());
00040 reco::IsoDeposit deposit(candDir );
00041 deposit.setVeto( reco::IsoDeposit::Veto(candDir, 0) );
00042 deposit.addCandEnergy(sc->energy()*sin(2*atan(exp(-sc->eta()))));
00043
00044 for(reco::SuperClusterCollection::const_iterator scItr = superClusterCollectionH->begin(); scItr != superClusterCollectionH->end(); ++scItr){
00045
00046 const reco::SuperCluster *supercluster = &(*scItr);
00047
00048 if(supercluster->seed()->algo() == 0){
00049 deltacur = ROOT::Math::VectorUtil::DeltaR(supercluster->position(), position);
00050 if (deltacur < delta1) {
00051 delta1=deltacur;
00052 matchedsupercluster = supercluster;
00053 MATCHEDSC = true;
00054 }
00055 }
00056 }
00057
00058 const reco::BasicCluster *cluster= 0;
00059
00060
00061 for(reco::BasicClusterCollection::const_iterator cItr = basicClusterCollectionH->begin(); cItr != basicClusterCollectionH->end(); ++cItr){
00062
00063 cluster = &(*cItr);
00064
00065 int ebc_bcalgo = cluster->algo();
00066 double ebc_bce = cluster->energy();
00067 double ebc_bceta = cluster->eta();
00068 double ebc_bcet = ebc_bce*sin(2*atan(exp(ebc_bceta)));
00069 double newDelta = 0.;
00070
00071 if (ebc_bcet > etMin_ && ebc_bcalgo == 0) {
00072
00073
00074 if(MATCHEDSC || !scmatch_ ){
00075 bool inSuperCluster = false;
00076
00077 if( scmatch_ ){
00078 reco::CaloCluster_iterator theEclust = matchedsupercluster->clustersBegin();
00079
00080 for(;theEclust != matchedsupercluster->clustersEnd(); ++theEclust) {
00081 if ((**theEclust) == (*cluster) ) inSuperCluster = true;
00082 }
00083 }
00084 if (!inSuperCluster || !scmatch_ ) {
00085 newDelta=ROOT::Math::VectorUtil::DeltaR(cluster->position(),position);
00086 if(newDelta < conesize_) {
00087 deposit.addDeposit( Direction(cluster->eta(), cluster->phi()), ebc_bcet);
00088 }
00089 }
00090 }
00091
00092 }
00093
00094 }
00095
00096
00097 return deposit;
00098
00099 }