All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
convert_Noise_ROOTtoJSON Namespace Reference

Functions

def get_freq_amps
 
def load_noise_spectra
 
def load_coherent_noise_spectra
 

Variables

tuple json_out_int = load_noise_spectra(["dataFFTHistosEE.root","dataFFTHistosEW.root","dataFFTHistosWE.root","dataFFTHistosWW.root"])
 
tuple json_out_coh = load_coherent_noise_spectra(["dataFFTHistosEE.root","dataFFTHistosEW.root","dataFFTHistosWE.root","dataFFTHistosWW.root"])
 
string bashCommand = "bzip2 -zf icarus_noise_model_*"
 

Function Documentation

def convert_Noise_ROOTtoJSON.get_freq_amps (   hist)

Definition at line 13 of file convert_Noise_ROOTtoJSON.py.

13 
14 def get_freq_amps(hist):
15  freq=[]
16  amps=[]
17  for i in range(0,hist.GetXaxis().GetNbins()):
18  freq.append(hist.GetBinLowEdge(i+1)*pow(10,-6))
19  amps.append(hist.GetBinContent(i+1)*pow(10,-9)*3.3*pow(10,3)/4095.0)#*pow(10,-9))#*pow(10,-9))
20  for i in range(hist.GetXaxis().GetNbins(),0,-1):
21  amps.append(hist.GetBinContent(i)*pow(10,-9)*3.3*pow(10,3)/4095.0)#*pow(10,-9))
22  for i in range(0,hist.GetXaxis().GetNbins()):
23  freq.append(hist.GetBinLowEdge(hist.GetXaxis().GetNbins()+1)*pow(10,-6)+hist.GetBinLowEdge(i+1)*pow(10,-6))
24  return freq,amps
def convert_Noise_ROOTtoJSON.load_coherent_noise_spectra (   filenames)

Definition at line 66 of file convert_Noise_ROOTtoJSON.py.

66 
67 def load_coherent_noise_spectra(filenames):
68  noise_type = "coh"
69  for filename in filenames:
70  noises = list()
71  modelFile = TFile.Open(filename,"READ")
72  tpcName=filename.replace('.root','')
73  tpcName=tpcName[-2:]
74  powerHist_ind1 = modelFile.Get(noise_type+"powerI1")
75  fr_ind1,amps_ind1 = get_freq_amps(powerHist_ind1)
76  powerHist_ind2 = modelFile.Get(noise_type+"powerI2")
77  fr_ind2,amps_ind2 = get_freq_amps(powerHist_ind2)
78  powerHist_coll = modelFile.Get(noise_type+"powerC")
79  fr_coll,amps_coll = get_freq_amps(powerHist_coll)
80  freq = [fr_ind1,fr_ind2,fr_coll]
81  amps = [amps_ind1,amps_ind2,amps_coll]
82  gain = [8.811970678500002e-10,8.811970678500002e-10,8.811970678500002e-10]
83  period = [400.0,400.0,400.0]
84  nsamples = [powerHist_ind1.GetXaxis().GetNbins()*2,powerHist_ind2.GetXaxis().GetNbins()*2,powerHist_coll.GetXaxis().GetNbins()*2]
85  shaping = [1.3,1.3,1.3]
86  const = [0.0,0.0,0.0]
87 
88  #Due to the bug in WC code 1st set of channels has only channel 0 (it will have NO coherent noise)
89  #the next group would be 31 channel and the rest are all 32 channel group
90  ns_0 = { 'period' : period[0],
91  'nsamples' : nsamples[0],
92  'gain' : gain[0],
93  'shaping' : shaping[0],
94  'wire-delta': 1.0,
95  'const' : const[0],
96  'tpcname' : tpcName,
97  'freqs' : list(freq[0]),
98  'amps' : list(amps[0])
99  }
100  noises.append(ns_0)
101  ns_1 = { 'period' : period[0],
102  'nsamples' : nsamples[0],
103  'gain' : gain[0],
104  'shaping' : shaping[0],
105  'wire-delta': 31.0,
106  'const' : const[0],
107  'tpcname' : tpcName,
108  'freqs' : list(freq[0]),
109  'amps' : list(amps[0])
110  }
111  noises.append(ns_1)
112  #Group for induction 1 tarts from 1 to accomodate for the bug
113  for group in range(1,66):#72
114  ns = { 'period' : period[0],
115  'nsamples' : nsamples[0],
116  'gain' : gain[0],
117  'shaping' : shaping[0],
118  'wire-delta': 32.0,
119  'const' : const[0],
120  'tpcname' : tpcName,
121  'freqs' : list(freq[0]),
122  'amps' : list(amps[0])
123  }
124  noises.append(ns)
125  for group in range(0,175):#180
126  ns = { 'period' : period[0],
127  'nsamples' : nsamples[0],
128  'gain' : gain[0],
129  'shaping' : shaping[0],
130  'wire-delta': 32.0,
131  'const' : const[0],
132  'tpcname' : tpcName,
133  'freqs' : list(freq[1]),
134  'amps' : list(amps[1])
135  }
136  noises.append(ns)
137  for group in range(0,175):#180
138  ns = { 'period' : period[0],
139  'nsamples' : nsamples[0],
140  'gain' : gain[0],
141  'shaping' : shaping[0],
142  'wire-delta': 32.0,
143  'const' : const[0],
144  'tpcname' : tpcName,
145  'freqs' : list(freq[2]),
146  'amps' : list(amps[2])
147  }
148  noises.append(ns)
149  json_format = json.dumps(noises,indent=4)
150  int_noise_file = open('icarus_noise_model_'+noise_type+'_TPC'+tpcName+'.json','w')
151  int_noise_file.write(json_format)
152  int_noise_file.close()
153  return 1
154 
print("Start Job")
do one_file $F done echo for F in find $TOP name CMakeLists txt print
list
Definition: file_to_url.sh:28
open(RACETRACK) or die("Could not open file $RACETRACK for writing")
def convert_Noise_ROOTtoJSON.load_noise_spectra (   filenames)

Definition at line 25 of file convert_Noise_ROOTtoJSON.py.

25 
26 def load_noise_spectra(filenames):
27  noise_type = "int"
28  for filename in filenames:
29 
30  noises = list()
31  modelFile = TFile.Open(filename,"READ")
32  tpcName=filename.replace('.root','')
33  tpcName=tpcName[-2:]
34  powerHist_ind1 = modelFile.Get(noise_type+"powerI1")
35  fr_ind1,amps_ind1 = get_freq_amps(powerHist_ind1)
36  powerHist_ind2 = modelFile.Get(noise_type+"powerI2")
37  fr_ind2,amps_ind2 = get_freq_amps(powerHist_ind2)
38  powerHist_coll = modelFile.Get(noise_type+"powerC")
39  fr_coll,amps_coll = get_freq_amps(powerHist_coll)
40  freq = [fr_ind1,fr_ind2,fr_coll]
41  amps = [amps_ind1,amps_ind2,amps_coll]
42  gain = [8.811970678500002e-10,8.811970678500002e-10,8.811970678500002e-10]
43  period = [400.0,400.0,400.0]
44  nsamples = [powerHist_ind1.GetXaxis().GetNbins()*2,powerHist_ind2.GetXaxis().GetNbins()*2,powerHist_coll.GetXaxis().GetNbins()*2]
45  shaping = [1.3,1.3,1.3]
46  wirelen = [8949.51,3658.0939799999996,3658.0939799999996]
47  const = [0.0,0.0,0.0]
48  for n in range(0,3):
49  ns = { 'period' : period[n],
50  'nsamples' : nsamples[n],
51  'gain' : gain[n],
52  'shaping' : shaping[n],
53  'wirelen': wirelen[n],
54  'const' : const[n],
55  'plane' : n,
56  'tpcname' : tpcName,
57  'freqs' : list(freq[n]),
58  'amps' : list(amps[n])
59  }
60  noises.append(ns)
61  json_format = json.dumps(noises,indent=4)
62  int_noise_file = open('icarus_noise_model_'+noise_type+'_TPC'+tpcName+'.json','w')
63  int_noise_file.write(json_format)
64  int_noise_file.close()
65  return 1
list
Definition: file_to_url.sh:28
open(RACETRACK) or die("Could not open file $RACETRACK for writing")

Variable Documentation

string convert_Noise_ROOTtoJSON.bashCommand = "bzip2 -zf icarus_noise_model_*"

Definition at line 158 of file convert_Noise_ROOTtoJSON.py.

tuple convert_Noise_ROOTtoJSON.json_out_coh = load_coherent_noise_spectra(["dataFFTHistosEE.root","dataFFTHistosEW.root","dataFFTHistosWE.root","dataFFTHistosWW.root"])

Definition at line 156 of file convert_Noise_ROOTtoJSON.py.

tuple convert_Noise_ROOTtoJSON.json_out_int = load_noise_spectra(["dataFFTHistosEE.root","dataFFTHistosEW.root","dataFFTHistosWE.root","dataFFTHistosWW.root"])

Definition at line 155 of file convert_Noise_ROOTtoJSON.py.