Commit 0f71b754 authored by Johann Cohen-Tanugi's avatar Johann Cohen-Tanugi
Browse files

move the call of trans() out of filter.cpp and into read() method, so that it...

move the call of trans() out of filter.cpp and into read() method, so that it is guaranteed to be called after clean, and make it private so no other code can call it; this way transtyp can be preserved. Make clean() private as well as there is no reason to call it more than once
parent 1542a294
......@@ -114,8 +114,6 @@ int main (int argc, char *argv[])
flt oneFilt (k,fltFiles[k],transtyp[k],calibtyp[k]);
// read the filter
oneFilt.read(fltFile);
// transform it to have all the filters with a T as a function of energy
oneFilt.trans();
//store all filters in a vector
vecFlt.push_back(oneFilt);
}
......
......@@ -64,12 +64,16 @@ void flt::read(string fltFile) {
//Close the stream
sflt.close();
// Sort the filter, remove the low values on the edge, be sure that the extreme points are ending with 0
clean();
return;
// Sort the filter, remove the low values on the edge, be sure that the extreme points are ending with 0
clean();
// transform it to have all the filters with a T as a function of energy
// trans needs to be after clean because lambdaMean computation supposes that lambda_trans be
// ordered.
trans();
return;
}
......@@ -174,8 +178,6 @@ void flt::trans() {
for (vector<oneElLambda>::iterator it=lamb_trans.begin(); it<lamb_trans.end(); ++it){
// Transform the filter according to trans*(lbd/lbmean)**transtyp (if transtype=0 -> nothing)
(it->val) = (it->val) * (it->lamb) /lmean;
// change the value of transtype
transtyp=0;
}
}
......
......@@ -18,8 +18,19 @@ using namespace std;
/// Class to store filter information. A filter class instance is in essence a vector of oneElLambda elements.
class flt
{
private:
/*! \brief transform a transmission curve in photon units into a transmission curve in energy units.
*
* If TRANS_TYPE=1, the transmission curve is provided in photon units and needs to be converted as
* \f$T(\lambda)\rightarrow T(\lambda)\cdot\lambda/\lambda_m\f$ where \f$\lambda_m\f$ is the mean
* wavelength of the filter transmission curve, see flt::lambdaMean.
* This transformation leaves the transmission curve integral invariant.
*/
void trans();
/// Sort the filter in lambda, remove the values with a low transmission on the edge, be sure that the extreme points are ending with 0
void clean();
public:
vector<oneElLambda> lamb_trans;
int id;
......@@ -96,8 +107,6 @@ class flt
void read(string fltFile);
/// build the vector of oneElLambda elements out of a filter stream directly
void read(ifstream& sfiltIn);
/// Sort the filter in lambda, remove the values with a low transmission on the edge, be sure that the extreme points are ending with 0
void clean();
/// Mean wavelength of the filter: \f$\lambda_{mean} = \frac{\int T(\lambda)\lambda d\lambda}{\int T(\lambda) d\lambda}\f$.
double lambdaMean();
/// full width at half maximum
......@@ -140,15 +149,6 @@ class flt
/// Thuan Gunn correction \f$ = 2.5\,\log10\left(\frac{\int F(BD+17o4708)\,T(\lambda)\,d\lambda}{\int Vega(\lambda)\, T(\lambda)\, d\lambda}\right) + 9.5 - 0.03\f$
double tgcorr();
/*! \brief transform a transmission curve in photon units into a transmission curve in energy units.
*
* If TRANS_TYPE=1, the transmission curve is provided in photon units and needs to be converted as
* \f$T(\lambda)\rightarrow T(\lambda)\cdot\lambda/\lambda_m\f$ where \f$\lambda_m\f$ is the mean
* wavelength of the filter transmission curve, see flt::lambdaMean.
* This transformation leaves the transmission curve integral invariant.
*/
void trans();
/// lowest stored lambda value
double lmin() const;
/// highest stored lambda value
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment