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