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

#include <CaloClusterStoreHelper.h>

Collaboration diagram for CaloClusterStoreHelper:

Static Public Member Functions

static std::unique_ptr< xAOD::CaloCluster > makeCluster (const CaloCellContainer *cellCont)
 Creates a valid CaloCluster with a private Aux-Store and CellLink container.
static std::unique_ptr< xAOD::CaloCluster > makeCluster (const DataLink< CaloCellContainer > &cellCont)
 Creates a valid CaloCluster with a private Aux-Store and CellLink container.
static std::unique_ptr< xAOD::CaloCluster > makeCluster (const CaloCellContainer *cellCont, const double eta0, const double phi0, const xAOD::CaloCluster_v1::ClusterSize clusterSize)
 Creates a valid CaloCluster with a private Aux-Store and CellLink container.
static xAOD::CaloCluster * makeCluster (xAOD::CaloClusterContainer *cont, const CaloCellContainer *cellCont)
 Creates a valid CaloCluster and pushes it into the cluster container.
static xAOD::CaloCluster * makeCluster (xAOD::CaloClusterContainer *cont, const DataLink< CaloCellContainer > &cellCont)
 Creates a valid CaloCluster and pushes it into the cluster container.
static StatusCode AddContainerWriteHandle (SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
 Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and records them to SG.
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.

Detailed Description

Definition at line 20 of file CaloClusterStoreHelper.h.

Member Function Documentation

◆ AddContainerWriteHandle()

StatusCode CaloClusterStoreHelper::AddContainerWriteHandle ( SG::WriteHandle< xAOD::CaloClusterContainer > & clusColl)
static

Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and records them to SG.

Parameters
clusCollSG write handle key of ClusterContainer
Returns
status code indicating sucess or failure

Definition at line 52 of file CaloClusterStoreHelper.cxx.

52 {
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}
static Double_t sc
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ copyContainer()

void CaloClusterStoreHelper::copyContainer ( const xAOD::CaloClusterContainer * oldColl,
xAOD::CaloClusterContainer * newColl )
static

Deep copy of a cluster container.

Parameters
oldThe container to copy.
Returns
Copy of the container and its clusters (an owning DV).

Definition at line 74 of file CaloClusterStoreHelper.cxx.

74 {
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 }
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.
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.

◆ finalizeClusters()

void CaloClusterStoreHelper::finalizeClusters ( const EventContext & ctx,
SG::WriteHandle< xAOD::CaloClusterContainer > & outClusterContainer,
SG::WriteHandle< CaloClusterCellLinkContainer > & outClusterContainerCellLink )
static

Finalize clusters (move CaloClusterCellLink to a separate container).

Definition at line 63 of file CaloClusterStoreHelper.cxx.

67{
68 for (xAOD::CaloCluster* cl : *outClusterContainer) {
69 cl->setLink(outClusterContainerCellLink.ptr(), ctx);
70 }
71}
pointer_type ptr()
Dereference the pointer.
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]

◆ makeCluster() [1/5]

std::unique_ptr< xAOD::CaloCluster > CaloClusterStoreHelper::makeCluster ( const CaloCellContainer * cellCont)
static

Creates a valid CaloCluster with a private Aux-Store and CellLink container.

Parameters
cellContpointer to the underlying CaloCellContainer
Returns
unique_ptr to a CaloCluster object.

Definition at line 12 of file CaloClusterStoreHelper.cxx.

12 {
13 return makeCluster (DataLink<CaloCellContainer> (cellCont));
14}
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.

◆ makeCluster() [2/5]

std::unique_ptr< xAOD::CaloCluster > CaloClusterStoreHelper::makeCluster ( const CaloCellContainer * cellCont,
const double eta0,
const double phi0,
const xAOD::CaloCluster_v1::ClusterSize clusterSize )
static

Creates a valid CaloCluster with a private Aux-Store and CellLink container.

Parameters
cellContpointer to the underlying CaloCellContainer
eta0seed \( \eta \) of cluster
phi0seed \( \varphi \) of cluster
clusterSize
Returns
unique_ptr to a CaloCluster object

Definition at line 25 of file CaloClusterStoreHelper.cxx.

27 {
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}

◆ makeCluster() [3/5]

std::unique_ptr< xAOD::CaloCluster > CaloClusterStoreHelper::makeCluster ( const DataLink< CaloCellContainer > & cellCont)
static

Creates a valid CaloCluster with a private Aux-Store and CellLink container.

Parameters
cellContlink to the underlying CaloCellContainer
Returns
unique_ptr to a CaloCluster object.

Definition at line 17 of file CaloClusterStoreHelper.cxx.

17 {
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}

◆ makeCluster() [4/5]

xAOD::CaloCluster * CaloClusterStoreHelper::makeCluster ( xAOD::CaloClusterContainer * cont,
const CaloCellContainer * cellCont )
static

Creates a valid CaloCluster and pushes it into the cluster container.

Parameters
contptr to and xAOD::CaloClusterContainer (must be associated with an CaloClusterAuxContainer);
cellContpointer to the underlying CaloCellContainer
Returns
Pointer to a CaloCluster object

Definition at line 36 of file CaloClusterStoreHelper.cxx.

38{
39 return makeCluster (cont, DataLink<CaloCellContainer> (cellCont));
40}

◆ makeCluster() [5/5]

xAOD::CaloCluster * CaloClusterStoreHelper::makeCluster ( xAOD::CaloClusterContainer * cont,
const DataLink< CaloCellContainer > & cellCont )
static

Creates a valid CaloCluster and pushes it into the cluster container.

Parameters
contptr to and xAOD::CaloClusterContainer (must be associated with an CaloClusterAuxContainer);
cellContlink to the underlying CaloCellContainer
Returns
Pointer to a CaloCluster object

Definition at line 43 of file CaloClusterStoreHelper.cxx.

44 {
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}
void addCellLink(CaloClusterCellLink *CCCL)

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