File indexing completed on 2024-04-06 12:15:35
0001 #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHMassSymSelect_h
0002 #define HeavyFlavorAnalysis_SpecificDecay_BPHMassSymSelect_h
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHMomentumSelect.h"
0017
0018
0019
0020
0021 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHDecayMomentum.h"
0022 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHMassSelect.h"
0023
0024
0025
0026
0027 #include <string>
0028
0029
0030
0031
0032
0033 class BPHMassSymSelect : public BPHMomentumSelect {
0034 public:
0035
0036
0037 BPHMassSymSelect(const std::string& np, const std::string& nn, const BPHMassSelect* ms)
0038 : nPos(np), nNeg(nn), mSel(ms) {}
0039
0040
0041 BPHMassSymSelect(const BPHMassSymSelect& x) = delete;
0042 BPHMassSymSelect& operator=(const BPHMassSymSelect& x) = delete;
0043
0044
0045
0046 ~BPHMassSymSelect() override = default;
0047
0048
0049
0050
0051 bool accept(const BPHDecayMomentum& cand) const override {
0052 if (mSel->accept(cand))
0053 return true;
0054
0055 const reco::Candidate* pp = cand.getDaug(nPos);
0056 const reco::Candidate* np = cand.getDaug(nNeg);
0057
0058 reco::Candidate* pc = cand.originalReco(pp)->clone();
0059 reco::Candidate* nc = cand.originalReco(np)->clone();
0060
0061 pc->setMass(np->p4().mass());
0062 nc->setMass(pp->p4().mass());
0063 const reco::Candidate::LorentzVector s4 = pc->p4() + nc->p4();
0064 double mass = s4.mass();
0065
0066 delete pc;
0067 delete nc;
0068 return ((mass >= mSel->getMassMin()) && (mass <= mSel->getMassMax()));
0069 }
0070
0071 private:
0072 std::string nPos;
0073 std::string nNeg;
0074 const BPHMassSelect* mSel;
0075 };
0076
0077 #endif