FACT++  1.0
void EventBuilderWrapper::gotNewRun ( RUN_CTRL2 run)
inline

Definition at line 1122 of file EventBuilderWrapper.h.

References RUN_CTRL2::closeTime, MessageImp::Info(), RUN_CTRL2::maxEvt, RUN_CTRL2::night, RUN_CTRL2::openTime, RUN_CTRL2::runId, RUN_CTRL2::runType, str, and MessageImp::Warn().

Referenced by gotNewRun().

1123  {
1124  // This is to secure iteration over fExpectedRuns
1125  const lock_guard<mutex> lock(mtx_newrun);
1126 
1127  map<uint32_t,FAD::RunDescription>::iterator it = fExpectedRuns.begin();
1128  while (it!=fExpectedRuns.end())
1129  {
1130  if (it->first<run.runId)
1131  {
1132  ostringstream str;
1133  str << "runOpen - Missed run " << it->first << ".";
1134  fMsg.Info(str);
1135 
1136  // Increase the iterator first, it becomes invalid with the next call
1137  const auto is = it++;
1138  fExpectedRuns.erase(is);
1139  continue;
1140  }
1141 
1142  if (it->first==run.runId)
1143  break;
1144 
1145  it++;
1146  }
1147 
1148  if (it==fExpectedRuns.end())
1149  {
1150  ostringstream str;
1151  str << "runOpen - Run " << run.runId << " wasn't expected (maybe manual triggers)";
1152  fMsg.Warn(str);
1153 
1154  // This is not ideal, but the best we can do
1155  run.night = fNightAsInt;
1156 
1157  return;
1158  }
1159 
1160  const FAD::RunDescription &conf = it->second;
1161 
1162  run.runType = conf.name;
1163  run.maxEvt = conf.maxevt;
1164  run.closeTime = conf.maxtime + run.openTime;
1165  run.night = conf.night;
1166 
1167  fExpectedRuns.erase(it);
1168 
1169  // Now signal the fadctrl (configuration process that a run is in progress)
1170  // Maybe this could be done earlier, but we are talking about a
1171  // negligible time scale here.
1172  fRunInProgress = run.runId;
1173  }
std::string runType
Definition: EventBuilder.h:72
char str[80]
Definition: test_client.c:7
int64_t runId
Definition: EventBuilder.h:57
map< uint32_t, FAD::RunDescription > fExpectedRuns
uint32_t maxEvt
Definition: EventBuilder.h:67
int Warn(const std::string &str)
Definition: MessageImp.h:48
uint32_t night
Definition: EventBuilder.h:64
int Info(const std::string &str)
Definition: MessageImp.h:47
time_t openTime
Definition: EventBuilder.h:61
time_t closeTime
Definition: EventBuilder.h:63

+ Here is the call graph for this function:

+ Here is the caller graph for this function: