ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
LArCalorimeter
LArSamplesMon
src
AbsLArCells.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#include "
LArSamplesMon/AbsLArCells.h
"
6
7
#include "
LArSamplesMon/History.h
"
8
#include "
LArCafJobs/CellInfo.h
"
9
#include "
LArSamplesMon/FilterParams.h
"
10
11
12
#include <iostream>
13
using
std::cout;
14
using
std::endl;
15
16
using namespace
LArSamples
;
17
18
19
//std::vector<CellInfo*> AbsLArCells::m_cellInfoCache(Definitions::nChannels,nullptr);
20
21
AbsLArCells::AbsLArCells
():
22
m_pos
(
nChannels
() + 1),
23
m_cellInfoCache
(
nChannels
())
24
{ }
25
26
AbsLArCells::~AbsLArCells
()
27
{
28
AbsLArCells::resetCache
();
29
}
30
31
32
void
AbsLArCells::resetCache
()
const
33
{
34
m_cellCache
.reset();
35
m_pos
=
nChannels
() + 1;
36
}
37
38
39
std::unique_ptr<const History>
AbsLArCells::newCellHistory
(
unsigned
int
i)
const
40
{
41
std::unique_ptr<const History> history =
getCellHistory
(i);
42
if
(!history)
return
nullptr
;
43
if
(!
m_cellInfoCache
[i]) {
44
const
CellInfo
* ci=history->cellInfo();
45
if
(ci) {
46
m_cellInfoCache
[i]=std::make_unique<CellInfo>(*ci,
false
);
47
}
48
}
49
// m_cellInfoCache[i] = (history->cellInfo() ? new CellInfo(*history->cellInfo(), false) : new CellInfo());
50
return
history;
51
}
52
53
54
const
History
*
AbsLArCells::cellHistory
(
unsigned
int
i)
const
55
{
56
if
(
m_pos
== i)
return
m_cellCache
.get();
57
resetCache
();
58
std::unique_ptr<const History> history =
newCellHistory
(i);
59
if
(!history)
return
nullptr
;
60
m_cellCache
= std::move(history);
61
m_pos
= i;
62
return
m_cellCache
.get();
63
}
64
65
66
std::unique_ptr<const CellInfo>
AbsLArCells::cellInfo
(
unsigned
int
i)
const
67
{
68
const
CellInfo
* info =
cellInfoCache
(i);
69
if
(info) {
70
if
(info->isValid()) {
71
return
std::make_unique<CellInfo> (*info);
72
}
73
return
nullptr
;
74
}
75
std::unique_ptr<const CellInfo> infop =
getCellInfo
(i);
76
if
(infop)
m_cellInfoCache
[i] = std::make_unique<CellInfo>(*infop,
false
);
77
return
infop;
78
}
79
80
81
const
CellInfo
*
AbsLArCells::cellInfoCache
(
unsigned
int
i)
const
82
{
83
return
m_cellInfoCache
[i].get();
84
}
85
86
87
std::unique_ptr<const CellInfo>
AbsLArCells::getCellInfo
(
unsigned
int
i)
const
88
{
89
std::unique_ptr<const History> history = this->
getCellHistory
(i);
90
if
(!history)
return
nullptr
;
91
if
(!history->cellInfo())
return
nullptr
;
92
return
std::make_unique<CellInfo>(*history->cellInfo());
93
}
94
95
96
const
History
*
AbsLArCells::pass
(
unsigned
int
i,
const
FilterParams
& f)
const
97
{
98
//std::cout << "Called AbsLArCells with hash " << i << std::endl;
99
if
(!f.passHash(i))
return
nullptr
;
100
std::unique_ptr<const CellInfo> info =
cellInfo
(i);
101
if
(!info) {
102
return
nullptr
;
103
}
104
//std::cout << "Called AbsLArCells::pass on a cell belonging to " << Id::str(info->calo()) << std::endl;
105
bool
result = f.passCell(*info);
106
return
result ?
cellHistory
(i) :
nullptr
;
107
}
108
109
AbsLArCells.h
CellInfo.h
FilterParams.h
History.h
LArSamples::AbsLArCells::getCellHistory
virtual std::unique_ptr< const History > getCellHistory(unsigned int i) const =0
LArSamples::AbsLArCells::~AbsLArCells
virtual ~AbsLArCells()
Definition
AbsLArCells.cxx:26
LArSamples::AbsLArCells::nChannels
virtual unsigned int nChannels() const
Definition
AbsLArCells.h:35
LArSamples::AbsLArCells::AbsLArCells
AbsLArCells()
Definition
AbsLArCells.cxx:21
LArSamples::AbsLArCells::m_pos
unsigned int m_pos
Definition
AbsLArCells.h:54
LArSamples::AbsLArCells::pass
const History * pass(unsigned int i, const FilterParams &f) const
Definition
AbsLArCells.cxx:96
LArSamples::AbsLArCells::m_cellCache
std::unique_ptr< const History > m_cellCache
Definition
AbsLArCells.h:55
LArSamples::AbsLArCells::getCellInfo
virtual std::unique_ptr< const CellInfo > getCellInfo(unsigned int i) const
Definition
AbsLArCells.cxx:87
LArSamples::AbsLArCells::cellHistory
virtual const History * cellHistory(unsigned int i) const
Definition
AbsLArCells.cxx:54
LArSamples::AbsLArCells::resetCache
virtual void resetCache() const
Definition
AbsLArCells.cxx:32
LArSamples::AbsLArCells::m_cellInfoCache
std::vector< std::unique_ptr< CellInfo > > m_cellInfoCache
Definition
AbsLArCells.h:56
LArSamples::AbsLArCells::newCellHistory
virtual std::unique_ptr< const History > newCellHistory(unsigned int i) const
Definition
AbsLArCells.cxx:39
LArSamples::AbsLArCells::cellInfoCache
const CellInfo * cellInfoCache(unsigned int i) const
Definition
AbsLArCells.cxx:81
LArSamples::AbsLArCells::cellInfo
virtual std::unique_ptr< const CellInfo > cellInfo(unsigned int i) const
Definition
AbsLArCells.cxx:66
LArSamples::CellInfo
Definition
CellInfo.h:31
LArSamples::FilterParams
Definition
FilterParams.h:50
LArSamples::History
Definition
History.h:36
LArSamples
Definition
AbsShape.h:24
Generated on
for ATLAS Offline Software by
1.17.0