Project
Loading...
Searching...
No Matches
RunManager.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
15#ifndef _CTP_RUNMANAGER_H_
16#define _CTP_RUNMANAGER_H_
19#include "BookkeepingApi/BkpClientFactory.h"
20#include "BookkeepingApi/BkpClient.h"
21using namespace o2::bkp::api;
22namespace o2
23{
24namespace ctp
25{
26typedef std::map<uint32_t, std::array<uint32_t, 6>> counters_t;
27typedef std::map<uint32_t, std::array<uint64_t, 6>> counters64_t;
29 CTPActiveRun() = default;
34 void initBK();
35 int send2BK(std::unique_ptr<BkpClient>& BKClient, size_t ts, bool start);
36 //
37 counters_t cnts0; // first counters in run
38 counters_t cntslast0; // last minus one read counters needed for overflow correction
39 counters_t cntslast; // last read counters
41 // QC
42 int qcwpcount = 0;
43};
45{
46 public:
47 CTPRunManager() = default;
48 void init();
49 int loadRun(const std::string& cfg);
50 int startRun(const std::string& cfg);
51 int stopRun(uint32_t irun, long timeStamp);
52 int addScalers(uint32_t irun, std::time_t time, bool start = 0);
53 int processMessage(std::string& topic, const std::string& message);
54 void printActiveRuns() const;
55 int loadScalerNames();
56 int getNRuns();
57 void setBKHost(std::string host) { mBKHost = host; };
58 void setQCWritePeriod(int period) { mQCWritePeriod = period; };
59 uint64_t checkOverflow(uint32_t lcnt0, uint32_t lcnt1, uint64_t lcntcor);
60 void printCounters();
61
62 private:
64 std::string mBKHost = "";
65 std::array<CTPActiveRun*, NRUNS> mActiveRuns;
66 std::array<std::uint32_t, NRUNS> mActiveRunNumbers;
67 std::array<uint32_t, CTPRunScalers::NCOUNTERS> mCounters;
68 std::map<std::string, uint32_t> mScalerName2Position;
69 std::map<uint32_t, CTPActiveRun*> mRunsLoaded;
70 std::unique_ptr<BkpClient> mBKClient;
71 int mEOX = 0; // redundancy check
72 int mNew = 1; // 1 - no CCDB: used for QC
73 int mQCWritePeriod = 3; // Time in 10secs between two writes to QCCD
74 ClassDefNV(CTPRunManager, 7);
75};
76} // namespace ctp
77} // namespace o2
78#endif //_CTP_RUNMANAGER_H_
definition of CTPConfiguration and related CTP structures
int16_t time
Definition RawEventData.h:4
int stopRun(uint32_t irun, long timeStamp)
int startRun(const std::string &cfg)
void printActiveRuns() const
int processMessage(std::string &topic, const std::string &message)
void setQCWritePeriod(int period)
Definition RunManager.h:58
int loadRun(const std::string &cfg)
void setBKHost(std::string host)
Definition RunManager.h:57
int addScalers(uint32_t irun, std::time_t time, bool start=0)
uint64_t checkOverflow(uint32_t lcnt0, uint32_t lcnt1, uint64_t lcntcor)
GLuint GLsizei const GLchar * message
Definition glcorearb.h:2517
GLuint start
Definition glcorearb.h:469
std::map< uint32_t, std::array< uint32_t, 6 > > counters_t
Definition RunManager.h:26
std::map< uint32_t, std::array< uint64_t, 6 > > counters64_t
Definition RunManager.h:27
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
counters64_t overflows
Definition RunManager.h:40
CTPConfiguration cfg
Definition RunManager.h:32
CTPRunScalers scalers
Definition RunManager.h:33
int send2BK(std::unique_ptr< BkpClient > &BKClient, size_t ts, bool start)