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 //----------------
39 // Constructors --
40 //----------------
42  const edm::EventSetup& es,
43  const BPHRecoBuilder::BPHGenericCollection* posCollection,
44  const BPHRecoBuilder::BPHGenericCollection* negCollection ):
45  kaonName( "Kaon" ),
46  pionName( "Pion" ),
47  evSetup( &es ),
48  pCollection( posCollection ),
49  nCollection( negCollection ) {
50  ptSel = new BPHParticlePtSelect ( 0.7 );
51  etaSel = new BPHParticleEtaSelect( 10.0 );
52  massSel = new BPHMassSelect( 0.75, 1.05 );
53  chi2Sel = new BPHChi2Select( 0.0 );
54  updated = false;
55 }
56 
57 //--------------
58 // Destructor --
59 //--------------
61  delete ptSel;
62  delete etaSel;
63  delete massSel;
64  delete chi2Sel;
65 }
66 
67 //--------------
68 // Operations --
69 //--------------
70 vector<BPHPlusMinusConstCandPtr> BPHKx0ToKPiBuilder::build() {
71 
72  if ( updated ) return kx0List;
73 
74  BPHRecoBuilder bKx0( *evSetup );
79  bKx0.filter( kaonName, *ptSel );
80  bKx0.filter( pionName, *ptSel );
81  bKx0.filter( kaonName, *etaSel );
82  bKx0.filter( pionName, *etaSel );
84  bKx0.filter( mTmpSel );
85 
86  vector<BPHPlusMinusConstCandPtr>
88 
89  int ikx;
90  int nkx = tmpList.size();
91  kx0List.clear();
92  kx0List.reserve( nkx );
93  BPHPlusMinusConstCandPtr pxt( 0 );
94  for ( ikx = 0; ikx < nkx; ++ikx ) {
95  BPHPlusMinusConstCandPtr& px0 = tmpList[ikx];
97  const
98  BPHPlusMinusCandidate* kx0 = px0.get();
99  BPHPlusMinusCandidate* kxb = pxb.get();
100  kxb->add( pionName, kx0->originalReco( kx0->getDaug( kaonName ) ),
102  kxb->add( kaonName, kx0->originalReco( kx0->getDaug( pionName ) ),
104  if ( fabs( kx0->composite().mass() - BPHParticleMasses::kx0Mass ) <
105  fabs( kxb->composite().mass() - BPHParticleMasses::kx0Mass ) )
106  pxt = px0;
107  else pxt = pxb;
108  if ( !massSel->accept( *pxt ) ) continue;
109  if ( !chi2Sel->accept( *pxt ) ) continue;
110  kx0List.push_back( pxt );
111  }
112 
113  updated = true;
114  return kx0List;
115 
116 }
117 
120  updated = false;
121  ptSel->setPtMin( pt );
122  return;
123 }
124 
125 
127  updated = false;
128  etaSel->setEtaMax( eta );
129  return;
130 }
131 
132 
134  updated = false;
135  massSel->setMassMin( m );
136  return;
137 }
138 
139 
141  updated = false;
142  massSel->setMassMax( m );
143  return;
144 }
145 
146 
148  updated = false;
149  chi2Sel->setProbMin( p );
150  return;
151 }
152 
153 
154 void BPHKx0ToKPiBuilder::setConstr( double mass, double sigma ) {
155  updated = false;
156  cMass = mass;
157  cSigma = sigma;
158  return;
159 }
160 
163  return ptSel->getPtMin();
164 }
165 
166 
168  return etaSel->getEtaMax();
169 }
170 
171 
173  return massSel->getMassMin();
174 }
175 
176 
178  return massSel->getMassMax();
179 }
180 
181 
183  return chi2Sel->getProbMin();
184 }
185 
186 
188  return cMass;
189 }
190 
191 
193  return cSigma;
194 }
195 
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:51
static const double kaonMass
virtual double mass() const final
mass
const BPHRecoBuilder::BPHGenericCollection * pCollection
virtual const pat::CompositeCandidate & composite() const
get a composite by the simple sum of simple particles
BPHGenericPtr< BPHPlusMinusCandidate >::type BPHPlusMinusCandidatePtr
void setMassMin(double m)
void setProbMin(double p)
void setPtMin(double pt)
set cuts
virtual bool accept(const BPHDecayMomentum &cand) const
select particle
Definition: BPHMassSelect.h:48
void setPtMin(double pt)
set pt min
BPHParticleEtaSelect * etaSel
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:55
static const double kx0Mass
static const double pionMSigma
double getEtaMax() const
void setEtaMax(double eta)
double getMassMax() const
const edm::EventSetup * evSetup
virtual void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
virtual bool accept(const BPHDecayVertex &cand) const
select vertex
Definition: BPHChi2Select.h:47
void setEtaMax(double eta)
set eta max
double getProbMin() const
get current prob min
Definition: BPHChi2Select.h:58
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:50
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 getConstrMass() const
std::vector< BPHPlusMinusConstCandPtr > build()
build Phi candidates