6 import CalibdDbDefaults
8 cool_database_strings=[CalibDbDefaults.cool_database_string, CalibDbDefaults.cool_database_string]
9 cool_folders=[CalibDbDefaults.cool_folders[calibtype], CalibDbDefaults.cool_folders[calibtype]]
10 cool_tags=[
'COMCOND-BLKPST-004-07',
'COMCOND-BLKPST-004-07']
11 run_numbers=[
None,
None]
14 sys.stderr.write(
"Usage: " + argv0 +
" [-h] [-s <cool database string>] [-f <cool folder>] [-t <cool tag>] <run number 1> [-s <cool database string>] [-f <cool folder>] [-t <cool tag>] <run number 2> <root file>\n")
20 optlist, args = getopt.getopt(theArgs,
'hs:f:t:')
22 for opt, oa
in optlist:
25 cool_database_strings[i] =
'sqlite://;schema=' + oa +
';dbname=COMP200'
28 cool_database_strings[i] = oa
40 sys.stderr.write(
"Error in commandline!\n")
43 run_numbers[i]=
int(args[0])
45 sys.stderr.write(
"Error in commandline!\n")
50 sys.stderr.write(
"Error in commandline!\n")
55 print (cool_database_strings)
61 sys.argv=[sys.argv[0],
'-b']
72 cool_tags[i] =
GetFolderTag(cool_database_strings[i], cool_folders[i])
73 print (
"Cool database: " + cool_database_strings[i] +
" " + cool_folders[i] +
" " + cool_tags[i] +
" " +
str(run_numbers[i]))
74 cool_t0s.append(
ReadT0Cool(cool_database_strings[i], cool_folders[i], cool_tags[i], run_numbers[i]))
80 outfile=TFile(outfile_nm,
"RECREATE")
81 tree=TTree(
"tree",
"t0 differences")
86 tree.Branch(
"station_nm", station_nm,
"station_nm/C")
87 tree.Branch(
"station_phi", station_phi,
"station_phi/I")
88 tree.Branch(
"station_eta", station_eta,
"station_eta/I")
98 n_tubes.append(
array(
'i', [0]))
99 tree.Branch(
"n_tubes_" +
str(i), n_tubes[-1],
"n_tubes_" +
str(i) +
"/I")
100 t0.append(
array(
'f', 432*[0.0]))
101 tree.Branch(
"t0_" +
str(i), t0[-1],
"t0_" +
str(i) +
"[n_tubes_" +
str(i) +
"]/F")
102 t0_mean.append(
array(
'f', [0.0]))
103 tree.Branch(
"t0_mean_" +
str(i), t0_mean[-1],
"t0_mean_" +
str(i) +
"/F")
104 t0_min.append(
array(
'f', [0.0]))
105 tree.Branch(
"t0_min_" +
str(i), t0_min[-1],
"t0_min_" +
str(i) +
"/F")
106 t0_max.append(
array(
'f', [0.0]))
107 tree.Branch(
"t0_max_" +
str(i), t0_max[-1],
"t0_max_" +
str(i) +
"/F")
110 for ident
in all_stations:
112 station_nm[i]=ident[0][i]
113 station_phi[0]=ident[1]
114 station_eta[0]=ident[2]
116 if not ident
in cool_t0s[i]:
125 theT0s=cool_t0s[i][ident]
126 n_tubes[i][0]=len(theT0s)
127 for j
in range(n_tubes[i][0]):
128 t0_mean[i][0]+=theT0s[j][0]
129 if t0_min[i][0]>theT0s[j][0]:
130 t0_min[i][0]=theT0s[j][0]
131 if t0_max[i][0]<theT0s[j][0]:
132 t0_max[i][0]=theT0s[j][0]
133 t0[i][j]=theT0s[j][0]
134 t0_mean[i][0]/=
float(n_tubes[i][0])