ATLAS Offline Software
Loading...
Searching...
No Matches
TrigCaloClusterCnvTool.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
6// EDM include(s):
11
12// Local include(s):
14
15namespace xAODMaker {
16
18 const std::string& name,
19 const IInterface* parent )
20 : AthAlgTool( type, name, parent ) {
21
22 // Declare the interface(s) provided by the tool:
23 declareInterface< ITrigCaloClusterCnvTool >( this );
24 }
25
26
36 StatusCode
38 xAOD::TrigCaloClusterContainer* xaod ) const {
39
40 ATH_MSG_DEBUG( "Size of the xAOD container before loop: "
41 << xaod->size() );
42
43 // Number of available samplings:
44 const unsigned int samplings = 25; // Is this really right?...
45
46 // Loop over the AOD objects:
49
50 for( ; aod_itr != aod_end; ++aod_itr ) {
51
52 // Create the xAOD object:
54 xaod->push_back( cluster );
55
56 cluster->setRawEnergy ( ( *aod_itr )->rawEnergy() );
57 cluster->setRawEt ( ( *aod_itr )->rawEt() );
58 cluster->setRawEta ( ( *aod_itr )->rawEta() );
59 cluster->setRawPhi ( ( *aod_itr )->rawPhi() );
60 cluster->setRoIword ( ( *aod_itr )->RoIword() );
61 cluster->setNCells ( ( *aod_itr )->nCells() );
62 cluster->setClusterQuality( ( *aod_itr )->quality() );
63
64 for( unsigned int i = 0; i < samplings; ++i ) {
65 const CaloSampling::CaloSample sample =
66 static_cast< CaloSampling::CaloSample >( i );
67 const float value = ( *aod_itr )->rawEnergy( sample );
68 if( ! cluster->setRawEnergy( sample, value ) ) {
69 ATH_MSG_WARNING( "Unable to set raw energy for sampling "
70 << sample );
71 }
72 }
73
74 ATH_MSG_DEBUG( "rawEnergy: "
75 << ( *aod_itr )->rawEnergy() << "; "
76 << "rawEt: "
77 << ( *aod_itr )->rawEt() << "; "
78 << "rawEta: "
79 << ( *aod_itr )->rawEta() << "; "
80 << "rawPhi: "
81 << ( *aod_itr )->rawPhi() << "; "
82 << std::hex << "m_roiWord: 0x"
83 << ( *aod_itr )->RoIword() << "; " << std::dec
84 << "numberUsedCells: "
85 << ( *aod_itr )->nCells() << "; "
86 << "quality: "
87 << ( *aod_itr )->quality() );
88
89 if( msg().level() <= MSG::DEBUG ) {
90 for( unsigned int i = 0; i < samplings; ++i ) {
91 const CaloSampling::CaloSample sample =
92 static_cast< CaloSampling::CaloSample >( i );
93 ATH_MSG_DEBUG( "rawEnergySample : "
95 << " = "
96 << ( *aod_itr )->rawEnergy( sample ) << ";" );
97 }
98 }
99
100 }
101
102 ATH_MSG_DEBUG( "Size of the xAOD container after loop: "
103 << xaod->size() );
104
105 // Return gracefully:
106 return StatusCode::SUCCESS;
107 }
108
109} // namespace xAODMaker
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
MsgStream & msg() const
static std::string getSamplingName(CaloSample theSample)
Returns a string (name) for each CaloSampling.
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
TrigCaloClusterCnvTool(const std::string &type, const std::string &name, const IInterface *parent)
Regular AlgTool constructor.
virtual StatusCode convert(const TrigCaloClusterContainer *aod, xAOD::TrigCaloClusterContainer *xaod) const override
Function that fills an existing xAOD::TrigCaloCluster.
void setClusterQuality(unsigned int)
set quality of cluster built (to be defined)
void setNCells(int)
set number of cells used from RoI
void setRoIword(long)
set RoI Word
void setRawPhi(float)
set Raw Phi (no calibration)
void setRawEnergy(float)
set Raw Energy (no calibration)
void setRawEta(float)
set Raw Eta (no calibration)
void setRawEt(float)
set Raw Et (no calibration)
TrigCaloClusterContainer_v1 TrigCaloClusterContainer
Define the latest version of the trigger calorimeter cluster container.
TrigCaloCluster_v1 TrigCaloCluster
Define the latest version of the trigger calorimeter cluster class.