TSoftwareAdcModule.hh Source File

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

# TSoftwareAdcModule.hh

解説を見る。

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