Project
Loading...
Searching...
No Matches
CTPRateFetcher.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
12#ifndef COMMON_CCDB_CTPRATEFETCHER_H_
13#define COMMON_CCDB_CTPRATEFETCHER_H_
14
15#include <string>
16
21
22namespace o2
23{
24namespace ctp
25{
26
28{
29 public:
30 CTPRateFetcher() = default;
31 double fetch(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, const std::string sourceName);
32 double fetchNoPuCorr(o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, int runNumber, const std::string sourceName);
33 void setupRun(int runNumber, o2::ccdb::BasicCCDBManager* ccdb, uint64_t timeStamp, bool initScalers);
34 void updateScalers(ctp::CTPRunScalers& scalers);
35 int getRates(std::array<double, 3>& rates, o2::ccdb::BasicCCDBManager* ccdb, int runNumber, const std::string sourceName); // rates at start,stop and middle of the run
36 double getLumi(o2::ccdb::BasicCCDBManager* ccdb, int runNumber, const std::string sourceName, int puCorr = 0); // total lumi for a run
37 double getLumiNoPuCorr(const std::string& classname, int type = 1);
38 double getLumiWPuCorr(const std::string& classname, int type = 1);
39 void setOrbit(bool orb) { mOrbit = orb; } // use orbit instead of time
40 void setOutsideLimits(bool qc) { mOutsideLimits = qc; } // return first/last rate of time outside of run
41
42 private:
43 double fetchCTPratesInputs(uint64_t timeStamp, int input);
44 double fetchCTPratesClasses(uint64_t timeStamp, const std::string& className, int inputType = 1);
45 double fetchCTPratesInputsNoPuCorr(uint64_t timeStamp, int input);
46 double fetchCTPratesClassesNoPuCorr(uint64_t timeStamp, const std::string& className, int inputType = 1);
47 double getLumi(const std::string& classname, int type = 1, int puCorr = 0);
48 double pileUpCorrection(double rate);
49 int mRunNumber = -1;
50 bool mOutsideLimits = 0;
51 bool mOrbit = 0;
53 o2::ctp::CTPRunScalers mScalers{};
55 ClassDefNV(CTPRateFetcher, 1);
56};
57} // namespace ctp
58} // namespace o2
59
60#endif // COMMON_CCDB_CTPRATEFETCHER_H_
definition of CTPConfiguration and related CTP structures
container for the LHC InterFace data
definition of CTPScalerRaw, CTPScalerO2
int getRates(std::array< double, 3 > &rates, o2::ccdb::BasicCCDBManager *ccdb, int runNumber, const std::string sourceName)
double getLumiWPuCorr(const std::string &classname, int type=1)
double getLumi(o2::ccdb::BasicCCDBManager *ccdb, int runNumber, const std::string sourceName, int puCorr=0)
void setOutsideLimits(bool qc)
void setupRun(int runNumber, o2::ccdb::BasicCCDBManager *ccdb, uint64_t timeStamp, bool initScalers)
double fetchNoPuCorr(o2::ccdb::BasicCCDBManager *ccdb, uint64_t timeStamp, int runNumber, const std::string sourceName)
double getLumiNoPuCorr(const std::string &classname, int type=1)
void updateScalers(ctp::CTPRunScalers &scalers)
double fetch(o2::ccdb::BasicCCDBManager *ccdb, uint64_t timeStamp, int runNumber, const std::string sourceName)
GLuint GLenum * rate
Definition glcorearb.h:5735
GLint GLint GLsizei GLint GLenum GLenum type
Definition glcorearb.h:275
GLuint GLsizei const GLenum * rates
Definition glcorearb.h:5738
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...