Belle II Software  release-05-02-19
InternalParticle Class Reference

another unneccessary layer of abstraction More...

#include <InternalParticle.h>

Inheritance diagram for InternalParticle:
Collaboration diagram for InternalParticle:

Public Types

enum  TFParticleType {
  kInteractionPoint,
  kOrigin,
  kRecoComposite,
  kRecoResonance,
  kInternalParticle,
  kRecoTrack,
  kResonance,
  kRecoPhoton,
  kRecoKlong,
  kMissingParticle,
  kFeedthroughParticle,
  kInternalTrack
}
 particle types

 
typedef std::vector< Constraintconstraintlist
 alias
 
typedef std::vector< std::pair< const ParticleBase *, int > > indexmap
 alias
 

Public Member Functions

 InternalParticle (Belle2::Particle *particle, const ParticleBase *mother, const ConstraintConfiguration &config, bool forceFitAll)
 constructor
 
virtual ~InternalParticle ()
 destructor
 
virtual ErrCode initCovariance (FitParams &) const override
 init covariance
 
ErrCode projectKineConstraint (const FitParams &, Projection &) const
 project kinematical constraint
 
virtual void forceP4Sum (FitParams &) const override
 enforce conservation of momentum sum
 
virtual ErrCode initParticleWithMother (FitParams &fitparams) override
 init particle in case it has a mother
 
virtual ErrCode initMotherlessParticle (FitParams &fitparams) override
 init particle in case it has no mother More...
 
ErrCode projectConstraint (const Constraint::Type type, const FitParams &fitparams, Projection &p) const override
 find out which constraint it is and project
 
virtual int dim () const override
 space reserved in fit params, if has mother then it has tau
 
virtual int type () const override
 type
 
virtual int posIndex () const override
 position index in fit params
 
virtual int tauIndex () const override
 tau index in fit params only if it has a mother More...
 
virtual int momIndex () const override
 momentum index in fit params depending on whether it has a mother
More...
 
virtual bool hasEnergy () const override
 has energy in fitparams

 
virtual bool hasPosition () const override
 has position index

 
virtual std::string parname (int index) const override
 name

 
virtual void addToConstraintList (constraintlist &list, int depth) const override
 add to constraint list

 
void setMassConstraint (bool b)
 set mass constraint flag
 
double phidomain (const double)
 rotate in positive phi domain

 
virtual void updateIndex (int &offset)
 this sets the index for momentum, position, etc. More...
 
const ParticleBaselocate (Belle2::Particle *particle) const
 get particle base from basf2 particle
 
Belle2::Particleparticle () const
 get basf2 particle

 
int index () const
 get index

 
const ParticleBasemother () const
 getMother() / hasMother()
 
const std::string & name () const
 get name of the particle
 
virtual ErrCode projectGeoConstraint (const FitParams &, Projection &) const
 project geometrical constraint More...
 
virtual ErrCode projectMassConstraintParticle (const FitParams &, Projection &) const
 project mass constraint using the particles parameters More...
 
virtual ErrCode projectMassConstraintDaughters (const FitParams &, Projection &) const
 project mass constraint using the parameters of the daughters More...
 
virtual ErrCode projectMassConstraint (const FitParams &, Projection &) const
 project mass constraint abstract
 
int eneIndex () const
 get energy index

 
virtual double chiSquare (const FitParams &) const
 get chi2
 
double pdgMass () const
 get pdg mass

 
double pdgWidth () const
 get pdg width
 
double pdgLifeTime () const
 get pdg lifetime
 
double pdgTime () const
 get Tau
 
int charge () const
 get charge
 
virtual ParticleBaseaddDaughter (Belle2::Particle *, const ConstraintConfiguration &config, bool forceFitAll=false)
 add daughter

 
virtual void removeDaughter (const ParticleBase *pb)
 remove daughter
 
virtual void retrieveIndexMap (indexmap &anindexmap) const
 get index map

 
void setMother (const ParticleBase *m)
 set mother

 
void collectVertexDaughters (std::vector< ParticleBase * > &particles, int posindex)
 get vertex daughters
 
virtual int nFinalChargedCandidates () const
 number of charged candidates
 
void setParticle (Belle2::Particle *particle)
 set the relation to basf2 particle type
 

Static Public Member Functions

static ParticleBasecreateParticle (Belle2::Particle *particle, const ParticleBase *mother, const ConstraintConfiguration &config, bool forceFitAll=false)
 create the according treeFitter particle obj for a basf2 particle type

 
static ParticleBasecreateOrigin (Belle2::Particle *daughter, const ConstraintConfiguration &config, bool forceFitAll)
 create a custom origin particle or a beamspot
 

Protected Types

typedef std::vector< ParticleBase * > ParticleContainer
 just an alias
 

Protected Member Functions

ErrCode initMomentum (FitParams &fitparams) const
 init momentum of *this and daughters
 
ErrCode initTau (FitParams &par) const
 initialises tau as a length

 
void setIndex (int i)
 set Index (in statevector)
 

Static Protected Member Functions

static double pdgLifeTime (Belle2::Particle *particle)
 get pdg lifetime
 
static bool isAResonance (Belle2::Particle *particle)
 controls if a particle is treated as a resonance(lifetime=0) or a particle that has a finite lifetime. More...
 
static double bFieldOverC ()
 Bz/c

 

Protected Attributes

Belle2::Particlem_particle
 pointer to framework type

 
const ParticleBasem_mother
 motherparticle
 
std::vector< ParticleBase * > m_daughters
 daughter container

 
bool m_isStronglyDecayingResonance
 decay length less than 1 micron

 
const ConstraintConfigurationm_config
 has all the constraint config
 

Static Private Member Functions

static bool compTrkTransverseMomentum (const RecoTrack *lhs, const RecoTrack *rhs)
 compare transverse track momentum
 

Private Attributes

bool m_massconstraint
 has mass cosntraint
 
bool m_shares_vertex_with_mother
 shares vertex with mother, that means decay vertex = productionvertex
 
bool m_geo_constraint
 use a geo metric constraint
 
bool m_lifetimeconstraint
 has lifetime constraint

 
bool m_isconversion
 is conversion

 
bool m_automatic_vertex_constraining
 automatically figure out if mother and particle vertex should be the same and also add geometric constraints
 
int m_index
 index
 
const double m_pdgMass
 pdg mass

 
double m_pdgWidth
 particle width
 
const double m_pdgLifeTime
 lifetime in cm

 
int m_charge
 charge

 
std::string m_name
 name

 

Detailed Description

another unneccessary layer of abstraction

Definition at line 26 of file InternalParticle.h.

Member Function Documentation

◆ initMotherlessParticle()

ErrCode initMotherlessParticle ( FitParams fitparams)
overridevirtual

init particle in case it has no mother

(0,0,0) is the best guess in any other case

Implements ParticleBase.

Reimplemented in Resonance.

Definition at line 86 of file InternalParticle.cc.

87  {
88  ErrCode status ;
89  for (auto daughter : m_daughters) {
90  status |= daughter->initMotherlessParticle(fitparams);
91  }
92 
93  int posindex = posIndex();
94  // FIXME update this and check if this position is already initialised
95  // lower stream vertices might be better
96  if (hasPosition()) {
97  fitparams.getStateVector().segment(posindex, 3) = Eigen::Matrix<double, 3, 1>::Zero(3);
98 
99  if (fitparams.getStateVector()(posindex) == 0 &&
100  fitparams.getStateVector()(posindex + 1) == 0 &&
101  fitparams.getStateVector()(posindex + 2) == 0) {
102 
103  TVector3 vtx = particle()->getVertex();
104  if (vtx.Mag()) { //if it's not zero
105  fitparams.getStateVector()(posindex) = vtx.X();
106  fitparams.getStateVector()(posindex + 1) = vtx.Y();
107  fitparams.getStateVector()(posindex + 2) = vtx.Z();
108  } else {
109 
110  std::vector<ParticleBase*> alldaughters;
111  ParticleBase::collectVertexDaughters(alldaughters, posindex);
112 
113  std::vector<ParticleBase*> vtxdaughters;
114 
115  vector<RecoTrack*> trkdaughters;
116  for (auto daughter : alldaughters) {
117  if (daughter->type() == ParticleBase::TFParticleType::kRecoTrack) {
118  trkdaughters.push_back(static_cast<RecoTrack*>(daughter));
119  } else if (daughter->hasPosition()
120  && fitparams.getStateVector()(daughter->posIndex()) != 0) {
121  vtxdaughters.push_back(daughter);
122  }
123  }
124 
125  TVector3 v;
126 
127  if (trkdaughters.size() >= 2) {
128  std::sort(trkdaughters.begin(), trkdaughters.end(), compTrkTransverseMomentum);
129 
130  RecoTrack* dau1 = trkdaughters[0];
131  RecoTrack* dau2 = trkdaughters[1];
132 
133  Belle2::Helix helix1 = dau1->particle()->getTrack()->getTrackFitResultWithClosestMass(Belle2::Const::ChargedStable(std::abs(
134  dau1->particle()->getPDGCode())))->getHelix();
135  Belle2::Helix helix2 = dau2->particle()->getTrack()->getTrackFitResultWithClosestMass(Belle2::Const::ChargedStable(std::abs(
136  dau2->particle()->getPDGCode())))->getHelix();
137 
138  double flt1(0), flt2(0);
139  HelixUtils::helixPoca(helix1, helix2, flt1, flt2, v, m_isconversion);
140 
141  fitparams.getStateVector()(posindex) = v.x();
142  fitparams.getStateVector()(posindex + 1) = v.y();
143  fitparams.getStateVector()(posindex + 2) = v.z();
144 
145  dau1->setFlightLength(flt1);
146  dau2->setFlightLength(flt2);
147 
148  } else if (false && trkdaughters.size() + vtxdaughters.size() >= 2) {
149  // TODO switched off waiting for refactoring of init1 and init2 functions (does not affect performance)
150  } else if (mother() && mother()->posIndex() >= 0) {
151  const int posindexmother = mother()->posIndex();
152  const int dim = m_config->m_originDimension; //TODO acess mother
153  fitparams.getStateVector().segment(posindex, dim) = fitparams.getStateVector().segment(posindexmother, dim);
154  } else {
156  fitparams.getStateVector().segment(posindex, 3) = Eigen::Matrix<double, 1, 3>::Zero(3);
157  }
158  }
159  }
160  }
161 
162  for (auto daughter : m_daughters) {
163  daughter->initParticleWithMother(fitparams);
164  }
165 
166  initMomentum(fitparams);
167  return status;
168  }

◆ isAResonance()

bool isAResonance ( Belle2::Particle particle)
staticprotectedinherited

controls if a particle is treated as a resonance(lifetime=0) or a particle that has a finite lifetime.

A finite life time means it will register a geo constraint for this particle

Definition at line 235 of file ParticleBase.cc.

◆ momIndex()

int momIndex ( ) const
overridevirtual

momentum index in fit params depending on whether it has a mother

indexing in { x, y, z, tau, px, py, pz, E } but tau is not existing for all InternalParticles

Reimplemented from ParticleBase.

Reimplemented in Resonance.

Definition at line 313 of file InternalParticle.cc.

◆ projectGeoConstraint()

ErrCode projectGeoConstraint ( const FitParams fitparams,
Projection p 
) const
virtualinherited

project geometrical constraint

the direction of the momentum is very well known from the kinematic constraints that is why we do not extract the distance as a vector here

Definition at line 359 of file ParticleBase.cc.

◆ projectMassConstraintDaughters()

ErrCode projectMassConstraintDaughters ( const FitParams fitparams,
Projection p 
) const
virtualinherited

project mass constraint using the parameters of the daughters

be aware that the signs here are important E-|p|-m extracts a negative mass and messes with the momentum !

Definition at line 435 of file ParticleBase.cc.

◆ projectMassConstraintParticle()

ErrCode projectMassConstraintParticle ( const FitParams fitparams,
Projection p 
) const
virtualinherited

project mass constraint using the particles parameters

be aware that the signs here are important E-|p|-m extracts a negative mass and messes with the momentum !

Definition at line 496 of file ParticleBase.cc.

◆ tauIndex()

int tauIndex ( ) const
overridevirtual

tau index in fit params only if it has a mother

only exists if particle is geo cosntraint and has a mother

Reimplemented from ParticleBase.

Reimplemented in Resonance.

Definition at line 307 of file InternalParticle.cc.

◆ updateIndex()

void updateIndex ( int &  offset)
virtualinherited

this sets the index for momentum, position, etc.

in the statevector

Definition at line 138 of file ParticleBase.cc.


The documentation for this class was generated from the following files:
TreeFitter::InternalParticle::m_isconversion
bool m_isconversion
is conversion
Definition: InternalParticle.h:122
Belle2::Particle::getVertex
TVector3 getVertex() const
Returns vertex position (POCA for charged, IP for neutral FS particles)
Definition: Particle.h:529
TreeFitter::InternalParticle::dim
virtual int dim() const override
space reserved in fit params, if has mother then it has tau
Definition: InternalParticle.cc:292
TreeFitter::HelixUtils::helixPoca
static double helixPoca(const Belle2::Helix &helix1, const Belle2::Helix &helix2, double &flt1, double &flt2, TVector3 &vertex, bool parallel=false)
POCA between two tracks.
Definition: HelixUtils.cc:238
TreeFitter::ConstraintConfiguration::m_originDimension
const int m_originDimension
dimension of the origin constraint and ALL geometric gcosntraints
Definition: ConstraintConfiguration.h:113
TreeFitter::ParticleBase::posIndex
virtual int posIndex() const
get vertex index (in statevector!)
Definition: ParticleBase.h:142
TreeFitter::InternalParticle::compTrkTransverseMomentum
static bool compTrkTransverseMomentum(const RecoTrack *lhs, const RecoTrack *rhs)
compare transverse track momentum
Definition: InternalParticle.cc:80
Belle2::CDC::Helix
Helix parameter class.
Definition: Helix.h:51
TreeFitter::InternalParticle::initMomentum
ErrCode initMomentum(FitParams &fitparams) const
init momentum of *this and daughters
Definition: InternalParticle.cc:185
TreeFitter::ParticleBase::mother
const ParticleBase * mother() const
getMother() / hasMother()
Definition: ParticleBase.cc:295
Belle2::Const::ChargedStable
Provides a type-safe way to pass members of the chargedStableSet set.
Definition: Const.h:465
TreeFitter::InternalParticle::hasPosition
virtual bool hasPosition() const override
has position index
Definition: InternalParticle.cc:329
TreeFitter::ParticleBase::collectVertexDaughters
void collectVertexDaughters(std::vector< ParticleBase * > &particles, int posindex)
get vertex daughters
Definition: ParticleBase.cc:257
TreeFitter::ParticleBase::m_config
const ConstraintConfiguration * m_config
has all the constraint config
Definition: ParticleBase.h:237
TreeFitter::ParticleBase::particle
Belle2::Particle * particle() const
get basf2 particle
Definition: ParticleBase.h:109
TreeFitter::ParticleBase::m_daughters
std::vector< ParticleBase * > m_daughters
daughter container
Definition: ParticleBase.h:231
TreeFitter::InternalParticle::posIndex
virtual int posIndex() const override
position index in fit params
Definition: InternalParticle.cc:286