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"
21
22using namespace o2::bkp::api;
23namespace o2
24{
25namespace ctp
26{
27typedef std::map<uint32_t, std::array<uint32_t, 6>> counters_t;
28typedef std::map<uint32_t, std::array<uint64_t, 6>> counters64_t;
30 CTPActiveRun() = default;
35 void initBK();
36 int send2BK(std::unique_ptr<BkpClient>& BKClient, size_t ts, bool start);
37 //
38 counters_t cnts0; // first counters in run
39 counters_t cntslast0; // last minus one read counters needed for overflow correction
40 counters_t cntslast; // last read counters
42 // QC
43 int qcwpcount = 0;
44};
46{
47 public:
48 CTPRunManager() = default;
49 void init();
50 int loadRun(const std::string& cfg);
51 int setRunConfigBK(uint32_t runNumber, const std::string& cfg);
52 int stopRun(uint32_t irun, long timeStamp);
53 int addScalers(uint32_t irun, std::time_t time, bool start = 0);
54 int processMessage(std::string& topic, const std::string& message);
55 void printActiveRuns() const;
56 int loadScalerNames();
57 int getNRuns();
58 void setBKHost(std::string host) { mBKHost = host; };
59 void setQCWritePeriod(int period) { mQCWritePeriod = period; };
60 uint64_t checkOverflow(uint32_t lcnt0, uint32_t lcnt1, uint64_t lcntcor);
61 void printCounters();
62
63 private:
65 std::string mBKHost = "";
66 std::array<CTPActiveRun*, NRUNS> mActiveRuns;
67 std::array<std::uint32_t, NRUNS> mActiveRunNumbers;
68 std::array<uint32_t, CTPRunScalers::NCOUNTERS> mCounters;
69 std::map<std::string, uint32_t> mScalerName2Position;
70 std::map<uint32_t, CTPActiveRun*> mRunsLoaded;
71 std::unique_ptr<BkpClient> mBKClient;
72 int mEOX = 0; // redundancy check
73 int mNew = 1; // 1 - no CCDB: used for QC
74 int mQCWritePeriod = 3; // Time in 10secs between two writes to QCCD
75 ClassDefNV(CTPRunManager, 8);
76};
77} // namespace ctp
78} // namespace o2
79#endif //_CTP_RUNMANAGER_H_
definition of CTPConfiguration and related CTP structures
int16_t time
Definition RawEventData.h:4
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events Show standalone event Run event generator maximum time bin of continuous for triggered for automatic continuous for automatic continuous triggered uint64_t
int stopRun(uint32_t irun, long timeStamp)
int setRunConfigBK(uint32_t runNumber, const std::string &cfg)
void printActiveRuns() const
int processMessage(std::string &topic, const std::string &message)
void setQCWritePeriod(int period)
Definition RunManager.h:59
int loadRun(const std::string &cfg)
void setBKHost(std::string host)
Definition RunManager.h:58
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
std::map< uint32_t, std::array< uint32_t, 6 > > counters_t
Definition RunManager.h:27
std::map< uint32_t, std::array< uint64_t, 6 > > counters64_t
Definition RunManager.h:28
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
counters64_t overflows
Definition RunManager.h:41
CTPConfiguration cfg
Definition RunManager.h:33
CTPRunScalers scalers
Definition RunManager.h:34
int send2BK(std::unique_ptr< BkpClient > &BKClient, size_t ts, bool start)