Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-07-08 01:45:55

0001 #ifndef HeavyFlavorAnalysis_SpecificDecay_BPHMassSymSelect_h
0002 #define HeavyFlavorAnalysis_SpecificDecay_BPHMassSymSelect_h
0003 /** \class BPHMassSymSelect
0004  *
0005  *  Description: 
0006  *     Class for candidate selection by invariant mass (at momentum sum level)
0007  *     allowing for decay product mass swap
0008  *
0009  *  \author Paolo Ronchese INFN Padova
0010  *
0011  */
0012 
0013 //----------------------
0014 // Base Class Headers --
0015 //----------------------
0016 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHMomentumSelect.h"
0017 
0018 //------------------------------------
0019 // Collaborating Class Declarations --
0020 //------------------------------------
0021 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHDecayMomentum.h"
0022 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHMassSelect.h"
0023 
0024 //---------------
0025 // C++ Headers --
0026 //---------------
0027 #include <string>
0028 
0029 //              ---------------------
0030 //              -- Class Interface --
0031 //              ---------------------
0032 
0033 class BPHMassSymSelect : public BPHMomentumSelect {
0034 public:
0035   /** Constructor
0036    */
0037   BPHMassSymSelect(const std::string& np, const std::string& nn, const BPHMassSelect* ms)
0038       : nPos(np), nNeg(nn), mSel(ms) {}
0039 
0040   // deleted copy constructor and assignment operator
0041   BPHMassSymSelect(const BPHMassSymSelect& x) = delete;
0042   BPHMassSymSelect& operator=(const BPHMassSymSelect& x) = delete;
0043 
0044   /** Destructor
0045    */
0046   ~BPHMassSymSelect() override = default;
0047 
0048   /** Operations
0049    */
0050   /// select particle
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