FACT++  1.0
int StateMachineMCP::StartRun ( const EventImp evt)
inlineprivate

Definition at line 184 of file mcp.cc.

References Error(), EventImp::Get(), MCP::State::kConfiguring1, RateControl::State::kConnected, DimState::online(), EventImp::Ptr(), Dim::SendCommandNB(), DimState::state(), and str.

Referenced by StateMachineMCP().

185  {
186  if (!fDimFTM.online())
187  {
188  Error("No connection to ftmcontrol (see PRINT).");
189  return GetCurrentState();
190  }
191  if (!fDimFAD.online())
192  {
193  Warn("No connection to fadcontrol (see PRINT).");
194  return GetCurrentState();
195  }
196  if (!fDimLog.online())
197  {
198  Warn("No connection to datalogger (see PRINT).");
199  return GetCurrentState();
200  }
201  if (!fDimRC.online())
202  {
203  Warn("No connection to ratecontrol (see PRINT).");
204  return GetCurrentState();
205  }
206 
207  fMaxTime = evt.Get<int64_t>();
208  fNumEvents = evt.Get<int64_t>(8);
209  fRunType = evt.Ptr<char>(16);
210 
211  fNumReset = 0;
212 
213  ostringstream str;
214  str << "Starting configuration '" << fRunType << "' for new run";
215  if (fNumEvents>0 || fMaxTime>0)
216  str << " [";
217  if (fNumEvents>0)
218  str << fNumEvents << " events";
219  if (fNumEvents>0 && fMaxTime>0)
220  str << " / ";
221  if (fMaxTime>0)
222  str << fMaxTime << "s";
223  if (fNumEvents>0 || fMaxTime>0)
224  str << "]";
225  Message(str);
226 
227  // Strictly speaking, it is not necessary, but
228  // stopping the ratecontrol before we configure
229  // the FTM ensures that no threshold setting commands
230  // interfere with the configuration of the FTM.
232  {
233  Dim::SendCommandNB("RATE_CONTROL/STOP");
234  Message("Stopping ratecontrol");
235  }
236 
237  if (fDimLog.state()<30/*kSM_WaitForRun*/)
238  {
239  Dim::SendCommandNB("DATA_LOGGER/START_RUN_LOGGING");
240  Message("Starting datalogger");
241  }
242 
245  }
int GetCurrentState() const
return the current state of the machine
int64_t fMaxTime
Definition: mcp.cc:180
string fRunType
Definition: mcp.cc:182
char str[80]
Definition: test_client.c:7
DimDescribedState fDimFTM
Definition: mcp.cc:46
const int32_t & state() const
Definition: DimState.h:80
int64_t fNumEvents
Definition: mcp.cc:181
int Error(const std::string &str)
Definition: MessageImp.h:49
DimDescribedState fDimFAD
Definition: mcp.cc:47
void Update(int newstate)
Definition: mcp.cc:270
void SendCommandNB(const std::string &command)
Definition: Dim.h:30
uint16_t fNumReset
Definition: mcp.cc:43
int Warn(const std::string &str)
Definition: MessageImp.h:48
DimDescribedState fDimLog
Definition: mcp.cc:48
bool online() const
Definition: DimState.h:82
int Message(const std::string &str)
Definition: MessageImp.h:46
T Get(size_t offset=0) const
Definition: EventImp.h:66
const T * Ptr(size_t offset=0) const
Definition: EventImp.h:74
DimDescribedState fDimRC
Definition: mcp.cc:49

+ Here is the call graph for this function:

+ Here is the caller graph for this function: