Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:20

0001 #ifndef HeavyFlavorAnalysis_RecoDecay_BPHRecoSelect_h
0002 #define HeavyFlavorAnalysis_RecoDecay_BPHRecoSelect_h
0003 /** \class BPHRecoSelect
0004  *
0005  *  Description: 
0006  *     Base class for daughter particle selection
0007  *
0008  *  \author Paolo Ronchese INFN Padova
0009  *
0010  */
0011 
0012 //----------------------
0013 // Base Class Headers --
0014 //----------------------
0015 
0016 //------------------------------------
0017 // Collaborating Class Declarations --
0018 //------------------------------------
0019 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoBuilder.h"
0020 
0021 namespace reco {
0022   class Candidate;
0023 }
0024 
0025 //---------------
0026 // C++ Headers --
0027 //---------------
0028 #include <string>
0029 #include <map>
0030 
0031 //              ---------------------
0032 //              -- Class Interface --
0033 //              ---------------------
0034 
0035 class BPHRecoSelect {
0036 public:
0037   /** Constructor
0038    */
0039   BPHRecoSelect() {}
0040 
0041   // deleted copy constructor and assignment operator
0042   BPHRecoSelect(const BPHRecoSelect& x) = delete;
0043   BPHRecoSelect& operator=(const BPHRecoSelect& x) = delete;
0044 
0045   /** Destructor
0046    */
0047   virtual ~BPHRecoSelect() {}
0048 
0049   using AcceptArg = reco::Candidate;
0050 
0051   /** Operations
0052    */
0053   /// accept function
0054   /// pointers to other particles in the decays can be obtained
0055   /// by the function "get" giving the particle name (passing the pointer
0056   /// to the builder)
0057   virtual bool accept(const reco::Candidate& cand) const = 0;
0058   virtual bool accept(const reco::Candidate& cand, const BPHRecoBuilder* build) const { return accept(cand); }
0059 
0060 protected:
0061   // function to get other particles pointers
0062   const reco::Candidate* get(const std::string& name, const BPHRecoBuilder* build) const {
0063     if (build == nullptr)
0064       return nullptr;
0065     std::map<std::string, const reco::Candidate*>& cMap = build->daugMap;
0066     std::map<std::string, const reco::Candidate*>::iterator iter = cMap.find(name);
0067     return (iter != cMap.end() ? iter->second : nullptr);
0068   }
0069 };
0070 
0071 #endif