Belle II Software light-2406-ragdoll
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/BaseFitter.h>
17#include <analysis/OrcaKinFit/TextTracer.h>
18
19// Constraints
20#include <analysis/OrcaKinFit/MomentumConstraint.h>
21#include <analysis/OrcaKinFit/RecoilMassConstraint.h>
22#include <analysis/OrcaKinFit/MassConstraint.h>
23
24// Fitobjects
25#include <analysis/OrcaKinFit/ParticleFitObject.h>
26
27// analysis dataobjects
28#include <framework/dataobjects/EventExtraInfo.h>
29#include <analysis/dataobjects/ParticleList.h>
30
31// framework datastore
32#include <framework/datastore/StoreObjPtr.h>
33
34// ROOT
35#include <Math/Vector4D.h>
36#include <TMatrixFSym.h>
37
38// CLHEOP
39#include <CLHEP/Matrix/SymMatrix.h>
40#include <CLHEP/Vector/LorentzVector.h>
41
42namespace Belle2 {
47 class Particle;
48 namespace OrcaKinFit {
49
57
58 public:
59
64
69 virtual void initialize() override;
70
74 virtual void terminate() override;
75
79 virtual void event() override;
80
81 private:
82
83 // module parameters
84 std::string m_listName;
85 std::string m_kinematicFitter;
86 std::string m_orcaFitterEngine;
87 std::string m_orcaTracer;
88 std::string m_orcaConstraint;
98 double m_recoilMass;
99 double m_invMass;
101 // internal variables
104 std::vector <double> m_unmeasuredLeptonFitObject;
105 std::vector <double> m_unmeasuredGammaFitObject;
108 // hard constraints
118 // UNUSED YET
119 std::string m_decayString;
127 bool doKinematicFit(Particle* p);
128
134 bool doOrcaKinFitFit(Particle* p);
135
139 bool fillFitParticles(Particle* mother, std::vector<Particle*>& particleChildren);
140
145 bool AddFour(Particle* mother);
146
153 void addParticleToOrcaKinFit(BaseFitter& fitter, Particle* particle, const int index);
154
160
166
171 void addTracerToFitter(BaseFitter& fitter);
172
176 void setConstraints();
177
181 ROOT::Math::PxPyPzEVector getLorentzVectorConstraints();
182
183
188 void resetFitter(BaseFitter& fitter);
189
196
203 void updateOrcaKinFitMother(BaseFitter& fitter, std::vector<Particle*>& particleChildren, Particle* mother);
204
205
211 bool updateOrcaKinFitDaughters(BaseFitter& fitter, Particle* mother);
212
221 void updateMapOfTrackAndDaughter(unsigned& l, std::vector<std::vector<unsigned>>& pars, std::vector<unsigned>& pard,
222 std::vector<Particle*>& allparticles, const Particle* daughter);
223
231 bool storeOrcaKinFitParticles(const std::string& prefix, BaseFitter& fitter, std::vector<Particle*>& particleChildren,
232 Particle* mother);
233
234
239 CLHEP::HepSymMatrix getCLHEPMomentumErrorMatrix(Particle* particle);
240
245 CLHEP::HepSymMatrix getCLHEPMomentumVertexErrorMatrix(Particle* particle);
246
251 CLHEP::HepLorentzVector getCLHEPLorentzVector(Particle* particle);
252
257 ROOT::Math::PxPyPzEVector getLorentzVector(ParticleFitObject* fitobject);
258
264 float getFitObjectError(ParticleFitObject* fitobject, int ilocal);
265
270 TMatrixFSym getFitObjectCovMat(ParticleFitObject* fitobject);
271
276 TMatrixFSym getCovMat7(ParticleFitObject* fitobject);
277
282
287
288 };
289
290 }// end OrcaKinFit namespace
292} // Belle2 namespace
293
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
Base class for Modules.
Definition: Module.h:72
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))
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
bool m_debugFitter
activate internal debugging (for New and Newton fitter only)
void addUnmeasuredGammaToOrcaKinFit(BaseFitter &fitter)
Adds an unmeasured gamma (E, phi, theta) to the fit (-3C) stored as EventExtraInfo TODO.
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)
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.
std::vector< double > m_unmeasuredGammaFitObject
unmeasured fit object
void addConstraintsToFitter(BaseFitter &fitter)
Adds Orca fit object to the constraints.
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.
TextTracer * m_textTracer
internal text output variable
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.
CLHEP::HepSymMatrix getCLHEPMomentumErrorMatrix(Particle *particle)
Returns particle's 4x4 momentum-error matrix as a HepSymMatrix.
double m_invMass
Invariant mass for Mass constraint.
bool m_fixUnmeasuredPhotonToHER
fix the momentum of the unmeasured photon to HER
StoreObjPtr< ParticleList > m_plist
StoreObjPtr for the particle list.
void addParticleToOrcaKinFit(BaseFitter &fitter, Particle *particle, const int index)
Adds given particle to the OrcaKinFit.
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 storeOrcaKinFitParticles(const std::string &prefix, BaseFitter &fitter, std::vector< Particle * > &particleChildren, Particle *mother)
store fit object information as ExtraInfo
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:75
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
Abstract base class for different kinds of events.
Definition: ClusterUtils.h:24