00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #include "TReadoutSegment.hh"
00017 #include "TDataSegment.hh"
00018 #include "TModule.hh"
00019
00020 TReadoutSegment::TReadoutSegment( const Tstring& id )
00021 : TReadoutIdentification( id ), TReadoutElementList(), theModule( 0 )
00022 {;}
00023
00024 TReadoutSegment::TReadoutSegment( TModule* module, const Tstring& id )
00025 : TReadoutIdentification( id ), TReadoutElementList(), theModule( module )
00026 {
00027 for ( Tint i = 0; i < module -> GetNumberOfChannels(); i ++ ) {
00028 push_back( TReadoutElement( theModule, itostr( i, 1 ), i ) );
00029 }
00030 }
00031
00032 TReadoutSegment::TReadoutSegment( TModule* module, Tint ch, const Tstring& id )
00033 : TReadoutIdentification( id ), TReadoutElementList(), theModule( module )
00034 {
00035 push_back( TReadoutElement( theModule, itostr( ch, 1 ), ch ) );
00036 }
00037
00038 TReadoutSegment::TReadoutSegment( TModule* module, const TstringList& elementid, const Tstring& id )
00039 : TReadoutIdentification( id ), TReadoutElementList(), theModule( module )
00040 {
00041 Tsize_t nch = (Tsize_t)( theModule -> GetNumberOfChannels() );
00042 if ( nch > elementid.size() ) {
00043 for ( Tsize_t i = elementid.size(); i < nch; i ++ ) {
00044 ( (TstringList*)(&elementid) ) -> push_back( itostr( i, 1 ) );
00045 }
00046 }
00047
00048 for ( Tsize_t i = 0; i < nch; i ++ ) {
00049 push_back( TReadoutElement( theModule, elementid[ i ], i ) );
00050 }
00051 }
00052
00053 TReadoutSegment::TReadoutSegment( TModule* module, const Tstring elementid[], const Tstring& id )
00054 : TReadoutIdentification( id ), TReadoutElementList(), theModule( module )
00055 {
00056 Tint nch = module -> GetNumberOfChannels();
00057
00058 for ( Tint i = 0; i < nch; i ++ ) {
00059 push_back( TReadoutElement( module, elementid[ i ], i ) );
00060 }
00061 }
00062
00063 TReadoutSegment::TReadoutSegment( const TReadoutSegment& right )
00064 : TReadoutIdentification( right ), TReadoutElementList( right ),
00065 theModule( right.theModule )
00066 {;}
00067
00068 TReadoutSegment::~TReadoutSegment()
00069 {;}
00070
00071 TDataSegment TReadoutSegment::Read()
00072 {
00073 TDataSegment segment( theID );
00074 for ( Tsize_t i = 0; i < size(); i ++ ) {
00075 segment.push_back( ( (*this)[ i ] ).Read() );
00076 }
00077 return segment;
00078 }
00079
00080 const TReadoutSegment& TReadoutSegment::operator=( const TReadoutSegment& right )
00081 {
00082 *( (TReadoutIdentification*)this ) = *( (TReadoutIdentification*)(&right) );
00083 *( (TReadoutElementList*)this ) = *( (TReadoutElementList*)(&right) );
00084 *theModule = *(right.theModule);
00085 return *this;
00086 }
00087
00088 Tbool TReadoutSegment::operator==( const TReadoutSegment& right ) const
00089 {
00090 Tbool ret = Ttrue;
00091 ret &= ( *( (TReadoutIdentification*)this ) == *( (TReadoutIdentification*)(&right) ) );
00092 ret &= ( *( (TReadoutElementList*)this ) == *( (TReadoutElementList*)(&right) ) );
00093 ret &= ( *theModule == *(right.theModule) );
00094 return ret;
00095 }
00096
00097 Tbool TReadoutSegment::operator!=( const TReadoutSegment& right ) const
00098 {
00099 Tbool ret = Tfalse;
00100 ret |= ( *( (TReadoutIdentification*)this ) != *( (TReadoutIdentification*)(&right) ) );
00101 ret |= ( *( (TReadoutElementList*)this ) != *( (TReadoutElementList*)(&right) ) );
00102 ret |= ( *theModule != *(right.theModule) );
00103 return ret;
00104 }
00105
00106 #ifdef __CLDAQ_ROOT_DLL
00107 ClassImp(TReadoutSegment)
00108 #endif