ATLAS Offline Software
Calorimeter
CaloEvent
src
CaloClusterNavigable.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
6
#include "
CaloEvent/CaloClusterLinkTemplate.h
"
7
8
#include "
CaloEvent/CaloClusterNavigable.h
"
9
#include "
CaloEvent/CaloCellLink.h
"
10
#include "
CaloEvent/CaloCellLinkContainer.h
"
11
12
#include <algorithm>
13
//#include <iostream>
14
15
CaloClusterNavigable::CaloClusterNavigable
()
16
: m_ownLinkStore(false)
17
{ }
18
19
CaloClusterNavigable::CaloClusterNavigable
(
CaloCellLinkContainer
* pLinkColl,
20
CaloCellLink
* pLink)
21
: m_ownLinkStore(false)
22
{
23
CaloClusterLinkTemplate<CaloCellLinkContainer>::setLink
(pLinkColl,
24
pLink,
25
m_cellLink
);
26
}
27
28
CaloClusterNavigable::CaloClusterNavigable
(
CaloCellLink
* pLink)
29
: m_ownLinkStore(true)
30
{
31
m_cellLink
.setElement(pLink);
32
}
33
34
CaloClusterNavigable::~CaloClusterNavigable
()
35
{
36
// If we own the store, the link holds the pointer directly.
37
if
(
m_ownLinkStore
)
delete
m_cellLink
.cachedElement();
38
}
39
40
CaloCellLink
*
CaloClusterNavigable::getCellLink
()
41
{
42
if
(
m_ownLinkStore
)
43
{
44
if
( *
m_cellLink
==
nullptr
)
m_cellLink
.setElement(
new
CaloCellLink
());
45
// Ok, because this happens only if we own the pointer.
46
CaloCellLink
* link
ATLAS_THREAD_SAFE
=
const_cast<
CaloCellLink
*
>
(*m_cellLink);
47
return
link;
48
}
49
else
50
{
51
return
(
CaloCellLink
*)
nullptr
;
52
}
53
54
// check if local pointer to store
55
// if ( m_cellLinkPointer != 0 ) { return m_cellLinkPointer;}
56
// check if linked pointer to store
57
// if ( m_cellLink.isValid() && *m_cellLink != 0 )
58
// {
59
// FIXME
60
// CaloCellLink* pLink = const_cast<CaloCellLink*>(*m_cellLink);
61
// return pLink;
62
// }
63
// create a new local store/
64
// m_cellLinkPointer = new CaloCellLink();
65
// return m_cellLinkPointer;
66
}
67
68
const
CaloCellLink
*
69
CaloClusterNavigable::getCellLink
()
const
70
{
71
// return *m_cellLink;
72
73
// if ( m_cellLinkPointer != 0 )
74
// {
75
// std::cout << "[CaloClusterNavigable@" << this << "] return "
76
// << "cell link @" << m_cellLinkPointer << std::endl;
77
// return m_cellLinkPointer;
78
// }
79
// if ( *m_cellLink == 0 )
80
// {
81
// std::cout << "[CaloClusterNavigable@" << this << "] problem with "
82
// << "cell link store, unexpected pointer = "
83
// << *m_cellLink << std::endl;
84
// }
85
return
m_cellLink
.isValid() ? *
m_cellLink
:
nullptr
;
86
}
CaloClusterNavigable.h
CaloClusterLinkTemplate.h
CaloCellLinkContainer
Container class for CaloCellLink.
Definition:
CaloCellLinkContainer.h:26
CaloClusterNavigable::CaloClusterNavigable
CaloClusterNavigable()
default constructor
Definition:
CaloClusterNavigable.cxx:15
CaloClusterNavigable::m_cellLink
cell_link_type m_cellLink
Local pointer to cell store.
Definition:
CaloClusterNavigable.h:186
CaloClusterLinkTemplate::setLink
static bool setLink(CONT *pCont, DOBJ *pDat, ELEM &rElm)
Definition:
CaloClusterLinkTemplate.h:26
CaloCellLink
Simple store for CaloCell links. This object is fully navigable.
Definition:
CaloCellLink.h:15
CaloCellLink.h
CaloCellLinkContainer.h
CaloClusterNavigable::getCellLink
CaloCellLink * getCellLink()
Definition:
CaloClusterNavigable.cxx:40
ATLAS_THREAD_SAFE
#define ATLAS_THREAD_SAFE
Definition:
checker_macros.h:211
CaloClusterNavigable::m_ownLinkStore
bool m_ownLinkStore
Definition:
CaloClusterNavigable.h:178
CaloClusterNavigable::~CaloClusterNavigable
virtual ~CaloClusterNavigable()
destructor
Definition:
CaloClusterNavigable.cxx:34
Generated on Mon Sep 29 2025 21:07:29 for ATLAS Offline Software by
1.8.18