ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Trigger
TrigConfiguration
TrigConfStorage
src
L1TopoMenuLoader.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
L1TopoMenuLoader.h
"
6
7
#include <CoralBase/Attribute.h>
8
#include <CoralBase/AttributeList.h>
9
10
#include "RelationalAccess/SchemaException.h"
11
#include "RelationalAccess/ITransaction.h"
12
#include "RelationalAccess/ITable.h"
13
#include "RelationalAccess/ISchema.h"
14
#include "RelationalAccess/ICursor.h"
15
#include "RelationalAccess/IQuery.h"
16
17
#include "
DBHelper.h
"
18
#include "
L1TopoConfig/L1TopoMenu.h
"
19
#include "
L1TopoConfig/L1TopoConfigAlg.h
"
20
21
#include <iostream>
22
#include <stdexcept>
23
#include <typeinfo>
24
#include <set>
25
26
using namespace
std
;
27
bool
TrigConf::L1TopoMenuLoader::load
(
TXC::L1TopoMenu
& tcaTarget ) {
28
try
{
29
unsigned
int
schema =
triggerDBSchemaVersion
();
30
TRG_MSG_DEBUG
(
"L1TopoMenuLoader Run "
<< (
isRun1
()? 1 : 2) <<
", schema version "
<< schema);
31
if
(
isRun1
()) {
32
TRG_MSG_INFO
(
"Not loading L1 TopoMenu from a run 1 database"
);
33
return
true
;
34
}
35
TRG_MSG_INFO
(
"Loading L1 TopoMenu with SMK "
<< tcaTarget.
getSMK
());
36
startSession
();
37
loadTopoAlgos
(tcaTarget);
38
commitSession
();
39
if
(
msg
().level() <
TrigConf::MSGTC::INFO
)
40
tcaTarget.
print
();
41
}
catch
(
const
std::exception& e ) {
42
TRG_MSG_ERROR
(
"L1TopoMenuLoader::load >> Standard C++ exception: "
<< e.what());
43
}
catch
( ... ) {
44
TRG_MSG_ERROR
(
"L1TopoMenuLoader::load >> ... caught "
);
45
}
46
TRG_MSG_INFO
(
"Loaded L1 TopoMenu with "
<< tcaTarget.
getL1TopoConfigAlgs
().size() <<
" algorithms and "
47
<< tcaTarget.
getL1TopoConfigOutputList
().
getTriggerLines
().size() <<
" trigger lines"
);
48
return
true
;
49
}
50
51
52
bool
TrigConf::L1TopoMenuLoader::loadTopoAlgos
(
TXC::L1TopoMenu
& tcaTarget) {
53
54
TRG_MSG_VERBOSE
(
"Calling loadTopoAlgos for SMK "
<< tcaTarget.
getSMK
());
55
56
try
{
57
startSession
();
58
59
unique_ptr<coral::IQuery> query0(
m_session
.nominalSchema().newQuery());
60
query0->addToTableList(
"SUPER_MASTER_TABLE"
,
"SM"
);
61
query0->addToTableList(
"TOPO_MASTER_TABLE"
,
"TMT"
);
62
query0->addToTableList(
"TOPO_TRIGGER_MENU"
,
"TTM"
);
63
query0->addToTableList(
"TTM_TO_TA"
,
"TTM2TA"
);
64
query0->addToTableList(
"TOPO_ALGO"
,
"TA"
);
65
query0->setRowCacheSize(1000);
66
67
//Bind list
68
coral::AttributeList bindList0;
69
bindList0.extend<
unsigned
int
>(
"tmtId"
);
70
std::string cond =
"TMT_ID = :tmtId"
;
71
bindList0[0].data<
unsigned
int
>() = tcaTarget.
getSMK
();
72
73
string
theCondition0 =
""
;
74
theCondition0 += string(
" SM.SMT_ID = :tmtId"
);
75
theCondition0 += string(
" AND TMT.TMT_ID = SM.SMT_TOPO_MASTER_TABLE_ID "
);
76
theCondition0 += string(
" AND TTM.TTM_ID = TMT.TMT_TRIGGER_MENU_ID "
);
77
theCondition0 += string(
" AND TTM2TA.TTM2TA_MENU_ID = TTM.TTM_ID "
);
78
theCondition0 += string(
" AND TA.TA_ID = TTM2TA.TTM2TA_ALGO_ID "
);
79
query0->setCondition( theCondition0, bindList0 );
80
81
coral::AttributeList attList0;
82
83
//TMT.TMT_TRIGGER_MENU_ID, TMT.TMT_VERSION,TTM.TTM_NAME,TTM.TTM_VERSION,TTM.TTM_CTPLINK_ID,TA.TA_ID,TA.TA_NAME,TA.TA_OUTPUT,TA.TA_TYPE,TA.TA_BITS,TA.TA_SORT_DECI,TA.TA_ALGO_ID
84
//attList0.extend<int>( "TMT.TMT_TRIGGER_MENU_ID" );
85
//attList0.extend<long>( "TMT.TMT_VERSION" );
86
attList0.extend<
string
>(
"TTM.TTM_NAME"
);
87
//attList0.extend<int>( "TTM.TTM_VERSION" );
88
attList0.extend<
int
>(
"TTM.TTM_CTPLINK_ID"
);
89
attList0.extend<
int
>(
"TA.TA_ID"
);
90
attList0.extend<
string
>(
"TA.TA_NAME"
);
91
attList0.extend<
string
>(
"TA.TA_OUTPUT"
);
92
attList0.extend<
string
>(
"TA.TA_TYPE"
);
93
attList0.extend<
int
>(
"TA.TA_BITS"
);
94
attList0.extend<
string
>(
"TA.TA_SORT_DECI"
);
95
attList0.extend<
int
>(
"TA.TA_ALGO_ID"
);
96
query0->defineOutput(attList0);
97
fillQuery
(query0.get(), attList0);
98
TRG_MSG_VERBOSE
(
"Executing loadTopoAlgos query "
);
99
coral::ICursor& cursor0 = query0->execute();
100
101
int
ctplinkid = 0;
102
103
std::map<uint, TXC::L1TopoConfigAlg> idToAlgMap;
// map of id -> alg for later bulk loading of inputs, outputs, etc.
104
105
while
(cursor0.next()){
106
const
coral::AttributeList& row0 = cursor0.currentRow();
107
int
ta_id = row0[
"TA.TA_ID"
].data<
int
>();
108
string
ta_name = row0[
"TA.TA_NAME"
].data<
string
>();
109
string
ta_output = row0[
"TA.TA_OUTPUT"
].data<
string
>();
110
string
ta_type = row0[
"TA.TA_TYPE"
].data<
string
>();
111
//int ta_bits = row0["TA.TA_BITS"].data<int>();
112
string
ta_sort_deci = row0[
"TA.TA_SORT_DECI"
].data<
string
>();
113
int
ta_algo_id = row0[
"TA.TA_ALGO_ID"
].data<
int
>();
114
ctplinkid = row0[
"TTM.TTM_CTPLINK_ID"
].data<
int
>();
115
tcaTarget.
setName
(row0[
"TTM.TTM_NAME"
].data<string>());
116
tcaTarget.
setVersion
(std::to_string(ta_id));
117
118
119
TXC::L1TopoConfigAlg
alg(ta_name,ta_type);
120
if
(ta_sort_deci==
"Decision"
) alg.setAlgKind(
TXC::L1TopoConfigAlg::DECISION
);
121
else
if
(ta_sort_deci==
"Sort"
) alg.setAlgKind(
TXC::L1TopoConfigAlg::SORT
);
122
else
alg.setAlgKind(
TXC::L1TopoConfigAlg::NONE
);
123
alg.setAlgOutput(ta_output);
124
alg.setAlgoID(ta_algo_id);
125
// loadAlgInput(alg,ta_id);
126
// loadAlgOutput(alg,ta_id,ta_bits);
127
// loadAlgRegister(alg, ta_id);
128
// loadAlgFixed(alg, ta_id);
129
idToAlgMap.emplace(ta_id,std::move(alg));
130
// tcaTarget.addAlgorithm(alg);
131
}
132
133
loadAllAlgsInput
(idToAlgMap);
134
loadAllAlgsOutput
(idToAlgMap);
135
loadAllAlgsRegister
(idToAlgMap);
136
loadAllAlgsFixed
(idToAlgMap);
137
138
for
(
auto
& e : idToAlgMap ) {
139
tcaTarget.
addAlgorithm
(std::move(e.second));
140
}
141
idToAlgMap.clear();
//invalid aftermove
142
loadTopoConfig
(tcaTarget);
143
loadOutputList
(tcaTarget,ctplinkid);
144
}
catch
(
const
std::exception& e ) {
145
TRG_MSG_ERROR
(
"loadTopoAlgos >> Standard C++ exception: "
<< e.what());
146
commitSession
();
147
throw
;
148
}
149
return
true
;
150
}
151
152
153
bool
TrigConf::L1TopoMenuLoader::loadAllAlgsInput
( std::map<uint, TXC::L1TopoConfigAlg>& idToAlgMap ) {
154
155
TRG_MSG_VERBOSE
(
"Calling loadAllAlgsInput"
);
156
157
set<uint> algIds;
158
for
(
auto
& e : idToAlgMap ) {
159
algIds.insert(e.first);
160
}
161
162
string
algIdsConc =
"("
;
163
bool
first =
true
;
164
for
(
int
id
: algIds ) {
165
if
(first) { first =
false
; }
else
{ algIdsConc +=
","
; }
166
algIdsConc +=
to_string
(
id
);
167
}
168
algIdsConc+=
")"
;
169
170
TRG_MSG_DEBUG
(
""
<< algIds.size() <<
" algorithms "
);
171
TRG_MSG_VERBOSE
(
"Alg IDs : "
<< algIdsConc);
172
173
try
{
174
startSession
();
175
176
unique_ptr<coral::IQuery> query0(
m_session
.nominalSchema().newQuery());
177
query0->addToTableList(
"TA_TO_TI"
,
"TA2TI"
);
178
query0->addToTableList(
"TOPO_ALGO_INPUT"
,
"TAI"
);
179
coral::AttributeList bindList0;
180
181
string
theCondition0 =
""
;
182
theCondition0 +=
" TA2TI.TA2TI_ALGO_ID IN "
+ algIdsConc;
183
theCondition0 += string(
" AND TA2TI.TA2TI_INPUT_ID = TAI.TAI_ID"
);
184
query0->setCondition( theCondition0, bindList0 );
185
186
coral::AttributeList attList0;
187
attList0.extend<
int
>(
"TA2TI.TA2TI_ALGO_ID"
);
188
attList0.extend<
string
>(
"TAI.TAI_NAME"
);
189
attList0.extend<
string
>(
"TAI.TAI_VALUE"
);
190
attList0.extend<
int
>(
"TAI.TAI_POSITION"
);
191
query0->defineOutput(attList0);
192
fillQuery
(query0.get(), attList0);
193
//std::cout << "Executing loadAlgInput query " << std::endl;
194
coral::ICursor& cursor0 = query0->execute();
195
196
uint
inputCount = 0;
197
while
(cursor0.next()){
198
inputCount ++;
199
200
const
coral::AttributeList& row0 = cursor0.currentRow();
201
202
//std::cout << "loadAlgInput my row " << row0 << std::endl;
203
string
tai_name = row0[
"TAI.TAI_NAME"
].data<
string
>();
204
string
tai_value = row0[
"TAI.TAI_VALUE"
].data<
string
>();
205
int
tai_pos = row0[
"TAI.TAI_POSITION"
].data<
int
>();
206
if
(tai_pos<0) tai_pos=0;
// when position is missing in XML, currently the TT uploads -1 instead of 0
207
208
// fill the alg
209
int
algoId = row0[
"TA2TI.TA2TI_ALGO_ID"
].data<
int
>();
210
auto
match
= idToAlgMap.find(algoId);
211
if
(
match
== idToAlgMap.end())
continue
;
212
TXC::L1TopoConfigAlg
& alg =
match
->second;
213
alg.addInput(tai_name,tai_value,tai_pos);
214
}
215
216
TRG_MSG_DEBUG
(
""
<< inputCount <<
" inputs found"
);
217
218
}
catch
(
const
exception& e){
219
TRG_MSG_ERROR
(
"loadAlgInput >> Standard C++ exception: "
<< e.what());
220
throw
;
221
}
222
return
true
;
223
}
224
225
226
bool
227
TrigConf::L1TopoMenuLoader::loadAllAlgsOutput
( std::map<uint, TXC::L1TopoConfigAlg> & idToAlgMap ) {
228
TRG_MSG_VERBOSE
(
"Calling loadAllAlgsOutput"
);
229
230
set<uint> algIds;
231
for
(
auto
& e : idToAlgMap ) {
232
algIds.insert(e.first);
233
}
234
235
string
algIdsConc =
"("
;
236
bool
first =
true
;
237
for
(
int
id
: algIds ) {
238
if
(first) { first =
false
; }
else
{ algIdsConc +=
","
; }
239
algIdsConc +=
to_string
(
id
);
240
}
241
algIdsConc+=
")"
;
242
243
try
{
244
startSession
();
245
unique_ptr<coral::IQuery> query0(
m_session
.nominalSchema().newQuery());
246
query0->addToTableList(
"TOPO_ALGO"
,
"TA"
);
247
query0->addToTableList(
"TA_TO_TO"
,
"TA2TO"
);
248
query0->addToTableList(
"TOPO_ALGO_OUTPUT"
,
"TAO"
);
249
//Bind list
250
coral::AttributeList bindList0;
251
// bindList0.extend<int>("taId");
252
// bindList0[0].data<int>() = ta_id;
253
254
string
theCondition0 =
""
;
255
theCondition0 +=
" TA.TA_ID IN "
+ algIdsConc;
256
theCondition0 +=
" AND TA.TA_ID = TA2TO.TA2TO_ALGO_ID"
;
257
theCondition0 +=
" AND TA2TO.TA2TO_OUTPUT_ID = TAO.TAO_ID"
;
258
query0->setCondition( theCondition0, bindList0 );
259
260
coral::AttributeList attList0;
261
attList0.extend<
int
>(
"TA2TO.TA2TO_ALGO_ID"
);
262
attList0.extend<
string
>(
"TAO.TAO_NAME"
);
263
attList0.extend<
string
>(
"TAO.TAO_VALUE"
);
264
attList0.extend<
string
>(
"TAO.TAO_BITNAME"
);
265
attList0.extend<
int
>(
"TAO.TAO_SELECTION"
);
266
attList0.extend<
int
>(
"TA.TA_BITS"
);
267
query0->defineOutput(attList0);
268
fillQuery
(query0.get(), attList0);
269
//std::cout << "Executing loadAlgOutput query " << std::endl;
270
coral::ICursor& cursor0 = query0->execute();
271
272
273
uint
outputCount = 0;
274
while
(cursor0.next()){
275
outputCount ++;
276
277
const
coral::AttributeList& row0 = cursor0.currentRow();
278
//std::cout << "loadAlgOutput my row " << row0 << std::endl;
279
string
tao_name = row0[
"TAO.TAO_NAME"
].data<
string
>();
280
string
tao_value = row0[
"TAO.TAO_VALUE"
].data<
string
>();
281
string
tao_bitname = row0[
"TAO.TAO_BITNAME"
].data<
string
>();
282
int
tao_sel = row0[
"TAO.TAO_SELECTION"
].data<
int
>();
283
int
ta_bits = row0[
"TA.TA_BITS"
].data<
int
>();
284
285
// fill the alg
286
int
algoId = row0[
"TA2TO.TA2TO_ALGO_ID"
].data<
int
>();
287
auto
match
= idToAlgMap.find(algoId);
288
if
(
match
== idToAlgMap.end())
continue
;
289
TXC::L1TopoConfigAlg
& alg =
match
->second;
290
alg.addOutput(tao_name,tao_value,ta_bits,tao_bitname, tao_sel);
291
}
292
293
TRG_MSG_DEBUG
(
""
<< outputCount <<
" outputs found"
);
294
295
}
catch
(
const
exception& e){
296
TRG_MSG_ERROR
(
"loadAlgOutput >> Standard C++ exception: "
<< e.what());
297
throw
;
298
}
299
return
true
;
300
}
301
302
303
304
bool
305
TrigConf::L1TopoMenuLoader::loadAllAlgsRegister
( std::map<uint, TXC::L1TopoConfigAlg> & idToAlgMap ) {
306
307
TRG_MSG_VERBOSE
(
"Calling loadAllAlgsRegister"
);
308
309
set<uint> algIds;
310
for
(
auto
& e : idToAlgMap ) {
311
algIds.insert(e.first);
312
}
313
314
string
algIdsConc =
"("
;
315
bool
first =
true
;
316
for
(
int
id
: algIds ) {
317
if
(first) { first =
false
; }
else
{ algIdsConc +=
","
; }
318
algIdsConc +=
to_string
(
id
);
319
}
320
algIdsConc+=
")"
;
321
322
try
{
323
startSession
();
324
325
unique_ptr<coral::IQuery> query0(
m_session
.nominalSchema().newQuery());
326
query0->addToTableList(
"TA_TO_TP"
,
"TA2TP"
);
327
query0->addToTableList(
"TOPO_PARAMETER"
,
"TP"
);
328
//Bind list
329
coral::AttributeList bindList0;
330
// bindList0.extend<int>("taId");
331
// bindList0[0].data<int>() = ta_id;
332
333
string
theCondition0 =
""
;
334
theCondition0 +=
" TA2TP.TA2TP_ALGO_ID IN "
+ algIdsConc;
335
theCondition0 +=
" AND TA2TP.TA2TP_PARAM_ID = TP.TP_ID"
;
336
query0->setCondition( theCondition0, bindList0 );
337
338
coral::AttributeList attList0;
339
attList0.extend<
int
>(
"TA2TP.TA2TP_ALGO_ID"
);
340
attList0.extend<
string
>(
"TP.TP_NAME"
);
341
attList0.extend<
long
>(
"TP.TP_VALUE"
);
342
attList0.extend<
int
>(
"TP.TP_POSITION"
);
343
attList0.extend<
int
>(
"TP.TP_SELECTION"
);
344
query0->defineOutput(attList0);
345
fillQuery
(query0.get(), attList0);
346
//std::cout << "Executing loadAlgRegister query " << std::endl;
347
coral::ICursor& cursor0 = query0->execute();
348
349
uint
registerCount(0);
350
while
(cursor0.next()){
351
registerCount++;
352
const
coral::AttributeList& row0 = cursor0.currentRow();
353
//std::cout << "loadAlgRegister my row " << row0 << std::endl;
354
string
tp_name = row0[
"TP.TP_NAME"
].data<
string
>();
355
long
tp_value = row0[
"TP.TP_VALUE"
].data<
long
>();
356
int
tp_pos = row0[
"TP.TP_POSITION"
].data<
int
>();
357
int
tp_sel = row0[
"TP.TP_SELECTION"
].data<
int
>();
358
if
(tp_pos<0) tp_pos=0;
359
if
(tp_sel<0) tp_sel=0;
360
361
362
// fill the alg
363
int
algoId = row0[
"TA2TP.TA2TP_ALGO_ID"
].data<
int
>();
364
auto
match
= idToAlgMap.find(algoId);
365
if
(
match
== idToAlgMap.end())
continue
;
366
TXC::L1TopoConfigAlg
& alg =
match
->second;
367
alg.addParameter(tp_name,
to_string
(tp_value),tp_pos, tp_sel);
368
}
369
370
TRG_MSG_DEBUG
(
""
<< registerCount <<
" registers found"
);
371
372
}
catch
(
const
exception& e){
373
TRG_MSG_ERROR
(
"loadAlgRegister >> Standard C++ exception: "
<< e.what());
374
throw
;
375
}
376
return
true
;
377
}
378
379
380
381
382
bool
383
TrigConf::L1TopoMenuLoader::loadAllAlgsFixed
( std::map<uint, TXC::L1TopoConfigAlg> & idToAlgMap ) {
384
TRG_MSG_VERBOSE
(
"Calling loadAllAlgsFixed"
);
385
386
set<uint> algIds;
387
for
(
auto
& e : idToAlgMap ) {
388
algIds.insert(e.first);
389
}
390
391
string
algIdsConc =
"("
;
392
bool
first =
true
;
393
for
(
int
id
: algIds ) {
394
if
(first) { first =
false
; }
else
{ algIdsConc +=
","
; }
395
algIdsConc +=
to_string
(
id
);
396
}
397
algIdsConc+=
")"
;
398
399
try
{
400
startSession
();
401
402
unique_ptr<coral::IQuery> query0(
m_session
.nominalSchema().newQuery());
403
query0->addToTableList(
"TA_TO_TG"
,
"TA2TG"
);
404
query0->addToTableList(
"TOPO_GENERIC"
,
"TG"
);
405
//Bind list
406
coral::AttributeList bindList0;
407
// bindList0.extend<int>("taId");
408
// bindList0[0].data<int>() = ta_id;
409
410
string
theCondition0 =
""
;
411
theCondition0 += string(
" TA2TG.TA2TG_ALGO_ID IN "
+ algIdsConc);
412
theCondition0 += string(
" AND TA2TG.TA2TG_GENERIC_ID = TG.TG_ID"
);
413
query0->setCondition( theCondition0, bindList0 );
414
415
query0->addToOrderList(
"TG.TG_NAME"
);
416
417
coral::AttributeList attList0;
418
attList0.extend<
int
>(
"TA2TG.TA2TG_ALGO_ID"
);
419
attList0.extend<
string
>(
"TG.TG_NAME"
);
420
attList0.extend<
string
>(
"TG.TG_VALUE"
);
421
query0->defineOutput(attList0);
422
fillQuery
(query0.get(), attList0);
423
//std::cout << "Executing loadAlgFiexed query " << std::endl;
424
coral::ICursor& cursor0 = query0->execute();
425
426
uint
fixedCount(0);
427
while
(cursor0.next()){
428
fixedCount++;
429
const
coral::AttributeList& row0 = cursor0.currentRow();
430
//std::cout << "loadAlgFixed my row " << row0 << std::endl;
431
string
tg_name = row0[
"TG.TG_NAME"
].data<
string
>();
432
string
tg_value = row0[
"TG.TG_VALUE"
].data<
string
>();
433
434
// fill the alg
435
int
algoId = row0[
"TA2TG.TA2TG_ALGO_ID"
].data<
int
>();
436
auto
match
= idToAlgMap.find(algoId);
437
if
(
match
== idToAlgMap.end())
continue
;
438
TXC::L1TopoConfigAlg
& alg =
match
->second;
439
alg.addFixedParameter(tg_name,tg_value);
440
}
441
442
TRG_MSG_DEBUG
(
""
<< fixedCount <<
" Fixed found"
);
443
444
}
catch
(
const
exception& e){
445
TRG_MSG_ERROR
(
"loadAlgFixed >> Standard C++ exception: "
<< e.what());
446
return
false
;
447
}
448
return
true
;
449
450
}
451
452
453
454
455
/*
456
bool TrigConf::L1TopoMenuLoader::loadAlgInput( TXC::L1TopoConfigAlg& tcaTarget, const int& ta_id ) {
457
try {
458
TRG_MSG_VERBOSE("Calling loadAlgInput");
459
startSession();
460
461
unique_ptr<coral::IQuery> query0(m_session.nominalSchema().newQuery());
462
query0->addToTableList("TA_TO_TI","TA2TI");
463
query0->addToTableList("TOPO_ALGO_INPUT","TAI");
464
//Bind list
465
coral::AttributeList bindList0;
466
bindList0.extend<int>("taId");
467
bindList0[0].data<int>() = ta_id;
468
469
string theCondition0 = "";
470
theCondition0 += string(" TA2TI.TA2TI_ALGO_ID = :taId" );
471
theCondition0 += string(" AND TA2TI.TA2TI_INPUT_ID = TAI.TAI_ID");
472
query0->setCondition( theCondition0, bindList0 );
473
474
coral::AttributeList attList0;
475
attList0.extend<string>( "TAI.TAI_NAME" );
476
attList0.extend<string>( "TAI.TAI_VALUE" );
477
attList0.extend<int>( "TAI.TAI_POSITION" );
478
query0->defineOutput(attList0);
479
fillQuery(query0.get(), attList0);
480
//std::cout << "Executing loadAlgInput query " << std::endl;
481
coral::ICursor& cursor0 = query0->execute();
482
while(cursor0.next()){
483
const coral::AttributeList& row0 = cursor0.currentRow();
484
//std::cout << "loadAlgInput my row " << row0 << std::endl;
485
string tai_name = row0["TAI.TAI_NAME"].data<string>();
486
string tai_value = row0["TAI.TAI_VALUE"].data<string>();
487
int tai_pos = row0["TAI.TAI_POSITION"].data<int>();
488
if(tai_pos<0) tai_pos=0; // when position is missing in XML, currently the TT uploads -1 instead of 0
489
tcaTarget.addInput(tai_name,tai_value,tai_pos);
490
}
491
} catch (const exception& e){
492
TRG_MSG_ERROR("loadAlgInput >> Standard C++ exception: " << e.what());
493
throw;
494
}
495
return true;
496
}
497
498
bool TrigConf::L1TopoMenuLoader::loadAlgRegister( TXC::L1TopoConfigAlg& tcaTarget, const int& ta_id ) {
499
try {
500
TRG_MSG_VERBOSE("Calling loadAlgRegister");
501
startSession();
502
503
unique_ptr<coral::IQuery> query0(m_session.nominalSchema().newQuery());
504
query0->addToTableList("TA_TO_TP","TA2TP");
505
query0->addToTableList("TOPO_PARAMETER","TP");
506
//Bind list
507
coral::AttributeList bindList0;
508
bindList0.extend<int>("taId");
509
bindList0[0].data<int>() = ta_id;
510
511
string theCondition0 = "";
512
theCondition0 += string(" TA2TP.TA2TP_ALGO_ID = :taId" );
513
theCondition0 += string(" AND TA2TP.TA2TP_PARAM_ID = TP.TP_ID");
514
query0->setCondition( theCondition0, bindList0 );
515
516
coral::AttributeList attList0;
517
attList0.extend<string>( "TP.TP_NAME" );
518
attList0.extend<long>( "TP.TP_VALUE" );
519
attList0.extend<int>( "TP.TP_POSITION" );
520
attList0.extend<int>( "TP.TP_SELECTION" );
521
query0->defineOutput(attList0);
522
fillQuery(query0.get(), attList0);
523
//std::cout << "Executing loadAlgRegister query " << std::endl;
524
coral::ICursor& cursor0 = query0->execute();
525
while(cursor0.next()){
526
const coral::AttributeList& row0 = cursor0.currentRow();
527
//std::cout << "loadAlgRegister my row " << row0 << std::endl;
528
string tp_name = row0["TP.TP_NAME"].data<string>();
529
long tp_value = row0["TP.TP_VALUE"].data<long>();
530
int tp_pos = row0["TP.TP_POSITION"].data<int>();
531
int tp_sel = row0["TP.TP_SELECTION"].data<int>();
532
if(tp_pos<0) tp_pos=0;
533
if(tp_sel<0) tp_sel=0;
534
tcaTarget.addParameter(tp_name,to_string(tp_value),tp_pos, tp_sel);
535
}
536
} catch (const exception& e){
537
TRG_MSG_ERROR("loadAlgRegister >> Standard C++ exception: " << e.what());
538
throw;
539
}
540
return true;
541
}
542
543
bool TrigConf::L1TopoMenuLoader::loadAlgOutput( TXC::L1TopoConfigAlg& tcaTarget, const int& ta_id, const int& ta_bits ) {
544
try {
545
TRG_MSG_VERBOSE("Calling loadAlgOutput");
546
startSession();
547
unique_ptr<coral::IQuery> query0(m_session.nominalSchema().newQuery());
548
query0->addToTableList("TA_TO_TO","TA2TO");
549
query0->addToTableList("TOPO_ALGO_OUTPUT","TAO");
550
//Bind list
551
coral::AttributeList bindList0;
552
bindList0.extend<int>("taId");
553
bindList0[0].data<int>() = ta_id;
554
555
string theCondition0 = "";
556
theCondition0 += string(" TA2TO.TA2TO_ALGO_ID = :taId" );
557
theCondition0 += string(" AND TA2TO.TA2TO_OUTPUT_ID = TAO.TAO_ID");
558
query0->setCondition( theCondition0, bindList0 );
559
560
coral::AttributeList attList0;
561
attList0.extend<string>( "TAO.TAO_NAME" );
562
attList0.extend<string>( "TAO.TAO_VALUE" );
563
attList0.extend<string>( "TAO.TAO_BITNAME" );
564
attList0.extend<int>( "TAO.TAO_SELECTION" );
565
query0->defineOutput(attList0);
566
fillQuery(query0.get(), attList0);
567
//std::cout << "Executing loadAlgOutput query " << std::endl;
568
coral::ICursor& cursor0 = query0->execute();
569
while(cursor0.next()){
570
const coral::AttributeList& row0 = cursor0.currentRow();
571
//std::cout << "loadAlgOutput my row " << row0 << std::endl;
572
string tao_name = row0["TAO.TAO_NAME"].data<string>();
573
string tao_value = row0["TAO.TAO_VALUE"].data<string>();
574
string tao_bitname = row0["TAO.TAO_BITNAME"].data<string>();
575
int tao_sel = row0["TAO.TAO_SELECTION"].data<int>();
576
tcaTarget.addOutput(tao_name,tao_value,ta_bits,tao_bitname, tao_sel);
577
}
578
} catch (const exception& e){
579
TRG_MSG_ERROR("loadAlgOutput >> Standard C++ exception: " << e.what());
580
throw;
581
}
582
return true;
583
}
584
585
bool TrigConf::L1TopoMenuLoader::loadAlgFixed( TXC::L1TopoConfigAlg& tcaTarget, const int& ta_id ) {
586
try {
587
TRG_MSG_VERBOSE("Calling loadAlgFixed");
588
startSession();
589
590
unique_ptr<coral::IQuery> query0(m_session.nominalSchema().newQuery());
591
query0->addToTableList("TA_TO_TG","TA2TG");
592
query0->addToTableList("TOPO_GENERIC","TG");
593
//Bind list
594
coral::AttributeList bindList0;
595
bindList0.extend<int>("taId");
596
bindList0[0].data<int>() = ta_id;
597
598
string theCondition0 = "";
599
theCondition0 += string(" TA2TG.TA2TG_ALGO_ID = :taId" );
600
theCondition0 += string(" AND TA2TG.TA2TG_GENERIC_ID = TG.TG_ID");
601
query0->setCondition( theCondition0, bindList0 );
602
603
coral::AttributeList attList0;
604
attList0.extend<string>( "TG.TG_NAME" );
605
attList0.extend<string>( "TG.TG_VALUE" );
606
query0->defineOutput(attList0);
607
fillQuery(query0.get(), attList0);
608
//std::cout << "Executing loadAlgFiexed query " << std::endl;
609
coral::ICursor& cursor0 = query0->execute();
610
while(cursor0.next()){
611
const coral::AttributeList& row0 = cursor0.currentRow();
612
//std::cout << "loadAlgFixed my row " << row0 << std::endl;
613
string tg_name = row0["TG.TG_NAME"].data<string>();
614
string tg_value = row0["TG.TG_VALUE"].data<string>();
615
tcaTarget.addFixedParameter(tg_name,tg_value);
616
}
617
} catch (const exception& e){
618
TRG_MSG_ERROR("loadAlgFixed >> Standard C++ exception: " << e.what());
619
return false;
620
}
621
return true;
622
}
623
*/
624
625
bool
TrigConf::L1TopoMenuLoader::loadOutputList
(
TXC::L1TopoMenu
& tcaTarget,
const
int
& ctplinkid) {
626
try
{
627
TRG_MSG_VERBOSE
(
"Calling loadOutputList"
);
628
startSession
();
629
630
unique_ptr<coral::IQuery> query0(
m_session
.nominalSchema().newQuery());
631
query0->addToTableList(
"TOPO_OUTPUT_LIST"
,
"TOL"
);
632
query0->addToTableList(
"TOPO_OUTPUT_LINK"
,
"TOLK"
);
633
query0->addToTableList(
"TOPO_OUTPUT_LINE"
,
"TOLINE"
);
634
//Bind list
635
coral::AttributeList bindList0;
636
bindList0.extend<
int
>(
"ctpLId"
);
637
bindList0[0].data<
int
>() = ctplinkid;
638
639
string
theCondition0 =
""
;
640
theCondition0 += string(
" TOL.OL_ID = :ctpLId"
);
641
theCondition0 += string(
" AND TOLK.TL_LINK_ID = TOL.OL_ID"
);
642
theCondition0 += string(
" AND TOLK.TL_OUTPUT_ID = TOLINE.TOL_ID"
);
643
query0->setCondition( theCondition0, bindList0 );
644
645
coral::AttributeList attList0;
646
attList0.extend<
int
>(
"TOLINE.TOL_ID"
);
647
attList0.extend<
string
>(
"TOLINE.TOL_ALGO_NAME"
);
648
attList0.extend<
string
>(
"TOLINE.TOL_TRIGGERLINE"
);
649
attList0.extend<
unsigned
int
>(
"TOLINE.TOL_ALGO_ID"
);
650
attList0.extend<
unsigned
int
>(
"TOLINE.TOL_MODULE"
);
651
attList0.extend<
unsigned
int
>(
"TOLINE.TOL_FPGA"
);
652
attList0.extend<
unsigned
int
>(
"TOLINE.TOL_FIRST_BIT"
);
653
attList0.extend<
unsigned
int
>(
"TOLINE.TOL_CLOCK"
);
654
query0->defineOutput(attList0);
655
fillQuery
(query0.get(), attList0);
656
//std::cout << "Executing loadAlgFiexed query " << std::endl;
657
coral::ICursor& cursor0 = query0->execute();
658
while
(cursor0.next()){
659
const
coral::AttributeList& row0 = cursor0.currentRow();
660
//std::cout << "loadOutputList my row " << row0 << std::endl;
661
string
tol_name = row0[
"TOLINE.TOL_ALGO_NAME"
].data<
string
>();
662
unsigned
int
tol_algoId = row0[
"TOLINE.TOL_ALGO_ID"
].data<
unsigned
int
>();
663
unsigned
int
tol_module = row0[
"TOLINE.TOL_MODULE"
].data<
unsigned
int
>();
664
unsigned
int
tol_fpga = row0[
"TOLINE.TOL_FPGA"
].data<
unsigned
int
>();
665
unsigned
int
tol_clock = row0[
"TOLINE.TOL_CLOCK"
].data<
unsigned
int
>();
666
unsigned
int
tol_firstbit = row0[
"TOLINE.TOL_FIRST_BIT"
].data<
unsigned
int
>();
667
tcaTarget.
addL1TopoXMLOutput
(
TXC::OutputListElement
( tol_name, tol_algoId, tol_module, tol_fpga, tol_clock, tol_firstbit));
668
}
669
tcaTarget.
setTriggerList
();
670
}
catch
(
const
exception& e){
671
TRG_MSG_ERROR
(
"loadOutputList >> Standard C++ exception: "
<< e.what());
672
throw
;
673
}
674
return
true
;
675
}
676
677
bool
TrigConf::L1TopoMenuLoader::loadTopoConfig
(
TXC::L1TopoMenu
& tcaTarget) {
678
679
try
{
680
TRG_MSG_VERBOSE
(
"Calling loadTopoConfig"
);
681
startSession
();
682
683
unique_ptr<coral::IQuery> query0(
m_session
.nominalSchema().newQuery());
684
query0->addToTableList(
"SUPER_MASTER_TABLE"
,
"SM"
);
685
query0->addToTableList(
"TOPO_MASTER_TABLE"
,
"TMT"
);
686
query0->addToTableList(
"TOPO_TRIGGER_MENU"
,
"TTM"
);
687
query0->addToTableList(
"TTM_TO_TC"
,
"TTM2TC"
);
688
query0->addToTableList(
"TOPO_CONFIG"
,
"TC"
);
689
query0->setRowCacheSize(5);
690
691
//Bind list
692
coral::AttributeList bindList0;
693
bindList0.extend<
unsigned
int
>(
"tmtId"
);
694
std::string cond =
"TMT_ID = :tmtId"
;
695
bindList0[0].data<
unsigned
int
>() = tcaTarget.
getSMK
();
696
697
string
theCondition0 =
""
;
698
theCondition0 += string(
" SM.SMT_ID = :tmtId"
);
699
theCondition0 += string(
" AND TMT.TMT_ID = SM.SMT_TOPO_MASTER_TABLE_ID "
);
700
theCondition0 += string(
" AND TTM.TTM_ID = TMT.TMT_TRIGGER_MENU_ID "
);
701
theCondition0 += string(
" AND TTM2TC.TTM2TC_ID = TTM.TTM_ID "
);
702
theCondition0 += string(
" AND TC.TC_ID = TTM2TC.TTM2TC_CONFIG_ID "
);
703
query0->setCondition( theCondition0, bindList0 );
704
705
coral::AttributeList attList0;
706
attList0.extend<
string
>(
"TC.TC_NAME"
);
707
attList0.extend<
string
>(
"TC.TC_VALUE"
);
708
query0->defineOutput(attList0);
709
fillQuery
(query0.get(), attList0);
710
coral::ICursor& cursor0 = query0->execute();
711
712
while
(cursor0.next()){
713
const
coral::AttributeList& row0 = cursor0.currentRow();
714
715
string
tc_name = row0[
"TC.TC_NAME"
].data<
string
>();
716
string
tc_value = row0[
"TC.TC_VALUE"
].data<
string
>();
717
718
tcaTarget.
addL1TopoConfigGlobal
(
TXC::TopoConfigElement
(tc_name,tc_value));
719
}
720
721
}
catch
(
const
std::exception& e ) {
722
TRG_MSG_ERROR
(
"loadTopoConfig >> Standard C++ exception: "
<< e.what());
723
commitSession
();
724
throw
;
725
}
726
return
true
;
727
}
728
DBHelper.h
to_string
static std::string to_string(const std::vector< T > &v)
Definition
FPGATrackSimGenScanTool.cxx:44
L1TopoConfigAlg.h
L1TopoMenuLoader.h
L1TopoMenu.h
uint
unsigned int uint
Definition
LArOFPhaseFill.cxx:19
TRG_MSG_INFO
#define TRG_MSG_INFO(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:27
TRG_MSG_VERBOSE
#define TRG_MSG_VERBOSE(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:24
TRG_MSG_DEBUG
#define TRG_MSG_DEBUG(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:25
TRG_MSG_ERROR
#define TRG_MSG_ERROR(x)
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStreamMacros.h:29
TXC::L1TopoConfigAlg
Definition
L1TopoConfigAlg.h:56
TXC::L1TopoConfigAlg::NONE
@ NONE
Definition
L1TopoConfigAlg.h:59
TXC::L1TopoConfigAlg::DECISION
@ DECISION
Definition
L1TopoConfigAlg.h:59
TXC::L1TopoConfigAlg::SORT
@ SORT
Definition
L1TopoConfigAlg.h:59
TXC::L1TopoConfigOutputList::getTriggerLines
const std::vector< TriggerLine > & getTriggerLines() const
Definition
L1TopoConfigOutputList.h:105
TXC::L1TopoMenu
Definition
L1TopoMenu.h:25
TXC::L1TopoMenu::setName
void setName(const std::string &name)
setter methods
Definition
L1TopoMenu.h:61
TXC::L1TopoMenu::getSMK
const unsigned int & getSMK() const
Definition
L1TopoMenu.h:48
TXC::L1TopoMenu::getL1TopoConfigOutputList
const L1TopoConfigOutputList & getL1TopoConfigOutputList() const
Definition
L1TopoMenu.h:55
TXC::L1TopoMenu::setVersion
void setVersion(const std::string &version)
Definition
L1TopoMenu.h:62
TXC::L1TopoMenu::addL1TopoXMLOutput
void addL1TopoXMLOutput(const TXC::OutputListElement &output)
add output
Definition
L1TopoMenu.h:69
TXC::L1TopoMenu::setTriggerList
TCS::StatusCode setTriggerList()
Definition
L1TopoMenu.cxx:40
TXC::L1TopoMenu::getL1TopoConfigAlgs
const std::vector< TXC::L1TopoConfigAlg > & getL1TopoConfigAlgs() const
Definition
L1TopoMenu.h:53
TXC::L1TopoMenu::addAlgorithm
void addAlgorithm(TXC::L1TopoConfigAlg &&alg)
add algorithm
Definition
L1TopoMenu.cxx:27
TXC::L1TopoMenu::addL1TopoConfigGlobal
void addL1TopoConfigGlobal(const TXC::TopoConfigElement &topoconfig)
add config
Definition
L1TopoMenu.h:72
TXC::L1TopoMenu::print
void print() const
print menu
Definition
L1TopoMenu.cxx:64
TXC::OutputListElement
Definition
L1TopoConfigOutputList.h:57
TrigConf::DBLoader::commitSession
void commitSession()
commit session if not already done
Definition
DBLoader.cxx:45
TrigConf::DBLoader::m_session
coral::ISessionProxy & m_session
CORAL interface to database session.
Definition
DBLoader.h:67
TrigConf::DBLoader::isRun1
bool isRun1()
Definition
DBLoader.h:59
TrigConf::DBLoader::triggerDBSchemaVersion
unsigned int triggerDBSchemaVersion()
Definition
DBLoader.cxx:76
TrigConf::DBLoader::startSession
void startSession()
start session if not already active
Definition
DBLoader.cxx:36
TrigConf::L1TopoMenuLoader::loadOutputList
bool loadOutputList(TXC::L1TopoMenu &tcaTarget, const int &ctplinkid)
Definition
L1TopoMenuLoader.cxx:625
TrigConf::L1TopoMenuLoader::loadTopoAlgos
bool loadTopoAlgos(TXC::L1TopoMenu &tcaTarget)
Definition
L1TopoMenuLoader.cxx:52
TrigConf::L1TopoMenuLoader::loadAllAlgsOutput
bool loadAllAlgsOutput(std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
Definition
L1TopoMenuLoader.cxx:227
TrigConf::L1TopoMenuLoader::loadAllAlgsFixed
bool loadAllAlgsFixed(std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
Definition
L1TopoMenuLoader.cxx:383
TrigConf::L1TopoMenuLoader::loadAllAlgsInput
bool loadAllAlgsInput(std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
Definition
L1TopoMenuLoader.cxx:153
TrigConf::L1TopoMenuLoader::loadAllAlgsRegister
bool loadAllAlgsRegister(std::map< uint, TXC::L1TopoConfigAlg > &idToAlgMap)
Definition
L1TopoMenuLoader.cxx:305
TrigConf::L1TopoMenuLoader::loadTopoConfig
bool loadTopoConfig(TXC::L1TopoMenu &tcaTarget)
Definition
L1TopoMenuLoader.cxx:677
TrigConf::L1TopoMenuLoader::load
virtual bool load(TXC::L1TopoMenu &) override
Definition
L1TopoMenuLoader.cxx:27
TrigConf::TrigConfMessaging::msg
MsgStreamTC & msg() const
The standard message stream.
Definition
TrigConfMessaging.h:86
match
bool match(std::string s1, std::string s2)
match the individual directories of two strings
Definition
hcg.cxx:359
TrigConf::MSGTC::INFO
@ INFO
Definition
Trigger/TrigConfiguration/TrigConfBase/TrigConfBase/MsgStream.h:25
TrigConf::fillQuery
void fillQuery(coral::IQuery *q, coral::AttributeList &attList)
Definition
DBHelper.cxx:13
std
STL namespace.
TXC::TopoConfigElement
Definition
L1TopoConfigGlobal.h:13
Generated on
for ATLAS Offline Software by
1.17.0