Belle II Software light-2411-aldebaran
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_prefix;
86 std::string m_kinematicFitter;
87 std::string m_orcaFitterEngine;
88 std::string m_orcaTracer;
89 std::string m_orcaConstraint;
99 double m_recoilMass;
100 double m_invMass;
102 // internal variables
105 std::vector <double> m_unmeasuredLeptonFitObject;
106 std::vector <double> m_unmeasuredGammaFitObject;
109 // hard constraints
119 // UNUSED YET
120 std::string m_decayString;
128 bool doKinematicFit(Particle* p);
129
135 bool doOrcaKinFitFit(Particle* p);
136
140 bool fillFitParticles(Particle* mother, std::vector<Particle*>& particleChildren);
141
146 bool AddFour(Particle* mother);
147
154 void addParticleToOrcaKinFit(BaseFitter& fitter, Particle* particle, const int index);
155
161
167
172 void addTracerToFitter(BaseFitter& fitter);
173
177 void setConstraints();
178
182 ROOT::Math::PxPyPzEVector getLorentzVectorConstraints();
183
184
189 void resetFitter(BaseFitter& fitter);
190
197
204 void updateOrcaKinFitMother(BaseFitter& fitter, std::vector<Particle*>& particleChildren, Particle* mother);
205
206
212 bool updateOrcaKinFitDaughters(BaseFitter& fitter, Particle* mother);
213
222 void updateMapOfTrackAndDaughter(unsigned& l, std::vector<std::vector<unsigned>>& pars, std::vector<unsigned>& pard,
223 std::vector<Particle*>& allparticles, const Particle* daughter);
224
232 bool storeOrcaKinFitParticles(const std::string& fitSuffix, BaseFitter& fitter, std::vector<Particle*>& particleChildren,
233 Particle* mother);
234
235
240 CLHEP::HepSymMatrix getCLHEPMomentumErrorMatrix(Particle* particle);
241
246 CLHEP::HepSymMatrix getCLHEPMomentumVertexErrorMatrix(Particle* particle);
247
252 CLHEP::HepLorentzVector getCLHEPLorentzVector(Particle* particle);
253
258 ROOT::Math::PxPyPzEVector getLorentzVector(ParticleFitObject* fitobject);
259
265 float getFitObjectError(ParticleFitObject* fitobject, int ilocal);
266
271 TMatrixFSym getFitObjectCovMat(ParticleFitObject* fitobject);
272
277 TMatrixFSym getCovMat7(ParticleFitObject* fitobject);
278
283
288
289 };
290
291 }// end OrcaKinFit namespace
293} // Belle2 namespace
294
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
std::string m_prefix
prefix attached to extrainfo names
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.
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
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 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