Belle II Software  release-05-01-25
RecoPhoton Class Reference

representation of the photon constraint More...

#include <RecoPhoton.h>

Inheritance diagram for RecoPhoton:
Collaboration diagram for RecoPhoton:

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

 RecoPhoton (Belle2::Particle *bc, const ParticleBase *mother)
 constructor
 
virtual ~RecoPhoton ()
 destructor
 
virtual ErrCode initParticleWithMother (FitParams &fitparams) override
 init particle with mother
 
virtual ErrCode initMotherlessParticle (FitParams &fitparams) override
 init particle without mother
 
ErrCode initCovariance (FitParams &fitparams) const override
 init covariance
 
ErrCode initParams ()
 update or init params
 
ErrCode projectRecoConstraint (const FitParams &fitparams, Projection &p) const override
 project photon constraint More...
 
virtual int dimM () const override
 sets the size of the corresponding residual projection
 
virtual bool hasEnergy () const override
 how should the energy be calculated ? from momentum or from E ?

 
virtual int dim () const override
 set the size of the particle in the statevector
 
virtual int type () const override
 type
 
virtual void addToConstraintList (constraintlist &alist, int depth) const override
 add to list
 
virtual std::string parname (int index) const override
 name
 
virtual int momIndex () const override
 get momentum index
 
virtual ErrCode projectConstraint (Constraint::Type, const FitParams &, Projection &) const override
 abstract abstract projection
 
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
 
virtual void forceP4Sum (FitParams &) const
 force p4 sum conservation all allong the tree
 
virtual int posIndex () const
 get vertex index (in statevector!)
 
virtual int tauIndex () const
 get tau index
 
virtual bool hasPosition () const
 get false

 
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 bool useEnergy (const Belle2::Particle &cand)
 has energy in fit params?
 
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 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
 

Private Attributes

const int m_dim
 dimension of residuals and 'width' of H
 
bool m_init
 was initialized*
 
bool m_useEnergy
 has energy ins statevector
 
Eigen::Matrix< double, 1, 4 > m_clusterPars
 constrains measured params (x_c, y_c, z_c, E_c)
 
Eigen::Matrix< double, 4, 4 > m_covariance
 covariance (x_c,y_c,z_c,E_c) of measured pars
 
int m_i1
 index with the highest momentum. More...
 
int m_i2
 random other index
 
int m_i3
 another random index
 
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

representation of the photon constraint

Definition at line 25 of file RecoPhoton.h.

Member Function Documentation

◆ 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.

◆ 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.

◆ projectRecoConstraint()

ErrCode projectRecoConstraint ( const FitParams fitparams,
Projection p 
) const
overridevirtual

project photon constraint

m : decay vertex mother p : momentum photon c : position cluster so: m + p = c thus (tau converts p to the correct units): 0 = c - m - tau * p we have 3 geometric equations and eliminate tau using the dimension with the highest momentum (because we have to divide by that momentum) only downside is we have to figure out which dimension this is the 4th equation is the energy which we keep as: 0 = E - |p| just to be sure, essentially this is always zero because p is build from E

Implements RecoParticle.

Definition at line 171 of file RecoPhoton.cc.

171  :
172  * m + p = c
173  * thus (tau converts p to the correct units):
174  * 0 = c - m - tau * p
175  * we have 3 geometric equations and eliminate tau using the dimension with the highest momentum
176  * (because we have to divide by that momentum)
177  * only downside is we have to figure out which dimension this is
178  * the 4th equation is the energy which we keep as:
179  * 0 = E - |p|
180  * just to be sure, essentially this is always zero because p is build from E
181  * */
182 
183  const Eigen::Matrix<double, 1, 3> x_vertex = fitparams.getStateVector().segment(posindex, 3);
184  const Eigen::Matrix<double, 1, 3> p_vec = fitparams.getStateVector().segment(momindex, 3);
185 
186  if (0 == p_vec[m_i1]) { return ErrCode(ErrCode::photondimerror); }
187 
188  // p_vec[m_i1] must not be 0
189  const double elim = (m_clusterPars[m_i1] - x_vertex[m_i1]) / p_vec[m_i1];
190  const double mom = p_vec.norm();
191 
192  // r'
193  Eigen::Matrix<double, 3, 1> residual3 = Eigen::Matrix<double, 3, 1>::Zero(3, 1);
194  residual3(0) = m_clusterPars[m_i2] - x_vertex[m_i2] - p_vec[m_i2] * elim;
195  residual3(1) = m_clusterPars[m_i3] - x_vertex[m_i3] - p_vec[m_i3] * elim;
196  residual3(2) = m_clusterPars[3] - mom;
197 
198  // dr'/dm | m:={xc,yc,zc,Ec} the measured quantities
199  Eigen::Matrix<double, 3, 4> P = Eigen::Matrix<double, 3, 4>::Zero(3, 4);
200  // deriving by the cluster pars
201  P(0, m_i2) = 1;
202  P(0, m_i1) = - p_vec[m_i2] / p_vec[m_i1];
203 
204  P(1, m_i3) = 1;
205  P(1, m_i1) = - p_vec[m_i3] / p_vec[m_i1];
206  P(2, 3) = 1; // dE/dEc
207 
208  p.getResiduals().segment(0, 3) = residual3;
209 
210  p.getV() = P * m_covariance.selfadjointView<Eigen::Lower>() * P.transpose();
211 
212  // dr'/dm | m:={x,y,z,px,py,pz,E}
213  // x := x_vertex (decay vertex of mother)
214  p.getH()(0, posindex + m_i1) = p_vec[m_i2] / p_vec[m_i1];
215  p.getH()(0, posindex + m_i2) = -1.0;
216  p.getH()(0, posindex + m_i3) = 0;
217 
218  p.getH()(1, posindex + m_i1) = p_vec[m_i3] / p_vec[m_i1];
219  p.getH()(1, posindex + m_i2) = 0;
220  p.getH()(1, posindex + m_i3) = -1.0;
221 
222  // elim already devided by p_vec[m_i1]
223  p.getH()(0, momindex + m_i1) = p_vec[m_i2] * elim / p_vec[m_i1];
224  p.getH()(0, momindex + m_i2) = -1. * elim;
225  p.getH()(0, momindex + m_i3) = 0;
226 
227  p.getH()(1, momindex + m_i1) = p_vec[m_i3] * elim / p_vec[m_i1];
228  p.getH()(1, momindex + m_i2) = 0;
229  p.getH()(1, momindex + m_i3) = -1. * elim;
230 
231  p.getH()(2, momindex + m_i1) = -1. * p_vec[m_i1] / mom;
232  p.getH()(2, momindex + m_i2) = -1. * p_vec[m_i2] / mom;
233  p.getH()(2, momindex + m_i3) = -1. * p_vec[m_i3] / mom;
234  // the photon does not store an energy in the state vector
235  // so no p.getH()(2, momindex + 3) here
236 
237  return ErrCode(ErrCode::Status::success);
238  }
239 
240 }
241 
242 

◆ 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.

Member Data Documentation

◆ m_i1

int m_i1
private

index with the highest momentum.

We have to make sure this does not change during the fit.

Definition at line 96 of file RecoPhoton.h.


The documentation for this class was generated from the following files:
TreeFitter::RecoPhoton::m_clusterPars
Eigen::Matrix< double, 1, 4 > m_clusterPars
constrains measured params (x_c, y_c, z_c, E_c)
Definition: RecoPhoton.h:90
TreeFitter::RecoPhoton::m_i1
int m_i1
index with the highest momentum.
Definition: RecoPhoton.h:96
TreeFitter::RecoPhoton::m_covariance
Eigen::Matrix< double, 4, 4 > m_covariance
covariance (x_c,y_c,z_c,E_c) of measured pars
Definition: RecoPhoton.h:93
TreeFitter::RecoPhoton::m_i2
int m_i2
random other index
Definition: RecoPhoton.h:98
TreeFitter::RecoPhoton::m_i3
int m_i3
another random index
Definition: RecoPhoton.h:100