Belle II Software development
b2hlt_read_histos.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 <daq/dqm/DqmMemFile.h>
9#include <daq/rfarm/event/hltsocket/HLTMainLoop.h>
10#include <framework/logging/Logger.h>
11
12#include <boost/program_options.hpp>
13#include <iostream>
14#include <thread>
15#include <chrono>
16
17
18namespace po = boost::program_options;
19using namespace Belle2;
20
21int main(int argc, char* argv[])
22{
23 std::string dqmFileName;
24
25 po::options_description
26 desc("b2hlt_read_histos - helper tool to check the content of a DQM shared memory file repeatedly (every 5s).");
27 desc.add_options()
28 ("help,h", "Print this help message")
29 ("dqmFileName", po::value<std::string>(&dqmFileName)->required(),
30 "where to read the shared memory from");
31
32 po::positional_options_description p;
33
34 po::variables_map vm;
35 try {
36 po::store(
37 po::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
38 } catch (std::exception& e) {
39 B2FATAL(e.what());
40 }
41
42 if (vm.count("help")) {
43 std::cout << desc << std::endl;
44 exit(1);
45 }
46
47 try {
48 po::notify(vm);
49 } catch (std::exception& e) {
50 B2FATAL(e.what());
51 }
52
53 Belle2::DqmMemFile file(dqmFileName, "read");
54 HLTMainLoop mainLoop;
55 while (mainLoop.isRunning()) {
56
57 auto memFile = file.LoadMemFile();
58 memFile->GetListOfKeys()->Print();
59
60 using namespace std::chrono_literals;
61 std::this_thread::sleep_for(5s);
62 }
63}
Abstract base class for different kinds of events.