Skip to content
Snippets Groups Projects
Commit a2bda0cd authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'bits-maker' into 'master'

Bits maker

See merge request atlas/athena!14853
parents a6dfc549 4357d33f
No related merge requests found
......@@ -64,7 +64,12 @@ StatusCode DecisionSummaryMakerAlg::execute_r(const EventContext& context) const
sum.begin(), sum.end() );
}
ATH_MSG_DEBUG( "Number of positive decisions " << TrigCompositeUtils::decisionIDs( output ).size() );
if ( msgLvl( MSG::DEBUG ) ) {
ATH_MSG_DEBUG( "Number of positive decisions " << TrigCompositeUtils::decisionIDs( output ).size() << " passing chains");
for ( auto d: TrigCompositeUtils::decisionIDs( output ) ) {
ATH_MSG_DEBUG( HLT::Identifier( d ) );
}
}
ATH_CHECK( outputHandle.record( std::move( container), std::move( aux )) );
return StatusCode::SUCCESS;
......
......@@ -38,7 +38,8 @@ StatusCode HLTResultMTMakerAlg::execute_r(const EventContext& context) const {
if ( iter != hltResult->getSerialisedData().end() )
sizeMain = double(iter->second.size()*sizeof(uint32_t))/1024;
MonitoredScope::declare( m_monTool, time, nstreams, nfrags, sizeMain );
auto bitWords = MonitoredScalar::declare( "bitWords", hltResult->getHltBits().size() );
MonitoredScope::declare( m_monTool, time, nstreams, nfrags, sizeMain, bitWords );
auto hltResultHandle = SG::makeHandle( m_resultKey, context );
......
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#include "DecisionHandling/HLTIdentifier.h"
#include "TriggerBitsMakerTool.h"
TriggerBitsMakerTool::TriggerBitsMakerTool(const std::string& type, const std::string& name, const IInterface* parent) :
base_class(type, name, parent){}
TriggerBitsMakerTool::~TriggerBitsMakerTool() {}
StatusCode TriggerBitsMakerTool::initialize() {
ATH_CHECK( m_finalChainDecisions.initialize() );
for ( auto& chainAndBit: m_chainToStreamProperty ) {
struct { std::string chain; int bit; } conf { chainAndBit.first, chainAndBit.second };
ATH_MSG_DEBUG( "Chain " << conf.chain << " will flip " << conf.bit << " bit" );
m_mapping[ HLT::Identifier( conf.chain ) ] = conf.bit;
}
return StatusCode::SUCCESS;
}
StatusCode TriggerBitsMakerTool::fill( HLT::HLTResultMT& resultToFill ) const {
auto chainsHandle = SG::makeHandle( m_finalChainDecisions );
std::vector<uint32_t> bits;
for ( TrigCompositeUtils::DecisionID chain: TrigCompositeUtils::decisionIDs( chainsHandle->at( 0 )) ) {
auto mappingIter = m_mapping.find( chain );
// each chain has to have stream
if( mappingIter == m_mapping.end() ) {
ATH_MSG_ERROR("Each chain has to have the bit/counter associated whereas the " << HLT::Identifier( chain ) << " does not" );
return StatusCode::FAILURE;
}
const int chainBitPosition = mappingIter->second;
// obtain bit position
const int word = chainBitPosition / ( sizeof(uint32_t) * 8 );
const int mask = 1 << (chainBitPosition % ( sizeof(uint32_t) * 8 ) );
bits.resize( word+1 ); // assure space
bits[word] |= mask;
}
resultToFill.setHltBits( bits );
if ( msgLvl( MSG::DEBUG ) ) {
ATH_MSG_DEBUG("Prepared " << bits.size() << " words with trigger bits");
for ( auto w: bits )
ATH_MSG_DEBUG("0x" << MSG::hex << w );
}
return StatusCode::SUCCESS;
}
StatusCode TriggerBitsMakerTool::finalize() {
return StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRIGOUTPUTHANDLING_TRIGGERBITSMAKERTOOL_H
#define TRIGOUTPUTHANDLING_TRIGGERBITSMAKERTOOL_H
#include <string>
#include "DecisionHandling/TrigCompositeUtils.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "TrigOutputHandling/HLTResultMTMakerTool.h"
/**
* @class TriggerBitsMakerTool
* @brief fills trigger bits in the HLTResultMT object
**/
class TriggerBitsMakerTool : public extends<AthAlgTool, HLTResultMTMakerTool> {
public:
TriggerBitsMakerTool(const std::string& type, const std::string& name, const IInterface* parent);
virtual ~TriggerBitsMakerTool() override;
virtual StatusCode fill( HLT::HLTResultMT& resultToFill ) const override;
virtual StatusCode initialize() override;
virtual StatusCode finalize() override;
private:
SG::ReadHandleKey<TrigCompositeUtils::DecisionContainer> m_finalChainDecisions { this, "ChainDecisions", "UNDEFINED", "Container with final chain decisions" };
Gaudi::Property<std::map<std::string, int>> m_chainToStreamProperty { this, "ChainToBit", {}, "Mapping from the chain name to bit position in trigger bits array"};
typedef std::map< TrigCompositeUtils::DecisionID, int> ChainToBitMap;
ChainToBitMap m_mapping;
};
#endif // TRIGOUTPUTHANDLING_TRIGGERBITSMAKERTOOL_H
......@@ -3,10 +3,12 @@
#include "../StreamTagMakerTool.h"
#include "../HLTResultMTMakerAlg.h"
#include "../DecisionSummaryMakerAlg.h"
#include "../TriggerBitsMakerTool.h"
DECLARE_COMPONENT( HLTResultCreatorByteStream )
DECLARE_COMPONENT( HLTEDMCreator )
DECLARE_COMPONENT( HLTResultMTMakerAlg )
DECLARE_COMPONENT( StreamTagMakerTool )
DECLARE_COMPONENT( DecisionSummaryMakerAlg )
DECLARE_COMPONENT( TriggerBitsMakerTool )
......@@ -343,7 +343,7 @@ StreamESD.ItemList += [ "ROIB::RoIBResult#*" ]
print "ESD file content "
print StreamESD.ItemList
from TrigOutputHandling.TrigOutputHandlingConf import DecisionSummaryMakerAlg, HLTResultMTMakerAlg, StreamTagMakerTool
from TrigOutputHandling.TrigOutputHandlingConf import DecisionSummaryMakerAlg, HLTResultMTMakerAlg, StreamTagMakerTool, TriggerBitsMakerTool
summMaker = DecisionSummaryMakerAlg()
summMaker.FinalDecisionKeys = [ theElectronHypo.HypoOutputDecisions ]
summMaker.FinalStepDecisions = dict( [ ( tool.getName(), theElectronHypo.HypoOutputDecisions ) for tool in theElectronHypo.HypoTools ] )
......@@ -358,8 +358,13 @@ stmaker.OutputLevel = DEBUG
stmaker.ChainDecisions = "HLTFinalDecisions"
stmaker.ChainToStream = dict( [(c, "Main") for c in testChains ] )
stmaker.ChainToStream["HLT_e5_etcut"] = "PhotonPerf" # just made up the name
bitsmaker = TriggerBitsMakerTool()
bitsmaker.ChainDecisions = "HLTFinalDecisions"
bitsmaker.ChainToBit = dict( [ (chain, 10*num) for num,chain in enumerate(testChains) ] )
bitsmaker.OutputLevel = DEBUG
hltResultMaker = HLTResultMTMakerAlg()
hltResultMaker.MakerTools = [ stmaker ]
hltResultMaker.MakerTools = [ stmaker, bitsmaker ]
hltResultMaker.OutputLevel = DEBUG
from AthenaMonitoring.GenericMonitoringTool import GenericMonitoringTool, defineHistogram
......@@ -376,6 +381,8 @@ hltResultMaker.MonTool.Histograms = [ defineHistogram( 'TIME_build', path='EXPER
################################################################################
# assemble top list of algorithms
......
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