3 #include <onlmon/OnlMonClient.h>
4 #include <onlmon/OnlMonDB.h>
9 #include <TGraphErrors.h>
27 TDatime T0(2003, 01, 01, 00, 00, 00);
43 if (name ==
"DaqMon1")
46 TC[0] =
new TCanvas(name.c_str(),
"DaqMon Example Monitor", -1, 0, xsize / 2, ysize);
51 gSystem->ProcessEvents();
52 Pad[0] =
new TPad(
"daqpad1",
"who needs this?", 0.1, 0.5, 0.9, 0.9, 0);
53 Pad[1] =
new TPad(
"daqpad2",
"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 ==
"DaqMon2")
65 TC[1] =
new TCanvas(name.c_str(),
"DaqMon2 Example Monitor", -xsize / 2, 0, xsize / 2, ysize);
66 gSystem->ProcessEvents();
67 Pad[2] =
new TPad(
"daqpad3",
"who needs this?", 0.1, 0.5, 0.9, 0.9, 0);
68 Pad[3] =
new TPad(
"daqpad4",
"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 ==
"DaqMon3")
79 TC[2] =
new TCanvas(name.c_str(),
"DaqMon3 Example Monitor", xsize / 2, 0, xsize / 2, ysize);
80 gSystem->ProcessEvents();
81 Pad[4] =
new TPad(
"daqpad5",
"who needs this?", 0.1, 0.5, 0.9, 0.9, 0);
82 Pad[5] =
new TPad(
"daqpad6",
"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 *daqmon_hist1 = cl->
getHisto(
"DAQMON_0",
"daqmon_hist1");
125 TH1 *daqmon_hist2 = cl->
getHisto(
"DAQMON_0",
"daqmon_hist1");
126 if (!gROOT->FindObject(
"DaqMon1"))
130 TC[0]->SetEditable(
true);
135 daqmon_hist1->DrawCopy();
140 TC[0]->SetEditable(
false);
146 daqmon_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 *daqmon_hist1 = cl->
getHisto(
"DAQMON_0",
"daqmon_hist2");
172 TH1 *daqmon_hist2 = cl->
getHisto(
"DAQMON_0",
"daqmon_hist2");
173 if (!gROOT->FindObject(
"DaqMon2"))
177 TC[1]->SetEditable(
true);
182 daqmon_hist1->DrawCopy();
187 TC[1]->SetEditable(
false);
193 daqmon_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);
259 std::ofstream
out(logfile.c_str());
260 out <<
"<HTML><HEAD><TITLE>Log file for run " << cl->
RunNumber()
261 <<
"</TITLE></HEAD>" << std::endl;
262 out <<
"<P>Some log file output would go here." << std::endl;
266 std::ofstream out2(status.c_str());
267 out2 <<
"<HTML><HEAD><TITLE>Status file for run " << cl->
RunNumber()
268 <<
"</TITLE></HEAD>" << std::endl;
269 out2 <<
"<P>Some status output would go here." << std::endl;
280 std::vector<float> var;
281 std::vector<float> varerr;
288 iret =
dbvars->
GetVar(begin, end, varname, timestamp, runnumber, var, varerr);
291 std::cout << __PRETTY_FUNCTION__ <<
" Error in db access" << std::endl;
294 if (!gROOT->FindObject(
"DaqMon3"))
299 float *
x =
new float[var.size()];
300 float *
y =
new float[var.size()];
301 float *ex =
new float[var.size()];
302 float *ey =
new float[var.size()];
304 for (
unsigned int i = 0;
i < var.size();
i++)
321 gr[0] =
new TGraphErrors(n, x, y, ex, ey);
322 gr[0]->SetMarkerColor(4);
323 gr[0]->SetMarkerStyle(21);
325 gr[0]->GetXaxis()->SetTimeDisplay(1);
326 gr[0]->GetXaxis()->SetLabelSize(0.03);
330 gr[0]->GetXaxis()->SetNdivisions(-1006);
332 gr[0]->GetXaxis()->SetTimeFormat(
"%Y/%m/%d %H:%M");
338 varname =
"daqmoncount";
339 iret =
dbvars->
GetVar(begin, end, varname, timestamp, runnumber, var, varerr);
342 std::cout << __PRETTY_FUNCTION__ <<
" Error in db access" << std::endl;
345 x =
new float[var.size()];
346 y =
new float[var.size()];
347 ex =
new float[var.size()];
348 ey =
new float[var.size()];
350 for (
unsigned int i = 0;
i < var.size();
i++)
367 gr[1] =
new TGraphErrors(n, x, y, ex, ey);
368 gr[1]->SetMarkerColor(4);
369 gr[1]->SetMarkerStyle(21);
371 gr[1]->GetXaxis()->SetTimeDisplay(1);
375 gr[1]->GetXaxis()->SetLabelSize(0.03);
377 gr[1]->GetXaxis()->SetTimeFormat(
"%Y/%m/%d %H:%M");