ATLAS Offline Software
Loading...
Searching...
No Matches
xAODCaloClusterAuxContainerCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id: xAODCaloClusterAuxContainerCnv.cxx 773852 2016-09-19 14:08:20Z krasznaa $
6
7// System include(s):
8#include <exception>
9#include <memory>
10
11// Infrastucture include(s):
12
13// EDM include(s):
16
17// Local include(s):
21
23xAODCaloClusterAuxContainerCnv( ISvcLocator* svcLoc )
25#ifndef XAOD_ANALYSIS
26 , m_compressor( "xAODClusterCompressor","xAODCaloClusterAuxContainerCnv" )
27#endif
28 , m_doCompression( false )
29{
30
31#ifndef XAOD_ANALYSIS
32 if( m_compressor.retrieve().isSuccess() ) {
33 m_doCompression = true;
34 ATH_MSG_INFO("Retrieved compression tool");
35 } else {
36 m_doCompression = false;
37 ATH_MSG_WARNING( "Failed to retrieve compression tool. "
38 "Will store uncompressed cluster" );
39 }
40#endif
41
42}
43
47 const std::string& key) {
48
49 std::unique_ptr<xAOD::CaloClusterAuxContainer> result
51
52#ifndef XAOD_ANALYSIS
53 // Compress it if possible:
54 if( m_doCompression ) {
56 for( size_t i = 0; i < result->size(); ++i ) {
57 helper.push_back( new xAOD::CaloCluster() );
58 }
59 helper.setStore( result.get() );
60 m_compressor->compress( &helper );
61 }
62#endif
63
64 // Return the object to be written:
65 return result.release();
66}
67
virtual xAOD::CaloClusterAuxContainer * createPersistentWithKey(xAOD::CaloClusterAuxContainer *trans, const std::string &key) override
ServiceHandle< IxAODClusterCompressor > m_compressor
Service compressing the cluster for storage on disk.
xAODCaloClusterAuxContainerCnv(ISvcLocator *svcLoc)
Converter constructor.
virtual xAOD::CaloClusterAuxContainer * createPersistentWithKey(xAOD::CaloClusterAuxContainer *trans, const std::string &key)
Function preparing the container to be written out.
bool m_doCompression
Flag set to false if the retrieval of the compression service failed.
Helper to copy an object while applying thinning.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
CaloClusterAuxContainer_v2 CaloClusterAuxContainer
Define the latest version of the calorimeter cluster auxiliary container.
T_AthenaPoolAuxContainerCnv< xAOD::CaloClusterAuxContainer, xAODCaloClusterAuxContainerCnv_v1 > xAODCaloClusterAuxContainerCnvBase
Base class for the converter.