ATLAS Offline Software
Static Public Member Functions | List of all members
CaloClusterStoreHelper Class Reference

#include <CaloClusterStoreHelper.h>

Collaboration diagram for CaloClusterStoreHelper:

Static Public Member Functions

static std::unique_ptr< xAOD::CaloClustermakeCluster (const CaloCellContainer *cellCont)
 Creates a valid CaloCluster with a private Aux-Store and CellLink container. More...
 
static std::unique_ptr< xAOD::CaloClustermakeCluster (const DataLink< CaloCellContainer > &cellCont)
 Creates a valid CaloCluster with a private Aux-Store and CellLink container. More...
 
static std::unique_ptr< xAOD::CaloClustermakeCluster (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. More...
 
static xAOD::CaloClustermakeCluster (xAOD::CaloClusterContainer *cont, const CaloCellContainer *cellCont)
 Creates a valid CaloCluster and pushes it into the cluster container. More...
 
static xAOD::CaloClustermakeCluster (xAOD::CaloClusterContainer *cont, const DataLink< CaloCellContainer > &cellCont)
 Creates a valid CaloCluster and pushes it into the cluster container. More...
 
static StatusCode AddContainerWriteHandle (SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
 Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and records them to SG. More...
 
static StatusCode finalizeClusters (SG::WriteHandle< CaloClusterCellLinkContainer > &h, xAOD::CaloClusterContainer *pClusterColl)
 Finalize clusters (move CaloClusterCellLink to a separate container). More...
 
static void finalizeClusters (const EventContext &ctx, SG::WriteHandle< xAOD::CaloClusterContainer > &outClusterContainer, SG::WriteHandle< CaloClusterCellLinkContainer > &outClusterContainerCellLink)
 
static void copyContainer (const xAOD::CaloClusterContainer *oldColl, xAOD::CaloClusterContainer *newColl)
 Deep copy of a cluster container. More...
 

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 53 of file CaloClusterStoreHelper.cxx.

53  {
54 
55  // Create the xAOD container and its auxiliary store:
56  StatusCode sc =
57  clusColl.record (std::make_unique<xAOD::CaloClusterContainer>(),
58  std::make_unique<xAOD::CaloClusterAuxContainer>());
59  return sc;
60 }

◆ 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 91 of file CaloClusterStoreHelper.cxx.

91  {
92  // make a Cluster Container
93  newColl->clear();
94  newColl->reserve (oldColl->size());
95  for (const xAOD::CaloCluster* oldCluster : *oldColl) {
96  xAOD::CaloCluster* newClu=newColl->push_back(std::make_unique<xAOD::CaloCluster>());
97  *newClu=*oldCluster;
98  //new xAOD::CaloCluster (*oldCluster)); //Copy c'tor creates a private AuxStore and a private ClusterCellLink obj
99  }
100  }

◆ finalizeClusters() [1/2]

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

Definition at line 80 of file CaloClusterStoreHelper.cxx.

84 {
85  for (xAOD::CaloCluster* cl : *outClusterContainer) {
86  cl->setLink(outClusterContainerCellLink.ptr(), ctx);
87  }
88 }

◆ finalizeClusters() [2/2]

StatusCode CaloClusterStoreHelper::finalizeClusters ( SG::WriteHandle< CaloClusterCellLinkContainer > &  h,
xAOD::CaloClusterContainer pClusterColl 
)
static

Finalize clusters (move CaloClusterCellLink to a separate container).

Definition at line 64 of file CaloClusterStoreHelper.cxx.

66 {
67  auto cellLinks = std::make_unique<CaloClusterCellLinkContainer>();
68 
69  //Loop on clusters and call setLink to transfer ownership of CaloClusterCellLink object to
70  //CaloClusterCellLinkContainer
72  for (xAOD::CaloCluster* cl : *pClusterColl) {
73  cl->setLink(cellLinks.get(), sg);
74  }
75 
76  return h.record (std::move (cellLinks));
77 }

◆ 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 13 of file CaloClusterStoreHelper.cxx.

13  {
14  return makeCluster (DataLink<CaloCellContainer> (cellCont));
15 }

◆ 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 26 of file CaloClusterStoreHelper.cxx.

28  {
29  std::unique_ptr<xAOD::CaloCluster> cluster=CaloClusterStoreHelper::makeCluster(cellCont);
30  cluster->setEta0(eta0);
31  cluster->setPhi0(phi0);
32  cluster->setClusterSize(clusterSize);
33  return cluster;
34 }

◆ 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 18 of file CaloClusterStoreHelper.cxx.

18  {
19  std::unique_ptr<xAOD::CaloCluster> cluster = std::make_unique<xAOD::CaloCluster>();
20  cluster->makePrivateStore();
21  if (cellCont) cluster->addCellLink(std::make_unique<CaloClusterCellLink>(cellCont));
22  return cluster;
23 }

◆ 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 37 of file CaloClusterStoreHelper.cxx.

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

◆ 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 44 of file CaloClusterStoreHelper.cxx.

45  {
46 
47  xAOD::CaloCluster* cluster=cont->push_back(std::make_unique<xAOD::CaloCluster>());
48  if (cellCont) cluster->addCellLink(std::make_unique<CaloClusterCellLink>(cellCont));
49  return cluster;
50 }

The documentation for this class was generated from the following files:
DataVector::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
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
InDetAccessor::phi0
@ phi0
Definition: InDetAccessor.h:33
SG::CurrentEventStore::store
static IProxyDict * store()
Fetch the current store.
IProxyDict
A proxy dictionary.
Definition: AthenaKernel/AthenaKernel/IProxyDict.h:47
xAOD::CaloCluster_v1::setEta0
void setEta0(flt_t)
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
xAOD::CaloCluster_v1::setPhi0
void setPhi0(flt_t)
Set raw of cluster seed.
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
DataVector::clear
void clear()
Erase all the elements in the collection.
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::AuxElement::makePrivateStore
void makePrivateStore()
Create a new (empty) private store for this object.
Definition: AuxElement.cxx:192
xAOD::CaloCluster_v1::addCellLink
void addCellLink(CaloClusterCellLink *CCCL)
Definition: CaloCluster_v1.h:721
h
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
xAOD::CaloCluster_v1::setClusterSize
void setClusterSize(const ClusterSize)
Get cluster size.
Definition: CaloCluster_v1.cxx:369
dq_make_web_display.cl
cl
print [x.__class__ for x in toList(dqregion.getSubRegions()) ]
Definition: dq_make_web_display.py:26
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.