/* 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 .
*/
/* Author: Peter Lane
*/
#include "src/common_cpp/Optics/PhaseSpaceVector.hh"
#include
#include
#include "CLHEP/Units/PhysicalConstants.h"
#include "Interface/Squeal.hh"
#include "Maths/Vector.hh"
namespace MAUS {
PhaseSpaceVector::PhaseSpaceVector()
: Vector(6)
{ }
PhaseSpaceVector::PhaseSpaceVector(const Vector& original_instance)
: Vector() {
if (original_instance.size() < 6) {
throw(Squeal(Squeal::recoverable,
"Attempted to construct with a Vector containing "
"fewer than six elements",
"PhaseSpaceVector::PhaseSpaceVector(Vector)"));
}
build_vector(6);
for (size_t index = 1; index <= 6; ++index) {
(*this)(index) = original_instance(index);
}
}
PhaseSpaceVector::PhaseSpaceVector(const PhaseSpaceVector& original_instance)
: Vector(original_instance)
{ }
PhaseSpaceVector::PhaseSpaceVector(double const * const array)
: Vector(array, 6)
{ }
PhaseSpaceVector::PhaseSpaceVector(const double t, const double E,
const double x, const double px,
const double y, const double py)
: Vector() {
const double data[6] = {
t, E, x, px, y, py
};
build_vector(6, data);
}
PhaseSpaceVector::~PhaseSpaceVector() { }
PhaseSpaceVector & PhaseSpaceVector::operator=(const PhaseSpaceVector & rhs) {
(*this).Vector::operator=(rhs);
return *this;
}
std::ostream& operator<<(std::ostream& out, const PhaseSpaceVector& vector) {
out << "t: " << vector[0] << "E: " << vector[1]
<< "x: " << vector[2] << "Px: " << vector[3]
<< "y: " << vector[4] << "Py: " << vector[5];
return out;
}
} // namespace MAUS