~chris-rogers/maus/emr_mc_digitization

« back to all changes in this revision

Viewing changes to src/common_cpp/Recon/Global/MinuitTrackFitter.hh

  • Committer: Chris Rogers
  • Date: 2014-04-16 11:48:45 UTC
  • mfrom: (707 merge)
  • mto: This revision was merged to the branch mainline in revision 711.
  • Revision ID: chris.rogers@stfc.ac.uk-20140416114845-h3u3q7pdcxkxvovs
Update to trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk/projects/maus
 
2
 *
 
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.
 
7
 *
 
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.
 
12
 *
 
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/>.
 
15
 *
 
16
 */
 
17
/* Author: Peter Lane
 
18
 */
 
19
 
 
20
#ifndef SRC_COMMON_CPP_OPTICS_RECONSTRUCTION_MINUIT_TRACK_FITTER_HH
 
21
#define SRC_COMMON_CPP_OPTICS_RECONSTRUCTION_MINUIT_TRACK_FITTER_HH
 
22
 
 
23
#include <string>
 
24
#include <vector>
 
25
 
 
26
#include "TMinuit.h"
 
27
#include "TObject.h"
 
28
 
 
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"
 
33
 
 
34
namespace MAUS {
 
35
 
 
36
class OpticsModel;
 
37
 
 
38
namespace DataStructure {
 
39
namespace Global {
 
40
  class Track;
 
41
  class TrackPoint;
 
42
}
 
43
}
 
44
 
 
45
namespace recon {
 
46
namespace global {
 
47
 
 
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;
 
51
 
 
52
void common_cpp_optics_recon_minuit_track_fitter_score_function(
 
53
    Int_t &    number_of_parameters,
 
54
    Double_t * gradiants,
 
55
    Double_t & function_value,
 
56
    Double_t * phase_space_coordinate_values,
 
57
    Int_t      execution_stage_flag);
 
58
 
 
59
class MinuitTrackFitter : public TrackFitter, public TObject {
 
60
 public:
 
61
  MinuitTrackFitter(MAUS::OpticsModel const * optics_model,
 
62
                    const double start_plane);
 
63
 
 
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);
 
68
 
 
69
  ~MinuitTrackFitter();
 
70
 
 
71
  static Double_t ScoreTrack(
 
72
      Double_t const * const start_plane_track_coordinates,
 
73
      const MAUS::OpticsModel & optics_model,
 
74
      const double mass,
 
75
      const std::vector<const MAUS::DataStructure::Global::TrackPoint *> &
 
76
                                                               detector_events);
 
77
 
 
78
  friend void common_cpp_optics_recon_minuit_track_fitter_score_function(
 
79
      Int_t &, Double_t *, Double_t &, Double_t *, Int_t);
 
80
 
 
81
 protected:
 
82
  static const size_t kPhaseSpaceDimension;
 
83
 
 
84
  size_t rounds_;
 
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_;
 
88
 
 
89
  void ResetParameters();
 
90
  static bool ValidVector(const MAUS::PhaseSpaceVector & guess,
 
91
                          const double mass);
 
92
  MinuitTrackFitter();
 
93
};
 
94
 
 
95
}  // namespace global
 
96
}  // namespace recon
 
97
}  // namespace MAUS
 
98
 
 
99
#endif