Project
Loading...
Searching...
No Matches
ParameterContainers.cxx
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
17
19
20// ClassImp(o2::tof::Parameters);
21using namespace o2::tof;
22
23bool ParameterCollection::addParameter(const std::string& pass, const std::string& parName, float value)
24{
25 const bool alreadyPresent = hasKey(pass);
26 if (alreadyPresent) {
27 LOG(debug) << "Changing parametrization corresponding to key " << pass << " from size " << mParameters[pass].size() << " to " << parName;
28 } else {
29 mParameters[pass] = std::unordered_map<std::string, paramvar_t>{};
30 LOG(debug) << "Adding new parametrization corresponding to key " << pass << ": " << parName;
31 }
32 mParameters[pass][parName] = value;
33 return true;
34}
35
36int ParameterCollection::getSize(const std::string& pass) const
37{
38 if (!hasKey(pass)) {
39 return -1;
40 }
41 return mParameters.at(pass).size();
42}
43
45{
46 for (const auto& [pass, pars] : mParameters) {
47 print(pass);
48 }
49}
50
51void ParameterCollection::print(const std::string& pass) const
52{
53 const auto& size = getSize(pass);
54 if (size < 0) {
55 LOG(info) << "empty pass: " << pass;
56 return;
57 }
58 LOG(info) << "Pass \"" << pass << "\" with size " << size;
59 for (const auto& [par, value] : mParameters.at(pass)) {
60 LOG(info) << "par name = " << par << ", value = " << value;
61 }
62}
Definitions of the containers for the general parameters.
std::ostringstream debug
bool hasKey(const std::string &key) const
Checks if the container has a particular key e.g. a pass.
int getSize(const std::string &pass) const
void print() const
printing function for the full content of the container
bool addParameter(const std::string &pass, const std::string &parName, float value)
Function to add a single parameter conatiner based on the asked key, e.g. pass or version.
GLsizeiptr size
Definition glcorearb.h:659
GLsizei const GLfloat * value
Definition glcorearb.h:819
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"