FACT++  1.0
void EventBuilderWrapper::runClose ( const EVT_CTRL2 evt)
inline

Definition at line 665 of file EventBuilderWrapper.h.

References RUN_CTRL2::calib, MessageImp::Error(), DrsCalibration::fRoi, DrsCalibration::fStep, DataCalib::GetCalibration(), MessageImp::Info(), run, EVT_CTRL2::runCtrl, str, time, and EVT_CTRL2::triggerCounter.

Referenced by runClose().

666  {
667  if (!fFile)
668  return;
669 
670  // It can happen that runFinished was never called
671  // (e.g. runWrite failed)
672  if (fRunInProgress==fFile->GetRunId())
673  fRunInProgress = -1;
674 
675  // Close the file
676  const bool rc = fFile->Close(evt);
677 
678  fLastClosed = fFile->GetRunId();
679 
680  ostringstream str;
681  str << "Closed: " << fFile->GetFileName() << " (" << fFile->GetRunId() << ")";
682  if (!rc)
683  str << "... failed!";
684 
685  // Signal that the file is closed
686 
687  fFile.reset();
688 
689  // Now do all the calls which can potentially block (dim)
690 
692 
693  // Time for update events before time for update runs
694  const Time time;
695 
696  fQueueEvents.emplace(time, fNumEvts);
697  fQueueTrigger.emplace(time, 'c', evt.triggerCounter);
698 
699  UpdateRuns();
700 
701  // Do the potentially blocking call after all others
702  rc ? fMsg.Info(str) : fMsg.Error(str);
703 
704  // If a Drs Calibration has just been finished, all following events
705  // should also be processed with this calibration.
706  // Note that this is a generally dangerous operation. Here, the previous
707  // DRS calibration shared_ptr gets freed and if it is the last in use,
708  // the memory will vanish. If another thread accesses that pointer,
709  // it _must_ make a copy of the shared_ptr first to ensure that
710  // the memory will stay in scope until the end of its operation.
712 
713  RUN_CTRL2 &run = *evt.runCtrl;
714  if (!run.calib || run.calib->fStep != cal.fStep || run.calib->fRoi!=cal.fRoi)
715  run.calib = make_shared<DrsCalibration>(cal);
716  }
static const DrsCalibration & GetCalibration()
Definition: DataCalib.h:54
Queue< tuple< Time, char, array< uint32_t, 8 > > > fQueueTrigger
Adds some functionality to boost::posix_time::ptime for our needs.
Definition: Time.h:30
char str[80]
Definition: test_client.c:7
uint16_t fRoi
Definition: DrsCalib.h:1318
void UpdateRuns(const string &fname="")
Queue< pair< Time, array< uint32_t, 4 > > > fQueueEvents
int Error(const std::string &str)
Definition: MessageImp.h:49
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
Definition: smartfact.txt:92
std::shared_ptr< RUN_CTRL2 > runCtrl
Definition: EventBuilder.h:139
static int run
Definition: dim_fork.cxx:9
uint32_t fStep
Definition: DrsCalib.h:1317
shared_ptr< DataProcessorImp > fFile
virtual void CloseRun(uint32_t)
array< uint32_t, 4 > fNumEvts
int Info(const std::string &str)
Definition: MessageImp.h:47
std::array< uint32_t, 8 > triggerCounter
Definition: EventBuilder.h:137
std::shared_ptr< DrsCalibration > calib
Definition: EventBuilder.h:78

+ Here is the call graph for this function:

+ Here is the caller graph for this function: