CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
BPHDecayToTkpTknSymChargeBuilder Class Reference

#include <BPHDecayToTkpTknSymChargeBuilder.h>

Inheritance diagram for BPHDecayToTkpTknSymChargeBuilder:
BPHDecayGenericBuilderBase BPHDecayGenericBuilder< BPHPlusMinusCandidate > BPHDecayGenericBuilderBase BPHDecayToV0DiffMassBuilder BPHKx0ToKPiBuilder BPHLambda0ToPPiBuilder

Classes

class  Particle
 

Public Member Functions

 BPHDecayToTkpTknSymChargeBuilder (const BPHEventSetupWrapper &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
 
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=default
 
- Public Member Functions inherited from BPHDecayGenericBuilderBase
 BPHDecayGenericBuilderBase ()
 
 BPHDecayGenericBuilderBase (const BPHEventSetupWrapper &es, BPHMassFitSelect *mfs=new BPHMassFitSelect(-2.0e+06, -1.0e+06))
 
 BPHDecayGenericBuilderBase (const BPHDecayGenericBuilderBase &x)=delete
 
double getMassFitMax () const
 
double getMassFitMin () const
 
double getMassMax () const
 
double getMassMin () const
 get current cuts More...
 
double getMinPDiff ()
 
double getProbMin () const
 
BPHDecayGenericBuilderBaseoperator= (const BPHDecayGenericBuilderBase &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 ~BPHDecayGenericBuilderBase ()
 
- Public Member Functions inherited from BPHDecayGenericBuilder< BPHPlusMinusCandidate >
 BPHDecayGenericBuilder (const BPHEventSetupWrapper &es, BPHMassFitSelect *mfs)
 
 BPHDecayGenericBuilder (const BPHDecayGenericBuilder &x)=delete
 
virtual std::vector< prod_ptrbuild ()
 build candidates More...
 
BPHDecayGenericBuilderoperator= (const BPHDecayGenericBuilder &x)=delete
 
 ~BPHDecayGenericBuilder () override=default
 

Private Member Functions

void addParticle (const BPHRecoBuilder::BPHGenericCollection *collection, int charge, std::vector< Particle *> &list)
 
void fillRecList () override
 build candidates More...
 

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::BPHGenericCollectionnCollection
 
const BPHRecoBuilder::BPHGenericCollectionpCollection
 
double pt1Min
 
double pt2Min
 

Additional Inherited Members

- Public Types inherited from BPHDecayGenericBuilder< BPHPlusMinusCandidate >
typedef BPHPlusMinusCandidate ::const_pointer prod_ptr
 
- Protected Member Functions inherited from BPHDecayGenericBuilder< BPHPlusMinusCandidate >
 BPHDecayGenericBuilder ()
 
- Protected Attributes inherited from BPHDecayGenericBuilderBase
BPHChi2Selectchi2Sel
 
const BPHEventSetupWrapperevSetup
 
BPHMassSelectmassSel
 
BPHMassFitSelectmFitSel
 
double minPDiff
 
bool outdated
 
- Protected Attributes inherited from BPHDecayGenericBuilder< BPHPlusMinusCandidate >
std::vector< prod_ptrrecList
 

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() [1/2]

BPHDecayToTkpTknSymChargeBuilder::BPHDecayToTkpTknSymChargeBuilder ( const BPHEventSetupWrapper 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

◆ BPHDecayToTkpTknSymChargeBuilder() [2/2]

BPHDecayToTkpTknSymChargeBuilder::BPHDecayToTkpTknSymChargeBuilder ( const BPHDecayToTkpTknSymChargeBuilder x)
delete

◆ ~BPHDecayToTkpTknSymChargeBuilder()

BPHDecayToTkpTknSymChargeBuilder::~BPHDecayToTkpTknSymChargeBuilder ( )
overridedefault

Destructor

Member Function Documentation

◆ addParticle()

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

Definition at line 191 of file BPHDecayToTkpTknSymChargeBuilder.cc.

References ALCARECOTkAlJpsiMuMu_cff::charge, universalConfigTemplate::collection, d1Mass, d2Mass, StorageManager_cfg::e1, eta1Max, eta2Max, BPHTrackReference::getTrack(), mps_fire::i, create_idmaps::n, SiStripOfflineCRack_cfg::p2, pt1Min, pt2Min, multPhiCorr_741_25nsDY_cfi::px, multPhiCorr_741_25nsDY_cfi::py, submitPVResolutionJobs::q, and mathSSE::sqrt().

Referenced by fillRecList().

193  {
194  int i;
195  int n = collection->size();
196  list.reserve(n);
197  for (i = 0; i < n; ++i) {
198  const reco::Candidate& cand = collection->get(i);
199  int q = cand.charge();
200  if ((charge > 0) && (q <= 0))
201  continue;
202  if ((charge < 0) && (q >= 0))
203  continue;
204  const reco::Candidate::LorentzVector p4 = cand.p4();
205  const reco::Track* tk = BPHTrackReference::getTrack(cand, "cfhp");
206  if (tk == nullptr)
207  continue;
208  double px = p4.px();
209  double py = p4.py();
210  double pz = p4.pz();
211  double p2 = (px * px) + (py * py) + (pz * pz);
212  double e1 = ((p4.pt() >= pt1Min) && (p4.eta() <= eta1Max) ? sqrt(p2 + (d1Mass * d1Mass)) : -1.0);
213  double e2 = ((p4.pt() >= pt2Min) && (p4.eta() <= eta2Max) ? sqrt(p2 + (d2Mass * d2Mass)) : -1.0);
214  if ((e1 > 0.0) || (e2 > 0.0))
215  list.push_back(new Particle(&cand, tk, px, py, pz, e1, e2));
216  }
217  return;
218 }
T sqrt(T t)
Definition: SSEVec.h:23
static const reco::Track * getTrack(const reco::Candidate &rc, const char *modeList="cfhbpmnigset", char *modeFlag=nullptr)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Definition: Candidate.h:36

◆ fillRecList()

void BPHDecayToTkpTknSymChargeBuilder::fillRecList ( )
overrideprivatevirtual

build candidates

Implements BPHDecayGenericBuilderBase.

Reimplemented in BPHDecayToV0DiffMassBuilder.

Definition at line 70 of file BPHDecayToTkpTknSymChargeBuilder.cc.

References BPHChi2Select::accept(), addParticle(), BPHDecayToTkpTknSymChargeBuilder::Particle::cand, BPHDecayGenericBuilderBase::chi2Sel, BPHGenericPtr< T >::create(), d1Mass, d1Name, d1Sigma, d2Mass, d2Name, d2Sigma, dzMax, BPHDecayToTkpTknSymChargeBuilder::Particle::e1, BPHDecayToTkpTknSymChargeBuilder::Particle::e2, eMass, BPHDecayGenericBuilderBase::evSetup, BPHDecayGenericBuilderBase::getMassMax(), BPHDecayGenericBuilderBase::getMassMin(), EgHLTOffHistBins_cfi::mass, vertexSelectForHeavyFlavorDQM_cfi::massMax, vertexSelectForHeavyFlavorDQM_cfi::massMin, nCollection, nt, LaserDQM_cfg::p1, SiStripOfflineCRack_cfg::p2, pCollection, DiDispStaMuonMonitor_cfi::pt, multPhiCorr_741_25nsDY_cfi::px, BPHDecayToTkpTknSymChargeBuilder::Particle::px, multPhiCorr_741_25nsDY_cfi::py, BPHDecayToTkpTknSymChargeBuilder::Particle::py, BPHDecayToTkpTknSymChargeBuilder::Particle::pz, BPHDecayGenericBuilder< BPHPlusMinusCandidate >::recList, findQualityFiles::rr, and BPHDecayToTkpTknSymChargeBuilder::Particle::track.

70  {
71  // extract basic informations from input collections
72 
73  vector<Particle*> pList;
74  vector<Particle*> nList;
75 
76  addParticle(pCollection, +1, pList);
77  addParticle(nCollection, -1, nList);
78  int iPos;
79  int iNeg;
80  int nPos = pList.size();
81  int nNeg = nList.size();
82  double massMin = getMassMin();
83  double massMax = getMassMax();
84  double mSqMin = massMin * massMin * 0.9;
85  double mSqMax = massMax * massMax * 1.1;
86  if (mSqMin < 0.0)
87  mSqMin = 0.0;
88 
89  for (iPos = 0; iPos < nPos; ++iPos) {
90  Particle* pc = pList[iPos];
91  const reco::Track* pt = pc->track;
92  double px = pc->px;
93  double py = pc->py;
94  double pz = pc->pz;
95  double p1 = pc->e1;
96  double p2 = pc->e2;
97  for (iNeg = 0; iNeg < nNeg; ++iNeg) {
98  Particle* nc = nList[iNeg];
99  const reco::Track* nt = nc->track;
100  if (fabs(nt->dz() - pt->dz()) > dzMax)
101  continue;
102  double nx = nc->px;
103  double ny = nc->py;
104  double nz = nc->pz;
105  double n1 = nc->e1;
106  double n2 = nc->e2;
107  const float tx = px + nx;
108  const float ty = py + ny;
109  const float tz = pz + nz;
110  const float ta = ((p1 > 0.0) && (n2 > 0.0) ? p1 + n2 : -1.0);
111  const float tb = ((p2 > 0.0) && (n1 > 0.0) ? p2 + n1 : -1.0);
112  float ma = (ta > 0 ? (ta * ta) - ((tx * tx) + (ty * ty) + (tz * tz)) : -1.0);
113  float mb = (tb > 0 ? (tb * tb) - ((tx * tx) + (ty * ty) + (tz * tz)) : -1.0);
114  if (((ma < mSqMin) || (ma > mSqMax)) && ((mb < mSqMin) || (mb > mSqMax)))
115  continue;
116  BPHPlusMinusCandidatePtr rc(nullptr);
117  float rcMass = -1.0;
118  if (ma > 0.0) {
120  rc->add(d1Name, pc->cand, d1Mass, d1Sigma);
121  rc->add(d2Name, nc->cand, d2Mass, d2Sigma);
122  rcMass = rc->composite().mass();
123  }
124  BPHPlusMinusCandidatePtr rb(nullptr);
125  float rbMass = -1.0;
126  if (mb > 0.0) {
128  rb->add(d1Name, nc->cand, d1Mass, d1Sigma);
129  rb->add(d2Name, pc->cand, d2Mass, d2Sigma);
130  rbMass = rb->composite().mass();
131  }
132  BPHPlusMinusCandidatePtr* rp(nullptr);
133  double mass = -1.0;
134  if ((rc.get() != nullptr) && ((rb.get() == nullptr) || (fabs(rcMass - eMass) < fabs(rbMass - eMass)))) {
135  mass = rcMass;
136  rp = &rc;
137  } else {
138  mass = rbMass;
139  rp = &rb;
140  }
141  BPHPlusMinusCandidate* rr = rp->get();
142  if (mass < massMin)
143  continue;
144  if (mass > massMax)
145  continue;
146  if (!chi2Sel->accept(*rr))
147  continue;
148  recList.push_back(*rp);
149  }
150  }
151 
152  for (iPos = 0; iPos < nPos; ++iPos)
153  delete pList[iPos];
154  for (iNeg = 0; iNeg < nNeg; ++iNeg)
155  delete nList[iNeg];
156 
157  return;
158 }
bool accept(const BPHDecayVertex &cand) const override
select vertex
Definition: BPHChi2Select.h:48
const BPHEventSetupWrapper * evSetup
const BPHRecoBuilder::BPHGenericCollection * nCollection
double getMassMin() const
get current cuts
BPHGenericPtr< BPHPlusMinusCandidate >::type BPHPlusMinusCandidatePtr
const BPHRecoBuilder::BPHGenericCollection * pCollection
int nt
Definition: AMPTWrapper.h:42
static type create(Args &&... args)
Definition: BPHGenericPtr.h:10
void addParticle(const BPHRecoBuilder::BPHGenericCollection *collection, int charge, std::vector< Particle *> &list)

◆ getDzMax()

double BPHDecayToTkpTknSymChargeBuilder::getDzMax ( ) const
inline

Definition at line 82 of file BPHDecayToTkpTknSymChargeBuilder.h.

References dzMax.

◆ getTrk1EtaMax()

double BPHDecayToTkpTknSymChargeBuilder::getTrk1EtaMax ( ) const
inline

◆ getTrk1PtMin()

double BPHDecayToTkpTknSymChargeBuilder::getTrk1PtMin ( ) const
inline

get current cuts

Definition at line 78 of file BPHDecayToTkpTknSymChargeBuilder.h.

References pt1Min.

Referenced by BPHKx0ToKPiBuilder::getPiPtMin().

◆ getTrk2EtaMax()

double BPHDecayToTkpTknSymChargeBuilder::getTrk2EtaMax ( ) const
inline

◆ getTrk2PtMin()

double BPHDecayToTkpTknSymChargeBuilder::getTrk2PtMin ( ) const
inline

◆ operator=()

BPHDecayToTkpTknSymChargeBuilder& BPHDecayToTkpTknSymChargeBuilder::operator= ( const BPHDecayToTkpTknSymChargeBuilder x)
delete

◆ setDzMax()

void BPHDecayToTkpTknSymChargeBuilder::setDzMax ( double  dz)

◆ setTrk1EtaMax()

void BPHDecayToTkpTknSymChargeBuilder::setTrk1EtaMax ( double  eta)

◆ setTrk1PtMin()

void BPHDecayToTkpTknSymChargeBuilder::setTrk1PtMin ( double  pt)

◆ setTrk2EtaMax()

void BPHDecayToTkpTknSymChargeBuilder::setTrk2EtaMax ( double  eta)

◆ setTrk2PtMin()

void BPHDecayToTkpTknSymChargeBuilder::setTrk2PtMin ( double  pt)

Member Data Documentation

◆ d1Mass

double BPHDecayToTkpTknSymChargeBuilder::d1Mass
private

Definition at line 86 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by addParticle(), and fillRecList().

◆ d1Name

std::string BPHDecayToTkpTknSymChargeBuilder::d1Name
private

Definition at line 85 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by fillRecList().

◆ d1Sigma

double BPHDecayToTkpTknSymChargeBuilder::d1Sigma
private

Definition at line 87 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by fillRecList().

◆ d2Mass

double BPHDecayToTkpTknSymChargeBuilder::d2Mass
private

Definition at line 89 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by addParticle(), and fillRecList().

◆ d2Name

std::string BPHDecayToTkpTknSymChargeBuilder::d2Name
private

Definition at line 88 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by fillRecList().

◆ d2Sigma

double BPHDecayToTkpTknSymChargeBuilder::d2Sigma
private

Definition at line 90 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by fillRecList().

◆ dzMax

double BPHDecayToTkpTknSymChargeBuilder::dzMax
private

Definition at line 100 of file BPHDecayToTkpTknSymChargeBuilder.h.

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

◆ eMass

double BPHDecayToTkpTknSymChargeBuilder::eMass
private

Definition at line 91 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by fillRecList().

◆ eta1Max

double BPHDecayToTkpTknSymChargeBuilder::eta1Max
private

Definition at line 98 of file BPHDecayToTkpTknSymChargeBuilder.h.

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

◆ eta2Max

double BPHDecayToTkpTknSymChargeBuilder::eta2Max
private

Definition at line 99 of file BPHDecayToTkpTknSymChargeBuilder.h.

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

◆ nCollection

const BPHRecoBuilder::BPHGenericCollection* BPHDecayToTkpTknSymChargeBuilder::nCollection
private

Definition at line 94 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by fillRecList().

◆ pCollection

const BPHRecoBuilder::BPHGenericCollection* BPHDecayToTkpTknSymChargeBuilder::pCollection
private

Definition at line 93 of file BPHDecayToTkpTknSymChargeBuilder.h.

Referenced by fillRecList().

◆ pt1Min

double BPHDecayToTkpTknSymChargeBuilder::pt1Min
private

Definition at line 96 of file BPHDecayToTkpTknSymChargeBuilder.h.

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

◆ pt2Min

double BPHDecayToTkpTknSymChargeBuilder::pt2Min
private

Definition at line 97 of file BPHDecayToTkpTknSymChargeBuilder.h.

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