Belle II Software  release-06-01-15
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 // DataObjects
20 #include <analysis/dataobjects/ParticleList.h>
21 #include <mdst/dbobjects/BeamSpot.h>
22 
23 // KFit
24 #include <analysis/VertexFitting/KFit/MassFitKFit.h>
25 #include <analysis/VertexFitting/KFit/FourCFitKFit.h>
26 #include <analysis/VertexFitting/KFit/MassFourCFitKFit.h>
27 #include <analysis/VertexFitting/KFit/MassPointingVertexFitKFit.h>
28 #include <analysis/VertexFitting/KFit/MassVertexFitKFit.h>
29 #include <analysis/VertexFitting/KFit/VertexFitKFit.h>
30 #include <analysis/VertexFitting/KFit/MakeMotherKFit.h>
31 
32 // Rave
33 #include <analysis/VertexFitting/RaveInterface/RaveSetup.h>
34 #include <analysis/VertexFitting/RaveInterface/RaveVertexFitter.h>
35 #include <analysis/VertexFitting/RaveInterface/RaveKinematicVertexFitter.h>
36 
37 namespace Belle2 {
43  class Particle;
44 
49 
50  public:
51 
56 
61  virtual void initialize() override;
62 
67  virtual void beginRun() override;
68 
72  virtual void event() override;
73 
74  private:
75 
77  std::string m_listName;
79  double m_Bfield;
80  std::string m_vertexFitter;
81  std::string m_fitType;
82  std::string m_withConstraint;
83  std::string m_decayString;
86  bool m_hasCovMatrix = false;
87  TVector3 m_BeamSpotCenter;
88  TMatrixDSym m_beamSpotCov;
90  double m_smearing;
91  std::vector<int> m_massConstraintList;
92  std::vector<std::string> m_massConstraintListParticlename;
99  bool doVertexFit(Particle* p);
100 
108  bool doKVertexFit(Particle* p, bool ipProfileConstraint, bool ipTubeConstraint);
109 
115  bool doKMassVertexFit(Particle* p);
116 
123 
129  bool doKMassFit(Particle* p);
130 
136  bool doKFourCFit(Particle* p);
137 
143  bool doKMassFourCFit(Particle* p);
144 
152 
160 
168 
176 
184 
192 
201  void updateMapOfTrackAndDaughter(unsigned& l, std::vector<std::vector<unsigned>>& pars, std::vector<unsigned>& pard,
202  std::vector<Particle*>& allparticles, const Particle* daughter);
203 
209  bool addChildofParticletoKFit(analysis::FourCFitKFit& kv, const Particle* particle);
210 
217  bool addChildofParticletoMassKFit(analysis::MassFourCFitKFit& kf, const Particle* particle, std::vector<unsigned>& particleId);
218 
223 
228 
233  bool fillFitParticles(const Particle* mother, std::vector<const Particle*>& fitChildren,
234  std::vector<const Particle*>& twoPhotonChildren);
235 
240  bool redoTwoPhotonDaughterMassFit(Particle* postFit, const Particle* preFit, const analysis::VertexFitKFit& kv) ;
241 
247  bool doRaveFit(Particle* mother);
248 
250  bool allSelectedDaughters(const Particle* mother, const std::vector<const Particle*>& tracksVertex);
251 
253  void findConstraintBoost(double cut);
254 
256  void smearBeamSpot(double width);
257  };
258 
260 } // Belle2 namespace
261 
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.
std::string m_withConstraint
additional constraint on vertex
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)
TVector3 m_BeamSpotCenter
Beam spot position.
DBObjPtr< BeamSpot > m_beamSpotDB
Beam spot database object.
std::string m_vertexFitter
Vertex Fitter name.
double m_confidenceLevel
required fit confidence level
DecayDescriptor m_decaydescriptor
Decay descriptor of decays to look for.
double m_Bfield
magnetic field from data base
double m_smearing
smearing width applied to IP tube
std::string m_fitType
type of the kinematic fit
StoreObjPtr< ParticleList > m_plist
particle list
Class to store reconstructed particles.
Definition: Particle.h:74
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:95
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.
VertexFitKFit is a derived class from KFitBase to perform vertex-constraint kinematical fit.
Definition: VertexFitKFit.h:32
bool makeKMassMother(analysis::MassFitKFit &kv, Particle *p)
Update mother particle after mass fit using KFit.
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.
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 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.
virtual void beginRun() override
Called when entering a new run.
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 doVertexFit(Particle *p)
Main steering routine.
bool doRaveFit(Particle *mother)
Fit using Rave.
bool doKMassFit(Particle *p)
Mass fit using KFit.
bool doKMassFourCFit(Particle *p)
MassFourC fit using KFit.
void findConstraintBoost(double cut)
calculate iptube constraint (quasi cylinder along boost direction) for RAVE fit
bool addChildofParticletoKFit(analysis::FourCFitKFit &kv, const Particle *particle)
Adds given particle's child to the FourCFitKFit.
void addIPProfileToKFit(analysis::VertexFitKFit &kv)
Adds IPProfile constraint to the vertex fit using KFit.
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
Abstract base class for different kinds of events.