Belle II Software development
ParticleVertexFitterModule.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// framework - DataStore
16#include <framework/database/DBObjPtr.h>
17#include <framework/datastore/StoreObjPtr.h>
18
19#include <framework/geometry/B2Vector3.h>
20
21// DataObjects
22#include <analysis/dataobjects/ParticleList.h>
23#include <mdst/dbobjects/BeamSpot.h>
24
25// KFit
26#include <analysis/VertexFitting/KFit/MassFitKFit.h>
27#include <analysis/VertexFitting/KFit/FourCFitKFit.h>
28#include <analysis/VertexFitting/KFit/MassFourCFitKFit.h>
29#include <analysis/VertexFitting/KFit/MassPointingVertexFitKFit.h>
30#include <analysis/VertexFitting/KFit/MassVertexFitKFit.h>
31#include <analysis/VertexFitting/KFit/VertexFitKFit.h>
32#include <analysis/VertexFitting/KFit/MakeMotherKFit.h>
33#include <analysis/VertexFitting/KFit/RecoilMassKFit.h>
34
35// Rave
36#include <analysis/VertexFitting/RaveInterface/RaveSetup.h>
37#include <analysis/VertexFitting/RaveInterface/RaveVertexFitter.h>
38#include <analysis/VertexFitting/RaveInterface/RaveKinematicVertexFitter.h>
39
40namespace Belle2 {
46 class Particle;
47
52
53 public:
54
59
64 virtual void initialize() override;
65
70 virtual void beginRun() override;
71
75 virtual void event() override;
76
77 private:
78
80 std::string m_listName;
82 double m_Bfield;
83 std::string m_vertexFitter;
84 std::string m_fitType;
85 std::string m_withConstraint;
86 std::string m_decayString;
89 bool m_hasCovMatrix = false;
91 TMatrixDSym m_beamSpotCov;
93 double m_smearing;
94 double m_recoilMass;
95 std::vector<int> m_massConstraintList;
96 std::vector<std::string> m_massConstraintListParticlename;
103 bool doVertexFit(Particle* p);
104
112 bool doKVertexFit(Particle* p, bool ipProfileConstraint, bool ipTubeConstraint);
113
119 bool doKMassVertexFit(Particle* p);
120
127
133 bool doKMassFit(Particle* p);
134
140 bool doKFourCFit(Particle* p);
141
147 bool doKMassFourCFit(Particle* p);
148
154 bool doKRecoilMassFit(Particle* p);
155
163
171
179
187
195
203
211
220 void updateMapOfTrackAndDaughter(unsigned& l, std::vector<std::vector<unsigned>>& pars, std::vector<unsigned>& pard,
221 std::vector<Particle*>& allparticles, const Particle* daughter);
222
229
236 bool addChildofParticletoMassKFit(analysis::MassFourCFitKFit& kf, const Particle* particle, std::vector<unsigned>& particleId);
237
242
247
252 bool fillFitParticles(const Particle* mother, std::vector<const Particle*>& fitChildren,
253 std::vector<const Particle*>& twoPhotonChildren);
254
258 bool fillNotFitParticles(const Particle* mother, std::vector<const Particle*>& notFitChildren,
259 const std::vector<const Particle*>& fitChildren);
260
265 bool redoTwoPhotonDaughterMassFit(Particle* postFit, const Particle* preFit, const analysis::VertexFitKFit& kv) ;
266
272 bool doRaveFit(Particle* mother);
273
275 bool allSelectedDaughters(const Particle* mother, const std::vector<const Particle*>& tracksVertex);
276
278 void findConstraintBoost(double cut);
279
281 void smearBeamSpot(double width);
282
285 };
286
288} // Belle2 namespace
Class for accessing objects in the database.
Definition: DBObjPtr.h:21
The DecayDescriptor stores information about a decay tree or parts of a decay tree.
Base class for Modules.
Definition: Module.h:72
TMatrixDSym m_beamSpotCov
Beam spot covariance matrix.
bool makeKMassMother(analysis::MassFitKFit &kv, Particle *p)
Update mother particle after mass fit using KFit.
std::string m_withConstraint
additional constraint on vertex
bool doKMassPointingVertexFit(Particle *p)
Mass-constrained vertex fit with additional pointing constraint using KFit.
void smearBeamSpot(double width)
smear beam spot covariance
bool makeMassKFourCMother(analysis::MassFourCFitKFit &kv, Particle *p)
Update mother particle after MassFourC fit using KFit.
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 doKVertexFit(Particle *p, bool ipProfileConstraint, bool ipTubeConstraint)
Unconstrained vertex fit using KFit.
bool doKMassVertexFit(Particle *p)
Mass-constrained vertex fit using KFit.
virtual void initialize() override
Initialize the Module.
void addIPTubeToKFit(analysis::VertexFitKFit &kv)
Adds IPTube constraint to the vertex fit using KFit.
bool addChildofParticletoMassKFit(analysis::MassFourCFitKFit &kf, const Particle *particle, std::vector< unsigned > &particleId)
Adds given particle's child to the MassFourCFitKFit.
virtual void event() override
Event processor.
bool makeKMassPointingVertexMother(analysis::MassPointingVertexFitKFit &kv, Particle *p)
Update mother particle after mass-constrained vertex fit with additional pointing constraint using KF...
bool m_updateDaughters
flag for daughters update
std::string m_decayString
daughter particles selection
std::vector< std::string > m_massConstraintListParticlename
Name of the particles to be mass constraint (massfourC)
std::string m_listName
particle list name
std::vector< int > m_massConstraintList
PDG codes of the particles to be mass constraint (massfourC)
bool m_hasCovMatrix
flag for mother covariance matrix (PseudoFitter)
bool makeKVertexMother(analysis::VertexFitKFit &kv, Particle *p)
Update mother particle after unconstrained vertex fit using KFit.
bool redoTwoPhotonDaughterMassFit(Particle *postFit, const Particle *preFit, const analysis::VertexFitKFit &kv)
Combines preFit particle and vertex information from vertex fit kv to create new postFit particle.
bool makeKMassVertexMother(analysis::MassVertexFitKFit &kv, Particle *p)
Update mother particle after mass-constrained vertex fit using KFit.
bool makeKFourCMother(analysis::FourCFitKFit &kv, Particle *p)
Update mother particle after FourC fit using KFit.
bool fillFitParticles(const Particle *mother, std::vector< const Particle * > &fitChildren, std::vector< const Particle * > &twoPhotonChildren)
Fills valid particle's children (with valid error matrix) in the vector of Particles that will enter ...
bool doKFourCFit(Particle *p)
FourC fit using KFit.
B2Vector3D m_BeamSpotCenter
Beam spot position.
virtual void beginRun() override
Called when entering a new run.
bool doKRecoilMassFit(Particle *p)
RecoilMass fit using KFit.
DBObjPtr< BeamSpot > m_beamSpotDB
Beam spot database object.
bool doVertexFit(Particle *p)
Main steering routine.
std::string m_vertexFitter
Vertex Fitter name.
bool doRaveFit(Particle *mother)
Fit using Rave.
bool makeKRecoilMassMother(analysis::RecoilMassKFit &kf, Particle *p)
Update mother particle after RecoilMass fit using KFit.
bool doKMassFit(Particle *p)
Mass fit using KFit.
double m_recoilMass
recoil mass for constraint
double m_confidenceLevel
required fit confidence level
bool doKMassFourCFit(Particle *p)
MassFourC fit using KFit.
DecayDescriptor m_decaydescriptor
Decay descriptor of decays to look for.
bool fillNotFitParticles(const Particle *mother, std::vector< const Particle * > &notFitChildren, const std::vector< const Particle * > &fitChildren)
Fills valid particle's children (with valid error matrix) in the vector of Particles that will not en...
void findConstraintBoost(double cut)
calculate iptube constraint (quasi cylinder along boost direction) for RAVE fit
double m_Bfield
magnetic field from data base
bool addChildofParticletoKFit(analysis::FourCFitKFit &kv, const Particle *particle)
Adds given particle's child to the FourCFitKFit.
double getChi2TracksLBoost(const analysis::VertexFitKFit &kv)
calculate the chi2 using only lboost information of tracks
double m_smearing
smearing width applied to IP tube
std::string m_fitType
type of the kinematic fit
void addIPProfileToKFit(analysis::VertexFitKFit &kv)
Adds IPProfile constraint to the vertex fit using KFit.
StoreObjPtr< ParticleList > m_plist
particle list
bool allSelectedDaughters(const Particle *mother, const std::vector< const Particle * > &tracksVertex)
check if all the Daughters (o grand-daughters) are selected for the vertex fit
Class to store reconstructed particles.
Definition: Particle.h:75
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:96
FourCFitKFit is a derived class from KFitBase to perform 4 momentum-constraint kinematical fit.
Definition: FourCFitKFit.h:30
MassFitKFit is a derived class from KFitBase to perform mass-constraint kinematical fit.
Definition: MassFitKFit.h:33
MassFourCFitKFit is a derived class from KFitBase to perform mass and 4 momentum-constraint kinematic...
MassPointingVertexFitKFit is a derived class from KFitBase It performs a kinematical fit with three c...
MassVertexFitKFit is a derived class from KFitBase to perform mass-vertex-constraint kinematical fit.
RecoilMassKFit is a derived class from KFitBase to perform a kinematical fit with a recoil mass const...
VertexFitKFit is a derived class from KFitBase to perform vertex-constraint kinematical fit.
Definition: VertexFitKFit.h:34
Abstract base class for different kinds of events.