FACT++  1.0
std::string DrsCalibration::WriteFitsImp ( const std::string &  filename,
const std::vector< float > &  vec,
uint32_t  night = 0 
) const
inline

Definition at line 1531 of file DrsCalib.h.

1532  {
1533  const size_t n = 1440*1024*4 + 1440*fRoi*2 + fNumTm*fRoi*2 + 3;
1534 
1535  ofits file(filename.c_str());
1536  if (!file)
1537  {
1538  std::ostringstream msg;
1539  msg << "Could not open file '" << filename << "': " << strerror(errno);
1540  return msg.str();
1541  }
1542 
1543  file.AddColumnInt("RunNumberBaseline");
1544  file.AddColumnInt("RunNumberGain");
1545  file.AddColumnInt("RunNumberTriggerOffset");
1546 
1547  file.AddColumnFloat(1024*1440, "BaselineMean", "mV");
1548  file.AddColumnFloat(1024*1440, "BaselineRms", "mV");
1549  file.AddColumnFloat(1024*1440, "GainMean", "mV");
1550  file.AddColumnFloat(1024*1440, "GainRms", "mV");
1551  file.AddColumnFloat(fRoi*1440, "TriggerOffsetMean", "mV");
1552  file.AddColumnFloat(fRoi*1440, "TriggerOffsetRms", "mV");
1553  file.AddColumnFloat(fRoi*fNumTm, "TriggerOffsetTMMean", "mV");
1554  file.AddColumnFloat(fRoi*fNumTm, "TriggerOffsetTMRms", "mV");
1555 
1556  file.SetDefaultKeys();
1557  if (night>0)
1558  file.SetInt("NIGHT", night, "Night as int");
1559 
1560  file.SetStr("DATE-OBS", fDateObs, "First event of whole DRS calibration");
1561  file.SetStr("DATE-END", fDateEnd, "Last event of whole DRS calibration");
1562  file.SetStr("RUN0-BEG", fDateRunBeg[0], "First event of run 0");
1563  file.SetStr("RUN1-BEG", fDateRunBeg[1], "First event of run 1");
1564  file.SetStr("RUN2-BEG", fDateRunBeg[2], "First event of run 2");
1565  file.SetStr("RUN0-END", fDateRunEnd[0], "Last event of run 0");
1566  file.SetStr("RUN1-END", fDateRunEnd[1], "Last event of run 1");
1567  file.SetStr("RUN2-END", fDateRunEnd[2], "Last event of run 2");
1568 
1569  file.SetInt("STEP", fStep, "");
1570 
1571  file.SetInt("ADCRANGE", 2000, "Dynamic range of the ADC in mV");
1572  file.SetInt("DACRANGE", 2500, "Dynamic range of the DAC in mV");
1573  file.SetInt("ADC", 12, "Resolution of ADC in bits");
1574  file.SetInt("DAC", 16, "Resolution of DAC in bits");
1575  file.SetInt("NPIX", 1440, "Number of channels in the camera");
1576  file.SetInt("NTM", fNumTm, "Number of time marker channels");
1577  file.SetInt("NROI", fRoi, "Region of interest");
1578 
1579  file.SetInt("NBOFFSET", fNumOffset, "Num of entries for offset calibration");
1580  file.SetInt("NBGAIN", fNumGain/1953125, "Num of entries for gain calibration");
1581  file.SetInt("NBTRGOFF", fNumTrgOff, "Num of entries for trigger offset calibration");
1582 
1583  // file.WriteKeyNT("DAC_A", fData.fDAC[0], "Level of DAC 0 in DAC counts") ||
1584  // file.WriteKeyNT("DAC_B", fData.fDAC[1], "Leval of DAC 1-3 in DAC counts") ||
1585  // file.WriteKeyNT("DAC_C", fData.fDAC[4], "Leval of DAC 4-7 in DAC counts") ||
1586 
1587  file.WriteTableHeader("DrsCalibration");
1588 
1589  if (!file.WriteRow(vec.data()+1, n*sizeof(float)))
1590  {
1591  std::ostringstream msg;
1592  msg << "Writing data to " << filename << " failed.";
1593  return msg.str();
1594  }
1595 
1596  return std::string();
1597  }
int64_t fNumGain
Definition: DrsCalib.h:1314
std::string fDateEnd
Definition: DrsCalib.h:1324
int64_t fNumTrgOff
Definition: DrsCalib.h:1315
uint16_t fRoi
Definition: DrsCalib.h:1318
uint16_t fNumTm
Definition: DrsCalib.h:1319
Definition: ofits.h:29
std::string fDateRunBeg[3]
Definition: DrsCalib.h:1322
std::string fDateRunEnd[3]
Definition: DrsCalib.h:1323
uint32_t fStep
Definition: DrsCalib.h:1317
std::string fDateObs
Definition: DrsCalib.h:1321
int64_t fNumOffset
Definition: DrsCalib.h:1313