ATLAS Offline Software
Loading...
Searching...
No Matches
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
10
11
12std::unique_ptr<xAOD::CaloCluster> CaloClusterStoreHelper::makeCluster(const CaloCellContainer* cellCont) {
13 return makeCluster (DataLink<CaloCellContainer> (cellCont));
14}
15
16
17std::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
25std::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
41
42
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
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
62void
64 const EventContext& ctx,
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
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 }
Helpers for checking error return status codes and reporting errors.
static Double_t sc
Container class for CaloCell.
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
static void finalizeClusters(const EventContext &ctx, SG::WriteHandle< xAOD::CaloClusterContainer > &outClusterContainer, SG::WriteHandle< CaloClusterCellLinkContainer > &outClusterContainerCellLink)
Finalize clusters (move CaloClusterCellLink to a separate container).
static void copyContainer(const xAOD::CaloClusterContainer *oldColl, xAOD::CaloClusterContainer *newColl)
Deep copy of a cluster container.
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
void clear()
Erase all the elements in the collection.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
void addCellLink(CaloClusterCellLink *CCCL)
ClusterSize
Enumeration to identify different cluster sizes.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.