Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:33

0001 #ifndef HeavyFlavorAnalysis_RecoDecay_BPHPlusMinusVertex_h
0002 #define HeavyFlavorAnalysis_RecoDecay_BPHPlusMinusVertex_h
0003 /** \class BPHPlusMinusVertex
0004  *
0005  *  Description: 
0006  *     class for reconstructed decay vertices to opposite charge
0007  *     particle pairs
0008  *
0009  *  \author Paolo Ronchese INFN Padova
0010  *
0011  */
0012 
0013 //----------------------
0014 // Base Class Headers --
0015 //----------------------
0016 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHDecayVertex.h"
0017 
0018 //------------------------------------
0019 // Collaborating Class Declarations --
0020 //------------------------------------
0021 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHPlusMinusCandidatePtr.h"
0022 #include "TrackingTools/PatternTools/interface/ClosestApproachInRPhi.h"
0023 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0024 
0025 class BPHEventSetupWrapper;
0026 
0027 //---------------
0028 // C++ Headers --
0029 //---------------
0030 
0031 //              ---------------------
0032 //              -- Class Interface --
0033 //              ---------------------
0034 
0035 class BPHPlusMinusVertex : public virtual BPHDecayVertex {
0036 public:
0037   /** Constructor is protected
0038    *  this object can exist only as part of a derived class
0039    */
0040   // deleted copy constructor and assignment operator
0041   BPHPlusMinusVertex(const BPHPlusMinusVertex& x) = delete;
0042   BPHPlusMinusVertex& operator=(const BPHPlusMinusVertex& x) = delete;
0043 
0044   /** Destructor
0045    */
0046   ~BPHPlusMinusVertex() override;
0047 
0048   /** Operations
0049    */
0050   /// compute distance of closest approach
0051   virtual const ClosestApproachInRPhi& cAppInRPhi() const;
0052 
0053 protected:
0054   BPHPlusMinusVertex(const BPHEventSetupWrapper* es);
0055 
0056   // utility functions to check/enforce the number of decay particles at 2
0057   template <class T>
0058   static bool chkName(const T& cont, const std::string& name, const std::string& msg);
0059   template <class T>
0060   static bool chkSize(const T& cont, const std::string& msg);
0061   bool chkSize(const std::string& msg) const;
0062 
0063   // utility function used to cash reconstruction results
0064   void setNotUpdated() const override;
0065 
0066 private:
0067   // reconstruction results cache
0068   mutable bool oldA;
0069   mutable ClosestApproachInRPhi* inRPhi;
0070 
0071   // compute closest approach distance and cache it
0072   virtual void computeApp() const;
0073 };
0074 
0075 template <class T>
0076 bool BPHPlusMinusVertex::chkName(const T& cont, const std::string& name, const std::string& msg) {
0077   if (cont.find(name) != cont.end())
0078     return true;
0079   edm::LogPrint("ParticleNotFound") << msg << ", " << name << " not found";
0080   return false;
0081 }
0082 
0083 template <class T>
0084 bool BPHPlusMinusVertex::chkSize(const T& cont, const std::string& msg) {
0085   int n = cont.size();
0086   if (n == 2)
0087     return true;
0088   edm::LogPrint("WrongDataSize") << msg << ", size = " << n;
0089   return false;
0090 }
0091 
0092 #endif