|
ATLAS Offline Software
|
Go to the documentation of this file.
16 q.addToTableList (
"SUPER_MASTER_TABLE",
"SMT" );
17 q.addToTableList (
"L1_MENU",
"L1TM" );
19 q.extendBinding<
unsigned int>(
"smk");
21 q.extendCondition(
"SMT.SMT_ID = :smk AND SMT.SMT_L1_MENU_ID = L1TM.L1TM_ID");
23 q.extendOutput<
unsigned int>(
"L1TM.L1TM_CTP_FILES_ID");
24 q.extendOutput<
unsigned int>(
"L1TM.L1TM_CTP_SMX_ID");
25 q.extendOutput<
unsigned int>(
"L1TM.L1TM_MUCTPI_FILES_ID");
26 q.extendOutput<
unsigned int>(
"L1TM.L1TM_TMC_SIGNALS_ID");
32 q.addToTableList (
"L1_CTP_FILES" );
34 q.extendBinding<
unsigned int>(
"id");
36 q.extendCondition(
"L1CF_ID = :id");
62 q.addToTableList (
"L1_CTP_SMX" );
64 q.extendBinding<
unsigned int>(
"id");
66 q.extendCondition(
"L1SMX_ID = :id");
80 q.addToTableList (
"L1_MUCTPI_FILES" );
82 q.extendBinding<
unsigned int>(
"id");
84 q.extendCondition(
"L1MF_ID = :id");
92 q.addToTableList (
"L1_TMC_SIGNALS" );
94 q.extendBinding<
unsigned int>(
"id");
96 q.extendCondition(
"L1TMC_ID = :id");
109 const std::string & )
const
111 unsigned int ctpFilesID{0};
112 unsigned int ctpSmxID{0};
113 unsigned int muctpiID{0};
114 unsigned int tmcSignalsID{0};
116 auto session = createDBSession();
117 session->transaction().start(
true);
118 const size_t sv = schemaVersion(session.get());
125 TRG_MSG_ERROR(
"Tried reading L1 CTPFiles, but super master key " <<
smk <<
" is not available" );
130 ctpFilesID =
row[
"L1TM.L1TM_CTP_FILES_ID"].data<
unsigned int>();
132 catch(
const coral::AttributeException &
e)
135 ctpSmxID =
row[
"L1TM.L1TM_CTP_SMX_ID"].data<
unsigned int>();
137 catch(
const coral::AttributeException &
e)
140 muctpiID =
row[
"L1TM.L1TM_MUCTPI_FILES_ID"].data<
unsigned int>();
142 catch(
const coral::AttributeException &
e)
145 tmcSignalsID =
row[
"L1TM.L1TM_TMC_SIGNALS_ID"].data<
unsigned int>();
147 catch(
const coral::AttributeException &
e)
150 TRG_MSG_INFO(
"ID of table L1_CTP_FILES : " << ctpFilesID);
152 TRG_MSG_INFO(
"ID of table L1_MUCTPI_FILES : " << muctpiID);
153 TRG_MSG_INFO(
"ID of table L1_TMC_SIGNALS : " << tmcSignalsID);
155 catch(coral::QueryException & ex) {
156 TRG_MSG_ERROR(
"When reading the files table links for super master key " <<
smk <<
" a coral::QueryException was caught ( " << ex.what() <<
" )" );
160 if(ctpFilesID>0 && (loadMask & 0x01)!=0 ) {
163 loadCTPFiles(ctpfiles, qdef.
createQuery( session.get() ),
sv );
166 if(ctpSmxID>0 && (loadMask & 0x02)!=0) {
169 loadCTPSMX(ctpfiles, qdef.
createQuery( session.get() ),
sv );
172 if(tmcSignalsID>0 && (loadMask & 0x04)!=0) {
178 if(muctpiID>0 && (loadMask & 0x08)!=0) {
181 loadMUCTPI(ctpfiles, qdef.
createQuery( session.get() ),
sv );
206 if(schemaVersion>=6) {
259 catch(coral::QueryException & ex) {
260 TRG_MSG_ERROR(
"When reading the L1CTPFiles a coral::QueryException was caught ( " << ex.what() <<
" )" );
283 catch(coral::QueryException & ex) {
284 TRG_MSG_ERROR(
"When reading the L1CTPFiles a coral::QueryException was caught ( " << ex.what() <<
" )" );
291 TRG_MSG_INFO(
"Loading data from table L1_MUCTPI_FILES");
303 catch(coral::QueryException & ex) {
304 TRG_MSG_ERROR(
"When reading the L1CTPFiles a coral::QueryException was caught ( " << ex.what() <<
" )" );
308 std::vector<std::string>
keys =
ds.getKeys();
312 std::vector<uint32_t>
v;
314 for(
const auto &
x : *
dv ) {
315 v.push_back(std::stoul(
x.getValue<std::string>(),
nullptr, 0));
322 for(
const std::string &
k :
keys) {
328 auto sopt =
ds.getAttribute_optional<std::string>(
k);
329 if(
k.compare(0, 6,
"pt_lut") == 0) {
330 auto dv =
ds.getList(
k);
331 std::vector<uint32_t>
v;
334 v.push_back(std::stoul(
x.getValue<std::string>(),
nullptr, 0));
337 }
else if(
k==
"multiplicities_nbits") {
338 auto dv =
ds.getList(
k);
339 std::vector<uint32_t>
v;
341 v.push_back(std::stoul(
x.getValue<std::string>(),
nullptr, 0));
361 catch(coral::QueryException & ex) {
362 TRG_MSG_ERROR(
"When reading the L1CTPFiles a coral::QueryException was caught ( " << ex.what() <<
" )" );
369 if(
auto ft =
ds.getAttribute<std::string>(
"filetype");
ft !=
"tmcresult" ) {
370 throw TrigConf::ParsingException(
"TrigDBCTPFilesLoader::loadTMC: json structure of unexpected file type found. Expected 'tmcresult', but found " +
ft);
374 if (
auto dv =
ds.getObject_optional(
"CTPCORE.TriggerInputs"))
376 std::vector<TrigConf::L1CTPFiles::CTPCoreInput> ctpcoreInputs;
377 for (
const std::string &
k :
dv->getKeys())
380 const std::string &
inputType = inp[
"type"];
394 ctpcoreInputs.push_back(
400 TRG_MSG_INFO(
"Loading ctpcore inputs " << ctpcoreInputs.size());
405 if (
auto dv =
ds.getObject_optional(
"CTPCORE.TriggerInputs"))
407 std::vector<TrigConf::L1CTPFiles::CTPCoreCTPXInput> ctpcoreCTPXInputs;
408 for (
const std::string &
k :
dv->getKeys())
411 const std::string &
inputType = inp[
"type"];
421 ctpcoreCTPXInputs.push_back(
427 TRG_MSG_INFO(
"Loading ctpcore CTPX inputs " << ctpcoreCTPXInputs.size());
432 std::vector<TrigConf::L1CTPFiles::CTPInCounter> ctpinCounters;
433 for (
size_t slot : {7, 8, 9})
435 for (
size_t conn : {0, 1, 2, 3})
438 if (
auto dv =
ds.getObject_optional(
path))
440 if (
auto ov =
dv->getList_optional(
"outputs"))
444 ctpinCounters.push_back(
446 output.getAttribute<std::string>(
"TriggerCounter"), slot,
conn,
output.getAttribute<
size_t>(
"number")));
452 TRG_MSG_INFO(
"Loading ctpin counters " << ctpinCounters.size());
456 std::vector<TrigConf::L1CTPFiles::CTPMonCounter> ctpmonCounters;
457 if(
auto dv =
ds.getObject_optional(
"CTPMON.Monitoring") ) {
458 if (
auto ov =
dv->getList_optional(
"outputs"))
462 ctpmonCounters.push_back(
464 output.getAttribute<std::string>(
"TriggerCounter"),
output.getAttribute<
size_t>(
"number")));
468 TRG_MSG_INFO(
"Loading ctpmon counters " << ctpmonCounters.size());
475 std::vector<uint32_t>
477 std::vector<uint32_t>
vec;
484 boost::iostreams::stream<boost::iostreams::array_source>
stream(
485 static_cast<const char*
> (
blob.startingAddress()),
488 std::string word{
""};
490 vec.push_back(std::stoul(word,
nullptr, 0));
493 catch(
const coral::AttributeException &
e) {}
497 throw std::runtime_error(
"CTPFilesLoader: file of unexpected size" );
508 boost::iostreams::stream<boost::iostreams::array_source>
stream(
509 static_cast<const char*
> (
blob.startingAddress()),
513 std::istreambuf_iterator<char>(
stream.rdbuf()),
514 std::istreambuf_iterator<char>()
518 catch(
const coral::AttributeException &
e) {}
521 throw std::runtime_error(
"CTPFilesLoader: field " +
field +
" in DB is empty" );
Loader class for Trigger configuration (L1 hardware files) from the Trigger DB.
path
python interpreter configuration --------------------------------------—
void loadTMC(L1CTPFiles &ctpfiles, std::unique_ptr< coral::IQuery > query, size_t schemaVersion) const
void set_Ctpin_MonSelector_Slot7(std::vector< uint32_t > data)
std::string find(const std::string &s)
return a remapped string
void set_Muctpi_Nbits(std::vector< uint32_t > data)
void set_Smx_Svfi_Slot7(const std::string &data)
static const size_t CTPMON_DECODER_SIZE
void set_Muctpi(MuctpiAccess key, std::vector< uint32_t > data)
std::map< size_t, QueryDefinition > m_link_queries
void set_Smx_Vhdl_Slot9(const std::string &data)
void set_Tmc_CtpinCounters(std::vector< TrigConf::L1CTPFiles::CTPInCounter > data)
static const std::map< MuctpiAccess, std::string > s_keyMap
std::map< size_t, QueryDefinition > m_muctpi_queries
Loader of trigger configurations from Json files.
void set_Tmc_Data(DataStructure data)
TrigDBCTPFilesLoader(const std::string &connection)
Constructor.
T getAttribute(const std::string &key, bool ignoreIfMissing=false, const T &def=T()) const
Access to simple attribute.
std::vector< size_t > vec
virtual ~TrigDBCTPFilesLoader() override
Destructor - cannot be defined here because QueryDefinition is an incomplete type.
std::map< size_t, QueryDefinition > m_tmcsig_queries
void set_HasCompleteTmcData(bool flag)
static const size_t CTPCORE_LUT_SIZE
void set_Smx_Vhdl_Slot7(const std::string &data)
void set_Smx_Svfi_Slot9(const std::string &data)
void set_Ctpcore_LUT(std::vector< uint32_t > data)
void setBoundValue(const std::string &fieldName, const T &value)
typename vecDetail::vec_typedef< T, N >::type vec
Define a nice alias for the vectorized type.
static const size_t CTPIN_MONDEC_SIZE
void set_Ctpcore_CAM(std::vector< uint32_t > data)
void set_HasCompleteMuctpiData(bool flag)
static const size_t CTPMON_SELECTOR_SIZE
std::string loadDBFieldIntoString(const coral::AttributeList &row, const std::string &field) const
std::unique_ptr< coral::IQuery > createQuery(coral::ISessionProxy *session)
static const size_t CTPCORE_CAM_SIZE
std::map< size_t, QueryDefinition > m_ctpfiles_queries
void set_Ctpcore_SMX(std::vector< uint32_t > data)
void set_Ctpmon_MonSelector(std::vector< uint32_t > data)
void set_Ctpmon_DMX(std::vector< uint32_t > data)
void set_Tmc_CtpmonCounters(std::vector< TrigConf::L1CTPFiles::CTPMonCounter > data)
boost::property_tree::ptree ptree
void set_Ctpin_MonDecoder_Slot7(std::vector< uint32_t > data)
void set_Muctpi_Extra_Ptlut(const std::string &key, std::vector< uint32_t > data)
void set_Smx_Vhdl_Slot8(const std::string &data)
std::string to_string(const DetectorType &type)
static const size_t CTPMON_DMX_SIZE
void loadCTPFiles(L1CTPFiles &ctpfiles, std::unique_ptr< coral::IQuery > query, size_t schemaVersion) const
Base class for Trigger configuration data and wrapper around underlying representation.
void set_Smx_Svfi_Slot8(const std::string &data)
bool loadHardwareFiles(unsigned int smk, L1CTPFiles &ctpfiles, uint8_t loadMask=0x0F, const std::string &outFileName="") const
Load content from the Trigger DB into an L1CTPFiles object for a given super master key (SMK)
void set_Tmc_CtpcoreInputs(std::vector< TrigConf::L1CTPFiles::CTPCoreInput > data)
void set_Ctpin_MonSelector_Slot9(std::vector< uint32_t > data)
std::map< size_t, QueryDefinition > m_ctpsmx_queries
void blobToPtree(const coral::Blob &blob, boost::property_tree::ptree &pt)
void set_Smx_Output(const std::string &data)
void set_Ctpin_MonDecoder_Slot8(std::vector< uint32_t > data)
void set_Tmc_CtpcoreCTPXInputs(std::vector< TrigConf::L1CTPFiles::CTPCoreCTPXInput > data)
void set_Ctpin_MonSelector_Slot8(std::vector< uint32_t > data)
std::vector< uint32_t > loadDBFieldIntoVector(const coral::AttributeList &row, const std::string &field, size_t size) const
void loadCTPSMX(L1CTPFiles &ctpfiles, std::unique_ptr< coral::IQuery > query, size_t schemaVersion) const
void loadMUCTPI(L1CTPFiles &ctpfiles, std::unique_ptr< coral::IQuery > query, size_t schemaVersion) const
static const size_t CTPIN_MONSEL_SIZE
void set_Ctpmon_MonDecoder(std::vector< uint32_t > data)
static const size_t CTPCORE_SMX_SIZE
void set_HasCompleteSmxData(bool flag)
void set_HasCompleteCtpData(bool flag)
Setters of the various CTP data.
void set_Ctpin_MonDecoder_Slot9(std::vector< uint32_t > data)