ATLAS Offline Software
Loading...
Searching...
No Matches
PEBInfoWriterToolBase Class Referenceabstract

Base class for tools used by PEBInfoWriterAlg. More...

#include <PEBInfoWriterToolBase.h>

Inheritance diagram for PEBInfoWriterToolBase:
Collaboration diagram for PEBInfoWriterToolBase:

Classes

struct  Input
 Input to the tool's decide method. More...
struct  PEBInfo
 Structure holding the list of ROBs and SubDets. More...

Public Member Functions

 PEBInfoWriterToolBase (const std::string &type, const std::string &name, const IInterface *parent)
 Standard constructor.
virtual ~PEBInfoWriterToolBase ()
 Standard destructor.
StatusCode decide (const EventContext &ctx, std::vector< Input > &inputs) const
 Adds a pass-through decision with attached PEB information created by createPEBInfo for each input.
HLT::Identifier id () const
 Returns the decision id.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static std::string robListKey ()
 Returns the key used to record/retrieve the ROB list.
static std::string subDetListKey ()
 Returns the key used to record/retrieve the SubDet list.

Protected Member Functions

virtual PEBInfo createPEBInfo (const EventContext &ctx, const Input &input) const =0
 Creates the PEBInfo which is attached to the decision in decide. Has to be implemented by the derived class.
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Protected Attributes

Gaudi::Property< int > m_maxRoIs
 MaxRoIs property.
Gaudi::Property< std::vector< unsigned int > > m_matchTriggerType

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

HLT::Identifier m_decisionId
 The decision id of the tool instance.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Base class for tools used by PEBInfoWriterAlg.

Derived classes have to implement createPEBInfo, which is used in decide

Definition at line 21 of file PEBInfoWriterToolBase.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ PEBInfoWriterToolBase()

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

Standard constructor.

Definition at line 20 of file PEBInfoWriterToolBase.cxx.

21: AthAlgTool(type,name,parent),
AthAlgTool()
Default constructor:
static HLT::Identifier fromToolName(const std::string &tname)
HLT::Identifier m_decisionId
The decision id of the tool instance.

◆ ~PEBInfoWriterToolBase()

PEBInfoWriterToolBase::~PEBInfoWriterToolBase ( )
virtual

Standard destructor.

Definition at line 26 of file PEBInfoWriterToolBase.cxx.

26{}

Member Function Documentation

◆ createPEBInfo()

virtual PEBInfo PEBInfoWriterToolBase::createPEBInfo ( const EventContext & ctx,
const Input & input ) const
protectedpure virtual

Creates the PEBInfo which is attached to the decision in decide. Has to be implemented by the derived class.

Implemented in RoIPEBInfoWriterTool, and StaticPEBInfoWriterTool.

◆ decide()

StatusCode PEBInfoWriterToolBase::decide ( const EventContext & ctx,
std::vector< Input > & inputs ) const

Adds a pass-through decision with attached PEB information created by createPEBInfo for each input.

Definition at line 30 of file PEBInfoWriterToolBase.cxx.

30 {
31 std::set<ElementLink<TrigRoiDescriptorCollection>> uniqueRoIs;
32 for (Input& input : inputs) {
33 // Skip if previous step for this chain didn't pass
34 if (not TrigCompositeUtils::passed(m_decisionId.numeric(), input.previousDecisionIDs)) {
35 ATH_MSG_DEBUG("Skipping chain because previous step didn't pass");
36 continue;
37 }
38
39 if (!m_matchTriggerType.empty()) {
40 if (std::none_of(
41 m_matchTriggerType.begin(),
43 [&input](uint8_t test_tt) { return (test_tt & input.tt) == test_tt; }
44 )){
45 continue;
46 }
47 }
48
49 // Count unique RoIs
50 bool isUnique = uniqueRoIs.insert(input.roiEL).second;
51 ATH_MSG_DEBUG("RoI eta/phi = " << (*input.roiEL)->eta() << "/" << (*input.roiEL)->phi() << " has "
52 << (isUnique ? "not yet" : "already") << " been processed. So far seen "
53 << uniqueRoIs.size() << " unique RoIs including this one");
54
55 // Skip processing if max RoIs limit reached
56 bool maxRoIsReached{false};
57 if (m_maxRoIs>=0 && static_cast<int>(uniqueRoIs.size()) > m_maxRoIs) {
58 ATH_MSG_DEBUG("Will attach empty PEB Info to this decision because the number of "
59 << "processed RoIs reached MaxRoIs (" << m_maxRoIs.value() << ")");
60 maxRoIsReached = true;
61 }
62
63 // Create new PEB Info for this input (empty if max RoIs limit is reached)
64 PEBInfo pebInfo = maxRoIsReached ? PEBInfo{} : createPEBInfo(ctx, input);
65
66 // Merge with previous ROBs
67 std::vector<uint32_t> previousRobs;
68 ATH_CHECK(input.decision->getDetail(robListKey(), previousRobs));
69 pebInfo.robs.insert(previousRobs.begin(), previousRobs.end());
70
71 // Merge with previous SubDets
72 std::vector<uint32_t> previousSubDets;
73 ATH_CHECK(input.decision->getDetail(subDetListKey(), previousSubDets));
74 pebInfo.subdets.insert(previousSubDets.begin(), previousSubDets.end());
75
76 // Attach the PEB Info to the decision
77 std::vector<uint32_t> robVec(pebInfo.robs.begin(), pebInfo.robs.end());
78 if (not input.decision->setDetail(robListKey(), robVec)) {
79 ATH_MSG_ERROR("Failed to attach the detail " << robListKey() << " to the decision");
80 return StatusCode::FAILURE;
81 }
82 std::vector<uint32_t> subDetVec(pebInfo.subdets.begin(), pebInfo.subdets.end());
83 if (not input.decision->setDetail(subDetListKey(), subDetVec)) {
84 ATH_MSG_ERROR("Failed to attach the detail " << subDetListKey() << " to the decision");
85 return StatusCode::FAILURE;
86 }
87
88 ATH_MSG_DEBUG("Attached PEB Info with " << robVec.size() << " ROBs and "
89 << subDetVec.size() << " SubDets to the decision object.");
90 ATH_MSG_DEBUG("PEBInfo: " << pebInfo);
91
92 // Make an accept decision
94 }
95 return StatusCode::SUCCESS;
96}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
virtual PEBInfo createPEBInfo(const EventContext &ctx, const Input &input) const =0
Creates the PEBInfo which is attached to the decision in decide. Has to be implemented by the derived...
Gaudi::Property< std::vector< unsigned int > > m_matchTriggerType
static std::string robListKey()
Returns the key used to record/retrieve the ROB list.
static std::string subDetListKey()
Returns the key used to record/retrieve the SubDet list.
Gaudi::Property< int > m_maxRoIs
MaxRoIs property.
bool uniqueRoIs(const std::vector< LinkInfo< xAOD::IParticleContainer > > &links)
Helper function that returns true if no objects share a final RoI.
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
void addDecisionID(DecisionID id, Decision *d)
Appends the decision (given as ID) to the decision object.
Input to the tool's decide method.
Structure holding the list of ROBs and SubDets.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ id()

HLT::Identifier PEBInfoWriterToolBase::id ( ) const
inline

Returns the decision id.

Definition at line 59 of file PEBInfoWriterToolBase.h.

59{return m_decisionId;}

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ robListKey()

std::string PEBInfoWriterToolBase::robListKey ( )
inlinestatic

Returns the key used to record/retrieve the ROB list.

Definition at line 61 of file PEBInfoWriterToolBase.h.

61{return "PEBROBList";}

◆ subDetListKey()

std::string PEBInfoWriterToolBase::subDetListKey ( )
inlinestatic

Returns the key used to record/retrieve the SubDet list.

Definition at line 63 of file PEBInfoWriterToolBase.h.

63{return "PEBSubDetList";}

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_decisionId

HLT::Identifier PEBInfoWriterToolBase::m_decisionId
private

The decision id of the tool instance.

Definition at line 79 of file PEBInfoWriterToolBase.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_matchTriggerType

Gaudi::Property<std::vector<unsigned int> > PEBInfoWriterToolBase::m_matchTriggerType
protected
Initial value:
{
this, "MatchTriggerType", {}, "L1 trigger type to match"
}

Definition at line 73 of file PEBInfoWriterToolBase.h.

73 {
74 this, "MatchTriggerType", {}, "L1 trigger type to match"
75 };

◆ m_maxRoIs

Gaudi::Property<int> PEBInfoWriterToolBase::m_maxRoIs
protected
Initial value:
{
this, "MaxRoIs", -1, "Create PEB list only for the first N RoIs from input decisions (<0 means no limit)"
}

MaxRoIs property.

Definition at line 69 of file PEBInfoWriterToolBase.h.

69 {
70 this, "MaxRoIs", -1, "Create PEB list only for the first N RoIs from input decisions (<0 means no limit)"
71 };

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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