FACT++  1.0
bool DataWriteFits2::WriteEvt ( const EVT_CTRL2 evt)
virtual

This writes one event to the file

Parameters
ethe pointer to the EVENT

Implements DataProcessorImp.

Definition at line 249 of file DataWriteFits2.cc.

References MessageImp::Error(), EVT_CTRL2::fEvent, fFile, DataProcessorImp::fFileName, fTriggerCounter, fTstop, str, EVT_CTRL2::time, and EVT_CTRL2::triggerCounter.

Referenced by GetDrsStep(), and DataCalib::WriteEvt().

250 {
251  // Remember the counter of the last written event
253 
254  // Remember the time of the last event
255  fTstop[0] = evt.time.tv_sec;
256  fTstop[1] = evt.time.tv_usec;
257 
258  const EVENT &e = *evt.fEvent;
259 
260  const int realRoiTM = (e.RoiTM > e.Roi) ? e.Roi : 0;
261  const size_t sz = sizeof(EVENT) + sizeof(e.StartPix)*e.Roi+sizeof(e.StartTM)*realRoiTM; //ETIENNE from RoiTm to Roi
262 
263  try
264  {
265  fFile->WriteRow(reinterpret_cast<const char*>(&e)+4, sz-4);
266  }
267  catch (const exception &ex)
268  {
269  Error("ofits::WriteRow failed for '"+fFileName+"': "+ex.what());
270  return false;
271  }
272 
273  if (!(*fFile))
274  {
275  ostringstream str;
276  str << "fstream::write() failed for '" << fFileName << "': " << strerror(errno) << " [errno=" << errno << "]";
277  Error(str);
278  return false;
279  }
280 
281  return true;
282 }
EVENT * fEvent
Definition: EventBuilder.h:132
char str[80]
Definition: test_client.c:7
std::shared_ptr< ofits > fFile
std::string fFileName
std::array< uint32_t, 8 > fTriggerCounter
int Error(const std::string &str)
Definition: MessageImp.h:49
uint32_t fTstop[2]
timeval time
Definition: EventBuilder.h:129
std::array< uint32_t, 8 > triggerCounter
Definition: EventBuilder.h:137

+ Here is the call graph for this function:

+ Here is the caller graph for this function: