Belle II Software development
V0Fitter.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#pragma once
9
10#include <framework/datastore/StoreArray.h>
11#include <framework/gearbox/Const.h>
12#include <mdst/dataobjects/TrackFitResult.h>
13#include <mdst/dataobjects/V0.h>
14#include <tracking/dataobjects/V0ValidationVertex.h>
15#include <tracking/dataobjects/RecoTrack.h>
16#include <genfit/Track.h>
17
18#include <Math/Vector3D.h>
19
20#include <utility>
21
22namespace genfit {
23 class MeasuredStateOnPlane;
24 class GFRaveVertex;
25 class Track;
26}
27
28namespace Belle2 {
39 class V0Fitter {
40 friend class V0FitterTest_GetTrackHypotheses_Test;
41 friend class V0FitterTest_EnableValidation_Test;
42 friend class V0FitterTest_InitializeCuts_Test;
43
44 public:
46 V0Fitter(const std::string& trackFitResultsName = "", const std::string& v0sName = "",
47 const std::string& v0ValidationVerticesName = "",
48 const std::string& recoTracksName = "",
49 const std::string& copiedRecoTracksName = "CopiedRecoTracks",
50 bool enableValidation = false);
51
53 void initializeCuts(double beamPipeRadius,
54 double vertexChi2CutOutside,
55 std::tuple<double, double> invMassRangeKshort,
56 std::tuple<double, double> invMassRangeLambda,
57 std::tuple<double, double> invMassRangePhoton);
58
64 void setFitterMode(int fitterMode);
65
67 bool fitAndStore(const Track* trackPlus, const Track* trackMinus, const Const::ParticleType& v0Hypothesis, bool& isForceStored,
68 bool& isHitRemoved);
69
71 std::pair<Const::ParticleType, Const::ParticleType> getTrackHypotheses(const Const::ParticleType& v0Hypothesis) const;
72
73 private:
74
89 bool vertexFitWithRecoTracks(const Track* trackPlus, const Track* trackMinus,
90 RecoTrack* recoTrackPlus, RecoTrack* recoTrackMinus,
91 const Const::ParticleType& v0Hypothesis,
92 unsigned int& hasInnerHitStatus, ROOT::Math::XYZVector& vertexPos,
93 const bool forceStore);
94
99 RecoTrack* copyRecoTrack(RecoTrack* origRecoTrack);
100
106 RecoTrack* copyRecoTrackAndFit(RecoTrack* origRecoTrack, const int trackPDG);
107
119 bool removeInnerHits(RecoTrack* prevRecoTrack, RecoTrack* recoTrack,
120 const int trackPDG, const ROOT::Math::XYZVector& vertexPosition);
121
127 int checkSharedInnermostCluster(const RecoTrack* recoTrackPlus, const RecoTrack* recoTrackMinus);
128
136 bool fitGFRaveVertex(genfit::Track& trackPlus, genfit::Track& trackMinus, genfit::GFRaveVertex& vertex);
137
139 bool extrapolateToVertex(genfit::MeasuredStateOnPlane& stPlus, genfit::MeasuredStateOnPlane& stMinus,
140 const ROOT::Math::XYZVector& vertexPosition);
141
144 bool extrapolateToVertex(genfit::MeasuredStateOnPlane& stPlus, genfit::MeasuredStateOnPlane& stMinus,
145 const ROOT::Math::XYZVector& vertexPosition, unsigned int& hasInnerHitStatus);
146
148 TrackFitResult* buildTrackFitResult(const genfit::Track& track, const RecoTrack* recoTrack,
149 const genfit::MeasuredStateOnPlane& msop, const double Bz,
150 const Const::ParticleType& trackHypothesis,
151 const int sharedInnermostCluster);
152
153
154 private:
156 std::string m_recoTracksName;
162
165 std::tuple<double, double> m_invMassRangeKshort;
166 std::tuple<double, double> m_invMassRangeLambda;
167 std::tuple<double, double> m_invMassRangePhoton;
171 };
172
174}
175
The ParticleType class for identifying different particle types.
Definition: Const.h:408
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
Accessor to arrays stored in the data store.
Definition: StoreArray.h:113
Values of the result of a track fit with a given particle hypothesis.
Class that bundles various TrackFitResults.
Definition: Track.h:25
V0Fitter class to create V0 mdst's from reconstructed tracks.
Definition: V0Fitter.h:39
bool m_useOnlyOneSVDHitPair
false only if the V0Fitter mode is 3
Definition: V0Fitter.h:170
void setFitterMode(int fitterMode)
set V0 fitter mode.
Definition: V0Fitter.cc:77
RecoTrack * copyRecoTrackAndFit(RecoTrack *origRecoTrack, const int trackPDG)
Create a copy of RecoTrack and fit the Track.
Definition: V0Fitter.cc:495
StoreArray< V0ValidationVertex > m_validationV0s
V0ValidationVertex (output, optional).
Definition: V0Fitter.h:160
StoreArray< RecoTrack > m_copiedRecoTracks
RecoTrack used to refit tracks (output)
Definition: V0Fitter.h:161
bool m_forcestore
true only if the V0Fitter mode is 1
Definition: V0Fitter.h:169
void initializeCuts(double beamPipeRadius, double vertexChi2CutOutside, std::tuple< double, double > invMassRangeKshort, std::tuple< double, double > invMassRangeLambda, std::tuple< double, double > invMassRangePhoton)
Initialize the cuts which will be applied during the fit and store process.
Definition: V0Fitter.cc:94
RecoTrack * copyRecoTrack(RecoTrack *origRecoTrack)
Create a copy of RecoTrack.
Definition: V0Fitter.cc:487
bool m_validation
Validation flag.
Definition: V0Fitter.h:155
std::pair< Const::ParticleType, Const::ParticleType > getTrackHypotheses(const Const::ParticleType &v0Hypothesis) const
Get track hypotheses for a given v0 hypothesis.
Definition: V0Fitter.cc:189
StoreArray< V0 > m_v0s
V0 (output).
Definition: V0Fitter.h:159
int checkSharedInnermostCluster(const RecoTrack *recoTrackPlus, const RecoTrack *recoTrackMinus)
Compare innermost hits of daughter pairs to check if they are the same (shared) or not.
Definition: V0Fitter.cc:625
TrackFitResult * buildTrackFitResult(const genfit::Track &track, const RecoTrack *recoTrack, const genfit::MeasuredStateOnPlane &msop, const double Bz, const Const::ParticleType &trackHypothesis, const int sharedInnermostCluster)
Build TrackFitResult of V0 Track and set relation to genfit Track.
Definition: V0Fitter.cc:165
StoreArray< TrackFitResult > m_trackFitResults
TrackFitResult (output).
Definition: V0Fitter.h:158
bool fitAndStore(const Track *trackPlus, const Track *trackMinus, const Const::ParticleType &v0Hypothesis, bool &isForceStored, bool &isHitRemoved)
Fit V0 with given hypothesis and store if fit was successful.
Definition: V0Fitter.cc:205
double m_beamPipeRadius
Radius where inside/outside beampipe is defined.
Definition: V0Fitter.h:163
bool vertexFitWithRecoTracks(const Track *trackPlus, const Track *trackMinus, RecoTrack *recoTrackPlus, RecoTrack *recoTrackMinus, const Const::ParticleType &v0Hypothesis, unsigned int &hasInnerHitStatus, ROOT::Math::XYZVector &vertexPos, const bool forceStore)
fit V0 vertex using RecoTrack's as inputs.
Definition: V0Fitter.cc:348
std::tuple< double, double > m_invMassRangePhoton
invariant mass cut for Photon.
Definition: V0Fitter.h:167
bool removeInnerHits(RecoTrack *prevRecoTrack, RecoTrack *recoTrack, const int trackPDG, const ROOT::Math::XYZVector &vertexPosition)
Remove inner hits from RecoTrack at once.
Definition: V0Fitter.cc:518
std::string m_recoTracksName
RecoTrackColName (input).
Definition: V0Fitter.h:156
bool extrapolateToVertex(genfit::MeasuredStateOnPlane &stPlus, genfit::MeasuredStateOnPlane &stMinus, const ROOT::Math::XYZVector &vertexPosition)
Extrapolate the fit results to the perigee to the vertex.
double m_vertexChi2CutOutside
Chi2 cut outside beampipe.
Definition: V0Fitter.h:164
StoreArray< RecoTrack > m_recoTracks
RecoTrack (input)
Definition: V0Fitter.h:157
bool fitGFRaveVertex(genfit::Track &trackPlus, genfit::Track &trackMinus, genfit::GFRaveVertex &vertex)
Fit the V0 vertex.
Definition: V0Fitter.cc:108
int m_v0FitterMode
0: store V0 at the first vertex fit, regardless of inner hits, 1: remove hits inside the V0 vertex po...
Definition: V0Fitter.h:168
std::tuple< double, double > m_invMassRangeKshort
invariant mass cut for Kshort.
Definition: V0Fitter.h:165
std::tuple< double, double > m_invMassRangeLambda
invariant mass cut for Lambda.
Definition: V0Fitter.h:166
Abstract base class for different kinds of events.