Skip to content

Commit 2f60566

Browse files
author
afurs
committed
DataFormatsFIT: hotfix for LUT, excluded CCDB API from header
1 parent b5ab60d commit 2f60566

File tree

3 files changed

+33
-11
lines changed

3 files changed

+33
-11
lines changed

DataFormats/Detectors/FIT/common/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ o2_add_library(DataFormatsFIT
1313
SOURCES src/RawEventData.cxx
1414
src/Triggers.cxx
1515
src/RawDataMetric.cxx
16+
src/LookUpTable.cxx
1617
PUBLIC_LINK_LIBRARIES O2::CommonDataFormat
1718
O2::DetectorsCommonDataFormats
1819
O2::CCDB)

DataFormats/Detectors/FIT/common/include/DataFormatsFIT/LookUpTable.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,9 @@
1515
// Look Up Table FIT
1616
//////////////////////////////////////////////
1717

18-
#include "CCDB/BasicCCDBManager.h"
1918
#include "DetectorsCommonDataFormats/DetID.h"
19+
#include "CommonUtils/NameConf.h"
20+
#include "Framework/Logger.h"
2021
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
2122
#include <boost/property_tree/ptree.hpp>
2223
#include <boost/property_tree/json_parser.hpp>
@@ -158,8 +159,7 @@ enum class EModuleType : int { kUnknown,
158159
kTCM };
159160

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

176176
LookupTableBase() = default;
177-
LookupTableBase(const Table_t& vecEntryFEE) { initFromTable(vecEntryFEE); }
177+
LookupTableBase(const Table_t* vecEntryFEE) { initFromTable(vecEntryFEE); }
178178
LookupTableBase(const std::string& pathToFile) { initFromFile(pathToFile); }
179179
LookupTableBase(const std::string& urlCCDB, const std::string& pathToStorageInCCDB, long timestamp = -1) { initCCDB(urlCCDB, pathToStorageInCCDB, timestamp); }
180180
// Map of str module names -> enum types
@@ -243,13 +243,7 @@ class LookupTableBase
243243
prepareEntriesFEE(filepath);
244244
prepareLUT();
245245
}
246-
void initCCDB(const std::string& urlCCDB, const std::string& pathToStorageInCCDB, long timestamp = -1)
247-
{
248-
auto& mgr = o2::ccdb::BasicCCDBManager::instance();
249-
mgr.setURL(urlCCDB);
250-
mVecEntryFEE = *(mgr.getForTimeStamp<Table_t>(pathToStorageInCCDB, timestamp));
251-
prepareLUT();
252-
}
246+
void initCCDB(const std::string& urlCCDB, const std::string& pathToStorageInCCDB, long timestamp = -1);
253247
void initFromTable(const Table_t* vecEntryFEE)
254248
{
255249
mVecEntryFEE = *vecEntryFEE;
@@ -419,6 +413,7 @@ class LookupTableBase
419413
Table_t mVecEntryFEE;
420414
MapEntryCRU2ModuleType_t mMapEntryCRU2ModuleType;
421415
MapEntryPM2ChannelID_t mMapEntryPM2ChannelID;
416+
typedef std::enable_if_t<std::is_integral<typename MapEntryPM2ChannelID::mapped_type>::value> CheckChannelIDtype; // should be integral
422417
};
423418

424419
// Singleton for LookUpTable, coomon for all three FIT detectors
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
#include "DataFormatsFIT/LookUpTable.h"
13+
#include "CCDB/BasicCCDBManager.h"
14+
#include <unordered_map>
15+
using namespace o2::fit;
16+
template <typename MapEntryCRU2ModuleType, typename MapEntryPM2ChannelID>
17+
void LookupTableBase<MapEntryCRU2ModuleType, MapEntryPM2ChannelID>::initCCDB(const std::string& urlCCDB, const std::string& pathToStorageInCCDB, long timestamp)
18+
{
19+
20+
auto& mgr = o2::ccdb::BasicCCDBManager::instance();
21+
mgr.setURL(urlCCDB);
22+
mVecEntryFEE = *(mgr.getForTimeStamp<LookupTableBase<MapEntryCRU2ModuleType, MapEntryPM2ChannelID>::Table_t>(pathToStorageInCCDB, timestamp));
23+
prepareLUT();
24+
}
25+
template class o2::fit::LookupTableBase<std::unordered_map<EntryCRU, EModuleType, HasherCRU, ComparerCRU>,
26+
std::unordered_map<EntryPM, int, HasherPM, ComparerPM>>;

0 commit comments

Comments
 (0)