ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloUtils
src
CaloClusterStoreHelper.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
CaloUtils/CaloClusterStoreHelper.h
"
6
#include "
CaloEvent/CaloClusterCellLink.h
"
7
#include "
xAODCaloEvent/CaloClusterAuxContainer.h
"
8
#include "
StoreGate/StoreGateSvc.h
"
9
#include "
AthenaKernel/errorcheck.h
"
10
11
12
std::unique_ptr<xAOD::CaloCluster>
CaloClusterStoreHelper::makeCluster
(
const
CaloCellContainer
* cellCont) {
13
return
makeCluster
(
DataLink<CaloCellContainer>
(cellCont));
14
}
15
16
17
std::unique_ptr<xAOD::CaloCluster>
CaloClusterStoreHelper::makeCluster
(
const
DataLink<CaloCellContainer>
& cellCont) {
18
std::unique_ptr<xAOD::CaloCluster> cluster = std::make_unique<xAOD::CaloCluster>();
19
cluster->makePrivateStore();
20
if
(cellCont) cluster->addCellLink(std::make_unique<CaloClusterCellLink>(cellCont));
21
return
cluster;
22
}
23
24
25
std::unique_ptr<xAOD::CaloCluster>
CaloClusterStoreHelper::makeCluster
(
const
CaloCellContainer
* cellCont,
26
const
double
eta0,
const
double
phi0,
27
const
xAOD::CaloCluster_v1::ClusterSize
clusterSize) {
28
std::unique_ptr<xAOD::CaloCluster> cluster=
CaloClusterStoreHelper::makeCluster
(cellCont);
29
cluster->setEta0(eta0);
30
cluster->setPhi0(phi0);
31
cluster->setClusterSize(clusterSize);
32
return
cluster;
33
}
34
35
36
xAOD::CaloCluster
*
CaloClusterStoreHelper::makeCluster
(
xAOD::CaloClusterContainer
* cont,
37
const
CaloCellContainer
* cellCont)
38
{
39
return
makeCluster
(cont,
DataLink<CaloCellContainer>
(cellCont));
40
}
41
42
43
xAOD::CaloCluster
*
CaloClusterStoreHelper::makeCluster
(
xAOD::CaloClusterContainer
* cont,
44
const
DataLink<CaloCellContainer>
& cellCont) {
45
46
xAOD::CaloCluster
* cluster=cont->
push_back
(std::make_unique<xAOD::CaloCluster>());
47
if
(cellCont) cluster->
addCellLink
(std::make_unique<CaloClusterCellLink>(cellCont));
48
return
cluster;
49
}
50
51
52
StatusCode
CaloClusterStoreHelper::AddContainerWriteHandle
(
SG::WriteHandle<xAOD::CaloClusterContainer>
&clusColl) {
53
54
// Create the xAOD container and its auxiliary store:
55
StatusCode
sc
=
56
clusColl.
record
(std::make_unique<xAOD::CaloClusterContainer>(),
57
std::make_unique<xAOD::CaloClusterAuxContainer>());
58
return
sc
;
59
}
60
61
62
void
63
CaloClusterStoreHelper::finalizeClusters
(
64
const
EventContext& ctx,
65
SG::WriteHandle<xAOD::CaloClusterContainer>
& outClusterContainer,
66
SG::WriteHandle<CaloClusterCellLinkContainer>
& outClusterContainerCellLink)
67
{
68
for
(
xAOD::CaloCluster
* cl : *outClusterContainer) {
69
cl->setLink(outClusterContainerCellLink.
ptr
(), ctx);
70
}
71
}
72
73
//Moved to here from CaloRunClusterCorrection
74
void
CaloClusterStoreHelper::copyContainer
(
const
xAOD::CaloClusterContainer
* oldColl,
xAOD::CaloClusterContainer
* newColl) {
75
// make a Cluster Container
76
newColl->
clear
();
77
newColl->
reserve
(oldColl->
size
());
78
for
(
const
xAOD::CaloCluster
* oldCluster : *oldColl) {
79
xAOD::CaloCluster
* newClu=newColl->
push_back
(std::make_unique<xAOD::CaloCluster>());
80
*newClu=*oldCluster;
81
//new xAOD::CaloCluster (*oldCluster)); //Copy c'tor creates a private AuxStore and a private ClusterCellLink obj
82
}
83
}
CaloClusterAuxContainer.h
CaloClusterCellLink.h
CaloClusterStoreHelper.h
errorcheck.h
Helpers for checking error return status codes and reporting errors.
sc
static Double_t sc
Definition
LArPhysWaveHECTool.cxx:37
StoreGateSvc.h
CaloCellContainer
Container class for CaloCell.
Definition
CaloCellContainer.h:55
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:12
CaloClusterStoreHelper::finalizeClusters
static void finalizeClusters(const EventContext &ctx, SG::WriteHandle< xAOD::CaloClusterContainer > &outClusterContainer, SG::WriteHandle< CaloClusterCellLinkContainer > &outClusterContainerCellLink)
Finalize clusters (move CaloClusterCellLink to a separate container).
Definition
CaloClusterStoreHelper.cxx:63
CaloClusterStoreHelper::copyContainer
static void copyContainer(const xAOD::CaloClusterContainer *oldColl, xAOD::CaloClusterContainer *newColl)
Deep copy of a cluster container.
Definition
CaloClusterStoreHelper.cxx:74
CaloClusterStoreHelper::AddContainerWriteHandle
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
Definition
CaloClusterStoreHelper.cxx:52
DataLink
Object reference supporting deferred reading from StoreGate.
Definition
AthLinks/DataLink.h:96
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DataVector::clear
void clear()
Erase all the elements in the collection.
SG::WriteHandle
Definition
StoreGate/StoreGate/WriteHandle.h:71
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
xAOD::CaloCluster_v1::addCellLink
void addCellLink(CaloClusterCellLink *CCCL)
Definition
CaloCluster_v1.h:728
xAOD::CaloCluster_v1::ClusterSize
ClusterSize
Enumeration to identify different cluster sizes.
Definition
CaloCluster_v1.h:89
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
Generated on
for ATLAS Offline Software by
1.17.0