CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
BPHDecayToTkpTknSymChargeBuilder Class Reference

#include <BPHDecayToTkpTknSymChargeBuilder.h>

Inheritance diagram for BPHDecayToTkpTknSymChargeBuilder:
BPHDecayGenericBuilder BPHKx0ToKPiBuilder

Classes

class  Particle
 

Public Member Functions

 BPHDecayToTkpTknSymChargeBuilder (const edm::EventSetup &es, const std::string &daug1Name, double daug1Mass, double daug1Sigma, const std::string &daug2Name, double daug2Mass, double daug2Sigma, const BPHRecoBuilder::BPHGenericCollection *posCollection, const BPHRecoBuilder::BPHGenericCollection *negCollection, double expectedMass)
 
 BPHDecayToTkpTknSymChargeBuilder (const BPHDecayToTkpTknSymChargeBuilder &x)=delete
 
std::vector
< BPHPlusMinusConstCandPtr
build ()
 build candidates More...
 
double getDzMax () const
 
double getTrk1EtaMax () const
 
double getTrk1PtMin () const
 get current cuts More...
 
double getTrk2EtaMax () const
 
double getTrk2PtMin () const
 
BPHDecayToTkpTknSymChargeBuilderoperator= (const BPHDecayToTkpTknSymChargeBuilder &x)=delete
 
void setDzMax (double dz)
 
void setTrk1EtaMax (double eta)
 
void setTrk1PtMin (double pt)
 set cuts More...
 
void setTrk2EtaMax (double eta)
 
void setTrk2PtMin (double pt)
 
 ~BPHDecayToTkpTknSymChargeBuilder () override
 
- Public Member Functions inherited from BPHDecayGenericBuilder
 BPHDecayGenericBuilder (const edm::EventSetup &es, BPHMassFitSelect *mfs=nullptr)
 
 BPHDecayGenericBuilder (const BPHDecayGenericBuilder &x)=delete
 
double getMassFitMax () const
 
double getMassFitMin () const
 
double getMassMax () const
 
double getMassMin () const
 get current cuts More...
 
double getMinPDiff ()
 
double getProbMin () const
 
BPHDecayGenericBuilderoperator= (const BPHDecayGenericBuilder &x)=delete
 
void setMassFitMax (double m)
 
void setMassFitMin (double m)
 
void setMassFitRange (double mMin, double mMax)
 
void setMassMax (double m)
 
void setMassMin (double m)
 set cuts More...
 
void setMassRange (double mMin, double mMax)
 
void setMinPDiff (double mpd)
 track min p difference More...
 
void setProbMin (double p)
 
virtual ~BPHDecayGenericBuilder ()
 

Private Member Functions

void addParticle (const BPHRecoBuilder::BPHGenericCollection *collection, int charge, std::vector< Particle * > &list)
 

Private Attributes

double d1Mass
 
std::string d1Name
 
double d1Sigma
 
double d2Mass
 
std::string d2Name
 
double d2Sigma
 
double dzMax
 
double eMass
 
double eta1Max
 
double eta2Max
 
const
BPHRecoBuilder::BPHGenericCollection
nCollection
 
const
BPHRecoBuilder::BPHGenericCollection
pCollection
 
double pt1Min
 
double pt2Min
 
std::vector
< BPHPlusMinusConstCandPtr
recList
 

Additional Inherited Members

- Protected Attributes inherited from BPHDecayGenericBuilder
BPHChi2Selectchi2Sel
 
const edm::EventSetupevSetup
 
BPHMassSelectmassSel
 
BPHMassFitSelectmFitSel
 
double minPDiff
 
bool updated
 

Detailed Description

Description: Class to build a decay to an oppositely charged particle pair with different masses, choosing the best mass assignment on the reconstructed mass basis

Author
Paolo Ronchese INFN Padova

Definition at line 43 of file BPHDecayToTkpTknSymChargeBuilder.h.

Constructor & Destructor Documentation

BPHDecayToTkpTknSymChargeBuilder::BPHDecayToTkpTknSymChargeBuilder ( const edm::EventSetup es,
const std::string &  daug1Name,
double  daug1Mass,
double  daug1Sigma,
const std::string &  daug2Name,
double  daug2Mass,
double  daug2Sigma,
const BPHRecoBuilder::BPHGenericCollection posCollection,
const BPHRecoBuilder::BPHGenericCollection negCollection,
double  expectedMass 
)

Constructor

Definition at line 40 of file BPHDecayToTkpTknSymChargeBuilder.cc.

52  d1Name(daug1Name),
53  d1Mass(daug1Mass),
54  d1Sigma(daug1Sigma),
55  d2Name(daug2Name),
56  d2Mass(daug2Mass),
57  d2Sigma(daug2Sigma),
58  eMass(expectedMass),
59  pCollection(posCollection),
60  nCollection(negCollection),
61  pt1Min(-1.0),
62  pt2Min(-1.0),
63  eta1Max(10.0),
64  eta2Max(10.0),
65  dzMax(1.0) {}
BPHDecayGenericBuilder(const edm::EventSetup &es, BPHMassFitSelect *mfs=nullptr)
const BPHRecoBuilder::BPHGenericCollection * nCollection
const BPHRecoBuilder::BPHGenericCollection * pCollection
BPHDecayToTkpTknSymChargeBuilder::BPHDecayToTkpTknSymChargeBuilder ( const BPHDecayToTkpTknSymChargeBuilder x)
delete
BPHDecayToTkpTknSymChargeBuilder::~BPHDecayToTkpTknSymChargeBuilder ( )
override

Destructor

Definition at line 70 of file BPHDecayToTkpTknSymChargeBuilder.cc.

70 {}

Member Function Documentation

void BPHDecayToTkpTknSymChargeBuilder::addParticle ( const BPHRecoBuilder::BPHGenericCollection collection,
int  charge,
std::vector< Particle * > &  list 
)
private

Definition at line 206 of file BPHDecayToTkpTknSymChargeBuilder.cc.

References reco::Candidate::charge(), d1Mass, d2Mass, eta1Max, eta2Max, BPHRecoBuilder::BPHGenericCollection::get(), BPHTrackReference::getTrack(), mps_fire::i, dqmiodumpmetadata::n, fireworks::p2, reco::Candidate::p4(), pt1Min, pt2Min, submitPVResolutionJobs::q, BPHRecoBuilder::BPHGenericCollection::size(), and mathSSE::sqrt().

Referenced by build().

208  {
209  int i;
210  int n = collection->size();
211  list.reserve(n);
212  for (i = 0; i < n; ++i) {
213  const reco::Candidate& cand = collection->get(i);
214  int q = cand.charge();
215  if ((charge > 0) && (q <= 0))
216  continue;
217  if ((charge < 0) && (q >= 0))
218  continue;
219  const reco::Candidate::LorentzVector p4 = cand.p4();
220  const reco::Track* tk = BPHTrackReference::getTrack(cand, "cfhp");
221  if (tk == nullptr)
222  continue;
223  double px = p4.px();
224  double py = p4.py();
225  double pz = p4.pz();
226  double p2 = (px * px) + (py * py) + (pz * pz);
227  double e1 = ((p4.pt() >= pt1Min) && (p4.eta() <= eta1Max) ? sqrt(p2 + (d1Mass * d1Mass)) : -1.0);
228  double e2 = ((p4.pt() >= pt2Min) && (p4.eta() <= eta2Max) ? sqrt(p2 + (d2Mass * d2Mass)) : -1.0);
229  if ((e1 > 0.0) || (e2 > 0.0))
230  list.push_back(new Particle(&cand, tk, px, py, pz, e1, e2));
231  }
232  return;
233 }
const TString p2
Definition: fwPaths.cc:13
T sqrt(T t)
Definition: SSEVec.h:19
static const reco::Track * getTrack(const reco::Candidate &rc, const char *modeList="cfhbpmnigset", char *modeFlag=nullptr)
virtual const reco::Candidate & get(int i) const =0
virtual int charge() const =0
electric charge
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector
vector< BPHPlusMinusConstCandPtr > BPHDecayToTkpTknSymChargeBuilder::build ( )

build candidates

Operations

Definition at line 75 of file BPHDecayToTkpTknSymChargeBuilder.cc.

References BPHChi2Select::accept(), addParticle(), BPHDecayToTkpTknSymChargeBuilder::Particle::cand, BPHDecayGenericBuilder::chi2Sel, BPHGenericPtr< T >::create(), d1Mass, d1Name, d1Sigma, d2Mass, d2Name, d2Sigma, reco::TrackBase::dz(), dzMax, BPHDecayToTkpTknSymChargeBuilder::Particle::e1, BPHDecayToTkpTknSymChargeBuilder::Particle::e2, eMass, BPHDecayGenericBuilder::evSetup, BPHDecayGenericBuilder::getMassMax(), BPHDecayGenericBuilder::getMassMin(), ResonanceBuilder::mass, nCollection, nt, fireworks::p1, fireworks::p2, pCollection, DiDispStaMuonMonitor_cfi::pt, BPHDecayToTkpTknSymChargeBuilder::Particle::px, BPHDecayToTkpTknSymChargeBuilder::Particle::py, BPHDecayToTkpTknSymChargeBuilder::Particle::pz, recList, findQualityFiles::rr, BPHDecayToTkpTknSymChargeBuilder::Particle::track, and BPHDecayGenericBuilder::updated.

Referenced by BPHDecayToV0DiffMassBuilder::buildFromBPHGenericCollection(), and BPHWriteSpecificDecay::fill().

75  {
76  if (updated)
77  return recList;
78 
79  recList.clear();
80 
81  // extract basic informations from input collections
82 
83  vector<Particle*> pList;
84  vector<Particle*> nList;
85 
86  addParticle(pCollection, +1, pList);
87  addParticle(nCollection, -1, nList);
88  int iPos;
89  int iNeg;
90  int nPos = pList.size();
91  int nNeg = nList.size();
92  double massMin = getMassMin();
93  double massMax = getMassMax();
94  double mSqMin = massMin * massMin * 0.9;
95  double mSqMax = massMax * massMax * 1.1;
96  if (mSqMin < 0.0)
97  mSqMin = 0.0;
98 
99  for (iPos = 0; iPos < nPos; ++iPos) {
100  Particle* pc = pList[iPos];
101  const reco::Track* pt = pc->track;
102  double px = pc->px;
103  double py = pc->py;
104  double pz = pc->pz;
105  double p1 = pc->e1;
106  double p2 = pc->e2;
107  for (iNeg = 0; iNeg < nNeg; ++iNeg) {
108  Particle* nc = nList[iNeg];
109  const reco::Track* nt = nc->track;
110  if (fabs(nt->dz() - pt->dz()) > dzMax)
111  continue;
112  double nx = nc->px;
113  double ny = nc->py;
114  double nz = nc->pz;
115  double n1 = nc->e1;
116  double n2 = nc->e2;
117  const float tx = px + nx;
118  const float ty = py + ny;
119  const float tz = pz + nz;
120  const float ta = ((p1 > 0.0) && (n2 > 0.0) ? p1 + n2 : -1.0);
121  const float tb = ((p2 > 0.0) && (n1 > 0.0) ? p2 + n1 : -1.0);
122  float ma = (ta > 0 ? (ta * ta) - ((tx * tx) + (ty * ty) + (tz * tz)) : -1.0);
123  float mb = (tb > 0 ? (tb * tb) - ((tx * tx) + (ty * ty) + (tz * tz)) : -1.0);
124  // if ( ma > 0.0 ) ma = sqrt( ma );
125  // else ma = -1.0;
126  // if ( mb > 0.0 ) mb = sqrt( mb );
127  // else mb = -1.0;
128  if (((ma < mSqMin) || (ma > mSqMax)) && ((mb < mSqMin) || (mb > mSqMax)))
129  continue;
130  BPHPlusMinusCandidatePtr rc(nullptr);
131  float rcMass = -1.0;
132  if (ma > 0.0) {
134  rc->add(d1Name, pc->cand, d1Mass, d1Sigma);
135  rc->add(d2Name, nc->cand, d2Mass, d2Sigma);
136  rcMass = rc->composite().mass();
137  }
138  BPHPlusMinusCandidatePtr rb(nullptr);
139  float rbMass = -1.0;
140  if (mb > 0.0) {
142  rb->add(d1Name, nc->cand, d1Mass, d1Sigma);
143  rb->add(d2Name, pc->cand, d2Mass, d2Sigma);
144  rbMass = rb->composite().mass();
145  }
146  BPHPlusMinusCandidatePtr* rp(nullptr);
147  double mass = -1.0;
148  if ((rc.get() != nullptr) && ((rb.get() == nullptr) || (fabs(rcMass - eMass) < fabs(rbMass - eMass)))) {
149  mass = rcMass;
150  rp = &rc;
151  } else {
152  mass = rbMass;
153  rp = &rb;
154  }
155  BPHPlusMinusCandidate* rr = rp->get();
156  if (mass < massMin)
157  continue;
158  if (mass > massMax)
159  continue;
160  if (!chi2Sel->accept(*rr))
161  continue;
162  recList.push_back(*rp);
163  }
164  }
165 
166  for (iPos = 0; iPos < nPos; ++iPos)
167  delete pList[iPos];
168  for (iNeg = 0; iNeg < nNeg; ++iNeg)
169  delete nList[iNeg];
170 
171  updated = true;
172  return recList;
173 }
void addParticle(const BPHRecoBuilder::BPHGenericCollection *collection, int charge, std::vector< Particle * > &list)
const TString p2
Definition: fwPaths.cc:13
bool accept(const BPHDecayVertex &cand) const override
select vertex
Definition: BPHChi2Select.h:48
const BPHRecoBuilder::BPHGenericCollection * nCollection
std::vector< BPHPlusMinusConstCandPtr > recList
BPHGenericPtr< BPHPlusMinusCandidate >::type BPHPlusMinusCandidatePtr
const TString p1
Definition: fwPaths.cc:12
const BPHRecoBuilder::BPHGenericCollection * pCollection
double getMassMin() const
get current cuts
int nt
Definition: AMPTWrapper.h:42
double dz() const
dz parameter (= dsz/cos(lambda)). This is the track z0 w.r.t (0,0,0) only if the refPoint is close to...
Definition: TrackBase.h:622
static type create(Args &&...args)
Definition: BPHGenericPtr.h:10
const edm::EventSetup * evSetup
double BPHDecayToTkpTknSymChargeBuilder::getDzMax ( ) const
inline

Definition at line 83 of file BPHDecayToTkpTknSymChargeBuilder.h.

References dzMax.

double BPHDecayToTkpTknSymChargeBuilder::getTrk1EtaMax ( ) const
inline
double BPHDecayToTkpTknSymChargeBuilder::getTrk1PtMin ( ) const
inline

get current cuts

Definition at line 79 of file BPHDecayToTkpTknSymChargeBuilder.h.

References pt1Min.

Referenced by BPHKx0ToKPiBuilder::getPiPtMin().

double BPHDecayToTkpTknSymChargeBuilder::getTrk2EtaMax ( ) const
inline
double BPHDecayToTkpTknSymChargeBuilder::getTrk2PtMin ( ) const
inline
BPHDecayToTkpTknSymChargeBuilder& BPHDecayToTkpTknSymChargeBuilder::operator= ( const BPHDecayToTkpTknSymChargeBuilder x)
delete
void BPHDecayToTkpTknSymChargeBuilder::setDzMax ( double  dz)
void BPHDecayToTkpTknSymChargeBuilder::setTrk1EtaMax ( double  eta)
void BPHDecayToTkpTknSymChargeBuilder::setTrk1PtMin ( double  pt)
void BPHDecayToTkpTknSymChargeBuilder::setTrk2EtaMax ( double  eta)
void BPHDecayToTkpTknSymChargeBuilder::setTrk2PtMin ( double  pt)

Member Data Documentation

double BPHDecayToTkpTknSymChargeBuilder::d1Mass
private

Definition at line 87 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by addParticle(), and build().

std::string BPHDecayToTkpTknSymChargeBuilder::d1Name
private

Definition at line 86 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by build().

double BPHDecayToTkpTknSymChargeBuilder::d1Sigma
private

Definition at line 88 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by build().

double BPHDecayToTkpTknSymChargeBuilder::d2Mass
private

Definition at line 90 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by addParticle(), and build().

std::string BPHDecayToTkpTknSymChargeBuilder::d2Name
private

Definition at line 89 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by build().

double BPHDecayToTkpTknSymChargeBuilder::d2Sigma
private

Definition at line 91 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by build().

double BPHDecayToTkpTknSymChargeBuilder::dzMax
private

Definition at line 101 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by build(), getDzMax(), and setDzMax().

double BPHDecayToTkpTknSymChargeBuilder::eMass
private

Definition at line 92 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by build().

double BPHDecayToTkpTknSymChargeBuilder::eta1Max
private

Definition at line 99 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by addParticle(), getTrk1EtaMax(), and setTrk1EtaMax().

double BPHDecayToTkpTknSymChargeBuilder::eta2Max
private

Definition at line 100 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by addParticle(), getTrk2EtaMax(), and setTrk2EtaMax().

const BPHRecoBuilder::BPHGenericCollection* BPHDecayToTkpTknSymChargeBuilder::nCollection
private

Definition at line 95 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by build().

const BPHRecoBuilder::BPHGenericCollection* BPHDecayToTkpTknSymChargeBuilder::pCollection
private

Definition at line 94 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by build().

double BPHDecayToTkpTknSymChargeBuilder::pt1Min
private

Definition at line 97 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by addParticle(), getTrk1PtMin(), and setTrk1PtMin().

double BPHDecayToTkpTknSymChargeBuilder::pt2Min
private

Definition at line 98 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by addParticle(), getTrk2PtMin(), and setTrk2PtMin().

std::vector<BPHPlusMinusConstCandPtr> BPHDecayToTkpTknSymChargeBuilder::recList
private

Definition at line 103 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by build().