Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2023-03-17 10:45:20

0001 #ifndef CommonTools_PFCandProducer_PFPileUpAlgo_
0002 #define CommonTools_PFCandProducer_PFPileUpAlgo_
0003 
0004 #include "FWCore/Framework/interface/Frameworkfwd.h"
0005 
0006 #include "FWCore/Framework/interface/Event.h"
0007 
0008 #include "DataFormats/ParticleFlowCandidate/interface/PFCandidateFwd.h"
0009 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0010 
0011 class PFPileUpAlgo {
0012 public:
0013   typedef std::vector<edm::FwdPtr<reco::PFCandidate> > PFCollection;
0014 
0015   PFPileUpAlgo() : checkClosestZVertex_(true), verbose_(false) { ; }
0016 
0017   PFPileUpAlgo(bool checkClosestZVertex, bool verbose = false)
0018       : checkClosestZVertex_(checkClosestZVertex), verbose_(verbose) {
0019     ;
0020   }
0021 
0022   ~PFPileUpAlgo() { ; }
0023 
0024   // the last parameter is needed if you want to use the sourceCandidatePtr
0025   void process(const PFCollection& pfCandidates, const reco::VertexCollection& vertices);
0026 
0027   inline void setVerbose(bool verbose) { verbose_ = verbose; }
0028 
0029   inline void setCheckClosestZVertex(bool val) { checkClosestZVertex_ = val; }
0030   inline void setNumOfPUVtxsForCharged(unsigned int val) { fNumOfPUVtxsForCharged_ = val; }
0031   inline void setDzCutForChargedFromPUVtxs(double val) { fDzCutForChargedFromPUVtxs_ = val; }
0032 
0033   const PFCollection& getPFCandidatesFromPU() const { return pfCandidatesFromPU_; }
0034 
0035   const PFCollection& getPFCandidatesFromVtx() const { return pfCandidatesFromVtx_; }
0036 
0037   int chargedHadronVertex(const reco::VertexCollection& vertices, const reco::PFCandidate& pfcand) const;
0038 
0039 private:
0040   /// use the closest z vertex if a track is not in a vertex
0041   bool checkClosestZVertex_;
0042   unsigned int fNumOfPUVtxsForCharged_;
0043   double fDzCutForChargedFromPUVtxs_;
0044 
0045   /// verbose ?
0046   bool verbose_;
0047 
0048   PFCollection pfCandidatesFromVtx_;
0049   PFCollection pfCandidatesFromPU_;
0050 };
0051 
0052 #endif