Belle II Software light-2509-fornax
ParticleKinematicFitterModule.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#pragma once
10
11#include <framework/core/Module.h>
12#include <string>
13#include <analysis/DecayDescriptor/DecayDescriptor.h>
14
15// OrcaKinFit
16#include <analysis/OrcaKinFit/MomentumConstraint.h>
17#include <analysis/OrcaKinFit/RecoilMassConstraint.h>
18#include <analysis/OrcaKinFit/MassConstraint.h>
19
20// analysis dataobjects
21#include <framework/dataobjects/EventExtraInfo.h>
22#include <analysis/dataobjects/ParticleList.h>
23
24// framework datastore
25#include <framework/datastore/StoreObjPtr.h>
26
27// ROOT
28#include <Math/Vector4D.h>
29#include <TMatrixFSym.h>
30
31// CLHEOP
32#include <CLHEP/Matrix/SymMatrix.h>
33#include <CLHEP/Vector/LorentzVector.h>
34
35namespace Belle2 {
40 class Particle;
41 namespace OrcaKinFit {
42 class BaseFitter;
44 class TextTracer;
45
53
54 public:
55
60
65 virtual void initialize() override;
66
70 virtual void terminate() override;
71
75 virtual void event() override;
76
77 private:
78
79 // module parameters
80 std::string m_listName;
81 std::string m_prefix;
82 std::string m_kinematicFitter;
83 std::string m_orcaFitterEngine;
84 std::string m_orcaTracer;
85 std::string m_orcaConstraint;
95 double m_recoilMass;
96 double m_invMass;
97 std::vector<int> m_listAlternateMassHypo;
98 std::vector<bool> m_listDirectionOnlyParticles;
99
100 // internal variables
103 std::vector <double> m_unmeasuredLeptonFitObject;
104 std::vector <double> m_unmeasuredGammaFitObject;
106
107 // hard constraints
112
114
116
117 // UNUSED YET
118 std::string m_decayString;
120
123
126
129
135 bool doKinematicFit(Particle* p);
136
142 bool doOrcaKinFitFit(Particle* p);
143
147 bool fillFitParticles(Particle* mother, std::vector<Particle*>& particleChildren);
148
153 bool AddFour(Particle* mother);
154
163 void addParticleToOrcaKinFit(BaseFitter& fitter, Particle* particle, const int index, bool useOnlyDirection, int massHypoPDG);
164
170
176
181 void addTracerToFitter(BaseFitter& fitter);
182
186 void setConstraints();
187
191 ROOT::Math::PxPyPzEVector getLorentzVectorConstraints();
192
193
198 void resetFitter(BaseFitter& fitter);
199
206
213 void updateOrcaKinFitMother(BaseFitter& fitter, std::vector<Particle*>& particleChildren, Particle* mother);
214
215
221 bool updateOrcaKinFitDaughters(BaseFitter& fitter, Particle* mother);
222
231 void updateMapOfTrackAndDaughter(unsigned& l, std::vector<std::vector<unsigned>>& pars, std::vector<unsigned>& pard,
232 std::vector<Particle*>& allparticles, const Particle* daughter);
233
241 bool storeOrcaKinFitParticles(const std::string& fitSuffix, BaseFitter& fitter, std::vector<Particle*>& particleChildren,
242 Particle* mother);
243
244
249 CLHEP::HepSymMatrix getCLHEPMomentumErrorMatrix(Particle* particle);
250
255 CLHEP::HepSymMatrix getCLHEPMomentumVertexErrorMatrix(Particle* particle);
256
261 CLHEP::HepLorentzVector getCLHEPLorentzVector(Particle* particle);
262
267 ROOT::Math::PxPyPzEVector getLorentzVector(ParticleFitObject* fitobject);
268
274 float getFitObjectError(ParticleFitObject* fitobject, int ilocal);
275
280 TMatrixFSym getFitObjectCovMat(ParticleFitObject* fitobject);
281
286 TMatrixFSym getCovMat7(ParticleFitObject* fitobject);
287
292
297
298 };
299
300 }// end OrcaKinFit namespace
302} // Belle2 namespace
303
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
Module()
Constructor.
Definition Module.cc:30
Abstract base class for fitting engines of kinematic fits.
Definition BaseFitter.h:47
Implements constraint 0 = mass1 - mass2 - m.
Implements a constraint of the form efact*sum(E)+pxfact*sum(px)+pyfact*sum(py)+pzfact*sum(pz)=value.
bool fillFitParticles(Particle *mother, std::vector< Particle * > &particleChildren)
Fills valid particle's children (with valid error matrix) in the vector of Particles that will enter ...
void addFitObjectToConstraints(ParticleFitObject &fitobject)
Adds Orca fit object to the constraints.
void updateMapOfTrackAndDaughter(unsigned &l, std::vector< std::vector< unsigned > > &pars, std::vector< unsigned > &pard, std::vector< Particle * > &allparticles, const Particle *daughter)
update the map of daughter and tracks, find out which tracks belong to each daughter.
bool m_liftPhotonTheta
lift theta constraint of the 3CPhoton.
std::vector< double > m_unmeasuredLeptonFitObject
unmeasured fit object
bool AddFour(Particle *mother)
Added four vectors and calculated a covariance matrix for a combined particles.
std::string m_orcaConstraint
Constraint (softBeam, hardBeam (default))
std::string m_decayStringForNeutronVsAntiNeutron
n or nbar particle tag selection
int m_debugFitterLevel
internal debugging level (for New and Newton fitter only)
virtual void initialize() override
Initialize the Module.
CLHEP::HepSymMatrix getCLHEPMomentumVertexErrorMatrix(Particle *particle)
Returns particle's 7x7 momentum-vertex-error matrix as a HepSymMatrix.
MomentumConstraint m_hardConstraintE
hard beam constraint E
std::string m_prefix
prefix attached to extrainfo names
DecayDescriptor m_decaydescriptorForDirectionOnlyParticles
Decay descriptor of direction only particles selection.
bool m_debugFitter
activate internal debugging (for New and Newton fitter only)
void addParticleToOrcaKinFit(BaseFitter &fitter, Particle *particle, const int index, bool useOnlyDirection, int massHypoPDG)
Adds given particle to the OrcaKinFit.
void addUnmeasuredGammaToOrcaKinFit(BaseFitter &fitter)
Adds an unmeasured gamma (E, phi, theta) to the fit (-3C) stored as EventExtraInfo TODO.
std::string m_decayStringForAlternateMassParticles
alternate mass particles selection
MomentumConstraint m_hardConstraintPz
hard beam constraint pz
float getFitObjectError(ParticleFitObject *fitobject, int ilocal)
Returns fit object error on the parameter ilocal.
ROOT::Math::PxPyPzEVector getLorentzVectorConstraints()
Get constraints (at whatever stage before/after fitting)
std::vector< int > m_listAlternateMassHypo
index of particles where only direction is used
bool doOrcaKinFitFit(Particle *p)
Kinematic fit using OrcaKinFit.
bool m_add3CPhoton
add one photon with unmeasured energy to the fit (costs 1 constraints)
TMatrixFSym getTMatrixFSymMomentumErrorMatrix()
Returns particle's 7x7 momentum-error matrix as a TMatrixFSym.
DecayDescriptor m_decaydescriptorForAlternateMassParticles
Decay descriptor of alternate particles selection.
std::vector< double > m_unmeasuredGammaFitObject
unmeasured fit object
void addConstraintsToFitter(BaseFitter &fitter)
Adds Orca fit object to the constraints.
std::vector< bool > m_listDirectionOnlyParticles
pdg values for particles where different mass hypo.
void addTracerToFitter(BaseFitter &fitter)
Adds tracer to the fitter.
RecoilMassConstraint m_hardConstraintRecoilMass
hard recoil mass constraint
TMatrixFSym getTMatrixFSymMomentumVertexErrorMatrix()
Returns particle's 7x7 momentum-vertex-error matrix as a TMatrixFSym.
StoreObjPtr< EventExtraInfo > m_eventextrainfo
StoreObjPtr for the EventExtraInfo in this mode.
MomentumConstraint m_hardConstraintPy
hard beam constraint py
double m_recoilMass
Recoil mass for RecoilMass constraint.
CLHEP::HepLorentzVector getCLHEPLorentzVector(Particle *particle)
Returns particle's 4-momentum as a HepLorentzVector.
std::string m_decayStringForDirectionOnlyParticles
direction only particles selection
DecayDescriptor m_decaydescriptor
Decay descriptor of decays to look for.
TMatrixFSym getCovMat7(ParticleFitObject *fitobject)
Returns covariance matrix.
ROOT::Math::PxPyPzEVector getLorentzVector(ParticleFitObject *fitobject)
bool updateOrcaKinFitDaughters(BaseFitter &fitter, Particle *mother)
Update the daughters: momentum is sum of daughters TODO update covariance matrix.
void setConstraints()
Sets constraints, this is not connect to particles or a fitter at this stage.
bool m_addUnmeasuredPhoton
add one unmeasured photon to the fit (costs 3 constraints)
TMatrixFSym getFitObjectCovMat(ParticleFitObject *fitobject)
Returns covariance matrix.
bool storeOrcaKinFitParticles(const std::string &fitSuffix, BaseFitter &fitter, std::vector< Particle * > &particleChildren, Particle *mother)
store fit object information as ExtraInfo
CLHEP::HepSymMatrix getCLHEPMomentumErrorMatrix(Particle *particle)
Returns particle's 4x4 momentum-error matrix as a HepSymMatrix.
bool m_fixUnmeasuredPhotonToHER
fix the momentum of the unmeasured photon to HER
DecayDescriptor m_decaydescriptorForNeutronVsAntiNeutron
Decay descriptor of n or nbar particle tag selection.
StoreObjPtr< ParticleList > m_plist
StoreObjPtr for the particle list.
void updateOrcaKinFitMother(BaseFitter &fitter, std::vector< Particle * > &particleChildren, Particle *mother)
Update the mother: momentum is sum of daughters TODO update covariance matrix.
void resetFitter(BaseFitter &fitter)
Resets all objects associated with the OrcaKinFit fitter.
bool m_fixUnmeasuredPhotonToLER
fix the momentum of the unmeasured photon to LER
bool doKinematicFit(Particle *p)
Main steering routine for any kinematic fitter.
MomentumConstraint m_hardConstraintPx
hard beam constraint px
Class to store reconstructed particles.
Definition Particle.h:76
Type-safe access to single objects in the data store.
Definition StoreObjPtr.h:96
Abstract base class for different kinds of events.