1 #if ROOT_VERSION_CODE >= ROOT_VERSION(6,00,0)
3 R__LOAD_LIBRARY(libdecoder_maindaq)
10 if (dirp == 0)
return false;
11 const char* name_char;
12 while ((name_char = gSystem->GetDirEntry(dirp))) {
13 string name = name_char;
14 int length = name.length();
15 if (length < 4 || name.substr(length-4, 4) !=
".dat")
continue;
17 list_run.push_back(run);
20 gSystem->FreeDirectory(dirp);
22 sort(list_run.begin(), list_run.end());
32 oss <<
"/dev/shm/decoder_maindaq";
33 gSystem->mkdir(oss.str().c_str(),
true);
34 oss <<
"/log_" << setfill(
'0') << setw(6) << run <<
".txt";
35 string fn_log = oss.str();
36 if (! gSystem->AccessPathName(fn_log.c_str())) {
37 for (
int ii = 1;
true; ii++) {
39 oss << fn_log <<
"." << ii;
40 if (gSystem->AccessPathName(oss.str().c_str())) {
41 cout <<
"Rename the existing log file with suffix=" << ii <<
"." << endl;
42 gSystem->Rename(fn_log.c_str(), oss.str().c_str());
49 oss <<
"root.exe -b -q '" << gSystem->Getenv(
"E1039_CORE")
50 <<
"/macros/online/Fun4MainDaq.C(" << run <<
", " << n_evt <<
", " << is_online <<
")' &>" << fn_log <<
" &";
52 cout <<
"Start the decoder for run " << run <<
":\n"
53 <<
" Log file = " << fn_log <<
"\n"
54 <<
" Command: " << oss.str() << endl;
55 gSystem->Exec(oss.str().c_str());
60 gSystem->Load(
"libdecoder_maindaq.so");
62 vector<int> list_run_done;
64 cout <<
"The Coda-file directory seems not mounted. Wait for 1 min." << endl;
70 cout <<
"Sleep for " << interval <<
" sec. Hit Ctrl-C to quit..." << endl;
74 cout <<
"The Coda-file directory doesn't exist. Strange but just wait." << endl;
77 for (vector<int>::iterator it = list_run.begin(); it != list_run.end(); it++) {
79 if (find(list_run_done.begin(), list_run_done.end(),
run) == list_run_done.end()) {
80 list_run_done.push_back(run);
int run(const int nEvents=1)
static std::string GetCodaFileDir()
static int CodaFile2RunNum(const std::string name)
Convert the name of a Coda file to its run number.
bool FindExistingRuns(vector< int > &list_run)
Daemon4MainDaq.C.
void StartDecoder(const int run, const int n_evt=0, const bool is_online=true)
int Daemon4MainDaq(const int interval=30)