ATLAS Offline Software
Loading...
Searching...
No Matches
xAODMaker::CaloClusterCnvTool Class Reference

Implementation of the ICaloClusterCnvTool interface. More...

#include <CaloClusterCnvTool.h>

Inheritance diagram for xAODMaker::CaloClusterCnvTool:
Collaboration diagram for xAODMaker::CaloClusterCnvTool:

Public Member Functions

 CaloClusterCnvTool (const std::string &type, const std::string &name, const IInterface *parent)
 Regular AlgTool constructor.
virtual StatusCode convert (const CaloCluster *aod, xAOD::CaloCluster *xaod, CaloClusterCellLinkContainer *ccclc=0) const override
 Function that fill an existing xAOD::CaloCluster object with info.
virtual StatusCode convert (const CaloClusterContainer *aod, xAOD::CaloClusterContainer *xaod) const override
 Function usable by TrigBStoxAODTool.
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Static Public Member Functions

static const InterfaceID & interfaceID ()
 Gaudi interface definition.

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Implementation of the ICaloClusterCnvTool interface.

   This tool holds the code doing the actual heavy lifting in
   converting an old CaloCluster object into an xAOD::CaloCluster
   one. It is used both by the package's main algorithm, and the
   trigger code when reading old BS files.
Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h
Walter Lampl Walte.nosp@m.r.La.nosp@m.mpl@c.nosp@m.ern..nosp@m.ch

Definition at line 29 of file CaloClusterCnvTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ CaloClusterCnvTool()

xAODMaker::CaloClusterCnvTool::CaloClusterCnvTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Regular AlgTool constructor.

Definition at line 47 of file CaloClusterCnvTool.cxx.

50 : AthAlgTool( type, name, parent ) {
51
52 // Declare the interface(s) that the tool implements:
53 declareInterface< ICaloClusterCnvTool >( this );
54 }
AthAlgTool()
Default constructor:

Member Function Documentation

◆ convert() [1/2]

StatusCode xAODMaker::CaloClusterCnvTool::convert ( const CaloCluster * aod,
xAOD::CaloCluster * xaod,
CaloClusterCellLinkContainer * ccclc = 0 ) const
overridevirtual

Function that fill an existing xAOD::CaloCluster object with info.

Implements xAODMaker::ICaloClusterCnvTool.

Definition at line 56 of file CaloClusterCnvTool.cxx.

60 {
61
62 //
63 // Deal with the cell association:
64 //
65 if( aod->isCellLinkValid() && ccclc ) {
66
67 ATH_MSG_DEBUG( "Found cluster with valid cell link" );
68
70 CaloCluster::cell_iterator cit_e = aod->end();
71 if( cit != cit_e ) { //Protect against empty-cluster case
72
73 //Get underlying cell container
74 const CaloCellContainer* ccc = aod->getContainer( cit );
75
76 if( ccc && ( !ccc->empty() ) ) {
77
78 CaloClusterCellLink* cccl = new CaloClusterCellLink( ccc );
79 xaod->addCellLink( cccl );
80 for( ; cit != cit_e; ++cit ) {
81 xaod->addCell( cit.getElement().index(), cit.getParameter() );
82 }//end loop over cells of a cluster
83
84 // Move cell links to external cell-link container:
85 xaod->setLink( ccclc );
86
87 } //end cell container ptr not NULL
88 else {
89 ATH_MSG_INFO( "Got NULL ptr to CaloCellContainer" );
90 }
91
92 }//end check cluster not-empty
93 else {
94 ATH_MSG_DEBUG( "Found cluster with empty list of constituents" );
95 }
96 }//end if isCellLink valid
97 else {
98 ATH_MSG_DEBUG( "Found cluster without valid cell link" );
99 }
100
101 // Set basic quantities:
102 xaod->setSamplingPattern( aod->samplingPattern() );
103 const xAOD::CaloCluster::ClusterSize clSize =
104 static_cast< xAOD::CaloCluster::ClusterSize >( aod->getClusterSize() );
105 xaod->setClusterSize( clSize );
106 xaod->setEta0( ( double ) aod->eta0() );
107 xaod->setPhi0( ( double ) aod->phi0() );
108 xaod->setTime( aod->getTime() );
109
110 xaod->setCalE( aod->e (P4SignalState::CALIBRATED) );
113 xaod->setCalM( aod->m (P4SignalState::CALIBRATED) );
114
115 xaod->setRawE( aod->e (P4SignalState::UNCALIBRATED) );
118 xaod->setRawM( aod->m (P4SignalState::UNCALIBRATED) );
119
120 xaod->setAltE( aod->e (P4SignalState::ALTCALIBRATED) );
123 xaod->setAltM( aod->m (P4SignalState::ALTCALIBRATED) );
124
125 //
126 // Copy the energy depositions per sampling:
127 copyClusterVariables (aod, xaod,
130 copyClusterVariables (aod, xaod,
133 copyClusterVariables (aod, xaod,
136
137 //
138 // Copy bad-channel data:
139 //
141 const std::vector< CaloClusterBadChannelData >* bcvec =
142 aod->getBadChannel();
143 for( const CaloClusterBadChannelData& bcd : *bcvec ) {
144 badChanList.emplace_back( bcd.getEta(), bcd.getPhi(),
145 bcd.getLayer(), bcd.getFlag().packedData() );
146 }
147 xaod->setBadChannelList( badChanList );
148
149 //
150 // Copy the moments:
151 //
154 for( ; mom_itr != mom_end; ++mom_itr ) {
155
156 // Forcibly convert between the two types:
157 const CaloCluster::moment_type aod_type =
158 static_cast<CaloCluster::moment_type>(mom_itr.getMomentType());
159 const xAOD::CaloCluster_v1::MomentType xaod_type =
160 static_cast< xAOD::CaloCluster_v1::MomentType >( aod_type );
161
162 // Insert the moment:
163 xaod->insertMoment( xaod_type,
164 mom_itr.getMoment().getValue() );
165 ATH_MSG_VERBOSE( "Copied moment " << aod_type );
166 }
167
168 // Return gracefully:
169 return StatusCode::SUCCESS;
170 }
#define ATH_MSG_INFO(x)
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
const double & getValue() const
returns the value of this moment
virtual object_iter end() const
end iterator for public object access
const CaloCellContainer * getContainer(const CaloCell *pCell) const
public container access: retrieve Container for given object pointer
virtual object_iter begin() const
begin iterator for public object access
virtual bool isCellLinkValid() const
moment_type getMomentType() const
Function access to moment type.
const CaloClusterMoment & getMoment() const
Function access to CaloClusterMoment.
double eta0() const
Returns raw of cluster seed.
MomentStoreIter moment_iterator
Moment iterator type for CaloCluster clients.
virtual double m() const
Retrieve mass independent of signal state.
virtual double e() const
Retrieve energy independent of signal state.
CaloCompositeCellBase< CaloClusterNavigable >::cell_iterator cell_iterator
Iterator on CaloCell s.
virtual double eta() const
Retrieve eta independent of signal state.
double getTime() const
Access cluster time.
moment_iterator beginMoment(bool useLink=true) const
First iterator on moment store.
moment_iterator endMoment(bool useLink=true) const
Last iterator on moment store.
unsigned int samplingPattern() const
Get sampling bitmask.
const badChannelList * getBadChannel() const
unsigned int getClusterSize() const
Get cluster size.
virtual double phi() const
Retrieve phi independent of signal state.
moment_store::moment_type moment_type
Cluster moment indicator type.
double phi0() const
Returns raw of cluster seed.
bool empty() const noexcept
Returns true if the collection is empty.
const ElementLink< CONT > & getElement() const
RPAR getParameter() const
void setRawEta(flt_t)
Set for signal state UNCALIBRATED.
void setAltPhi(flt_t)
Set for signal state ALTCALIBRATED.
void setRawPhi(flt_t)
Set for signal state UNCALIBRATED.
bool setPhi(const CaloSample sampling, const float phi)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
void setAltM(flt_t)
Set mass for singal state ALTCALIBRATED.
void addCellLink(CaloClusterCellLink *CCCL)
void setRawE(flt_t)
Set Energy for signal state UNCALIBRATED.
void setCalPhi(flt_t)
Set for signal state CALIBRATED.
void setRawM(flt_t)
Set mass for singal state UNCALIBRATED.
void setAltEta(flt_t)
Set for signal state ALTCALIBRATED.
void setTime(flt_t)
Set cluster time.
void insertMoment(MomentType type, double value)
void setCalEta(flt_t)
Set for signal state CALIBRATED.
void setClusterSize(const ClusterSize)
Get cluster size.
bool setEta(const CaloSample sampling, const float eta)
Set in a given sampling. Returns false if the sample isn't part of the cluster.
ClusterSize
Enumeration to identify different cluster sizes.
bool setEnergy(const CaloSample sampling, const float e)
Set energy for a given sampling. Returns false if the sample isn't part of the cluster.
void setSamplingPattern(const unsigned sp, const bool clearSamplingVars=false)
Set sampling pattern (one bit per sampling.
void setPhi0(flt_t)
Set raw of cluster seed.
void setAltE(flt_t)
Set Energy for signal state ALTCALIBRATED.
MomentType
Enums to identify different moments.
void setCalE(flt_t)
Set Energy for signal state CALIBRATED.
void setCalM(flt_t)
Set mass for singal state CALIBRATED.
bool setLink(CaloClusterCellLinkContainer *CCCL, IProxyDict *sg=nullptr)
Set up an ElementLink to a CaloClusterCellLink object.
bool addCell(const unsigned index, const double weight)
Method to add a cell to the cluster (Beware: Kinematics not updated!)
void setBadChannelList(const CaloClusterBadChannelList &bcl)
std::vector< CaloClusterBadChannelData > CaloClusterBadChannelList

◆ convert() [2/2]

StatusCode xAODMaker::CaloClusterCnvTool::convert ( const CaloClusterContainer * aod,
xAOD::CaloClusterContainer * xaod ) const
overridevirtual

Function usable by TrigBStoxAODTool.

Implements xAODMaker::ICaloClusterCnvTool.

Definition at line 172 of file CaloClusterCnvTool.cxx.

174 {
175
178 CaloClusterCellLinkContainer* ccclc = nullptr;
179
180 for( ; it!= itE; ++it){
181 xAOD::CaloCluster* xcluster = new xAOD::CaloCluster();
182 xaod->push_back( xcluster );
183 CHECK( convert( *it, xcluster, ccclc) );
184 }
185
186 return StatusCode::SUCCESS;
187 }
Athena::TPCnvVers::Old Athena::TPCnvVers::Old Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current Athena::TPCnvVers::Current CaloClusterCellLinkContainer
Definition CaloTPCnv.cxx:95
#define CHECK(...)
Evaluate an expression and check for errors.
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.
virtual StatusCode convert(const CaloCluster *aod, xAOD::CaloCluster *xaod, CaloClusterCellLinkContainer *ccclc=0) const override
Function that fill an existing xAOD::CaloCluster object with info.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & xAODMaker::ICaloClusterCnvTool::interfaceID ( )
inlinestaticinherited

Gaudi interface definition.

Definition at line 53 of file ICaloClusterCnvTool.h.

53 {
55 }
static const InterfaceID IID_ICaloClusterCnvTool("xAODMaker::ICaloClusterCnvTool", 1, 0)
The interface provided by ICaloClusterCnvTool.

◆ msg()

MsgStream & AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381 {
382 h.renounce();
384 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308 {
309 // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310 // << " size: " << m_vhka.size() << endmsg;
311 for (auto &a : m_vhka) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: