17 factfits(
const std::string& fname,
const std::string& tableName=
"",
bool force=
false) :
18 zfits(fname, tableName, force),
29 factfits(
const std::string& fname,
const std::string& fout,
const std::string& tableName,
bool force=
false) :
30 zfits(fname, fout, tableName, force),
73 for (
int ch=0; ch<1440; ch++)
81 const int16_t modStart = startCell[ch] % 1024;
84 const int16_t *cal = off+modStart;
85 const int16_t *end_stride = data+
fNumRoi;
87 if (modStart+fNumRoi>1024)
94 while (data<end_stride)
105 if (Get<uint16_t>(
"NPIX")!=1440)
108 fNumRoi = Get<uint16_t>(
"NROI");
113 const Table::Columns::const_iterator it =
fTable.
cols.find(
"Data");
114 if (it==
fTable.
cols.end() || it->second.num!=1440*
fNumRoi || it->second.type!=
'I')
118 const Table::Columns::const_iterator is =
fTable.
cols.find(
"StartCellData");
119 if (is==
fTable.
cols.end() || is->second.num!=1440 || is->second.type!=
'I')
135 zfits calib(fileName,
"ZDrsCellOffsets");
139 clear(rdstate()|std::ios::badbit);
149 clear(rdstate()|std::ios::badbit);
151 throw std::runtime_error(
"Table 'ZDrsCellOffsets' found, but not with one row as expected");
153 gLog <<
___err___ <<
"ERROR - Table 'ZDrsCellOffsets' found, but not with one row as expected" << std::endl;
157 if (calib.
GetStr(
"TTYPE1") !=
"OffsetCalibration")
159 clear(rdstate()|std::ios::badbit);
161 throw std::runtime_error(
"Table 'ZDrsCellOffsets' found, but first column is not the one expected");
163 gLog <<
___err___ <<
"ERROR - Table 'ZDrsCellOffsets' found, but first column is not the one expected" << std::endl;
167 bool isColumnPresent =
false;
168 if (calib.
HasKey(
"TFORM1") && calib.
GetStr(
"TFORM1") ==
"1474560I") isColumnPresent =
true;
169 if (calib.
HasKey(
"ZFORM1") && calib.
GetStr(
"ZFORM1") ==
"1474560I") isColumnPresent =
true;
170 if (!isColumnPresent)
172 clear(rdstate()|std::ios::badbit);
174 throw std::runtime_error(
"Table 'ZDrsCellOffsets' has wrong column format (TFROM1)");
176 gLog <<
___err___ <<
"ERROR - Table 'ZDrsCellOffsets' has wrong column format (TFORM1)" << std::endl;
187 clear(rdstate()|std::ios::badbit);
190 throw std::runtime_error(
"Reading column 'OffsetCalibration' failed.");
192 gLog <<
___err___ <<
"ERROR - Reading column 'OffsetCalibration' failed." << std::endl;
204 #warning Time marker channels currently unhandled
bool HasKey(const std::string &key) const
std::string GetStr(const std::string &key) const
factfits(const std::string &fname, const std::string &fout, const std::string &tableName, bool force=false)
void * SetPtrAddress(const std::string &name)
bool IsCompressedFITS() const
size_t fOffsetStartCellData
size_t GetNumRows() const
const std::vector< int16_t > & GetOffsetCalibration() const
bool GetNextRow(bool check=true)
std::vector< int16_t > fOffsetCalibration
integer values of the drs calibration used for compression
std::vector< char > fBufferRow
void StageRow(size_t row, char *dest)
virtual void StageRow(size_t row, char *dest)
void readDrsCalib(const std::string &fileName)
factfits(const std::string &fname, const std::string &tableName="", bool force=false)