~jan.greis/maus/1811

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
/* This file is part of MAUS: http://micewww.pp.rl.ac.uk:8080/projects/maus
 *
 * MAUS is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * MAUS is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with MAUS.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef _SRC_COMMON_CPP_DATASTRUCTURE_SCIFITRACK_HH_
#define _SRC_COMMON_CPP_DATASTRUCTURE_SCIFITRACK_HH_

#include <TMatrixD.h>

// C++ headers
#include <vector>

// MAUS headers
#include "src/common_cpp/DataStructure/SciFiTrackPoint.hh"
#include "src/common_cpp/DataStructure/SciFiBasePRTrack.hh"
#include "src/common_cpp/DataStructure/SciFiStraightPRTrack.hh"
#include "src/common_cpp/DataStructure/SciFiHelicalPRTrack.hh"

namespace MAUS {

class SciFiTrack {
 public:
  /** @brief Constructor.
   */
  SciFiTrack();

  /** @brief Destructor, deletes the track points
   */
  virtual ~SciFiTrack();

  /** @brief Copy constructor, deeps copies the track points
   */
  SciFiTrack(const SciFiTrack &a_track);

  /** @brief Assignment operator, deeps copies the track points
   */
  SciFiTrack& operator=(const SciFiTrack &a_track);

  /** @brief Sets the tracker number.
   */
  void set_tracker(int tracker) { _tracker = tracker; }

  /** @brief Sets the filtered chi2.
   */
  void set_chi2(double chi2) { _chi2 = chi2; }

  /** @brief Sets the ndf for this track.
   */
  void set_ndf(int ndf)      { _ndf = ndf; }

  /** @brief Sets the P-value for the chi2 and ndf found.
   */
  void set_P_value(double p_value) { _P_value = p_value; }

  /** @brief Sets the charge of the fitted particle.
   */
  void set_charge(int charge) { _charge = charge; }

  /** @brief Sets trackpoints vector, shallow copy
   */
  void set_scifitrackpoints(SciFiTrackPointPArray points) { _trackpoints = points; }

  /** @brief  Returns the mother pr_tracks as a TRef*.
   */
  void set_pr_track(TRef* const pr_track) { _pr_track = pr_track; }

  /** @brief  Returns the mother pr_track as a TObject pointer
   */
  void set_pr_track_tobject(TObject* const pr_track) { *_pr_track = pr_track; }

  /** @brief  Returns the mother pr_tracks as an array of pointers.
   */
  void set_pr_track_pointer(SciFiBasePRTrack* const pr_track) { *_pr_track = pr_track; }


  /** @brief Returns the tracker number.
   */
  int tracker() const      { return _tracker; }

  /** @brief Returns the filtered chi2.
   */
  double chi2()    const   { return _chi2; }

  /** @brief Returns the ndf.
   */
  int ndf()     const   { return _ndf; }

  /** @brief Returns the P-value.
   */
  double P_value()    const   { return _P_value; }

  /** @brief Returns the charge of the fitted particle.
   */
  int charge()        const   { return _charge; }

  /** @brief Returns the array of SciFiTrackPoints which belong to this track.
   */
  SciFiTrackPointPArray scifitrackpoints()      const   { return _trackpoints; }

  /** @brief Adds a SciFiTrackPoint to the member array.
   */
  void add_scifitrackpoint(SciFiTrackPoint* trackpoint) { _trackpoints.push_back(trackpoint); }

  /** @brief  Returns the mother pr_track as a TRef*.
   */
  TRef* pr_track()                const { return _pr_track; }

  /** @brief  Returns the mother pr_track as a TObject pointer
   */
  TObject* pr_track_tobject()     const { return _pr_track->GetObject(); }

  /** @brief  Returns the mother pr_track as a pointer
   */
  SciFiBasePRTrack* pr_track_pointer() const
                                 { return static_cast<SciFiBasePRTrack*>(_pr_track->GetObject()); }

  /** @brief  Returns the mother pr_trackas a helical pointer
   */
  SciFiHelicalPRTrack* pr_track_pointer_helical() const
                              { return static_cast<SciFiHelicalPRTrack*>(_pr_track->GetObject()); }

  /** @brief  Returns the mother pr_tracks as a straight pointer
   */
  SciFiStraightPRTrack* pr_track_pointer_straight() const
                             { return static_cast<SciFiStraightPRTrack*>(_pr_track->GetObject()); }

  /** @brief Enumeration of the possible types of SciFi tracks.
   */
  enum AlgorithmUsed { kalman_straight, kalman_helical };

  /** @brief Returns the type of algorithm used to reconstruct this track.
   */
  int GetAlgorithmUsed() const { return static_cast<int> (_algorithm_used); }

  void SetAlgorithmUsed(int algorithm) { _algorithm_used = (AlgorithmUsed) algorithm; }

  void SetSeedPosition(ThreeVector pos) { this->_seed_position = pos; }

  ThreeVector GetSeedPosition() const { return _seed_position; }

  void SetSeedMomentum(ThreeVector mom) { this->_seed_momentum = mom; }

  ThreeVector GetSeedMomentum() const { return _seed_momentum; }

  void SetSeedCovariance(std::vector<double> seed) { this->_seed_covariance_matrix = seed; }
  void SetSeedCovariance(double* cov, unsigned int size);

  std::vector<double> GetSeedCovariance() const { return _seed_covariance_matrix; }

 private:
  int _tracker;

  double _chi2;

  int _ndf;

  double _P_value;

  int _charge;

  AlgorithmUsed _algorithm_used;

  SciFiTrackPointPArray _trackpoints;

  ThreeVector _seed_position;
  ThreeVector _seed_momentum;
  std::vector<double> _seed_covariance_matrix;

  // Pointer to the seed track. This does not assume memory
  TRef* _pr_track;

  MAUS_VERSIONED_CLASS_DEF(SciFiTrack)
};

typedef std::vector<SciFiTrack*> SciFiTrackPArray;
} // ~namespace MAUS

#endif