source: fact/tools/rootmacros/README.txt@ 13414

Last change on this file since 13414 was 12606, checked in by lusterma, 13 years ago
various updates of the contents and the form, not finished
File size: 9.4 KB
Line 
1README of FACT svntools/rootmacros
2++++++++++++++++++++++++++++++++++
3
4
5ROOT version on ISDC fact cluster: /opt/root5.18.x86_64/bin/root for testing.
6
7ROOT macros:
8============
9
10fana2.C view the DRS data of a pixel, before and after various filter algorithms
11fbsl.C compute the baseline for all pixels, save the values in a txt file
12 and the histograms in a ROOT file
13fpeak_cdf.C extract the single photon spectra
14gainfit.C analyses the amplitude spektra of fpeak_cfd.C
15
16flightpulser.C ROOT macro for plotting the amplitudes of the external lightpulser
17tpeak.C ROOT macros to produce overlays of data around a found peak in a given window.
18
19GetDrsOffset.C ROOT macro calculating the DRS Offset calibration constants
20
21
22Calling root in batch mode (helpful for automatization):
23========================================================
24
25 root -l -q fbsl.C++'("/data00/fact-construction/raw/2011/10/26/20111026_036.fits.gz",
26 "/data00/fact-construction/raw/2011/10/26/20111026_031.drs.fits.gz",
27 "./fbsl.txt", "./20111026_036.root")'
28
29 see run.py for an example on how to run for instance fbsl.C on a list of data + calibration files
30
31
32Detailed Description of macros
33==============================
34
35fana2.C ROOT macro for viewing pipeline data
36
37 function declaration:
38
39 int fana2(
40 char *datafilename = "../raw/20110916_025.fits", // input file fits or fits.gz
41 const char *drsfilename = "../raw/20110916_024.drs.fits", // DRS calibration file drs.fits or drs.fits.gz
42 int pixelnr = 0, // which pixel in range(1440)
43 int firstevent = 0, // first event to display
44 int nevents = -1 ) // number of events to display
45
46 description:
47
48 the raw data are read and the drs calibration is applied
49 spikes (DRS feature) are removed (replaced by the average of the neighboring channels
50 a sliding average filter is applied, default length: 16 slices
51 a constant fraction disciminator filter is applied
52
53 online display:
54
55 canvas 1: DRS Waveform
56 1) raw DRS pipeline
57 2) estimator for spike detection DRS pipeline
58 3) correct raw data (spikes removed)
59
60 canvas 2: filtered DRS Waveform
61 1) sliding average FIR filter response
62 2) 1) + constant fraction discriminator FIR filter respones
63 3) 2) + sliding average FIR filter respone
64 ( not used just left for historical reasons )
65
66 remarks:
67
68 region of interest of the data file and the drs calibration file must agree
69
70------------------------------------------------------------------------------------
71
72fbsl.C ROOT Macro computing the baseline for each pixel
73
74 function declaration:
75
76 int fbsl(
77 const char *datafilename = "path-to-datafile.fits.gz",
78 const char *drsfilename = "path-to-calibfile.drs.fits.gz",
79 const char *TextOutFileName = "./appendfile.txt",
80 const char *RootOutFileName = "./datafile.root",
81 int firstevent = 0,
82 int nevents = -1,
83 int firstpixel = 0,
84 int npixel = -1,
85 bool produceGraphic = false
86 )
87
88 description:
89
90 estimatin of the baseline (following T. Ph. Kraehenbuehl:
91 histogram the concents of all slices and all events individually for each pixel
92 the value with the maximum bin content corresponds to the baseline
93
94 create summary histograms with the estimated baselines
95
96 create summary histograms with the rms values of the single pixel histo's
97
98 output:
99
100 text file with the estimated baseline values
101
102 root file containing
103
104 summary histograms for baseline estimates and rms
105 individual histogram of each single pixel
106
107 remarks:
108
109 the rms is not the rms of the baseline, but the rms of the complete pixel histograms
110
111 the 4 ints: firstevent, nevents, firstpixel, npixel can be used to
112 perform the calculatation on a subset
113
114 if produceGraphic == true, two Canvases with overview histograms are opened
115
116-----------------------------------------------------------------------------------------------
117
118fpeak_cfd.C ROOT macro creating an amplitude spektrum for each pixel
119
120 function declaration:
121
122 int fpeak(
123 char *datafilename = "data/20111016_013.fits.gz",
124 const char *drsfilename = "../../20111016_011.drs.fits.gz",
125 const char *OutRootFileName = "../analysis/fpeak_cdf.Coutput.root",
126 int firstevent = 0,
127 int nevents = -1,
128 int firstpixel = 0,
129 int npixel = -1,
130 bool spikeDebug = false,
131 int avg1 = 14,
132 int avg2 = 8,
133 int verbosityLevel = 1, // different verbosity levels can be implemented here
134 bool ProduceGraphic = true
135 )
136
137 description:
138
139 1) using the constant fraction discriminator FIR filtered data peaks of single photons are searched
140 2) a negative slope zero crossings indicates the position of a peak
141 3) additional cuts confirm the single photon peak and verify irs separation from other peask
142 in order to avoid overlaps of several pulses
143 4) the amplitudes of the identified peaks are histogrammed in a 2d histo ( amplitude vs pixel )
144
145 outputs:
146
147 root file containing the 2d histogram of the amplitudes vs pixel
148
149 remark:
150 the two integers 'avg1' and 'avg2' are still present for debugging...
151 two sliding average filters are used, and these are the HALFwidths of these filters.
152
153-----------------------------------------------------------------------------------------------
154
155gainfit.C ROOT macro for analysing the amplitude spektra of fpeak_cfd.C
156
157 this is far from beeing any good, but have a look yourself.
158
159 call it like this:
160 gainfit("rootfilename.root", "textoutfilename.txt" , false);
161
162 its short ... so I'd rather not explain it here.
163 I guess one can try for many other fit functions, and play with Parameter
164 bounds, but I had no time yet.
165 Thomas Krähenbühl once send me a mail containing a lot of ideas, and I guess
166 in gainanalysis.C there is a lot more ...
167 these scripts should maybe be joined soon ...somehow.
168 D.Neise 20111104
169
170-----------------------------------------------------------------------------------------------
171
172flightpulser.C ROOT macro for plotting the amplitudes of the external lightpulser
173
174 call it e.g. like this
175 root
176 flightpulser.C+'("data/20111029_017.fits.gz","data/20111029_013.drs.fits.gz","../analysis/20111029_017-013_fpeak_cfd.root",
177 0, 100, 0,-1)'
178
179 to look at the amplitudes of all camera pixel for 100 events.
180 you get a color coded TH2F so you can look at the amplitude distribution
181 yourself.
182
183 this macro is based on fpeak_cdf.C pretty much.
184 I basically use the same steps, but in the end I just fill the absolute
185 maximum into the TH2F.
186
187 The macro is pretty slow (about 1.5 min for 100 full camera events) so I
188 switched off the sliding averages...
189
190 but it didn't help much...
191
192 I am still not sure how to improve the speed of these macros.....
193
194-----------------------------------------------------------------------------------------------
195
196tpeak.C ROOT macros to produce overlays of data around a found peak in a given window.
197
198 int tpeak(
199 char *datafilename = "data/20111016_013.fits.gz",
200 const char *drsfilename = "../../20111016_011.drs.fits.gz",
201 const char *OutRootFileName = "../analysis/fpeak_cdf.Coutput.root",
202 int firstevent = 0,
203 int nevents = -1,
204 int firstpixel = 0,
205 int npixel = -1,
206 bool spikeDebug = false,
207 int avg1 = 14,
208 int avg2 = 8,
209 int OverlayWindowLeft = 50,
210 int OverlayWindowRight = 150,
211 int verbosityLevel = 1, // different verbosity levels can be implemented here
212 bool ProduceGraphic = true
213 )
214
215 call it like this, if you want to overlay a certain number of peaks for a single channel
216 tpeak("data/20111029_017.fits.gz","data/20111029_013.drs.fits.gz","test.root",0,1000,333,1,true,0,0,50,150,1,true)
217
218 set the first bool 'spikeDebug' to false in order to overlay quicker ... every 50th event the canvas is updated.
219 depending on what kind of peaks you like to detect the sliding average filters
220 should be set to e.g. 14,8 for singles in a quiet G-APD pedestal run
221 or 0,0 if you want to see just every thing that might be a signal...
222
223 the window size 50,150 means .. 50 slices to the left of the maximum and 150
224 to the right.
225
226 there is a bit of cleaning included in the file, maybe you want to switch it
227 off, then just search for the calls of these methods...
228 removeMaximaBelow( *zXings, 3.0);
229 removeRegionWithMaxOnEdge( *zXings, 2);
230 removeRegionOnFallingEdge( *zXings, 100);
231
232 and comment them out or play with the settings.
233
234 they are defined in zerosearch.C, which is maybe a bad choice...
235
236---------------------------------------------------------------------------------------
237
238GetDrsOffset.C ROOT macro calculating the DRS Offset calibration constants
239
240 -- TESTING --
241
242 In case you have taken a file, which is good for calibrating the DRS Offset,
243 then you can calculate the offset using this macro.
244 It just calculates the mean value and the RMS for all DRS bins of all pixels
245 in the file, for the number of events you like.
246
247 The output is two TH2Fs, which contain all requested data on the one hand and
248 on the other hand are good for having an overview.
249
250 call it like this:
251 GetDrsOffset("path/20111111_001.fits.gz")
252
253 GetDrsOffset("path/20111111_001.fits.gz", "foo/output.root")
254 saves the output to a root file
255
256 GetDrsOffset("path/20111111_001.fits.gz", "", "bar/test.bin")
257 saves the output to a binary file.
258
259 GetDrsOffset("path/20111111_001.fits.gz", "foo/out.root", "bar/test.bin", false, -1)
260 produces all output, but does not open a ROOT Canvas.
261 -1 : means process all events in the given file.
262
Note: See TracBrowser for help on using the repository browser.