Skip to content
Snippets Groups Projects
Commit 28d83cc3 authored by Joerg Stelzer's avatar Joerg Stelzer Committed by Graeme Stewart
Browse files

fix segfault in menu merger, was due to a copy of the trigger config (TrigConfxAOD-00-00-13)

parent 3e4f5c4c
No related branches found
No related tags found
No related merge requests found
......@@ -2,7 +2,7 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: prepareTriggerMenu.cxx 631651 2014-11-27 18:33:16Z lheinric $
// $Id: prepareTriggerMenu.cxx 647171 2015-02-16 15:33:28Z krasznaa $
// Infrastructure include(s):
#include "AsgTools/MsgStream.h"
......@@ -37,10 +37,19 @@ namespace TrigConf {
StatusCode prepareTriggerMenu( const xAOD::TriggerMenu* menu,
CTPConfig& ctpConfig,
HLTChainList& chainList,
HLTSequenceList& sequenceList,
HLTSequenceList& sequenceList,
BunchGroupSet& bgSet,
MsgStream& msg ) {
// A little sanity check:
if( ( ! menu->hasStore() ) && ( ( ! menu->container() ) ||
( ! menu->container()->hasStore() ) ) ) {
msg << MSG::FATAL << "prepareTriggerMenu(...) Received "
<< "xAOD::TriggerMenu object is not connected to an auxiliary "
<< "store" << endreq;
return StatusCode::FAILURE;
}
// Clear the current LVL1 configuration:
ctpConfig.menu().clear();
ctpConfig.clearPrescaleSets();
......@@ -66,6 +75,9 @@ namespace TrigConf {
// Clear the current HLT configuration:
chainList.clear();
// A helper variable:
bool signatureWarningPrinted = false;
// Fill the HLT configuration:
for( size_t i = 0; i < menu->chainIds().size(); ++i ) {
......@@ -84,21 +96,54 @@ namespace TrigConf {
}
// An empty signature list for the chain:
std::vector< HLTSignature* > signatures;
const std::vector< uint32_t > counters = menu->chainSignatureCounters()[ i ];
const std::vector< int > logics = menu->chainSignatureLogics()[ i ];
const std::vector< std::vector< std::string > > outputTEs = menu->chainSignatureOutputTEs()[ i ];
const std::vector< std::string > labels = menu->chainSignatureLabels()[ i ];
msg << MSG::VERBOSE << "chain has " << counters.size() << " signatures" << endreq;
for(int sig = 0; sig < counters.size(); ++sig ){
std::vector<HLTTriggerElement*> outTEs;
for(uint32_t outTEcounter = 0; outTEcounter< outputTEs[sig].size(); ++outTEcounter){
outTEs.push_back(new HLTTriggerElement(outputTEs[sig][outTEcounter]));
}
signatures.push_back(new HLTSignature(counters[sig],logics[sig],outTEs));
msg << MSG::VERBOSE << "prepared signature: " << *signatures.back() << endreq;
}
// If signature information is available, read it in:
if( menu->chainSignatureCountersAvailable() &&
menu->chainSignatureCounters().size() &&
menu->chainSignatureLogicsAvailable() &&
menu->chainSignatureLogics().size() &&
menu->chainSignatureOutputTEsAvailable() &&
menu->chainSignatureOutputTEs().size() /*&&
menu->chainSignatureLabelsAvailable() &&
menu->chainSignatureLabels().size() */) {
const std::vector< uint32_t >& counters =
menu->chainSignatureCounters()[ i ];
const std::vector< int >& logics =
menu->chainSignatureLogics()[ i ];
const std::vector< std::vector< std::string > >& outputTEs =
menu->chainSignatureOutputTEs()[ i ];
/*
const std::vector< std::string >& labels =
menu->chainSignatureLabels()[ i ];
*/
if( msg.level() <= MSG::VERBOSE ) {
msg << MSG::VERBOSE << "chain has " << counters.size()
<< " signatures" << endreq;
}
for( size_t sig = 0; sig < counters.size(); ++sig ) {
std::vector< HLTTriggerElement* > outTEs;
for( size_t outTEcounter = 0;
outTEcounter< outputTEs[ sig ].size(); ++outTEcounter ) {
HLTTriggerElement* element =
new HLTTriggerElement( outputTEs[ sig ][ outTEcounter ] );
outTEs.push_back( element );
}
HLTSignature* signature =
new HLTSignature( counters[ sig ], logics[ sig ], outTEs );
signatures.push_back( signature );
if( msg.level() <= MSG::VERBOSE ) {
msg << MSG::VERBOSE << "prepared signature: "
<< *( signatures.back() ) << endreq;
}
}
} else if( ! signatureWarningPrinted ) {
msg << MSG::WARNING << "prepareTriggerMenu(...): "
<< "HLT Signature information not available on the input"
<< endreq;
signatureWarningPrinted = true;
}
// Create the chain object:
HLTChain* chain = new HLTChain( menu->chainNames()[ i ],
......@@ -124,18 +169,30 @@ namespace TrigConf {
}
}
//Add sequence information
for(size_t i = 0; i< menu->sequenceOutputTEs().size() ; ++i){
HLTTriggerElement* outputTE = new HLTTriggerElement(menu->sequenceOutputTEs()[i]);
std::vector<HLTTriggerElement*> inputTEs;
for(size_t j = 0; j < menu->sequenceInputTEs()[i].size(); ++j){
inputTEs.push_back(new HLTTriggerElement(menu->sequenceInputTEs()[i][j]));
}
HLTSequence* sequence = new HLTSequence(inputTEs,outputTE,menu->sequenceAlgorithms()[i]);
sequenceList.addHLTSequence( sequence );
//this throws a runtime_error if it fails, which we don't need to handle,
//since this is a FATAL error anyways
// Add sequence information if it's available:
if( menu->sequenceInputTEsAvailable() &&
menu->sequenceOutputTEsAvailable() &&
menu->sequenceAlgorithmsAvailable() ) {
for( size_t i = 0; i< menu->sequenceOutputTEs().size(); ++i ) {
HLTTriggerElement* outputTE =
new HLTTriggerElement( menu->sequenceOutputTEs()[ i ] );
std::vector< HLTTriggerElement* > inputTEs;
for( size_t j = 0; j < menu->sequenceInputTEs()[ i ].size(); ++j ) {
HLTTriggerElement* te =
new HLTTriggerElement( menu->sequenceInputTEs()[ i ][ j ] );
inputTEs.push_back( te );
}
HLTSequence* sequence =
new HLTSequence( inputTEs, outputTE,
menu->sequenceAlgorithms()[ i ] );
sequenceList.addHLTSequence( sequence );
// This throws a runtime_error if it fails, which we don't need to
// handle, since this is a FATAL error anyways.
}
} else {
msg << MSG::WARNING << "prepareTriggerMenu(...): "
<< "HLT Sequence information not available on the input" << endreq;
}
// Check if bunch-groups are available:
......
......@@ -37,7 +37,7 @@ PACKAGE_TRYDEP =
PACKAGE_SCRIPTS =
# whether to use pedantic compilation:
PACKAGE_PEDANTIC = 0
PACKAGE_PEDANTIC = 1
# whether to turn *off* optimization (set to dict to do it only for
# dictionaries):
......
......@@ -2,7 +2,7 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODMenuWriter.cxx 631651 2014-11-27 18:33:16Z lheinric $
// $Id: xAODMenuWriter.cxx 648306 2015-02-19 19:44:19Z stelzer $
// Gaudi/Athena include(s):
#include "AthenaKernel/errorcheck.h"
......@@ -204,31 +204,31 @@ namespace TrigConf {
chainParentNames.push_back( ( *chain_itr )->lower_chain_name() );
chainPrescales.push_back( ( *chain_itr )->prescale() );
chainRerunPrescales.push_back(
( *chain_itr )->prescales().getRerunPrescale("").second );
( *chain_itr )->prescales().getRerunPrescale("").second );
chainPassthroughPrescales.push_back( ( *chain_itr )->pass_through() );
std::vector<uint32_t> counters;
std::vector<int> logics;
std::vector<std::vector<std::string> > outputTEs;
std::vector<uint32_t> counters;
std::vector<int> logics;
std::vector<std::vector<std::string> > outputTEs;
std::vector<std::string> labels;
ATH_MSG_VERBOSE((*chain_itr)->chain_name() << " has " << (*chain_itr)->signatureList().size() << " signatures");
for(auto& signature : (*chain_itr)->signatureList() ){
uint32_t cntr = signature->signature_counter();
counters.push_back(cntr);
logics.push_back(signature->logic());
labels.push_back(signature->label());
std::vector<std::string> outputTEids;
for(auto& outputTE : signature->outputTEs()){
outputTEids.push_back(outputTE->name());
}
outputTEs.push_back(outputTEids);
ATH_MSG_VERBOSE("converted this signature: " << *signature);
}
chainSignatureCounters.push_back(counters);
chainSignatureLogics.push_back(logics);
chainSignatureOutputTEs.push_back(outputTEs);
chainSignatureLabels.push_back(labels);
ATH_MSG_VERBOSE((*chain_itr)->chain_name() << " has " << (*chain_itr)->signatureList().size() << " signatures");
for(auto& signature : (*chain_itr)->signatureList() ){
uint32_t cntr = signature->signature_counter();
counters.push_back(cntr);
logics.push_back(signature->logic());
labels.push_back(signature->label());
std::vector<std::string> outputTEids;
for(auto& outputTE : signature->outputTEs()){
outputTEids.push_back(outputTE->name());
}
outputTEs.push_back(outputTEids);
ATH_MSG_VERBOSE("converted this signature: " << *signature);
}
chainSignatureCounters.push_back(counters);
chainSignatureLogics.push_back(logics);
chainSignatureOutputTEs.push_back(outputTEs);
chainSignatureLabels.push_back(labels);
// Some verbose information:
ATH_MSG_VERBOSE( " \"" << chainNames.back() << "\" Chain Id = "
......@@ -256,25 +256,25 @@ namespace TrigConf {
// Set its sequence information:
//
ATH_MSG_DEBUG( "Filling sequence information" );
auto sequenceList = m_trigConf->sequences();
auto& sequenceList = m_trigConf->sequences();
std::vector<std::vector<std::string> > sequenceInputTEs;
std::vector<std::string> sequenceOutputTE;
std::vector<std::vector<std::string> > sequenceAlgorithms;
for(auto& seq : sequenceList){
std::vector<std::string> inputTEs;
for(auto& input : seq->inputTEs()) inputTEs.push_back(input->name());
sequenceInputTEs.push_back(inputTEs);
sequenceAlgorithms.push_back(seq->algorithms());
sequenceOutputTE.push_back(seq->outputTE()->name());
std::vector<std::string> inputTEs;
for(auto& input : seq->inputTEs()) inputTEs.push_back(input->name());
sequenceInputTEs.push_back(inputTEs);
sequenceAlgorithms.push_back(seq->algorithms());
sequenceOutputTE.push_back(seq->outputTE()->name());
ATH_MSG_VERBOSE("original sequence: \n" << *seq);
ATH_MSG_VERBOSE("original sequence: \n" << *seq);
ATH_MSG_VERBOSE("added sequence with: ");
ATH_MSG_VERBOSE(" inputTEs: " << sequenceInputTEs.back());
ATH_MSG_VERBOSE(" algos: " << sequenceAlgorithms.back());
ATH_MSG_VERBOSE(" outputTE: " << sequenceOutputTE.back());
}
ATH_MSG_VERBOSE("added sequence with: ");
ATH_MSG_VERBOSE(" inputTEs: " << sequenceInputTEs.back());
ATH_MSG_VERBOSE(" algos: " << sequenceAlgorithms.back());
ATH_MSG_VERBOSE(" outputTE: " << sequenceOutputTE.back());
}
menu->setSequenceInputTEs(sequenceInputTEs);
menu->setSequenceOutputTEs(sequenceOutputTE);
......
......@@ -2,7 +2,7 @@
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// $Id: xAODTrigConfReadTest.cxx 613036 2014-08-22 10:59:33Z krasznaa $
// $Id: xAODTrigConfReadTest.cxx 646707 2015-02-13 09:51:38Z krasznaa $
// ROOT include(s):
#ifdef ROOTCORE
......@@ -51,7 +51,7 @@ int main( int argc, char* argv[] ) {
// Create the trigger configuration tool:
TrigConf::xAODConfigTool configTool( "xAODConfigTool" );
// configTool.setProperty( "MetaObjectName", "Bla" );
configTool.setProperty( "OutputLevel", MSG::VERBOSE );
configTool.setProperty( "OutputLevel", MSG::VERBOSE ).ignore();
if( configTool.initialize().isFailure() ) {
::Error( APP_NAME, "Couldn't initialise the trigger configuration tool" );
return 1;
......@@ -84,6 +84,10 @@ int main( int argc, char* argv[] ) {
static_cast< int >( configTool.masterKey() ),
static_cast< int >( configTool.lvl1PrescaleKey() ),
static_cast< int >( configTool.hltPrescaleKey() ) );
::Info( APP_NAME, " Number of L1 items: %i",
static_cast< int >( configTool.ctpConfig()->menu().items().size() ) );
::Info( APP_NAME, " Number of HLT chains: %i",
static_cast< int >( configTool.chains().size() ) );
}
// Give some feedback of where we are:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment