28 #include <type_traits>
55 if( ( !
menu->hasStore() ) && ( ( !
menu->container() ) ||
56 ( !
menu->container()->hasStore() ) ) ) {
58 <<
"xAOD::TriggerMenu object is not connected to an auxiliary "
60 return StatusCode::FAILURE;
69 for(
size_t i = 0;
i <
menu->itemCtpIds().
size(); ++
i ) {
72 item->setCtpId(
menu->itemCtpIds()[
i ] );
74 if(
menu->itemPrescalesAvailable() ) {
76 static_cast< float >(
menu->itemPrescales()[
i ] ) );
80 <<
" has ctpid " <<
menu->itemCtpIds()[
i ] <<
endmsg;
89 bool signatureWarningPrinted =
false;
92 for(
size_t i = 0;
i <
menu->chainIds().
size(); ++
i ) {
95 std::string
level =
"";
96 if(
menu->chainNames()[
i ].find(
"L2_" ) == 0 ) {
98 }
else if(
menu->chainNames()[
i ].find(
"EF_" ) == 0 ) {
100 }
else if(
menu->chainNames()[
i ].find(
"HLT_" ) == 0 ) {
103 msg << MSG::WARNING <<
"prepareTriggerMenu(...): "
104 <<
"Couldn't figure out 'level' for chain: "
111 if(
menu->chainSignatureCountersAvailable() &&
112 menu->chainSignatureCounters().size() &&
113 menu->chainSignatureLogicsAvailable() &&
114 menu->chainSignatureLogics().size() &&
115 menu->chainSignatureOutputTEsAvailable() &&
116 menu->chainSignatureOutputTEs().size()
120 const std::vector< uint32_t >& counters =
121 menu->chainSignatureCounters()[
i ];
122 const std::vector< int >& logics =
123 menu->chainSignatureLogics()[
i ];
124 const std::vector< std::vector< std::string > >& outputTEs =
125 menu->chainSignatureOutputTEs()[
i ];
133 <<
" has counter " <<
menu->chainIds()[
i ]
134 <<
" and " << counters.size() <<
" signatures" <<
endmsg;
136 for(
size_t sig = 0;
sig < counters.size(); ++
sig ) {
137 std::vector< HLTTriggerElement* > outTEs;
138 outTEs.reserve(outputTEs[
sig ].
size());
139 for(
size_t outTEcounter = 0;
140 outTEcounter< outputTEs[
sig ].size(); ++outTEcounter ) {
143 outTEs.push_back( element );
153 }
else if( ! signatureWarningPrinted ) {
154 msg << MSG::WARNING <<
"prepareTriggerMenu(...): "
155 <<
"HLT Signature information not available on the input"
157 signatureWarningPrinted =
true;
162 menu->chainIds()[
i ],
165 menu->chainParentNames()[
i ],
168 if(
menu->chainRerunPrescalesAvailable() ) {
169 chain->set_rerun_prescale(
menu->chainRerunPrescales()[
i ] );
171 if(
menu->chainPassthroughPrescalesAvailable() ) {
172 chain->set_pass_through(
menu->chainPassthroughPrescales()[
i ] );
174 if (
menu->chainPrescalesAvailable() ) {
175 chain->set_prescale(
menu->chainPrescales()[
i ]);
179 std::vector<long unsigned int> leg_multiplicities(parsed_multiplicities.begin(), parsed_multiplicities.end());
180 chain->set_leg_multiplicities( leg_multiplicities );
185 <<
"Couldn't add chain \"" <<
chain->name()
188 return StatusCode::FAILURE;
193 if(
menu->sequenceInputTEsAvailable() &&
194 menu->sequenceOutputTEsAvailable() &&
195 menu->sequenceAlgorithmsAvailable() ) {
197 for(
size_t i = 0;
i<
menu->sequenceOutputTEs().
size(); ++
i ) {
200 std::vector< HLTTriggerElement* > inputTEs;
201 for(
size_t j = 0; j <
menu->sequenceInputTEs()[
i ].
size(); ++j ) {
204 inputTEs.push_back( te );
208 menu->sequenceAlgorithms()[
i ] );
214 msg << MSG::WARNING <<
"prepareTriggerMenu(...): "
215 <<
"HLT Sequence information not available on the input" <<
endmsg;
219 if(
menu->bunchGroupBunchesAvailable() ) {
226 for(
size_t i = 0;
i <
menu->bunchGroupBunches().
size(); ++
i ) {
230 bg.setInternalNumber(
i );
231 std::vector< uint16_t >::const_iterator b_itr =
232 menu->bunchGroupBunches()[
i ].begin();
233 std::vector< uint16_t >::const_iterator b_end =
234 menu->bunchGroupBunches()[
i ].end();
235 for( ; b_itr != b_end; ++b_itr ) {
236 bg.addBunch( *b_itr );
247 msg << MSG::WARNING <<
"prepareTriggerMenu(...): "
248 <<
"Bunch-group information not available on the "
253 msg << MSG::INFO <<
"Loaded xAOD::TriggerMenu configuration:" <<
endmsg;
254 msg << MSG::INFO <<
" SMK = " <<
menu->smk()
255 <<
", L1PSK = " <<
menu->l1psk()
259 return StatusCode::SUCCESS;
267 std::vector<T> return_vector;
268 for(
const ptree::value_type&
entry :
ds.data().get_child(child) ) {
269 return_vector.push_back(
entry.second.get_value<T>() );
271 return return_vector;
278 std::vector<std::vector<T>> return_vector;
279 for(
const ptree::value_type& outer :
ds.data().get_child(child) ) {
280 return_vector.push_back(std::vector<T>());
281 for (
const ptree::value_type& inner : outer.second) {
282 return_vector.back().push_back( inner.second.get_value<T>() );
285 return return_vector;
321 for (
const L1Item& loadedItem : loadedL1) {
323 item->setName( loadedItem.name() );
324 item->setCtpId( loadedItem.ctpId() );
330 ps = loadedPrescale.
enabled ?
static_cast< float >( loadedPrescale.
prescale ) : -1.0;
336 <<
" has ctpid " << loadedItem.ctpId()
337 <<
" and prescale " << ps
345 sequenceList.
clear();
349 for (
const Chain& loadedChain : loadedHlt) {
351 std::string
level =
"";
352 if( loadedChain.name().find(
"L2_" ) == 0 ) {
354 }
else if( loadedChain.name().find(
"EF_" ) == 0 ) {
356 }
else if( loadedChain.name().find(
"HLT_" ) == 0 ) {
359 msg << MSG::WARNING <<
"prepareTriggerMenu(...): "
360 <<
"Couldn't figure out 'level' for chain: "
361 << loadedChain.name() <<
endmsg;
368 std::vector<uint32_t> counters;
369 std::vector<int> logics;
370 std::vector<std::vector<std::string>> outputTEs;
371 if (loadedChain.hasChild(
"signature")) {
372 counters = ToVector<uint32_t>(loadedChain,
"signature.counters");
373 logics = ToVector<int>(loadedChain,
"signature.logics");
374 outputTEs = ToVectorVector<std::string>(loadedChain,
"signature.outputTEs");
377 for(
size_t sig = 0;
sig < counters.size(); ++
sig ) {
378 std::vector< HLTTriggerElement* > outTEs;
379 outTEs.reserve(outputTEs[
sig ].
size());
380 for(
size_t outTEcounter = 0; outTEcounter< outputTEs[
sig ].size(); ++outTEcounter ) {
382 outTEs.push_back( element );
393 loadedChain.counter(),
396 loadedChain.l1item(),
400 chain->set_rerun_prescale( -1.0 );
401 chain->set_pass_through( -1.0 );
402 chain->set_leg_multiplicities( loadedChain.legMultiplicities() );
404 for (
const std::string&
group : loadedChain.groups()){
411 ps = loadedPrescale.
enabled ?
static_cast< float >( loadedPrescale.
prescale ) : -1.0;
413 chain->set_prescale( ps );
417 <<
" has counter " << loadedChain.counter()
418 <<
", HLT prescale " << ps
419 <<
", groups " << loadedChain.groups().size() <<
", legs " << loadedChain.legMultiplicities().size()
420 <<
", and " << counters.size() <<
" signatures (runs 1,2 only) " <<
endmsg;
426 <<
"Couldn't add chain \"" <<
chain->name()
429 return StatusCode::FAILURE;
435 if( loadedHlt.
hasChild(
"sequence_run2") ) {
436 std::vector<std::string> menu_outputTEs = ToVector<std::string>(loadedHlt,
"sequence_run2.outputTEs");
437 std::vector<std::vector<std::string>> menu_inputTEs = ToVectorVector<std::string>(loadedHlt,
"sequence_run2.inputTEs");
438 std::vector<std::vector<std::string>> menu_algorithms = ToVectorVector<std::string>(loadedHlt,
"sequence_run2.algorithms");
440 for(
size_t i = 0;
i< menu_outputTEs.size(); ++
i ) {
442 std::vector< HLTTriggerElement* > inputTEs;
443 for(
size_t j = 0; j < menu_inputTEs[
i ].size(); ++j ) {
445 inputTEs.push_back( te );
462 for(
size_t i = 0;
i < 16; ++
i ) {
464 bg.setInternalNumber(
i);
471 for(
size_t i = 0;
i < loadedBgSet.
size(); ++
i ) {
473 const std::shared_ptr<L1BunchGroup> loadedBg = loadedBgSet.
getBunchGroup(
i);
477 bg.setInternalNumber(
i);
481 bg.addBunch(
static_cast<int>(
b) );
492 bgSet = std::move(bgSetNew);
495 return StatusCode::SUCCESS;