3 #include <onlmon/OnlMonClient.h>
4 #include <onlmon/OnlMonDB.h>
9 #include <TGraphErrors.h>
27 TDatime T0(2003, 01, 01, 00, 00, 00);
46 TC[0] =
new TCanvas(name.c_str(),
"MyMon Example Monitor", -1, 0, xsize / 2, ysize);
51 gSystem->ProcessEvents();
52 Pad[0] =
new TPad(
"mypad1",
"who needs this?", 0.1, 0.5, 0.9, 0.9, 0);
53 Pad[1] =
new TPad(
"mypad2",
"who needs this?", 0.1, 0.05, 0.9, 0.45, 0);
57 transparent[0] =
new TPad(
"transparent0",
"this does not show", 0, 0, 1, 1);
60 TC[0]->SetEditable(
false);
62 else if (name ==
"MyMon2")
65 TC[1] =
new TCanvas(name.c_str(),
"MyMon2 Example Monitor", -xsize / 2, 0, xsize / 2, ysize);
66 gSystem->ProcessEvents();
67 Pad[2] =
new TPad(
"mypad3",
"who needs this?", 0.1, 0.5, 0.9, 0.9, 0);
68 Pad[3] =
new TPad(
"mypad4",
"who needs this?", 0.1, 0.05, 0.9, 0.45, 0);
72 transparent[1] =
new TPad(
"transparent1",
"this does not show", 0, 0, 1, 1);
75 TC[1]->SetEditable(
false);
77 else if (name ==
"MyMon3")
79 TC[2] =
new TCanvas(name.c_str(),
"MyMon3 Example Monitor", xsize / 2, 0, xsize / 2, ysize);
80 gSystem->ProcessEvents();
81 Pad[4] =
new TPad(
"mypad5",
"who needs this?", 0.1, 0.5, 0.9, 0.9, 0);
82 Pad[5] =
new TPad(
"mypad6",
"who needs this?", 0.1, 0.05, 0.9, 0.45, 0);
98 if (what ==
"ALL" || what ==
"FIRST")
103 if (what ==
"ALL" || what ==
"SECOND")
108 if (what ==
"ALL" || what ==
"HISTORY")
115 std::cout << __PRETTY_FUNCTION__ <<
" Unimplemented Drawing option: " << what << std::endl;
124 TH1 *mymon_hist1 = cl->
getHisto(
"MYMON_0",
"mymon_hist1");
125 TH1 *mymon_hist2 = cl->
getHisto(
"MYMON_1",
"mymon_hist1");
126 if (!gROOT->FindObject(
"MyMon1"))
130 TC[0]->SetEditable(
true);
135 mymon_hist1->DrawCopy();
140 TC[0]->SetEditable(
false);
146 mymon_hist2->DrawCopy();
149 PrintRun.SetTextFont(62);
150 PrintRun.SetTextSize(0.04);
152 PrintRun.SetTextAlign(23);
153 std::ostringstream runnostream;
155 time_t evttime = cl->
EventTime(
"CURRENT");
158 <<
", Time: " << ctime(&evttime);
159 runstring = runnostream.str();
161 PrintRun.DrawText(0.5, 1., runstring.c_str());
164 TC[0]->SetEditable(
false);
171 TH1 *mymon_hist1 = cl->
getHisto(
"MYMON_0",
"mymon_hist2");
172 TH1 *mymon_hist2 = cl->
getHisto(
"MYMON_1",
"mymon_hist2");
173 if (!gROOT->FindObject(
"MyMon2"))
177 TC[1]->SetEditable(
true);
182 mymon_hist1->DrawCopy();
187 TC[1]->SetEditable(
false);
193 mymon_hist2->DrawCopy();
196 PrintRun.SetTextFont(62);
197 PrintRun.SetTextSize(0.04);
199 PrintRun.SetTextAlign(23);
200 std::ostringstream runnostream;
202 time_t evttime = cl->
EventTime(
"CURRENT");
205 <<
", Time: " << ctime(&evttime);
206 runstring = runnostream.str();
208 PrintRun.DrawText(0.5, 1., runstring.c_str());
211 TC[1]->SetEditable(
false);
219 int iret =
Draw(what);
225 for (TCanvas *canvas :
TC)
227 if (canvas ==
nullptr)
241 int iret =
Draw(what);
250 for (TCanvas *canvas :
TC)
252 if (canvas ==
nullptr)
265 std::ofstream
out(logfile.c_str());
266 out <<
"<HTML><HEAD><TITLE>Log file for run " << cl->
RunNumber()
267 <<
"</TITLE></HEAD>" << std::endl;
268 out <<
"<P>Some log file output would go here." << std::endl;
272 std::ofstream out2(status.c_str());
273 out2 <<
"<HTML><HEAD><TITLE>Status file for run " << cl->
RunNumber()
274 <<
"</TITLE></HEAD>" << std::endl;
275 out2 <<
"<P>Some status output would go here." << std::endl;
286 std::vector<float> var;
287 std::vector<float> varerr;
294 iret =
dbvars->
GetVar(begin, end, varname, timestamp, runnumber, var, varerr);
297 std::cout << __PRETTY_FUNCTION__ <<
" Error in db access" << std::endl;
300 if (!gROOT->FindObject(
"MyMon3"))
305 float *
x =
new float[var.size()];
306 float *
y =
new float[var.size()];
307 float *ex =
new float[var.size()];
308 float *ey =
new float[var.size()];
310 for (
unsigned int i = 0;
i < var.size();
i++)
327 gr[0] =
new TGraphErrors(n, x, y, ex, ey);
328 gr[0]->SetMarkerColor(4);
329 gr[0]->SetMarkerStyle(21);
331 gr[0]->GetXaxis()->SetTimeDisplay(1);
332 gr[0]->GetXaxis()->SetLabelSize(0.03);
336 gr[0]->GetXaxis()->SetNdivisions(-1006);
338 gr[0]->GetXaxis()->SetTimeFormat(
"%Y/%m/%d %H:%M");
344 varname =
"mymoncount";
345 iret =
dbvars->
GetVar(begin, end, varname, timestamp, runnumber, var, varerr);
348 std::cout << __PRETTY_FUNCTION__ <<
" Error in db access" << std::endl;
351 x =
new float[var.size()];
352 y =
new float[var.size()];
353 ex =
new float[var.size()];
354 ey =
new float[var.size()];
356 for (
unsigned int i = 0;
i < var.size();
i++)
373 gr[1] =
new TGraphErrors(n, x, y, ex, ey);
374 gr[1]->SetMarkerColor(4);
375 gr[1]->SetMarkerStyle(21);
377 gr[1]->GetXaxis()->SetTimeDisplay(1);
381 gr[1]->GetXaxis()->SetLabelSize(0.03);
383 gr[1]->GetXaxis()->SetTimeFormat(
"%Y/%m/%d %H:%M");