ATLAS Offline Software
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"
8 namespace DerivationFramework {
9 
10 
11 AnyVertexSkimmingTool::AnyVertexSkimmingTool(const std::string& t, const std::string& n, const IInterface* p) : AthAlgTool(t,n,p)
12 {}
13 
15 
17  if(m_useHandles) for(const auto& str : m_containerNames) m_keyArray.emplace_back(str);
18  ATH_CHECK(m_keyArray.initialize(m_useHandles));
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 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
read
IovVectorMap_t read(const Folder &theFolder, const SelectionCriterion &choice, const unsigned int limit=10)
Definition: openCoraCool.cxx:569
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
DerivationFramework::AnyVertexSkimmingTool::initialize
StatusCode initialize() override
Definition: AnyVertexSkimmingTool.cxx:16
DerivationFramework::AnyVertexSkimmingTool::m_useHandles
Gaudi::Property< bool > m_useHandles
Definition: AnyVertexSkimmingTool.h:24
AnyVertexSkimmingTool.h
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
beamspotman.n
n
Definition: beamspotman.py:731
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DerivationFramework::AnyVertexSkimmingTool::eventPassesFilter
virtual bool eventPassesFilter() const override
Check that the current event passes this filter.
Definition: AnyVertexSkimmingTool.cxx:22
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
DerivationFramework::AnyVertexSkimmingTool::m_containerNames
Gaudi::Property< std::vector< std::string > > m_containerNames
Definition: AnyVertexSkimmingTool.h:22
VertexContainer.h
DerivationFramework::AnyVertexSkimmingTool::m_keyArray
SG::ReadHandleKeyArray< xAOD::VertexContainer > m_keyArray
Definition: AnyVertexSkimmingTool.h:23
DerivationFramework::AnyVertexSkimmingTool::AnyVertexSkimmingTool
AnyVertexSkimmingTool(const std::string &, const std::string &, const IInterface *)
Definition: AnyVertexSkimmingTool.cxx:11
str
Definition: BTagTrackIpAccessor.cxx:11
AthAlgTool
Definition: AthAlgTool.h:26
get_generator_info.error
error
Definition: get_generator_info.py:40
DerivationFramework::AnyVertexSkimmingTool::~AnyVertexSkimmingTool
~AnyVertexSkimmingTool()
error
Definition: IImpactPoint3dEstimator.h:70
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37