Skip to content

Commit cbd562d

Browse files
authored
Revert "TOF Param container: move to header only"
This reverts commit 1aa2c14.
1 parent 6d76514 commit cbd562d

File tree

3 files changed

+68
-38
lines changed

3 files changed

+68
-38
lines changed

DataFormats/Detectors/TOF/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ o2_add_library(DataFormatsTOF
1616
src/CalibLHCphaseTOF.cxx
1717
src/CalibTimeSlewingParamTOF.cxx
1818
src/CTF.cxx
19+
src/ParameterContainers.cxx
1920
src/CalibInfoCluster.cxx
2021
src/CosmicInfo.cxx
2122
src/Diagnostic.cxx

DataFormats/Detectors/TOF/include/DataFormatsTOF/ParameterContainers.h

Lines changed: 5 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class Parameters
3737
Parameters(std::array<std::string, nPar> parNames, std::string name) : mName{name}, mPar{}, mParNames{parNames} {};
3838

3939
/// Default destructor
40-
virtual ~Parameters() = default; // Ensure proper cleanup in derived classes
40+
~Parameters() = default;
4141

4242
/// Setter for the parameter at position iparam
4343
/// \param iparam index in the array of the parameters
@@ -183,27 +183,10 @@ class ParameterCollection : public TNamed
183183
/// @param value parameter to add to the stored information
184184
/// @param pass key to look for in the stored information e.g. pass
185185
/// @return true if found and configured false if not fully configured
186-
bool addParameter(const std::string& pass, const std::string& parName, float value)
187-
{
188-
const bool alreadyPresent = hasKey(pass);
189-
if (alreadyPresent) {
190-
LOG(debug) << "Changing parametrization corresponding to key " << pass << " from size " << mParameters[pass].size() << " to " << parName;
191-
} else {
192-
mParameters[pass] = std::unordered_map<std::string, paramvar_t>{};
193-
LOG(debug) << "Adding new parametrization corresponding to key " << pass << ": " << parName;
194-
}
195-
mParameters[pass][parName] = value;
196-
return true;
197-
}
186+
bool addParameter(const std::string& pass, const std::string& parName, float value);
198187

199188
/// @return the size of the container i.e. the number of stored keys (or passes)
200-
int getSize(const std::string& pass) const
201-
{
202-
if (!hasKey(pass)) {
203-
return -1;
204-
}
205-
return mParameters.at(pass).size();
206-
}
189+
int getSize(const std::string& pass) const;
207190

208191
/// @brief Function to push the parameters from the sub container into the collection and store it under a given key
209192
/// @tparam ParType type of the parameter container
@@ -231,26 +214,10 @@ class ParameterCollection : public TNamed
231214

232215
/// @brief printing function for the content of the pass
233216
/// @param pass pass to print
234-
void print(const std::string& pass) const
235-
{
236-
const auto& size = getSize(pass);
237-
if (size < 0) {
238-
LOG(info) << "empty pass: " << pass;
239-
return;
240-
}
241-
LOG(info) << "Pass \"" << pass << "\" with size " << size;
242-
for (const auto& [par, value] : mParameters.at(pass)) {
243-
LOG(info) << "par name = " << par << ", value = " << value;
244-
}
245-
}
217+
void print(const std::string& pass) const;
246218

247219
/// @brief printing function for the full content of the container
248-
void print() const
249-
{
250-
for (const auto& [pass, pars] : mParameters) {
251-
print(pass);
252-
}
253-
}
220+
void print() const;
254221

255222
/// @brief Getter of the full map of parameters stored in the container
256223
/// @return returns the full map of parameters
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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+
/// \file ParameterContainers.h
13+
/// \author Francesco Noferini
14+
/// \author Nicolò Jacazio nicolo.jacazio@cern.ch
15+
/// @since 2022-11-08
16+
/// \brief Implementation of the containers for the general parameters
17+
18+
#include "DataFormatsTOF/ParameterContainers.h"
19+
20+
// ClassImp(o2::tof::Parameters);
21+
using namespace o2::tof;
22+
23+
bool 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+
36+
int ParameterCollection::getSize(const std::string& pass) const
37+
{
38+
if (!hasKey(pass)) {
39+
return -1;
40+
}
41+
return mParameters.at(pass).size();
42+
}
43+
44+
void ParameterCollection::print() const
45+
{
46+
for (const auto& [pass, pars] : mParameters) {
47+
print(pass);
48+
}
49+
}
50+
51+
void 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+
}

0 commit comments

Comments
 (0)