Ignore:
Timestamp:
10/17/13 16:47:44 (11 years ago)
Author:
tbretz
Message:
Fixed a square root of a potenitally negative number; replaced setting the default keys in the fits file with SetDefaultKeys; added night as an argument to WriteFitsImp
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcore/DrsCalib.h

    r16843 r17241  
    504504        rc.avg /= rc.cnt;
    505505        rc.rms /= rc.cnt;
    506 
    507         rc.rms = sqrt(rc.rms-rc.avg*rc.avg);
     506        rc.rms -= rc.avg*rc.avg;
     507        rc.rms  = rc.rms<0 ? 0 : sqrt(rc.rms);
    508508
    509509        return rc;
     
    13771377    }
    13781378
    1379     std::string WriteFitsImp(const std::string &filename, const std::vector<float> &vec) const
     1379    std::string WriteFitsImp(const std::string &filename, uint32_t night, const std::vector<float> &vec) const
    13801380    {
    13811381        const size_t n = 1440*1024*4 + 1440*fRoi*2 + fNumTm*fRoi*2 + 3;
     
    14061406        file.AddColumnFloat(fRoi*fNumTm, "TriggerOffsetTMRms",  "mV");
    14071407
    1408 #ifdef __MARS__
    1409         const MTime now(-1);
    1410         file.SetStr(  "TELESCOP", "FACT",               "Telescope that acquired this data");
    1411         file.SetStr(  "PACKAGE",  "MARS",               "Package name");
    1412         file.SetStr(  "VERSION",  "1.0",                "Package description");
    1413         //file.SetStr(  "CREATOR",  "root",               "Program that wrote this file");
    1414         file.SetFloat("EXTREL",   1.0,                  "Release Number");
    1415         file.SetStr(  "COMPILED", __DATE__" "__TIME__,  "Compile time");
    1416         //file.SetStr(  "REVISION", REVISION,             "SVN revision");
    1417         file.SetStr(  "ORIGIN",   "FACT",               "Institution that wrote the file");
    1418         file.SetStr(  "DATE",     now.GetStringFmt("%Y-%m-%dT%H:%M:%S").Data(), "File creation date");
    1419         file.SetInt(  "NIGHT",    now.GetNightAsInt(),  "Night as int");
    1420         file.SetStr(  "TIMESYS",  "UTC",                "Time system");
    1421         file.SetStr(  "TIMEUNIT", "d",                  "Time given in days w.r.t. to MJDREF");
    1422         file.SetInt(  "MJDREF",   40587,                "MJD to UNIX time (seconds since 1970/1/1)");
    1423 #else
    1424         DataWriteFits2::WriteDefaultKeys(file);
    1425 #endif
     1408        file.SetDefaultKeys();
     1409        file.SetInt("NIGHT", night, "Night as int");
     1410
    14261411        file.SetStr("DATE-OBS", fDateObs, "First event of whole DRS calibration");
    14271412        file.SetStr("DATE-END", fDateEnd, "Last event of whole DRS calibration");
Note: See TracChangeset for help on using the changeset viewer.