File indexing completed on 2024-04-06 12:15:35
0001 #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHKinFitChi2Select_h
0002 #define HeavyFlavorAnalysis_SpecificDecay_BPHKinFitChi2Select_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHFitSelect.h"
0016
0017
0018
0019
0020 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHKinematicFit.h"
0021 #include "TMath.h"
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031 class BPHKinFitChi2Select : public BPHFitSelect {
0032 public:
0033
0034
0035 BPHKinFitChi2Select(double prob) : probMin(prob) {}
0036
0037
0038 BPHKinFitChi2Select(const BPHKinFitChi2Select& x) = delete;
0039 BPHKinFitChi2Select& operator=(const BPHKinFitChi2Select& x) = delete;
0040
0041
0042
0043 ~BPHKinFitChi2Select() override = default;
0044
0045
0046
0047
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
0065 void setProbMin(double p) {
0066 probMin = p;
0067 return;
0068 }
0069
0070
0071 double getProbMin() const { return probMin; }
0072
0073 private:
0074 double probMin;
0075 };
0076
0077 #endif