Belle II Software development
hrelay2.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <string>
9#include <stdio.h>
10#include <stdlib.h>
11#include <unistd.h>
12#include <TFile.h>
13
14#include <daq/dqm/HistoRelay2.h>
15
16using namespace Belle2;
17using namespace std;
18
19int main(int argc, char** argv)
20{
21 if (argc < 4) {
22 printf("Usage : hrelay2 file dest port interval\n");
23 exit(-1);
24 }
25 string file = string(argv[1]);
26 string dest = string(argv[2]);
27 int port = atoi(argv[3]);
28 int interval = atoi(argv[4]);
29
30 // Create empty file before starting
31 auto filepath = string("/dev/shm/") + file;
32 auto dqmhisto = new TFile(filepath.c_str(), "NEW");
33 if (dqmhisto->IsOpen()) {
34 dqmhisto->Close();
35 }
36 delete dqmhisto;
37
38 HistoRelay2 hrelay2(file, dest, port);
39
40 for (;;) {
41 // printf("hrelay2 : collecting histograms\n");
42 if (hrelay2.collect()) {
43 sleep(1); // just short if file is just updated
44 } else {
45 sleep(interval);
46 }
47 }
48
49}
Abstract base class for different kinds of events.
STL namespace.