メインページ   モジュール   名前空間一覧   クラス階層   アルファベット順一覧   構成   ファイル一覧   構成メンバ   ファイルメンバ   関連ページ    

TReadoutSegment.cc

解説を見る。
00001 // =====================================================================
00002 //  $Id: TReadoutSegment.cc,v 1.5 2004/03/07 10:30:33 goiwai Exp $
00003 //  $Name: CLDAQ-1-14-03 $
00004 //  $Log: TReadoutSegment.cc,v $
00005 //  Revision 1.5  2004/03/07 10:30:33  goiwai
00006 //  ROOTに組みこむためのおまじないマクロを埋めこみました。
00007 //  全てにおいて完全に動作するわけではありません。
00008 //
00009 //  Revision 1.4  2003/10/06 16:39:00  goiwai
00010 //  *** empty log message ***
00011 //
00012 //  Revision 1.3  2003/07/30 16:20:11  goiwai
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   // dangerous, no check, should be check string array here.
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


CLDAQ - a Class Library for DataAcQuisition (Version 1.14.3)
Go IWAI -- goiwai at users.sourceforge.jp