Belle II Software  release-08-01-10
RecoResonance.cc
1 /**************************************************************************
2  * basf2 (Belle II Analysis Software Framework) *
3  * Author: The Belle II Collaboration *
4  * External Contributor: Wouter Hulsbergen *
5  * *
6  * See git log for contributors and copyright holders. *
7  * This file is licensed under LGPL-3.0, see LICENSE.md. *
8  **************************************************************************/
9 
10 
11 #include <analysis/VertexFitting/TreeFitter/RecoResonance.h>
12 #include <analysis/VertexFitting/TreeFitter/FitParams.h>
13 
14 namespace TreeFitter {
15 
17  const ParticleBase* mother,
18  const ConstraintConfiguration& config
19  ) :
20  Composite(particle, mother, config),
21  m_massconstraint(false)
22  {
23  m_massconstraint = std::find(config.m_massConstraintListPDG.begin(), config.m_massConstraintListPDG.end(),
24  std::abs(m_particle->getPDGCode())) != config.m_massConstraintListPDG.end();
25  }
26 
28  {
29  return ErrCode(ErrCode::Status::success);
30  }
31 
33  {
34  const int posindex = posIndex();
35  const int momindex = momIndex();
36 
37  //quick map for parameters
38  int quickindexmap[7];
39  for (int i = 0; i < 3; ++i) {
40  quickindexmap[i] = posindex + i;
41  }
42  for (int i = 0; i < 4; ++i) {
43  quickindexmap[i + 3] = momindex + i;
44  }
45 
46  // copy the 'measurement' -> this overwrites mother position !
47  for (int row = 0; row < dimM(); ++row) {
48  fitparams.getStateVector()(quickindexmap[row]) = m_params[row];
49  }
50  return ErrCode(ErrCode::Status::success);
51  }
52 
54  {
55  ErrCode status;
56  switch (type) {
57  case Constraint::resonance:
58  status |= projectComposite(fitparams, p);
59  break;
60  default:
61  status |= ParticleBase::projectConstraint(type, fitparams, p);
62  }
63  return status;
64  }
65 
66  std::string RecoResonance::parname(int index) const
67  {
68  return ParticleBase::parname(index + 4);
69  }
70 
72  int depth) const
73  {
74  list.push_back(Constraint(this, Constraint::resonance, depth, dimM()));
75 
76  if (m_massconstraint) {
77  list.push_back(Constraint(this, Constraint::mass, depth, 1, 3));
78  }
79  }
80 }
Class to store reconstructed particles.
Definition: Particle.h:75
int getPDGCode(void) const
Returns PDG code.
Definition: Particle.h:426
A class for composite particles, where the daughters must be ignored by the fitter.
Definition: Composite.h:17
int dimM() const
get dimension of measurement
Definition: Composite.h:46
Eigen::Matrix< double, 7, 1 > m_params
column vector to store the measurement
Definition: Composite.h:82
ErrCode projectComposite(const FitParams &fitparams, Projection &p) const
project this particle constraint
Definition: Composite.cc:75
class to manage the order of constraints and their filtering
Definition: Constraint.h:20
Type
type of constraints the order of these constraints is important: it is the order in which they are ap...
Definition: Constraint.h:27
abstract errorocode be aware that the default is success
Definition: ErrCode.h:14
Class to store and manage fitparams (statevector)
Definition: FitParams.h:20
Eigen::Matrix< double, -1, 1, 0, MAX_MATRIX_SIZE, 1 > & getStateVector()
getter for the fit parameters/statevector
Definition: FitParams.h:65
base class for all particles
Definition: ParticleBase.h:25
virtual std::string parname(int index) const
get name of parameter i
virtual ErrCode projectConstraint(Constraint::Type, const FitParams &, Projection &) const
project constraint.
Belle2::Particle * m_particle
pointer to framework type
Definition: ParticleBase.h:192
int index() const
get index
Definition: ParticleBase.h:95
std::vector< Constraint > constraintlist
alias
Definition: ParticleBase.h:52
class to store the projected residuals and the corresponding jacobian as well as the covariance matri...
Definition: Projection.h:18
RecoResonance(Belle2::Particle *bc, const ParticleBase *mother, const ConstraintConfiguration &config)
constructor
virtual std::string parname(int index) const override
parameter name
virtual ErrCode projectConstraint(Constraint::Type, const FitParams &, Projection &) const override
project the constraint
bool m_massconstraint
has mass constraint
Definition: RecoResonance.h:59
virtual int momIndex() const override
get momentum index in statevector
Definition: RecoResonance.h:46
virtual int type() const override
get type
Definition: RecoResonance.h:40
virtual ErrCode initParticleWithMother(FitParams &fitparams) override
init particle in case it has a mother
virtual void addToConstraintList(constraintlist &list, int depth) const override
add to the list of constraints
virtual ErrCode initMotherlessParticle(FitParams &fitparams) override
init particle in case it has no mother
virtual int posIndex() const override
get position index in statevector x,y,z,tau,px,py,pz
Definition: RecoResonance.h:43