Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CommonFuncs.C
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file CommonFuncs.C
1 #ifndef MACROS_COMMONFUNCS_C
2 #define MACROS_COMMONFUNCS_C
3 
4 #include <onlmon/OnlMonClient.h>
5 
6 void CreateHostList(const int online = 0)
7 {
8  cout << "online: " << online << endl;
10  if (!online)
11  {
12  cl->AddServerHost("localhost"); // check local host first
13  for (int i = 2061; i <= 2068; i++)
14  {
15  string node = "rcas" + to_string(i);
16  cl->AddServerHost(node); // put all va machines in search list
17  }
18  for (int i = 1; i <= 8; i++)
19  {
20  string node = "sphnx0" + to_string(i);
21  cl->AddServerHost(node); // put all va machines in search list
22  }
23  cl->AddServerHost("sphnxdev01");
24  }
25  else if (online == 1)
26  {
27  const char *hostlist = gSystem->Getenv("ONLMON_RUNDIR");
28  char hostlistname[200];
29  if (hostlist)
30  {
31  char node[20];
32  sprintf(hostlistname, "%s/monitoring_hosts.list", hostlist);
33  FILE *f = fopen(hostlistname, "r");
34  while (fscanf(f, "%19s", &node[0]) != EOF)
35  {
36  cout << "adding " << node << endl;
37  cl->AddServerHost(node); // put monitoring machines in search list
38  }
39  }
40  }
41  else
42  {
43  cl->AddServerHost("localhost"); // check only local host
44  }
45 }
46 
48 {
50  delete cl;
51  gSystem->Exit(0);
52  return;
53 }
54 
56 {
57  TSeqCollection* allCanvases = gROOT->GetListOfCanvases();
58  TCanvas* canvas = nullptr;
59  while ((canvas = (TCanvas*) allCanvases->First()))
60  {
61  std::cout << "Deleting Canvas " << canvas->GetName() << std::endl;
62  delete canvas;
63  }
64 }
65 
66 #endif