ATLAS Offline Software
CaloRingerReaderUtils.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // =====================================================================================
7 
8 
9 // Kernel includes:
10 #include "GaudiKernel/StatusCode.h"
11 #include "GaudiKernel/ToolHandle.h"
12 
13 // xAOD includes:
19 
20 namespace Ringer {
21 
22 // =====================================================================================
24  ATH_MSG_DEBUG(" ---------- Preparing to loop for " << nParticles << " particles");
25  // Reset counters, set number of particles to nParticles:
26  m_part_size = nParticles;
27  m_part_counter = 0;
28 
29  // Make and set the CaloRings and RingSets container
31  ATH_CHECK(m_crContH->record(std::make_unique<xAOD::CaloRingsContainer>(),
32  std::make_unique<xAOD::CaloRingsAuxContainer>()));
34  ATH_CHECK(m_rsContH->record(std::make_unique<xAOD::RingSetContainer>(),
35  std::make_unique<xAOD::RingSetAuxContainer>()));
36 
37  // Set containers which will hold the build CaloRings and reserve one slot per
38  // particle as initial guess:
39  return m_builder->preExecute( m_crContH->ptr(), m_rsContH->ptr(), nParticles );
40 }
41 
42 // =====================================================================================
44  if ( m_part_counter == m_part_size ) {
45  delete m_crContH; m_crContH = nullptr;
46  delete m_rsContH; m_rsContH = nullptr;
47  }
48 }
49 
50 } // namespace Ringer
Ringer::BuildCaloRingsFctorBase::m_builder
ToolHandle< ICaloRingsBuilder > & m_builder
Protected Properties.
Definition: CaloRingerReaderUtils.h:64
RingSetAuxContainer.h
Ringer::BuildCaloRingsFctorBase::prepareToLoopFor
StatusCode prepareToLoopFor(std::size_t nParticles)
Methods.
Definition: CaloRingerReaderUtils.cxx:23
Ringer::BuildCaloRingsFctorBase::m_crContH
SG::WriteHandle< xAOD::CaloRingsContainer > * m_crContH
Private Properties.
Definition: CaloRingerReaderUtils.h:95
CaloRingsAuxContainer.h
CaloRingsContainer.h
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
Ringer::BuildCaloRingsFctorBase::m_part_counter
size_t m_part_counter
Hold number of particles already procesed for this event:
Definition: CaloRingerReaderUtils.h:66
CaloRingerReaderUtils.h
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Ringer::BuildCaloRingsFctorBase::checkRelease
void checkRelease()
Release the handles when finished looping.
Definition: CaloRingerReaderUtils.cxx:43
RingSetContainer.h
Ringer::BuildCaloRingsFctorBase::m_rsContH
SG::WriteHandle< xAOD::RingSetContainer > * m_rsContH
Keep RingSetContainer handle in scope until finished looping.
Definition: CaloRingerReaderUtils.h:97
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
CaloClusterContainer.h
Ringer::BuildCaloRingsFctorBase::m_part_size
size_t m_part_size
Hold number of particles to be processed:
Definition: CaloRingerReaderUtils.h:68
Ringer
Namespace dedicated for Ringer utilities.
Definition: CaloRingsDefs.h:9