00001 #ifndef CommonTools_PFCandProducer_PFPileUpAlgo_ 00002 #define CommonTools_PFCandProducer_PFPileUpAlgo_ 00003 00004 #include "FWCore/Framework/interface/Frameworkfwd.h" 00005 #include "FWCore/Framework/interface/EDProducer.h" 00006 00007 #include "FWCore/Framework/interface/Event.h" 00008 00009 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h" 00010 #include "DataFormats/VertexReco/interface/VertexFwd.h" 00011 00012 class PFPileUpAlgo { 00013 public: 00014 00015 00016 typedef std::vector< edm::FwdPtr<reco::PFCandidate> > PFCollection; 00017 00018 PFPileUpAlgo():checkClosestZVertex_(true), verbose_(false) {;} 00019 00020 PFPileUpAlgo( bool checkClosestZVertex, bool verbose=false): 00021 checkClosestZVertex_(checkClosestZVertex), verbose_(verbose) {;} 00022 00023 ~PFPileUpAlgo(){;} 00024 00025 // the last parameter is needed if you want to use the sourceCandidatePtr 00026 void process(const PFCollection & pfCandidates, 00027 const reco::VertexCollection & vertices) ; 00028 00029 inline void setVerbose(bool verbose) { verbose_ = verbose; } 00030 00031 inline void setCheckClosestZVertex(bool val) { checkClosestZVertex_ = val;} 00032 00033 const PFCollection & getPFCandidatesFromPU() const {return pfCandidatesFromPU_;} 00034 00035 const PFCollection & getPFCandidatesFromVtx() const {return pfCandidatesFromVtx_;} 00036 00037 int chargedHadronVertex(const reco::VertexCollection& vertices, 00038 const reco::PFCandidate& pfcand ) const; 00039 00040 00041 private : 00042 00044 bool checkClosestZVertex_; 00045 00046 00048 bool verbose_; 00049 00050 PFCollection pfCandidatesFromVtx_; 00051 PFCollection pfCandidatesFromPU_; 00052 00053 }; 00054 00055 #endif