ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloRec
src
CaloClusterCopier.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
/********************************************************************
6
7
NAME: CaloClusterCopier.h
8
PACKAGE: offline/Calorimeter/CaloRec
9
10
AUTHORS: D. Rousseau, copied from LArClusterCopier from H. Ma
11
CREATED: Sep 2005
12
See header file.
13
14
********************************************************************/
15
16
#include "
CaloClusterCopier.h
"
17
#include "
xAODCaloEvent/CaloClusterContainer.h
"
18
#include "
xAODCaloEvent/CaloCluster.h
"
19
#include "
xAODCaloEvent/CaloClusterKineHelper.h
"
20
#include "
CaloUtils/CaloClusterStoreHelper.h
"
21
22
#include "
AthenaKernel/errorcheck.h
"
23
24
25
// -------------------------------------------------------------
26
// Constructor
27
// -------------------------------------------------------------
28
CaloClusterCopier::CaloClusterCopier
(
const
std::string&
type
,
29
const
std::string& name,
30
const
IInterface* parent):
31
AthAlgTool
(
type
, name, parent),
32
m_clustersKey
(
""
),
33
m_copyCells
(true),
m_useClusterPosition
(false),
m_etCut
(-1.),
m_clusterSize
(
xAOD
::CaloCluster_v1::CSize_Unknown)
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
}
41
42
// -------------------------------------------------------------
43
// Destructor
44
// -------------------------------------------------------------
45
CaloClusterCopier::~CaloClusterCopier
()
46
=
default
;
47
48
StatusCode
CaloClusterCopier::initialize
() {
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
}
64
65
StatusCode
66
CaloClusterCopier::execute
(
const
EventContext& ctx,
67
xAOD::CaloClusterContainer
* clusColl)
const
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());
79
if
(
m_useClusterPosition
) {
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
}
112
113
114
void
CaloClusterCopier::getClusterSize
(){
115
116
if
(name()==
"LArgamClusterMaker.larClusterCopier"
){
117
m_clusterSize
=
xAOD::CaloCluster::SW_55ele
;
118
}
else
if
(name()==
"LAr35ClusterMaker.larClusterCopier35"
){
119
m_clusterSize
=
xAOD::CaloCluster::SW_35ele
;
120
}
else
if
(name()==
"LAr37ClusterMaker.larClusterCopier37"
){
121
m_clusterSize
=
xAOD::CaloCluster::SW_37ele
;
122
}
else
if
(name()==
"LArgamClusterMaker.larClusterCopiergam"
){
123
m_clusterSize
=
xAOD::CaloCluster::SW_55gam
;
124
}
else
if
(name()==
"LArgam35ClusterMaker.larClusterCopiergam35"
){
125
m_clusterSize
=
xAOD::CaloCluster::SW_35gam
;
126
}
else
if
(name()==
"LArgam37ClusterMaker.larClusterCopiergam37"
){
127
m_clusterSize
=
xAOD::CaloCluster::SW_37gam
;
128
}
else
if
(name()==
"EMTopo35ClusterMaker.TopoEMCopier35"
) {
129
m_clusterSize
=
xAOD::CaloCluster::SW_35gam
;
130
}
131
132
ATH_MSG_DEBUG
(
"Name, Cluster size = "
<< name() <<
" "
<<
m_clusterSize
);
133
134
}
135
//xAOD::CaloCluster_v1::
ATH_CHECK
#define ATH_CHECK
Evaluate an expression and check for errors.
Definition
AthCheckMacros.h:40
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition
AthMsgStreamMacros.h:31
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition
AthMsgStreamMacros.h:32
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition
AthMsgStreamMacros.h:29
CaloClusterCopier.h
CaloClusterKineHelper.h
CaloClusterStoreHelper.h
errorcheck.h
Helpers for checking error return status codes and reporting errors.
CaloClusterContainer.h
CaloCluster.h
AthAlgTool::AthAlgTool
AthAlgTool(const std::string &type, const std::string &name, const IInterface *parent)
Constructor with parameters:
Definition
AthAlgTool.cxx:16
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
Definition
AthCommonDataStore.h:145
CaloClusterCellLink::const_iterator::index
unsigned index() const
Accessor for the index of the cell in the CaloCellContainer.
Definition
CaloClusterCellLink.h:86
CaloClusterCopier::execute
virtual StatusCode execute(const EventContext &ctx, xAOD::CaloClusterContainer *) const override
Execute on an entire collection of clusters.
Definition
CaloClusterCopier.cxx:66
CaloClusterCopier::m_copyCells
bool m_copyCells
Definition
CaloClusterCopier.h:54
CaloClusterCopier::m_etCut
float m_etCut
Definition
CaloClusterCopier.h:56
CaloClusterCopier::m_useClusterPosition
bool m_useClusterPosition
Definition
CaloClusterCopier.h:55
CaloClusterCopier::getClusterSize
void getClusterSize()
Definition
CaloClusterCopier.cxx:114
CaloClusterCopier::CaloClusterCopier
CaloClusterCopier(const std::string &type, const std::string &name, const IInterface *parent)
Definition
CaloClusterCopier.cxx:28
CaloClusterCopier::m_clustersKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clustersKey
Definition
CaloClusterCopier.h:53
CaloClusterCopier::initialize
virtual StatusCode initialize() override
Definition
CaloClusterCopier.cxx:48
CaloClusterCopier::m_clusterSize
xAOD::CaloCluster::ClusterSize m_clusterSize
Definition
CaloClusterCopier.h:57
CaloClusterCopier::~CaloClusterCopier
virtual ~CaloClusterCopier() override
CaloClusterKineHelper::calculateKine
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.
Definition
CaloClusterKineHelper.cxx:223
CaloClusterStoreHelper::makeCluster
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
Definition
CaloClusterStoreHelper.cxx:13
DataVector< CaloCluster_v1 >::const_iterator
DataModel_detail::const_iterator< DataVector > const_iterator
Definition
DataVector.h:838
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
SG::ReadHandle
Definition
StoreGate/StoreGate/ReadHandle.h:67
xAOD::CaloCluster_v1::const_cell_iterator
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version).
Definition
CaloCluster_v1.h:796
xAOD::CaloCluster_v1::setClusterSize
void setClusterSize(const ClusterSize)
Get cluster size.
Definition
CaloCluster_v1.cxx:369
xAOD::CaloCluster_v1::setEta0
void setEta0(flt_t)
xAOD::CaloCluster_v1::SW_55ele
@ SW_55ele
Definition
CaloCluster_v1.h:91
xAOD::CaloCluster_v1::SW_37gam
@ SW_37gam
Definition
CaloCluster_v1.h:97
xAOD::CaloCluster_v1::SW_35gam
@ SW_35gam
Definition
CaloCluster_v1.h:96
xAOD::CaloCluster_v1::SW_37ele
@ SW_37ele
Definition
CaloCluster_v1.h:93
xAOD::CaloCluster_v1::SW_35ele
@ SW_35ele
Definition
CaloCluster_v1.h:92
xAOD::CaloCluster_v1::SW_55gam
@ SW_55gam
Definition
CaloCluster_v1.h:95
xAOD::CaloCluster_v1::setPhi0
void setPhi0(flt_t)
Set raw of cluster seed.
xAOD::CaloCluster_v1::addCell
bool addCell(const unsigned index, const double weight)
Method to add a cell to the cluster (Beware: Kinematics not updated!).
Definition
CaloCluster_v1.h:774
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition
ICaloAffectedTool.h:24
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
xAOD::CaloClusterContainer
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
Definition
Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloClusterContainer.h:17
type
Generated on
for ATLAS Offline Software by
1.17.0