ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::AnyVertexSkimmingTool Class Reference

#include <AnyVertexSkimmingTool.h>

Inheritance diagram for DerivationFramework::AnyVertexSkimmingTool:
Collaboration diagram for DerivationFramework::AnyVertexSkimmingTool:

Public Member Functions

 AnyVertexSkimmingTool (const std::string &, const std::string &, const IInterface *)
StatusCode initialize () override
virtual bool eventPassesFilter () const override
 ~AnyVertexSkimmingTool ()

Private Attributes

Gaudi::Property< std::vector< std::string > > m_containerNames { this, "VertexContainerNames", {} }
SG::ReadHandleKeyArray< xAOD::VertexContainerm_keyArray {this, "ReadHandles", {} }
Gaudi::Property< bool > m_useHandles { this, "UseHandles", false }

Detailed Description

Definition at line 15 of file AnyVertexSkimmingTool.h.

Constructor & Destructor Documentation

◆ AnyVertexSkimmingTool()

DerivationFramework::AnyVertexSkimmingTool::AnyVertexSkimmingTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 11 of file AnyVertexSkimmingTool.cxx.

11 : base_class(t,n,p)
12{}

◆ ~AnyVertexSkimmingTool()

DerivationFramework::AnyVertexSkimmingTool::~AnyVertexSkimmingTool ( )
default

Member Function Documentation

◆ eventPassesFilter()

bool DerivationFramework::AnyVertexSkimmingTool::eventPassesFilter ( ) const
overridevirtual

Definition at line 22 of file AnyVertexSkimmingTool.cxx.

22 {
23
24 if(m_useHandles){
25 bool pass = false;
26 for(auto key : m_keyArray){
27 ATH_MSG_DEBUG("Key Checking: " << key.key());
28 SG::ReadHandle<xAOD::VertexContainer> read(key);
29 if(!read.isValid()){
30 std::string error("AnyVertexSkimmingTool - Failed to retrieve : ");
31 error += key.key();
32 throw std::runtime_error(error);
33 }
34 if(not read->empty()) pass |= true;
35 }
36 return pass;
37 }else{
38 bool pass = false;
39 for(const std::string& name : m_containerNames){
40 ATH_MSG_DEBUG("Checking: " << name);
41 const xAOD::VertexContainer* container = nullptr;
42 if(evtStore()->retrieve(container, name).isFailure()){
43 std::string error("AnyVertexSkimmingTool - Failed to retrieve : ");
44 error += name;
45 throw std::runtime_error(error);
46 }
47 if(not container->empty()) pass |= true;
48 //Not breaking from loop early to ensure all containers are written - avoids production bugs
49 }
50 return pass;
51 }
52}
#define ATH_MSG_DEBUG(x)
bool empty() const noexcept
Returns true if the collection is empty.
SG::ReadHandleKeyArray< xAOD::VertexContainer > m_keyArray
Gaudi::Property< std::vector< std::string > > m_containerNames
retrieve(aClass, aKey=None)
Definition PyKernel.py:110
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)

◆ initialize()

StatusCode DerivationFramework::AnyVertexSkimmingTool::initialize ( )
override

Definition at line 16 of file AnyVertexSkimmingTool.cxx.

16 {
17 if(m_useHandles) for(const auto& str : m_containerNames) m_keyArray.emplace_back(str);
19 return StatusCode::SUCCESS;
20}
#define ATH_CHECK
Evaluate an expression and check for errors.

Member Data Documentation

◆ m_containerNames

Gaudi::Property<std::vector<std::string> > DerivationFramework::AnyVertexSkimmingTool::m_containerNames { this, "VertexContainerNames", {} }
private

Definition at line 22 of file AnyVertexSkimmingTool.h.

22{ this, "VertexContainerNames", {} };

◆ m_keyArray

SG::ReadHandleKeyArray<xAOD::VertexContainer> DerivationFramework::AnyVertexSkimmingTool::m_keyArray {this, "ReadHandles", {} }
private

Definition at line 23 of file AnyVertexSkimmingTool.h.

23{this, "ReadHandles", {} };

◆ m_useHandles

Gaudi::Property<bool> DerivationFramework::AnyVertexSkimmingTool::m_useHandles { this, "UseHandles", false }
private

Definition at line 24 of file AnyVertexSkimmingTool.h.

24{ this, "UseHandles", false };

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