| 1 | //--------------------------------------------------------------------------
|
|---|
| 2 | // File and Version Information:
|
|---|
| 3 | // $Id: squarefilt.cc,v 1.5 2000-04-13 14:10:45 ansari Exp $
|
|---|
| 4 | //
|
|---|
| 5 | // Description:
|
|---|
| 6 | //
|
|---|
| 7 | // History (add to end):
|
|---|
| 8 | // Sophie Oct, 1999 - creation
|
|---|
| 9 | //
|
|---|
| 10 | //------------------------------------------------------------------------
|
|---|
| 11 |
|
|---|
| 12 | //---------------
|
|---|
| 13 | // C++ Headers --
|
|---|
| 14 | //---------------
|
|---|
| 15 | #include "machdefs.h"
|
|---|
| 16 | #include <iostream.h>
|
|---|
| 17 |
|
|---|
| 18 | #include "squarefilt.h"
|
|---|
| 19 |
|
|---|
| 20 | /*!
|
|---|
| 21 | * \class SOPHYA::SquareFilter
|
|---|
| 22 | * Square detector response
|
|---|
| 23 | */
|
|---|
| 24 |
|
|---|
| 25 | //----------------
|
|---|
| 26 | // Constructor --
|
|---|
| 27 | //----------------
|
|---|
| 28 | SquareFilter::SquareFilter()
|
|---|
| 29 | : SpectralResponse()
|
|---|
| 30 | {
|
|---|
| 31 | }
|
|---|
| 32 |
|
|---|
| 33 | SquareFilter::SquareFilter(double numin, double numax)
|
|---|
| 34 | : SpectralResponse(numin, numax)
|
|---|
| 35 | {
|
|---|
| 36 | _nuPeak = (numin+numax)/2.;
|
|---|
| 37 | _peakTransmission = transmission(_nuPeak);
|
|---|
| 38 | }
|
|---|
| 39 |
|
|---|
| 40 |
|
|---|
| 41 | //--------------
|
|---|
| 42 | // Destructor --
|
|---|
| 43 | //--------------
|
|---|
| 44 | SquareFilter::~SquareFilter()
|
|---|
| 45 | {
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | // ---------------------------
|
|---|
| 49 | // -- Function Definitions --
|
|---|
| 50 | // ---------------------------
|
|---|
| 51 |
|
|---|
| 52 |
|
|---|
| 53 | /*! The transmission returns 1. for frequencies in the [numin,numax] range
|
|---|
| 54 | and 0. outside */
|
|---|
| 55 | double
|
|---|
| 56 | SquareFilter::transmission(double nu) const
|
|---|
| 57 | {
|
|---|
| 58 | if(nu < -1.e99) nu = -1.e99;
|
|---|
| 59 | if(nu > 1.e99) nu = 1.e99;
|
|---|
| 60 |
|
|---|
| 61 | if(nu>=_numin && nu<=_numax) return 1.;
|
|---|
| 62 | return 0.;
|
|---|
| 63 | }
|
|---|
| 64 |
|
|---|
| 65 | double
|
|---|
| 66 | SquareFilter::peakFreq() const
|
|---|
| 67 | {
|
|---|
| 68 | return _nuPeak;
|
|---|
| 69 | }
|
|---|
| 70 |
|
|---|
| 71 | double
|
|---|
| 72 | SquareFilter::peakTransmission() const
|
|---|
| 73 | {
|
|---|
| 74 | return _peakTransmission;
|
|---|
| 75 | }
|
|---|
| 76 |
|
|---|
| 77 | /*
|
|---|
| 78 | void
|
|---|
| 79 | SquareFilter::WriteSelf(POutPersist& s)
|
|---|
| 80 | {
|
|---|
| 81 | s.PutR8(this->minFreq());
|
|---|
| 82 | s.PutR8(this->maxFreq());
|
|---|
| 83 | }
|
|---|
| 84 |
|
|---|
| 85 | void
|
|---|
| 86 | SquareFilter::ReadSelf(PInPersist& s)
|
|---|
| 87 | {
|
|---|
| 88 | double minFreq, maxFreq;
|
|---|
| 89 | s.GetR8(_numin);
|
|---|
| 90 | s.GetR8(_numax);
|
|---|
| 91 | cout << "minFreq - maxFreq " << _numin << "-" << _numax << endl;
|
|---|
| 92 | }
|
|---|
| 93 | */
|
|---|