]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MONITOR/alionlinemonitor.cxx
gpu patch
[u/mrichter/AliRoot.git] / MONITOR / alionlinemonitor.cxx
CommitLineData
c6d78c69 1#include "AliDimIntNotifier.h"
2#include "AliOnlineReco.h"
3
4#include <TRint.h>
5
fb25eab0 6#include <TSQLServer.h>
7#include <TSQLResult.h>
8#include <TSQLRow.h>
9
10#include <TTimeStamp.h>
11
c6d78c69 12int main(int argc, char **argv)
13{
14 AliDimIntNotifier::SetMainThreadId();
15
16 Bool_t test = argc > 1 && strcmp("-test", argv[1]) == 0;
17
18 TRint app("App", &argc, argv);
19
20 AliOnlineReco *win = new AliOnlineReco;
21 win->MapWindow();
22
23 if (test)
24 {
25 win->SetTestMode();
26
e35c7687 27 win->GetSOR(0)->infoHandlerTest(2214);
28 win->GetSOR(0)->infoHandlerTest(2215);
29 win->GetSOR(0)->infoHandlerTest(2224);
30 win->GetSOR(0)->infoHandlerTest(2244);
c6d78c69 31
32 printf("win = (AliOnlineReco*) 0x%lx\n", (unsigned long)win);
33 }
fb25eab0 34 else {
35
a15a9f84 36 TString baseDir = gSystem->Getenv("ONLINERECO_BASE_DIR");
37 if (baseDir.IsNull()) {
38 printf("ERROR: ONLINERECO_BASE_DIR is not set. Exiting...");
39 return 0;
40 }
41
fb25eab0 42 const char *dbHost = "aldaqdb";
43 Int_t dbPort = 3306;
44 const char *dbName = "LOGBOOK";
45 const char *user = "logbook";
46 const char *password = "alice";
47
48 TSQLServer* server = TSQLServer::Connect(Form("mysql://%s:%d/%s", dbHost, dbPort, dbName), user, password);
49 if (!server) {
50 printf("ERROR: Could not connect to DAQ Logbook");
51 return 0;
52 }
53 TString sqlQuery;
54 TTimeStamp ts;
82142d1d 55 sqlQuery.Form("SELECT run FROM logbook WHERE DAQ_time_start > %u AND DAQ_time_end IS NULL AND partition REGEXP 'PHYSICS.*'",
56 ts.GetSec()-86400);
fb25eab0 57 TSQLResult* result = server->Query(sqlQuery);
58 if (!result) {
59 printf("ERROR: Can't execute query <%s>!", sqlQuery.Data());
60 return 0;
61 }
62 if (result->GetRowCount() == 0) {
63 printf("No active physics runs found");
64 }
65 else {
66 for (Int_t iRow = 0; iRow < result->GetRowCount(); iRow++) {
67 TSQLRow* row = result->Next();
68 TString runStr = row->GetField(0);
69 if (runStr.IsDigit())
70 win->StartOfRun(runStr.Atoi());
71 delete row;
72 }
73 }
74 delete result;
75 }
c6d78c69 76
77 app.Run(kTRUE);
78 return 0;
79}