CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
BPHMassFitSelect.h
Go to the documentation of this file.
1 #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHMassFitSelect_h
2 #define HeavyFlavorAnalysis_SpecificDecay_BPHMassFitSelect_h
3 
12 //----------------------
13 // Base Class Headers --
14 //----------------------
17 
18 //------------------------------------
19 // Collaborating Class Declarations --
20 //------------------------------------
24 
25 //---------------
26 // C++ Headers --
27 //---------------
28 #include <string>
29 
30 // ---------------------
31 // -- Class Interface --
32 // ---------------------
33 
34 class BPHMassFitSelect : public BPHFitSelect, public BPHMassCuts {
35 public:
38  BPHMassFitSelect(double minMass, double maxMass) : BPHMassCuts(minMass, maxMass) { setFitConstraint(); }
39 
40  BPHMassFitSelect(const std::string& name, double mass, double sigma, double minMass, double maxMass)
41  : BPHMassCuts(minMass, maxMass) {
42  setFitConstraint(name, mass, sigma);
43  }
44 
45  BPHMassFitSelect(const std::string& name, double mass, double minMass, double maxMass)
46  : BPHMassCuts(minMass, maxMass) {
47  setFitConstraint(name, mass);
48  }
49 
51  : BPHMassCuts(minMass, maxMass) {
52  setFitConstraint(name, c);
53  }
54 
56  : BPHMassCuts(minMass, maxMass) {
57  setFitConstraint(name, c);
58  }
59 
60  // deleted copy constructor and assignment operator
61  BPHMassFitSelect(const BPHMassFitSelect& x) = delete;
62  BPHMassFitSelect& operator=(const BPHMassFitSelect& x) = delete;
63 
66  ~BPHMassFitSelect() override {}
67 
70  bool accept(const BPHKinematicFit& cand) const override {
72  switch (type) {
73  default:
74  case none:
75  break;
76  case mcss:
78  break;
79  case mcst:
80  cand.kinematicTree(cName, cMass);
81  break;
82  case kf:
83  cand.kinematicTree(cName, kc);
84  break;
85  case mtkf:
86  cand.kinematicTree(cName, mtkc);
87  break;
88  }
89  double mass = cand.p4().mass();
90  return ((mass >= mMin) && (mass <= mMax));
91  }
92 
95  type = none;
96  cName = "";
97  cMass = -1.0;
98  cSigma = -1.0;
99  kc = nullptr;
100  mtkc = nullptr;
101  }
102  void setFitConstraint(const std::string& name, double mass) {
103  type = mcst;
104  cName = name;
105  cMass = mass;
106  cSigma = -1.0;
107  kc = nullptr;
108  mtkc = nullptr;
109  }
110  void setFitConstraint(const std::string& name, double mass, double sigma) {
111  type = mcss;
112  cName = name;
113  cMass = mass;
114  cSigma = sigma;
115  kc = nullptr;
116  mtkc = nullptr;
117  }
119  type = kf;
120  cName = name;
121  cMass = -1.0;
122  cSigma = -1.0;
123  kc = c;
124  mtkc = nullptr;
125  }
127  type = mtkf;
128  cName = name;
129  cMass = -1.0;
130  cSigma = -1.0;
131  kc = nullptr;
132  mtkc = c;
133  }
134 
136  const std::string& getConstrainedName() const { return cName; }
137  double getMass() const { return cMass; }
138  double getSigma() const { return cSigma; }
139  KinematicConstraint* getKC() const { return kc; }
141 
142 private:
143  enum fit_type { none, mcss, mcst, kf, mtkf };
144 
147  double cMass;
148  double cSigma;
151 };
152 
153 #endif
~BPHMassFitSelect() override
virtual const math::XYZTLorentzVector & p4() const
compute total momentum after the fit
const edm::EventSetup & c
void setFitConstraint(const std::string &name, double mass, double sigma)
void setFitConstraint()
set fit constraint
double getMass() const
BPHMassFitSelect(const std::string &name, double mass, double sigma, double minMass, double maxMass)
void setFitConstraint(const std::string &name, double mass)
const std::string & getConstrainedName() const
get fit constraint
double mMax
Definition: BPHMassCuts.h:63
virtual const RefCountedKinematicTree & kinematicTree() const
perform the kinematic fit and get the result
BPHMassFitSelect(double minMass, double maxMass)
double getSigma() const
void setFitConstraint(const std::string &name, KinematicConstraint *c)
MultiTrackKinematicConstraint * getMultiTrackKC() const
void setFitConstraint(const std::string &name, MultiTrackKinematicConstraint *c)
KinematicConstraint * getKC() const
BPHMassFitSelect(const std::string &name, MultiTrackKinematicConstraint *c, double minMass, double maxMass)
double mMin
Definition: BPHMassCuts.h:62
KinematicConstraint * kc
MultiTrackKinematicConstraint * mtkc
BPHMassFitSelect(const std::string &name, KinematicConstraint *c, double minMass, double maxMass)
BPHMassFitSelect & operator=(const BPHMassFitSelect &x)=delete
bool accept(const BPHKinematicFit &cand) const override
select particle
BPHMassFitSelect(const std::string &name, double mass, double minMass, double maxMass)