Belle II Software  release-05-01-25
b2hlt_read_histos.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2019 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <daq/dqm/DqmMemFile.h>
11 #include <daq/rfarm/event/hltsocket/HLTMainLoop.h>
12 #include <framework/logging/Logger.h>
13 
14 #include <boost/program_options.hpp>
15 #include <iostream>
16 #include <thread>
17 #include <chrono>
18 
19 
20 namespace po = boost::program_options;
21 using namespace Belle2;
22 
23 int main(int argc, char* argv[])
24 {
25  std::string dqmFileName;
26 
27  po::options_description
28  desc("b2hlt_read_histos - helper tool to check the content of a DQM shared memory file repeatedly (every 5s).");
29  desc.add_options()
30  ("help,h", "Print this help message")
31  ("dqmFileName", po::value<std::string>(&dqmFileName)->required(),
32  "where to read the shared memory from");
33 
34  po::positional_options_description p;
35 
36  po::variables_map vm;
37  try {
38  po::store(
39  po::command_line_parser(argc, argv).options(desc).positional(p).run(), vm);
40  } catch (std::exception& e) {
41  B2FATAL(e.what());
42  }
43 
44  if (vm.count("help")) {
45  std::cout << desc << std::endl;
46  exit(1);
47  }
48 
49  try {
50  po::notify(vm);
51  } catch (std::exception& e) {
52  B2FATAL(e.what());
53  }
54 
55  Belle2::DqmMemFile file(dqmFileName, "read");
56  HLTMainLoop mainLoop;
57  while (mainLoop.isRunning()) {
58 
59  auto memFile = file.LoadMemFile();
60  memFile->GetListOfKeys()->Print();
61 
62  using namespace std::chrono_literals;
63  std::this_thread::sleep_for(5s);
64  }
65 }
prepareAsicCrosstalkSimDB.e
e
aux.
Definition: prepareAsicCrosstalkSimDB.py:53
main
int main(int argc, char **argv)
Run all tests.
Definition: test_main.cc:77
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::HLTMainLoop
Definition: HLTMainLoop.h:28
Belle2::DqmMemFile
Definition: DqmMemFile.h:28