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

TSoftwareAdcModule.hh

解説を見る。
00001 // =====================================================================
00028 // =====================================================================
00029 #ifndef CLDAQ__TSOFTWAREADCMODULE_HH
00030 #define CLDAQ__TSOFTWAREADCMODULE_HH
00031 
00032 #include "Tglobals.h"
00033 #include "TSoftwareModule.hh"
00034 #include "TChannel.hh"
00035 #include "TRandomEngine.hh"
00036 #include "TRandomFlat.hh"
00037 #include "TRandomGaussian.hh"
00038 
00039 class TDataSegment;
00040 class TDataElement;
00041 
00042 
00062 class TSoftwareAdcModule
00063   : public TSoftwareModule
00064 {
00065   protected:
00066     enum { tDataOverFlow = -1 };
00067     enum { tDefaultScale = 4096 };
00068     enum { tDefaultChannel = 16 };
00069 
00070   protected:
00071     Tint theScale;
00072     TintList theMean;
00073     TintList theSigma;
00074     TChannel theChannel;
00075     Trandom_t theRandomType;
00076 
00077   protected:
00078     static Tint theSeed;
00079     static TRandomEngine theRandomEngine;
00080 
00081   public:
00082     TSoftwareAdcModule( Tint nchannel = tDefaultChannel, Tint scale = tDefaultScale, Trandom_t randtype = tRandomGaussian );
00083     TSoftwareAdcModule( const TSoftwareAdcModule& right );
00084     virtual ~TSoftwareAdcModule();
00085 
00086   public:
00087     virtual Tint Clear();
00088     virtual Tint Update();
00089     virtual Tint Initialize();
00090     virtual Tvoid FillData( TDataElement& element, Tint channel );
00091 
00092   public:
00093     virtual const TSoftwareAdcModule& operator=( const TSoftwareAdcModule& right );
00094     virtual Tbool operator==( const TSoftwareAdcModule& right ) const;
00095     virtual Tbool operator!=( const TSoftwareAdcModule& right ) const;
00096 
00097   public:
00098     virtual Tint GetScale() const;
00099     virtual const TintList& GetMean() const;
00100     virtual Tint GetMean( Tint channel ) const;
00101     virtual const TintList& GetSigma() const;
00102     virtual Tint GetSigma( Tint channel ) const;
00103     virtual const TChannel& GetChannel() const;
00104     virtual Tint GetData( Tint channel ) const;
00105     virtual Trandom_t GetRandomType() const;
00106     virtual Tvoid SetScale( Tint scale );
00107     virtual Tvoid SetMean( const TintList& meanlist );
00108     virtual Tvoid SetMean( Tint channel, Tint mean );
00109     virtual Tvoid SetSigma( const TintList& sigmalist );
00110     virtual Tvoid SetSigma( Tint channel, Tint sigma );
00111     virtual Tvoid SetChannel( const TChannel& channels );
00112     virtual Tvoid SetData( Tint channel, Tint data );
00113     virtual Tvoid GetRandomType( Trandom_t randomtype );
00114 
00115   public:
00116     static Tint GetSeed();
00117     static const TRandomEngine& GetRandomEngine();
00118     static Tvoid SetSeed( Tint seed );
00119     static Tvoid SetRandomEngine( const TRandomEngine& engine );
00120 
00121   protected:
00122     virtual Tvoid setParameters();
00123     virtual Tvoid fillGaussian();
00124 
00125 #ifdef __CLDAQ_ROOT_DLL
00126     ClassDef(TSoftwareAdcModule,0)
00127 #endif
00128 
00129 };
00130 
00131 inline Tint TSoftwareAdcModule::GetScale() const
00132 {
00133   return theScale;
00134 }
00135 
00136 inline const TintList& TSoftwareAdcModule::GetMean() const
00137 {
00138   return theMean;
00139 }
00140 
00141 inline Tint TSoftwareAdcModule::GetMean( Tint channel ) const
00142 {
00143   if ( channel < 0 || channel >= theNumberOfChannels ) {
00144     Tcerr << "TSoftwareAdcModule::GetMean: invalid ID" << Tendl;
00145     return -EFAULT;
00146   } else {
00147     return theMean[ channel ];
00148   }
00149 }
00150 
00151 inline const TintList& TSoftwareAdcModule::GetSigma() const
00152 {
00153   return theSigma;
00154 }
00155 
00156 inline Tint TSoftwareAdcModule::GetSigma( Tint channel ) const
00157 {
00158   if ( channel < 0 || channel >= theNumberOfChannels ) {
00159     Tcerr << "TSoftwareAdcModule::GetSigma: invalid ID" << Tendl;
00160     return -EFAULT;
00161   } else {
00162     return theSigma[ channel ];
00163   }
00164 }
00165 
00166 inline const TChannel& TSoftwareAdcModule::GetChannel() const
00167 {
00168   return theChannel;
00169 }
00170 
00171 inline Tint TSoftwareAdcModule::GetData( Tint channel ) const
00172 {
00173   if ( channel < 0 || channel >= theNumberOfChannels ) {
00174     Tcerr << "TSoftwareAdcModule::GetData: invalid ID" << Tendl;
00175     return -EFAULT;
00176   } else {
00177     return theChannel[ channel ];
00178   }
00179 }
00180 
00181 inline Trandom_t TSoftwareAdcModule::GetRandomType() const
00182 {
00183   return theRandomType;
00184 }
00185 
00186 inline Tvoid TSoftwareAdcModule::SetScale( Tint scale )
00187 {
00188   theScale = scale;
00189   return;
00190 }
00191 
00192 inline Tvoid TSoftwareAdcModule::SetMean( const TintList& meanlist )
00193 {
00194   theMean = meanlist;
00195   return;
00196 }
00197 
00198 inline Tvoid TSoftwareAdcModule::SetMean( Tint channel, Tint mean )
00199 {
00200   if ( channel < 0 || channel >= theNumberOfChannels )
00201     Tcerr << "TSoftwareAdc::SetMean: invalid ID" << Tendl;
00202   else
00203     theMean[ channel ] = mean;
00204   return;
00205 }
00206 
00207 inline Tvoid TSoftwareAdcModule::SetSigma( const TintList& sigmalist )
00208 {
00209   theSigma = sigmalist;
00210   return;
00211 }
00212 
00213 inline Tvoid TSoftwareAdcModule::SetSigma( Tint channel, Tint sigma )
00214 {
00215   if ( channel < 0 || channel >= theNumberOfChannels )
00216     Tcerr << "TSoftwareAdc::SetSigma: invalid ID" << Tendl;
00217   else
00218     theSigma[ channel ] = sigma;
00219   return;
00220 }
00221 
00222 inline Tvoid TSoftwareAdcModule::SetChannel( const TChannel& channels )
00223 {
00224   theChannel = channels;
00225   return;
00226 }
00227 
00228 inline Tvoid TSoftwareAdcModule::SetData( Tint channel, Tint data )
00229 {
00230   if ( channel < 0 || channel >= theNumberOfChannels )
00231     Tcerr << "TSoftwareAdc::SetData: invalid ID" << Tendl;
00232   else
00233     theChannel[ channel ] = data;
00234   return;
00235 }
00236 
00237 inline Tvoid TSoftwareAdcModule::GetRandomType( Trandom_t randomtype )
00238 {
00239   theRandomType = randomtype;
00240   return;
00241 }
00242 
00243 inline Tint TSoftwareAdcModule::GetSeed()
00244 {
00245   return TSoftwareAdcModule::theSeed;
00246 }
00247 
00248 inline const TRandomEngine& TSoftwareAdcModule::GetRandomEngine()
00249 {
00250   return TSoftwareAdcModule::theRandomEngine;
00251 }
00252 
00253 inline Tvoid TSoftwareAdcModule::SetSeed( Tint seed )
00254 {
00255   TSoftwareAdcModule::theSeed = seed;
00256   return;
00257 }
00258 
00259 inline Tvoid TSoftwareAdcModule::SetRandomEngine( const TRandomEngine& engine )
00260 {
00261   TSoftwareAdcModule::theRandomEngine = engine;
00262   return;
00263 }
00264 
00265 #endif


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