7 outfile =
open(
"TILB.sql",
"wt")
8 outfile.write(
"SET echo OFF;\n")
9 outfile.write(
"set linesize 132;\n")
12 outfile.write(
"create table TILB_data (\n")
13 outfile.write(
"TILB_data_id number(10),\n")
14 outfile.write(
"SECTION number(10),\n")
15 outfile.write(
"NPERIOD number(10),\n")
16 outfile.write(
"NMODUL number(10),\n")
17 outfile.write(
"RMIN float(63),\n")
18 outfile.write(
"RMAX float(63),\n")
19 outfile.write(
"RMINIMAL float(63),\n")
20 outfile.write(
"RMAXIMAL float(63),\n")
21 outfile.write(
"DZPERIO float(63),\n")
22 outfile.write(
"DRFRONT float(63),\n")
23 outfile.write(
"DZEND float(63),\n")
24 outfile.write(
"FLANGEX float(63),\n")
25 outfile.write(
"FLANGEY float(63),\n")
26 outfile.write(
"ZOFFSET float(63),\n")
27 outfile.write(
"PHIGAP float(63),\n")
28 outfile.write(
"ISCI_ST number(10),\n")
29 outfile.write(
"DZMODUL float(63),\n")
30 outfile.write(
"DZMAST float(63),\n")
31 outfile.write(
"DZSPAC float(63),\n")
32 outfile.write(
"DZEND1 float(63),\n")
33 outfile.write(
"DZEND2 float(63),\n")
34 outfile.write(
"NGIRDER number(10),\n")
35 outfile.write(
"NSCIN number(10),\n")
36 outfile.write(
"FINGPATTERN number(10),\n")
37 outfile.write(
"NPERCUTPOS number(10),\n")
38 outfile.write(
"NPERCUTNEG number(10),\n")
39 outfile.write(
"CURSCINT number(10),\n")
40 outfile.write(
"DZGIR float(63)\n")
41 outfile.write(
") ;\n")
43 outfile.write(
"alter table TILB_data add constraint TILB_data_pk\n")
44 outfile.write(
"primary key (TILB_data_id);\n")
46 outfile.write(
"create table TILB_data2tag (\n")
47 outfile.write(
" TILB_vers varchar2(255),\n")
48 outfile.write(
" TILB_data_id number(10)\n")
49 outfile.write(
") ;\n")
56 outfile =
open(
"TILB.sql",
"awt")
58 outfile.write(
"comment on column TILB_data.TILB_data_id is 'TileCal TILB, Section';\n")
59 outfile.write(
"comment on column TILB_data.SECTION is '1-barrel, 2-extended, 3-ITC1, 4-ITC2, 5-Gap, 6-Crack';\n")
60 outfile.write(
"comment on column TILB_data.NPERIOD is 'Number of periods in the module';\n")
61 outfile.write(
"comment on column TILB_data.NMODUL is 'Number of modules,in full cylinder, ")
62 outfile.write(
"used for Dphi calcuations only (Dphi = 2 pi / Nmodules)';\n")
63 outfile.write(
"comment on column TILB_data.RMIN is 'Minimal active radius';\n")
64 outfile.write(
"comment on column TILB_data.RMAX is 'Maximal active radius';\n")
65 outfile.write(
"comment on column TILB_data.RMINIMAL is 'Minimal radius of section mother (G4)';\n")
66 outfile.write(
"comment on column TILB_data.RMAXIMAL is 'Maximal radius of section mother (G4)';\n")
67 outfile.write(
"comment on column TILB_data.DZPERIO is 'Dummy';\n")
68 outfile.write(
"comment on column TILB_data.DRFRONT is 'Thickness of the front plate (in R)';\n")
69 outfile.write(
"comment on column TILB_data.DZEND is 'Thickness of the endplates (in Z) if they are equal';\n")
70 outfile.write(
"comment on column TILB_data.FLANGEX is 'End plate square hole dimension or min width for gap envelope';\n")
71 outfile.write(
"comment on column TILB_data.FLANGEY is 'End plate square hole position or max width for gap envelope';\n")
72 outfile.write(
"comment on column TILB_data.ZOFFSET is 'Offset of the module center along Z';\n")
73 outfile.write(
"comment on column TILB_data.PHIGAP is 'Design gap between modules';\n")
74 outfile.write(
"comment on column TILB_data.ISCI_ST is 'ID of the first scintillator';\n")
75 outfile.write(
"comment on column TILB_data.DZMODUL is 'Z-length of the module';\n")
76 outfile.write(
"comment on column TILB_data.DZMAST is 'Master plate thickness';\n")
77 outfile.write(
"comment on column TILB_data.DZSPAC is 'Spacer thickness';\n")
78 outfile.write(
"comment on column TILB_data.DZEND1 is 'Thickens of the end plate 1';\n")
79 outfile.write(
"comment on column TILB_data.DZEND2 is 'Thickens of the end plate 2';\n")
80 outfile.write(
"comment on column TILB_data.NGIRDER is 'Number of girder elements';\n")
81 outfile.write(
"comment on column TILB_data.NSCIN is 'Number of scintillators in the period';\n")
82 outfile.write(
"comment on column TILB_data.FINGPATTERN is 'Finger type of 2 fingers in barrel or one ")
83 outfile.write(
"finger in ext.barrel standard barrel fingers: 11 (both L and R present), ")
84 outfile.write(
"10 (L), 13 (R), 1 (no L, no R), standard ext.barrel fingers: 2 (finger present) or 0';\n")
85 outfile.write(
"comment on column TILB_data.NPERCUTPOS is 'number of cut periods at higher Z ( Z > 0 )';\n")
86 outfile.write(
"comment on column TILB_data.NPERCUTNEG is 'number of cut periods at lower Z side ( Z < 0 )';\n")
87 outfile.write(
"comment on column TILB_data.CURSCINT is 'scintillator number to describe special ITC cells';\n")
88 outfile.write(
"comment on column TILB_data.DZGIR is 'length of girder in special ITC cells';\n")
95 inpfile =
open(
"TILB-GEO-01",
"rt")
96 outfile =
open(
"TILB.sql",
"awt")
97 line = modname = comment = volline = cindx =
' '
99 n1 = n2 = n3 = n15 = n21 = n22 = n23 = n24 = n25 = n26 = 0
100 r4 = r5 = r6 = r7 = r8 = r9 = r10 = 0.0
101 r11 = r12 = r13 = r14 = r16 = r17 = r18 = r19 = r20 = r27 = 0.0
107 line = inpfile.readline()
113 name = string.split(line)
134 r11 =
float(name[10])
135 r12 =
float(name[11])
136 r13 =
float(name[12])
137 r14 =
float(name[13])
139 r16 =
float(name[15])
140 r17 =
float(name[16])
141 r18 =
float(name[17])
142 r19 =
float(name[18])
143 r20 =
float(name[19])
150 r27 =
float(name[26])
153 volline = volline+
","+
str(r7)+
","+
str(r8)+
","+
str(r9)+
","+
str(r10)+
","+
str(r11)+
","+
str(r12)
154 volline = volline+
","+
str(r13)+
","+
str(r14)+
","+
str(n15)+
","+
str(r16)+
","+
str(r17)+
","+
str(r18)
155 volline = volline+
","+
str(r19)+
","+
str(r20)+
","+
str(n21)+
","+
str(n22)+
","+
str(n23)+
","+
str(n24)
156 volline = volline+
","+
str(n25)+
","+
str(n26)+
","+
str(r27)
158 outfile.write(
"insert into TILB_data (TILB_data_id,SECTION,NPERIOD,NMODUL,RMIN,RMAX,RMINIMAL,RMAXIMAL,\n")
159 outfile.write(
"DZPERIO,DRFRONT,DZEND,FLANGEX,FLANGEY,ZOFFSET,PHIGAP,ISCI_ST,DZMODUL,DZMAST,DZSPAC,\n")
160 outfile.write(
"DZEND1,DZEND2,NGIRDER,NSCIN,FINGPATTERN,NPERCUTPOS,NPERCUTNEG,CURSCINT,DZGIR) values (\n")
161 outfile.write(volline)
162 outfile.write(
");\n")
163 outfile.write(
"insert into TILB_data2tag values ('TILB-GEO-01', ")
165 outfile.write(
");\n")
168 print ' IndexError : ',nmax,
' ',name
175 print 'Tile TILB wirh python '
177 print ' Tile Values ',
TILB(
'TILB-GEO-01')