Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion DataFormats/Detectors/TOF/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ o2_add_library(DataFormatsTOF
src/CalibLHCphaseTOF.cxx
src/CalibTimeSlewingParamTOF.cxx
src/CTF.cxx
src/ParameterContainers.cxx
src/CalibInfoCluster.cxx
src/CosmicInfo.cxx
src/Diagnostic.cxx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Parameters
Parameters(std::array<std::string, nPar> parNames, std::string name) : mName{name}, mPar{}, mParNames{parNames} {};

/// Default destructor
~Parameters() = default;
virtual ~Parameters() = default; // Ensure proper cleanup in derived classes

/// Setter for the parameter at position iparam
/// \param iparam index in the array of the parameters
Expand Down Expand Up @@ -183,10 +183,27 @@ class ParameterCollection : public TNamed
/// @param value parameter to add to the stored information
/// @param pass key to look for in the stored information e.g. pass
/// @return true if found and configured false if not fully configured
bool addParameter(const std::string& pass, const std::string& parName, float value);
bool addParameter(const std::string& pass, const std::string& parName, float value)
{
const bool alreadyPresent = hasKey(pass);
if (alreadyPresent) {
LOG(debug) << "Changing parametrization corresponding to key " << pass << " from size " << mParameters[pass].size() << " to " << parName;
} else {
mParameters[pass] = std::unordered_map<std::string, paramvar_t>{};
LOG(debug) << "Adding new parametrization corresponding to key " << pass << ": " << parName;
}
mParameters[pass][parName] = value;
return true;
}

/// @return the size of the container i.e. the number of stored keys (or passes)
int getSize(const std::string& pass) const;
int getSize(const std::string& pass) const
{
if (!hasKey(pass)) {
return -1;
}
return mParameters.at(pass).size();
}

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

/// @brief printing function for the content of the pass
/// @param pass pass to print
void print(const std::string& pass) const;
void print(const std::string& pass) const
{
const auto& size = getSize(pass);
if (size < 0) {
LOG(info) << "empty pass: " << pass;
return;
}
LOG(info) << "Pass \"" << pass << "\" with size " << size;
for (const auto& [par, value] : mParameters.at(pass)) {
LOG(info) << "par name = " << par << ", value = " << value;
}
}

/// @brief printing function for the full content of the container
void print() const;
void print() const
{
for (const auto& [pass, pars] : mParameters) {
print(pass);
}
}

/// @brief Getter of the full map of parameters stored in the container
/// @return returns the full map of parameters
Expand Down
62 changes: 0 additions & 62 deletions DataFormats/Detectors/TOF/src/ParameterContainers.cxx

This file was deleted.