6 #include <onlmon/HistoBinDefs.h>
7 #include <onlmon/OnlMonBase.h>
8 #include <onlmon/OnlMonDefs.h>
10 #include <MessageTypes.h>
12 #include <TDirectory.h>
18 #include <TIterator.h>
22 #include <TSeqCollection.h>
34 #include <sys/utsname.h>
36 #include <uuid/uuid.h>
75 if (gROOT->FindObject(
"ServerRunning"))
77 std::cout <<
"Don't run Server and Client in same session, exiting" << std::endl;
82 const char *env_display = getenv(
"DISPLAY");
86 std::cout <<
"Cannot open Display, Display Env Var is set to "
87 << displaystring << std::endl;
88 if (displaystring.find(
"unix") != std::string::npos)
92 std::cout <<
"presumably the virtual framebuffer is not running on " << ThisNode.nodename
93 <<
", check if process /usr/X11R6/bin/Xvfb is alive" << std::endl;
95 else if (displaystring.find(
"localhost") != std::string::npos)
97 std::cout <<
"Check your ssh forwarding" << std::endl;
98 std::cout <<
"your $HOME/.ssh/config has to contain the line" << std::endl;
99 std::cout <<
"ForwardX11 yes" << std::endl;
104 std::cout <<
"Display not set, cannot continue" << std::endl;
109 clientrunning =
new TH1F(
"ClientRunning",
"ClientRunning", 1, 0, 1);
110 if (getenv(
"ONLMON_HTMLDIR") ==
nullptr)
112 std::cout <<
"ONLMON_HTMLDIR not set, exiting" << std::endl;
117 TGFrame *rootWin = (TGFrame *) gClient->GetRoot();
120 for (
int i = 0;
i < kMAXSIGNALS;
i++)
122 gSystem->IgnoreSignal((ESignals)
i);
133 std::cout <<
"deleting " <<
DrawerList.begin()->first << std::endl;
140 delete Histo.begin()->second;
147 TSeqCollection *allCanvases = gROOT->GetListOfCanvases();
148 TCanvas *canvas =
nullptr;
149 while ((canvas = static_cast<TCanvas *>(allCanvases->First())))
153 std::cout <<
"Deleting Canvas " << canvas->GetName() << std::endl;
166 std::map<const std::string, ClientHistoList *>
entry;
168 subsysiter =
SubsysHisto.insert(std::make_pair(subsys, entry)).first;
171 std::cout <<
"inserting " << subsys <<
" into SubsysHisto, readback: " << subsysiter->first << std::endl;
174 auto hiter = subsysiter->second.find(hname);
175 if (hiter == subsysiter->second.end())
179 subsysiter->second.insert(std::make_pair(hname, newhisto));
182 std::cout <<
"new histogram " << hname <<
" of subsystem " << subsys << std::endl;
187 hiter->second->SubSystem(subsys);
191 hiter = subsysiter->second.find(frameworkhistoname);
192 if (hiter == subsysiter->second.end())
196 subsysiter->second.insert(std::make_pair(frameworkhistoname, newhisto));
199 std::cout <<
"new histogram " << frameworkhistoname <<
" of subsystem " << subsys << std::endl;
204 hiter->second->SubSystem(subsys);
212 std::string mysubsys = subsys.substr(0,subsys.find(
'_'));
215 if (frwrkiter.find(mysubsys) == std::string::npos)
217 m_MonitorFetchedSet.clear();
222 std::map<const std::string, ClientHistoList *>::const_iterator histoiter;
223 std::map<const std::string, ClientHistoList *>::const_iterator histonewiter;
238 for (
auto &hiter : subsyshistos->second)
240 hiter.second->ServerHost(
"UNKNOWN");
241 hiter.second->ServerPort(0);
242 if (hiter.second->Histo() !=
nullptr)
244 hiter.second->Histo()->Delete();
246 hiter.second->Histo(
nullptr);
255 std::map<std::string, std::map<const std::string, ClientHistoList *>>::const_iterator
histos =
SubsysHisto.find(subsys);
256 for (
auto &hiter : histos->second)
262 std::cout <<
"Request for " << hiter.first <<
" on " << subsys <<
" failed " << std::endl;
264 if (hiter.second->Histo())
266 hiter.second->Histo()->Delete();
267 hiter.second->Histo(
nullptr);
268 hiter.second->ServerHost(
"UNKNOWN");
269 hiter.second->ServerPort(0);
275 else if (getall == 1)
277 std::map<std::string, std::list<std::string>> transferlist;
278 std::ostringstream host_port;
280 int failed_to_locate = 0;
283 for (
auto &
histos : subs->second)
287 std::cout <<
"checking for subsystem " << subs->first <<
", histo " <<
histos.first << std::endl;
289 if (
histos.second->SubSystem() == subsys)
291 int unknown_histo = 0;
293 if (
histos.second->ServerHost() ==
"UNKNOWN")
295 if (!failed_to_locate)
301 std::cout <<
"Subsystem " << subsys <<
" Histogram " << hname <<
" cannot be located" << std::endl;
303 failed_to_locate = 1;
314 if (
histos.second->Histo())
316 histos.second->Histo()->Reset();
321 (transferlist[subsys]).push_back(fullhname);
326 std::list<std::string>::const_iterator liter;
327 for (
auto listiter = transferlist.begin(); listiter != transferlist.end(); ++listiter)
329 std::list<std::string> hlist = listiter->second;
333 std::cout << __PRETTY_FUNCTION__ <<
"Cannot find MonitorHostPorts entry for " << listiter->first << std::endl;
334 std::cout <<
"existing hosts: " << std::endl;
337 std::cout <<
"subsystem " << hport.first <<
" on host " << hport.second.first
338 <<
" listening on port " << hport.second.second << std::endl;
342 if (
requestHistoList(listiter->first, hostportiter->second.first, hostportiter->second.second, hlist) != 0)
344 for (liter = hlist.begin(); liter != hlist.end(); ++liter)
348 std::cout <<
"Request for " << *liter <<
" failed " << std::endl;
349 histoiter =
Histo.find(*liter);
350 if (histoiter->second && histoiter->second->Histo())
352 histoiter->second->Histo()->Delete();
353 histoiter->second->Histo(
nullptr);
354 histoiter->second->ServerHost(
"UNKNOWN");
355 histoiter->second->ServerPort(0);
362 else if (getall == 2)
364 const char *hname =
"none";
365 for (histoiter =
Histo.begin(); histoiter !=
Histo.end(); ++histoiter)
367 if (histoiter->second->SubSystem() == subsys)
369 hname = histoiter->first.c_str();
374 if (histoiter !=
Histo.end())
376 std::string hostname = histoiter->second->ServerHost();
377 int moniport = histoiter->second->ServerPort();
379 if (hostname ==
"UNKNOWN")
383 std::cout <<
"Histogram " << hname <<
" cannot be located" << std::endl;
386 histonewiter =
Histo.find(hname);
387 hostname = histonewiter->second->ServerHost();
388 moniport = histonewiter->second->ServerPort();
392 for (histonewiter =
Histo.begin(); histonewiter !=
Histo.end(); ++histonewiter)
394 if (histonewiter->second->SubSystem() == subsys)
396 if (histonewiter->second->Histo())
398 histonewiter->second->Histo()->Reset();
405 std::cout <<
"Request for all histograms from "
406 << hostname <<
" failed, trying single " << std::endl;
413 std::cout <<
"No Histogram of subsystem "
414 << subsys <<
" registered" << std::endl;
417 m_MonitorFetchedSet.insert(subsys);
423 std::map<const std::string, OnlMonDraw *>::iterator iter =
DrawerList.find(Drawer->
Name());
426 std::cout <<
"Drawer " << Drawer->
Name() <<
" already registered, I won't overwrite it" << std::endl;
427 std::cout <<
"Use a different name and try again" << std::endl;
448 TSeqCollection *allCanvases = gROOT->GetListOfCanvases();
449 TCanvas *canvas =
nullptr;
450 while ((canvas = static_cast<TCanvas *>(allCanvases->First())))
454 std::cout <<
"Deleting Canvas " << canvas->GetName() << std::endl;
475 std::cout <<
"Run Number too small: " << runno
476 <<
" not creating html output" << std::endl;
479 char *onlmon_real_html = getenv(
"ONLMON_REAL_HTML");
480 if (!onlmon_real_html)
482 old_umask = umask(S_IWOTH);
483 std::cout <<
"Making html output group writable so others can run tests as well" << std::endl;
488 if (!onlmon_real_html)
498 std::map<const std::string, OnlMonDraw *>::iterator iter;
506 iter->second->Draw(what);
508 else if (opt ==
"PS")
510 iter->second->MakePS(what);
512 else if (opt ==
"SAVEPLOT")
514 iter->second->SavePlot(what,
"png");
516 else if (opt ==
"HTML")
520 std::cout << __PRETTY_FUNCTION__ <<
" creating html output for "
521 << iter->second->Name() << std::endl;
523 if (iter->second->MakeHtml(what))
525 std::cout <<
"subsystem " << iter->second->Name()
526 <<
" not in root file, skipping" << std::endl;
531 std::cout <<
"option " << opt <<
" not implemented" << std::endl;
539 std::cout <<
"Drawer " << who <<
" not in list" << std::endl;
550 iter->second->Draw(what);
552 else if (opt ==
"PS")
554 iter->second->MakePS(what);
556 else if (opt ==
"HTML")
560 std::cout << __PRETTY_FUNCTION__ <<
" creating html output for "
561 << iter->second->Name() << std::endl;
564 int iret = iter->second->MakeHtml(what);
567 std::cout <<
"subsystem " << iter->second->Name()
568 <<
" not in root file, skipping" << std::endl;
572 TSeqCollection *allCanvases = gROOT->GetListOfCanvases();
573 TCanvas *canvas =
nullptr;
574 while ((canvas = static_cast<TCanvas *>(allCanvases->First())))
576 std::cout <<
"Deleting Canvas " << canvas->GetName() << std::endl;
591 std::map<std::string, std::map<const std::string, ClientHistoList *>>::const_iterator
histos =
SubsysHisto.find(subsys);
592 auto histoiter = histos->second.find(what);
595 std::cout << __PRETTY_FUNCTION__ <<
"checking for " << what <<
" on monitor " << subsys << std::endl;
597 if (histoiter != histos->second.end())
599 hostname = histoiter->second->ServerHost();
600 moniport = histoiter->second->ServerPort();
601 if (hostname ==
"UNKNOWN")
605 std::cout <<
"Histogram " << what <<
" cannot be located" << std::endl;
609 histoiter = histos->second.find(what);
610 hostname = histoiter->second->ServerHost();
611 moniport = histoiter->second->ServerPort();
612 if (hostname ==
"UNKNOWN")
614 std::cout << __PRETTY_FUNCTION__ <<
"host UNKNOWN for whatever reason" << std::endl;
623 std::cout <<
"Histogram " << what <<
" cannot be located" << std::endl;
626 histoiter = histos->second.find(what);
627 if (histoiter != histos->second.end())
629 hostname = histoiter->second->ServerHost();
630 moniport = histoiter->second->ServerPort();
631 if (hostname ==
"UNKNOWN")
633 std::cout << __PRETTY_FUNCTION__ <<
"host UNKNOWN for whatever reason" << std::endl;
639 std::cout << __PRETTY_FUNCTION__ <<
"Problem determining host" << std::endl;
643 TSocket sock(hostname.c_str(), moniport);
648 std::cout << __PRETTY_FUNCTION__ <<
" sending " << fullhistoname <<
" to " << hostname <<
" port " << moniport << std::endl;
650 sock.Send(fullhistoname.c_str());
655 std::cout << __PRETTY_FUNCTION__ <<
"Waiting for Message from : " << hostname
656 <<
" on port " << moniport << std::endl;
661 std::cout << __PRETTY_FUNCTION__ <<
"Server not running on " << hostname << std::endl;
665 if (mess->What() == kMESS_STRING)
672 std::cout << __PRETTY_FUNCTION__ <<
"Message: " << str << std::endl;
674 if (!strcmp(str,
"Finished"))
678 else if (!strcmp(str,
"UnknownHisto"))
684 std::cout << __PRETTY_FUNCTION__ <<
"Unknown Text Message: " << str << std::endl;
688 else if (mess->What() == kMESS_OBJECT)
690 TH1 *histo =
static_cast<TH1 *
>(mess->ReadObjectAny(mess->GetClass()));
692 TH1 *maphist =
static_cast<TH1 *
>(histo->Clone(histo->GetName()));
695 std::cout << __PRETTY_FUNCTION__ <<
"histoname: " << histo->GetName() <<
" at "
696 << histo << std::endl;
704 sock.Send(
"Finished");
713 TSocket sock(hostname.c_str(), moniport);
715 sock.Send(what.c_str());
721 std::cout << __PRETTY_FUNCTION__ <<
"Server not running on " << hostname << std::endl;
725 if (mess->What() == kMESS_STRING)
732 std::cout << __PRETTY_FUNCTION__ <<
"Message: " << str << std::endl;
735 if (!strcmp(str,
"Finished"))
739 else if (!strcmp(str,
"UnknownHisto"))
745 std::cout << __PRETTY_FUNCTION__ <<
"Unknown Text Message: " << str << std::endl;
749 else if (mess->What() == kMESS_OBJECT)
752 TH1 *histo =
static_cast<TH1 *
>(mess->ReadObjectAny(mess->GetClass()));
756 std::cout << __PRETTY_FUNCTION__ <<
"histoname: " << histo->GetName() <<
" at "
757 << histo << std::endl;
764 sock.Send(
"Finished");
773 TSocket sock(hostname.c_str(), moniport);
775 sock.Send(
"LISTMONITORS");
779 std::cout << __PRETTY_FUNCTION__ <<
"Server not running on " << hostname << std::endl;
787 if (mess->What() == kMESS_STRING)
794 std::cout <<
"received " << strmess << std::endl;
797 if (str ==
"Finished")
803 std::cout <<
"inserting " << str <<
" on host " << hostname
804 <<
" listening to " << moniport << std::endl;
806 MonitorHostPorts.insert(std::make_pair(str, std::make_pair(hostname, moniport)));
810 std::cout <<
"requestMonitorList: received unexpected message type: " << mess->What() << std::endl;
814 sock.Send(
"Finished");
824 TSocket sock(hostname.c_str(), moniport);
827 std::list<std::string>::const_iterator listiter;
831 std::cout << __PRETTY_FUNCTION__ <<
"Server not running on " << hostname << std::endl;
837 for (listiter = histolist.begin(); listiter != histolist.end(); ++listiter)
841 std::cout << __PRETTY_FUNCTION__ <<
"asking for " << *listiter << std::endl;
843 sock.Send((*listiter).c_str());
847 std::cout << __PRETTY_FUNCTION__ <<
"Server shut down during getting histo list" << std::endl;
851 if (mess->What() == kMESS_STRING)
858 std::cout << __PRETTY_FUNCTION__ <<
"Message: " << str << std::endl;
861 if (!strcmp(str,
"Ack"))
865 else if (!strcmp(str,
"UnknownHisto"))
871 std::cout << __PRETTY_FUNCTION__ <<
"Unknown Text Message: " << str << std::endl;
874 else if (mess->What() == kMESS_OBJECT)
877 TH1 *histo =
static_cast<TH1 *
>(mess->ReadObjectAny(mess->GetClass()));
881 std::cout << __PRETTY_FUNCTION__ <<
"histoname: " << histo->GetName() <<
" at "
882 << histo << std::endl;
888 sock.Send(
"alldone");
891 sock.Send(
"Finished");
903 std::map<const std::string, ClientHistoList *> newmap;
906 newmap.insert(std::make_pair(hname, entry));
907 SubsysHisto.insert(std::make_pair(subsys, newmap));
910 auto histoiter = subsysiter->second.find(hname);
912 if (histoiter != subsysiter->second.end())
916 std::cout <<
"deleting histogram " << hname <<
" at " <<
Histo[hname] << std::endl;
918 delete histoiter->second->Histo();
919 histoiter->second->Histo(h1d);
924 newhisto->
Histo(h1d);
925 subsysiter->second.insert(std::make_pair(hname, newhisto));
928 std::cout <<
"new histogram " << hname <<
" at " << newhisto->
Histo() << std::endl;
937 std::map<const std::string, OnlMonDraw *>::iterator iter =
DrawerList.find(name);
942 std::cout <<
"Could not locate drawer" << name << std::endl;
953 auto hiter = subsysiter->second.find(hname);
954 if (hiter == subsysiter->second.end())
958 return hiter->second->Histo();
963 if (!strcmp(what,
"ALL") || !strcmp(what,
"DRAWER"))
966 std::cout <<
"--------------------------------------" << std::endl
968 std::cout <<
"List of Drawers in OnlMonClient:" << std::endl;
970 std::map<const std::string, OnlMonDraw *>::const_iterator hiter;
973 std::cout << hiter->first <<
" is at " << hiter->second << std::endl;
975 std::cout << std::endl;
977 if (!strcmp(what,
"ALL") || !strcmp(what,
"SERVERS"))
980 std::cout <<
"--------------------------------------" << std::endl
982 std::cout <<
"List of Servers in OnlMonClient:" << std::endl;
984 std::vector<std::string>::iterator hostiter;
987 std::cout <<
"ServerHost: " << *hostiter << std::endl;
990 if (!strcmp(what,
"ALL") || !strcmp(what,
"MONITORS"))
993 std::cout <<
"--------------------------------------" << std::endl
995 std::cout <<
"List of Monitors in OnlMonClient:" << std::endl;
999 std::cout <<
"Monitor " << moniiter.first <<
" runs on " << moniiter.second.first
1000 <<
" listening to port " << moniiter.second.second << std::endl;
1003 if (!strcmp(what,
"ALL") || !strcmp(what,
"HISTOS"))
1006 std::cout <<
"--------------------------------------" << std::endl
1008 std::cout <<
"List of Histograms in OnlMonClient:" << std::endl;
1010 std::map<const std::string, ClientHistoList *>::const_iterator hiter;
1011 for (hiter =
Histo.begin(); hiter !=
Histo.end(); ++hiter)
1013 std::cout << hiter->first <<
" Address " << hiter->second->Histo()
1014 <<
" on host " << hiter->second->ServerHost()
1015 <<
" port " << hiter->second->ServerPort()
1016 <<
", subsystem " << hiter->second->SubSystem() << std::endl;
1018 std::cout << std::endl;
1024 std::cout <<
"Subsystem " << subs.first <<
" runs on " << subiter->second.first;
1025 std::cout <<
" on port " << subiter->second.second << std::endl;
1027 for (
auto &
histos : subs.second)
1028 std::cout <<
histos.first <<
" @ " << subs.first
1029 <<
" Address " <<
histos.second->Histo()
1030 <<
" on host " <<
histos.second->ServerHost()
1031 <<
" port " <<
histos.second->ServerPort()
1032 <<
", subsystem " <<
histos.second->SubSystem() << std::endl;
1034 std::cout << std::endl;
1036 if (!strcmp(what,
"ALL") || !strcmp(what,
"UNKNOWN"))
1039 std::cout <<
"--------------------------------------" << std::endl
1041 std::cout <<
"List of Unknown Histograms in OnlMonClient:" << std::endl;
1043 std::map<const std::string, ClientHistoList *>::const_iterator hiter;
1044 for (hiter =
Histo.begin(); hiter !=
Histo.end(); ++hiter)
1046 if (hiter->second->ServerHost() ==
"UNKNOWN" ||
1047 hiter->second->SubSystem() ==
"UNKNOWN")
1049 std::cout << hiter->first <<
" Address " << hiter->second->Histo()
1050 <<
" on host " << hiter->second->ServerHost()
1051 <<
" port " << hiter->second->ServerPort()
1052 <<
", subsystem " << hiter->second->SubSystem() << std::endl;
1055 std::cout << std::endl;
1068 std::cout <<
"Connecting to " << hostname <<
", if it is frozen here - this is the one you need to restart" << std::endl;
1069 TSocket sock(hostname.c_str(), MoniPort);
1073 std::cout <<
"UpdateServerHistoMap: sending cmd HistoList to "
1074 << hostname <<
" on port "
1078 if (!sock.Send(
"HistoList"))
1080 std::cout <<
"Server not running on " << hostname
1081 <<
" port " << MoniPort << std::endl;
1088 std::cout <<
"UpdateServerHistoMap: waiting for response on "
1089 << hostname <<
" on port "
1096 std::cout <<
"UpdateServerHistoMap: No Recv, Server not running on "
1098 <<
" on port " << MoniPort << std::endl;
1101 if (mess->What() == kMESS_STRING)
1109 std::cout <<
"UpdateServerHistoMap Response: " << str << std::endl;
1111 if (str ==
"Finished")
1116 if (str == searchstring)
1118 std::cout <<
"found subsystem " << subsys <<
" histo " << hname << std::endl;
1121 unsigned int pos_space = str.find(
' ');
1122 PutHistoInMap(str.substr(pos_space + 1, str.size()), str.substr(0, pos_space), hostname, MoniPort);
1126 sock.Send(
"Finished");
1145 std::map<const std::string, ClientHistoList *>
entry;
1147 hiter =
SubsysHisto.insert(std::make_pair(subsys, entry)).first;
1149 auto histoiter = hiter->second.find(hname);
1150 if (histoiter != hiter->second.end())
1152 histoiter->second->ServerHost(hostname);
1153 histoiter->second->ServerPort(port);
1160 hiter->second.insert(std::make_pair(hname, newhisto));
1169 std::cout <<
"Host " << hostname <<
" already in list" << std::endl;
1195 TH1 *frameworkvars =
getHisto(frwrkiter,
"FrameWorkVars");
1198 runno = std::max(runno, (
int) frameworkvars->GetBinContent(
RUNNUMBERBIN));
1209 tret = std::max(tret,
EventTime(frwrkiter,which));
1214 std::cout <<
"Time is " << ctime(&tret) << std::endl;
1227 else if (which ==
"CURRENT")
1231 else if (which ==
"EOR")
1237 std::cout <<
"Bad Option for Time: " << which
1238 <<
", implemented are BOR EOR CURRENT" << std::endl;
1241 TH1 *frameworkvars =
getHisto(servername,
"FrameWorkVars");
1242 if (frameworkvars ==
nullptr)
1248 tret = (time_t) frameworkvars->GetBinContent(ibin);
1252 std::cout <<
"Time is " << ctime(&tret) << std::endl;
1260 TDirectory *
save = gDirectory;
1261 TFile *histofile =
new TFile(filename.c_str(),
"READ");
1264 std::cout <<
"Can't open " << filename << std::endl;
1268 TIterator *titer = histofile->GetListOfKeys()->MakeIterator();
1270 TH1 *histo, *histoptr;
1271 while ((obj = titer->Next()))
1275 std::cout <<
"TObject at " << obj << std::endl;
1276 std::cout << obj->GetName() << std::endl;
1277 std::cout << obj->ClassName() << std::endl;
1279 histofile->GetObject(obj->GetName(), histoptr);
1282 histo =
static_cast<TH1 *
>(histoptr->Clone());
1286 std::cout <<
"HistoName: " << histo->GetName() << std::endl;
1287 std::cout <<
"HistoClass: " << histo->ClassName() << std::endl;
1299 TSocket sock(hostname, port);
1301 if (!sock.Send(cmd))
1303 std::cout <<
"Server not running on " << hostname
1304 <<
" port " << port << std::endl;
1313 std::cout << __PRETTY_FUNCTION__ <<
"No Recv, Server not running on " << hostname
1314 <<
" on port " << port << std::endl;
1318 if (mess->What() == kMESS_STRING)
1325 std::cout << __PRETTY_FUNCTION__ <<
" Message: " << str << std::endl;
1328 if (!strcmp(str,
"Finished"))
1334 sock.Send(
"Finished");
1388 std::cout << __PRETTY_FUNCTION__ <<
" TCanvas is Null Pointer" << std::endl;
1391 if (pngfilename.empty())
1393 std::cout << __PRETTY_FUNCTION__ <<
" emtpy png filename, not saving TCanvas "
1394 << canvas->GetName() << std::endl;
1400 uuid_unparse(uu, uuid);
1402 canvas->Print(tmpname.c_str(),
"gif");
1403 TImage *img = TImage::Open(tmpname.c_str());
1404 img->WriteImage(pngfilename.c_str());
1406 if (
remove(tmpname.c_str()))
1408 std::cout <<
"Error removing " << tmpname << std::endl;
1415 TCanvas *cgiCanv =
new TCanvas(
"cgiCanv",
"cgiCanv", 200, 200, 650, 500);
1416 gStyle->SetOptStat(statopt);
1417 cgiCanv->SetFillColor(0);
1418 cgiCanv->SetBorderMode(0);
1419 cgiCanv->SetBorderSize(2);
1420 cgiCanv->SetFrameFillColor(0);
1421 cgiCanv->SetFrameBorderMode(0);
1422 cgiCanv->SetTickx();
1423 cgiCanv->SetTicky();
1425 histo->SetMarkerStyle(8);
1426 histo->SetMarkerSize(0.15);
1427 histo->Draw(drawopt);
1431 uuid_unparse(uu, uuid);
1433 cgiCanv->Print(tmpname.c_str(),
"gif");
1434 TImage *img = TImage::Open(tmpname.c_str());
1435 img->WriteImage(pngfilename.c_str());
1436 if (
remove(tmpname.c_str()))
1438 std::cout <<
"Error removing " << tmpname << std::endl;
1448 std::ostringstream logfilename;
1449 const char *logdir = getenv(
"ONLMON_LOGDIR");
1452 logfilename << logdir <<
"/";
1455 logfilename << drawer.
Name() <<
"_" << irun <<
".log.gz";
1456 std::ifstream
infile(logfilename.str().c_str(), std::ios_base::binary);
1460 std::ofstream
outfile(outfilename.c_str(), std::ios_base::binary);
1483 if (runnoinput == 221)
1496 if (runno == 0xFEE2DCB)
1503 std::ostringstream
cmd;
1510 printf(
" Exception caught during DriverManager::getConnection, Message: %s\n", e.
getMessage().c_str());
1515 cmd <<
"select runnumber from run where runnumber = " << runno;
1526 printf(
"Exception caught for query %s\nMessage: %s", cmd.str().c_str(), e.
getMessage().c_str());
1530 printf(
"run table query did not give any result, run %d not in DB yet countdown %d\n", runno, ncount);
1542 cmd <<
"SELECT triggerconfig,brunixtime,runtype FROM RUN WHERE RUNNUMBER = "
1546 printf(
"command: %s\n", cmd.str().c_str());
1554 printf(
"Exception caught for query %s\nMessage: %s", cmd.str().c_str(), e.
getMessage().c_str());
1559 TriggerConfig = rs->
getString(
"triggerconfig");
1560 if (TriggerConfig ==
"StandAloneMode")
1568 if (TriggerConfig.find(
"Cosmic") != std::string::npos)
1607 std::cout <<
"checking " << hostiter << std::endl;
1625 std::cout <<
"checking " << hostiter << std::endl;
1632 std::cout <<
"looking for " << name << std::endl;
1639 std::cout <<
"found " << name <<
" running on " << moniter->second.first
1640 <<
" listening to port " << moniter->second.second << std::endl;
1658 TSocket sock(moniter->second.first.c_str(), moniter->second.second);
1660 sock.Send(command.c_str());
1664 std::cout << __PRETTY_FUNCTION__ <<
"Server not running on " << moniter->second.first << std::endl;
1668 if (mess->What() == kMESS_STRING)
1675 std::cout << __PRETTY_FUNCTION__ <<
"Message: " << str << std::endl;
1677 if (!strcmp(str,
"Yes"))
1682 sock.Send(
"Finished");
1690 subsys = subsys.substr(subsys.find(
'-') + 1);
1691 subsys = subsys.substr(0, subsys.find(
".root"));