File indexing completed on 2024-04-06 12:15:35
0001 #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHMassFitSelect_h
0002 #define HeavyFlavorAnalysis_SpecificDecay_BPHMassFitSelect_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHFitSelect.h"
0016 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHMassCuts.h"
0017
0018
0019
0020
0021 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHKinematicFit.h"
0022 #include "RecoVertex/KinematicFitPrimitives/interface/KinematicConstraint.h"
0023 #include "RecoVertex/KinematicFitPrimitives/interface/MultiTrackKinematicConstraint.h"
0024
0025
0026
0027
0028 #include <string>
0029
0030
0031
0032
0033
0034 class BPHMassFitSelect : public BPHFitSelect, public BPHMassCuts {
0035 public:
0036
0037
0038 BPHMassFitSelect(double minMass, double maxMass) : BPHMassCuts(minMass, maxMass) { setFitConstraint(); }
0039
0040 BPHMassFitSelect(const std::string& name, double mass, double sigma, double minMass, double maxMass)
0041 : BPHMassCuts(minMass, maxMass) {
0042 setFitConstraint(name, mass, sigma);
0043 }
0044
0045 BPHMassFitSelect(const std::string& name, double mass, double minMass, double maxMass)
0046 : BPHMassCuts(minMass, maxMass) {
0047 setFitConstraint(name, mass);
0048 }
0049
0050 BPHMassFitSelect(const std::string& name, KinematicConstraint* c, double minMass, double maxMass)
0051 : BPHMassCuts(minMass, maxMass) {
0052 setFitConstraint(name, c);
0053 }
0054
0055 BPHMassFitSelect(const std::string& name, MultiTrackKinematicConstraint* c, double minMass, double maxMass)
0056 : BPHMassCuts(minMass, maxMass) {
0057 setFitConstraint(name, c);
0058 }
0059
0060
0061 BPHMassFitSelect(const BPHMassFitSelect& x) = delete;
0062 BPHMassFitSelect& operator=(const BPHMassFitSelect& x) = delete;
0063
0064
0065
0066 ~BPHMassFitSelect() override = default;
0067
0068
0069
0070
0071 bool accept(const BPHKinematicFit& cand) const override {
0072 switch (type) {
0073 default:
0074 case none:
0075 break;
0076 case mcss:
0077 cand.kinematicTree(cName, cMass, cSigma);
0078 break;
0079 case mcst:
0080 cand.kinematicTree(cName, cMass);
0081 break;
0082 case kf:
0083 cand.kinematicTree(cName, kc);
0084 break;
0085 case mtkf:
0086 cand.kinematicTree(cName, mtkc);
0087 break;
0088 }
0089 double mass = cand.p4().mass();
0090 return ((mass >= mMin) && (mass <= mMax));
0091 }
0092
0093
0094 void setFitConstraint() {
0095 type = none;
0096 cName = "";
0097 cMass = -1.0;
0098 cSigma = -1.0;
0099 kc = nullptr;
0100 mtkc = nullptr;
0101 }
0102 void setFitConstraint(const std::string& name, double mass) {
0103 type = mcst;
0104 cName = name;
0105 cMass = mass;
0106 cSigma = -1.0;
0107 kc = nullptr;
0108 mtkc = nullptr;
0109 }
0110 void setFitConstraint(const std::string& name, double mass, double sigma) {
0111 type = mcss;
0112 cName = name;
0113 cMass = mass;
0114 cSigma = sigma;
0115 kc = nullptr;
0116 mtkc = nullptr;
0117 }
0118 void setFitConstraint(const std::string& name, KinematicConstraint* c) {
0119 type = kf;
0120 cName = name;
0121 cMass = -1.0;
0122 cSigma = -1.0;
0123 kc = c;
0124 mtkc = nullptr;
0125 }
0126 void setFitConstraint(const std::string& name, MultiTrackKinematicConstraint* c) {
0127 type = mtkf;
0128 cName = name;
0129 cMass = -1.0;
0130 cSigma = -1.0;
0131 kc = nullptr;
0132 mtkc = c;
0133 }
0134
0135
0136 const std::string& getConstrainedName() const { return cName; }
0137 double getMass() const { return cMass; }
0138 double getSigma() const { return cSigma; }
0139 KinematicConstraint* getKC() const { return kc; }
0140 MultiTrackKinematicConstraint* getMultiTrackKC() const { return mtkc; }
0141
0142 private:
0143 enum fit_type { none, mcss, mcst, kf, mtkf };
0144
0145 fit_type type;
0146 std::string cName;
0147 double cMass;
0148 double cSigma;
0149 KinematicConstraint* kc;
0150 MultiTrackKinematicConstraint* mtkc;
0151 };
0152
0153 #endif