4 from ROOT
import TCanvas, TPad, TFormula, TF1, TPaveLabel, TH1F, TFile
16 for i
in range(0,hist.GetXaxis().GetNbins()):
17 freq.append(hist.GetBinLowEdge(i+1)*pow(10,-6))
18 amps.append(hist.GetBinContent(i+1)*pow(10,-9)*3.3*pow(10,3)/4095.0)
19 for i
in range(hist.GetXaxis().GetNbins(),0,-1):
20 amps.append(hist.GetBinContent(i)*pow(10,-9)*3.3*pow(10,3)/4095.0)
21 for i
in range(0,hist.GetXaxis().GetNbins()):
22 freq.append(hist.GetBinLowEdge(hist.GetXaxis().GetNbins()+1)*pow(10,-6)+hist.GetBinLowEdge(i+1)*pow(10,-6))
27 for filename
in filenames:
30 modelFile = TFile.Open(filename,
"READ")
31 tpcName=filename.replace(
'.root',
'')
33 powerHist_ind1 = modelFile.Get(noise_type+
"powerI1")
35 powerHist_ind2 = modelFile.Get(noise_type+
"powerI2")
37 powerHist_coll = modelFile.Get(noise_type+
"powerC")
39 freq = [fr_ind1,fr_ind2,fr_coll]
40 amps = [amps_ind1,amps_ind2,amps_coll]
41 gain = [8.811970678500002e-10,8.811970678500002e-10,8.811970678500002e-10]
42 period = [400.0,400.0,400.0]
43 nsamples = [powerHist_ind1.GetXaxis().GetNbins()*2,powerHist_ind2.GetXaxis().GetNbins()*2,powerHist_coll.GetXaxis().GetNbins()*2]
44 shaping = [1.3,1.3,1.3]
45 wirelen = [8949.51,3658.0939799999996,3658.0939799999996]
48 ns = {
'period' : period[n],
49 'nsamples' : nsamples[n],
51 'shaping' : shaping[n],
52 'wirelen': wirelen[n],
56 'freqs' :
list(freq[n]),
57 'amps' :
list(amps[n])
60 json_format = json.dumps(noises,indent=4)
61 int_noise_file =
open(
'icarus_noise_model_'+noise_type+
'_TPC'+tpcName+
'.json',
'w')
62 int_noise_file.write(json_format)
63 int_noise_file.close()
68 for filename
in filenames:
70 modelFile = TFile.Open(filename,
"READ")
71 tpcName=filename.replace(
'.root',
'')
73 powerHist_ind1 = modelFile.Get(noise_type+
"powerI1")
75 powerHist_ind2 = modelFile.Get(noise_type+
"powerI2")
77 powerHist_coll = modelFile.Get(noise_type+
"powerC")
79 freq = [fr_ind1,fr_ind2,fr_coll]
80 amps = [amps_ind1,amps_ind2,amps_coll]
81 gain = [8.811970678500002e-10,8.811970678500002e-10,8.811970678500002e-10]
82 period = [400.0,400.0,400.0]
83 nsamples = [powerHist_ind1.GetXaxis().GetNbins()*2,powerHist_ind2.GetXaxis().GetNbins()*2,powerHist_coll.GetXaxis().GetNbins()*2]
84 shaping = [1.3,1.3,1.3]
89 ns_0 = {
'period' : period[0],
90 'nsamples' : nsamples[0],
92 'shaping' : shaping[0],
96 'freqs' :
list(freq[0]),
97 'amps' :
list(amps[0])
100 ns_1 = {
'period' : period[0],
101 'nsamples' : nsamples[0],
103 'shaping' : shaping[0],
107 'freqs' :
list(freq[0]),
108 'amps' :
list(amps[0])
112 for group
in range(1,66):
113 ns = {
'period' : period[0],
114 'nsamples' : nsamples[0],
116 'shaping' : shaping[0],
120 'freqs' :
list(freq[0]),
121 'amps' :
list(amps[0])
124 for group
in range(0,175):
125 ns = {
'period' : period[0],
126 'nsamples' : nsamples[0],
128 'shaping' : shaping[0],
132 'freqs' :
list(freq[1]),
133 'amps' :
list(amps[1])
136 for group
in range(0,175):
137 ns = {
'period' : period[0],
138 'nsamples' : nsamples[0],
140 'shaping' : shaping[0],
144 'freqs' :
list(freq[2]),
145 'amps' :
list(amps[2])
148 json_format = json.dumps(noises,indent=4)
149 int_noise_file =
open(
'icarus_noise_model_'+noise_type+
'_TPC'+tpcName+
'.json',
'w')
150 int_noise_file.write(json_format)
151 int_noise_file.close()
155 json_out_int =
load_noise_spectra([
"dataFFTHistosEE.root",
"dataFFTHistosEW.root",
"dataFFTHistosWE.root",
"dataFFTHistosWW.root"])
158 bashCommand =
"bzip2 -zf icarus_noise_model_*"
159 os.system(bashCommand)
160 print(
"Finished Job")
def load_coherent_noise_spectra
do one_file $F done echo for F in find $TOP name CMakeLists txt print
open(RACETRACK) or die("Could not open file $RACETRACK for writing")