FACT++  1.0
bool factofits::WriteTableHeader ( const char *  name = "DATA")
inlinevirtual

Overload of the super function.

Reimplemented from zofits.

Definition at line 87 of file factofits.h.

References ___warn___, fDataOffset, fNumSlices, fOffsetCalibration, zofits::fRealColumns, fStartCellsOffset, gLog, IsOffsetCalibration(), and zofits::WriteTableHeader().

88  {
89  if (!zofits::WriteTableHeader(name))
90  return false;
91 
92  if (!IsOffsetCalibration())
93  return true;
94 
95  //retrieve the column storing the start cell offsets, if required.
96  for (auto it=fRealColumns.cbegin(); it!=fRealColumns.cend(); it++)
97  {
98  if (it->col.name == "StartCellData")
99  fStartCellsOffset = it->col.offset;
100 
101  if (it->col.name == "Data")
102  {
103  fNumSlices = it->col.num;
104  fDataOffset = it->col.offset;
105  if (fNumSlices % 1440 != 0)
106  {
107 #ifdef __EXCEPTIONS
108  throw std::runtime_error("Number of data samples not a multiple of 1440.");
109 #else
110  gLog << ___warn___ << "WARNING - Number of data samples not a multiple of 1440. Doing it uncalibrated." << std::endl;
111 #endif
112  fOffsetCalibration.resize(0);
113  }
114  fNumSlices /= 1440;
115  }
116  }
117 
118  if (fStartCellsOffset < 0)
119  {
120 #ifdef __EXCEPTIONS
121  throw std::runtime_error("FACT Calibration requested, but \"StartCellData\" column not found.");
122 #else
123  gLog << ___warn___ << "WARNING - FACT Calibration requested, but \"StartCellData\" column not found. Doing it uncalibrated." << std::endl;
124 #endif
125  //throw away the calibration data
126  fOffsetCalibration.resize(0);
127  }
128 
129  if (fDataOffset < 0)
130  {
131 #ifdef __EXCEPTIONS
132  throw std::runtime_error("FACT Calibration requested, but \"Data\" column not found.");
133 #else
134  gLog << ___warn___ << "WARNING - FACT Calibration requested, but \"Data\" column not found. Doing it uncalibrated." << std::endl;
135 #endif
136  //throw away the calibration data
137  fOffsetCalibration.resize(0);
138  }
139 
140  return true;
141  }
int32_t fNumSlices
Number of samples per pixel per event.
Definition: factofits.h:366
#define gLog
Definition: fits.h:36
int32_t fDataOffset
Offset in bytes for the data.
Definition: factofits.h:365
int32_t fStartCellsOffset
Offset in bytes for the startcell data.
Definition: factofits.h:364
virtual bool WriteTableHeader(const char *name="DATA")
Definition: zofits.h:165
#define ___warn___
Definition: fits.h:38
std::vector< int16_t > fOffsetCalibration
The calibration itself.
Definition: factofits.h:363
std::vector< CompressedColumn > fRealColumns
Vector hosting the columns of the file.
Definition: zofits.h:1005
virtual bool IsOffsetCalibration()
whether or not a calibration was given to the file writer
Definition: factofits.h:42

+ Here is the call graph for this function: