Changeset 17046 for branches/Mars_MC


Ignore:
Timestamp:
08/27/13 14:08:14 (11 years ago)
Author:
ftemme
Message:
Moved the setting of the header keys for the fitsoutput of ceres files from MJSimulation.cc to MWriteFitsFile::ReInit, cause several used header keys are only then known and can't be set in MJSimulation::Process()
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/Mars_MC/mfileio/MWriteFitsFile.cc

    r15277 r17046  
    1515#include "MWriteFitsFile.h"
    1616#include "MFitsArray.h"
     17
     18#include "MTime.h"
    1719
    1820//for find
     
    337339    return kTRUE;
    338340}
     341
     342void MWriteFitsFile::SetupHeaderKeys(MRawRunHeader &header)
     343{
     344    const MTime now(-1);
     345    SetHeaderKey("ISMC",true,"Bool if File is Montecarlo File");
     346    SetHeaderKey("TELESCOP", "FACT", "");
     347    SetHeaderKey("PACKAGE", "MARS Cheobs", "");
     348    SetHeaderKey("VERSION", "1.0", "");
     349    SetHeaderKey("CREATOR", "Ceres", "");
     350    SetHeaderKey("EXTREL", 1., "");
     351    SetHeaderKey("COMPILED", __DATE__" "__TIME__, "");
     352    //SetHeaderKey("REVISION", "0", "");
     353    SetHeaderKey("ORIGIN", "FACT", "");
     354    SetHeaderKey("DATE", now.GetStringFmt("%Y-%m-%dT%H:%M:%S").Data(), "");
     355    SetHeaderKey("NIGHT", now.GetNightAsInt(), "");
     356    SetHeaderKey("TIMESYS", "UTC", "");
     357    SetHeaderKey("TIMEUNIT", "d", "");
     358    SetHeaderKey("MJDREF", 40587, "");
     359    //SetHeaderKey("BLDVER", 1, "");
     360    SetHeaderKey("RUNID", header.GetRunNumber(), "");
     361    SetHeaderKey("NBOARD", 40, "");
     362    SetHeaderKey("NPIX", header.GetNumPixel(), "");
     363    SetHeaderKey("NROI", header.GetNumSamplesHiGain(), "");
     364    SetHeaderKey("NROITM", 0, "");
     365    SetHeaderKey("TMSHIFT", 0, "");
     366    SetHeaderKey("CAMERA", "MGeomCamFACT", "Montecarlo File");
     367    SetHeaderKey("DAQ", "DRS4", "Montecarlo File");
     368
     369    // FTemme: ADCRANGE and ADC have to be calculated, using the values for
     370    // the fadctype.
     371//    SetHeaderKey("ADCRANGE", 2000, "Dynamic range in mV");
     372//    SetHeaderKey("ADC", 12, "Resolution in bits");
     373
     374    switch(header.GetRunType())
     375    {
     376    case MRawRunHeader::kRTData|MRawRunHeader::kRTMonteCarlo:
     377        SetHeaderKey("RUNTYPE", "data", "");
     378        break;
     379    case MRawRunHeader::kRTPedestal|MRawRunHeader::kRTMonteCarlo:
     380        SetHeaderKey("RUNTYPE", "pedestal", "");
     381        break;
     382    case MRawRunHeader::kRTCalibration|MRawRunHeader::kRTMonteCarlo:
     383        SetHeaderKey("RUNTYPE", "calibration", "");
     384        break;
     385    }
     386//    SetHeaderKey("ID", 777, "Board  0: Board ID");
     387//    SetHeaderKey("FMVER", 532, "Board  0: Firmware Version");
     388//    SetHeaderKey("DNA", "0", "");
     389//    SetHeaderKey("BOARD", 0, "");
     390//    SetHeaderKey("PRESC", 40, "");
     391//    SetHeaderKey("PHASE", 0, "");
     392//    SetHeaderKey("DAC0", 26500, "");
     393//    SetHeaderKey("DAC1", 0, "");
     394//    SetHeaderKey("DAC2", 0, "");
     395//    SetHeaderKey("DAC3", 0, "");
     396//    SetHeaderKey("DAC4", 28800, "");
     397//    SetHeaderKey("DAC5", 28800, "");
     398//    SetHeaderKey("DAC6", 28800, "");
     399//    SetHeaderKey("DAC7", 28800, "");
     400    SetHeaderKey("REFCLK", header.GetFreqSampling(), "");
     401    SetHeaderKey("DRSCALIB", false, "");
     402//    SetHeaderKey("TSTARTI", 0, "");
     403//    SetHeaderKey("TSTARTF", 0., "");
     404//    SetHeaderKey("TSTOPI", 0, "");
     405//    SetHeaderKey("TSTOPF", 0., "");
     406//    SetHeaderKey("DATE-OBS", "1970-01-01T00:00:00", "");
     407//    SetHeaderKey("DATE-END", "1970-01-01T00:00:00", "");
     408//    SetHeaderKey("NTRG", 0, "");
     409//    SetHeaderKey("NTRGPED", 0, "");
     410//    SetHeaderKey("NTRGLPE", 0, "");
     411//    SetHeaderKey("NTRGTIM", 0, "");
     412//    SetHeaderKey("NTRGLPI", 0, "");
     413//    SetHeaderKey("NTRGEXT1", 0, "");
     414//    SetHeaderKey("NTRGEXT2", 0, "");
     415//    SetHeaderKey("NTRGMISC", 0, "");
     416}
     417
    339418template<>
    340419std::string MWriteFitsFile::GetFitsString(const double& value)
     
    11271206      return kFALSE;
    11281207
     1208
     1209   MRawRunHeader* header = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
     1210   SetupHeaderKeys(*header);
     1211
    11291212   if (GetContainer(pList) == kFALSE)
    11301213      return kFALSE;
Note: See TracChangeset for help on using the changeset viewer.