| 1 | //--------------------------------------------------------------------------
 | 
|---|
| 2 | // File and Version Information:
 | 
|---|
| 3 | //      $Id: squarefilt.cc,v 1.4 1999-11-29 16:59:12 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 | // Constructor --
 | 
|---|
| 22 | //----------------
 | 
|---|
| 23 | SquareFilter::SquareFilter()
 | 
|---|
| 24 |   : SpectralResponse()
 | 
|---|
| 25 | {
 | 
|---|
| 26 | }
 | 
|---|
| 27 | 
 | 
|---|
| 28 | SquareFilter::SquareFilter(double numin, double numax)
 | 
|---|
| 29 |   : SpectralResponse(numin, numax)
 | 
|---|
| 30 | {
 | 
|---|
| 31 |   _nuPeak = (numin+numax)/2.;
 | 
|---|
| 32 |   _peakTransmission = transmission(_nuPeak);
 | 
|---|
| 33 | }
 | 
|---|
| 34 | 
 | 
|---|
| 35 | 
 | 
|---|
| 36 | //--------------
 | 
|---|
| 37 | // Destructor --
 | 
|---|
| 38 | //--------------
 | 
|---|
| 39 | SquareFilter::~SquareFilter()
 | 
|---|
| 40 | {
 | 
|---|
| 41 | }
 | 
|---|
| 42 | 
 | 
|---|
| 43 | //              ---------------------------
 | 
|---|
| 44 | //              --  Function Definitions --
 | 
|---|
| 45 | //              ---------------------------
 | 
|---|
| 46 | 
 | 
|---|
| 47 | 
 | 
|---|
| 48 | double 
 | 
|---|
| 49 | SquareFilter::transmission(double nu) const
 | 
|---|
| 50 | {
 | 
|---|
| 51 |   if(nu < -1.e99) nu = -1.e99;
 | 
|---|
| 52 |   if(nu > 1.e99) nu = 1.e99;
 | 
|---|
| 53 |   
 | 
|---|
| 54 |   if(nu>=_numin && nu<=_numax) return 1.;
 | 
|---|
| 55 |   return 0.;
 | 
|---|
| 56 | }
 | 
|---|
| 57 | 
 | 
|---|
| 58 | double 
 | 
|---|
| 59 | SquareFilter::peakFreq() const 
 | 
|---|
| 60 | {
 | 
|---|
| 61 | return _nuPeak;
 | 
|---|
| 62 | }
 | 
|---|
| 63 | 
 | 
|---|
| 64 | double 
 | 
|---|
| 65 | SquareFilter::peakTransmission() const 
 | 
|---|
| 66 | {
 | 
|---|
| 67 |   return _peakTransmission;
 | 
|---|
| 68 | }
 | 
|---|
| 69 | 
 | 
|---|
| 70 | /*
 | 
|---|
| 71 | void 
 | 
|---|
| 72 | SquareFilter::WriteSelf(POutPersist& s) 
 | 
|---|
| 73 | {
 | 
|---|
| 74 |   s.PutR8(this->minFreq());
 | 
|---|
| 75 |   s.PutR8(this->maxFreq());
 | 
|---|
| 76 | }
 | 
|---|
| 77 | 
 | 
|---|
| 78 | void 
 | 
|---|
| 79 | SquareFilter::ReadSelf(PInPersist& s) 
 | 
|---|
| 80 | {
 | 
|---|
| 81 |   double minFreq, maxFreq;
 | 
|---|
| 82 |   s.GetR8(_numin);
 | 
|---|
| 83 |   s.GetR8(_numax);
 | 
|---|
| 84 |   cout << "minFreq - maxFreq " <<  _numin << "-" << _numax  << endl;
 | 
|---|
| 85 | }
 | 
|---|
| 86 | */
 | 
|---|