ATLAS Offline Software
xAODTrackParticleAuxContainerCnv.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 // $Id: xAODTrackParticleAuxContainerCnv.cxx 791368 2017-01-05 08:55:07Z krasznaa $
6 
7 // System include(s):
8 #include <exception>
9 #include <memory>
10 
11 // ROOT include(s):
12 #include <TClass.h>
13 
14 // Athena/Gaudi include(s):
17 
18 // Local include(s):
24 
25 // EDM include(s):
27 
29 xAODTrackParticleAuxContainerCnv( ISvcLocator* svcLoc )
31  m_compressorTool( "xAODMaker::TrackParticleCompressorTool/"
32  "xAODTrackParticleCompressorTool" ) {
33 
34 }
35 
37 
38  // Retrieve the compression tool:
39  CHECK( m_compressorTool.retrieve() );
40 
41  // Call the base class's initialize:
43 
44  // Return gracefully:
45  return StatusCode::SUCCESS;
46 }
47 
51  const std::string& key ) {
52 
53  // Load the necessary ROOT class(es):
54  static char const* const NAME =
55  "std::vector<ElementLink<DataVector<Trk::Track> > >";
56  static TClass const* const cls = TClass::GetClass( NAME );
57  if( ! cls ) {
58  ATH_MSG_ERROR( "Couldn't load dictionary for type: " << NAME );
59  }
60 
61  // This makes a copy of the container, with any thinning applied.
62  std::unique_ptr< xAOD::TrackParticleAuxContainer > result
64 
65 
66  // Create a helper object for the float compression:
68  for( size_t i = 0; i < result->size(); ++i ) {
69  helper.push_back( std::make_unique<xAOD::TrackParticle>() );
70  }
71  helper.setStore( result.get() );
72 
73  // Compress the track particles' payload:
74  for( xAOD::TrackParticle* tp : helper ) {
75  // Check for possible compression errors:
76  if( ! m_compressorTool->compress( *tp ).isSuccess() ) {
77  REPORT_MESSAGE( MSG::ERROR )
78  << "Failed to compress track particle";
79  return nullptr;
80  }
81  }
82 
83  // Return the thinned and compressed object:
84  return result.release();
85 }
86 
xAOD::TrackParticleAuxContainer_v5
Temporary container used until we have I/O for AuxStoreInternal.
Definition: TrackParticleAuxContainer_v5.h:35
get_generator_info.result
result
Definition: get_generator_info.py:21
xAODTrackParticleAuxContainerCnv::m_compressorTool
ToolHandle< xAODMaker::ITrackParticleCompressorTool > m_compressorTool
Compressor tool for the track particles.
Definition: xAODTrackParticleAuxContainerCnv.h:68
xAODTrackParticleAuxContainerCnv_v1.h
xAODTrackParticleAuxContainerCnv_v2.h
CaloClusterListBadChannel.cls
cls
Definition: CaloClusterListBadChannel.py:8
ParticleTest.tp
tp
Definition: ParticleTest.py:25
T_AthenaPoolAuxContainerCnv
Athena pool converter for aux store classes.
Definition: T_AthenaPoolAuxContainerCnv.h:39
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
xAODTrackParticleAuxContainerCnv::initialize
StatusCode initialize() override
Function initialising the converter.
Definition: xAODTrackParticleAuxContainerCnv.cxx:36
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:85
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
xAODTrackParticleAuxContainerCnv::createPersistentWithKey
virtual xAOD::TrackParticleAuxContainer * createPersistentWithKey(xAOD::TrackParticleAuxContainer *trans, const std::string &key) override
Function preparing the container to be written out.
Definition: xAODTrackParticleAuxContainerCnv.cxx:50
xAODTrackParticleAuxContainerCnv::xAODTrackParticleAuxContainerCnv
xAODTrackParticleAuxContainerCnv(ISvcLocator *svcLoc)
Converter constructor.
Definition: xAODTrackParticleAuxContainerCnv.cxx:29
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
T_AthenaPoolAuxContainerCnv::createPersistentWithKey
virtual AUXSTORE * createPersistentWithKey(AUXSTORE *trans, const std::string &key) override
Convert a transient object to persistent form.
errorcheck.h
Helpers for checking error return status codes and reporting errors.
REPORT_MESSAGE
#define REPORT_MESSAGE(LVL)
Report a message.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:365
xAODTrackParticleAuxContainerCnv_v4.h
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
copyThinned.h
Helper to copy an object while applying thinning.
T_AthenaPoolCustCnv< AUXSTORE, AUXSTORE >::initialize
virtual StatusCode initialize()
Gaudi Service Interface method implementations:
xAODTrackParticleAuxContainerCnv.h
xAODTrackParticleAuxContainerCnv_v3.h
TrackParticleContainer.h
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37