Belle II Software  release-05-01-25
FeedthroughParticle.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2020 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributor: Francesco Tenchini, Jo-Frederik Krohn, Fabian Krinner *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include <analysis/dataobjects/Particle.h>
12 #include <analysis/VertexFitting/TreeFitter/FeedthroughParticle.h>
13 #include <analysis/VertexFitting/TreeFitter/FitParams.h>
14 #include <framework/logging/Logger.h>
15 
16 using std::vector;
17 
18 namespace TreeFitter {
19 
21  const ParticleBase* mother,
22  const ConstraintConfiguration& config,
23  bool forceFitAll
24  ) :
25  ParticleBase(particle, mother, &config)
26  {
27  if (particle) {
28  if (particle->getNDaughters() != 1) {
29  B2ERROR("FeedthroughParticles can only be initialized with a single daughter.");
30  }
31  addDaughter(particle->getDaughters()[0], config, forceFitAll);
32  } else {
33  B2ERROR("Trying to create a FeedthroughParticle from NULL. This should never happen.");
34  }
35  }
36 
38  {
39  ErrCode status;
40 
41  for (ParticleBase* daughter : m_daughters) {
42  status |= daughter->initMotherlessParticle(fitparams);
43  }
44  for (ParticleBase* daughter : m_daughters) {
45  daughter->initParticleWithMother(fitparams);
46  }
47  return status;
48  }
49 
51  {
52  ErrCode status;
53  status |= m_daughters[0]->initCovariance(fitparams);
54  return status;
55  }
56 
58  int depth) const
59  {
60  for (ParticleBase* daughter : m_daughters) {
61  daughter->addToConstraintList(list, depth - 1);
62  }
63  }
64 
66  {
67  int rc = -1;
68  if (m_daughters.size()) {
69  rc = m_daughters[0]->posIndex();
70  }
71  return rc;
72  }
73 
75  {
76  int rc = -1;
77  if (m_daughters.size()) {
78  rc = m_daughters[0]->momIndex();
79  }
80  return rc;
81  }
82 
83 
84 
85 }
86 
TreeFitter::ConstraintConfiguration
constainer
Definition: ConstraintConfiguration.h:25
TreeFitter::ErrCode
abstract errorocode be aware that the default is succes
Definition: ErrCode.h:23
TreeFitter::ParticleBase
base class for all particles
Definition: ParticleBase.h:36
TreeFitter::FitParams
Class to store and manage fitparams (statevector)
Definition: FitParams.h:29
TreeFitter::FeedthroughParticle::initCovariance
virtual ErrCode initCovariance(FitParams &) const override
init covariance matrix, do nothing, since the particle is just a feedthrough
Definition: FeedthroughParticle.cc:50
TreeFitter::FeedthroughParticle::posIndex
int posIndex() const override
take posIndex from daughter
Definition: FeedthroughParticle.cc:65
Belle2::Particle::getDaughters
std::vector< Belle2::Particle * > getDaughters() const
Returns a vector of pointers to daughter particles.
Definition: Particle.cc:601
Belle2::Particle::getNDaughters
unsigned getNDaughters(void) const
Returns number of daughter particles.
Definition: Particle.h:625
TreeFitter::FeedthroughParticle::addToConstraintList
virtual void addToConstraintList(constraintlist &alist, int depth) const override
add to constraint list
Definition: FeedthroughParticle.cc:57
TreeFitter::ParticleBase::constraintlist
std::vector< Constraint > constraintlist
alias
Definition: ParticleBase.h:69
TreeFitter::FeedthroughParticle::momIndex
int momIndex() const override
take momIndex from daughter
Definition: FeedthroughParticle.cc:74
Belle2::Particle
Class to store reconstructed particles.
Definition: Particle.h:77
TreeFitter::FeedthroughParticle::FeedthroughParticle
FeedthroughParticle(Belle2::Particle *particle, const ParticleBase *mother, const ConstraintConfiguration &config, bool forceFitAll)
Constructor.
Definition: FeedthroughParticle.cc:20
TreeFitter::FeedthroughParticle::initMotherlessParticle
virtual ErrCode initMotherlessParticle(FitParams &) override
init particle that does not need a mother vertex
Definition: FeedthroughParticle.cc:37
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::ParticleBase::addDaughter
virtual ParticleBase * addDaughter(Belle2::Particle *, const ConstraintConfiguration &config, bool forceFitAll=false)
add daughter
Definition: ParticleBase.cc:119