Changeset 12606 for fact/tools/rootmacros
- Timestamp:
- 11/21/11 22:11:57 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/tools/rootmacros/README.txt
r12581 r12606 1 1 README of FACT svntools/rootmacros 2 3 on the ISDC cluster, I used /opt/root5.18.x86_64/bin/root for testing. 4 2 ++++++++++++++++++++++++++++++++++ 3 4 5 ROOT version on ISDC fact cluster: /opt/root5.18.x86_64/bin/root for testing. 6 7 ROOT macros: 8 ============ 9 10 fana2.C view the DRS data of a pixel, before and after various filter algorithms 11 fbsl.C compute the baseline for all pixels, save the values in a txt file 12 and the histograms in a ROOT file 13 fpeak_cdf.C extract the single photon spectra 14 gainfit.C analyses the amplitude spektra of fpeak_cfd.C 15 16 flightpulser.C ROOT macro for plotting the amplitudes of the external lightpulser 17 tpeak.C ROOT macros to produce overlays of data around a found peak in a given window. 18 19 GetDrsOffset.C ROOT macro calculating the DRS Offset calibration constants 20 21 22 Calling 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 32 Detailed Description of macros 33 ============================== 34 35 fana2.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 5 72 fbsl.C ROOT Macro computing the baseline for each pixel 6 the function is declared as: 7 int fbsl( 8 const char *datafilename = "path-to-datafile.fits.gz", 9 const char *drsfilename = "path-to-calibfile.drs.fits.gz", 10 const char *TextOutFileName = "./appendfile.txt", 11 const char *RootOutFileName = "./datafile.root", 12 int firstevent = 0, 13 int nevents = -1, 14 int firstpixel = 0, 15 int npixel = -1, 16 bool produceGraphic = false 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 17 86 ) 18 87 19 the baseline and its rms is calculated for each pixel based on the data, 20 given in the datafile. 21 the results are appended to a textfile 22 and the histograms ,which were used for caluculation, as well as some 23 overviews are stored in a root file. 24 the 4 ints: firstevent, nevents, firstpixel, npixel can be used to calculate 25 only for a subset 26 the last bool can be set to true, which will open 2 Canvases with overview 27 histograms. 28 29 for automatic production of baseline analysis one can call this macro like 30 this: 31 e.g. 32 root -l -q fbsl.C++'("/data00/fact-construction/raw/2011/10/26/20111026_036.fits.gz", "/data00/fact-construction/raw/2011/10/26/20111026_031.drs.fits.gz", "./fbsl.txt", "./20111026_036.root")' 33 34 35 ----------------------------------------------------------------------------------------------- 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 36 118 fpeak_cfd.C ROOT macro creating an amplitude spektrum for each pixel 37 119 38 int fpeak( 39 char *datafilename = "data/20111016_013.fits.gz", 40 const char *drsfilename = "../../20111016_011.drs.fits.gz", 41 const char *OutRootFileName = "../analysis/fpeak_cdf.Coutput.root", 42 int firstevent = 0, 43 int nevents = -1, 44 int firstpixel = 0, 45 int npixel = -1, 46 bool spikeDebug = false, 47 int avg1 = 14, 48 int avg2 = 8, 49 int verbosityLevel = 1, // different verbosity levels can be implemented here 50 bool ProduceGraphic = true 51 ) 52 53 the peaks are search, using the constant fraction discriminator, implemented 54 as a FIR filter, which outputs a waveform, which rising edge zero crossings 55 show the position of a peak. 56 57 the two integers 'avg1' and 'avg2' are still present for debugging... 58 two sliding average filters are beeing used, and these are the HALFwidths of 59 these filters. 60 61 The amplitude spektra are produced as a TH2F with the pixels on its x-Axis. 62 For further analysy the ROOT macro gainfit.C may be used... 63 64 65 ----------------------------------------------------------------------------------------------- 66 67 gainfit.C ROOT macro for analysing the amplitude spektra of fpeak_cfd.C 68 69 this is far from beeing any good, but have a look yourself. 70 71 call it like this: 72 gainfit("rootfilename.root", "textoutfilename.txt" , false); 73 74 its short ... so I'd rather not explain it here. 75 I guess one can try for many other fit functions, and play with Parameter 76 bounds, but I had no time yet. 77 Thomas Krähenbühl once send me a mail containing a lot of ideas, and I guess 78 in gainanalysis.C there is a lot more ... 79 these scripts should maybe be joined soon ...somehow. 80 D.Neise 20111104 81 82 83 ----------------------------------------------------------------------------------------------- 84 flightpulser.C ROOT macro for plotting the amplitudes of the external lightpulser 85 86 call it e.g. like this 87 root 88 flightpulser.C+'("data/20111029_017.fits.gz","data/20111029_013.drs.fits.gz","../analysis/20111029_017-013_fpeak_cfd.root", 89 0, 100, 0,-1)' 90 91 to look at the amplitudes of all camera pixel for 100 events. 92 you get a color coded TH2F so you can look at the amplitude distribution 93 yourself. 94 95 this macro is based on fpeak_cdf.C pretty much. 96 I basically use the same steps, but in the end I just fill the absolute 97 maximum into the TH2F. 98 99 The macro is pretty slow (about 1.5 min for 100 full camera events) so I 100 switched off the sliding averages... 101 102 but it didn't help much... 103 104 I am still not sure how to improve the speed of these macros..... 105 106 107 ----------------------------------------------------------------------------------------------- 108 tpeak.C ROOT macros to produce overlays of data around a found peak in a given 109 window. 110 111 int tpeak( 112 char *datafilename = "data/20111016_013.fits.gz", 113 const char *drsfilename = "../../20111016_011.drs.fits.gz", 114 const char *OutRootFileName = "../analysis/fpeak_cdf.Coutput.root", 115 int firstevent = 0, 116 int nevents = -1, 117 int firstpixel = 0, 118 int npixel = -1, 119 bool spikeDebug = false, 120 int avg1 = 14, 121 int avg2 = 8, 122 int OverlayWindowLeft = 50, 123 int OverlayWindowRight = 150, 124 int verbosityLevel = 1, // different verbosity levels can be implemented 125 here 126 bool ProduceGraphic = true 127 ) 128 129 call it like this, if you want to overlay a certain number of peaks for a 130 single channel 131 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) 132 133 set the first bool 'spikeDebug' to false in order to overlay quicker ... every 134 50th event the canvas is updated. 135 depending on what kind of peaks you like to detect the sliding average filters 136 should be set to e.g. 14,8 for singles in a quiet G-APD pedestal run 137 or 0,0 if you want to see just every thing that might be a signal... 138 139 the window size 50,150 means .. 50 slices to the left of the maximum and 150 140 to the right. 141 142 there is a bit of cleaning included in the file, maybe you want to switch it 143 off, then just search for the calls of these methods... 144 removeMaximaBelow( *zXings, 3.0); 145 removeRegionWithMaxOnEdge( *zXings, 2); 146 removeRegionOnFallingEdge( *zXings, 100); 147 148 and comment them out or play with the settings. 149 150 they are defined in zerosearch.C, which is maybe a bad choice... 151 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 155 gainfit.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 172 flightpulser.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 196 tpeak.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... 152 235 153 236 --------------------------------------------------------------------------------------- 154 GetDrsOffset.C - a ROOT macro calculating the DRS Offset calibration constants 155 156 -- TESTING -- 157 158 In case you have taken a file, which is good for calibrating the DRS Offset, 237 238 GetDrsOffset.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, 159 243 then you can calculate the offset using this macro. 160 244 It just calculates the mean value and the RMS for all DRS bins of all pixels … … 177 261 -1 : means process all events in the given file. 178 262 179 ---------------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.