ATLAS Offline Software
Calorimeter
CaloEvent
src
CaloClusterNavigable.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2020 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
(
m_ownLinkStore
&& *
m_cellLink
!=
nullptr
)
delete
*
m_cellLink
;
37
}
38
39
CaloCellLink
*
CaloClusterNavigable::getCellLink
()
40
{
41
if
(
m_ownLinkStore
)
42
{
43
if
( *
m_cellLink
==
nullptr
)
m_cellLink
.setElement(
new
CaloCellLink
());
44
// Ok, because this happens only if we own the pointer.
45
CaloCellLink
* link
ATLAS_THREAD_SAFE
=
const_cast<
CaloCellLink
*
>
(*m_cellLink);
46
return
link;
47
}
48
else
49
{
50
return
(
CaloCellLink
*)
nullptr
;
51
}
52
53
// check if local pointer to store
54
// if ( m_cellLinkPointer != 0 ) { return m_cellLinkPointer;}
55
// check if linked pointer to store
56
// if ( m_cellLink.isValid() && *m_cellLink != 0 )
57
// {
58
// FIXME
59
// CaloCellLink* pLink = const_cast<CaloCellLink*>(*m_cellLink);
60
// return pLink;
61
// }
62
// create a new local store/
63
// m_cellLinkPointer = new CaloCellLink();
64
// return m_cellLinkPointer;
65
}
66
67
const
CaloCellLink
*
68
CaloClusterNavigable::getCellLink
()
const
69
{
70
// return *m_cellLink;
71
72
// if ( m_cellLinkPointer != 0 )
73
// {
74
// std::cout << "[CaloClusterNavigable@" << this << "] return "
75
// << "cell link @" << m_cellLinkPointer << std::endl;
76
// return m_cellLinkPointer;
77
// }
78
// if ( *m_cellLink == 0 )
79
// {
80
// std::cout << "[CaloClusterNavigable@" << this << "] problem with "
81
// << "cell link store, unexpected pointer = "
82
// << *m_cellLink << std::endl;
83
// }
84
return
m_cellLink
.isValid() ? *
m_cellLink
:
nullptr
;
85
}
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:39
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 Sun Dec 22 2024 21:07:51 for ATLAS Offline Software by
1.8.18