~christopher-hunt08/maus/maus_integrated_kalman

« back to all changes in this revision

Viewing changes to src/map/MapCppTrackerIntegratedTrackFit/MapCppTrackerIntegratedTrackFit.hh

  • Committer: Christopher Hunt
  • Date: 2018-07-04 14:12:12 UTC
  • Revision ID: christopher.hunt08@imperial.ac.uk-20180704141212-orzzl40mi53xc6kh
Added files for field integrated kalman filter. Now to test it...

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:8080/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
 
 
18
#ifndef _SRC_MAP_MAPCPPTrackerIntegratedTrackFit_H_
 
19
#define _SRC_MAP_MAPCPPTrackerIntegratedTrackFit_H_
 
20
 
 
21
// #define KALMAN_TEST
 
22
 
 
23
// C headers
 
24
#include <assert.h>
 
25
#include <json/json.h>
 
26
#include <CLHEP/Units/PhysicalConstants.h>
 
27
 
 
28
// C++ headers
 
29
#include <string>
 
30
#include <sstream>
 
31
#include <vector>
 
32
#include <map>
 
33
 
 
34
// Other headers
 
35
#include "Utils/Exception.hh"
 
36
#include "Utils/Squeak.hh"
 
37
#include "Config/MiceModule.hh"
 
38
#include "src/common_cpp/Utils/CppErrorHandler.hh"
 
39
#include "src/common_cpp/Utils/JsonWrapper.hh"
 
40
#include "src/common_cpp/Utils/Globals.hh"
 
41
#include "src/common_cpp/Globals/GlobalsManager.hh"
 
42
#include "src/common_cpp/JsonCppProcessors/SpillProcessor.hh"
 
43
#include "src/common_cpp/DataStructure/ReconEvent.hh"
 
44
 
 
45
#include "src/common_cpp/DataStructure/SciFiEvent.hh"
 
46
#include "src/common_cpp/DataStructure/Spill.hh"
 
47
#include "src/common_cpp/DataStructure/SciFiSeed.hh"
 
48
#include "src/common_cpp/Recon/SciFi/PatternRecognition.hh"
 
49
#include "src/common_cpp/Recon/Kalman/KalmanTrackFit.hh"
 
50
#include "src/common_cpp/Recon/Kalman/KalmanTrack.hh"
 
51
#include "src/common_cpp/Recon/Kalman/MAUSSciFiIntegratedPropagator.hh"
 
52
#include "src/common_cpp/Recon/Kalman/MAUSSciFiPropagators.hh"
 
53
#include "src/common_cpp/Recon/Kalman/MAUSSciFiMeasurements.hh"
 
54
#include "src/common_cpp/API/MapBase.hh"
 
55
 
 
56
namespace MAUS {
 
57
 
 
58
struct SciFiPlaneGeometry;
 
59
 
 
60
/** @class MapCppTrackerIntegratedTrackFit
 
61
 *  Perform the final tracker track fit using the Kalman filter
 
62
 *
 
63
 */
 
64
class MapCppTrackerIntegratedTrackFit : public MapBase<Data> {
 
65
 
 
66
 public:
 
67
  /** Constructor - initialises pointers to NULL */
 
68
  MapCppTrackerIntegratedTrackFit();
 
69
 
 
70
  /** Constructor - deletes any allocated memory */
 
71
  ~MapCppTrackerIntegratedTrackFit();
 
72
 
 
73
 private:
 
74
  /** Sets up the worker
 
75
   *
 
76
   *  \param argJsonConfigDocument a JSON document with
 
77
   *         the configuration.
 
78
   */
 
79
  void _birth(const std::string& argJsonConfigDocument);
 
80
 
 
81
  /** Shutdowns the worker
 
82
   *
 
83
   *  This takes no arguments and does nothing
 
84
   */
 
85
  void _death();
 
86
 
 
87
  /** Process MAUS data object
 
88
   *
 
89
   *  Receive a data object with digits (either MC or real) and then call the higher level
 
90
   *  reconstruction algorithms
 
91
   *
 
92
   * \param document a line/spill from the JSON input
 
93
   */
 
94
  void _process(Data* data) const;
 
95
 
 
96
  /** Performs the final track fit
 
97
   *
 
98
   *  Track fit takes the spacepoints from Pattern Recognition and, going back to the clusters
 
99
   *  which formed the spacepoints, fits the tracks more acurately using a Kalman filter
 
100
   *
 
101
   *  \param evt the current SciFiEvent
 
102
   */
 
103
  SciFiTrack* track_fit_helix(MAUS::SciFiSeed* seed) const;
 
104
 
 
105
  SciFiTrack* track_fit_straight(MAUS::SciFiSeed* seed) const;
 
106
 
 
107
  SciFiTrack* make_empty(SciFiSeed* seed) const;
 
108
  /** 
 
109
    * @brief Rates the track based on the outcome of the reconstruction
 
110
    */
 
111
  void calculate_track_rating(SciFiTrack* track) const;
 
112
 
 
113
 private:
 
114
 
 
115
  void _set_field_values(SciFiEvent* event) const;
 
116
 
 
117
  /// This will contain the configuration
 
118
  Json::Value _configJSON;
 
119
 
 
120
  // Various options and parameters
 
121
  bool _kalman_on;
 
122
  bool _use_mcs;
 
123
  bool _use_eloss;
 
124
  bool _use_patrec_seed;
 
125
  bool _correct_pz;
 
126
  int _excellent_num_trackpoints;
 
127
  int _good_num_trackpoints;
 
128
  int _poor_num_trackpoints;
 
129
  double _excellent_p_value;
 
130
  double _good_p_value;
 
131
  double _poor_p_value;
 
132
  int _excellent_num_spacepoints;
 
133
  int _good_num_spacepoints;
 
134
  int _poor_num_spacepoints;
 
135
  double _seed_value;
 
136
 
 
137
  /// Kalman Track Fitter Object
 
138
  Kalman::TrackFit* _helical_track_fitter;
 
139
  Kalman::TrackFit* _straight_track_fitter;
 
140
 
 
141
  SciFiHelicalMeasurements* _helical_measurement;
 
142
  SciFiStraightMeasurements* _straight_measurement;
 
143
 
 
144
  int SciFiRunRecon;
 
145
}; // Don't forget this trailing colon!!!!
 
146
 
 
147
} // ~namespace MAUS
 
148
 
 
149
#endif