00001 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef TDSPCLIP_H 00019 #define TDSPCLIP_H 00020 00021 #include <TDSPFunction.h> 00022 00029 class TDSPClip : public TDSPFunction { 00030 protected: 00031 00032 Double_t fClipAmplitude; // The Amplitude where to start clipping; 00033 00034 public: 00035 TDSPClip(char *name = NULL); 00036 ~TDSPClip(); 00037 00038 void SetClip(Double_t c) { fClipAmplitude=c;}; 00039 Double_t GetClip() { return fClipAmplitude;}; 00040 00041 virtual TComplex F(TComplex); 00042 00043 ClassDef(TDSPClip,1) 00044 00045 }; 00046 00047 // Simple Clip Application. 00048 // Clip the Signal at fClipAmplitude and preserve the phase 00049 // 00050 inline TComplex TDSPClip::F(TComplex in) { 00051 Double_t in_abs = Abs(in); 00052 if (in_abs>fClipAmplitude) 00053 return in/in_abs*fClipAmplitude; 00054 else 00055 return in; 00056 } 00057 00058 #endif
1.3.2