MiniballSort
Loading...
Searching...
No Matches
Calibration.cc
Go to the documentation of this file.
1#include "Calibration.hh"
2
5
6void FebexMWD::DoMWD() {
7
8 // For now use James' naming convention and switch later
9 unsigned int L = rise_time + 3; // 3 clock cycles delay in VHDL
10 unsigned int M = window + 3; // 3 clock cycles delay in VHDL
11 unsigned int torr = decay_time;
12 //unsigned int cfd_trig_delay = M + flat_top;
13
14 // Get the trace length
15 unsigned int trace_length = trace.size();
16
17 // Baseline energy estimation
18 float baseline_energy = 0.0;
19
20 // resize vectors
21 stage1.resize( trace_length, 0.0 );
22 stage2.resize( trace_length, 0.0 );
23 stage3.resize( trace_length, 0.0 );
24 stage4.resize( trace_length, 0.0 );
25 differential.resize( trace_length, 0.0 );
26 shaper.resize( trace_length, 0.0 );
27 cfd.resize( trace_length, 0.0 );
28
29 // Initialise the clipped flag to false
30 clipped = false;
31
32 // skip first few samples?
33 unsigned int skip = 8;
34
35 // Loop over trace and analyse
36 for( unsigned int i = 0; i < trace_length; ++i ) {
37
38 // Check if we are clipped
39 if( trace[i] == 0 || (trace[i] & 0x0000FFFF) == 0x0000FFFF )
40 clipped = true;
41
42 // Make some default values for derived pulses
43 differential[i] = 0;
44 shaper[i] = 0;
45 cfd[i] = 0;
46 //stage1[i] = 0;
47 //stage2[i] = 0;
48 //stage3[i] = 0;
49 //stage4[i] = 0;
50
51 // James' simple CFD currently on firmware
52 shaper[i] = trace[i];
53 fraction = 1.0;
54
55 // Shaped pulse
56 if( i >= cfd_shaping_time + skip && i >= cfd_integration_time + skip ) {
57
58 // James - differential-integrating shaper
60 for( unsigned int j = 1; j <= cfd_integration_time; ++j )
61 shaper[i] += differential[i-j];
63
64
65 // Liam - simple differential shaper
66 //shaper[i] = trace[i] - trace[i-cfd_shaping_time];
67
68 }
69
70 // CFD trace, do triggering later
71 if( i >= cfd_delay + skip ) {
72
73 // James + Liam both the same here
74 cfd[i] = fraction * shaper[i];
75 cfd[i] -= shaper[i-cfd_delay];
76
77 }
78
79 // Now we need to be longer than M
80 if( i >= M + skip ) {
81
82 // MWD stage 1 - difference
83 // this is 'D' in James' MATLAB code
84 stage1[i] = (int)trace[i];
85 stage1[i] -= (int)trace[i-M];
86
87
88 // MWD stage 2 - remove decay and average
89 // this is 'MA' in James' MATLAB code
90 stage2[i] = 0;
91 for( unsigned int j = 1; j <= M; ++j )
92 stage2[i] += (int)trace[i-j];
93 stage2[i] /= torr;
94
95 // MWD stage 3 - moving average
96 // this is 'MWD' in James' MATLAB code
97 stage3[i] = stage1[i] + stage2[i];
98
99 }
100
101 // MWD stage 4 - energy averaging
102 // This is 'T' in James' MWD code
103 if( i >= L + skip ){
104
105 for( unsigned int j = 1; j <= L; ++j )
106 stage4[i] += stage3[i-j];
107
108 stage4[i] /= L;
109
110 }
111
112 } // loop over trace
113
114
115 // Loop now over the CFD trace until we trigger
116 // This is not the same as James' trigger, but it's better
117 // plus he has updated his CFD and I don't have the new one
118 for( unsigned int i = skip; i < trace_length; ++i ) {
119
120 // Trigger when we pass the threshold on the CFD
121 if( i > cfd_delay + skip &&
122 ( ( cfd[i] > threshold && threshold > 0 ) ||
123 ( cfd[i] < threshold && threshold < 0 ) ) ) {
124
125 // Mark the arming threshold point
126 unsigned int armed_at = i;
127
128 // Find zero crossing - Liam version, but James effects the same thing
129 bool xing = false;
130 while( !xing && i < trace_length ) {
131
132 // Move to the next sample
133 i++;
134
135 // Reject incorrect polarity - Liam version, but James effects the same thing
136 if( threshold < 0 && cfd[i-1] > 0 ) continue;
137 if( threshold > 0 && cfd[i-1] < 0 ) continue;
138
139 // Found a zero-crossing
140 if( cfd[i] * cfd[i-1] < 0 ) xing = true;
141
142 }
143
144 // If we didn't find a crossing, stop now
145 if( !xing ) continue;
146
147
148 // Check we have enough trace left to analyse
149 if( trace_length - i < flat_top )
150 break;
151
152 // Mark the CFD time - James
153 cfd_list.push_back( i );
154
155 // Mark the CFD time - Liam
156 //float cfd_time = (float)i / TMath::Abs(cfd[i]);
157 //cfd_time += (float)(i-1) / TMath::Abs(cfd[i-1]);
158 //cfd_time /= 1.0 / TMath::Abs(cfd[i]) + 1.0 / TMath::Abs(cfd[i-1]);
159 //cfd_list.push_back( cfd_time );
160
161 // Baseline estimation comes from averaged trace
162 // Just in case a trigger comes before the baseline length, use whatever we can
163 if( cfd_list.size() == 1 ) {
164
165 // First trigger with good baseline
166 if( i >= baseline_length )
167 baseline_energy = stage4[i-baseline_length];
168
169 // Or just use the first sample
170 else baseline_energy = stage4[0];
171 }
172
173 else {
174
175 // Not the first trigger but still with good baseline
176 if( i >= baseline_length + cfd_list.back() )
177 baseline_energy = stage4[i-baseline_length];
178
179 // Otherwise don't bother updating baseline, assume its the same
180
181 }
182
183 // move to peak of the flat top
184 i += flat_top;
185
186 // assess the energy from stage 4 and push back
187 energy_list.push_back( stage4[i] - baseline_energy );
188 //energy_list.push_back( stage4[i] );
189
190 // Move to the end of the whole thing
191 //i += M + L - flat_top;
192
193 // Check we are beyond the trigger hold off
194 if( i < armed_at + cfd_hold )
195 i = armed_at + cfd_hold;
196
197 } // threshold passed
198
199 } // loop over CFD
200
201 return;
202
203}
204
205MiniballCalibration::MiniballCalibration( std::string filename, std::shared_ptr<MiniballSettings> myset ) {
206
207 SetFile( filename );
208 set = myset;
209 fRand = std::make_unique<TRandom3>();
210 default_qint = false;
211
212}
213
215
216 std::unique_ptr<TEnv> config = std::make_unique<TEnv>( fInputFile.data() );
217
219 default_FebexMWD_Rise = 780; // L
220 default_FebexMWD_Top = 870; // mwd_cfd_trig_delay
221 default_FebexMWD_Baseline = 60; // delay MWD in James' firmware
222 default_FebexMWD_Window = 880; // M
224 default_FebexCFD_HoldOff = 100; // prevent double triggering?
229
230 // FEBEX initialisation
231 fFebexOffset.resize( set->GetNumberOfFebexSfps() );
232 fFebexGain.resize( set->GetNumberOfFebexSfps() );
233 fFebexGainQuadr.resize( set->GetNumberOfFebexSfps() );
234 fFebexThreshold.resize( set->GetNumberOfFebexSfps() );
235 fFebexType.resize( set->GetNumberOfFebexSfps() );
236 fFebexTime.resize( set->GetNumberOfFebexSfps() );
237 fFebexMWD_Decay.resize( set->GetNumberOfFebexSfps() );
238 fFebexMWD_Rise.resize( set->GetNumberOfFebexSfps() );
239 fFebexMWD_Top.resize( set->GetNumberOfFebexSfps() );
240 fFebexMWD_Baseline.resize( set->GetNumberOfFebexSfps() );
241 fFebexMWD_Window.resize( set->GetNumberOfFebexSfps() );
242 fFebexCFD_Delay.resize( set->GetNumberOfFebexSfps() );
243 fFebexCFD_HoldOff.resize( set->GetNumberOfFebexSfps() );
244 fFebexCFD_Shaping.resize( set->GetNumberOfFebexSfps() );
245 fFebexCFD_Integration.resize( set->GetNumberOfFebexSfps() );
246 fFebexCFD_Threshold.resize( set->GetNumberOfFebexSfps() );
247 fFebexCFD_Fraction.resize( set->GetNumberOfFebexSfps() );
248
249 // Global parameters
250 double default_FebexOffset = (double)config->GetValue( "febex.Offset", (double)0 );
251 double default_FebexGain = (double)config->GetValue( "febex.Gain", 0.25 );
252 double default_FebexGainQuadr = (double)config->GetValue( "febex.GainQuadr", (double)0 );
253 unsigned int default_FebexThreshold = (unsigned int)config->GetValue( "febex.Threshold", (double)0 );
254 std::string default_FebexType = config->GetValue( "febex.Type", "Qshort" );
255 if( default_qint ) default_FebexType = "Qint"; // override for MBS
256 long default_FebexTime = (long)config->GetValue( "febex.Time", (double)0 );
257 default_FebexMWD_Decay = (unsigned int)config->GetValue( "febex.MWD.DecayTime", (double)default_FebexMWD_Decay );
258 default_FebexMWD_Rise = (unsigned int)config->GetValue( "febex_.MWD.RiseTime", (double)default_FebexMWD_Rise );
259 default_FebexMWD_Top = (unsigned int)config->GetValue( "febex.MWD.FlatTop", (double)default_FebexMWD_Top );
260 default_FebexMWD_Baseline = (unsigned int)config->GetValue( "febex.MWD.Baseline", (double)default_FebexMWD_Baseline );
261 default_FebexMWD_Window = (unsigned int)config->GetValue( "febex.MWD.Window", (double)default_FebexMWD_Window );
262 default_FebexCFD_Delay = (unsigned int)config->GetValue( "febex.CFD.DelayTime", (double)default_FebexCFD_Delay );
263 default_FebexCFD_HoldOff = (unsigned int)config->GetValue( "febex.CFD.HoldOff", (double)default_FebexCFD_HoldOff );
264 default_FebexCFD_Shaping = (unsigned int)config->GetValue( "febex.CFD.ShapingTime", (double)default_FebexCFD_Shaping );
265 default_FebexCFD_Integration = (unsigned int)config->GetValue( "febex.CFD.IntegrationTime", (double)default_FebexCFD_Integration );
266 default_FebexCFD_Threshold = (int)config->GetValue( "febex.CFD.Threshold", (double)default_FebexCFD_Threshold );
267 default_FebexCFD_Fraction = (float)config->GetValue( "febex.CFD.Fraction", (double)default_FebexCFD_Fraction );
268
269
270 // FEBEX parameter read
271 for( unsigned char i = 0; i < set->GetNumberOfFebexSfps(); i++ ){
272
273 fFebexOffset[i].resize( set->GetNumberOfFebexBoards() );
274 fFebexGain[i].resize( set->GetNumberOfFebexBoards() );
275 fFebexGainQuadr[i].resize( set->GetNumberOfFebexBoards() );
276 fFebexThreshold[i].resize( set->GetNumberOfFebexBoards() );
277 fFebexType[i].resize( set->GetNumberOfFebexBoards() );
278 fFebexTime[i].resize( set->GetNumberOfFebexBoards() );
279 fFebexMWD_Decay[i].resize( set->GetNumberOfFebexBoards() );
280 fFebexMWD_Rise[i].resize( set->GetNumberOfFebexBoards() );
281 fFebexMWD_Top[i].resize( set->GetNumberOfFebexBoards() );
282 fFebexMWD_Baseline[i].resize( set->GetNumberOfFebexBoards() );
283 fFebexMWD_Window[i].resize( set->GetNumberOfFebexBoards() );
284 fFebexCFD_Delay[i].resize( set->GetNumberOfFebexBoards() );
285 fFebexCFD_HoldOff[i].resize( set->GetNumberOfFebexBoards() );
286 fFebexCFD_Shaping[i].resize( set->GetNumberOfFebexBoards() );
287 fFebexCFD_Integration[i].resize( set->GetNumberOfFebexBoards() );
288 fFebexCFD_Threshold[i].resize( set->GetNumberOfFebexBoards() );
289 fFebexCFD_Fraction[i].resize( set->GetNumberOfFebexBoards() );
290
291 double sfpFebexOffset = (double)config->GetValue( Form( "febex_%d.Offset", i ), (double)default_FebexOffset );
292 double sfpFebexGain = (double)config->GetValue( Form( "febex_%d.Gain", i ), (double)default_FebexGain );
293 double sfpFebexGainQuadr = (double)config->GetValue( Form( "febex_%d.GainQuadr", i ), (double)default_FebexGainQuadr );
294 unsigned int sfpFebexThreshold = (unsigned int)config->GetValue( Form( "febex_%d.Threshold", i ), (double)default_FebexThreshold );
295 std::string sfpFebexType = config->GetValue( Form( "febex_%d.Type", i ), default_FebexType.data() );
296 long sfpFebexTime = (long)config->GetValue( Form( "febex_%d.Time", i ), (double)default_FebexTime );
297 unsigned int sfpFebexMWD_Decay = (unsigned int)config->GetValue( Form( "febex_%d.MWD.DecayTime", i ), (double)default_FebexMWD_Decay );
298 unsigned int sfpFebexMWD_Rise = (unsigned int)config->GetValue( Form( "febex_%d.MWD.RiseTime", i ), (double)default_FebexMWD_Rise );
299 unsigned int sfpFebexMWD_Top = (unsigned int)config->GetValue( Form( "febex_%d.MWD.FlatTop", i ), (double)default_FebexMWD_Top );
300 unsigned int sfpFebexMWD_Baseline = (unsigned int)config->GetValue( Form( "febex_%d.MWD.Baseline", i ), (double)default_FebexMWD_Baseline );
301 unsigned int sfpFebexMWD_Window = (unsigned int)config->GetValue( Form( "febex_%d.MWD.Window", i ), (double)default_FebexMWD_Window );
302 unsigned int sfpFebexCFD_Delay = (unsigned int)config->GetValue( Form( "febex_%d.CFD.DelayTime", i ), (double)default_FebexCFD_Delay );
303 unsigned int sfpFebexCFD_HoldOff = (unsigned int)config->GetValue( Form( "febex_%d.CFD.HoldOff", i ), (double)default_FebexCFD_HoldOff );
304 unsigned int sfpFebexCFD_Shaping = (unsigned int)config->GetValue( Form( "febex_%d.CFD.ShapingTime", i ), (double)default_FebexCFD_Shaping );
305 unsigned int sfpFebexCFD_Integration = (unsigned int)config->GetValue( Form( "febex_%d.CFD.IntegrationTime", i ), (double)default_FebexCFD_Integration );
306 int sfpFebexCFD_Threshold = (int)config->GetValue( Form( "febex_%d.CFD.Threshold", i ), (double)default_FebexCFD_Threshold );
307 float sfpFebexCFD_Fraction = (float)config->GetValue( Form( "febex_%d.CFD.Fraction", i ), (double)default_FebexCFD_Fraction );
308
309 for( unsigned char j = 0; j < set->GetNumberOfFebexBoards(); j++ ){
310
311 fFebexOffset[i][j].resize( set->GetNumberOfFebexChannels() );
312 fFebexGain[i][j].resize( set->GetNumberOfFebexChannels() );
313 fFebexGainQuadr[i][j].resize( set->GetNumberOfFebexChannels() );
314 fFebexThreshold[i][j].resize( set->GetNumberOfFebexChannels() );
315 fFebexType[i][j].resize( set->GetNumberOfFebexChannels() );
316 fFebexTime[i][j].resize( set->GetNumberOfFebexChannels() );
317 fFebexMWD_Decay[i][j].resize( set->GetNumberOfFebexChannels() );
318 fFebexMWD_Rise[i][j].resize( set->GetNumberOfFebexChannels() );
319 fFebexMWD_Top[i][j].resize( set->GetNumberOfFebexChannels() );
320 fFebexMWD_Baseline[i][j].resize( set->GetNumberOfFebexChannels() );
321 fFebexMWD_Window[i][j].resize( set->GetNumberOfFebexChannels() );
322 fFebexCFD_Delay[i][j].resize( set->GetNumberOfFebexChannels() );
323 fFebexCFD_HoldOff[i][j].resize( set->GetNumberOfFebexChannels() );
324 fFebexCFD_Shaping[i][j].resize( set->GetNumberOfFebexChannels() );
325 fFebexCFD_Integration[i][j].resize( set->GetNumberOfFebexChannels() );
326 fFebexCFD_Threshold[i][j].resize( set->GetNumberOfFebexChannels() );
327 fFebexCFD_Fraction[i][j].resize( set->GetNumberOfFebexChannels() );
328
329 double boardFebexOffset = (double)config->GetValue( Form( "febex_%d_%d.Offset", i, j ), (double)sfpFebexOffset );
330 double boardFebexGain = (double)config->GetValue( Form( "febex_%d_%d.Gain", i, j ), (double)sfpFebexGain );
331 double boardFebexGainQuadr = (double)config->GetValue( Form( "febex_%d_%d.GainQuadr", i, j ), (double)sfpFebexGainQuadr );
332 unsigned int boardFebexThreshold = (unsigned int)config->GetValue( Form( "febex_%d_%d.Threshold", i, j ), (double)sfpFebexThreshold );
333 std::string boardFebexType = config->GetValue( Form( "febex_%d_%d.Type", i, j ), sfpFebexType.data() );
334 long boardFebexTime = (long)config->GetValue( Form( "febex_%d_%d.Time", i, j ), (double)sfpFebexTime );
335 unsigned int boardFebexMWD_Decay = (unsigned int)config->GetValue( Form( "febex_%d_%d.MWD.DecayTime", i, j ), (double)sfpFebexMWD_Decay );
336 unsigned int boardFebexMWD_Rise = (unsigned int)config->GetValue( Form( "febex_%d_%d.MWD.RiseTime", i, j ), (double)sfpFebexMWD_Rise );
337 unsigned int boardFebexMWD_Top = (unsigned int)config->GetValue( Form( "febex_%d_%d.MWD.FlatTop", i, j ), (double)sfpFebexMWD_Top );
338 unsigned int boardFebexMWD_Baseline = (unsigned int)config->GetValue( Form( "febex_%d_%d.MWD.Baseline", i, j ), (double)sfpFebexMWD_Baseline );
339 unsigned int boardFebexMWD_Window = (unsigned int)config->GetValue( Form( "febex_%d_%d.MWD.Window", i, j ), (double)sfpFebexMWD_Window );
340 unsigned int boardFebexCFD_Delay = (unsigned int)config->GetValue( Form( "febex_%d_%d.CFD.DelayTime", i, j ), (double)sfpFebexCFD_Delay );
341 unsigned int boardFebexCFD_HoldOff = (unsigned int)config->GetValue( Form( "febex_%d_%d.CFD.HoldOff", i, j ), (double)sfpFebexCFD_HoldOff );
342 unsigned int boardFebexCFD_Shaping = (unsigned int)config->GetValue( Form( "febex_%d_%d.CFD.ShapingTime", i, j ), (double)sfpFebexCFD_Shaping );
343 unsigned int boardFebexCFD_Integration = (unsigned int)config->GetValue( Form( "febex_%d_%d.CFD.IntegrationTime", i, j ), (double)sfpFebexCFD_Integration );
344 int boardFebexCFD_Threshold = (int)config->GetValue( Form( "febex_%d_%d.CFD.Threshold", i, j ), (double)sfpFebexCFD_Threshold );
345 float boardFebexCFD_Fraction = (float)config->GetValue( Form( "febex_%d_%d.CFD.Fraction", i, j ), (double)sfpFebexCFD_Fraction );
346
347 for( unsigned char k = 0; k < set->GetNumberOfFebexChannels(); k++ ){
348
349 fFebexOffset[i][j][k] = (double)config->GetValue( Form( "febex_%d_%d_%d.Offset", i, j, k ), (double)boardFebexOffset );
350 fFebexGain[i][j][k] = (double)config->GetValue( Form( "febex_%d_%d_%d.Gain", i, j, k ), (double)boardFebexGain );
351 fFebexGainQuadr[i][j][k] = (double)config->GetValue( Form( "febex_%d_%d_%d.GainQuadr", i, j, k ), (double)boardFebexGainQuadr );
352 fFebexThreshold[i][j][k] = (unsigned int)config->GetValue( Form( "febex_%d_%d_%d.Threshold", i, j, k ), (double)boardFebexThreshold );
353 fFebexType[i][j][k] = config->GetValue( Form( "febex_%d_%d_%d.Type", i, j, k ), boardFebexType.data() );
354 fFebexTime[i][j][k] = (long)config->GetValue( Form( "febex_%d_%d_%d.Time", i, j, k ), (double)boardFebexTime );
355 fFebexMWD_Decay[i][j][k] = (unsigned int)config->GetValue( Form( "febex_%d_%d_%d.MWD.DecayTime", i, j, k ), (double)boardFebexMWD_Decay );
356 fFebexMWD_Rise[i][j][k] = (unsigned int)config->GetValue( Form( "febex_%d_%d_%d.MWD.RiseTime", i, j, k ), (double)boardFebexMWD_Rise );
357 fFebexMWD_Top[i][j][k] = (unsigned int)config->GetValue( Form( "febex_%d_%d_%d.MWD.FlatTop", i, j, k ), (double)boardFebexMWD_Top );
358 fFebexMWD_Baseline[i][j][k] = (unsigned int)config->GetValue( Form( "febex_%d_%d_%d.MWD.Baseline", i, j, k ), (double)boardFebexMWD_Baseline );
359 fFebexMWD_Window[i][j][k] = (unsigned int)config->GetValue( Form( "febex_%d_%d_%d.MWD.Window", i, j, k ), (double)boardFebexMWD_Window );
360 fFebexCFD_Delay[i][j][k] = (unsigned int)config->GetValue( Form( "febex_%d_%d_%d.CFD.DelayTime", i, j, k ), (double)boardFebexCFD_Delay );
361 fFebexCFD_HoldOff[i][j][k] = (unsigned int)config->GetValue( Form( "febex_%d_%d_%d.CFD.HoldOff", i, j, k ), (double)boardFebexCFD_HoldOff );
362 fFebexCFD_Shaping[i][j][k] = (unsigned int)config->GetValue( Form( "febex_%d_%d_%d.CFD.ShapingTime", i, j, k ), (double)boardFebexCFD_Shaping );
363 fFebexCFD_Integration[i][j][k] = (unsigned int)config->GetValue( Form( "febex_%d_%d_%d.CFD.IntegrationTime", i, j, k ), (double)boardFebexCFD_Integration );
364 fFebexCFD_Threshold[i][j][k] = (int)config->GetValue( Form( "febex_%d_%d_%d.CFD.Threshold", i, j, k ), (double)boardFebexCFD_Threshold );
365 fFebexCFD_Fraction[i][j][k] = (float)config->GetValue( Form( "febex_%d_%d_%d.CFD.Fraction", i, j, k ), (double)boardFebexCFD_Fraction );
366
367 } // k: channel
368
369 } // j: board
370
371 } // i: sfp
372
373 // ADC initialisation
374 fAdcOffset.resize( set->GetNumberOfAdcModules() );
375 fAdcGain.resize( set->GetNumberOfAdcModules() );
376 fAdcGainQuadr.resize( set->GetNumberOfAdcModules() );
377 fAdcThreshold.resize( set->GetNumberOfAdcModules() );
378 fAdcTime.resize( set->GetNumberOfAdcModules() );
379
380 // ADC parameter read
381 for( unsigned char i = 0; i < set->GetNumberOfAdcModules(); i++ ){
382
383 fAdcOffset[i].resize( set->GetMaximumNumberOfAdcChannels() );
384 fAdcGain[i].resize( set->GetMaximumNumberOfAdcChannels() );
385 fAdcGainQuadr[i].resize( set->GetMaximumNumberOfAdcChannels() );
386 fAdcThreshold[i].resize( set->GetMaximumNumberOfAdcChannels() );
387 fAdcTime[i].resize( set->GetMaximumNumberOfAdcChannels() );
388
389 double defaultAdcOffset = config->GetValue( Form( "adc_%d.Offset", i ), (double)0.0 );
390 double defaultAdcGain = config->GetValue( Form( "adc_%d.Gain", i ), (double)1.0 );
391 double defaultAdcGainQuadr = config->GetValue( Form( "adc_%d.GainQuadr", i ), (double)0.0 );
392 unsigned int defaultAdcThreshold = (unsigned int)config->GetValue( Form( "adc_%d.Threshold", i ), (double)0 );
393 long defaultAdcTime = (long)config->GetValue( Form( "adc_%d.Time", i ), (double)0 );
394
395 for( unsigned char j = 0; j < set->GetMaximumNumberOfAdcChannels(); j++ ){
396
397 fAdcOffset[i][j] = config->GetValue( Form( "adc_%d_%d.Offset", i, j ), (double)defaultAdcOffset );
398 fAdcGain[i][j] = config->GetValue( Form( "adc_%d_%d.Gain", i, j ), (double)defaultAdcGain );
399 fAdcGainQuadr[i][j] = config->GetValue( Form( "adc_%d_%d.GainQuadr", i, j ), (double)defaultAdcGainQuadr );
400 fAdcThreshold[i][j] = (unsigned int)config->GetValue( Form( "adc_%d_%d.Threshold", i, j ), (double)defaultAdcThreshold );
401 fAdcTime[i][j] = (long)config->GetValue( Form( "adc_%d_%d.Time", i, j ), (double)defaultAdcTime );
402
403 }
404
405 }
406
407 // DGF initialisation
408 fDgfOffset.resize( set->GetNumberOfDgfModules() );
409 fDgfGain.resize( set->GetNumberOfDgfModules() );
410 fDgfGainQuadr.resize( set->GetNumberOfDgfModules() );
411 fDgfThreshold.resize( set->GetNumberOfDgfModules() );
412 fDgfTime.resize( set->GetNumberOfDgfModules() );
413
414 // DGF parameter read
415 for( unsigned char i = 0; i < set->GetNumberOfDgfModules(); i++ ){
416
417 fDgfOffset[i].resize( set->GetNumberOfDgfChannels() );
418 fDgfGain[i].resize( set->GetNumberOfDgfChannels() );
419 fDgfGainQuadr[i].resize( set->GetNumberOfDgfChannels() );
420 fDgfThreshold[i].resize( set->GetNumberOfDgfChannels() );
421 fDgfTime[i].resize( set->GetNumberOfDgfChannels() );
422
423 double defaultDgfOffset = config->GetValue( Form( "dgf_%d.Offset", i ), (double)0.0 );
424 double defaultDgfGain = config->GetValue( Form( "dgf_%d.Gain", i ), (double)1.0 );
425 double defaultDgfGainQuadr = config->GetValue( Form( "dgf_%d.GainQuadr", i ), (double)0.0 );
426 unsigned int defaultDgfThreshold = (unsigned int)config->GetValue( Form( "dgf_%d.Threshold", i ), (double)0 );
427 long defaultDgfTime = (long)config->GetValue( Form( "dgf_%d.Time", i ), (double)0 );
428
429 for( unsigned char j = 0; j < set->GetNumberOfDgfChannels(); j++ ){
430
431 fDgfOffset[i][j] = config->GetValue( Form( "dgf_%d_%d.Offset", i, j ), (double)defaultDgfOffset );
432 fDgfGain[i][j] = config->GetValue( Form( "dgf_%d_%d.Gain", i, j ), (double)defaultDgfGain );
433 fDgfGainQuadr[i][j] = config->GetValue( Form( "dgf_%d_%d.GainQuadr", i, j ), (double)defaultDgfGainQuadr );
434 fDgfThreshold[i][j] = (unsigned int)config->GetValue( Form( "dgf_%d_%d.Threshold", i, j ), (double)defaultDgfThreshold );
435 fDgfTime[i][j] = (long)config->GetValue( Form( "dgf_%d_%d.Time", i, j ), (double)defaultDgfTime );
436
437 }
438
439 }
440
441}
442
443float MiniballCalibration::FebexEnergy( unsigned char sfp, unsigned char board, unsigned char ch, unsigned int raw ) {
444
445 float energy, raw_rand;
446
447 if( sfp < set->GetNumberOfFebexSfps() &&
448 board < set->GetNumberOfFebexBoards() &&
449 ch < set->GetNumberOfFebexChannels() ) {
450
451 raw_rand = raw + 0.5 - fRand->Uniform();
452
453 energy = fFebexGainQuadr[sfp][board][ch] * raw_rand * raw_rand;
454 energy += fFebexGain[sfp][board][ch] * raw_rand;
455 energy += fFebexOffset[sfp][board][ch];
456
457 // Check if we have defaults
458 if( TMath::Abs( fFebexGainQuadr[sfp][board][ch] ) < 1e-6 &&
459 TMath::Abs( fFebexGain[sfp][board][ch] - 1.0 ) < 1e-6 &&
460 TMath::Abs( fFebexOffset[sfp][board][ch] ) < 1e-6 )
461
462 return raw;
463
464 else return energy;
465
466 }
467
468 return -1;
469
470}
471
472float MiniballCalibration::DgfEnergy( unsigned char mod, unsigned char ch, unsigned int raw ) {
473
474 float energy, raw_rand;
475
476 if( mod < set->GetNumberOfDgfModules() &&
477 ch < set->GetNumberOfDgfChannels() ) {
478
479 raw_rand = raw + 0.5 - fRand->Uniform();
480
481 energy = fDgfGainQuadr[mod][ch] * raw_rand * raw_rand;
482 energy += fDgfGain[mod][ch] * raw_rand;
483 energy += fDgfOffset[mod][ch];
484
485 // Check if we have defaults
486 if( TMath::Abs( fDgfGain[mod][ch] - 1.0 ) < 1e-6 &&
487 TMath::Abs( fDgfOffset[mod][ch] ) < 1e-6 )
488
489 return raw;
490
491 else return energy;
492
493 }
494
495 return -1;
496
497}
498
499float MiniballCalibration::AdcEnergy( unsigned char mod, unsigned char ch, unsigned int raw ) {
500
501 float energy, raw_rand;
502
503 if( mod < set->GetNumberOfAdcModules() &&
504 ch < set->GetMaximumNumberOfAdcChannels() ) {
505
506 raw_rand = raw + 0.5 - fRand->Uniform();
507
508 energy = fAdcGain[mod][ch] * raw_rand;
509 energy += fAdcOffset[mod][ch];
510
511 // Check if we have defaults
512 if( TMath::Abs( fAdcGain[mod][ch] - 1.0 ) < 1e-6 &&
513 TMath::Abs( fAdcOffset[mod][ch] ) < 1e-6 )
514
515 return raw;
516
517 else return energy;
518
519 }
520
521 return -1;
522
523}
524
525FebexMWD MiniballCalibration::DoMWD( unsigned char sfp, unsigned char board, unsigned char ch, std::vector<unsigned short> trace ) {
526
527 // Create a FebexMWD class to hold the info
528 FebexMWD mwd;
529
530 // Check if it's a valid event first
531 if( sfp < set->GetNumberOfFebexSfps() &&
532 board < set->GetNumberOfFebexBoards() &&
533 ch < set->GetNumberOfFebexChannels() ) {
534
535 // Set the parameters of the MWD
536 mwd.SetTrace( trace );
537 mwd.SetRiseTime( fFebexMWD_Rise[sfp][board][ch] );
538 mwd.SetDecayTime( fFebexMWD_Decay[sfp][board][ch] );
539 mwd.SetFlatTop( fFebexMWD_Top[sfp][board][ch] );
540 mwd.SetBaseline( fFebexMWD_Baseline[sfp][board][ch] );
541 mwd.SetWindow( fFebexMWD_Window[sfp][board][ch] );
542 mwd.SetDelayTime( fFebexCFD_Delay[sfp][board][ch] );
543 mwd.SetHoldOff( fFebexCFD_HoldOff[sfp][board][ch] );
544 mwd.SetShapingTime( fFebexCFD_Shaping[sfp][board][ch] );
545 mwd.SetIntegrationTime( fFebexCFD_Integration[sfp][board][ch] );
546 mwd.SetThreshold( fFebexCFD_Threshold[sfp][board][ch] );
547 mwd.SetFraction( fFebexCFD_Fraction[sfp][board][ch] );
548
549 // Run the MWD
550 mwd.DoMWD();
551
552 }
553
554 return mwd;
555
556}
557
558double MiniballCalibration::FebexOffset( unsigned char sfp, unsigned char board, unsigned char ch ) {
559
560 if( sfp < set->GetNumberOfFebexSfps() &&
561 board < set->GetNumberOfFebexBoards() &&
562 ch < set->GetNumberOfFebexChannels() ) {
563
564 return fFebexOffset[sfp][board][ch];
565
566 }
567
568 return 0.0;
569
570}
571
572double MiniballCalibration::FebexGain( unsigned char sfp, unsigned char board, unsigned char ch ) {
573
574 if( sfp < set->GetNumberOfFebexSfps() &&
575 board < set->GetNumberOfFebexBoards() &&
576 ch < set->GetNumberOfFebexChannels() ) {
577
578 return fFebexGain[sfp][board][ch];
579
580 }
581
582 return 1.0;
583
584}
585
586double MiniballCalibration::FebexGainQuadr( unsigned char sfp, unsigned char board, unsigned char ch ) {
587
588 if( sfp < set->GetNumberOfFebexSfps() &&
589 board < set->GetNumberOfFebexBoards() &&
590 ch < set->GetNumberOfFebexChannels() ) {
591
592 return fFebexGainQuadr[sfp][board][ch];
593
594 }
595
596 return 0.0;
597
598}
599
600unsigned int MiniballCalibration::FebexThreshold( unsigned char sfp, unsigned char board, unsigned char ch ) {
601
602 if( sfp < set->GetNumberOfFebexSfps() &&
603 board < set->GetNumberOfFebexBoards() &&
604 ch < set->GetNumberOfFebexChannels() ) {
605
606 return fFebexThreshold[sfp][board][ch];
607
608 }
609
610 return -1;
611
612}
613
614long MiniballCalibration::FebexTime( unsigned char sfp, unsigned char board, unsigned char ch ){
615
616 if( sfp < set->GetNumberOfFebexSfps() &&
617 board < set->GetNumberOfFebexBoards() &&
618 ch < set->GetNumberOfFebexChannels() ) {
619
620 return fFebexTime[sfp][board][ch];
621
622 }
623
624 return 0;
625
626}
627
628std::string MiniballCalibration::FebexType( unsigned char sfp, unsigned char board, unsigned char ch ){
629
630 if( sfp < set->GetNumberOfFebexSfps() &&
631 board < set->GetNumberOfFebexBoards() &&
632 ch < set->GetNumberOfFebexChannels() ) {
633
634 return fFebexType[sfp][board][ch];
635
636 }
637
638 return "";
639
640}
641
642double MiniballCalibration::DgfOffset( unsigned char mod, unsigned char ch ) {
643
644 if( mod < set->GetNumberOfDgfModules() &&
645 ch < set->GetNumberOfDgfChannels() ) {
646
647 return fDgfOffset[mod][ch];
648
649 }
650
651 return 0.0;
652
653}
654
655double MiniballCalibration::DgfGain( unsigned char mod, unsigned char ch ) {
656
657 if( mod < set->GetNumberOfDgfModules() &&
658 ch < set->GetNumberOfDgfChannels() ) {
659
660 return fDgfGain[mod][ch];
661
662 }
663
664 return 1.0;
665
666}
667
668double MiniballCalibration::DgfGainQuadr( unsigned char mod, unsigned char ch ) {
669
670 if( mod < set->GetNumberOfDgfModules() &&
671 ch < set->GetNumberOfDgfChannels() ) {
672
673 return fDgfGainQuadr[mod][ch];
674
675 }
676
677 return 0.0;
678
679}
680
681unsigned int MiniballCalibration::DgfThreshold( unsigned char mod, unsigned char ch ) {
682
683 if( mod < set->GetNumberOfDgfModules() &&
684 ch < set->GetNumberOfDgfChannels() ) {
685
686 return fDgfThreshold[mod][ch];
687
688 }
689
690 return -1;
691
692}
693
694long MiniballCalibration::DgfTime( unsigned char mod, unsigned char ch ){
695
696 if( mod < set->GetNumberOfDgfModules() &&
697 ch < set->GetNumberOfDgfChannels() ) {
698
699 return fDgfTime[mod][ch];
700
701 }
702
703 return 0;
704
705}
706double MiniballCalibration::AdcOffset( unsigned char mod, unsigned char ch ) {
707
708 if( mod < set->GetNumberOfAdcModules() &&
709 ch < set->GetMaximumNumberOfAdcChannels() ) {
710
711 return fAdcOffset[mod][ch];
712
713 }
714
715 return 0.0;
716
717}
718
719double MiniballCalibration::AdcGain( unsigned char mod, unsigned char ch ) {
720
721 if( mod < set->GetNumberOfAdcModules() &&
722 ch < set->GetMaximumNumberOfAdcChannels() ) {
723
724 return fAdcGain[mod][ch];
725
726 }
727
728 return 1.0;
729
730}
731
732double MiniballCalibration::AdcGainQuadr( unsigned char mod, unsigned char ch ) {
733
734 if( mod < set->GetNumberOfAdcModules() &&
735 ch < set->GetMaximumNumberOfAdcChannels() ) {
736
737 return fAdcGainQuadr[mod][ch];
738
739 }
740
741 return 0.0;
742
743}
744
745unsigned int MiniballCalibration::AdcThreshold( unsigned char mod, unsigned char ch ) {
746
747 if( mod < set->GetNumberOfAdcModules() &&
748 ch < set->GetMaximumNumberOfAdcChannels() ) {
749
750 return fAdcThreshold[mod][ch];
751
752 }
753
754 return -1;
755
756}
757
758long MiniballCalibration::AdcTime( unsigned char mod, unsigned char ch ){
759
760 if( mod < set->GetNumberOfAdcModules() &&
761 ch < set->GetMaximumNumberOfAdcChannels() ) {
762
763 return fAdcTime[mod][ch];
764
765 }
766
767 return 0;
768
769}
770
771
772// MWD
773void MiniballCalibration::SetMWDDecay( unsigned char sfp, unsigned char board, unsigned char ch, unsigned int decay ){
774
775 if( sfp < set->GetNumberOfFebexSfps() &&
776 board < set->GetNumberOfFebexBoards() &&
777 ch < set->GetNumberOfFebexChannels() ) {
778
779 fFebexMWD_Decay[sfp][board][ch] = decay;
780 return;
781
782 }
783
784 else return;
785
786}
787
788void MiniballCalibration::SetMWDRise( unsigned char sfp, unsigned char board, unsigned char ch, unsigned int rise ){
789
790 if( sfp < set->GetNumberOfFebexSfps() &&
791 board < set->GetNumberOfFebexBoards() &&
792 ch < set->GetNumberOfFebexChannels() ) {
793
794 fFebexMWD_Rise[sfp][board][ch] = rise;
795 return;
796
797 }
798
799 else return;
800
801}
802
803void MiniballCalibration::SetMWDFlatTop( unsigned char sfp, unsigned char board, unsigned char ch, unsigned int top ){
804
805 if( sfp < set->GetNumberOfFebexSfps() &&
806 board < set->GetNumberOfFebexBoards() &&
807 ch < set->GetNumberOfFebexChannels() ) {
808
809 fFebexMWD_Top[sfp][board][ch] = top;
810 return;
811
812 }
813
814 else return;
815
816}
817
818void MiniballCalibration::SetMWDBaseline( unsigned char sfp, unsigned char board, unsigned char ch, unsigned int baseline_length ){
819
820 if( sfp < set->GetNumberOfFebexSfps() &&
821 board < set->GetNumberOfFebexBoards() &&
822 ch < set->GetNumberOfFebexChannels() ) {
823
824 fFebexMWD_Baseline[sfp][board][ch] = baseline_length;
825 return;
826
827 }
828
829 else return;
830
831}
832
833void MiniballCalibration::SetMWDWindow( unsigned char sfp, unsigned char board, unsigned char ch, unsigned int window ){
834
835 if( sfp < set->GetNumberOfFebexSfps() &&
836 board < set->GetNumberOfFebexBoards() &&
837 ch < set->GetNumberOfFebexChannels() ) {
838
839 fFebexMWD_Window[sfp][board][ch] = window;
840 return;
841
842 }
843
844 else return;
845
846}
847
848void MiniballCalibration::SetCFDFraction( unsigned char sfp, unsigned char board, unsigned char ch, float fraction ){
849
850 if( sfp < set->GetNumberOfFebexSfps() &&
851 board < set->GetNumberOfFebexBoards() &&
852 ch < set->GetNumberOfFebexChannels() ) {
853
854 fFebexCFD_Fraction[sfp][board][ch] = fraction;
855 return;
856
857 }
858
859 else return;
860
861}
862
863void MiniballCalibration::SetCFDDelay( unsigned char sfp, unsigned char board, unsigned char ch, unsigned int delay ){
864
865 if( sfp < set->GetNumberOfFebexSfps() &&
866 board < set->GetNumberOfFebexBoards() &&
867 ch < set->GetNumberOfFebexChannels() ) {
868
869 fFebexCFD_Delay[sfp][board][ch] = delay;
870 return;
871
872 }
873
874 else return;
875
876}
877
878void MiniballCalibration::SetCFDHoldOff( unsigned char sfp, unsigned char board, unsigned char ch, unsigned int hold ){
879
880 if( sfp < set->GetNumberOfFebexSfps() &&
881 board < set->GetNumberOfFebexBoards() &&
882 ch < set->GetNumberOfFebexChannels() ) {
883
884 fFebexCFD_HoldOff[sfp][board][ch] = hold;
885 return;
886
887 }
888
889 else return;
890
891}
892
893void MiniballCalibration::SetCFDShapingTime( unsigned char sfp, unsigned char board, unsigned char ch, unsigned int shaping ){
894
895 if( sfp < set->GetNumberOfFebexSfps() &&
896 board < set->GetNumberOfFebexBoards() &&
897 ch < set->GetNumberOfFebexChannels() ) {
898
899 fFebexCFD_Shaping[sfp][board][ch] = shaping;
900 return;
901
902 }
903
904 else return;
905
906}
907
908void MiniballCalibration::SetCFDIntegrationTime( unsigned char sfp, unsigned char board, unsigned char ch, unsigned int integration ){
909
910 if( sfp < set->GetNumberOfFebexSfps() &&
911 board < set->GetNumberOfFebexBoards() &&
912 ch < set->GetNumberOfFebexChannels() ) {
913
914 fFebexCFD_Integration[sfp][board][ch] = integration;
915 return;
916
917 }
918
919 else return;
920
921}
922
923void MiniballCalibration::SetCFDThreshold( unsigned char sfp, unsigned char board, unsigned char ch, int threshold ){
924
925 if( sfp < set->GetNumberOfFebexSfps() &&
926 board < set->GetNumberOfFebexBoards() &&
927 ch < set->GetNumberOfFebexChannels() ) {
928
929 fFebexCFD_Threshold[sfp][board][ch] = threshold;
930 return;
931
932 }
933
934 else return;
935
936}
937
938unsigned int MiniballCalibration::GetMWDDecay( unsigned char sfp, unsigned char board, unsigned char ch ){
939
940 if( sfp < set->GetNumberOfFebexSfps() &&
941 board < set->GetNumberOfFebexBoards() &&
942 ch < set->GetNumberOfFebexChannels() ) {
943
944 return fFebexMWD_Decay[sfp][board][ch];
945
946 }
947
948 else return 0;
949
950}
951
952unsigned int MiniballCalibration::GetMWDRise( unsigned char sfp, unsigned char board, unsigned char ch ){
953
954 if( sfp < set->GetNumberOfFebexSfps() &&
955 board < set->GetNumberOfFebexBoards() &&
956 ch < set->GetNumberOfFebexChannels() ) {
957
958 return fFebexMWD_Rise[sfp][board][ch];
959
960 }
961
962 else return 0;
963
964}
965
966unsigned int MiniballCalibration::GetMWDFlatTop( unsigned char sfp, unsigned char board, unsigned char ch ){
967
968 if( sfp < set->GetNumberOfFebexSfps() &&
969 board < set->GetNumberOfFebexBoards() &&
970 ch < set->GetNumberOfFebexChannels() ) {
971
972 return fFebexMWD_Top[sfp][board][ch];
973
974 }
975
976 else return 0;
977
978}
979
980unsigned int MiniballCalibration::GetMWDBaseline( unsigned char sfp, unsigned char board, unsigned char ch ){
981
982 if( sfp < set->GetNumberOfFebexSfps() &&
983 board < set->GetNumberOfFebexBoards() &&
984 ch < set->GetNumberOfFebexChannels() ) {
985
986 return fFebexMWD_Baseline[sfp][board][ch];
987
988 }
989
990 else return 0;
991
992}
993
994unsigned int MiniballCalibration::GetMWDWindow( unsigned char sfp, unsigned char board, unsigned char ch ){
995
996 if( sfp < set->GetNumberOfFebexSfps() &&
997 board < set->GetNumberOfFebexBoards() &&
998 ch < set->GetNumberOfFebexChannels() ) {
999
1000 return fFebexMWD_Window[sfp][board][ch];
1001
1002 }
1003
1004 else return 0;
1005
1006}
1007
1008float MiniballCalibration::GetCFDFraction( unsigned char sfp, unsigned char board, unsigned char ch ){
1009
1010 if( sfp < set->GetNumberOfFebexSfps() &&
1011 board < set->GetNumberOfFebexBoards() &&
1012 ch < set->GetNumberOfFebexChannels() ) {
1013
1014 return fFebexCFD_Fraction[sfp][board][ch];
1015
1016 }
1017
1018 else return 0;
1019
1020}
1021
1022unsigned int MiniballCalibration::GetCFDDelay( unsigned char sfp, unsigned char board, unsigned char ch ){
1023
1024 if( sfp < set->GetNumberOfFebexSfps() &&
1025 board < set->GetNumberOfFebexBoards() &&
1026 ch < set->GetNumberOfFebexChannels() ) {
1027
1028 return fFebexCFD_Delay[sfp][board][ch];
1029
1030 }
1031
1032 else return 0;
1033
1034}
1035
1036unsigned int MiniballCalibration::GetCFDHoldOff( unsigned char sfp, unsigned char board, unsigned char ch ){
1037
1038 if( sfp < set->GetNumberOfFebexSfps() &&
1039 board < set->GetNumberOfFebexBoards() &&
1040 ch < set->GetNumberOfFebexChannels() ) {
1041
1042 return fFebexCFD_HoldOff[sfp][board][ch];
1043
1044 }
1045
1046 else return 0;
1047
1048}
1049
1050unsigned int MiniballCalibration::GetCFDShapingTime( unsigned char sfp, unsigned char board, unsigned char ch ){
1051
1052 if( sfp < set->GetNumberOfFebexSfps() &&
1053 board < set->GetNumberOfFebexBoards() &&
1054 ch < set->GetNumberOfFebexChannels() ) {
1055
1056 return fFebexCFD_Shaping[sfp][board][ch];
1057
1058 }
1059
1060 else return 0;
1061
1062}
1063
1064unsigned int MiniballCalibration::GetCFDIntegrationTime( unsigned char sfp, unsigned char board, unsigned char ch ){
1065
1066 if( sfp < set->GetNumberOfFebexSfps() &&
1067 board < set->GetNumberOfFebexBoards() &&
1068 ch < set->GetNumberOfFebexChannels() ) {
1069
1070 return fFebexCFD_Integration[sfp][board][ch];
1071
1072 }
1073
1074 else return 0;
1075
1076}
1077
1078int MiniballCalibration::GetCFDThreshold( unsigned char sfp, unsigned char board, unsigned char ch ){
1079
1080 if( sfp < set->GetNumberOfFebexSfps() &&
1081 board < set->GetNumberOfFebexBoards() &&
1082 ch < set->GetNumberOfFebexChannels() ) {
1083
1084 return fFebexCFD_Threshold[sfp][board][ch];
1085
1086 }
1087
1088 else return 0;
1089
1090}
1091
ClassImp(FebexMWD) ClassImp(MiniballCalibration) void FebexMWD
Definition Calibration.cc:3
std::vector< float > stage3
unsigned int cfd_integration_time
std::vector< float > stage4
unsigned int baseline_length
std::vector< float > energy_list
unsigned int decay_time
std::vector< unsigned short > trace
void SetWindow(unsigned int t)
void SetBaseline(unsigned int t)
unsigned int cfd_delay
std::vector< float > shaper
void SetShapingTime(unsigned int t)
std::vector< float > differential
void SetFraction(float f)
void SetIntegrationTime(unsigned int t)
unsigned int rise_time
std::vector< float > stage2
float fraction
unsigned int window
void SetFlatTop(unsigned int t)
std::vector< float > stage1
unsigned int cfd_shaping_time
unsigned int cfd_hold
void SetDelayTime(unsigned int t)
std::vector< float > cfd
void DoMWD()
void SetRiseTime(unsigned int t)
void SetTrace(std::vector< unsigned short > t)
void SetHoldOff(unsigned int t)
void SetThreshold(unsigned int t)
std::vector< float > cfd_list
void SetDecayTime(float t)
unsigned int flat_top
double DgfGain(unsigned char mod, unsigned char ch)
float FebexEnergy(unsigned char sfp, unsigned char board, unsigned char ch, unsigned int raw)
std::vector< std::vector< long > > fAdcTime
double AdcGain(unsigned char mod, unsigned char ch)
void SetFile(std::string filename)
int GetCFDThreshold(unsigned char sfp, unsigned char board, unsigned char ch)
std::vector< std::vector< std::vector< unsigned int > > > fFebexCFD_Integration
unsigned int default_FebexCFD_HoldOff
void SetCFDDelay(unsigned char sfp, unsigned char board, unsigned char ch, unsigned int delay)
long FebexTime(unsigned char sfp, unsigned char board, unsigned char ch)
long AdcTime(unsigned char mod, unsigned char ch)
FebexMWD DoMWD(unsigned char sfp, unsigned char board, unsigned char ch, std::vector< unsigned short > trace)
void SetMWDDecay(unsigned char sfp, unsigned char board, unsigned char ch, unsigned int decay)
void SetMWDRise(unsigned char sfp, unsigned char board, unsigned char ch, unsigned int rise)
std::shared_ptr< MiniballSettings > set
long DgfTime(unsigned char mod, unsigned char ch)
std::vector< std::vector< double > > fDgfGain
double FebexGain(unsigned char sfp, unsigned char board, unsigned char ch)
unsigned int GetCFDDelay(unsigned char sfp, unsigned char board, unsigned char ch)
std::vector< std::vector< std::vector< double > > > fFebexOffset
unsigned int default_FebexCFD_Delay
std::vector< std::vector< std::vector< unsigned int > > > fFebexThreshold
std::vector< std::vector< std::vector< unsigned int > > > fFebexMWD_Baseline
std::vector< std::vector< double > > fAdcGain
std::vector< std::vector< double > > fDgfGainQuadr
std::vector< std::vector< std::vector< unsigned int > > > fFebexMWD_Rise
double FebexOffset(unsigned char sfp, unsigned char board, unsigned char ch)
double DgfOffset(unsigned char mod, unsigned char ch)
unsigned int FebexThreshold(unsigned char sfp, unsigned char board, unsigned char ch)
std::vector< std::vector< std::vector< long > > > fFebexTime
std::vector< std::vector< double > > fDgfOffset
float DgfEnergy(unsigned char mod, unsigned char ch, unsigned int raw)
float AdcEnergy(unsigned char mod, unsigned char ch, unsigned int raw)
double AdcOffset(unsigned char mod, unsigned char ch)
void SetCFDThreshold(unsigned char sfp, unsigned char board, unsigned char ch, int threshold)
std::vector< std::vector< std::vector< unsigned int > > > fFebexMWD_Top
std::vector< std::vector< std::vector< unsigned int > > > fFebexCFD_HoldOff
unsigned int GetMWDWindow(unsigned char sfp, unsigned char board, unsigned char ch)
std::vector< std::vector< double > > fAdcOffset
void SetMWDBaseline(unsigned char sfp, unsigned char board, unsigned char ch, unsigned int baseline_length)
std::vector< std::vector< std::vector< unsigned int > > > fFebexMWD_Decay
void SetCFDIntegrationTime(unsigned char sfp, unsigned char board, unsigned char ch, unsigned int integration)
void SetCFDFraction(unsigned char sfp, unsigned char board, unsigned char ch, float fraction)
std::vector< std::vector< long > > fDgfTime
std::vector< std::vector< std::vector< float > > > fFebexCFD_Fraction
unsigned int GetMWDDecay(unsigned char sfp, unsigned char board, unsigned char ch)
std::string FebexType(unsigned char sfp, unsigned char board, unsigned char ch)
std::unique_ptr< TRandom3 > fRand
unsigned int GetMWDFlatTop(unsigned char sfp, unsigned char board, unsigned char ch)
std::vector< std::vector< double > > fAdcGainQuadr
std::vector< std::vector< std::vector< double > > > fFebexGainQuadr
unsigned int default_FebexCFD_Integration
float GetCFDFraction(unsigned char sfp, unsigned char board, unsigned char ch)
std::string fInputFile
unsigned int default_FebexMWD_Rise
std::vector< std::vector< unsigned int > > fDgfThreshold
std::vector< std::vector< std::vector< int > > > fFebexCFD_Threshold
unsigned int GetCFDIntegrationTime(unsigned char sfp, unsigned char board, unsigned char ch)
std::vector< std::vector< unsigned int > > fAdcThreshold
unsigned int AdcThreshold(unsigned char mod, unsigned char ch)
void SetCFDShapingTime(unsigned char sfp, unsigned char board, unsigned char ch, unsigned int shaping)
unsigned int GetMWDRise(unsigned char sfp, unsigned char board, unsigned char ch)
double DgfGainQuadr(unsigned char mod, unsigned char ch)
unsigned int default_FebexMWD_Baseline
unsigned int default_FebexMWD_Decay
void SetCFDHoldOff(unsigned char sfp, unsigned char board, unsigned char ch, unsigned int hold)
std::vector< std::vector< std::vector< unsigned int > > > fFebexCFD_Shaping
void SetMWDFlatTop(unsigned char sfp, unsigned char board, unsigned char ch, unsigned int top)
std::vector< std::vector< std::vector< std::string > > > fFebexType
MiniballCalibration(std::string filename, std::shared_ptr< MiniballSettings > myset)
std::vector< std::vector< std::vector< double > > > fFebexGain
unsigned int default_FebexMWD_Top
double AdcGainQuadr(unsigned char mod, unsigned char ch)
std::vector< std::vector< std::vector< unsigned int > > > fFebexMWD_Window
unsigned int DgfThreshold(unsigned char mod, unsigned char ch)
double FebexGainQuadr(unsigned char sfp, unsigned char board, unsigned char ch)
unsigned int default_FebexCFD_Shaping
unsigned int default_FebexMWD_Window
unsigned int GetMWDBaseline(unsigned char sfp, unsigned char board, unsigned char ch)
unsigned int GetCFDHoldOff(unsigned char sfp, unsigned char board, unsigned char ch)
std::vector< std::vector< std::vector< unsigned int > > > fFebexCFD_Delay
void SetMWDWindow(unsigned char sfp, unsigned char board, unsigned char ch, unsigned int window)
unsigned int GetCFDShapingTime(unsigned char sfp, unsigned char board, unsigned char ch)
std::shared_ptr< MiniballSettings > myset
Definition mb_sort.cc:123