Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:24

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/BPHBdToKxMuMuBuilder.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/SpecificDecay/interface/BPHMassSelect.h"
0020 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHChi2Select.h"
0021 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHMassFitSelect.h"
0022 #include "HeavyFlavorAnalysis/SpecificDecay/interface/BPHParticleMasses.h"
0023 
0024 //---------------
0025 // C++ Headers --
0026 //---------------
0027 using namespace std;
0028 
0029 //-------------------
0030 // Initializations --
0031 //-------------------
0032 
0033 //----------------
0034 // Constructors --
0035 //----------------
0036 BPHBdToKxMuMuBuilder::BPHBdToKxMuMuBuilder(const edm::EventSetup& es,
0037                                            const std::vector<BPHPlusMinusConstCandPtr>& oniaCollection,
0038                                            const std::vector<BPHPlusMinusConstCandPtr>& kx0Collection)
0039     : oniaName("Onia"), kx0Name("Kx0"), evSetup(&es), jCollection(&oniaCollection), kCollection(&kx0Collection) {
0040   oniaSel = new BPHMassSelect(1.00, 12.00);
0041   mkx0Sel = new BPHMassSelect(0.80, 1.00);
0042   massSel = new BPHMassSelect(3.50, 8.00);
0043   chi2Sel = new BPHChi2Select(0.02);
0044   mFitSel = new BPHMassFitSelect(4.00, 7.00);
0045   massConstr = true;
0046   minPDiff = 1.0e-4;
0047   updated = false;
0048 }
0049 
0050 //--------------
0051 // Destructor --
0052 //--------------
0053 BPHBdToKxMuMuBuilder::~BPHBdToKxMuMuBuilder() {
0054   delete oniaSel;
0055   delete mkx0Sel;
0056   delete massSel;
0057   delete chi2Sel;
0058   delete mFitSel;
0059 }
0060 
0061 //--------------
0062 // Operations --
0063 //--------------
0064 vector<BPHRecoConstCandPtr> BPHBdToKxMuMuBuilder::build() {
0065   if (updated)
0066     return bdList;
0067 
0068   bdList.clear();
0069 
0070   BPHRecoBuilder bBd(*evSetup);
0071   bBd.setMinPDiffererence(minPDiff);
0072   bBd.add(oniaName, *jCollection);
0073   bBd.add(kx0Name, *kCollection);
0074   bBd.filter(oniaName, *oniaSel);
0075   bBd.filter(kx0Name, *mkx0Sel);
0076 
0077   bBd.filter(*massSel);
0078   if (chi2Sel != nullptr)
0079     bBd.filter(*chi2Sel);
0080   if (massConstr)
0081     bBd.filter(*mFitSel);
0082 
0083   bdList = BPHRecoCandidate::build(bBd);
0084   //
0085   //  Apply kinematic constraint on the onia mass.
0086   //  The operation is already performed when apply the mass selection,
0087   //  so it's not repeated. The following code is left as example
0088   //  for similar operations
0089   //
0090   //  int iBd;
0091   //  int nBd = ( massConstr ? bdList.size() : 0 );
0092   //  for ( iBd = 0; iBd < nBd; ++iBd ) {
0093   //    BPHRecoCandidate* cptr = bdList[iBd].get();
0094   //    BPHRecoConstCandPtr onia = cptr->getComp( oniaName );
0095   //    double oMass = onia->constrMass();
0096   //    if ( oMass < 0 ) continue;
0097   //    double sigma = onia->constrSigma();
0098   //    cptr->kinematicTree( oniaName, oMass, sigma );
0099   //  }
0100   updated = true;
0101 
0102   return bdList;
0103 }
0104 
0105 /// set cuts
0106 void BPHBdToKxMuMuBuilder::setOniaMassMin(double m) {
0107   updated = false;
0108   oniaSel->setMassMin(m);
0109   return;
0110 }
0111 
0112 void BPHBdToKxMuMuBuilder::setOniaMassMax(double m) {
0113   updated = false;
0114   oniaSel->setMassMax(m);
0115   return;
0116 }
0117 
0118 void BPHBdToKxMuMuBuilder::setKxMassMin(double m) {
0119   updated = false;
0120   mkx0Sel->setMassMin(m);
0121   return;
0122 }
0123 
0124 void BPHBdToKxMuMuBuilder::setKxMassMax(double m) {
0125   updated = false;
0126   mkx0Sel->setMassMax(m);
0127   return;
0128 }
0129 
0130 void BPHBdToKxMuMuBuilder::setMassMin(double m) {
0131   updated = false;
0132   massSel->setMassMin(m);
0133   return;
0134 }
0135 
0136 void BPHBdToKxMuMuBuilder::setMassMax(double m) {
0137   updated = false;
0138   massSel->setMassMax(m);
0139   return;
0140 }
0141 
0142 void BPHBdToKxMuMuBuilder::setProbMin(double p) {
0143   updated = false;
0144   delete chi2Sel;
0145   chi2Sel = (p < 0.0 ? nullptr : new BPHChi2Select(p));
0146   return;
0147 }
0148 
0149 void BPHBdToKxMuMuBuilder::setMassFitMin(double m) {
0150   updated = false;
0151   mFitSel->setMassMin(m);
0152   return;
0153 }
0154 
0155 void BPHBdToKxMuMuBuilder::setMassFitMax(double m) {
0156   updated = false;
0157   mFitSel->setMassMax(m);
0158   return;
0159 }
0160 
0161 void BPHBdToKxMuMuBuilder::setConstr(bool flag) {
0162   updated = false;
0163   massConstr = flag;
0164   return;
0165 }
0166 
0167 /// get current cuts
0168 double BPHBdToKxMuMuBuilder::getOniaMassMin() const { return oniaSel->getMassMin(); }
0169 
0170 double BPHBdToKxMuMuBuilder::getOniaMassMax() const { return oniaSel->getMassMax(); }
0171 
0172 double BPHBdToKxMuMuBuilder::getKxMassMin() const { return mkx0Sel->getMassMin(); }
0173 
0174 double BPHBdToKxMuMuBuilder::getKxMassMax() const { return mkx0Sel->getMassMax(); }
0175 
0176 double BPHBdToKxMuMuBuilder::getMassMin() const { return massSel->getMassMin(); }
0177 
0178 double BPHBdToKxMuMuBuilder::getMassMax() const { return massSel->getMassMax(); }
0179 
0180 double BPHBdToKxMuMuBuilder::getProbMin() const { return (chi2Sel == nullptr ? -1.0 : chi2Sel->getProbMin()); }
0181 
0182 double BPHBdToKxMuMuBuilder::getMassFitMin() const { return mFitSel->getMassMin(); }
0183 
0184 double BPHBdToKxMuMuBuilder::getMassFitMax() const { return mFitSel->getMassMax(); }
0185 
0186 bool BPHBdToKxMuMuBuilder::getConstr() const { return massConstr; }