Go to the documentation of this file.00001 #include "PFCandWithSuperClusterExtractor.h"
00002
00003 #include "RecoMuon/MuonIsolation/interface/Range.h"
00004 #include "DataFormats/RecoCandidate/interface/IsoDepositDirection.h"
00005 #include "DataFormats/Common/interface/Handle.h"
00006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00007 #include "DataFormats/Math/interface/deltaR.h"
00008
00009 using namespace edm;
00010 using namespace reco;
00011
00012 PFCandWithSuperClusterExtractor::PFCandWithSuperClusterExtractor( const ParameterSet& par ) :
00013 thePFCandTag(par.getParameter<edm::InputTag>("inputCandView")),
00014 theDepositLabel(par.getUntrackedParameter<std::string>("DepositLabel")),
00015 theVetoSuperClusterMatch(par.getParameter<bool>("SCMatch_Veto")),
00016 theDiff_r(par.getParameter<double>("Diff_r")),
00017 theDiff_z(par.getParameter<double>("Diff_z")),
00018 theDR_Max(par.getParameter<double>("DR_Max")),
00019 theDR_Veto(par.getParameter<double>("DR_Veto"))
00020 {
00021
00022 }
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 reco::IsoDeposit::Veto PFCandWithSuperClusterExtractor::veto(const reco::IsoDeposit::Direction & dir) const
00033 {
00034 reco::IsoDeposit::Veto result;
00035 result.vetoDir = dir;
00036 result.dR = theDR_Veto;
00037 return result;
00038 }
00039
00040
00041 IsoDeposit PFCandWithSuperClusterExtractor::depositFromObject(const Event & event, const EventSetup & eventSetup, const Photon & cand) const
00042 {
00043 reco::isodeposit::Direction candDir(cand.eta(), cand.phi());
00044 IsoDeposit deposit(candDir );
00045 deposit.setVeto( veto(candDir) );
00046 deposit.addCandEnergy(cand.pt());
00047
00048 Handle< PFCandidateCollection > PFCandH;
00049 event.getByLabel(thePFCandTag, PFCandH);
00050
00051 double eta = cand.eta(), phi = cand.phi();
00052 reco::Particle::Point vtx = cand.vertex();
00053 for (PFCandidateCollection::const_iterator it = PFCandH->begin(), ed = PFCandH->end(); it != ed; ++it) {
00054 double dR = deltaR(it->eta(), it->phi(), eta, phi);
00055
00056 if (theVetoSuperClusterMatch && cand.superCluster().isNonnull() && it->superClusterRef().isNonnull() && cand.superCluster() == it->superClusterRef()) continue;
00057 if ( (dR < theDR_Max) && (dR > theDR_Veto) &&
00058 (std::abs(it->vz() - cand.vz()) < theDiff_z) &&
00059 ((it->vertex() - vtx).Rho() < theDiff_r)) {
00060
00061 reco::isodeposit::Direction dirTrk(it->eta(), it->phi());
00062 deposit.addDeposit(dirTrk, it->pt());
00063 }
00064 }
00065
00066 return deposit;
00067 }
00068
00069 IsoDeposit PFCandWithSuperClusterExtractor::depositFromObject(const Event & event, const EventSetup & eventSetup, const Track & cand) const
00070 {
00071 reco::isodeposit::Direction candDir(cand.eta(), cand.phi());
00072 IsoDeposit deposit(candDir );
00073 deposit.setVeto( veto(candDir) );
00074 deposit.addCandEnergy(cand.pt());
00075 Handle< PFCandidateCollection > PFCandH;
00076 event.getByLabel(thePFCandTag, PFCandH);
00077
00078 double eta = cand.eta(), phi = cand.phi();
00079 reco::Particle::Point vtx = cand.vertex();
00080 for (PFCandidateCollection::const_iterator it = PFCandH->begin(), ed = PFCandH->end(); it != ed; ++it) {
00081 double dR = deltaR(it->eta(), it->phi(), eta, phi);
00082
00083 if ( (dR < theDR_Max) && (dR > theDR_Veto) &&
00084 (std::abs(it->vz() - cand.vz()) < theDiff_z) &&
00085 ((it->vertex() - vtx).Rho() < theDiff_r)) {
00086
00087 reco::isodeposit::Direction dirTrk(it->eta(), it->phi());
00088 deposit.addDeposit(dirTrk, it->pt());
00089 }
00090 }
00091
00092 return deposit;
00093 }
00094
00095
00096 IsoDeposit PFCandWithSuperClusterExtractor::depositFromObject(const Event & event, const EventSetup & eventSetup, const PFCandidate & cand) const
00097 {
00098 reco::isodeposit::Direction candDir(cand.eta(), cand.phi());
00099 IsoDeposit deposit(candDir );
00100 deposit.setVeto( veto(candDir) );
00101 deposit.addCandEnergy(cand.pt());
00102 Handle< PFCandidateCollection > PFCandH;
00103 event.getByLabel(thePFCandTag, PFCandH);
00104
00105 double eta = cand.eta(), phi = cand.phi();
00106 reco::Particle::Point vtx = cand.vertex();
00107 for (PFCandidateCollection::const_iterator it = PFCandH->begin(), ed = PFCandH->end(); it != ed; ++it) {
00108
00109 if (theVetoSuperClusterMatch && cand.superClusterRef().isNonnull() && it->superClusterRef().isNonnull() && cand.superClusterRef() == it->superClusterRef()) continue;
00110 double dR = deltaR(it->eta(), it->phi(), eta, phi);
00111
00112 if ( (dR < theDR_Max) && (dR > theDR_Veto) &&
00113 (std::abs(it->vz() - cand.vz()) < theDiff_z) &&
00114 ((it->vertex() - vtx).Rho() < theDiff_r)) {
00115
00116 reco::isodeposit::Direction dirTrk(it->eta(), it->phi());
00117 deposit.addDeposit(dirTrk, it->pt());
00118 }
00119 }
00120
00121 return deposit;
00122 }
00123
00124
00125
00126 #include "FWCore/PluginManager/interface/ModuleDef.h"
00127 #include "FWCore/Framework/interface/MakerMacros.h"
00128
00129
00130 #include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractor.h"
00131 #include "PhysicsTools/IsolationAlgos/interface/IsoDepositExtractorFactory.h"
00132 #include "PFCandWithSuperClusterExtractor.h"
00133 DEFINE_EDM_PLUGIN(IsoDepositExtractorFactory, PFCandWithSuperClusterExtractor, "PFCandWithSuperClusterExtractor");