ATLAS Offline Software
Loading...
Searching...
No Matches
CTPUnpackingEmulationTool Class Reference

#include <CTPUnpackingEmulationTool.h>

Inheritance diagram for CTPUnpackingEmulationTool:
Collaboration diagram for CTPUnpackingEmulationTool:

Public Member Functions

 CTPUnpackingEmulationTool (const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode decode (const EventContext &ctx, const ROIB::RoIBResult &roib, HLT::IDVec &enabledChains) const override
virtual StatusCode initialize () override
virtual bool isEmulated () const override
virtual StatusCode passBeforePrescaleSelection (const ROIB::RoIBResult *, const std::vector< std::string > &, bool &) const override

Protected Attributes

std::unordered_map< int, HLT::IDVecm_ctpToChain
Gaudi::Property< bool > m_forceEnable
ToolHandle< GenericMonitoringToolm_monTool {this, "MonTool", "", "Monitoring tool"}

Static Protected Attributes

static constexpr int s_CTPIDForUnseededChains = -1

Private Member Functions

StatusCode parseInputFile ()
 Fill the m_events vector with configuration from an input file.

Private Attributes

Gaudi::Property< std::string > m_inputFileName
std::vector< HLT::IDVecm_events
 Chain IDs (inner vector) to activate for each event (outer vector)

Detailed Description

Definition at line 12 of file CTPUnpackingEmulationTool.h.

Constructor & Destructor Documentation

◆ CTPUnpackingEmulationTool()

CTPUnpackingEmulationTool::CTPUnpackingEmulationTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 13 of file CTPUnpackingEmulationTool.cxx.

16 : CTPUnpackingToolBase( type, name, parent ) {}
CTPUnpackingToolBase(const std::string &type, const std::string &name, const IInterface *parent)

Member Function Documentation

◆ decode()

StatusCode CTPUnpackingEmulationTool::decode ( const EventContext & ctx,
const ROIB::RoIBResult & roib,
HLT::IDVec & enabledChains ) const
overridevirtual

Reimplemented from CTPUnpackingToolBase.

Definition at line 56 of file CTPUnpackingEmulationTool.cxx.

58 {
59 if ( m_events.empty() ){
60 ATH_MSG_ERROR( "No chain set found. Cannot decode CTP emulation" );
61 return StatusCode::FAILURE;
62 }
63
64 size_t line = ctx.evt() % m_events.size();
65 enabledChains = m_events[line];
66
67 return StatusCode::SUCCESS;
68}
#define ATH_MSG_ERROR(x)
std::vector< HLT::IDVec > m_events
Chain IDs (inner vector) to activate for each event (outer vector)

◆ initialize()

StatusCode CTPUnpackingEmulationTool::initialize ( )
overridevirtual

Reimplemented from CTPUnpackingToolBase.

Definition at line 50 of file CTPUnpackingEmulationTool.cxx.

50 {
52 return parseInputFile();
53}
#define ATH_CHECK
Evaluate an expression and check for errors.
StatusCode parseInputFile()
Fill the m_events vector with configuration from an input file.
virtual StatusCode initialize() override

◆ isEmulated()

virtual bool CTPUnpackingEmulationTool::isEmulated ( ) const
inlineoverridevirtual

Reimplemented from CTPUnpackingToolBase.

Definition at line 24 of file CTPUnpackingEmulationTool.h.

24{return true;}

◆ parseInputFile()

StatusCode CTPUnpackingEmulationTool::parseInputFile ( )
private

Fill the m_events vector with configuration from an input file.

Definition at line 19 of file CTPUnpackingEmulationTool.cxx.

19 {
20 std::ifstream inputFile( m_inputFileName );
21 if ( not inputFile.good() ) {
22 ATH_MSG_ERROR( "Input file " << m_inputFileName << " inaccessible" );
23 return StatusCode::FAILURE;
24 }
25
26 std::string line;
27 while ( std::getline( inputFile, line ) ) {
28 if ( line[0] == '#' ) {continue;}
29 std::istringstream allChains( line );
31 while ( allChains ) {
32 std::string chainName;
33 allChains >> chainName;
34 if ( not chainName.empty() ) {
35 ids.push_back( HLT::Identifier( chainName ).numeric() );
36 }
37 }
38
39 if ( not ids.empty() ) {
40 m_events.push_back( std::move(ids) ); // new event
41 }
42 }
43 inputFile.close();
44
45 ATH_MSG_DEBUG( "In input file "<<m_inputFileName.value()<<" found "<<m_events.size()<<" chain sets" );
46 return StatusCode::SUCCESS;
47}
#define ATH_MSG_DEBUG(x)
Gaudi::Property< std::string > m_inputFileName
std::vector< HLT::Identifier > IDVec

◆ passBeforePrescaleSelection()

StatusCode CTPUnpackingToolBase::passBeforePrescaleSelection ( const ROIB::RoIBResult * ,
const std::vector< std::string > & ,
bool &  ) const
overridevirtualinherited

Reimplemented in CTPUnpackingTool.

Definition at line 24 of file CTPUnpackingToolBase.cxx.

26 {
27 ATH_MSG_ERROR("Base class should not call this function");
28 return StatusCode::FAILURE;
29}

Member Data Documentation

◆ m_ctpToChain

std::unordered_map<int, HLT::IDVec> CTPUnpackingToolBase::m_ctpToChain
protectedinherited

Definition at line 46 of file CTPUnpackingToolBase.h.

◆ m_events

std::vector<HLT::IDVec> CTPUnpackingEmulationTool::m_events
private

Chain IDs (inner vector) to activate for each event (outer vector)

Definition at line 32 of file CTPUnpackingEmulationTool.h.

◆ m_forceEnable

Gaudi::Property<bool> CTPUnpackingToolBase::m_forceEnable
protectedinherited
Initial value:
{
this, "ForceEnableAllChains", false, "Enables all chains in each event, testing mode"}

Definition at line 48 of file CTPUnpackingToolBase.h.

48 {
49 this, "ForceEnableAllChains", false, "Enables all chains in each event, testing mode"};

◆ m_inputFileName

Gaudi::Property<std::string> CTPUnpackingEmulationTool::m_inputFileName
private
Initial value:
{
this, "InputFilename", "CTPEmulation.dat", "Fake CTP RoIB input filename"}

Definition at line 28 of file CTPUnpackingEmulationTool.h.

28 {
29 this, "InputFilename", "CTPEmulation.dat", "Fake CTP RoIB input filename"};

◆ m_monTool

ToolHandle<GenericMonitoringTool> CTPUnpackingToolBase::m_monTool {this, "MonTool", "", "Monitoring tool"}
protectedinherited

Definition at line 51 of file CTPUnpackingToolBase.h.

51{this, "MonTool", "", "Monitoring tool"};

◆ s_CTPIDForUnseededChains

int CTPUnpackingToolBase::s_CTPIDForUnseededChains = -1
staticconstexprprotectedinherited

Definition at line 45 of file CTPUnpackingToolBase.h.


The documentation for this class was generated from the following files: