Belle II Software development
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/ConstraintConfiguration.h>
13#include <analysis/VertexFitting/TreeFitter/FitParams.h>
14
15namespace TreeFitter {
16
18 const ParticleBase* mother,
19 const ConstraintConfiguration& config
20 ) :
21 Composite(particle, mother, config),
22 m_massconstraint(false)
23 {
24 m_massconstraint = std::find_if(config.m_massConstraintListPDG.begin(), config.m_massConstraintListPDG.end(),
25 [pdg = std::abs(m_particle->getPDGCode())](int val) {
26 return std::abs(val) == pdg;
27 }) != config.m_massConstraintListPDG.end()
28 or m_particle->hasExtraInfo("treeFitterMassConstraint");
29 }
30
32 {
33 return ErrCode(ErrCode::Status::success);
34 }
35
37 {
38 const int posindex = posIndex();
39 const int momindex = momIndex();
40
41 //quick map for parameters
42 int quickindexmap[7];
43 for (int i = 0; i < 3; ++i) {
44 quickindexmap[i] = posindex + i;
45 }
46 for (int i = 0; i < 4; ++i) {
47 quickindexmap[i + 3] = momindex + i;
48 }
49
50 // copy the 'measurement' -> this overwrites mother position !
51 for (int row = 0; row < dimM(); ++row) {
52 fitparams.getStateVector()(quickindexmap[row]) = m_params[row];
53 }
54 return ErrCode(ErrCode::Status::success);
55 }
56
58 {
59 ErrCode status;
60 switch (type) {
61 case Constraint::resonance:
62 status |= projectComposite(fitparams, p);
63 break;
64 default:
65 status |= ParticleBase::projectConstraint(type, fitparams, p);
66 }
67 return status;
68 }
69
70 std::string RecoResonance::parname(int index) const
71 {
72 return ParticleBase::parname(index + 4);
73 }
74
76 int depth) const
77 {
78 list.push_back(Constraint(this, Constraint::resonance, depth, dimM()));
79
80 if (m_massconstraint) {
81 list.push_back(Constraint(this, Constraint::mass, depth, 1, 3));
82 }
83 }
84}
Class to store reconstructed particles.
Definition Particle.h:76
int dimM() const
get dimension of measurement
Definition Composite.h:45
Composite(Belle2::Particle *bc, const ParticleBase *mother, const ConstraintConfiguration &config, bool massconstraint=false)
constructor
Definition Composite.cc:20
Eigen::Matrix< double, 7, 1 > m_params
column vector to store the measurement
Definition Composite.h:81
ErrCode projectComposite(const FitParams &fitparams, Projection &p) const
project this particle constraint
Definition Composite.cc:76
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
Belle2::Particle * particle() const
get basf2 particle
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
int index() const
get index
const ParticleBase * mother() const
getMother() / hasMother()
std::vector< Constraint > constraintlist
alias
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
virtual int momIndex() const override
get momentum index in statevector
virtual int type() const override
get type
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