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

#include <EventQualityFilterAlg.h>

Inheritance diagram for EventQualityFilterAlg:
Collaboration diagram for EventQualityFilterAlg:

Public Member Functions

 EventQualityFilterAlg (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters:
virtual ~EventQualityFilterAlg ()
 Destructor:
virtual StatusCode initialize () override
virtual StatusCode execute () override
virtual StatusCode sysInitialize () override
 Initialization method invoked by the framework.
virtual void setFilterPassed (bool state) const
 Set the filter passed flag to the specified state.
void setFilterDescription (const std::string &descr)
 helper method to ease the setting of this filter's description in derived classes Note that this method should be called in the c-tor of derived classes
ServiceHandle< ICutFlowSvc > & cutFlowSvc ()
 return a handle to an ICutFlowSvc instance
CutIdentifier cutID ()
 return the CutIdentifier corresponding to the top-level cut of this filter algorithm
const SG::ReadHandleKey< xAOD::EventInfo > & eventInfoKey () const
 EventInfo key for use in derived classes.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
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 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

Protected Member Functions

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.

Private Types

typedef ServiceHandle< ICutFlowSvcICutFlowSvc_t
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

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

Private Attributes

BooleanProperty m_useLArError { this, "VetoLArError", true, "Veto events with a LAr error" }
 Flag to turn on/off checking of LAr calorimeter error flag.
BooleanProperty m_useTileError { this, "VetoTileError", true, "Veto events with a Tile error" }
 Flag to turn on/off checking of tile calorimter error flag.
BooleanProperty m_useSCTError { this, "VetoSCTError", true, "Veto events with an SCT error" }
 Flag to turn on/off checking of SCT error flag.
BooleanProperty m_useCoreError { this, "VetoCoreError", true, "Veto events with a Core error" }
 Flag to turn on/off checking of core error flag.
SG::ReadHandleKey< xAOD::EventInfom_eventInfo {this, "EventInfo", "EventInfo", "EventInfo key"}
 EventInfo read handle.
CutIdentifier m_cutID
 The CutIdentifier for this filter algorithm.
ICutFlowSvc_t m_cutFlowSvc
 handle to the service holding tables of cut-flows for filtering algs.
std::string m_filterDescr
 filter description: describes what this filter does.
bool m_resetSelfDescription
SG::ReadHandleKey< xAOD::EventInfom_eventInfoKey { this, "EventInfoKey", "EventInfo", "" }
DataObjIDColl m_extendedExtraObjects
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

Definition at line 24 of file EventQualityFilterAlg.h.

Member Typedef Documentation

◆ ICutFlowSvc_t

Definition at line 84 of file AthFilterAlgorithm.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ EventQualityFilterAlg()

EventQualityFilterAlg::EventQualityFilterAlg ( const std::string & name,
ISvcLocator * pSvcLocator )

Constructor with parameters:

Definition at line 30 of file EventQualityFilterAlg.cxx.

31 :
32 ::AthFilterAlgorithm( name, pSvcLocator )
33{
34}
AthFilterAlgorithm()
Default constructor:

◆ ~EventQualityFilterAlg()

EventQualityFilterAlg::~EventQualityFilterAlg ( )
virtual

Destructor:

Definition at line 39 of file EventQualityFilterAlg.cxx.

40{}

Member Function Documentation

◆ cutFlowSvc()

ServiceHandle< ICutFlowSvc > & AthFilterAlgorithm::cutFlowSvc ( )
inlineinherited

return a handle to an ICutFlowSvc instance

Definition at line 108 of file AthFilterAlgorithm.h.

109{
110 return m_cutFlowSvc;
111}
ICutFlowSvc_t m_cutFlowSvc
handle to the service holding tables of cut-flows for filtering algs.

◆ cutID()

CutIdentifier AthFilterAlgorithm::cutID ( )
inlineinherited

return the CutIdentifier corresponding to the top-level cut of this filter algorithm

Definition at line 116 of file AthFilterAlgorithm.h.

117{
118 return m_cutID;
119}
CutIdentifier m_cutID
The CutIdentifier for this filter algorithm.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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< Algorithm > >::detStore ( ) const
inlineinherited

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

Definition at line 95 of file AthCommonDataStore.h.

◆ doNotResetSelfDescription()

void AthFilterAlgorithm::doNotResetSelfDescription ( Gaudi::Details::PropertyBase & )
inlineprivateinherited

Definition at line 124 of file AthFilterAlgorithm.h.

125{
127}

◆ eventInfoKey()

const SG::ReadHandleKey< xAOD::EventInfo > & AthFilterAlgorithm::eventInfoKey ( ) const
inherited

EventInfo key for use in derived classes.

Definition at line 134 of file AthFilterAlgorithm.cxx.

135{
136 return m_eventInfoKey;
137}
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey

◆ evtStore()

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

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

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode EventQualityFilterAlg::execute ( )
overridevirtual

Definition at line 58 of file EventQualityFilterAlg.cxx.

59{
60 ATH_MSG_DEBUG ("Executing " << name() << "...");
61
62 const EventContext& ctx = Gaudi::Hive::currentContext();
63
64 // Get the EventInfo object
65 SG::ReadHandle<xAOD::EventInfo> eventInfo(m_eventInfo, ctx);
66 if (!eventInfo.isValid()) {
67 ATH_MSG_ERROR("Could not retrieve EventInfo!");
68 return StatusCode::FAILURE;
69 }
70
71
72
73 // Only do the event vetoing on data
74 const bool isSim = eventInfo->eventType(xAOD::EventInfo::EventType::IS_SIMULATION);
75 if ( isSim ) {
76 ATH_MSG_DEBUG ("It is an MC event... not vetoing...");
77 this->setFilterPassed(true);
78 return StatusCode::SUCCESS;
79 }
80
81
82 // Now make the event decision
83 bool passEvent(true);
84 if ( m_useLArError.value() && eventInfo->errorState(xAOD::EventInfo::LAr) == xAOD::EventInfo::Error ){ passEvent = false; }
85 if ( m_useTileError.value() && eventInfo->errorState(xAOD::EventInfo::Tile) == xAOD::EventInfo::Error ){ passEvent = false; }
86 if ( m_useSCTError.value() && eventInfo->errorState(xAOD::EventInfo::SCT) == xAOD::EventInfo::Error ){ passEvent = false; }
87 if ( m_useCoreError.value() && eventInfo->isEventFlagBitSet(xAOD::EventInfo::Core, 18) ){ passEvent = false; }
88
89 // Set the final decision
90 this->setFilterPassed(passEvent);
91
92 return StatusCode::SUCCESS;
93}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
virtual void setFilterPassed(bool state) const
Set the filter passed flag to the specified state.
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo
EventInfo read handle.
BooleanProperty m_useSCTError
Flag to turn on/off checking of SCT error flag.
BooleanProperty m_useCoreError
Flag to turn on/off checking of core error flag.
BooleanProperty m_useLArError
Flag to turn on/off checking of LAr calorimeter error flag.
BooleanProperty m_useTileError
Flag to turn on/off checking of tile calorimter error flag.
@ Tile
The Tile calorimeter.
@ Core
Core flags describing the event.
@ LAr
The LAr calorimeter.
@ Error
The sub-detector issued an error.
@ IS_SIMULATION
true: simulation, false: data

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ initialize()

StatusCode EventQualityFilterAlg::initialize ( )
overridevirtual

Definition at line 45 of file EventQualityFilterAlg.cxx.

46{
47 ATH_MSG_DEBUG ("Initializing " << name() << "...");
48 ATH_MSG_DEBUG( "Using: " << m_useLArError );
49 ATH_MSG_DEBUG( "Using: " << m_useTileError );
50 ATH_MSG_DEBUG( "Using: " << m_useSCTError );
51 ATH_MSG_DEBUG( "Using: " << m_useCoreError );
52 // ATH_MSG_DEBUG( "Using: " << m_useTileTripReader );
53 ATH_CHECK(m_eventInfo.initialize());
54 return StatusCode::SUCCESS;
55}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Algorithm >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ setFilterDescription()

void AthFilterAlgorithm::setFilterDescription ( const std::string & descr)
inherited

helper method to ease the setting of this filter's description in derived classes Note that this method should be called in the c-tor of derived classes

helper function to ease the setting of this filter's description in derived classes

Definition at line 118 of file AthFilterAlgorithm.cxx.

119{
120 if( cutFlowSvc()==0 ){
122 }
123 else if( m_resetSelfDescription and cutID() ){
124 cutFlowSvc()->setFilterDescription(cutID(),descr);
125 }
126 else{
127 ATH_MSG_INFO("problem setting filter description with cutflow-svc");
128 }
129
130 return;
131}
#define ATH_MSG_INFO(x)
ServiceHandle< ICutFlowSvc > & cutFlowSvc()
return a handle to an ICutFlowSvc instance
CutIdentifier cutID()
return the CutIdentifier corresponding to the top-level cut of this filter algorithm
std::string m_filterDescr
filter description: describes what this filter does.
list descr
print "%s.properties()" % self.__name__

◆ setFilterPassed()

void AthFilterAlgorithm::setFilterPassed ( bool state) const
virtualinherited

Set the filter passed flag to the specified state.

Definition at line 99 of file AthFilterAlgorithm.cxx.

100{
101 AthAlgorithm::setFilterPassed(state);
102
103 if (state) {
104 const EventContext& ctx = Gaudi::Hive::currentContext();
105 SG::ReadHandle<xAOD::EventInfo> evtInfo (m_eventInfoKey, ctx);
106 // Only try to access the mcEventWeight if we are running on Monte Carlo, duhhh!
107 if ( evtInfo->eventType(xAOD::EventInfo::IS_SIMULATION) ) {
108 m_cutFlowSvc->addEvent(m_cutID, evtInfo->mcEventWeights());
109 } else {
110 m_cutFlowSvc->addEvent(m_cutID, 1.0);
111 }
112 }
113}

◆ sysInitialize()

StatusCode AthFilterAlgorithm::sysInitialize ( )
overridevirtualinherited

Initialization method invoked by the framework.

This method is responsible for any bookkeeping of initialization required by the framework itself. It will in turn invoke the initialize() method of the derived algorithm, and of any sub-algorithms which it creates.

Reimplemented from AthAlgorithm.

Definition at line 65 of file AthFilterAlgorithm.cxx.

66{
67 // ---- stolen from GaudiKernel/Algorithm::sysInitialize -------
68 // Bypass the initialization if the algorithm
69 // has already been initialized.
70 if ( Gaudi::StateMachine::INITIALIZED <= FSMState() ) return StatusCode::SUCCESS;
71
72 // Set the Algorithm's properties
73 bindPropertiesTo( serviceLocator()->getOptsSvc() );
74
75 // Bypass the initialization if the algorithm is disabled.
76 // Need to do this after bindPropertiesTo.
77 if ( !isEnabled( ) ) return StatusCode::SUCCESS;
78
79 // ---- stolen from GaudiKernel/Algorithm::sysInitialize ------- END ---
80
81 // register ourselves with the cutFlowSvc
82 if ( cutFlowSvc().retrieve().isSuccess()) {
83 m_cutID = cutFlowSvc()->registerFilter(this->name(), m_filterDescr, false);
84 if (0 == m_cutID) {
85 ATH_MSG_INFO("problem registering myself with cutflow-svc");
86 } else {
87 ATH_MSG_VERBOSE("registered with cutflow-svc");
88 }
89 }
90
91 ATH_CHECK( m_eventInfoKey.initialize() );
92
93 // re-direct to base class...
95}
#define ATH_MSG_VERBOSE(x)
virtual StatusCode sysInitialize() override
Override sysInitialize.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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_cutFlowSvc

ICutFlowSvc_t AthFilterAlgorithm::m_cutFlowSvc
privateinherited

handle to the service holding tables of cut-flows for filtering algs.

Definition at line 86 of file AthFilterAlgorithm.h.

◆ m_cutID

CutIdentifier AthFilterAlgorithm::m_cutID
privateinherited

The CutIdentifier for this filter algorithm.

Definition at line 82 of file AthFilterAlgorithm.h.

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_eventInfo

SG::ReadHandleKey<xAOD::EventInfo> EventQualityFilterAlg::m_eventInfo {this, "EventInfo", "EventInfo", "EventInfo key"}
private

EventInfo read handle.

Definition at line 66 of file EventQualityFilterAlg.h.

66{this, "EventInfo", "EventInfo", "EventInfo key"};

◆ m_eventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> AthFilterAlgorithm::m_eventInfoKey { this, "EventInfoKey", "EventInfo", "" }
privateinherited

Definition at line 96 of file AthFilterAlgorithm.h.

97{ this, "EventInfoKey", "EventInfo", "" };

◆ m_evtStore

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

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_filterDescr

std::string AthFilterAlgorithm::m_filterDescr
privateinherited

filter description: describes what this filter does.

this is usually pushed to the ICutFlowSvc

Definition at line 90 of file AthFilterAlgorithm.h.

◆ m_resetSelfDescription

bool AthFilterAlgorithm::m_resetSelfDescription
privateinherited

Definition at line 93 of file AthFilterAlgorithm.h.

◆ m_useCoreError

BooleanProperty EventQualityFilterAlg::m_useCoreError { this, "VetoCoreError", true, "Veto events with a Core error" }
private

Flag to turn on/off checking of core error flag.

Definition at line 59 of file EventQualityFilterAlg.h.

59{ this, "VetoCoreError", true, "Veto events with a Core error" };

◆ m_useLArError

BooleanProperty EventQualityFilterAlg::m_useLArError { this, "VetoLArError", true, "Veto events with a LAr error" }
private

Flag to turn on/off checking of LAr calorimeter error flag.

Definition at line 50 of file EventQualityFilterAlg.h.

50{ this, "VetoLArError", true, "Veto events with a LAr error" };

◆ m_useSCTError

BooleanProperty EventQualityFilterAlg::m_useSCTError { this, "VetoSCTError", true, "Veto events with an SCT error" }
private

Flag to turn on/off checking of SCT error flag.

Definition at line 56 of file EventQualityFilterAlg.h.

56{ this, "VetoSCTError", true, "Veto events with an SCT error" };

◆ m_useTileError

BooleanProperty EventQualityFilterAlg::m_useTileError { this, "VetoTileError", true, "Veto events with a Tile error" }
private

Flag to turn on/off checking of tile calorimter error flag.

Definition at line 53 of file EventQualityFilterAlg.h.

53{ this, "VetoTileError", true, "Veto events with a Tile error" };

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

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

Definition at line 398 of file AthCommonDataStore.h.


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