// // $Id: SiCentral.cpp,v 1.8 2001/02/03 22:53:35 hobbs Exp $ // // File: SiCentral.cpp // Purpose: // Created: 15-DEC-1997 Emanuela Barberis // // $Revision: 1.8 $ // // // Include files #include #include "SiCentral.hpp" #include // Global definitions using namespace std; using namespace dgs; bool operator<(const SiCentral& lhs, const SiCentral&rhs) { return lhs.get_position()[2] < rhs.get_position()[2]; } // Constructors/Destructors SiCentral::SiCentral(int nb, float* barrels_zpos, const SiBarrel* proto_barrel, int nd, float* disks_zpos, const SiDisk* proto_disk) // // Purpose: Instantiate central detector with nb barrels, nd disks. // The ideal positions are given in barrel_zpos, disk_zpos. // The barrel, disk defined as // proto_barrel, proto_disk define the barrels, // disks. If the pointer is null, the defaults are used. // { const SiBarrel* use_barrel; const SiDisk* use_disk; int i; //Damn MSVC5 if( proto_barrel ) use_barrel=proto_barrel; else use_barrel = new SiBarrel; if( proto_disk ) use_disk=proto_disk; else use_disk = new SiDisk; // Create and position the barrels. for( i=0 ; i& barrels_zpos, const vector& barrels, const vector& disks_zpos, const vector& disks): _barrels(barrels), _disks(disks) { int i; // Now position the barrels. for( i=0 ; i<_barrels.size() ; i++ ) { CartesianCoordinate zpos(0.0,0.0,barrels_zpos[i]); position_child_at(zpos,_barrels[i]); } // Now position the disks. for( i=0 ; i<_disks.size() ; i++ ) { CartesianCoordinate zpos(0.0,0.0,disks_zpos[i]); position_child_at(zpos,_disks[i]); } } // Accessors const list SiCentral::get_children() // // Purpose: Return the addresses of the barrels and disks in the // central section of the tracker // { int i; list kids; for( i=0 ; i<_barrels.size() ; i++ ) kids.push_back( &_barrels[i] ); for( i=0 ; i<_disks.size() ; i++ ) kids.push_back( &_disks[i] ); return kids; } std::ostream& operator <<(std::ostream& os, const SiCentral& me) // // Purpose: Dump a central tracker // { int i; os << "SiCentral at " << me.get_position() << " has " << me.get_barrel_count() << " barrel" << " and " << me.get_disk_count() << " disk" << endl; for( i=0 ; i