ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
InnerDetector
InDetDetDescr
PixelGeoModel
python
PixelGeoDB.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
2
3
def
InitializeGeometryParameters
(dbGeomCursor):
4
"""Read geometry parameters for Pixel
5
6
dbGeomCursor: AtlasGeoDBInterface instance
7
"""
8
9
# ----------------------------------------------------------------------------
10
# Read versionname, layout and dbm from PixelSwitches table
11
dbId, dbSwitches, dbParam = dbGeomCursor.GetCurrentLeafContent(
"PixelSwitches"
)
12
13
params = {
"VersionName"
:
"UNDEFINED"
,
14
"Layout"
:
"UNDEFINED"
,
15
"DBM"
:
False
}
16
17
if
dbId:
18
key = dbId[0]
19
if
"VERSIONNAME"
in
dbParam:
20
params[
"VersionName"
] = dbSwitches[key][dbParam.index(
"VERSIONNAME"
)]
21
if
"LAYOUT"
in
dbParam :
22
params[
"Layout"
] = dbSwitches[key][dbParam.index(
"LAYOUT"
)]
23
if
"BUILDDBM"
in
dbParam :
24
params[
"DBM"
] = (dbSwitches[key][dbParam.index(
"BUILDDBM"
)] != 0)
25
26
27
# ----------------------------------------------------------------------------
28
# IBL layout
29
params[
"IBL"
] = (params[
"Layout"
] ==
"IBL"
)
30
params[
"IBLlayout"
] =
"noIBL"
31
32
if
params[
"IBL"
]:
33
dbId, dbLayers, dbParam = dbGeomCursor.GetCurrentLeafContent(
"PixelLayer"
)
34
IBLStaveIndex = -1
35
IBLgeoLayout = -1
36
37
if
dbId:
38
key = dbId[0]
39
if
"STAVEINDEX"
in
dbParam
and
dbLayers[key][dbParam.index(
"STAVEINDEX"
)]
not
in
[
"NULL"
,
None
]:
40
IBLStaveIndex = int(dbLayers[key][dbParam.index(
"STAVEINDEX"
)])
41
42
if
IBLStaveIndex > -1:
43
dbId, dbStaves, dbParam = dbGeomCursor.GetCurrentLeafContent(
"PixelStave"
)
44
45
if
dbId
and
IBLStaveIndex <= len(dbStaves.keys()):
46
key = dbId[IBLStaveIndex]
47
if
"LAYOUT"
in
dbParam
and
dbStaves[key][dbParam.index(
"LAYOUT"
)]
not
in
[
"NULL"
,
None
]:
48
IBLgeoLayout = int(dbStaves[key][dbParam.index(
"LAYOUT"
)])
49
if
IBLgeoLayout
in
[3,4] : params[
"IBLlayout"
] =
"planar"
50
elif
IBLgeoLayout
in
[5] : params[
"IBLlayout"
] =
"3D"
51
52
return
params
53
54
def
InitializeGeometryParameters_SQLite
(sqliteDbReader):
55
"""Read geometry parameters for Pixel from SQLite
56
57
sqliteDbReader: AtlasGeoDBInterface_SQLite instance
58
"""
59
60
# ----------------------------------------------------------------------------
61
# Read versionname, layout and dbm from PixelSwitches table
62
dbData = sqliteDbReader.GetData(
"PixelSwitches"
)
63
64
params = {
"VersionName"
:
"UNDEFINED"
,
65
"Layout"
:
"UNDEFINED"
,
66
"DBM"
:
False
}
67
68
if
dbData:
69
if
"VERSIONNAME"
in
dbData[0].keys():
70
params[
"VersionName"
] = dbData[0][
"VERSIONNAME"
]
71
if
"LAYOUT"
in
dbData[0].keys():
72
params[
"Layout"
] = dbData[0][
"LAYOUT"
]
73
if
"BUILDDBM"
in
dbData[0].keys():
74
params[
"DBM"
] = (dbData[0][
"BUILDDBM"
] != 0)
75
76
77
# ----------------------------------------------------------------------------
78
# IBL layout
79
params[
"IBL"
] = (params[
"Layout"
] ==
"IBL"
)
80
params[
"IBLlayout"
] =
"noIBL"
81
82
if
params[
"IBL"
]:
83
dbData = sqliteDbReader.GetData(
"PixelLayer"
)
84
IBLStaveIndex = -1
85
IBLgeoLayout = -1
86
87
if
dbData:
88
if
"STAVEINDEX"
in
dbData[0].keys()
and
dbData[0][
"STAVEINDEX"
]
not
in
[
"NULL"
,
None
]:
89
IBLStaveIndex = int(dbData[0][
"STAVEINDEX"
])
90
91
if
IBLStaveIndex > -1:
92
dbData = sqliteDbReader.GetData(
"PixelStave"
)
93
if
dbData
and
IBLStaveIndex <= len(dbData):
94
if
"LAYOUT"
in
dbData[IBLStaveIndex].keys()
and
dbData[IBLStaveIndex][
"LAYOUT"
]
not
in
[
"NULL"
,
None
]:
95
IBLgeoLayout = int(dbData[IBLStaveIndex][
"LAYOUT"
])
96
if
IBLgeoLayout
in
[3,4] : params[
"IBLlayout"
] =
"planar"
97
elif
IBLgeoLayout
in
[5] : params[
"IBLlayout"
] =
"3D"
98
99
return
params
PixelGeoDB.InitializeGeometryParameters
InitializeGeometryParameters(dbGeomCursor)
Definition
PixelGeoDB.py:3
PixelGeoDB.InitializeGeometryParameters_SQLite
InitializeGeometryParameters_SQLite(sqliteDbReader)
Definition
PixelGeoDB.py:54
Generated on
for ATLAS Offline Software by
1.17.0