1
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk/projects/maus
3
* MAUS is free software: you can redistribute it and/or modify
4
* it under the terms of the GNU General Public License as published by
5
* the Free Software Foundation, either version 3 of the License, or
6
* (at your option) any later version.
8
* MAUS is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with MAUS. If not, see <http://www.gnu.org/licenses/>.
20
#ifndef SRC_COMMON_CPP_OPTICS_RECONSTRUCTION_MINUIT_TRACK_FITTER_HH
21
#define SRC_COMMON_CPP_OPTICS_RECONSTRUCTION_MINUIT_TRACK_FITTER_HH
29
#include "src/common_cpp/DataStructure/Global/ReconEnums.hh"
30
#include "src/common_cpp/Optics/CovarianceMatrix.hh"
31
#include "Recon/Global/TrackFitter.hh"
32
#include "Recon/Global/Particle.hh"
38
namespace DataStructure {
48
// Minuit requires a gobal, static function to minimize. This requires a
49
// global instance of TMinuit to use TMinuit::GetObjectFit().
50
TMinuit * common_cpp_optics_recon_minuit_track_fitter_minuit = NULL;
52
void common_cpp_optics_recon_minuit_track_fitter_score_function(
53
Int_t & number_of_parameters,
55
Double_t & function_value,
56
Double_t * phase_space_coordinate_values,
57
Int_t execution_stage_flag);
59
class MinuitTrackFitter : public TrackFitter, public TObject {
61
MinuitTrackFitter(MAUS::OpticsModel const * optics_model,
62
const double start_plane);
64
// pure virtual function from TrackFitter base class
65
void Fit(MAUS::DataStructure::Global::Track const * const raw_track,
66
MAUS::DataStructure::Global::Track * const track,
67
const std::string mapper_name);
71
static Double_t ScoreTrack(
72
Double_t const * const start_plane_track_coordinates,
73
const MAUS::OpticsModel & optics_model,
75
const std::vector<const MAUS::DataStructure::Global::TrackPoint *> &
78
friend void common_cpp_optics_recon_minuit_track_fitter_score_function(
79
Int_t &, Double_t *, Double_t &, Double_t *, Int_t);
82
static const size_t kPhaseSpaceDimension;
85
std::vector<const MAUS::DataStructure::Global::TrackPoint *> detector_events_;
86
std::vector<MAUS::DataStructure::Global::TrackPoint> reconstructed_points_;
87
MAUS::DataStructure::Global::PID particle_id_;
89
void ResetParameters();
90
static bool ValidVector(const MAUS::PhaseSpaceVector & guess,