ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
TileCalorimeter
TileGeoModel
TileOracle
TileModule.py
Go to the documentation of this file.
1
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
2
3
6
def
TileHeader
(num):
7
outfile = open(
"TileModule.sql"
,
"wt"
)
8
outfile.write(
"SET echo OFF;\n"
)
9
outfile.write(
"#set linesize 132;\n"
)
10
# outfile.write("drop table TileModule_data2tag cascade constraints;\n")
11
# outfile.write("drop table TileModule_data cascade constraints;\n")
12
outfile.write(
"create table TileModule_data (\n"
)
13
outfile.write(
"TileModule_data_id number(10),\n"
)
14
outfile.write(
"PART number(10),\n"
)
15
outfile.write(
"MODNUM number(10),\n"
)
16
outfile.write(
"NAM varchar2(255),\n"
)
17
outfile.write(
"TYP number(10),\n"
)
18
outfile.write(
"COMM varchar2(255)\n"
)
19
outfile.write(
") ;\n"
)
20
outfile.write(
"\n"
)
21
outfile.write(
"alter table TileModule_data add constraint TileModule_data_pk\n"
)
22
outfile.write(
"primary key (TileModule_data_id);\n"
)
23
outfile.write(
"\n"
)
24
outfile.write(
"create table TileModule_data2tag (\n"
)
25
outfile.write(
" TileModule_vers varchar2(255),\n"
)
26
outfile.write(
" TileModule_data_id number(10)\n"
)
27
outfile.write(
") ;\n"
)
28
29
outfile.close()
30
return
num
31
32
# ---------------------------------------------------------------------------------------------------------------
33
def
TileComments
(num):
34
outfile = open(
"TileModule.sql"
,
"awt"
)
35
outfile.write(
"\n"
)
36
outfile.write(
"comment on column TileModule_data.TileModule_data_id is "
)
37
outfile.write(
"'Tile Modules description, version 05';\n"
)
38
outfile.write(
"comment on column TileModule_data.PART is "
)
39
outfile.write(
"'Tile parts 0-TB Barrel, 1-Barrel, 2-Ext.Bar Neg, 3-Ext.Bar Pos, 4 - ITC Neg, 5 - ITC Pos';\n"
)
40
outfile.write(
"comment on column TileModule_data.MODNUM is 'Module index';\n"
)
41
outfile.write(
"comment on column TileModule_data.NAM is 'Module name (production label)';\n"
)
42
outfile.write(
"comment on column TileModule_data.TYP is 'Module type of contents 1,2,6050403';\n"
)
43
outfile.write(
"comment on column TileModule_data.COMM is 'Module Comments';\n"
)
44
outfile.close()
45
return
num
46
47
# ---------------------------------------------------------------------------------------------------------------
48
def
TileModule
(num):
49
import
string
50
inpfile = open(
"TileModule-GEO-00"
,
"rt"
)
51
outfile = open(
"TileModule.sql"
,
"awt"
)
52
line = modname = comment = volline = cindx =
' '
53
n1 = n2 = n3 = nmax = 0
54
55
outfile.write(
"\n"
)
56
57
indx = -1
58
while
1 :
59
line = inpfile.readline()
60
indx = indx + 1
61
cindx = str(indx)
62
if
line ==
""
:
63
break
64
65
name = string.split(line)
66
nmax = len(name)
67
try
:
68
if
nmax < 4:
69
raise
IndexError
70
if
nmax > 5:
71
raise
IndexError
72
73
n1 = int(name[0])
74
n2 = int(name[1])
75
modname = name[2]
76
n3 = int(name[3])
77
78
if
nmax >= 4:
79
comment =
''
80
81
if
nmax == 5:
82
comment = name[4]
83
84
volline = str(indx)+
","
+str(n1)+
","
+str(n2)+
",'"
+modname+
"',"
+str(n3)+
",'"
+comment+
"'"
85
86
outfile.write(
"insert into TileModule_data (TileModule_data_id,PART,MODNUM,NAM,TYP,COMM) values (\n"
)
87
outfile.write(volline)
88
outfile.write(
");\n"
)
89
outfile.write(
"insert into TileModule_data2tag values ('TileModule-GEO-00', "
)
90
outfile.write(cindx)
91
outfile.write(
");\n"
)
92
93
except
IndexError:
# coments are in line
94
print
' IndexError : '
,nmax,
' '
,name
95
96
inpfile.close()
97
outfile.close()
98
return
num
99
100
# ---------------------------------------------------------------------------------------------------------------
101
print
'Tile wirh python '
102
print
' Tile Header'
,
TileHeader
(
'Header'
)
103
print
' Tile Values '
,
TileModule
(
'TileModule-GEO-00'
)
104
print
' Tile Coments'
,
TileComments
(
'Comments'
)
105
TileModule
Definition
TileModule.py:1
TileModule.TileComments
TileComments(num)
Definition
TileModule.py:33
TileModule.TileHeader
TileHeader(num)
Definition
TileModule.py:6
Generated on
for ATLAS Offline Software by
1.17.0