#include "Hit.h" #include pool_tutorial::Hit::Hit(): m_x( 0 ), m_y( 0 ), m_z( 0 ), m_value( 0 ), m_digit() {} pool_tutorial::Hit::Hit( const pool_tutorial::Hit& rhs ): m_x( rhs.m_x ), m_y( rhs.m_y ), m_z( rhs.m_z ), m_value( rhs.m_value ), m_digit( rhs.m_digit ) // Beware! This does not create a copy of a Digit object {} pool_tutorial::Hit::~Hit() {} pool_tutorial::Hit& pool_tutorial::Hit::operator=( const pool_tutorial::Hit& rhs ) { m_x = rhs.m_x; m_y = rhs.m_y; m_z = rhs.m_z; m_value = rhs.m_value; m_digit = rhs.m_digit; // Beware! This does not call the = operator of a Digit object return *this; } double pool_tutorial::Hit::x() const { return m_x; } double pool_tutorial::Hit::y() const { return m_y; } double pool_tutorial::Hit::z() const { return m_z; } double pool_tutorial::Hit::value() const { return m_value; } void pool_tutorial::Hit::setPosition( double x, double y, double z ) { m_x = x; m_y = y; m_z = z; } void pool_tutorial::Hit::setValue( double value ) { m_value = value; } pool_tutorial::Digit& pool_tutorial::Hit::digit() { if ( ! m_digit ) { throw std::runtime_error( "A digit is not set for this hit" ); } return *m_digit; } void pool_tutorial::Hit::setDigit( const pool::Ref< pool_tutorial::Digit >& digit ) { m_digit = digit; }