Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 /*
0002  *  See header file for a description of this class.
0003  *
0004  *  \author Paolo Ronchese INFN Padova
0005  *
0006  */
0007 
0008 //-----------------------
0009 // This Class' Header --
0010 //-----------------------
0011 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHDecayConstrainedBuilderBase.h"
0012 
0013 //-------------------------------
0014 // Collaborating Class Headers --
0015 //-------------------------------
0016 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoBuilder.h"
0017 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHPlusMinusCandidate.h"
0018 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHRecoCandidate.h"
0019 #include "HeavyFlavorAnalysis/RecoDecay/interface/BPHAnalyzerTokenWrapper.h"
0020 
0021 //---------------
0022 // C++ Headers --
0023 //---------------
0024 #include <iostream>
0025 using namespace std;
0026 
0027 //-------------------
0028 // Initializations --
0029 //-------------------
0030 
0031 //----------------
0032 // Constructors --
0033 //----------------
0034 BPHDecayConstrainedBuilderBase::BPHDecayConstrainedBuilderBase(const BPHEventSetupWrapper& es,
0035                                                                const string& resName,
0036                                                                double resMass,
0037                                                                double resWidth)
0038     : BPHDecayConstrainedBuilderBase(resName, resMass, resWidth) {
0039   if (evSetup == nullptr)
0040     evSetup = new BPHEventSetupWrapper(es);
0041 }
0042 
0043 BPHDecayConstrainedBuilderBase::BPHDecayConstrainedBuilderBase(const string& resName,
0044                                                                double resMass,
0045                                                                double resWidth,
0046                                                                bool createFitSelObject)
0047     : rName(resName),
0048       rMass(resMass),
0049       rWidth(resWidth),
0050       resoSel(new BPHMassSelect(-2.0e+06, -1.0e+06)),
0051       massConstr(true),
0052       mfSelForce(false) {
0053   mFitSel = (createFitSelObject ? massFitSelector(-2.0e+06, -1.0e+06) : nullptr);
0054 }
0055 
0056 BPHDecayConstrainedBuilderBase::BPHDecayConstrainedBuilderBase() {}
0057 
0058 //--------------
0059 // Destructor --
0060 //--------------
0061 BPHDecayConstrainedBuilderBase::~BPHDecayConstrainedBuilderBase() { delete resoSel; }
0062 
0063 //--------------
0064 // Operations --
0065 //--------------
0066 /// set cuts
0067 void BPHDecayConstrainedBuilderBase::setResMassMin(double m) {
0068   outdated = true;
0069   resoSel->setMassMin(m);
0070   return;
0071 }
0072 
0073 void BPHDecayConstrainedBuilderBase::setResMassMax(double m) {
0074   outdated = true;
0075   resoSel->setMassMax(m);
0076   return;
0077 }
0078 
0079 void BPHDecayConstrainedBuilderBase::setResMassRange(double mMin, double mMax) {
0080   outdated = true;
0081   resoSel->setMassMin(mMin);
0082   resoSel->setMassMax(mMax);
0083   return;
0084 }
0085 
0086 void BPHDecayConstrainedBuilderBase::setConstr(bool flag) {
0087   if ((flag == massConstr) && !mfSelForce)
0088     return;
0089   outdated = true;
0090   massConstr = flag;
0091   BPHMassFitSelect* mfs = massFitSelector(mFitSel->getMassMin(), mFitSel->getMassMax());
0092   delete mFitSel;
0093   mFitSel = mfs;
0094   mfSelForce = false;
0095   return;
0096 }
0097 
0098 void BPHDecayConstrainedBuilderBase::setMassFitSelect(BPHMassFitSelect* mfs) {
0099   if (mFitSel == mfs)
0100     return;
0101   outdated = true;
0102   mfSelForce = true;
0103   mFitSel = mfs;
0104   return;
0105 }
0106 
0107 BPHMassFitSelect* BPHDecayConstrainedBuilderBase::massFitSelector(double mMin, double mMax) {
0108   if (massConstr)
0109     return new BPHMassFitSelect(rName, rMass, rWidth, mMin, mMax);
0110   else
0111     return new BPHMassFitSelect(mMin, mMax);
0112 }