CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
BPHKinematicFit Class Reference

#include <BPHKinematicFit.h>

Inheritance diagram for BPHKinematicFit:
BPHDecayVertex BPHDecayMomentum BPHRecoCandidate BPHPlusMinusCandidate

Classes

struct  FlyingParticle
 

Public Member Functions

 BPHKinematicFit (const BPHKinematicFit &x)=delete
 
double constrMass () const
 retrieve the constraint More...
 
double constrSigma () const
 
virtual const RefCountedKinematicVertex currentDecayVertex () const
 
virtual const RefCountedKinematicParticle currentParticle () const
 get current particle More...
 
bool getIndependentFit (const std::string &name) const
 retrieve independent fit flag More...
 
double getMassSigma (const reco::Candidate *cand) const
 retrieve particle mass sigma More...
 
virtual bool isEmpty () const
 get fit status More...
 
virtual bool isValidFit () const
 
virtual const RefCountedKinematicTreekinematicTree () const
 perform the kinematic fit and get the result More...
 
virtual const RefCountedKinematicTreekinematicTree (const std::string &name) const
 
virtual const RefCountedKinematicTreekinematicTree (const std::string &name, double mass) const
 
virtual const RefCountedKinematicTreekinematicTree (const std::string &name, double mass, double sigma) const
 
virtual const RefCountedKinematicTreekinematicTree (const std::string &name, KinematicConstraint *kc) const
 
virtual const RefCountedKinematicTreekinematicTree (const std::string &name, MultiTrackKinematicConstraint *kc) const
 
virtual const std::vector< RefCountedKinematicParticle > & kinParticles () const
 get kinematic particles More...
 
virtual std::vector< RefCountedKinematicParticlekinParticles (const std::vector< std::string > &names) const
 
virtual ParticleMass mass () const
 
BPHKinematicFitoperator= (const BPHKinematicFit &x)=delete
 
virtual const math::XYZTLorentzVectorp4 () const
 compute total momentum after the fit More...
 
virtual void resetKinematicFit () const
 reset the kinematic fit More...
 
void setConstraint (double mass, double sigma)
 apply a mass constraint More...
 
void setIndependentFit (const std::string &name, bool flag=true, double mass=-1.0, double sigma=-1.0)
 set a decaying daughter as an unique particle fitted independently More...
 
virtual const RefCountedKinematicVertex topDecayVertex () const
 
virtual const RefCountedKinematicParticle topParticle () const
 get top particle More...
 
 ~BPHKinematicFit () override
 
- Public Member Functions inherited from BPHDecayVertex
 BPHDecayVertex (const BPHDecayVertex &x)=delete
 
const edm::EventSetupgetEventSetup () const
 retrieve EventSetup More...
 
const reco::TrackgetTrack (const reco::Candidate *cand) const
 get Track for a daughter More...
 
const std::string & getTrackSearchList (const reco::Candidate *cand) const
 retrieve track search list More...
 
reco::TransientTrackgetTransientTrack (const reco::Candidate *cand) const
 get TransientTrack for a daughter More...
 
BPHDecayVertexoperator= (const BPHDecayVertex &x)=delete
 
const std::vector< const reco::Track * > & tracks () const
 get list of Tracks More...
 
const std::vector< reco::TransientTrack > & transientTracks () const
 get list of TransientTracks More...
 
virtual bool validTracks () const
 check for valid reconstructed vertex More...
 
virtual bool validVertex () const
 
virtual const reco::Vertexvertex (VertexFitter< 5 > *fitter=nullptr, const reco::BeamSpot *bs=nullptr, const GlobalPoint *priorPos=nullptr, const GlobalError *priorError=nullptr) const
 get reconstructed vertex More...
 
 ~BPHDecayVertex () override
 
- Public Member Functions inherited from BPHDecayMomentum
 BPHDecayMomentum (const BPHDecayMomentum &x)=delete
 
virtual const std::vector< std::string > & compNames () const
 
virtual const pat::CompositeCandidatecomposite () const
 get a composite by the simple sum of simple particles More...
 
virtual const std::vector< BPHRecoConstCandPtr > & daughComp () const
 
virtual const std::vector< const reco::Candidate * > & daughFull () const
 
virtual const std::vector< const reco::Candidate * > & daughters () const
 
virtual const std::vector< std::string > & daugNames () const
 
virtual BPHRecoConstCandPtr getComp (const std::string &name) const
 
virtual const reco::CandidategetDaug (const std::string &name) const
 
BPHDecayMomentumoperator= (const BPHDecayMomentum &x)=delete
 
virtual const reco::CandidateoriginalReco (const reco::Candidate *daug) const
 get the original particle from the clone More...
 
virtual ~BPHDecayMomentum ()
 

Protected Member Functions

virtual void addK (const std::string &name, const BPHRecoConstCandPtr &comp)
 add a previously reconstructed particle giving it a name More...
 
virtual void addK (const std::string &name, const reco::Candidate *daug, const std::string &searchList, double mass=-1.0, double sigma=-1.0)
 
virtual void addK (const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
 
 BPHKinematicFit ()
 
 BPHKinematicFit (const BPHKinematicFit *ptr)
 
void setNotUpdated () const override
 
- Protected Member Functions inherited from BPHDecayVertex
virtual void addV (const std::string &name, const BPHRecoConstCandPtr &comp)
 add a previously reconstructed particle giving it a name More...
 
virtual void addV (const std::string &name, const reco::Candidate *daug, const std::string &searchList, double mass)
 
 BPHDecayVertex (const BPHDecayVertex *ptr, const edm::EventSetup *es)
 
 BPHDecayVertex (const edm::EventSetup *es)
 
- Protected Member Functions inherited from BPHDecayMomentum
virtual void addP (const std::string &name, const BPHRecoConstCandPtr &comp)
 add a previously reconstructed particle giving it a name More...
 
virtual void addP (const std::string &name, const reco::Candidate *daug, double mass=-1.0)
 
 BPHDecayMomentum ()
 
 BPHDecayMomentum (const std::map< std::string, Component > &daugMap)
 
 BPHDecayMomentum (const std::map< std::string, Component > &daugMap, const std::map< std::string, BPHRecoConstCandPtr > compMap)
 
const std::vector< Component > & componentList () const
 
virtual void fill (BPHRecoCandidate *ptr, int level) const =0
 

Private Member Functions

virtual void addParticles (std::vector< RefCountedKinematicParticle > &kl, std::map< const reco::Candidate *, RefCountedKinematicParticle > &km, std::map< const BPHRecoCandidate *, RefCountedKinematicParticle > &cm) const
 
virtual void buildParticles () const
 
virtual void fitMomentum () const
 
virtual void getParticles (const std::string &moth, const std::string &daug, std::vector< RefCountedKinematicParticle > &kl, std::set< RefCountedKinematicParticle > &ks) const
 
virtual void getParticles (const std::string &moth, const std::vector< std::string > &daug, std::vector< RefCountedKinematicParticle > &kl, std::set< RefCountedKinematicParticle > &ks) const
 
virtual const RefCountedKinematicTreekinematicTree (const std::vector< RefCountedKinematicParticle > &kPart, MultiTrackKinematicConstraint *kc) const
 
virtual unsigned int numParticles (const BPHKinematicFit *cand=nullptr) const
 
virtual const BPHKinematicFitsplitKP (const std::string &name, std::vector< RefCountedKinematicParticle > *kComp, std::vector< RefCountedKinematicParticle > *kTail=nullptr) const
 

Static Private Member Functions

static void insertParticle (RefCountedKinematicParticle &kp, std::vector< RefCountedKinematicParticle > &kl, std::set< RefCountedKinematicParticle > &ks)
 

Private Attributes

std::vector< RefCountedKinematicParticleallParticles
 
std::map< const BPHRecoCandidate *, FlyingParticlecKinP
 
std::map< const reco::Candidate *, double > dMSig
 
std::map< const BPHRecoCandidate *, RefCountedKinematicParticlekCDMap
 
std::map< const reco::Candidate *, RefCountedKinematicParticlekinMap
 
RefCountedKinematicTree kinTree
 
double massConst
 
double massSigma
 
bool oldFit
 
bool oldKPs
 
bool oldMom
 
std::vector< BPHRecoConstCandPtrtmpList
 
math::XYZTLorentzVector totalMomentum
 

Detailed Description

Description: Highest-level base class to encapsulate kinematic fit operations

Author
Paolo Ronchese INFN Padova high-level base class to perform a kinematic fit

Definition at line 38 of file BPHKinematicFit.h.

Constructor & Destructor Documentation

◆ BPHKinematicFit() [1/3]

BPHKinematicFit::BPHKinematicFit ( const BPHKinematicFit x)
delete

Constructors are protected this object can exist only as part of a derived class

◆ ~BPHKinematicFit()

BPHKinematicFit::~BPHKinematicFit ( )
override

Destructor

Definition at line 85 of file BPHKinematicFit.cc.

85 {}

◆ BPHKinematicFit() [2/3]

BPHKinematicFit::BPHKinematicFit ( )
protected

Definition at line 39 of file BPHKinematicFit.cc.

40  : BPHDecayVertex(nullptr),
41  massConst(-1.0),
42  massSigma(-1.0),
43  oldKPs(true),
44  oldFit(true),
45  oldMom(true),
46  kinTree(nullptr) {}

◆ BPHKinematicFit() [3/3]

BPHKinematicFit::BPHKinematicFit ( const BPHKinematicFit ptr)
protected

Definition at line 48 of file BPHKinematicFit.cc.

49  : BPHDecayVertex(ptr, nullptr),
50  massConst(-1.0),
51  massSigma(-1.0),
52  oldKPs(true),
53  oldFit(true),
54  oldMom(true),
55  kinTree(nullptr) {
56  map<const reco::Candidate*, const reco::Candidate*> iMap;
57  const vector<const reco::Candidate*>& daug = daughters();
58  const vector<Component>& list = ptr->componentList();
59  int i;
60  int n = daug.size();
61  for (i = 0; i < n; ++i) {
62  const reco::Candidate* cand = daug[i];
63  iMap[originalReco(cand)] = cand;
64  }
65  for (i = 0; i < n; ++i) {
66  const Component& c = list[i];
67  dMSig[iMap[c.cand]] = c.msig;
68  }
69  const vector<BPHRecoConstCandPtr>& dComp = daughComp();
70  int j;
71  int m = dComp.size();
72  for (j = 0; j < m; ++j) {
73  const BPHRecoCandidate* rc = dComp[j].get();
74  const map<const reco::Candidate*, double>& dMap = rc->dMSig;
75  const map<const BPHRecoCandidate*, FlyingParticle>& cMap = rc->cKinP;
76  dMSig.insert(dMap.begin(), dMap.end());
77  cKinP.insert(cMap.begin(), cMap.end());
78  cKinP[rc];
79  }
80 }

References c, cKinP, BPHDecayMomentum::cMap, BPHDecayMomentum::componentList(), BPHDecayMomentum::daughComp(), BPHDecayMomentum::daughters(), BPHDecayMomentum::dMap, dMSig, mps_fire::i, dqmiolumiharvest::j, visualization-live-secondInstance_cfg::m, dqmiodumpmetadata::n, and BPHDecayMomentum::originalReco().

Member Function Documentation

◆ addK() [1/3]

virtual void BPHKinematicFit::addK ( const std::string &  name,
const BPHRecoConstCandPtr comp 
)
protectedvirtual

add a previously reconstructed particle giving it a name

◆ addK() [2/3]

virtual void BPHKinematicFit::addK ( const std::string &  name,
const reco::Candidate daug,
const std::string &  searchList,
double  mass = -1.0,
double  sigma = -1.0 
)
protectedvirtual

add a simple particle and specify a criterion to search for the associated track

◆ addK() [3/3]

virtual void BPHKinematicFit::addK ( const std::string &  name,
const reco::Candidate daug,
double  mass = -1.0,
double  sigma = -1.0 
)
protectedvirtual

add a simple particle giving it a name particles are cloned, eventually specifying a different mass and a sigma

Referenced by BPHRecoCandidate::add().

◆ addParticles()

void BPHKinematicFit::addParticles ( std::vector< RefCountedKinematicParticle > &  kl,
std::map< const reco::Candidate *, RefCountedKinematicParticle > &  km,
std::map< const BPHRecoCandidate *, RefCountedKinematicParticle > &  cm 
) const
privatevirtual

Definition at line 371 of file BPHKinematicFit.cc.

373  {
374  const vector<const reco::Candidate*>& daug = daughters();
376  int n = daug.size();
377  float chi = 0.0;
378  float ndf = 0.0;
379  while (n--) {
380  const reco::Candidate* cand = daug[n];
381  ParticleMass mass = cand->mass();
382  float sigma = dMSig.find(cand)->second;
383  if (sigma < 0)
384  sigma = 1.0e-7;
386  if (tt != nullptr)
387  kl.push_back(km[cand] = pFactory.particle(*tt, mass, chi, ndf, sigma));
388  }
389  const vector<BPHRecoConstCandPtr>& comp = daughComp();
390  int m = comp.size();
391  while (m--) {
392  const BPHRecoCandidate* cptr = comp[m].get();
393  const FlyingParticle& fp = cKinP.at(cptr);
394  if (fp.flag) {
395  BPHRecoCandidate* tptr = cptr->clone();
396  double mass = fp.mass;
397  double sigma = fp.sigma;
398  if ((mass > 0.0) && (sigma > 0.0))
399  tptr->setConstraint(mass, sigma);
400  tmpList.push_back(BPHRecoConstCandPtr(tptr));
401  if (tptr->isEmpty())
402  return;
403  if (!tptr->isValidFit())
404  return;
405  kl.push_back(cm[cptr] = tptr->topParticle());
406  } else {
407  cptr->addParticles(kl, km, cm);
408  }
409  }
410  return;
411 }

References addParticles(), cKinP, BPHRecoCandidate::clone(), AlCaHLTBitMon_QueryRunRegistry::comp, BPHDecayMomentum::daughComp(), BPHDecayMomentum::daughters(), dMSig, personalPlayback::fp, BPHDecayVertex::getTransientTrack(), isEmpty(), isValidFit(), visualization-live-secondInstance_cfg::m, mass(), dqmiodumpmetadata::n, KinematicParticleFactoryFromTransientTrack::particle(), setConstraint(), tmpList, topParticle(), and groupFilesInBlocks::tt.

Referenced by addParticles(), and buildParticles().

◆ buildParticles()

void BPHKinematicFit::buildParticles ( ) const
privatevirtual

Definition at line 361 of file BPHKinematicFit.cc.

361  {
362  kinMap.clear();
363  kCDMap.clear();
364  allParticles.clear();
365  allParticles.reserve(daughFull().size());
367  oldKPs = false;
368  return;
369 }

References addParticles(), allParticles, BPHDecayMomentum::daughFull(), kCDMap, kinMap, oldKPs, and findQualityFiles::size.

Referenced by kinParticles().

◆ constrMass()

double BPHKinematicFit::constrMass ( ) const

retrieve the constraint

Definition at line 99 of file BPHKinematicFit.cc.

99 { return massConst; }

References massConst.

Referenced by BPHRecoCandidate::fill().

◆ constrSigma()

double BPHKinematicFit::constrSigma ( ) const

Definition at line 101 of file BPHKinematicFit.cc.

101 { return massSigma; }

References massSigma.

Referenced by BPHRecoCandidate::fill().

◆ currentDecayVertex()

const RefCountedKinematicVertex BPHKinematicFit::currentDecayVertex ( ) const
virtual

Definition at line 277 of file BPHKinematicFit.cc.

277  {
278  if (isEmpty())
279  return RefCountedKinematicVertex(nullptr);
280  return kinTree->currentDecayVertex();
281 }

References isEmpty(), and kinTree.

◆ currentParticle()

const RefCountedKinematicParticle BPHKinematicFit::currentParticle ( ) const
virtual

get current particle

Definition at line 271 of file BPHKinematicFit.cc.

271  {
272  if (isEmpty())
273  return RefCountedKinematicParticle(nullptr);
274  return kinTree->currentParticle();
275 }

References isEmpty(), and kinTree.

◆ fitMomentum()

void BPHKinematicFit::fitMomentum ( ) const
privatevirtual

Definition at line 538 of file BPHKinematicFit.cc.

538  {
539  if (isValidFit()) {
540  const KinematicState& ks = topParticle()->currentState();
541  GlobalVector tm = ks.globalMomentum();
542  double x = tm.x();
543  double y = tm.y();
544  double z = tm.z();
545  double m = ks.mass();
546  double e = sqrt((x * x) + (y * y) + (z * z) + (m * m));
547  totalMomentum.SetPxPyPzE(x, y, z, e);
548  } else {
549  edm::LogPrint("FitNotFound") << "BPHKinematicFit::fitMomentum: "
550  << "simple momentum sum computed";
552  const vector<const reco::Candidate*>& daug = daughters();
553  int n = daug.size();
554  while (n--)
555  tm += daug[n]->p4();
556  const vector<BPHRecoConstCandPtr>& comp = daughComp();
557  int m = comp.size();
558  while (m--)
559  tm += comp[m]->p4();
560  totalMomentum = tm;
561  }
562  oldMom = false;
563  return;
564 }

References AlCaHLTBitMon_QueryRunRegistry::comp, BPHDecayMomentum::daughComp(), BPHDecayMomentum::daughters(), MillePedeFileConverter_cfg::e, KinematicState::globalMomentum(), isValidFit(), visualization-live-secondInstance_cfg::m, KinematicState::mass(), dqmiodumpmetadata::n, oldMom, mathSSE::sqrt(), topParticle(), totalMomentum, x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by p4().

◆ getIndependentFit()

bool BPHKinematicFit::getIndependentFit ( const std::string &  name) const

retrieve independent fit flag

Definition at line 321 of file BPHKinematicFit.cc.

321  {
322  const BPHRecoCandidate* comp = getComp(name).get();
323  map<const BPHRecoCandidate*, FlyingParticle>::const_iterator iter = cKinP.find(comp);
324  return (iter != cKinP.end() ? iter->second.flag : false);
325 }

References cKinP, AlCaHLTBitMon_QueryRunRegistry::comp, BPHDecayMomentum::getComp(), and Skims_PA_cff::name.

Referenced by BPHRecoCandidate::fill().

◆ getMassSigma()

double BPHKinematicFit::getMassSigma ( const reco::Candidate cand) const

retrieve particle mass sigma

Definition at line 315 of file BPHKinematicFit.cc.

315  {
316  map<const reco::Candidate*, double>::const_iterator iter = dMSig.find(cand);
317  return (iter != dMSig.end() ? iter->second : -1);
318 }

References dMSig.

Referenced by BPHRecoCandidate::fill().

◆ getParticles() [1/2]

virtual void BPHKinematicFit::getParticles ( const std::string &  moth,
const std::string &  daug,
std::vector< RefCountedKinematicParticle > &  kl,
std::set< RefCountedKinematicParticle > &  ks 
) const
privatevirtual

◆ getParticles() [2/2]

virtual void BPHKinematicFit::getParticles ( const std::string &  moth,
const std::vector< std::string > &  daug,
std::vector< RefCountedKinematicParticle > &  kl,
std::set< RefCountedKinematicParticle > &  ks 
) const
privatevirtual

◆ insertParticle()

void BPHKinematicFit::insertParticle ( RefCountedKinematicParticle kp,
std::vector< RefCountedKinematicParticle > &  kl,
std::set< RefCountedKinematicParticle > &  ks 
)
staticprivate

Definition at line 477 of file BPHKinematicFit.cc.

479  {
480  if (ks.find(kp) != ks.end())
481  return;
482  kl.push_back(kp);
483  ks.insert(kp);
484  return;
485 }

References kp.

◆ isEmpty()

bool BPHKinematicFit::isEmpty ( void  ) const
virtual

get fit status

Definition at line 256 of file BPHKinematicFit.cc.

256  {
257  kinematicTree();
258  if (kinTree.get() == nullptr)
259  return true;
260  return kinTree->isEmpty();
261 }

References kinematicTree(), and kinTree.

Referenced by addParticles(), plotting.Plot::clone(), currentDecayVertex(), currentParticle(), topDecayVertex(), and topParticle().

◆ isValidFit()

bool BPHKinematicFit::isValidFit ( ) const
virtual

Definition at line 263 of file BPHKinematicFit.cc.

263  {
265  if (kPart.get() == nullptr)
266  return false;
267  return kPart->currentState().isValid();
268 }

References topParticle().

Referenced by addParticles(), and fitMomentum().

◆ kinematicTree() [1/7]

const RefCountedKinematicTree & BPHKinematicFit::kinematicTree ( ) const
virtual

perform the kinematic fit and get the result

Definition at line 160 of file BPHKinematicFit.cc.

160  {
161  if (oldFit)
162  return kinematicTree("", massConst, massSigma);
163  return kinTree;
164 }

References kinTree, massConst, massSigma, and oldFit.

Referenced by isEmpty().

◆ kinematicTree() [2/7]

virtual const RefCountedKinematicTree& BPHKinematicFit::kinematicTree ( const std::string &  name) const
virtual

◆ kinematicTree() [3/7]

virtual const RefCountedKinematicTree& BPHKinematicFit::kinematicTree ( const std::string &  name,
double  mass 
) const
virtual

◆ kinematicTree() [4/7]

virtual const RefCountedKinematicTree& BPHKinematicFit::kinematicTree ( const std::string &  name,
double  mass,
double  sigma 
) const
virtual

◆ kinematicTree() [5/7]

virtual const RefCountedKinematicTree& BPHKinematicFit::kinematicTree ( const std::string &  name,
KinematicConstraint kc 
) const
virtual

◆ kinematicTree() [6/7]

virtual const RefCountedKinematicTree& BPHKinematicFit::kinematicTree ( const std::string &  name,
MultiTrackKinematicConstraint kc 
) const
virtual

◆ kinematicTree() [7/7]

const RefCountedKinematicTree & BPHKinematicFit::kinematicTree ( const std::vector< RefCountedKinematicParticle > &  kPart,
MultiTrackKinematicConstraint kc 
) const
privatevirtual

Definition at line 525 of file BPHKinematicFit.cc.

526  {
527  try {
529  kinTree = cvf.fit(kPart, kc);
530  } catch (std::exception const&) {
531  edm::LogPrint("FitFailed") << "BPHKinematicFit::kinematicTree: "
532  << "kin fit reset";
533  kinTree = RefCountedKinematicTree(nullptr);
534  }
535  return kinTree;
536 }

References cppFunctionSkipper::exception, KinematicConstrainedVertexFitter::fit(), and kinTree.

◆ kinParticles() [1/2]

const vector< RefCountedKinematicParticle > & BPHKinematicFit::kinParticles ( ) const
virtual

get kinematic particles

Definition at line 125 of file BPHKinematicFit.cc.

125  {
126  if (oldKPs)
127  buildParticles();
128  return allParticles;
129 }

References allParticles, buildParticles(), and oldKPs.

Referenced by splitKP().

◆ kinParticles() [2/2]

virtual std::vector<RefCountedKinematicParticle> BPHKinematicFit::kinParticles ( const std::vector< std::string > &  names) const
virtual

◆ mass()

ParticleMass BPHKinematicFit::mass ( ) const
virtual

Definition at line 297 of file BPHKinematicFit.cc.

297  {
299  if (kPart.get() == nullptr)
300  return -1.0;
301  const KinematicState kStat = kPart->currentState();
302  if (kStat.isValid())
303  return kStat.mass();
304  return -1.0;
305 }

References KinematicState::isValid(), KinematicState::mass(), and topParticle().

Referenced by Particle.Particle::__str__(), DiObject.DiMuon::__str__(), BPHRecoCandidate::add(), addParticles(), BPHPlusMinusCandidate::build(), BPHRecoCandidate::build(), BPHDecayToV0DiffMassBuilder::buildCandidate(), BPHRecoCandidate::fill(), setConstraint(), and setIndependentFit().

◆ numParticles()

unsigned int BPHKinematicFit::numParticles ( const BPHKinematicFit cand = nullptr) const
privatevirtual

Definition at line 461 of file BPHKinematicFit.cc.

461  {
462  if (cand == nullptr)
463  cand = this;
464  unsigned int n = cand->daughters().size();
465  const vector<string>& cnames = cand->compNames();
466  int i = cnames.size();
467  while (i) {
468  const BPHRecoCandidate* comp = cand->getComp(cnames[--i]).get();
469  if (cKinP.at(comp).flag)
470  ++n;
471  else
472  n += numParticles(comp);
473  }
474  return n;
475 }

References cKinP, AlCaHLTBitMon_QueryRunRegistry::comp, mps_fire::i, and dqmiodumpmetadata::n.

Referenced by splitKP().

◆ operator=()

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

◆ p4()

const math::XYZTLorentzVector & BPHKinematicFit::p4 ( ) const
virtual

compute total momentum after the fit

Definition at line 308 of file BPHKinematicFit.cc.

308  {
309  if (oldMom)
310  fitMomentum();
311  return totalMomentum;
312 }

References fitMomentum(), oldMom, and totalMomentum.

Referenced by Tau.Tau::dxy_approx(), Tau.Tau::dz(), and Lepton.Lepton::p4WithFSR().

◆ resetKinematicFit()

void BPHKinematicFit::resetKinematicFit ( ) const
virtual

reset the kinematic fit

Definition at line 250 of file BPHKinematicFit.cc.

250  {
251  oldKPs = oldFit = oldMom = true;
252  return;
253 }

References oldFit, oldKPs, and oldMom.

Referenced by BPHDecayToResFlyingBuilder::build(), and setNotUpdated().

◆ setConstraint()

void BPHKinematicFit::setConstraint ( double  mass,
double  sigma 
)

apply a mass constraint

Operations

Definition at line 91 of file BPHKinematicFit.cc.

91  {
92  oldKPs = oldFit = oldMom = true;
93  massConst = mass;
94  massSigma = sigma;
95  return;
96 }

References mass(), massConst, massSigma, oldFit, oldKPs, and oldMom.

Referenced by addParticles(), and BPHRecoCandidate::fill().

◆ setIndependentFit()

void BPHKinematicFit::setIndependentFit ( const std::string &  name,
bool  flag = true,
double  mass = -1.0,
double  sigma = -1.0 
)

set a decaying daughter as an unique particle fitted independently

Definition at line 104 of file BPHKinematicFit.cc.

104  {
105  string::size_type pos = name.find('/');
106  if (pos != string::npos) {
107  edm::LogPrint("WrongRequest") << "BPHKinematicFit::setIndependentFit: "
108  << "cascade decay specification not admitted " << name;
109  return;
110  }
111  const BPHRecoCandidate* comp = getComp(name).get();
112  if (comp == nullptr) {
113  edm::LogPrint("ParticleNotFound") << "BPHKinematicFit::setIndependentFit: " << name << " daughter not found";
114  return;
115  }
116  oldKPs = oldFit = oldMom = true;
117  FlyingParticle& fp = cKinP[comp];
118  fp.flag = flag;
119  fp.mass = mass;
120  fp.sigma = sigma;
121  return;
122 }

References cKinP, AlCaHLTBitMon_QueryRunRegistry::comp, RemoveAddSevLevel::flag, personalPlayback::fp, BPHDecayMomentum::getComp(), mass(), Skims_PA_cff::name, oldFit, oldKPs, and oldMom.

Referenced by BPHDecayToResFlyingBuilder::build(), and BPHRecoCandidate::fill().

◆ setNotUpdated()

void BPHKinematicFit::setNotUpdated ( ) const
overrideprotectedvirtual

Reimplemented from BPHDecayVertex.

Reimplemented in BPHPlusMinusCandidate.

Definition at line 354 of file BPHKinematicFit.cc.

354  {
357  return;
358 }

References resetKinematicFit(), and BPHDecayVertex::setNotUpdated().

Referenced by BPHPlusMinusCandidate::setNotUpdated().

◆ splitKP()

const BPHKinematicFit * BPHKinematicFit::splitKP ( const std::string &  name,
std::vector< RefCountedKinematicParticle > *  kComp,
std::vector< RefCountedKinematicParticle > *  kTail = nullptr 
) const
privatevirtual

Definition at line 487 of file BPHKinematicFit.cc.

489  {
490  kinTree = RefCountedKinematicTree(nullptr);
491  oldFit = false;
492  kinParticles();
493  if (allParticles.size() != numParticles())
494  return nullptr;
495  kComp->clear();
496  if (kTail == nullptr)
497  kTail = kComp;
498  else
499  kTail->clear();
500  if (name.empty()) {
501  *kComp = allParticles;
502  return this;
503  }
504  const BPHRecoCandidate* comp = getComp(name).get();
505  int ns;
506  if (comp != nullptr) {
507  ns = (cKinP.at(comp).flag ? 1 : numParticles(comp));
508  } else {
509  edm::LogPrint("ParticleNotFound") << "BPHKinematicFit::splitKP: " << name << " daughter not found";
510  *kTail = allParticles;
511  return nullptr;
512  }
513  vector<string> nfull(2);
514  nfull[0] = name;
515  nfull[1] = "*";
516  vector<RefCountedKinematicParticle> kPart = kinParticles(nfull);
517  vector<RefCountedKinematicParticle>::const_iterator iter = kPart.begin();
518  vector<RefCountedKinematicParticle>::const_iterator imid = iter + ns;
519  vector<RefCountedKinematicParticle>::const_iterator iend = kPart.end();
520  kComp->insert(kComp->end(), iter, imid);
521  kTail->insert(kTail->end(), imid, iend);
522  return comp;
523 }

References allParticles, cKinP, AlCaHLTBitMon_QueryRunRegistry::comp, BPHDecayMomentum::getComp(), kinParticles(), kinTree, Skims_PA_cff::name, numParticles(), and oldFit.

◆ topDecayVertex()

const RefCountedKinematicVertex BPHKinematicFit::topDecayVertex ( ) const
virtual

Definition at line 290 of file BPHKinematicFit.cc.

290  {
291  if (isEmpty())
292  return RefCountedKinematicVertex(nullptr);
293  kinTree->movePointerToTheTop();
294  return kinTree->currentDecayVertex();
295 }

References isEmpty(), and kinTree.

Referenced by BPHDecayToResFlyingBuilder::build().

◆ topParticle()

const RefCountedKinematicParticle BPHKinematicFit::topParticle ( ) const
virtual

get top particle

Definition at line 284 of file BPHKinematicFit.cc.

284  {
285  if (isEmpty())
286  return RefCountedKinematicParticle(nullptr);
287  return kinTree->topParticle();
288 }

References isEmpty(), and kinTree.

Referenced by addParticles(), fitMomentum(), isValidFit(), and mass().

Member Data Documentation

◆ allParticles

std::vector<RefCountedKinematicParticle> BPHKinematicFit::allParticles
mutableprivate

Definition at line 148 of file BPHKinematicFit.h.

Referenced by buildParticles(), kinParticles(), and splitKP().

◆ cKinP

std::map<const BPHRecoCandidate*, FlyingParticle> BPHKinematicFit::cKinP
private

◆ dMSig

std::map<const reco::Candidate*, double> BPHKinematicFit::dMSig
private

Definition at line 129 of file BPHKinematicFit.h.

Referenced by addParticles(), BPHKinematicFit(), and getMassSigma().

◆ kCDMap

std::map<const BPHRecoCandidate*, RefCountedKinematicParticle> BPHKinematicFit::kCDMap
mutableprivate

Definition at line 147 of file BPHKinematicFit.h.

Referenced by buildParticles().

◆ kinMap

std::map<const reco::Candidate*, RefCountedKinematicParticle> BPHKinematicFit::kinMap
mutableprivate

Definition at line 146 of file BPHKinematicFit.h.

Referenced by buildParticles().

◆ kinTree

RefCountedKinematicTree BPHKinematicFit::kinTree
mutableprivate

◆ massConst

double BPHKinematicFit::massConst
private

Definition at line 125 of file BPHKinematicFit.h.

Referenced by constrMass(), kinematicTree(), and setConstraint().

◆ massSigma

double BPHKinematicFit::massSigma
private

Definition at line 126 of file BPHKinematicFit.h.

Referenced by constrSigma(), kinematicTree(), and setConstraint().

◆ oldFit

bool BPHKinematicFit::oldFit
mutableprivate

◆ oldKPs

bool BPHKinematicFit::oldKPs
mutableprivate

◆ oldMom

bool BPHKinematicFit::oldMom
mutableprivate

◆ tmpList

std::vector<BPHRecoConstCandPtr> BPHKinematicFit::tmpList
mutableprivate

Definition at line 140 of file BPHKinematicFit.h.

Referenced by addParticles().

◆ totalMomentum

math::XYZTLorentzVector BPHKinematicFit::totalMomentum
mutableprivate

Definition at line 150 of file BPHKinematicFit.h.

Referenced by fitMomentum(), and p4().

Vector3DBase
Definition: Vector3DBase.h:8
DDAxes::y
AlCaHLTBitMon_QueryRunRegistry.comp
string comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
BPHDecayMomentum::daughComp
virtual const std::vector< BPHRecoConstCandPtr > & daughComp() const
Definition: BPHDecayMomentum.cc:89
mps_fire.i
i
Definition: mps_fire.py:428
BPHKinematicFit::isEmpty
virtual bool isEmpty() const
get fit status
Definition: BPHKinematicFit.cc:256
dqmiodumpmetadata.n
n
Definition: dqmiodumpmetadata.py:28
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
BPHKinematicFit::dMSig
std::map< const reco::Candidate *, double > dMSig
Definition: BPHKinematicFit.h:129
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
BPHKinematicFit::numParticles
virtual unsigned int numParticles(const BPHKinematicFit *cand=nullptr) const
Definition: BPHKinematicFit.cc:461
KinematicParticleFactoryFromTransientTrack
Definition: KinematicParticleFactoryFromTransientTrack.h:16
ParticleMass
double ParticleMass
Definition: ParticleMass.h:4
KinematicState
Definition: KinematicState.h:17
BPHDecayMomentum::cMap
std::map< std::string, BPHRecoConstCandPtr > cMap
Definition: BPHDecayMomentum.h:148
BPHKinematicFit::oldKPs
bool oldKPs
Definition: BPHKinematicFit.h:143
BPHKinematicFit::oldMom
bool oldMom
Definition: BPHKinematicFit.h:145
BPHDecayVertex::getTransientTrack
reco::TransientTrack * getTransientTrack(const reco::Candidate *cand) const
get TransientTrack for a daughter
Definition: BPHDecayVertex.cc:143
pos
Definition: PixelAliasList.h:18
edm::LogPrint
Log< level::Warning, true > LogPrint
Definition: MessageLogger.h:130
KinematicState::globalMomentum
GlobalVector globalMomentum() const
Definition: KinematicState.h:67
RefCountedKinematicParticle
ReferenceCountingPointer< KinematicParticle > RefCountedKinematicParticle
Definition: RefCountedKinematicParticle.h:7
BPHKinematicFit::buildParticles
virtual void buildParticles() const
Definition: BPHKinematicFit.cc:361
BPHKinematicFit::allParticles
std::vector< RefCountedKinematicParticle > allParticles
Definition: BPHKinematicFit.h:148
personalPlayback.fp
fp
Definition: personalPlayback.py:523
ReferenceCountingPointer
Definition: ReferenceCounted.h:60
DDAxes::x
BPHDecayVertex::BPHDecayVertex
BPHDecayVertex(const BPHDecayVertex &x)=delete
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
KinematicConstrainedVertexFitter::fit
RefCountedKinematicTree fit(const std::vector< RefCountedKinematicParticle > &part)
Definition: KinematicConstrainedVertexFitter.h:46
BPHKinematicFit::massSigma
double massSigma
Definition: BPHKinematicFit.h:126
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
visualization-live-secondInstance_cfg.m
m
Definition: visualization-live-secondInstance_cfg.py:79
mathSSE::sqrt
T sqrt(T t)
Definition: SSEVec.h:19
DDAxes::z
BPHKinematicFit::addParticles
virtual void addParticles(std::vector< RefCountedKinematicParticle > &kl, std::map< const reco::Candidate *, RefCountedKinematicParticle > &km, std::map< const BPHRecoCandidate *, RefCountedKinematicParticle > &cm) const
Definition: BPHKinematicFit.cc:371
BPHKinematicFit::isValidFit
virtual bool isValidFit() const
Definition: BPHKinematicFit.cc:263
BPHDecayVertex::setNotUpdated
void setNotUpdated() const override
Definition: BPHDecayVertex.cc:175
KinematicParticleFactoryFromTransientTrack::particle
RefCountedKinematicParticle particle(const reco::TransientTrack &initialTrack, const ParticleMass &massGuess, float chiSquared, float degreesOfFr, float &m_sigma) const
Definition: KinematicParticleFactoryFromTransientTrack.cc:15
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
BPHKinematicFit::totalMomentum
math::XYZTLorentzVector totalMomentum
Definition: BPHKinematicFit.h:150
KinematicConstrainedVertexFitter
Definition: KinematicConstrainedVertexFitter.h:21
BPHKinematicFit::topParticle
virtual const RefCountedKinematicParticle topParticle() const
get top particle
Definition: BPHKinematicFit.cc:284
cand
Definition: decayParser.h:32
BPHKinematicFit::kinMap
std::map< const reco::Candidate *, RefCountedKinematicParticle > kinMap
Definition: BPHKinematicFit.h:146
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
BPHKinematicFit::kCDMap
std::map< const BPHRecoCandidate *, RefCountedKinematicParticle > kCDMap
Definition: BPHKinematicFit.h:147
BPHDecayMomentum::getComp
virtual BPHRecoConstCandPtr getComp(const std::string &name) const
Definition: BPHDecayMomentum.cc:106
KinematicState::isValid
bool isValid() const
Definition: KinematicState.h:79
BPHKinematicFit::massConst
double massConst
Definition: BPHKinematicFit.h:125
BPHKinematicFit::mass
virtual ParticleMass mass() const
Definition: BPHKinematicFit.cc:297
BPHKinematicFit::tmpList
std::vector< BPHRecoConstCandPtr > tmpList
Definition: BPHKinematicFit.h:140
BPHKinematicFit::kinematicTree
virtual const RefCountedKinematicTree & kinematicTree() const
perform the kinematic fit and get the result
Definition: BPHKinematicFit.cc:160
BPHKinematicFit::setConstraint
void setConstraint(double mass, double sigma)
apply a mass constraint
Definition: BPHKinematicFit.cc:91
reco::Candidate
Definition: Candidate.h:27
KinematicState::mass
ParticleMass mass() const
Definition: KinematicState.h:54
BPHDecayMomentum::originalReco
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
Definition: BPHDecayMomentum.cc:82
reco::TransientTrack
Definition: TransientTrack.h:19
math::XYZTLorentzVector
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
BPHDecayMomentum::daughFull
virtual const std::vector< const reco::Candidate * > & daughFull() const
Definition: BPHDecayMomentum.cc:75
BPHKinematicFit::fitMomentum
virtual void fitMomentum() const
Definition: BPHKinematicFit.cc:538
RefCountedKinematicVertex
ReferenceCountingPointer< KinematicVertex > RefCountedKinematicVertex
Definition: RefCountedKinematicVertex.h:7
BPHKinematicFit::oldFit
bool oldFit
Definition: BPHKinematicFit.h:144
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
BPHKinematicFit::resetKinematicFit
virtual void resetKinematicFit() const
reset the kinematic fit
Definition: BPHKinematicFit.cc:250
BPHRecoCandidate::clone
virtual BPHRecoCandidate * clone(int level=-1) const
Definition: BPHRecoCandidate.cc:53
BPHDecayMomentum::daughters
virtual const std::vector< const reco::Candidate * > & daughters() const
Definition: BPHDecayMomentum.cc:73
RefCountedKinematicTree
ReferenceCountingPointer< KinematicTree > RefCountedKinematicTree
Definition: RefCountedKinematicTree.h:6
BPHKinematicFit::cKinP
std::map< const BPHRecoCandidate *, FlyingParticle > cKinP
Definition: BPHKinematicFit.h:137
BPHRecoCandidate
Definition: BPHRecoCandidate.h:46
c
auto & c
Definition: CAHitNtupletGeneratorKernelsImpl.h:56
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
BPHDecayMomentum::componentList
const std::vector< Component > & componentList() const
Definition: BPHDecayMomentum.cc:118
BPHKinematicFit::kinTree
RefCountedKinematicTree kinTree
Definition: BPHKinematicFit.h:149
kp
int kp
Definition: CascadeWrapper.h:13
BPHDecayMomentum::dMap
std::map< std::string, const reco::Candidate * > dMap
Definition: BPHDecayMomentum.h:147
BPHRecoConstCandPtr
BPHGenericPtr< const BPHRecoCandidate >::type BPHRecoConstCandPtr
Definition: BPHRecoCandidatePtr.h:9
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443
BPHKinematicFit::kinParticles
virtual const std::vector< RefCountedKinematicParticle > & kinParticles() const
get kinematic particles
Definition: BPHKinematicFit.cc:125
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37