7 outfile =
open(
"CUTS.sql",
"wt")
8 outfile.write(
"SET echo OFF;\n")
9 outfile.write(
"set linesize 132;\n")
12 outfile.write(
"create table CUTS_data (\n")
13 outfile.write(
"CUTS_data_id number(10),\n")
14 outfile.write(
"volume varchar2(255),\n")
15 outfile.write(
"dX1 float(63),\n")
16 outfile.write(
"dX2 float(63),\n")
17 outfile.write(
"dY1 float(63),\n")
18 outfile.write(
"dY2 float(63),\n")
19 outfile.write(
"dZ1 float(63),\n")
20 outfile.write(
"Xpos float(63),\n")
21 outfile.write(
"Ypos float(63) \n")
22 outfile.write(
") ;\n")
24 outfile.write(
"alter table CUTS_data add constraint CUTS_data_pk\n")
25 outfile.write(
"primary key (CUTS_data_id);\n")
27 outfile.write(
"create table CUTS_data2tag (\n")
28 outfile.write(
" CUTS_vers varchar2(255),\n")
29 outfile.write(
" CUTS_data_id number(10)\n")
30 outfile.write(
") ;\n")
37 outfile =
open(
"CUTS.sql",
"awt")
39 outfile.write(
"comment on column CUTS_data.CUTS_data_id is 'TileCal CUTS, Section';\n")
40 outfile.write(
"comment on column CUTS_data.volume is 'Volume name';\n")
41 outfile.write(
"comment on column CUTS_data.dX1 is 'TRD shape, dX1/2 [mm]';\n")
42 outfile.write(
"comment on column CUTS_data.dX2 is 'TRD shape, dX2/2 [mm]';\n")
43 outfile.write(
"comment on column CUTS_data.dY1 is 'TRD shape, dY1/2 [mm]';\n")
44 outfile.write(
"comment on column CUTS_data.dY2 is 'TRD shape, dY2/2 [mm]';\n")
45 outfile.write(
"comment on column CUTS_data.dZ1 is 'TRD shape, dZ1/2 [mm]';\n")
46 outfile.write(
"comment on column CUTS_data.Xpos is 'X Position [mm]';\n")
47 outfile.write(
"comment on column CUTS_data.Ypos is 'Y Position [mm]';\n")
54 inpfile =
open(
"CUTS-00",
"rt")
55 outfile =
open(
"CUTS.sql",
"awt")
56 line =volname =modname =comment =volline =cindx =
' '
60 r3 =r4 =r5 =r6 =r7 =r8 =r9 =0.0
66 line = inpfile.readline()
72 name = string.split(line)
92 volline =
str(indx)+
",'"+volname+
"',"+
str(r2)+
","+
str(r3)+
","+
str(r4)+
","+
str(r5)
93 volline = volline+
","+
str(r6)+
","+
str(r7)+
","+
str(r8)
95 outfile.write(
"insert into CUTS_data (CUTS_data_id, volume,dX1,dX2,dY1,dY2,dZ1,Xpos,Ypos) values (\n")
96 outfile.write(volline)
98 outfile.write(
"insert into CUTS_data2tag values ('CUTS-00', ")
100 outfile.write(
");\n")
103 print ' IndexError : ',nmax,
' ',name
110 print 'Tile CUTS wirh python '
112 print ' Tile Values ',
CUTS(
'CUTS-00')