FACT++  1.0
void DataLogger::AddNewRunNumber ( int64_t  newRun,
Time  time 
)
private

Open the relevant text files related to a particular run.

add a new run number

Add a new active run number

Parameters
newRunthe new run number
timethe time at which the new run number was issued

Definition at line 1216 of file datalogger.cc.

References MessageImp::Debug(), MessageImp::Error(), StateMachineImp::GetCurrentState(), kSM_BadFolder, kSM_Logging, kSM_WaitingRun, StateMachineDim::SetCurrentState(), str, and time.

Referenced by CheckForRunNumber().

1217 {
1218 
1219  if (newRun > 0xffffffff)
1220  {
1221  Error("New run number too large, out of range. Ignoring.");
1222  return;
1223  }
1224  for (std::vector<int64_t>::const_iterator it=previousRunNumbers.begin(); it != previousRunNumbers.end(); it++)
1225  {
1226  if (*it == newRun)
1227  {
1228  Error("Newly provided run number has already been used (or is still in use). Going to error state");
1229  SetCurrentState(kSM_BadFolder, "AddNewRunNumber");
1230  return;
1231  }
1232  }
1233  if (fDebugIsOn)
1234  {
1235  ostringstream str;
1236  str << "Adding new run number " << newRun << " issued at " << time;
1237  Debug(str);
1238  }
1239  //Add new run number to run number list
1240  fRunNumber.push_back(RunNumberType());
1241  fRunNumber.back().runNumber = int32_t(newRun);
1242  fRunNumber.back().time = time;
1243 
1244  if (fDebugIsOn)
1245  {
1246  ostringstream str;
1247  str << "The new run number is: " << fRunNumber.back().runNumber;
1248  Debug(str);
1249  }
1251  return;
1252 
1253  if (newRun > 0 && GetCurrentState() == kSM_WaitingRun)
1254  SetCurrentState(kSM_Logging, "AddNewRunNumber");
1255  if (newRun < 0 && GetCurrentState() == kSM_Logging)
1256  SetCurrentState(kSM_WaitingRun, "AddNewRunNumber");
1257 }
the folder specified for Nightly logging does not exist or has bad permissions
Definition: datalogger.cc:188
int GetCurrentState() const
return the current state of the machine
int Debug(const std::string &str)
Definition: MessageImp.h:45
both files openned and writing
Definition: datalogger.cc:187
char str[80]
Definition: test_client.c:7
bool fDebugIsOn
configuration flags
Definition: datalogger.cc:315
std::vector< int64_t > previousRunNumbers
Definition: datalogger.cc:341
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
list< RunNumberType > fRunNumber
run numbers
Definition: datalogger.cc:211
Run number record. Used to keep track of which run numbers are still active.
Definition: datalogger.cc:106
waiting for the run number to open the run file
Definition: datalogger.cc:186
std::string SetCurrentState(int state, const char *txt="", const std::string &cmd="")

+ Here is the call graph for this function:

+ Here is the caller graph for this function: