Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHKinFitChi2Select_h
0002 #define HeavyFlavorAnalysis_SpecificDecay_BPHKinFitChi2Select_h
0003 /** \class BPHKinFitChi2Select
0004  *
0005  *  Description: 
0006  *     Class for candidate selection by chisquare (at vertex fit level)
0007  *
0008  *  \author Paolo Ronchese INFN Padova
0009  *
0010  */
0011 
0012 //----------------------
0013 // Base Class Headers --
0014 //----------------------
0015 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHFitSelect.h"
0016 
0017 //------------------------------------
0018 // Collaborating Class Declarations --
0019 //------------------------------------
0020 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHKinematicFit.h"
0021 #include "TMath.h"
0022 
0023 //---------------
0024 // C++ Headers --
0025 //---------------
0026 
0027 //              ---------------------
0028 //              -- Class Interface --
0029 //              ---------------------
0030 
0031 class BPHKinFitChi2Select : public BPHFitSelect {
0032 public:
0033   /** Constructor
0034    */
0035   BPHKinFitChi2Select(double prob) : probMin(prob) {}
0036 
0037   // deleted copy constructor and assignment operator
0038   BPHKinFitChi2Select(const BPHKinFitChi2Select& x) = delete;
0039   BPHKinFitChi2Select& operator=(const BPHKinFitChi2Select& x) = delete;
0040 
0041   /** Destructor
0042    */
0043   ~BPHKinFitChi2Select() override = default;
0044 
0045   /** Operations
0046    */
0047   /// select vertex
0048   bool accept(const BPHKinematicFit& cand) const override {
0049     if (probMin < 0.0)
0050       return true;
0051     const RefCountedKinematicVertex tdv = cand.topDecayVertex();
0052     if (tdv.get() == nullptr)
0053       return false;
0054     if (!tdv->vertexIsValid())
0055       return false;
0056     reco::Vertex v(*tdv);
0057     if (v.isFake())
0058       return false;
0059     if (!v.isValid())
0060       return false;
0061     return (TMath::Prob(v.chi2(), lround(v.ndof())) >= probMin);
0062   }
0063 
0064   /// set prob min
0065   void setProbMin(double p) {
0066     probMin = p;
0067     return;
0068   }
0069 
0070   /// get current prob min
0071   double getProbMin() const { return probMin; }
0072 
0073 private:
0074   double probMin;
0075 };
0076 
0077 #endif