CMS 3D CMS Logo

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

#include <BPHKinematicFit.h>

Inheritance diagram for BPHKinematicFit:
BPHDecayVertex BPHDecayMomentum BPHRecoCandidate BPHPlusMinusCandidate

Public Member Functions

double constrMass () const
 retrieve the constraint More...
 
double constrSigma () const
 
virtual const RefCountedKinematicVertex currentDecayVertex () const
 
virtual const RefCountedKinematicParticle currentParticle () const
 
virtual bool isEmpty () const
 
virtual bool isValidFit () const
 
virtual const RefCountedKinematicTreekinematicTree () const
 perform the kinematic fit and get the result More...
 
virtual const RefCountedKinematicTreekinematicTree (const std::string &name, double mass, double sigma) const
 
virtual const RefCountedKinematicTreekinematicTree (const std::string &name, double mass) 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
 
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...
 
 ~BPHKinematicFit () override
 
- Public Member Functions inherited from BPHDecayVertex
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...
 
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 () const
 get reconstructed vertex More...
 
 ~BPHDecayVertex () override
 
- Public Member Functions inherited from BPHDecayMomentum
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
 
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 reco::Candidate *daug, double mass=-1.0, double sigma=-1.0)
 
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 BPHRecoConstCandPtr &comp)
 add a previously reconstructed particle giving it a name More...
 
 BPHKinematicFit ()
 
 BPHKinematicFit (const BPHKinematicFit *ptr)
 
void setNotUpdated () const override
 
- Protected Member Functions inherited from BPHDecayVertex
virtual void addV (const std::string &name, const reco::Candidate *daug, const std::string &searchList, double mass)
 
virtual void addV (const std::string &name, const BPHRecoConstCandPtr &comp)
 add a previously reconstructed particle giving it a name More...
 
 BPHDecayVertex (const edm::EventSetup *es)
 
 BPHDecayVertex (const BPHDecayVertex *ptr, const edm::EventSetup *es)
 
- Protected Member Functions inherited from BPHDecayMomentum
virtual void addP (const std::string &name, const reco::Candidate *daug, double mass=-1.0)
 
virtual void addP (const std::string &name, const BPHRecoConstCandPtr &comp)
 add a previously reconstructed particle giving it a name More...
 
 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
 

Private Member Functions

virtual void buildParticles () const
 
virtual void fitMomentum () const
 

Private Attributes

std::vector< RefCountedKinematicParticleallParticles
 
std::map< const reco::Candidate *, double > dMSig
 
std::map< const reco::Candidate *, RefCountedKinematicParticlekinMap
 
RefCountedKinematicTree kinTree
 
double massConst
 
double massSigma
 
bool oldFit
 
bool oldKPs
 
bool oldMom
 
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 35 of file BPHKinematicFit.h.

Constructor & Destructor Documentation

BPHKinematicFit::~BPHKinematicFit ( )
override

Constructor is protected this object can exist only as part of a derived classDestructor

Definition at line 87 of file BPHKinematicFit.cc.

87  {
88 }
BPHKinematicFit::BPHKinematicFit ( )
protected

Definition at line 43 of file BPHKinematicFit.cc.

43  :
44  BPHDecayVertex( nullptr ),
45  massConst( -1.0 ),
46  massSigma( -1.0 ),
47  oldKPs( true ),
48  oldFit( true ),
49  oldMom( true ),
50  kinTree( nullptr ) {
51 }
BPHDecayVertex(const edm::EventSetup *es)
RefCountedKinematicTree kinTree
BPHKinematicFit::BPHKinematicFit ( const BPHKinematicFit ptr)
protected

Definition at line 54 of file BPHKinematicFit.cc.

References EnergyCorrector::c, BPHDecayMomentum::Component::cand, BPHDecayMomentum::componentList(), BPHDecayMomentum::daughComp(), BPHDecayMomentum::daughters(), BPHDecayMomentum::dMap, dMSig, mps_fire::i, list(), funct::m, BPHDecayMomentum::Component::msig, gen::n, and BPHDecayMomentum::originalReco().

54  :
55  BPHDecayVertex( ptr, nullptr ),
56  massConst( -1.0 ),
57  massSigma( -1.0 ),
58  oldKPs( true ),
59  oldFit( true ),
60  oldMom( true ),
61  kinTree( nullptr ) {
62  map<const reco::Candidate*,const reco::Candidate*> iMap;
63  const vector<const reco::Candidate*>& daug = daughters();
64  const vector<Component>& list = ptr->componentList();
65  int i;
66  int n = daug.size();
67  for ( i = 0; i < n; ++i ) {
68  const reco::Candidate* cand = daug[i];
69  iMap[originalReco( cand )] = cand;
70  }
71  for ( i = 0; i < n; ++i ) {
72  const Component& c = list[i];
73  dMSig[iMap[c.cand]] = c.msig;
74  }
75  const vector<BPHRecoConstCandPtr>& dComp = daughComp();
76  int j;
77  int m = dComp.size();
78  for ( j = 0; j < m; ++j ) {
79  const map<const reco::Candidate*,double>& dMap = dComp[j]->dMSig;
80  dMSig.insert( dMap.begin(), dMap.end() );
81  }
82 }
virtual const std::vector< const reco::Candidate * > & daughters() const
std::map< const reco::Candidate *, double > dMSig
const std::vector< Component > & componentList() const
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
BPHDecayVertex(const edm::EventSetup *es)
RefCountedKinematicTree kinTree
std::map< std::string, const reco::Candidate * > dMap
virtual const std::vector< BPHRecoConstCandPtr > & daughComp() const
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run

Member Function Documentation

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 p4(), and BPHPlusMinusCandidate::~BPHPlusMinusCandidate().

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

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

add a previously reconstructed particle giving it a name

void BPHKinematicFit::buildParticles ( ) const
privatevirtual

Definition at line 380 of file BPHKinematicFit.cc.

References allParticles, BPHDecayMomentum::daughFull(), dMSig, BPHDecayVertex::getTransientTrack(), kinMap, mass(), reco::Candidate::mass(), gen::n, oldKPs, KinematicParticleFactoryFromTransientTrack::particle(), and groupFilesInBlocks::tt.

Referenced by kinParticles().

380  {
381  kinMap.clear();
382  allParticles.clear();
383  const vector<const reco::Candidate*>& daug = daughFull();
385  int n = daug.size();
386  allParticles.reserve( n );
387  float chi = 0.0;
388  float ndf = 0.0;
389  while ( n-- ) {
390  const reco::Candidate* cand = daug[n];
391  ParticleMass mass = cand->mass();
392  float sigma = dMSig.find( cand )->second;
393  if ( sigma < 0 ) sigma = 1.0e-7;
395  if ( tt != nullptr ) allParticles.push_back( kinMap[cand] =
396  pFactory.particle( *tt,
397  mass, chi, ndf, sigma ) );
398  }
399  oldKPs = false;
400  return;
401 }
reco::TransientTrack * getTransientTrack(const reco::Candidate *cand) const
get TransientTrack for a daughter
double ParticleMass
Definition: ParticleMass.h:5
virtual ParticleMass mass() const
std::map< const reco::Candidate *, double > dMSig
std::map< const reco::Candidate *, RefCountedKinematicParticle > kinMap
std::vector< RefCountedKinematicParticle > allParticles
virtual double mass() const =0
mass
virtual const std::vector< const reco::Candidate * > & daughFull() const
RefCountedKinematicParticle particle(const reco::TransientTrack &initialTrack, const ParticleMass &massGuess, float chiSquared, float degreesOfFr, float &m_sigma) const
double BPHKinematicFit::constrMass ( ) const

retrieve the constraint

Definition at line 101 of file BPHKinematicFit.cc.

References massConst.

101  {
102  return massConst;
103 }
double BPHKinematicFit::constrSigma ( ) const

Definition at line 106 of file BPHKinematicFit.cc.

References massSigma.

106  {
107  return massSigma;
108 }
const RefCountedKinematicVertex BPHKinematicFit::currentDecayVertex ( ) const
virtual

Definition at line 325 of file BPHKinematicFit.cc.

References isEmpty(), and kinTree.

325  {
326  if ( isEmpty() ) return RefCountedKinematicVertex( nullptr );
327  return kinTree->currentDecayVertex();
328 }
virtual bool isEmpty() const
ReferenceCountingPointer< KinematicVertex > RefCountedKinematicVertex
RefCountedKinematicTree kinTree
const RefCountedKinematicParticle BPHKinematicFit::currentParticle ( ) const
virtual

Definition at line 319 of file BPHKinematicFit.cc.

References isEmpty(), and kinTree.

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

319  {
320  if ( isEmpty() ) return RefCountedKinematicParticle( nullptr );
321  return kinTree->currentParticle();
322 }
virtual bool isEmpty() const
RefCountedKinematicTree kinTree
ReferenceCountingPointer< KinematicParticle > RefCountedKinematicParticle
void BPHKinematicFit::fitMomentum ( ) const
privatevirtual

Definition at line 404 of file BPHKinematicFit.cc.

References AlCaHLTBitMon_QueryRunRegistry::comp, currentParticle(), BPHDecayMomentum::daughComp(), BPHDecayMomentum::daughters(), MillePedeFileConverter_cfg::e, KinematicState::globalMomentum(), isValidFit(), funct::m, KinematicState::mass(), gen::n, oldMom, mathSSE::sqrt(), totalMomentum, x, PV3DBase< T, PVType, FrameType >::x(), y, PV3DBase< T, PVType, FrameType >::y(), z, and PV3DBase< T, PVType, FrameType >::z().

Referenced by p4().

404  {
405  if ( isValidFit() ) {
406  const KinematicState& ks = currentParticle()->currentState();
407  GlobalVector tm = ks.globalMomentum();
408  double x = tm.x();
409  double y = tm.y();
410  double z = tm.z();
411  double m = ks.mass();
412  double e = sqrt( ( x * x ) + ( y * y ) + ( z * z ) + ( m * m ) );
413  totalMomentum.SetPxPyPzE( x, y, z, e );
414  }
415  else {
416  edm::LogPrint( "FitNotFound" )
417  << "BPHKinematicFit::fitMomentum: "
418  << "simple momentum sum computed";
420  const vector<const reco::Candidate*>& daug = daughters();
421  int n = daug.size();
422  while ( n-- ) tm += daug[n]->p4();
423  const vector<BPHRecoConstCandPtr>& comp = daughComp();
424  int m = comp.size();
425  while ( m-- ) tm += comp[m]->p4();
426  totalMomentum = tm;
427  }
428  oldMom = false;
429  return;
430 }
T y() const
Definition: PV3DBase.h:63
GlobalVector globalMomentum() const
virtual const std::vector< const reco::Candidate * > & daughters() const
virtual const RefCountedKinematicParticle currentParticle() const
ParticleMass mass() const
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
Definition: LorentzVector.h:29
T sqrt(T t)
Definition: SSEVec.h:18
T z() const
Definition: PV3DBase.h:64
virtual bool isValidFit() const
virtual const std::vector< BPHRecoConstCandPtr > & daughComp() const
math::XYZTLorentzVector totalMomentum
T x() const
Definition: PV3DBase.h:62
bool BPHKinematicFit::isEmpty ( void  ) const
virtual

Definition at line 305 of file BPHKinematicFit.cc.

References kinematicTree(), kinTree, and nullptr.

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

305  {
306  kinematicTree();
307  if ( kinTree.get() == nullptr ) return true;
308  return kinTree->isEmpty();
309 }
#define nullptr
virtual const RefCountedKinematicTree & kinematicTree() const
perform the kinematic fit and get the result
RefCountedKinematicTree kinTree
bool BPHKinematicFit::isValidFit ( ) const
virtual

Definition at line 312 of file BPHKinematicFit.cc.

References currentParticle(), and nullptr.

Referenced by fitMomentum().

312  {
314  if ( kPart.get() == nullptr ) return false;
315  return kPart->currentState().isValid();
316 }
#define nullptr
virtual const RefCountedKinematicParticle currentParticle() const
const RefCountedKinematicTree & BPHKinematicFit::kinematicTree ( ) const
virtual
virtual const RefCountedKinematicTree& BPHKinematicFit::kinematicTree ( const std::string &  name,
double  mass,
double  sigma 
) const
virtual
virtual const RefCountedKinematicTree& BPHKinematicFit::kinematicTree ( const std::string &  name,
double  mass 
) const
virtual
virtual const RefCountedKinematicTree& BPHKinematicFit::kinematicTree ( const std::string &  name,
KinematicConstraint kc 
) const
virtual
virtual const RefCountedKinematicTree& BPHKinematicFit::kinematicTree ( const std::string &  name,
MultiTrackKinematicConstraint kc 
) const
virtual
const vector< RefCountedKinematicParticle > & BPHKinematicFit::kinParticles ( ) const
virtual

get kinematic particles

Definition at line 111 of file BPHKinematicFit.cc.

References allParticles, buildParticles(), BPHDecayMomentum::daughFull(), BPHDecayMomentum::getDaug(), mps_fire::i, kinMap, kp, funct::m, genParticles_cff::map, gen::n, cscdqm::h::names, oldKPs, BPhysicsValidation_cfi::pname, and muonDTDigis_cfi::pset.

Referenced by kinematicTree().

112  {
113  if ( oldKPs ) buildParticles();
114  return allParticles;
115 }
virtual void buildParticles() const
std::vector< RefCountedKinematicParticle > allParticles
virtual std::vector<RefCountedKinematicParticle> BPHKinematicFit::kinParticles ( const std::vector< std::string > &  names) const
virtual
ParticleMass BPHKinematicFit::mass ( ) const
virtual

Definition at line 331 of file BPHKinematicFit.cc.

References currentParticle(), KinematicState::isValid(), KinematicState::mass(), and nullptr.

Referenced by Particle.Particle::__str__(), DiObject.DiMuon::__str__(), BPHPlusMinusCandidate::build(), BPHRecoCandidate::build(), buildParticles(), kinematicTree(), p4(), setConstraint(), and BPHPlusMinusCandidate::~BPHPlusMinusCandidate().

331  {
333  if ( kPart.get() == nullptr ) return -1.0;
334  const KinematicState kStat = kPart->currentState();
335  if ( kStat.isValid() ) return kStat.mass();
336  return -1.0;
337 }
bool isValid() const
#define nullptr
virtual const RefCountedKinematicParticle currentParticle() const
ParticleMass mass() const
const math::XYZTLorentzVector & BPHKinematicFit::p4 ( ) const
virtual
void BPHKinematicFit::resetKinematicFit ( ) const
virtual

reset the kinematic fit

Definition at line 299 of file BPHKinematicFit.cc.

References oldFit, oldKPs, and oldMom.

Referenced by setNotUpdated().

299  {
300  oldKPs = oldFit = oldMom = true;
301  return;
302 }
void BPHKinematicFit::setConstraint ( double  mass,
double  sigma 
)

apply a mass constraint

Operations

Definition at line 93 of file BPHKinematicFit.cc.

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

Referenced by BPHOniaToMuMuBuilder::extractList().

93  {
94  oldFit = oldMom = true;
95  massConst = mass;
96  massSigma = sigma;
97  return;
98 }
virtual ParticleMass mass() const
void BPHKinematicFit::setNotUpdated ( ) const
overrideprotectedvirtual

Reimplemented from BPHDecayVertex.

Reimplemented in BPHPlusMinusCandidate.

Definition at line 373 of file BPHKinematicFit.cc.

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

Referenced by BPHPlusMinusCandidate::setNotUpdated().

373  {
376  return;
377 }
void setNotUpdated() const override
virtual void resetKinematicFit() const
reset the kinematic fit

Member Data Documentation

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

Definition at line 126 of file BPHKinematicFit.h.

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

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

Definition at line 118 of file BPHKinematicFit.h.

Referenced by BPHKinematicFit(), buildParticles(), and p4().

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

Definition at line 125 of file BPHKinematicFit.h.

Referenced by buildParticles(), and kinParticles().

RefCountedKinematicTree BPHKinematicFit::kinTree
mutableprivate

Definition at line 127 of file BPHKinematicFit.h.

Referenced by currentDecayVertex(), currentParticle(), isEmpty(), and kinematicTree().

double BPHKinematicFit::massConst
private

Definition at line 114 of file BPHKinematicFit.h.

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

double BPHKinematicFit::massSigma
private

Definition at line 115 of file BPHKinematicFit.h.

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

bool BPHKinematicFit::oldFit
mutableprivate

Definition at line 122 of file BPHKinematicFit.h.

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

bool BPHKinematicFit::oldKPs
mutableprivate

Definition at line 121 of file BPHKinematicFit.h.

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

bool BPHKinematicFit::oldMom
mutableprivate

Definition at line 123 of file BPHKinematicFit.h.

Referenced by fitMomentum(), p4(), resetKinematicFit(), and setConstraint().

math::XYZTLorentzVector BPHKinematicFit::totalMomentum
mutableprivate

Definition at line 128 of file BPHKinematicFit.h.

Referenced by fitMomentum(), and p4().