00001 /* 00002 * ============================================================================= 00003 * Filename: RecoTauEnergyRecoveryPlugin2.cc 00004 * 00005 * Description: Set tau energy to sum of **all** PFCandidates 00006 * (regardless of PFCandidate type and whether 00007 * PFCandidate passes or fails quality cuts) 00008 * 00009 * NOTE: use for testing only, 00010 * this code has **not** yet been commissioned !! 00011 * 00012 * Created: 02/02/2013 17:09:00 00013 * 00014 * Authors: Christian Veelken (LLR) 00015 * 00016 * ============================================================================= 00017 */ 00018 00019 #include "RecoTauTag/RecoTau/interface/RecoTauBuilderPlugins.h" 00020 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidate.h" 00021 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" 00022 #include "DataFormats/JetReco/interface/PFJet.h" 00023 #include "DataFormats/GsfTrackReco/interface/GsfTrack.h" 00024 #include "DataFormats/TrackReco/interface/Track.h" 00025 #include "DataFormats/VertexReco/interface/Vertex.h" 00026 #include "DataFormats/VertexReco/interface/VertexFwd.h" 00027 #include "RecoTauTag/RecoTau/interface/RecoTauQualityCuts.h" 00028 00029 #include "FWCore/Framework/interface/ESHandle.h" 00030 00031 #include "DataFormats/Math/interface/deltaR.h" 00032 00033 #include <algorithm> 00034 00035 namespace reco { namespace tau { 00036 00037 class RecoTauEnergyRecoveryPlugin2 : public RecoTauModifierPlugin 00038 { 00039 public: 00040 00041 explicit RecoTauEnergyRecoveryPlugin2(const edm::ParameterSet&); 00042 virtual ~RecoTauEnergyRecoveryPlugin2(); 00043 void operator()(PFTau&) const; 00044 virtual void beginEvent(); 00045 00046 private: 00047 00048 double dRcone_; 00049 }; 00050 00051 RecoTauEnergyRecoveryPlugin2::RecoTauEnergyRecoveryPlugin2(const edm::ParameterSet& cfg) 00052 : RecoTauModifierPlugin(cfg), 00053 dRcone_(cfg.getParameter<double>("dRcone")) 00054 {} 00055 00056 RecoTauEnergyRecoveryPlugin2::~RecoTauEnergyRecoveryPlugin2() 00057 {} 00058 00059 void RecoTauEnergyRecoveryPlugin2::beginEvent() 00060 {} 00061 00062 void RecoTauEnergyRecoveryPlugin2::operator()(PFTau& tau) const 00063 { 00064 reco::Candidate::LorentzVector tauAltP4(0.,0.,0.,0.); 00065 00066 std::vector<reco::PFCandidatePtr> pfJetConstituents = tau.jetRef()->getPFConstituents(); 00067 for ( std::vector<reco::PFCandidatePtr>::const_iterator pfJetConstituent = pfJetConstituents.begin(); 00068 pfJetConstituent != pfJetConstituents.end(); ++pfJetConstituent ) { 00069 double dR = deltaR((*pfJetConstituent)->p4(), tau.p4()); 00070 if ( dR < dRcone_ ) tauAltP4 += (*pfJetConstituent)->p4(); 00071 } 00072 00073 tau.setalternatLorentzVect(tauAltP4); 00074 } 00075 00076 }} // end namespace reco::tau 00077 00078 #include "FWCore/Framework/interface/MakerMacros.h" 00079 DEFINE_EDM_PLUGIN(RecoTauModifierPluginFactory, 00080 reco::tau::RecoTauEnergyRecoveryPlugin2, 00081 "RecoTauEnergyRecoveryPlugin2");