#include "bareParticle.h" bareParticle::bareParticle(const TRIDVECTOR& pos , const TRIDVECTOR& bg) { position_ = pos; betagamma_ = bg; gamma_ = sqrt( 1.0 + betagamma_.norm2() ); } bareParticle::bareParticle(bareParticle& bp) { position_ = bp.position_; betagamma_ = bp.betagamma_; gamma_ = bp.gamma_; } bareParticle::bareParticle(const bareParticle& bp) { position_ = bp.position_; betagamma_ = bp.betagamma_; gamma_ = bp.gamma_; } void bareParticle::resetDynamics(const bareParticle& bp) { position_ = bp.position_; betagamma_ = bp.betagamma_; gamma_ = bp.gamma_; } bareParticle& bareParticle::operator = (const bareParticle& bp) { position_ = bp.position_; betagamma_ = bp.betagamma_; gamma_ = bp.gamma_; return *this; } const TRIDVECTOR& bareParticle::getReferenceToPosition() const { return position_; } TRIDVECTOR bareParticle::getPosition() const { return position_; } TRIDVECTOR& bareParticle::getReferenceToPosition() { return position_; } double bareParticle::getZ() const { return position_.getComponent(2); } void bareParticle::setZ(double z) { position_.setComponent(2, z); } void bareParticle::incrementZ( double dz) { position_.incrementComponent(2, dz); } void bareParticle::setX(double x) { position_.setComponent(0, x); } double bareParticle::getRadius() const { double auxx = position_.getComponent(0); double auxy = position_.getComponent(1); return sqrt(auxx * auxx + auxy * auxy); } TRIDVECTOR bareParticle::getBetaGamma() const { return betagamma_; } TRIDVECTOR& bareParticle::getReferenceToBetaGamma() { return betagamma_; } void bareParticle::setBetaGamma(const TRIDVECTOR& btg) { betagamma_ = btg; gamma_ = sqrt( 1.0 + betagamma_.norm2() ); } double bareParticle::getBetaz() const { return betagamma_.getComponent(2)/gamma_; } double bareParticle::getGamma() const { return gamma_; } string bareParticle::FileOutputFlow() const { ostringstream sortie; sortie << position_.output_flow() << betagamma_.output_flow() << " " << gamma_; return sortie.str(); } bool bareParticle::FileInput( ifstream& ifs) { bool test = false; if ( position_.input_flow(ifs) && betagamma_.input_flow(ifs) ) { if ( ifs >> gamma_ ) { test = true; } } return test; } void bareParticle::imprimer() const { cout << " ---- impression particule nue ----- " << endl; cout << " position : " << endl; position_.print(); cout << " betas : " << endl; TRIDVECTOR betas; double fac = 1.0/gamma_; betas = betagamma_ * fac; betas.print(); cout << " gamma = " << gamma_ << endl; }