1
/* This file is part of MAUS: http:// micewww.pp.rl.ac.uk:8080/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 COMMON_CPP_RECONSTRUCTION_PARTICLE_OPTICAL_VECTOR_HH
21
#define COMMON_CPP_RECONSTRUCTION_PARTICLE_OPTICAL_VECTOR_HH
25
#include "DataStructure/Step.hh"
26
#include "src/common_cpp/Optics/PhaseSpaceVector.hh"
27
#include "Recon/Global/Particle.hh"
28
#include "Recon/Global/Detector.hh"
34
/* @class ParticleOpticalVector a phase space vector with redundant t/E and z/Pz
35
* coordinates as well as an ID that links the track to the detector that
38
* The redundant sets of coordinates can be filled in by explicitly using the
39
* FillInCoordinates() function or by setting all of the coordinates at once
40
* using the array or parameterised constructors (which implicitly call
41
* FillInCoordinates()). If t < 0 it fills in t and E from z, Pz, and the given
42
* mass parameter. If t >= 0 and z < 0, it fills in z and Pz from t, E, and
45
class ParticleOpticalVector : public MAUS::PhaseSpaceVector {
47
/* @brief Construct with all elements initialized to zero and phase space type
50
ParticleOpticalVector();
52
ParticleOpticalVector(
53
const MAUS::PhaseSpaceVector& vector,
54
const double t0, const double E0, const double P0);
56
/* @brief Copy constructor.
58
ParticleOpticalVector(const ParticleOpticalVector & original_instance);
60
/* @brief Create with coordinates from an array.
61
Order is t, E, x, Px, y, Py.
63
explicit ParticleOpticalVector(double const * const array);
65
/* @brief Reconstructed track point constructor. The track point was not
66
* generated by a detector, so an uncertanty matrix must be supplied. The
67
* detector_id field is set to Detector::None.
69
ParticleOpticalVector(const double l, const double delta,
70
const double x, const double a,
71
const double y, const double b);
73
~ParticleOpticalVector();
75
// *************************
76
// Assignment Operators
77
// *************************
78
ParticleOpticalVector& operator =(
79
const ParticleOpticalVector& rhs);
80
ParticleOpticalVector& operator+=(
81
const ParticleOpticalVector& rhs);
82
ParticleOpticalVector& operator-=(
83
const ParticleOpticalVector& rhs);
84
ParticleOpticalVector& operator*=(
85
const ParticleOpticalVector& rhs);
86
ParticleOpticalVector& operator/=(
87
const ParticleOpticalVector& rhs);
88
ParticleOpticalVector& operator+=(const double& rhs);
89
ParticleOpticalVector& operator-=(const double& rhs);
90
ParticleOpticalVector& operator*=(const double& rhs);
91
ParticleOpticalVector& operator/=(const double& rhs);
93
// *************************
94
// Algebraic Operators
95
// *************************
96
const ParticleOpticalVector operator+(
97
const ParticleOpticalVector& rhs) const;
98
const ParticleOpticalVector operator-(
99
const ParticleOpticalVector& rhs) const;
100
const ParticleOpticalVector operator*(
101
const ParticleOpticalVector& rhs) const;
102
const ParticleOpticalVector operator/(
103
const ParticleOpticalVector& rhs) const;
104
const ParticleOpticalVector operator+(const double& rhs) const;
105
const ParticleOpticalVector operator-(const double& rhs) const;
106
const ParticleOpticalVector operator*(const double& rhs) const;
107
const ParticleOpticalVector operator/(const double& rhs) const;
109
// *************************
110
// Comparison Operators
111
// *************************
112
const bool operator==(const ParticleOpticalVector& rhs) const;
113
const bool operator!=(const ParticleOpticalVector& rhs) const;
115
double l() const {return (*this)[0];}
116
double delta() const {return (*this)[1];}
117
double x() const {return (*this)[2];}
118
double a() const {return (*this)[3];}
119
double y() const {return (*this)[4];}
120
double b() const {return (*this)[5];}
123
void set_l(double l) {(*this)[0] = l;}
124
void set_delta(double delta) {(*this)[1] = delta;}
125
void set_x(double x) {(*this)[2] = x;}
126
void set_a(double a) {(*this)[3] = a;}
127
void set_y(double y) {(*this)[4] = y;}
128
void set_b(double b) {(*this)[5] = b;}
131
std::ostream& operator<<(std::ostream& out, const ParticleOpticalVector& vector);
133
} // namespace global