CMS 3D CMS Logo

BPHKx0ToKPiBuilder.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Paolo Ronchese INFN Padova
5  *
6  */
7 
8 //-----------------------
9 // This Class' Header --
10 //-----------------------
12 
13 //-------------------------------
14 // Collaborating Class Headers --
15 //-------------------------------
26 
27 //---------------
28 // C++ Headers --
29 //---------------
30 #include <iostream>
31 using namespace std;
32 
33 //-------------------
34 // Initializations --
35 //-------------------
36 
37 //----------------
38 // Constructors --
39 //----------------
41  const BPHRecoBuilder::BPHGenericCollection* posCollection,
42  const BPHRecoBuilder::BPHGenericCollection* negCollection)
43  : kaonName("Kaon"), pionName("Pion"), evSetup(&es), pCollection(posCollection), nCollection(negCollection) {
44  ptSel = new BPHParticlePtSelect(0.7);
45  etaSel = new BPHParticleEtaSelect(10.0);
46  massSel = new BPHMassSelect(0.75, 1.05);
47  chi2Sel = new BPHChi2Select(0.0);
48  updated = false;
49 }
50 
51 //--------------
52 // Destructor --
53 //--------------
55  delete ptSel;
56  delete etaSel;
57  delete massSel;
58  delete chi2Sel;
59 }
60 
61 //--------------
62 // Operations --
63 //--------------
64 vector<BPHPlusMinusConstCandPtr> BPHKx0ToKPiBuilder::build() {
65  if (updated)
66  return kx0List;
67 
68  BPHRecoBuilder bKx0(*evSetup);
71  bKx0.filter(kaonName, *ptSel);
72  bKx0.filter(pionName, *ptSel);
73  bKx0.filter(kaonName, *etaSel);
74  bKx0.filter(pionName, *etaSel);
76  bKx0.filter(mTmpSel);
77 
78  vector<BPHPlusMinusConstCandPtr> tmpList = BPHPlusMinusCandidate::build(bKx0, kaonName, pionName);
79 
80  int ikx;
81  int nkx = tmpList.size();
82  kx0List.clear();
83  kx0List.reserve(nkx);
84  BPHPlusMinusConstCandPtr pxt(nullptr);
85  for (ikx = 0; ikx < nkx; ++ikx) {
86  BPHPlusMinusConstCandPtr& px0 = tmpList[ikx];
88  const BPHPlusMinusCandidate* kx0 = px0.get();
89  BPHPlusMinusCandidate* kxb = pxb.get();
92  if (fabs(kx0->composite().mass() - BPHParticleMasses::kx0Mass) <
93  fabs(kxb->composite().mass() - BPHParticleMasses::kx0Mass))
94  pxt = px0;
95  else
96  pxt = pxb;
97  if (!massSel->accept(*pxt))
98  continue;
99  if (!chi2Sel->accept(*pxt))
100  continue;
101  kx0List.push_back(pxt);
102  }
103 
104  updated = true;
105  return kx0List;
106 }
107 
110  updated = false;
111  ptSel->setPtMin(pt);
112  return;
113 }
114 
116  updated = false;
117  etaSel->setEtaMax(eta);
118  return;
119 }
120 
122  updated = false;
123  massSel->setMassMin(m);
124  return;
125 }
126 
128  updated = false;
129  massSel->setMassMax(m);
130  return;
131 }
132 
134  updated = false;
135  chi2Sel->setProbMin(p);
136  return;
137 }
138 
139 void BPHKx0ToKPiBuilder::setConstr(double mass, double sigma) {
140  updated = false;
141  cMass = mass;
142  cSigma = sigma;
143  return;
144 }
145 
147 double BPHKx0ToKPiBuilder::getPtMin() const { return ptSel->getPtMin(); }
148 
149 double BPHKx0ToKPiBuilder::getEtaMax() const { return etaSel->getEtaMax(); }
150 
151 double BPHKx0ToKPiBuilder::getMassMin() const { return massSel->getMassMin(); }
152 
153 double BPHKx0ToKPiBuilder::getMassMax() const { return massSel->getMassMax(); }
154 
155 double BPHKx0ToKPiBuilder::getProbMin() const { return chi2Sel->getProbMin(); }
156 
157 double BPHKx0ToKPiBuilder::getConstrMass() const { return cMass; }
158 
159 double BPHKx0ToKPiBuilder::getConstrSigma() const { return cSigma; }
BPHKx0ToKPiBuilder(const edm::EventSetup &es, const BPHRecoBuilder::BPHGenericCollection *posCollection, const BPHRecoBuilder::BPHGenericCollection *negCollection)
static std::vector< BPHPlusMinusConstCandPtr > build(const BPHRecoBuilder &builder, const std::string &nPos, const std::string &nNeg, double mass=-1, double msig=-1)
double getConstrSigma() const
std::vector< BPHPlusMinusConstCandPtr > kx0List
void setMassMax(double m)
Definition: BPHMassCuts.h:48
static const double kaonMass
const BPHRecoBuilder::BPHGenericCollection * pCollection
bool accept(const BPHDecayMomentum &cand) const override
select particle
Definition: BPHMassSelect.h:44
void setMassMin(double m)
void setProbMin(double p)
void setPtMin(double pt)
set cuts
void setPtMin(double pt)
set pt min
BPHParticleEtaSelect * etaSel
bool accept(const BPHDecayVertex &cand) const override
select vertex
Definition: BPHChi2Select.h:44
const pat::CompositeCandidate & composite() const override
get a composite by the simple sum of simple particles
void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0) override
double getPtMin() const
get current cuts
BPHGenericPtr< const BPHPlusMinusCandidate >::type BPHPlusMinusConstCandPtr
double getPtMin() const
get current pt min
void setProbMin(double p)
set prob min
Definition: BPHChi2Select.h:54
static const double kx0Mass
static const double pionMSigma
double getEtaMax() const
void setEtaMax(double eta)
BPHGenericPtr< BPHPlusMinusCandidate >::type BPHPlusMinusCandidatePtr
double getMassMax() const
const edm::EventSetup * evSetup
void setEtaMax(double eta)
set eta max
double getProbMin() const
get current prob min
Definition: BPHChi2Select.h:60
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
double getProbMin() const
static const double pionMass
void setMassMin(double m)
set mass cuts
Definition: BPHMassCuts.h:44
void add(const std::string &name, const BPHGenericCollection *collection, double mass=-1.0, double msig=-1.0)
double getMassMax() const
Definition: BPHMassCuts.h:55
double getMassMin() const
get current mass cuts
Definition: BPHMassCuts.h:54
const BPHRecoBuilder::BPHGenericCollection * nCollection
static const double kaonMSigma
void filter(const std::string &name, const BPHRecoSelect &sel) const
BPHMassSelect * massSel
double getMassMin() const
double getEtaMax() const
get current eta max
void setMassMax(double m)
virtual const reco::Candidate * getDaug(const std::string &name) const
BPHChi2Select * chi2Sel
BPHParticlePtSelect * ptSel
void setConstr(double mass, double sigma)
double mass() const final
mass
double getConstrMass() const
std::vector< BPHPlusMinusConstCandPtr > build()
build Phi candidates