Belle II Software  release-08-01-10
GblFitter.h
1 /* Copyright 2013
2  * Authors: Sergey Yashchenko and Tadeas Bilka
3  *
4  * This file is part of GENFIT.
5  *
6  * GENFIT is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published
8  * by the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * GENFIT is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public License
17  * along with GENFIT. If not, see <http://www.gnu.org/licenses/>.
18  */
23 #ifndef GblFitter_H
24 #define GblFitter_H
25 
26 #include "GblTrajectory.h"
27 #include "AbsFitter.h"
28 #include "AbsTrackRep.h"
29 #include "GblFitterInfo.h"
30 #include "GblFitStatus.h"
31 #include "GblTrackSegmentController.h"
32 
33 #include <map>
34 #include <iostream>
35 
36 #include <TMatrixD.h>
37 #include <assert.h>
38 #include <sstream>
39 
40 #include <TMath.h>
41 #include <TVector3.h>
42 
43 
44 namespace genfit {
45 
46  class GblTrackSegmentController;
47 
53  class GblFitter : public AbsFitter {
54 
55  private:
56  GblFitter(const GblFitter&);
57  GblFitter& operator=(GblFitter const&);
58 
59  std::string m_gblInternalIterations;
60  bool m_enableScatterers;
61  bool m_enableIntermediateScatterer;
62  unsigned int m_externalIterations;
63  unsigned int m_recalcJacobians;
64 
65  // Minimum scattering sigma (will be squared and inverted...)
66  double scatEpsilon;
67  GblTrackSegmentController* m_segmentController;
68 
69  public:
70 
74  GblFitter() : AbsFitter(), m_gblInternalIterations(""), m_enableScatterers(true), m_enableIntermediateScatterer(true), m_externalIterations(1), m_recalcJacobians(0), scatEpsilon(1.e-8), m_segmentController(nullptr) {;}
75 
79  virtual ~GblFitter();
80 
100  void setOptions(const std::string &internalIterations = "", bool enableScatterers = true, bool enableIntermediateScatterer = true, unsigned int externalIterations = 1, unsigned int recalcJacobians = 1) {
101  m_externalIterations = externalIterations;
102  m_gblInternalIterations = internalIterations;
103  m_recalcJacobians = recalcJacobians;
104  if (!enableScatterers)
105  enableIntermediateScatterer = false;
106  m_enableScatterers = enableScatterers;
107  m_enableIntermediateScatterer = enableIntermediateScatterer;
108  }
109 
110 
119  void setMSOptions(bool enableScatterers = true, bool enableIntermediateScatterer = true) {
120  if (!enableScatterers)
121  enableIntermediateScatterer = false;
122  m_enableScatterers = enableScatterers;
123  m_enableIntermediateScatterer = enableIntermediateScatterer;
124  }
125 
145  void getScattererFromMatList(double& length,
146  double& theta, double& s, double& ds,
147  const double p, const double mass, const double charge,
148  const std::vector<genfit::MatStep>& steps) const;
149 
155  void processTrackWithRep(Track* trk, const AbsTrackRep* rep, bool resortHits = false) override;
156 
165  double constructGblInfo(Track* trk, const AbsTrackRep* rep);
166 
189 
196  std::vector<gbl::GblPoint> collectGblPoints(genfit::Track* trk, const genfit::AbsTrackRep* rep);
197 
206  void cleanGblInfo(Track* trk, const AbsTrackRep* rep) const;
207 
215  void sortHits(Track* trk, const AbsTrackRep* rep) const;
216 
217  void setTrackSegmentController(GblTrackSegmentController* controler);
218 
219 
220  public:
221 
222  ClassDef(GblFitter, 2)
223 
224  };
225 
226 } /* End of namespace genfit */
229 #endif // GblFitter_H
230 
GblTrajectory definition.
GBL trajectory.
Definition: GblTrajectory.h:48
Abstract base class for fitters.
Definition: AbsFitter.h:35
Abstract base class for a track representation.
Definition: AbsTrackRep.h:66
Generic GBL implementation.
Definition: GblFitter.h:53
virtual ~GblFitter()
Destructor.
Definition: GblFitter.cc:90
void setOptions(const std::string &internalIterations="", bool enableScatterers=true, bool enableIntermediateScatterer=true, unsigned int externalIterations=1, unsigned int recalcJacobians=1)
Set options of the fitter/GBL.
Definition: GblFitter.h:100
void updateGblInfo(gbl::GblTrajectory &traj, genfit::Track *trk, const genfit::AbsTrackRep *rep)
Populate all fitter infos in track for rep with results of trajectory fit.
Definition: GblFitter.cc:289
double constructGblInfo(Track *trk, const AbsTrackRep *rep)
Propagate seed, populate track with scatterers and GblFitterInfos with reference state set.
Definition: GblFitter.cc:376
GblFitter()
Default (and only) constructor.
Definition: GblFitter.h:74
void setMSOptions(bool enableScatterers=true, bool enableIntermediateScatterer=true)
Set multiple scattering options of the fitter/GBL.
Definition: GblFitter.h:119
void processTrackWithRep(Track *trk, const AbsTrackRep *rep, bool resortHits=false) override
Performs fit on a Track.
Definition: GblFitter.cc:106
void sortHits(Track *trk, const AbsTrackRep *rep) const
Sort hits in track by arc-len using extrapolation.
Definition: GblFitter.cc:244
void getScattererFromMatList(double &length, double &theta, double &s, double &ds, const double p, const double mass, const double charge, const std::vector< genfit::MatStep > &steps) const
Evaluates moments of radiation length distribution from list of material steps and computes parameter...
Definition: GblFitter.cc:315
void cleanGblInfo(Track *trk, const AbsTrackRep *rep) const
Remove all previous gbl fitter data from track Also removes trackpoints without measurement.
Definition: GblFitter.cc:233
std::vector< gbl::GblPoint > collectGblPoints(genfit::Track *trk, const genfit::AbsTrackRep *rep)
Constructs all GBL points and returns them in vector for trajectory construction.
Definition: GblFitter.cc:274
TrackSegmentController for use with GblFitter.
Collection of TrackPoint objects, AbsTrackRep objects and FitStatus objects.
Definition: Track.h:71
Defines for I/O streams used for error and debug printing.