ATLAS Offline Software
Loading...
Searching...
No Matches
AnyVertexSkimmingTool.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
7#include "Gaudi/Property.h"
8namespace DerivationFramework {
9
10
11AnyVertexSkimmingTool::AnyVertexSkimmingTool(const std::string& t, const std::string& n, const IInterface* p) : base_class(t,n,p)
12{}
13
15
17 if(m_useHandles) for(const auto& str : m_containerNames) m_keyArray.emplace_back(str);
19 return StatusCode::SUCCESS;
20}
21
23
24 if(m_useHandles){
25 bool pass = false;
26 for(auto key : m_keyArray){
27 ATH_MSG_DEBUG("Key Checking: " << key.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}
53
54}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x)
AnyVertexSkimmingTool(const std::string &, const std::string &, const IInterface *)
SG::ReadHandleKeyArray< xAOD::VertexContainer > m_keyArray
Gaudi::Property< std::vector< std::string > > m_containerNames
THE reconstruction tool.
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)