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