ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
Calorimeter
CaloRec
python
CaloThinCellsBySamplingAlg_test.py
Go to the documentation of this file.
1
#
2
# Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration.
3
#
4
# File: CaloRec/python/CaloThinCellsBySamplingAlg_test.py
5
# Author: scott snyder
6
# Date: Nov, 2019
7
# Brief: Test for CaloThinCellsBySamplingAlg.
8
#
9
10
from
AthenaConfiguration.ComponentAccumulator
import
ComponentAccumulator
11
from
AthenaConfiguration.ComponentFactory
import
CompFactory
12
from
AthenaPython.PyAthenaComps
import
Alg, StatusCode
13
import
ROOT
14
15
16
def
make_calo_cells
(mgr):
17
ccc = ROOT.CaloCellContainer()
18
for
i
in
range (mgr.element_size()):
19
elt = mgr.get_element (ROOT.IdentifierHash (i))
20
if
not
elt:
break
21
cc = ROOT.CaloCell (elt, 0, 0, 0, 0)
22
ccc.push_back (cc)
23
ROOT.SetOwnership (cc,
False
)
24
ccc.order()
25
ccc.updateCaloIterators()
26
return
ccc
27
28
29
class
CreateDataAlg
(Alg):
30
def
execute
(self):
31
ctx = self.getContext()
32
mgr = self.condStore[
'CaloDetDescrManager'
].find (ctx.eventID())
33
ccc = make_calo_cells (mgr)
34
self.evtStore.record (ccc,
'AllCalo'
,
False
)
35
return
StatusCode.Success
36
37
38
class
CheckThinningAlg
(Alg):
39
def
execute
(self):
40
ctx = self.getContext()
41
mgr = self.condStore[
'CaloDetDescrManager'
].find (ctx.eventID())
42
dec = self.evtStore[
'AllCalo_THINNED_StreamAOD.thinAlg'
]
43
44
for
i
in
range (dec.size()):
45
elt = mgr.get_element (ROOT.IdentifierHash (i))
46
if
elt.getSampling() == 3
or
elt.getSampling() == 17:
47
assert
not
dec.thinned(i)
48
else
:
49
assert
dec.thinned(i)
50
return
StatusCode.Success
51
52
53
def
testCfg
(flags):
54
result = ComponentAccumulator()
55
56
from
LArGeoAlgsNV.LArGMConfig
import
LArGMCfg
57
from
TileGeoModel.TileGMConfig
import
TileGMCfg
58
result.merge(LArGMCfg(flags))
59
result.merge(TileGMCfg(flags))
60
61
from
LArCabling.LArCablingConfig
import
LArOnOffIdMappingCfg
62
result.merge(LArOnOffIdMappingCfg(flags))
63
64
result.addEventAlgo (CreateDataAlg (
'CreateDataAlg'
))
65
66
CaloThinCellsBySamplingAlg=CompFactory.CaloThinCellsBySamplingAlg
67
result.addEventAlgo (CaloThinCellsBySamplingAlg (
'thinAlg'
,
68
StreamName =
'StreamAOD'
,
69
SamplingCellsName = [
'EMB3'
,
70
'TileGap3'
]))
71
72
result.addEventAlgo (CheckThinningAlg (
'CheckThinningAlg'
))
73
return
result
74
75
76
from
AthenaConfiguration.AllConfigFlags
import
initConfigFlags
77
from
AthenaConfiguration.TestDefaults
import
defaultTestFiles
78
flags = initConfigFlags()
79
flags.Input.Files = defaultTestFiles.RDO_RUN2
80
flags.Input.TimeStamps = [1000]
81
flags.Detector.GeometryLAr =
True
82
flags.Detector.GeometryTile =
True
83
flags.needFlagsCategory(
'Tile'
)
84
flags.needFlagsCategory(
'LAr'
)
85
86
flags.lock()
87
from
AthenaConfiguration.MainServicesConfig
import
MainServicesCfg
88
acc=MainServicesCfg(flags)
89
90
from
McEventSelector.McEventSelectorConfig
import
McEventSelectorCfg
91
acc.merge (McEventSelectorCfg (flags))
92
93
acc.merge (testCfg (flags))
94
acc.run(1)
95
96
python.CaloThinCellsBySamplingAlg_test.CheckThinningAlg
Definition
CaloThinCellsBySamplingAlg_test.py:38
python.CaloThinCellsBySamplingAlg_test.CheckThinningAlg.execute
execute(self)
Definition
CaloThinCellsBySamplingAlg_test.py:39
python.CaloThinCellsBySamplingAlg_test.CreateDataAlg
Definition
CaloThinCellsBySamplingAlg_test.py:29
python.CaloThinCellsBySamplingAlg_test.CreateDataAlg.execute
execute(self)
Definition
CaloThinCellsBySamplingAlg_test.py:30
python.CaloThinCellsBySamplingAlg_test.testCfg
testCfg(flags)
Definition
CaloThinCellsBySamplingAlg_test.py:53
python.CaloThinCellsBySamplingAlg_test.make_calo_cells
make_calo_cells(mgr)
Definition
CaloThinCellsBySamplingAlg_test.py:16
Generated on
for ATLAS Offline Software by
1.17.0