ATLAS Offline Software
Loading...
Searching...
No Matches
CaloClusterCopier Class Reference

#include <CaloClusterCopier.h>

Inheritance diagram for CaloClusterCopier:
Collaboration diagram for CaloClusterCopier:

Public Member Functions

 CaloClusterCopier (const std::string &type, const std::string &name, const IInterface *parent)
virtual ~CaloClusterCopier () override
virtual StatusCode initialize () override
virtual StatusCode execute (const EventContext &ctx, xAOD::CaloClusterContainer *) const override
 Execute on an entire collection of clusters.
void getClusterSize ()
virtual StatusCode execute (xAOD::CaloClusterContainer *collection) final
 Execute on an entire collection of clusters.
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
 DeclareInterfaceID (CaloClusterCollectionProcessor, 1, 0)

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

SG::ReadHandleKey< xAOD::CaloClusterContainerm_clustersKey
bool m_copyCells
bool m_useClusterPosition
float m_etCut
xAOD::CaloCluster::ClusterSize m_clusterSize
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

Definition at line 34 of file CaloClusterCopier.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

◆ CaloClusterCopier()

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

Definition at line 28 of file CaloClusterCopier.cxx.

30 :
31 AthAlgTool(type, name, parent),
32 m_clustersKey(""),
34{
35 declareInterface<CaloClusterCollectionProcessor> (this);
36 declareProperty("ClustersName",m_clustersKey);
37 declareProperty("CopyCells",m_copyCells);
38 declareProperty("UseClusterPosition",m_useClusterPosition);
39 declareProperty("etCut",m_etCut);
40}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clustersKey
xAOD::CaloCluster::ClusterSize m_clusterSize

◆ ~CaloClusterCopier()

CaloClusterCopier::~CaloClusterCopier ( )
overridevirtualdefault

Member Function Documentation

◆ 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 }

◆ DeclareInterfaceID()

CaloClusterCollectionProcessor::DeclareInterfaceID ( CaloClusterCollectionProcessor ,
1 ,
0  )
inherited

◆ 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.

◆ execute() [1/2]

StatusCode CaloClusterCopier::execute ( const EventContext & ctx,
xAOD::CaloClusterContainer * collection ) const
overridevirtual

Execute on an entire collection of clusters.

Parameters
collectionThe container of clusters. param ctx The event context.

Implements CaloClusterCollectionProcessor.

Definition at line 66 of file CaloClusterCopier.cxx.

68{
69 ATH_MSG_DEBUG("Executing CaloClusterCopier");
70 SG::ReadHandle<xAOD::CaloClusterContainer> inputContainer( m_clustersKey, ctx);
71
72 xAOD::CaloClusterContainer::const_iterator it = inputContainer->begin();
73 xAOD::CaloClusterContainer::const_iterator it_e = inputContainer->end();
74 for(; it!=it_e;++it) {
75 const xAOD::CaloCluster* old = *it;
76 if (m_etCut < 0 || std::fabs(old->et()) > m_etCut) {
77 // make the cluster
78 xAOD::CaloCluster* cluster_ptr = CaloClusterStoreHelper::makeCluster(clusColl,old->getCellLinks()->getCellContainer());
80 cluster_ptr->setEta0(old->eta());
81 cluster_ptr->setPhi0(old->phi());
82 } else {
83 cluster_ptr->setEta0(old->eta0());
84 cluster_ptr->setPhi0(old->phi0());
85 }
86
87 cluster_ptr->setClusterSize(m_clusterSize);
88
89 if (m_copyCells){
90 //Copy constructor for cell-link object??
91 //CaloClusterCellLink* links=new CaloClusterCellLink(oldCellLinks->getCellContainer());
92 //cluster_ptr->addCellLink(links);
93 // get all the cells
94 xAOD::CaloCluster::const_cell_iterator it_cell=old->cell_begin();
95 xAOD::CaloCluster::const_cell_iterator it_cell_e=old->cell_end();
96 // put the cell in cluster
97 int nhit = 0;
98 for(; it_cell!=it_cell_e; ++it_cell) {
99 cluster_ptr->addCell(it_cell.index(),1.0);
100 ++nhit;
101 }
102 //update kine!
103 CaloClusterKineHelper::calculateKine(cluster_ptr,false,true); //No weight at this point!
104 ATH_MSG_DEBUG(" Number of cells = " <<nhit);
105 }// end if m_copyCells
106 }//end if et cut
107 }//end loop over input clusters
108
109 ATH_MSG_DEBUG("Done with copying clusters, number of clusters= " << clusColl->size());
110 return StatusCode::SUCCESS;
111}
#define ATH_MSG_DEBUG(x)
static void calculateKine(xAOD::CaloCluster *clu, const bool useweight=true, const bool updateLayers=true, const bool useGPUCriteria=false)
Helper class to calculate cluster kinematics based on cells.
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version)
void setClusterSize(const ClusterSize)
Get cluster size.
void setPhi0(flt_t)
Set raw of cluster seed.
bool addCell(const unsigned index, const double weight)
Method to add a cell to the cluster (Beware: Kinematics not updated!)
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ execute() [2/2]

virtual StatusCode CaloClusterCollectionProcessor::execute ( xAOD::CaloClusterContainer * collection)
inlinefinalvirtual

Execute on an entire collection of clusters.

Parameters
collectionThe container of clusters. (deprecated)

Reimplemented from CaloClusterCollectionProcessor.

Definition at line 50 of file CaloClusterCollectionProcessor.h.

51 {
52 return execute (Gaudi::Hive::currentContext(), collection);
53 }
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *) const override
Execute on an entire collection of clusters.

◆ 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

◆ getClusterSize()

void CaloClusterCopier::getClusterSize ( )

Definition at line 114 of file CaloClusterCopier.cxx.

114 {
115
116 if(name()=="LArgamClusterMaker.larClusterCopier"){
118 }else if(name()=="LAr35ClusterMaker.larClusterCopier35"){
120 }else if(name()=="LAr37ClusterMaker.larClusterCopier37"){
122 }else if(name()=="LArgamClusterMaker.larClusterCopiergam"){
124 }else if(name()=="LArgam35ClusterMaker.larClusterCopiergam35"){
126 }else if(name()=="LArgam37ClusterMaker.larClusterCopiergam37"){
128 }else if (name()=="EMTopo35ClusterMaker.TopoEMCopier35") {
130 }
131
132 ATH_MSG_DEBUG("Name, Cluster size = " << name() << " " << m_clusterSize);
133
134}

◆ initialize()

StatusCode CaloClusterCopier::initialize ( )
overridevirtual

Definition at line 48 of file CaloClusterCopier.cxx.

48 {
49
50 ATH_MSG_INFO( " Careful: CaloClusterCopier only copy eta0 phi0" );
51
52 if (!m_copyCells){
53 ATH_MSG_INFO( " Do not copy cells " );
54 // ATH_MSG_ERROR( " CopyCell=False : Possibility to copy cluster without cells not implemented yet. Ignored." );
55
56 } else {
57 ATH_MSG_WARNING( " Copy of cluster with cells not well tested " );
58 }
59 ATH_CHECK(m_clustersKey.initialize());
60
61 return StatusCode::SUCCESS;
62
63}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)

◆ 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.

◆ 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_clusterSize

xAOD::CaloCluster::ClusterSize CaloClusterCopier::m_clusterSize
private

Definition at line 57 of file CaloClusterCopier.h.

◆ m_clustersKey

SG::ReadHandleKey<xAOD::CaloClusterContainer> CaloClusterCopier::m_clustersKey
private

Definition at line 53 of file CaloClusterCopier.h.

◆ m_copyCells

bool CaloClusterCopier::m_copyCells
private

Definition at line 54 of file CaloClusterCopier.h.

◆ 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_etCut

float CaloClusterCopier::m_etCut
private

Definition at line 56 of file CaloClusterCopier.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_useClusterPosition

bool CaloClusterCopier::m_useClusterPosition
private

Definition at line 55 of file CaloClusterCopier.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: