Belle II Software  release-05-01-25
ParticleBase.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributor: Wouter Hulsbergen, Francesco Tenchini, Jo-Frederik Krohn *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 //Creates a particle. Base class for all other particle classes.
12 
13 #include <TDatabasePDG.h>
14 
15 #include <analysis/VertexFitting/TreeFitter/ParticleBase.h>
16 #include <analysis/VertexFitting/TreeFitter/InternalParticle.h>
17 #include <analysis/VertexFitting/TreeFitter/RecoComposite.h>
18 #include <analysis/VertexFitting/TreeFitter/RecoResonance.h>
19 #include <analysis/VertexFitting/TreeFitter/RecoTrack.h>
20 #include <analysis/VertexFitting/TreeFitter/FeedthroughParticle.h>
21 #include <analysis/VertexFitting/TreeFitter/InternalTrack.h>
22 
23 #include <analysis/VertexFitting/TreeFitter/RecoPhoton.h>
24 #include <analysis/VertexFitting/TreeFitter/RecoKlong.h>
25 #include <analysis/VertexFitting/TreeFitter/Resonance.h>
26 #include <analysis/VertexFitting/TreeFitter/Origin.h>
27 #include <analysis/VertexFitting/TreeFitter/FitParams.h>
28 
29 #include <framework/geometry/BFieldManager.h>
30 
31 namespace TreeFitter {
32 
33  ParticleBase::ParticleBase(Belle2::Particle* particle, const ParticleBase* mother, const ConstraintConfiguration* config) :
34  m_particle(particle),
35  m_mother(mother),
36  m_isStronglyDecayingResonance(false),
37  m_config(config),
38  m_index(0),
39  m_pdgMass(particle->getPDGMass()),
40  m_pdgWidth(0),
41  m_pdgLifeTime(TDatabasePDG::Instance()->GetParticle(particle->getPDGCode())->Lifetime() * 1e9),
42  m_charge(0),
43  m_name("Unknown")
44  {
45  if (particle) {
46  m_isStronglyDecayingResonance = isAResonance(particle);
47  const int pdgcode = particle->getPDGCode();
48  if (pdgcode) { // PDG code != 0
49 
50  double fltcharge = particle->getCharge();
51 
52  // round to nearest integer
53  m_charge = fltcharge < 0 ? int(fltcharge - 0.5) : int(fltcharge + 0.5);
54  m_name = particle->getName();
55  } else {// PDG code = 0
56  m_charge = particle->getCharge() > 0 ? 1 : (particle->getCharge() < 0 ? -1 : 0);
57  }
58  }
59  }
60 
61  ParticleBase::ParticleBase(Belle2::Particle* particle, const ParticleBase* mother) :
62  m_particle(particle),
63  m_mother(mother),
64  m_isStronglyDecayingResonance(false),
65  m_config(nullptr),
66  m_index(0),
67  m_pdgMass(particle->getPDGMass()),
68  m_pdgWidth(0),
69  m_pdgLifeTime(TDatabasePDG::Instance()->GetParticle(particle->getPDGCode())->Lifetime() * 1e9),
70  m_charge(0),
71  m_name("Unknown")
72  {
73  if (particle) {
74  m_isStronglyDecayingResonance = isAResonance(particle);
75  const int pdgcode = particle->getPDGCode();
76  if (pdgcode) { // PDG code != 0
77 
78  double fltcharge = particle->getCharge();
79 
80  // round to nearest integer
81  m_charge = fltcharge < 0 ? int(fltcharge - 0.5) : int(fltcharge + 0.5);
82  m_name = particle->getName();
83  } else {// PDG code = 0
84  m_charge = particle->getCharge() > 0 ? 1 : (particle->getCharge() < 0 ? -1 : 0);
85  }
86  }
87  }
88 
89  ParticleBase::ParticleBase(const std::string& name) :
90  m_particle(nullptr),
91  m_mother(nullptr),
92  m_isStronglyDecayingResonance(false),
93  m_config(nullptr),
94  m_index(0),
95  m_pdgMass(0),
96  m_pdgWidth(0),
97  m_pdgLifeTime(0),
98  m_charge(0),
99  m_name(name)
100  {}
101 
102 
104  {
105  for (auto daughter : m_daughters) {
106  delete daughter;
107  }
108  m_daughters.clear();
109  }
110 
112  {
113  auto newDaughter = ParticleBase::createParticle(cand, this, config, forceFitAll);
114  m_daughters.push_back(newDaughter);
115  return m_daughters.back();
116  }
117 
118 
120  {
121  auto iter = std::find(m_daughters.begin(), m_daughters.end(), pb);
122  if (iter != m_daughters.end()) {
123  delete *iter;
124  m_daughters.erase(iter);
125  } else {
126  B2ERROR("Cannot remove particle, because not found ...");
127  }
128  }
129 
130  void ParticleBase::updateIndex(int& offset)
131  {
132  for (auto* daughter : m_daughters) {
133  daughter->updateIndex(offset);
134  }
135  m_index = offset;
136  offset += dim();
137  }
138 
140  Belle2::Particle* daughter,
141  const ConstraintConfiguration& config,
142  bool forceFitAll
143  )
144  {
145  return new Origin(daughter, config, forceFitAll);
146  }
147 
149  const ConstraintConfiguration& config, bool forceFitAll)
150  {
151  ParticleBase* rc = nullptr;
152 
153  if (!mother) { // 'head of tree' particles
154  if (!particle->getMdstArrayIndex()) { //0 means it's a composite
155  rc = new InternalParticle(particle, nullptr, config, forceFitAll);
156 
157  } else {
158 
159  rc = new InternalParticle(particle, nullptr, config,
160  forceFitAll); //FIXME obsolete not touching it now god knows where this might be needed
161 
162  }
163  } else if (particle->hasExtraInfo("bremsCorrected")) { // Has Bremsstrahlungs-recovery
164  if (particle->getExtraInfo("bremsCorrected") == 0.) { // No gammas assigned -> feedthrough
165  rc = new FeedthroughParticle(particle, mother, config, forceFitAll);
166  } else { // Got gammas -> Internal track
167  rc = new InternalTrack(particle, mother, config, forceFitAll, true, true); // Always mass-constrain brems tracks
168  }
169  } else if (particle->getMdstArrayIndex() ||
170  particle->getTrack() ||
171  particle->getECLCluster() ||
172  particle->getKLMCluster()) { // external particles and final states
173  if (particle->getTrack()) {
174  rc = new RecoTrack(particle, mother);
175  } else if (particle->getECLCluster()) {
176  rc = new RecoPhoton(particle, mother);
177 
178  } else if (particle->getKLMCluster()) {
179  rc = new RecoKlong(particle, mother);
180 
181  } else if (isAResonance(particle)) {
182  rc = new RecoResonance(particle, mother);
183 
184  } else {
185  rc = new InternalParticle(particle, mother, config, forceFitAll);
186 
187  }
188 
189  } else { // 'internal' particles
190 
191  if (false) { // fitted composites //JFK::eventually implement prefitting mechanic to prefit composites with other fitters
192  if (isAResonance(particle)) {
193 
194  rc = new RecoResonance(particle, mother);
195 
196  } else {
197  rc = new RecoComposite(particle, mother);
198  }
199 
200  } else { // unfitted composites
201 
202  if (isAResonance(particle)) {
203  rc = new Resonance(particle, mother, config, forceFitAll);
204 
205  } else {
206  rc = new InternalParticle(particle, mother, config, forceFitAll);
207  }
208  }
209  }
210  return rc;
211  }
212 
213 
215  {
216  int pdgcode = particle->getPDGCode();
217  double lifetime = 0;
218 
219  if (pdgcode) {
220  lifetime = TDatabasePDG::Instance()->GetParticle(pdgcode)->Lifetime() * 1e9;
221  }
222 
223  return lifetime ;
224  }
225 
226 
228  {
229  bool rc = false ;
230  const int pdgcode = std::abs(particle->getPDGCode());
231 
232  if (pdgcode && !(particle->getMdstArrayIndex())) {
233  switch (pdgcode) {
234  case 22: //photon conversion
235  rc = false;
236  break ;
237 
238  case -11: //bremsstrahlung
239  case 11:
240  rc = true ;
241  break ;
242  default: //everything with boosted flight length less than 1 micrometer
243  rc = (pdgcode && pdgLifeTime(particle) < 1e-5);
244  }
245  }
246  return rc ;
247  }
248 
249  void ParticleBase::collectVertexDaughters(std::vector<ParticleBase*>& particles, int posindex)
250  {
251  if (mother() && mother()->posIndex() == posindex) {
252  particles.push_back(this);
253  }
254 
255  for (auto* daughter : m_daughters) {
256  daughter->collectVertexDaughters(particles, posindex);
257  }
258  }
259 
260  ErrCode ParticleBase::initCovariance(FitParams& fitparams) const
261  {
262  // this is very sensitive and can heavily affect the efficiency of the fit
263  ErrCode status;
264 
265  const int posindex = posIndex();
266  if (posindex >= 0) {
267  for (int i = 0; i < 3; ++i) {
268  fitparams.getCovariance()(posindex + i, posindex + i) = 1;
269  }
270  }
271 
272  const int momindex = momIndex();
273  if (momindex >= 0) {
274  const int maxrow = hasEnergy() ? 4 : 3;
275  for (int i = 0; i < maxrow; ++i) {
276  fitparams.getCovariance()(momindex + i, momindex + i) = 10.;
277  }
278  }
279 
280  const int tauindex = tauIndex();
281  if (tauindex >= 0) {
282  fitparams.getCovariance()(tauindex, tauindex) = 1.;
283  }
284  return status;
285  }
286 
287  const ParticleBase* ParticleBase::mother() const
288  {
289  const ParticleBase* rc = m_mother;
290  while (rc && rc->type() == kFeedthroughParticle) {
291  rc = rc->mother();
292  }
293  return rc;
294  }
295 
296  std::string ParticleBase::parname(int thisindex) const
297  {
298  std::string rc = name();
299  switch (thisindex) {
300  case 0: rc += "_x "; break;
301  case 1: rc += "_y "; break;
302  case 2: rc += "_z "; break;
303  case 3: rc += "_tau"; break;
304  case 4: rc += "_px "; break;
305  case 5: rc += "_py "; break;
306  case 6: rc += "_pz "; break;
307  case 7: rc += "_E "; break;
308  default:;
309  }
310  return rc;
311  }
312 
313  const ParticleBase* ParticleBase::locate(Belle2::Particle* particle) const
314  {
315  const ParticleBase* rc = (m_particle == particle) ? this : nullptr;
316  if (!rc) {
317  for (auto* daughter : m_daughters) {
318  rc = daughter->locate(particle);
319  if (rc) {break;}
320  }
321  }
322  return rc;
323  }
324 
325  void ParticleBase::retrieveIndexMap(indexmap& map) const
326  {
327  map.push_back(std::pair<const ParticleBase*, int>(this, index()));
328  for (auto* daughter : m_daughters) {
329  daughter->retrieveIndexMap(map);
330  }
331  }
332 
333  double ParticleBase::chiSquare(const FitParams& fitparams) const
334  {
335  double rc = 0;
336  for (auto* daughter : m_daughters) {
337  rc += daughter->chiSquare(fitparams);
338  }
339  return rc;
340  }
341 
343  {
344  int rc = 0;
345  for (auto* daughter : m_daughters) {
346  rc += daughter->nFinalChargedCandidates();
347  }
348  return rc;
349  }
350 
352  {
353  assert(m_config);
354  // only allow 2d for head of tree particles that are beam constrained
355  const int dim = m_config->m_originDimension == 2 && std::abs(m_particle->getPDGCode()) == m_config->m_headOfTreePDG ? 2 : 3;
356  const int posindexmother = mother()->posIndex();
357  const int posindex = posIndex();
358  const int tauindex = tauIndex();
359  const int momindex = momIndex();
360 
361  const double tau = fitparams.getStateVector()(tauindex);
362  Eigen::Matrix < double, 1, -1, 1, 1, 3 > x_vec = fitparams.getStateVector().segment(posindex, dim);
363  Eigen::Matrix < double, 1, -1, 1, 1, 3 > x_m = fitparams.getStateVector().segment(posindexmother, dim);
364  Eigen::Matrix < double, 1, -1, 1, 1, 3 > p_vec = fitparams.getStateVector().segment(momindex, dim);
365  const double mom = p_vec.norm();
366  const double mom3 = mom * mom * mom;
367 
368  if (3 == dim) {
369  // we can already set these
370  //diagonal momentum
371  p.getH()(0, momindex) = tau * (p_vec(1) * p_vec(1) + p_vec(2) * p_vec(2)) / mom3 ;
372  p.getH()(1, momindex + 1) = tau * (p_vec(0) * p_vec(0) + p_vec(2) * p_vec(2)) / mom3 ;
373  p.getH()(2, momindex + 2) = tau * (p_vec(0) * p_vec(0) + p_vec(1) * p_vec(1)) / mom3 ;
374 
375  //offdiagonal momentum
376  p.getH()(0, momindex + 1) = - tau * p_vec(0) * p_vec(1) / mom3 ;
377  p.getH()(0, momindex + 2) = - tau * p_vec(0) * p_vec(2) / mom3 ;
378 
379  p.getH()(1, momindex + 0) = - tau * p_vec(1) * p_vec(0) / mom3 ;
380  p.getH()(1, momindex + 2) = - tau * p_vec(1) * p_vec(2) / mom3 ;
381 
382  p.getH()(2, momindex + 0) = - tau * p_vec(2) * p_vec(0) / mom3 ;
383  p.getH()(2, momindex + 1) = - tau * p_vec(2) * p_vec(1) / mom3 ;
384 
385  } else if (2 == dim) {
386 
387  // NOTE THAT THESE ARE DIFFERENT IN 2d
388  p.getH()(0, momindex) = tau * (p_vec(1) * p_vec(1)) / mom3 ;
389  p.getH()(1, momindex + 1) = tau * (p_vec(0) * p_vec(0)) / mom3 ;
390 
391  //offdiagonal momentum
392  p.getH()(0, momindex + 1) = - tau * p_vec(0) * p_vec(1) / mom3 ;
393  p.getH()(1, momindex + 0) = - tau * p_vec(1) * p_vec(0) / mom3 ;
394  } else {
395  B2FATAL("Dimension of Geometric constraint is not 2 or 3. This will crash many things. You should feel bad.");
396  }
397 
398  for (int row = 0; row < dim; ++row) {
399 
400  double posxmother = x_m(row);
401  double posx = x_vec(row);
402  double momx = p_vec(row);
403 
407  p.getResiduals()(row) = posxmother + tau * momx / mom - posx ;
408  p.getH()(row, posindexmother + row) = 1;
409  p.getH()(row, posindex + row) = -1;
410  p.getH()(row, tauindex) = momx / mom;
411  }
412 
413  return ErrCode(ErrCode::Status::success);
414  }
415 
416  void inline setExtraInfo(Belle2::Particle* part, const std::string& name, const double value)
417  {
418  if (part) {
419  if (part->hasExtraInfo(name)) {
420  part->setExtraInfo(name, value);
421  } else {
422  part->addExtraInfo(name, value);
423  }
424  }
425  }
426 
427  ErrCode ParticleBase::projectMassConstraintDaughters(const FitParams& fitparams,
428  Projection& p) const
429  {
430  const double mass = pdgMass();
431  const double mass2 = mass * mass;
432  double px = 0;
433  double py = 0;
434  double pz = 0;
435  double E = 0;
436 
437  // the parameters of the daughters must be used otherwise the mass constraint does not have an effect on the extracted daughter momenta
438  for (const auto* daughter : m_daughters) {
439  const int momindex = daughter->momIndex();
440  // in most cases the daughters will be final states so we cache the value to use it in the energy column
441  const double px_daughter = fitparams.getStateVector()(momindex);
442  const double py_daughter = fitparams.getStateVector()(momindex + 1);
443  const double pz_daughter = fitparams.getStateVector()(momindex + 2);
444 
445  px += px_daughter;
446  py += py_daughter;
447  pz += pz_daughter;
448  if (daughter->hasEnergy()) {
449  E += fitparams.getStateVector()(momindex + 3);
450  } else {
451  // final states dont have an energy index
452  const double m = daughter->pdgMass();
453  E += std::sqrt(m * m + px_daughter * px_daughter + py_daughter * py_daughter + pz_daughter * pz_daughter);
454  }
455  }
456 
460  p.getResiduals()(0) = mass2 - E * E + px * px + py * py + pz * pz;
461 
462  for (const auto* daughter : m_daughters) {
463  //dr/dx = d/dx m2-{E1+E2+...}^2+{p1+p2+...}^2 = 2*x (x= E or p)
464  const int momindex = daughter->momIndex();
465  p.getH()(0, momindex) = 2.0 * px;
466  p.getH()(0, momindex + 1) = 2.0 * py;
467  p.getH()(0, momindex + 2) = 2.0 * pz;
468 
469  if (daughter->hasEnergy()) {
470  p.getH()(0, momindex + 3) = -2.0 * E;
471  } else {
472  const double px_daughter = fitparams.getStateVector()(momindex);
473  const double py_daughter = fitparams.getStateVector()(momindex + 1);
474  const double pz_daughter = fitparams.getStateVector()(momindex + 2);
475  const double m = daughter->pdgMass();
476 
477  const double E_daughter = std::sqrt(m * m + px_daughter * px_daughter + py_daughter * py_daughter + pz_daughter * pz_daughter);
478  const double E_by_E_daughter = E / E_daughter;
479  p.getH()(0, momindex) -= 2.0 * E_by_E_daughter * px_daughter;
480  p.getH()(0, momindex + 1) -= 2.0 * E_by_E_daughter * py_daughter;
481  p.getH()(0, momindex + 2) -= 2.0 * E_by_E_daughter * pz_daughter;
482  }
483 
484  }
485  return ErrCode(ErrCode::Status::success);
486  }
487 
488  ErrCode ParticleBase::projectMassConstraintParticle(const FitParams& fitparams,
489  Projection& p) const
490  {
491  const double mass = pdgMass();
492  const double mass2 = mass * mass;
493  const int momindex = momIndex();
494  const double px = fitparams.getStateVector()(momindex);
495  const double py = fitparams.getStateVector()(momindex + 1);
496  const double pz = fitparams.getStateVector()(momindex + 2);
497  const double E = fitparams.getStateVector()(momindex + 3);
498 
502  p.getResiduals()(0) = mass2 - E * E + px * px + py * py + pz * pz;
503 
504  p.getH()(0, momindex) = 2.0 * px;
505  p.getH()(0, momindex + 1) = 2.0 * py;
506  p.getH()(0, momindex + 2) = 2.0 * pz;
507  p.getH()(0, momindex + 3) = -2.0 * E;
508 
509  // TODO 0 in most cases -> needs special treatment if width=0 to not crash chi2 calculation
510  // const double width = TDatabasePDG::Instance()->GetParticle(particle()->getPDGCode())->Width();
511  // transport measurement uncertainty into residual system
512  // f' = sigma_x^2 * (df/dx)^2
513  // p.getV()(0) = width * width * 4 * mass2;
514 
515  return ErrCode(ErrCode::Status::success);
516  }
517 
519  Projection& p) const
520  {
521  assert(m_config);
522  if (m_config->m_massConstraintType == 0) {
523  return projectMassConstraintParticle(fitparams, p);
524  } else {
525  return projectMassConstraintDaughters(fitparams, p);
526  }
527  }
528 
529  ErrCode ParticleBase::projectConstraint(Constraint::Type type, const FitParams& fitparams, Projection& p) const
530  {
531  ErrCode status;
532  if (type == Constraint::mass) {
533  return projectMassConstraint(fitparams, p);
534  } else {
535  B2FATAL("Trying to project constraint of ParticleBase type. This is undefined.");
536  }
537  return ErrCode(ErrCode::Status::badsetup);
538  }
539 
541  {
542  return (Belle2::BFieldManager::getField(TVector3(0, 0, 0)).Z() * Belle2::Const::speedOfLight);
543  }
544 
545  ErrCode ParticleBase::initTau(FitParams& fitparams) const
546  {
547  const int tauindex = tauIndex();
548  if (tauindex >= 0 && hasPosition()) {
549 
550  const int posindex = posIndex();
551  const int mother_ps_index = mother()->posIndex();
552  const int dim = m_config->m_originDimension; // TODO can we configure this to be particle specific?
553 
554  // tau has different meaning depending on the dimension of the constraint
555  // 2-> use x-y projection
556  const Eigen::Matrix < double, 1, -1, 1, 1, 3 > vertex_dist =
557  fitparams.getStateVector().segment(posindex, dim) - fitparams.getStateVector().segment(mother_ps_index, dim);
558  const Eigen::Matrix < double, 1, -1, 1, 1, 3 >
559  mom = fitparams.getStateVector().segment(posindex, dim) - fitparams.getStateVector().segment(mother_ps_index, dim);
560 
561  // if an intermediate vertex is not well defined by a track or so it will be initialised with 0
562  // same for the momentum of for example B0, it might be initialised with 0
563  // in those cases use pdg value
564  const double mom_norm = mom.norm();
565  const double dot = std::abs(vertex_dist.dot(mom));
566  const double tau = dot / mom_norm;
567  if (0 == mom_norm || 0 == dot) {
568  fitparams.getStateVector()(tauindex) = pdgTime() * Belle2::Const::speedOfLight / pdgMass();
569  } else {
570  fitparams.getStateVector()(tauindex) = tau;
571  }
572  }
573 
574  return ErrCode(ErrCode::Status::success);
575  }
576 } //end namespace TreeFitter
577 
Belle2::Particle::getPDGCode
int getPDGCode(void) const
Returns PDG code.
Definition: Particle.h:380
TreeFitter::ParticleBase::projectConstraint
virtual ErrCode projectConstraint(Constraint::Type, const FitParams &, Projection &) const
project constraint.
Definition: ParticleBase.cc:537
TreeFitter::ParticleBase::projectMassConstraint
virtual ErrCode projectMassConstraint(const FitParams &, Projection &) const
project mass constraint abstract
Definition: ParticleBase.cc:526
TreeFitter::ParticleBase::dim
virtual int dim() const =0
get dimension of constraint
TreeFitter::ParticleBase::name
const std::string & name() const
get name of the particle
Definition: ParticleBase.h:118
TreeFitter::ParticleBase::createParticle
static ParticleBase * createParticle(Belle2::Particle *particle, const ParticleBase *mother, const ConstraintConfiguration &config, bool forceFitAll=false)
create the according treeFitter particle obj for a basf2 particle type
Definition: ParticleBase.cc:156
Belle2::BFieldManager::getField
static void getField(const double *pos, double *field)
return the magnetic field at a given position.
Definition: BFieldManager.h:110
TreeFitter::ConstraintConfiguration::m_massConstraintType
const bool m_massConstraintType
const flag for the type of the mass constraint
Definition: ConstraintConfiguration.h:83
TreeFitter::ConstraintConfiguration
constainer
Definition: ConstraintConfiguration.h:25
TreeFitter::ParticleBase::nFinalChargedCandidates
virtual int nFinalChargedCandidates() const
number of charged candidates
Definition: ParticleBase.cc:350
TreeFitter::ParticleBase::locate
const ParticleBase * locate(Belle2::Particle *particle) const
get particle base from basf2 particle
Definition: ParticleBase.cc:321
TreeFitter::ParticleBase::ParticleBase
ParticleBase(Belle2::Particle *particle, const ParticleBase *mother, const ConstraintConfiguration *config)
default constructor
Definition: ParticleBase.cc:41
TreeFitter::ParticleBase::projectMassConstraintDaughters
virtual ErrCode projectMassConstraintDaughters(const FitParams &, Projection &) const
project mass constraint using the parameters of the daughters
Definition: ParticleBase.cc:435
TreeFitter::ErrCode
abstract errorocode be aware that the default is succes
Definition: ErrCode.h:23
TreeFitter::ParticleBase::type
virtual int type() const =0
get particle type
TreeFitter::ParticleBase::pdgMass
double pdgMass() const
get pdg mass
Definition: ParticleBase.h:164
TreeFitter::ParticleBase
base class for all particles
Definition: ParticleBase.h:36
TreeFitter::ParticleBase::chiSquare
virtual double chiSquare(const FitParams &) const
get chi2
Definition: ParticleBase.cc:341
TreeFitter::FitParams
Class to store and manage fitparams (statevector)
Definition: FitParams.h:29
TreeFitter::ParticleBase::~ParticleBase
virtual ~ParticleBase()
destructor, actually does something
Definition: ParticleBase.cc:111
TreeFitter::Origin
representation of the beamspot as a particle
Definition: Origin.h:30
TreeFitter::ConstraintConfiguration::m_headOfTreePDG
int m_headOfTreePDG
PDG code of the head particle.
Definition: ConstraintConfiguration.h:116
TreeFitter::FitParams::getStateVector
Eigen::Matrix< double, -1, 1, 0, MAX_MATRIX_SIZE, 1 > & getStateVector()
getter for the fit parameters/statevector
Definition: FitParams.h:74
TreeFitter::ParticleBase::initTau
ErrCode initTau(FitParams &par) const
initialises tau as a length
Definition: ParticleBase.cc:553
TreeFitter::ParticleBase::bFieldOverC
static double bFieldOverC()
Bz/c
Definition: ParticleBase.cc:548
Belle2::Particle::getKLMCluster
const KLMCluster * getKLMCluster() const
Returns the pointer to the KLMCluster object that was used to create this Particle (ParticleType == c...
Definition: Particle.cc:850
TreeFitter::ParticleBase::isAResonance
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...
Definition: ParticleBase.cc:235
Belle2::Const::speedOfLight
static const double speedOfLight
[cm/ns]
Definition: Const.h:568
TreeFitter::ParticleBase::createOrigin
static ParticleBase * createOrigin(Belle2::Particle *daughter, const ConstraintConfiguration &config, bool forceFitAll)
create a custom origin particle or a beamspot
Definition: ParticleBase.cc:147
TreeFitter::Constraint::Type
Type
type of constraints the order of these constraints is important: it is the order in which they are ap...
Definition: Constraint.h:36
TreeFitter::ParticleBase::index
int index() const
get index
Definition: ParticleBase.h:112
Belle2::Particle::getMdstArrayIndex
unsigned getMdstArrayIndex(void) const
Returns 0-based index of MDST store array object (0 for composite particles)
Definition: Particle.h:413
Belle2::Particle::getECLCluster
const ECLCluster * getECLCluster() const
Returns the pointer to the ECLCluster object that was used to create this Particle (if ParticleType =...
Definition: Particle.cc:816
TreeFitter::ConstraintConfiguration::m_originDimension
const int m_originDimension
dimension of the origin constraint and ALL geometric gcosntraints
Definition: ConstraintConfiguration.h:113
TreeFitter::InternalParticle
another unneccessary layer of abstraction
Definition: InternalParticle.h:26
TreeFitter::ParticleBase::projectGeoConstraint
virtual ErrCode projectGeoConstraint(const FitParams &, Projection &) const
project geometrical constraint
Definition: ParticleBase.cc:359
TreeFitter::ParticleBase::tauIndex
virtual int tauIndex() const
get tau index
Definition: ParticleBase.h:145
TreeFitter::ParticleBase::hasPosition
virtual bool hasPosition() const
get false
Definition: ParticleBase.h:155
Belle2::Particle::getExtraInfo
float getExtraInfo(const std::string &name) const
Return given value if set.
Definition: Particle.cc:1177
TreeFitter::ParticleBase::m_index
int m_index
index
Definition: ParticleBase.h:241
TreeFitter::ParticleBase::posIndex
virtual int posIndex() const
get vertex index (in statevector!)
Definition: ParticleBase.h:142
TreeFitter::ParticleBase::projectMassConstraintParticle
virtual ErrCode projectMassConstraintParticle(const FitParams &, Projection &) const
project mass constraint using the particles parameters
Definition: ParticleBase.cc:496
TreeFitter::ParticleBase::hasEnergy
virtual bool hasEnergy() const
get momentum dimension
Definition: ParticleBase.h:152
Belle2::Particle::getTrack
const Track * getTrack() const
Returns the pointer to the Track object that was used to create this Particle (ParticleType == c_Trac...
Definition: Particle.cc:770
TreeFitter::ParticleBase::initCovariance
virtual ErrCode initCovariance(FitParams &) const
init covariance matrix
Definition: ParticleBase.cc:268
TreeFitter::ParticleBase::parname
virtual std::string parname(int index) const
get name of parameter i
Definition: ParticleBase.cc:304
Belle2::Particle
Class to store reconstructed particles.
Definition: Particle.h:77
TreeFitter::ParticleBase::removeDaughter
virtual void removeDaughter(const ParticleBase *pb)
remove daughter
Definition: ParticleBase.cc:127
TreeFitter::ParticleBase::m_mother
const ParticleBase * m_mother
motherparticle
Definition: ParticleBase.h:228
TreeFitter::ParticleBase::m_particle
Belle2::Particle * m_particle
pointer to framework type
Definition: ParticleBase.h:225
TreeFitter::ParticleBase::mother
const ParticleBase * mother() const
getMother() / hasMother()
Definition: ParticleBase.cc:295
TreeFitter::ParticleBase::momIndex
virtual int momIndex() const
get momentum index
Definition: ParticleBase.h:148
TreeFitter::ParticleBase::retrieveIndexMap
virtual void retrieveIndexMap(indexmap &anindexmap) const
get index map
Definition: ParticleBase.cc:333
TreeFitter::ParticleBase::collectVertexDaughters
void collectVertexDaughters(std::vector< ParticleBase * > &particles, int posindex)
get vertex daughters
Definition: ParticleBase.cc:257
TreeFitter::ParticleBase::pdgLifeTime
double pdgLifeTime() const
get pdg lifetime
Definition: ParticleBase.h:170
TreeFitter::ParticleBase::updateIndex
virtual void updateIndex(int &offset)
this sets the index for momentum, position, etc.
Definition: ParticleBase.cc:138
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::Projection
class to store the projected residuals and the corresponding jacobian as well as the covariance matri...
Definition: Projection.h:27
TreeFitter::ParticleBase::pdgTime
double pdgTime() const
get Tau
Definition: ParticleBase.h:173
TreeFitter::ParticleBase::m_daughters
std::vector< ParticleBase * > m_daughters
daughter container
Definition: ParticleBase.h:231
Belle2::Particle::hasExtraInfo
bool hasExtraInfo(const std::string &name) const
Return wether the extra info with the given name is set.
Definition: Particle.cc:1154
TreeFitter::ParticleBase::addDaughter
virtual ParticleBase * addDaughter(Belle2::Particle *, const ConstraintConfiguration &config, bool forceFitAll=false)
add daughter
Definition: ParticleBase.cc:119