BPHPlusMinusVertex

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
#ifndef HeavyFlavorAnalysis_RecoDecay_BPHPlusMinusVertex_h
#define HeavyFlavorAnalysis_RecoDecay_BPHPlusMinusVertex_h
/** \class BPHPlusMinusVertex
 *
 *  Description: 
 *     class for reconstructed decay vertices to opposite charge
 *     particle pairs
 *
 *  \author Paolo Ronchese INFN Padova
 *
 */

//----------------------
// Base Class Headers --
//----------------------
#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHDecayVertex.h"

//------------------------------------
// Collaborating Class Declarations --
//------------------------------------
#include "HeavyFlavorAnalysis/RecoDecay/interface/BPHPlusMinusCandidatePtr.h"
#include "TrackingTools/PatternTools/interface/ClosestApproachInRPhi.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

class BPHEventSetupWrapper;

//---------------
// C++ Headers --
//---------------

//              ---------------------
//              -- Class Interface --
//              ---------------------

class BPHPlusMinusVertex : public virtual BPHDecayVertex {
public:
  /** Constructor is protected
   *  this object can exist only as part of a derived class
   */
  // deleted copy constructor and assignment operator
  BPHPlusMinusVertex(const BPHPlusMinusVertex& x) = delete;
  BPHPlusMinusVertex& operator=(const BPHPlusMinusVertex& x) = delete;

  /** Destructor
   */
  ~BPHPlusMinusVertex() override;

  /** Operations
   */
  /// compute distance of closest approach
  virtual const ClosestApproachInRPhi& cAppInRPhi() const;

protected:
  BPHPlusMinusVertex(const BPHEventSetupWrapper* es);

  // utility functions to check/enforce the number of decay particles at 2
  template <class T>
  static bool chkName(const T& cont, const std::string& name, const std::string& msg);
  template <class T>
  static bool chkSize(const T& cont, const std::string& msg);
  bool chkSize(const std::string& msg) const;

  // utility function used to cash reconstruction results
  void setNotUpdated() const override;

private:
  // reconstruction results cache
  mutable bool oldA;
  mutable ClosestApproachInRPhi* inRPhi;

  // compute closest approach distance and cache it
  virtual void computeApp() const;
};

template <class T>
bool BPHPlusMinusVertex::chkName(const T& cont, const std::string& name, const std::string& msg) {
  if (cont.find(name) != cont.end())
    return true;
  edm::LogPrint("ParticleNotFound") << msg << ", " << name << " not found";
  return false;
}

template <class T>
bool BPHPlusMinusVertex::chkSize(const T& cont, const std::string& msg) {
  int n = cont.size();
  if (n == 2)
    return true;
  edm::LogPrint("WrongDataSize") << msg << ", size = " << n;
  return false;
}

#endif