// // $Id: SiBarrel.cpp,v 1.15 2001/02/03 22:53:35 hobbs Exp $ // // File: SiBarrel.cc // Purpose: // Created: 10-OCT-1997 John Hobbs // // $Revision: 1.15 $ // // // Include files #include #include "SiBarrel.hpp" #include #include #include // Global definitions using namespace std; using namespace dgs; bool operator<(const SiBarrel& lhs, const SiBarrel&rhs) { return lhs.get_position()[2] < rhs.get_position()[2]; } bool operator==(const SiBarrel& lhs, const SiBarrel&rhs) { if( lhs.get_position() != rhs.get_position() ) return false; if( lhs.get_layer_count() != rhs.get_layer_count() ) return false; for( int i=1 ; i<=lhs.get_layer_count() ; i++ ) if( *(lhs.get_layer(i)) != *(rhs.get_layer(i)) ) return false; return true; } bool operator!=(const SiBarrel& lhs, const SiBarrel&rhs) { return !(lhs==rhs); } // Constructors/Destructors SiBarrel::SiBarrel() { } SiBarrel::SiBarrel(const vector &layers, bool spun/*false*/): _layers(layers) { if( spun ) flip_ladders(); } // Accessors const list SiBarrel::get_children() { list kids; for( int i=0 ; i<_layers.size() ; i++ ) kids.push_back( &_layers[i] ); return kids; } std::ostream& operator <<(std::ostream& os, const SiBarrel& me) { os << "SiBarrel at " << me.get_position() << " has " << me._layers.size() << " layers" << endl; for( int i=0 ; iget_ladder_count() ; lad++ ) { SiLadder* theLadder = theLayer->get_mutable_ladder(lad); GeometryXform ladder_relative = theLadder->get_relative_position(get_position()); SpaceVector offset = ladder_relative.get_offset(); Rotation angles = ladder_relative.get_rotation(); Rotation spin = RotationY(3.1415926535898); Rotation rspun=angles*spin; GeometryXform spun(offset,rspun); theLadder->set_relative_position(get_position(),spun); } } }