00001
00002
00004 #ifndef __Oinject__
00005 #define __Oinject__
00006 #include "Spectrum.h"
00007 #include "TRandom3.h"
00008 #include "TMath.h"
00009
00010 #define sqrt2pi 2.5066282746310002416123552393401042
00011
00012 using namespace std;
00013
00019 class Oinject{
00020
00021 public:
00022
00039 Oinject(const double aDuration);
00040
00044 virtual ~Oinject(void);
00059 void MakeWaveform(void);
00060
00067 inline double GetWaveform(const int aIndex, const int aSamplingFrequency){
00068 return
00069 amp*
00070 Wg/sigma_t/sqrt2pi*exp(-(-duration/2.0+(double)aIndex/(double)aSamplingFrequency-tau)*(-duration/2.0+(double)aIndex/(double)aSamplingFrequency-tau)/2.0/sigma_t/sigma_t)*
00071 TMath::Cos(2.0*TMath::Pi()*phi*(-duration/2.0+(double)aIndex/(double)aSamplingFrequency)+phase);
00072 };
00073
00079 double GetTrueSNR(Spectrum *aSpec1, Spectrum *aSpec2);
00080
00086 inline void SetTimeRange(const double aTimeMin, const double aTimeMax){
00087 taumin=aTimeMin; taumax=aTimeMax;
00088 };
00089
00095 inline void SetFrequencyRange(const double aFreqMin, const double aFreqMax){
00096 phimin=aFreqMin; phimax=aFreqMax;
00097 };
00098
00104 inline void SetAmplitudeRange(const double aAmpMin, const double aAmpMax){
00105 ampmin=aAmpMin; ampmax=aAmpMax;
00106 };
00107
00113 inline void SetQRange(const double aQMin, const double aQMax){
00114 Qmin=aQMin; Qmax=aQMax;
00115 };
00116
00120 inline double GetTime(void){ return tau; };
00121
00125 inline double GetTimeMin(void){ return taumin; };
00126
00130 inline double GetTimeMax(void){ return taumax; };
00131
00135 inline double GetFrequency(void){ return phi; };
00136
00140 inline double GetFrequencyMin(void){ return phimin; };
00141
00145 inline double GetFrequencyMax(void){ return phimax; };
00146
00150 inline double GetQ(void){ return Q; };
00151
00155 inline double GetQMin(void){ return Qmin; };
00156
00160 inline double GetQMax(void){ return Qmax; };
00161
00165 inline double GetAmplitude(void){ return amp; };
00166
00170 inline double GetAmplitudeMin(void){ return ampmin; };
00171
00175 inline double GetAmplitudeMax(void){ return ampmax; };
00176
00180 inline double GetPhase(void){ return phase; };
00181
00185 inline double GetSigmat(void){ return sigma_t; };
00186
00190 inline double GetSigmaf(void){ return sigma_f; };
00191
00192 private:
00193
00194 double duration;
00195 TRandom3 *randgen;
00196
00197 double Wg;
00198 double sigma_t;
00199 double sigma_f;
00200
00201 void GenerateParameters(void);
00202 double tau;
00203 double taumin;
00204 double taumax;
00205 double phi;
00206 double phimin;
00207 double phimax;
00208 double Q;
00209 double Qmin;
00210 double Qmax;
00211 double amp;
00212 double ampmin;
00213 double ampmax;
00214 double snr;
00215 double phase;
00216
00217 ClassDef(Oinject,0)
00218 };
00219
00220
00221 #endif
00222
00223