Track.cxx
Go to the documentation of this file.
2 
4 
5 
6 
9  : start_(start), end_(end)
10 {
11  dp_ = static_cast<double>(end_.Plane().val) -
12  static_cast<double>(start_.Plane().val);
13  dc_ = static_cast<double>(end_.Cell().val) -
14  static_cast<double>(start_.Cell().val);
15 
16  dt_ = static_cast<int64_t>(end_.TDC().val) -
17  static_cast<int64_t>(start_.TDC().val);
18 
19  distance_ = calculate_distance();
20  velocity_ = calculate_velocity();
21  beta_ = velocity_ / Constants::SPEED_OF_LIGHT;
22 
23  calculate_slopes();
24 }
25 
26 
27 
29 {
30  double dx = Constants::CELL_WIDTH * dc_;
31  double dz = Constants::PLANE_WIDTH * dp_;
32 
33  return sqrt(dx*dx + dz*dz);
34 }
35 
36 
37 
39 {
40  double dt_in_nanoseconds = Constants::TDC_TICK * dt_;
41 
42  return distance_ / dt_in_nanoseconds;
43 }
44 
45 
46 
48 {
49  if (dp_ == 0)
50  {
51  slope_plane_is_valid_ = false;
52  } else {
53  slope_plane_is_valid_ = true;
56  }
57 
58  if (dt_ == 0)
59  {
60  slope_time_is_valid_ = false;
61  } else {
62  slope_time_is_valid_ = true;
65  }
66 
67  if (dc_ == 0)
68  {
69  slope_cell_is_valid_ = false;
70  } else {
71  slope_cell_is_valid_ = true;
73  }
74 }
75 
76 
77 
79 {
80  return distance_;
81 }
82 
83 
84 
86 {
87  return dt_;
88 }
89 
90 
91 
93 {
94  return velocity_;
95 }
96 
97 
98 
100 {
101  return beta_;
102 }
103 
104 
105 
107 {
108  return slope_plane_is_valid_;
109 }
110 
111 
112 
114 {
115  return slope_time_is_valid_;
116 }
117 
118 
119 
121 {
122  return slope_cell_is_valid_;
123 }
124 
125 
126 
128 {
129  if (!slope_plane_is_valid())
130  {
131  std::cerr << "\n\tThe slope is invalid.\n\n"
132  << "Please check Track::slope_is_valid() "
133  << "before accessing Track::slope()." << std::endl;
134  assert(false);
135  }
136 
137  return slope_cell_plane_;
138 }
139 
140 
141 
143 {
144  if (!slope_plane_is_valid())
145  {
146  std::cerr << "\n\tThe slope is invalid.\n\n"
147  << "Please check Track::slope_is_valid() "
148  << "before accessing Track::slope()." << std::endl;
149  assert(false);
150  }
151 
152  return slope_time_plane_;
153 }
154 
155 
156 
158 {
159  if (!slope_time_is_valid())
160  {
161  std::cerr << "\n\tThe slope is invalid.\n\n"
162  << "Please check Track::slope_is_valid() "
163  << "before accessing Track::slope()." << std::endl;
164  assert(false);
165  }
166 
167  return slope_cell_time_;
168 }
169 
170 
171 
173 {
174  if (!slope_time_is_valid())
175  {
176  std::cerr << "\n\tThe slope is invalid.\n\n"
177  << "Please check Track::slope_is_valid() "
178  << "before accessing Track::slope()." << std::endl;
179  assert(false);
180  }
181 
182  return slope_plane_time_;
183 }
184 
185 
186 
188 {
189  if (!slope_cell_is_valid())
190  {
191  std::cerr << "\n\tThe slope is invalid.\n\n"
192  << "Please check Track::slope_is_valid() "
193  << "before accessing Track::slope()." << std::endl;
194  assert(false);
195  }
196 
197  return slope_time_cell_;
198 }
199 
200 
201 
203 {
204  return start_;
205 }
206 
207 
208 
210 {
211  return end_;
212 }
213 
214 
215 
217 {
218  return std::min(start_.Plane().val, end_.Plane().val);
219 }
220 
221 
222 
224 {
225  return std::max(start_.Plane().val, end_.Plane().val);
226 }
227 
228 
229 
231 {
232  return dp_;
233 }
234 
235 
236 
238 {
239  return std::min(start_.Cell().val, end_.Cell().val);
240 }
241 
242 
243 
245 {
246  return std::max(start_.Cell().val, end_.Cell().val);
247 }
248 
249 
250 
252 {
253  return dc_;
254 }
double velocity() const
Definition: Track.cxx:92
T max(const caf::Proxy< T > &a, T b)
double slope_cell_plane() const
Definition: Track.cxx:127
double time() const
Definition: Track.cxx:85
double calculate_velocity() const
Definition: Track.cxx:38
novaddt::Plane const & Plane() const
Definition: DAQHit.h:70
novaddt::DAQHit start_
Definition: Track.h:61
novaddt::DAQHit start() const
Definition: Track.cxx:202
double slope_plane_time_
Definition: Track.h:54
T sqrt(T number)
Definition: d0nt_math.hpp:156
value_type val
Definition: BaseProducts.h:109
unsigned min_cell() const
Definition: Track.cxx:237
OStream cerr
Definition: OStream.cxx:7
const double CELL_WIDTH
Definition: Constants.h:12
double beta_
Definition: Track.h:54
bool slope_cell_is_valid() const
Definition: Track.cxx:120
double distance() const
Definition: Track.cxx:78
double slope_time_plane() const
Definition: Track.cxx:142
void calculate_slopes()
Definition: Track.cxx:47
int cell_difference() const
Definition: Track.cxx:251
double beta() const
Definition: Track.cxx:99
double velocity_
Definition: Track.h:54
unsigned max_plane() const
Definition: Track.cxx:223
bool slope_plane_is_valid() const
Definition: Track.cxx:106
double calculate_distance() const
Definition: Track.cxx:28
novaddt::DAQHit end() const
Definition: Track.cxx:209
double dx[NP][NC]
double dz[NP][NC]
novaddt::DAQHit end_
Definition: Track.h:61
const double SPEED_OF_LIGHT
double slope_plane_time() const
Definition: Track.cxx:172
value_type val
Definition: BaseProducts.h:84
double slope_cell_time() const
Definition: Track.cxx:157
bool slope_time_is_valid() const
Definition: Track.cxx:113
bool slope_cell_is_valid_
Definition: Track.h:59
double slope_cell_time_
Definition: Track.h:54
unsigned min_plane() const
Definition: Track.cxx:216
bool slope_plane_is_valid_
Definition: Track.h:59
double distance_
Definition: Track.h:54
double slope_cell_plane_
Definition: Track.h:54
bool slope_time_is_valid_
Definition: Track.h:59
int plane_difference() const
Definition: Track.cxx:230
double slope_time_cell() const
Definition: Track.cxx:187
novaddt::Cell const & Cell() const
Definition: DAQHit.h:71
assert(nhit_max >=nhit_nbins)
T min(const caf::Proxy< T > &a, T b)
unsigned max_cell() const
Definition: Track.cxx:244
Track(novaddt::DAQHit const &start, novaddt::DAQHit const &end)
Definition: Track.cxx:8
double slope_time_cell_
Definition: Track.h:54
const double TDC_TICK
Definition: Constants.h:13
const double PLANE_WIDTH
Definition: Constants.h:11
double slope_time_plane_
Definition: Track.h:54