//-------------------------------------------------------------------------- #include "BaBar/BaBar.hh" #include #include "PacEmc/PacEmcDigi.hh" #include "CLHEP/Geometry/HepPoint.h" //---------------- // Constructors -- //---------------- PacEmcDigi::PacEmcDigi() : _energy(0), _tci(new TwoCoordIndex(-1,-1,-1)) { init(); } PacEmcDigi::PacEmcDigi(double energy, const TwoCoordIndex *tci) : _energy(energy), _tci(new TwoCoordIndex(*tci)) { init(); } PacEmcDigi::PacEmcDigi(const PacEmcDigi& other) : _energy(other.energy()), _tci(new TwoCoordIndex(*(other.tci()))) { init(); } PacEmcDigi::~PacEmcDigi() { delete _tci; delete _where; } // Calculate where void PacEmcDigi::init() { _where= new HepPoint(0,0,0); // Calculating the location needs detector information _thetaReal = _where->theta(); _phiReal= _where->phi(); } PacEmcDigi* PacEmcDigi::clone() const { return new PacEmcDigi(*this); } //------------- // Operators -- //------------- bool PacEmcDigi::operator==( const PacEmcDigi& otherDigi ) const { bool equal = false; if ( this->theta() == otherDigi.theta() && this->phi() == otherDigi.phi() && this->energy() == otherDigi.energy() ) { equal=true; } return equal; } bool PacEmcDigi::operator!=( const PacEmcDigi& otherDigi ) const { return ! ( *this == otherDigi ); } const TwoCoordIndex* PacEmcDigi::tci() const { return _tci; } const HepPoint& PacEmcDigi::where() const { return *_where; }