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: 1 addition & 0 deletions DataFormats/Detectors/FIT/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ o2_add_library(DataFormatsFIT
SOURCES src/RawEventData.cxx
src/Triggers.cxx
src/RawDataMetric.cxx
src/LookUpTable.cxx
PUBLIC_LINK_LIBRARIES O2::CommonDataFormat
O2::DetectorsCommonDataFormats
O2::CCDB)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
// Look Up Table FIT
//////////////////////////////////////////////

#include "CCDB/BasicCCDBManager.h"
#include "DetectorsCommonDataFormats/DetID.h"
#include "CommonUtils/NameConf.h"
#include "Framework/Logger.h"
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/json_parser.hpp>
Expand Down Expand Up @@ -158,8 +159,7 @@ enum class EModuleType : int { kUnknown,
kTCM };

template <typename MapEntryCRU2ModuleType = std::unordered_map<EntryCRU, EModuleType, HasherCRU, ComparerCRU>,
typename MapEntryPM2ChannelID = std::unordered_map<EntryPM, int, HasherPM, ComparerPM>,
typename = typename std::enable_if_t<std::is_integral<typename MapEntryPM2ChannelID::mapped_type>::value>>
typename MapEntryPM2ChannelID = std::unordered_map<EntryPM, int, HasherPM, ComparerPM>>
class LookupTableBase
{
public:
Expand All @@ -174,7 +174,7 @@ class LookupTableBase
typedef EntryPM_t Topo_t; // temporary for common interface

LookupTableBase() = default;
LookupTableBase(const Table_t& vecEntryFEE) { initFromTable(vecEntryFEE); }
LookupTableBase(const Table_t* vecEntryFEE) { initFromTable(vecEntryFEE); }
LookupTableBase(const std::string& pathToFile) { initFromFile(pathToFile); }
LookupTableBase(const std::string& urlCCDB, const std::string& pathToStorageInCCDB, long timestamp = -1) { initCCDB(urlCCDB, pathToStorageInCCDB, timestamp); }
// Map of str module names -> enum types
Expand Down Expand Up @@ -243,13 +243,7 @@ class LookupTableBase
prepareEntriesFEE(filepath);
prepareLUT();
}
void initCCDB(const std::string& urlCCDB, const std::string& pathToStorageInCCDB, long timestamp = -1)
{
auto& mgr = o2::ccdb::BasicCCDBManager::instance();
mgr.setURL(urlCCDB);
mVecEntryFEE = *(mgr.getForTimeStamp<Table_t>(pathToStorageInCCDB, timestamp));
prepareLUT();
}
void initCCDB(const std::string& urlCCDB, const std::string& pathToStorageInCCDB, long timestamp = -1);
void initFromTable(const Table_t* vecEntryFEE)
{
mVecEntryFEE = *vecEntryFEE;
Expand Down Expand Up @@ -419,6 +413,7 @@ class LookupTableBase
Table_t mVecEntryFEE;
MapEntryCRU2ModuleType_t mMapEntryCRU2ModuleType;
MapEntryPM2ChannelID_t mMapEntryPM2ChannelID;
typedef std::enable_if_t<std::is_integral<typename MapEntryPM2ChannelID::mapped_type>::value> CheckChannelIDtype; // should be integral
};

// Singleton for LookUpTable, coomon for all three FIT detectors
Expand Down
26 changes: 26 additions & 0 deletions DataFormats/Detectors/FIT/common/src/LookUpTable.cxx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
// All rights not expressly granted are reserved.
//
// This software is distributed under the terms of the GNU General Public
// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

#include "DataFormatsFIT/LookUpTable.h"
#include "CCDB/BasicCCDBManager.h"
#include <unordered_map>
using namespace o2::fit;
template <typename MapEntryCRU2ModuleType, typename MapEntryPM2ChannelID>
void LookupTableBase<MapEntryCRU2ModuleType, MapEntryPM2ChannelID>::initCCDB(const std::string& urlCCDB, const std::string& pathToStorageInCCDB, long timestamp)
{

auto& mgr = o2::ccdb::BasicCCDBManager::instance();
mgr.setURL(urlCCDB);
mVecEntryFEE = *(mgr.getForTimeStamp<LookupTableBase<MapEntryCRU2ModuleType, MapEntryPM2ChannelID>::Table_t>(pathToStorageInCCDB, timestamp));
prepareLUT();
}
template class o2::fit::LookupTableBase<std::unordered_map<EntryCRU, EModuleType, HasherCRU, ComparerCRU>,
std::unordered_map<EntryPM, int, HasherPM, ComparerPM>>;