source: trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc@ 7090

Last change on this file since 7090 was 7070, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 22.5 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Markus Gaug 01/2004 <mailto:markus@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25/////////////////////////////////////////////////////////////////////////////
26//
27// MExtractPedestal
28//
29// Pedestal Extractor base class
30//
31// Input Containers:
32// MRawEvtData
33// MRawRunHeader
34// MRawEvtHeader
35// MGeomCam
36// MPedestalCam
37//
38// Output Containers:
39// MPedestalCam
40//
41// This class should be used for pedestal extractors with the following facilities:
42// a) Standardized calculation of AB-noise, mean pedestals and RMS
43// b) Standardized treatment of area- and sector averaged pedestals values
44// c) Possibility to use a signal extractor to be applied on the pedestals
45// d) Possibility to handle two MPedestalCams: one for the signal extractor and
46// a second to be filled during the pedestal calculating process.
47//
48// ad a): Every calculated value is referred to one FADC slice (e.g. Mean pedestal per slice),
49// RMS per slice.
50// MExtractPedestal applies the following formula (1):
51//
52// Pedestal per slice = sum(x_i) / n / slices
53// PedRMS per slice = Sqrt( ( sum(x_i^2) - sum(x_i)^2/n ) / n-1 / slices )
54// AB-Offset per slice = (sumAB0 - sumAB1) / n / slices
55//
56// where x_i is the sum of "slices" FADC slices and sum means the sum over all
57// events. "n" is the number of events, "slices" is the number of summed FADC samples.
58//
59// Note that the slice-to-slice fluctuations are not Gaussian, but Poissonian, thus
60// asymmetric and they are correlated.
61//
62// It is important to know that the Pedestal per slice and PedRMS per slice depend
63// on the number of used FADC slices, as seen in the following plots:
64//
65//Begin_Html
66/*
67<img src="images/PedestalStudyInner.gif">
68*/
69//End_Html
70//
71//Begin_Html
72/*
73<img src="images/PedestalStudyOuter.gif">
74*/
75//End_Html
76//
77// The plots show the inner and outer pixels, respectivly and have the following meaning:
78//
79// 1) The calculated mean pedestal per slice (from MPedCalcPedRun)
80// 2) The fitted mean pedestal per slice (from MHPedestalCam)
81// 3) The calculated pedestal RMS per slice (from MPedCalcPedRun)
82// 4) The fitted sigma of the pedestal distribution per slice
83// (from MHPedestalCam)
84// 5) The relative difference between calculation and histogram fit
85// for the mean
86// 6) The relative difference between calculation and histogram fit
87// for the sigma or RMS, respectively.
88//
89// The calculated means do not change significantly except for the case of 2 slices,
90// however the RMS changes from 5.7 per slice in the case of 2 extracted slices
91// to 8.3 per slice in the case of 26 extracted slices. This change is very significant.
92//
93// ad b) Every calculated value is referred to one FADC slice and one (averaged) pixel,
94// (e.g. Mean Pedestal per area index per slice per pixel, etc. )
95//
96// MExtractPedestal applies the following formula (2):
97//
98// Averaged Pedestal per slice = sum(x_i) / n / slices / n_pix
99// PedRMS per slice = Sqrt( ( sum(x_i^2) - sum(x_i)^2/n ) / n-1 / slices / n_pix )
100// AB-Offset per slice = (sumAB0 - sumAB1) / n / slices / n_pix
101//
102// where x_i is the sum of "slices" FADC slices and sum means the sum over all
103// events and all concerned pixels.
104// "n" is the number of events, "slices" is the number of summed FADC samples and
105// "n_pix" is the number of pixels belonging to the specific area index or camera sector.
106//
107// Calculating these averaged event-by-event values is very important to trace coherent
108// fluctuations. An example is given in the following plots:
109//
110//Begin_Html
111/*
112<img src="images/PedestalOscillations.gif">
113*/
114//End_Html
115//
116// The plots show the extracted pedestals of the inner pixels (obtained
117// with MHPedestalCam), averaged on an event-by-event basis from
118// run 13428 with switched off camera LV.
119// The meaning of the four plots is:
120//
121// 1) The distribution of the averaged pedestals
122// 2) The averaged pedestals vs. time.
123// One can see clearly the oscillation pattern
124// 3) The fourier transform of the averaged pedestals vs. time.
125// One can see clearly a peak at a certain frequency
126// 4) The projection of the fourier components with the non-exponential
127// (and therefore significant) outlier.
128//
129// ad c) Many signal extractors, especially those using a sliding window
130// have biases and their resolutions for zero-signals do not agree
131// with the pedestal RMS. For the F-Factor method in the calibration
132// and the image cleaning, however, both have to be known and measured.
133//
134// For this reason, a signal extractor can be handed over to the
135// pedestal extractor and applied on the pedestal events with the
136// function SetExtractor().
137// The results will get stored in an MPedestalCam.
138//
139// Note that only extractors deriving from MExtractTimeAndCharge
140// can be used.
141//
142// ad d) The signal extractors themselves need a pedestal to be subtracted
143// from the FADC slices.
144// If the user wishes that the pededestals do not get overwritten by
145// the results from the signal extractor, a different named MPedestalCam
146// can be created with the function: SetNamePedestalOut().
147//
148// See also: MPedestalCam, MPedestalPix, MPedCalcPedRun, MPedCalcFromLoGain
149//
150/////////////////////////////////////////////////////////////////////////////
151#include "MExtractPedestal.h"
152
153#include "MParList.h"
154
155#include "MLog.h"
156#include "MLogManip.h"
157
158#include "MRawRunHeader.h"
159#include "MRawEvtHeader.h"
160#include "MRawEvtPixelIter.h"
161#include "MRawEvtData.h"
162
163#include "MPedestalPix.h"
164#include "MPedestalCam.h"
165
166#include "MGeomPix.h"
167#include "MGeomCam.h"
168
169#include "MTaskEnv.h"
170#include "MExtractTimeAndCharge.h"
171
172ClassImp(MExtractPedestal);
173
174using namespace std;
175
176const TString MExtractPedestal::fgNamePedestalCam = "MPedestalCam";
177const UInt_t MExtractPedestal::fgNumDump = 500;
178
179// --------------------------------------------------------------------------
180//
181// Default constructor:
182//
183// Sets:
184// - all pointers to NULL
185//
186// Calls:
187// - AddToBranchList("fHiGainPixId");
188// - AddToBranchList("fHiGainFadcSamples");
189// - Clear()
190//
191MExtractPedestal::MExtractPedestal(const char *name, const char *title)
192 : fGeom(NULL), fPedestalsIn(NULL), fPedestalsInter(NULL), fPedestalsOut(NULL),
193 fExtractor(NULL), fExtractWinFirst(0), fExtractWinSize(0)
194{
195 fName = name ? name : "MExtractPedestal";
196 fTitle = title ? title : "Base class to calculate pedestals";
197
198 AddToBranchList("fHiGainPixId");
199 AddToBranchList("fLoGainPixId");
200 AddToBranchList("fHiGainFadcSamples");
201 AddToBranchList("fLoGainFadcSamples");
202
203 SetIntermediateStorage( kFALSE );
204 SetPedestalUpdate ( kTRUE );
205 SetRandomCalculation ( kTRUE );
206
207 SetNamePedestalCamIn();
208 SetNamePedestalCamOut();
209 SetNumDump();
210
211 Clear();
212}
213
214void MExtractPedestal::ResetArrays()
215{
216 // Reset contents of arrays.
217 fSumx.Reset();
218 fSumx2.Reset();
219 fSumAB0.Reset();
220 fSumAB1.Reset();
221 fAreaSumx.Reset();
222 fAreaSumx2.Reset();
223 fAreaSumAB0.Reset();
224 fAreaSumAB1.Reset();
225 fAreaFilled.Reset();
226 fAreaValid.Reset();
227 fSectorSumx.Reset();
228 fSectorSumx2.Reset();
229 fSectorSumAB0.Reset();
230 fSectorSumAB1.Reset();
231 fSectorFilled.Reset();
232 fSectorValid.Reset();
233
234}
235
236// --------------------------------------------------------------------------
237//
238// Resets Arrays:
239//
240// Sets:
241// - fRawEvt to NULL
242// - fRunHeader to NULL
243// - fEvtHeader to NULL
244//
245void MExtractPedestal::Clear(const Option_t *o)
246{
247
248 fRawEvt = NULL;
249 fRunHeader = NULL;
250 fEvtHeader = NULL;
251
252 // If the size is yet set, set the size
253 if (fSumx.GetSize()>0)
254 ResetArrays();
255
256}
257
258// --------------------------------------------------------------------------
259//
260// Checks:
261// - if a window is odd
262//
263Bool_t MExtractPedestal::SetExtractWindow(UShort_t windowf, UShort_t windows)
264{
265
266 Bool_t rc = kTRUE;
267
268 const Int_t odd = windows & 0x1;
269
270 if (odd && !fExtractor)
271 {
272 *fLog << warn << GetDescriptor();
273 *fLog << " - WARNING: Window size in SetExtractWindow has to be even... ";
274 *fLog << " raising from " << windows << " to ";
275 windows += 1;
276 *fLog << windows << "!" << endl;
277 rc = kFALSE;
278 }
279
280 if (windows==0)
281 {
282 *fLog << warn << GetDescriptor();
283 *fLog << " - WARNING: Window size in SetExtractWindow has to be > 0... adjusting to 2!" << endl;
284 windows = 2;
285 rc = kFALSE;
286 }
287
288 fExtractWinSize = windows;
289 fExtractWinFirst = windowf;
290 fExtractWinLast = fExtractWinFirst+fExtractWinSize-1;
291
292 return rc;
293}
294
295// --------------------------------------------------------------------------
296//
297// Look for the following input containers:
298//
299// - MRawEvtData
300// - MRawRunHeader
301// - MRawEvtHeader
302// - MGeomCam
303//
304// The following output containers are also searched and created if
305// they were not found:
306//
307// - MPedestalCam with the name fPedContainerName
308//
309Int_t MExtractPedestal::PreProcess(MParList *pList)
310{
311
312 Clear();
313
314 fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData"));
315 if (!fRawEvt)
316 {
317 *fLog << err << AddSerialNumber("MRawEvtData") << " not found... aborting." << endl;
318 return kFALSE;
319 }
320
321 fRunHeader = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader"));
322 if (!fRunHeader)
323 {
324 *fLog << err << AddSerialNumber("MRawRunHeader") << " not found... aborting." << endl;
325 return kFALSE;
326 }
327
328 fEvtHeader = (MRawEvtHeader*)pList->FindObject(AddSerialNumber("MRawEvtHeader"));
329 if (!fEvtHeader)
330 {
331 *fLog << err << AddSerialNumber("MRawEvtHeader") << " not found... aborting." << endl;
332 return kFALSE;
333 }
334
335 fGeom = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam"));
336 if (!fGeom)
337 {
338 *fLog << err << AddSerialNumber("MGeomCam") << " not found... aborting." << endl;
339 return kFALSE;
340 }
341
342 if (fExtractor && !fPedestalsIn)
343 {
344 fPedestalsIn = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedestalCamIn), "MPedestalCam");
345 if (!fPedestalsIn)
346 {
347 *fLog << err << AddSerialNumber(fNamePedestalCamIn) << " not found... aborting." << endl;
348 return kFALSE;
349 }
350 }
351
352 if (!fPedestalsInter && fIntermediateStorage)
353 {
354 fPedestalsInter = (MPedestalCam*)pList->FindCreateObj("MPedestalCam", AddSerialNumber(fNamePedestalCamInter));
355 if (!fPedestalsInter)
356 return kFALSE;
357 }
358
359 if (!fPedestalsOut)
360 {
361 fPedestalsOut = (MPedestalCam*)pList->FindCreateObj("MPedestalCam", AddSerialNumber(fNamePedestalCamOut));
362 if (!fPedestalsOut)
363 return kFALSE;
364 }
365
366 *fLog << inf;
367 Print();
368
369 return fExtractor ? fExtractor->CallPreProcess(pList) : kTRUE;
370}
371
372Int_t MExtractPedestal::Process()
373{
374 if (fExtractor)
375 fExtractor->SetNoiseCalculation(fRandomCalculation);
376
377 const Int_t rc = Calc();
378
379 if (fExtractor)
380 fExtractor->SetNoiseCalculation(kFALSE);
381
382 return rc;
383}
384
385// ---------------------------------------------------------------------------------
386//
387// Sets the size (from MPedestalCam::GetSize() ) and resets the following arrays:
388// - fSumx
389// - fSumx2
390// - fSumAB0
391// - fSumAB1
392// - fAreaSumx
393// - fAreaSumx2
394// - fAreaSumAB0
395// - fAreaSumAB1
396// - fAreaFilled
397// - fAreaValid
398// - fSectorSumx
399// - fSectorSumx2
400// - fSectorSumAB0
401// - fSectorSumAB1
402// - fSectorFilled
403// - fSectorValid
404//
405Bool_t MExtractPedestal::ReInit(MParList *pList)
406{
407 // If the size is not yet set, set the size
408 if (fSumx.GetSize()==0)
409 {
410 const Int_t npixels = fPedestalsOut->GetSize();
411 const Int_t areas = fPedestalsOut->GetNumAverageArea();
412 const Int_t sectors = fPedestalsOut->GetNumAverageSector();
413
414 fSumx. Set(npixels);
415 fSumx2. Set(npixels);
416 fSumAB0.Set(npixels);
417 fSumAB1.Set(npixels);
418
419 fAreaSumx. Set(areas);
420 fAreaSumx2. Set(areas);
421 fAreaSumAB0.Set(areas);
422 fAreaSumAB1.Set(areas);
423 fAreaFilled.Set(areas);
424 fAreaValid .Set(areas);
425
426 fSectorSumx. Set(sectors);
427 fSectorSumx2. Set(sectors);
428 fSectorSumAB0.Set(sectors);
429 fSectorSumAB1.Set(sectors);
430 fSectorFilled.Set(sectors);
431 fSectorValid .Set(sectors);
432
433 for (Int_t i=0; i<npixels; i++)
434 {
435 const UInt_t aidx = (*fGeom)[i].GetAidx();
436 const UInt_t sector = (*fGeom)[i].GetSector();
437
438 fAreaValid [aidx] ++;
439 fSectorValid[sector]++;
440 }
441 }
442
443 if (fExtractor)
444 {
445 if (!((MTask*)fExtractor)->ReInit(pList))
446 return kFALSE;
447
448 SetExtractWindow(fExtractor->GetHiGainFirst(), (Int_t)TMath::Nint(fExtractor->GetNumHiGainSamples()));
449 }
450
451 return kTRUE;
452}
453
454Int_t MExtractPedestal::PostProcess()
455{
456 fPedestalsIn = NULL;
457 return fExtractor ? fExtractor->CallPostProcess() : kTRUE;
458}
459
460
461// --------------------------------------------------------------------------
462//
463// The following resources are available:
464// ExtractWindowFirst: 15
465// ExtractWindowSize: 6
466// NumEventsDump: 500
467// PedestalUpdate: yes
468// RandomCalculation: yes
469//
470Int_t MExtractPedestal::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
471{
472 Bool_t rc=kFALSE;
473
474 // find resource for numdump
475 if (IsEnvDefined(env, prefix, "NumDump", print))
476 {
477 const Int_t num = GetEnvValue(env, prefix, "NumDump", -1);
478 if (num<=0)
479 {
480 *fLog << err << GetDescriptor() << ": ERROR - NumDump invalid!" << endl;
481 return kERROR;
482 }
483
484 SetNumDump(num);
485 rc = kTRUE;
486 }
487
488 // find resource for numeventsdump
489 if (IsEnvDefined(env, prefix, "NumEventsDump", print))
490 {
491 SetNumEventsDump(GetEnvValue(env, prefix, "NumEventsDump", (Int_t)fNumEventsDump));
492 rc = kTRUE;
493 }
494
495 // find resource for numeventsdump
496 if (IsEnvDefined(env, prefix, "NumAreasDump", print))
497 {
498 SetNumAreasDump(GetEnvValue(env, prefix, "NumAreasDump", (Int_t)fNumAreasDump));
499 rc = kTRUE;
500 }
501
502 // find resource for numeventsdump
503 if (IsEnvDefined(env, prefix, "NumSectorsDump", print))
504 {
505 SetNumSectorsDump(GetEnvValue(env, prefix, "NumSectorsDump", (Int_t)fNumSectorsDump));
506 rc = kTRUE;
507 }
508
509 // find resource for pedestal update
510 if (IsEnvDefined(env, prefix, "PedestalUpdate", print))
511 {
512 SetPedestalUpdate(GetEnvValue(env, prefix, "PedestalUpdate", fPedestalUpdate));
513 rc = kTRUE;
514 }
515
516 if (IsEnvDefined(env, prefix, "IntermediateStorage", print))
517 {
518 SetIntermediateStorage(GetEnvValue(env, prefix, "IntermediateStorage", fIntermediateStorage));
519 rc = kTRUE;
520 }
521
522 // find resource for random calculation
523 if (IsEnvDefined(env, prefix, "RandomCalculation", print))
524 {
525 SetRandomCalculation(GetEnvValue(env, prefix, "RandomCalculation", fRandomCalculation));
526 rc = kTRUE;
527 }
528
529 // Find resources for ExtractWindow
530 Int_t ef = fExtractWinFirst;
531 Int_t es = fExtractWinSize;
532 if (IsEnvDefined(env, prefix, "ExtractWinFirst", print))
533 {
534 ef = GetEnvValue(env, prefix, "ExtractWinFirst", ef);
535 rc = kTRUE;
536 }
537 if (IsEnvDefined(env, prefix, "ExtractWinSize", print))
538 {
539 es = GetEnvValue(env, prefix, "ExtractWinSize", es);
540 rc = kTRUE;
541 }
542
543 SetExtractWindow(ef,es);
544
545 // find resource for MPedestalCam
546 if (IsEnvDefined(env, prefix, "NamePedestalCamIn", print))
547 {
548 SetNamePedestalCamIn(GetEnvValue(env, prefix, "NamePedestalCamIn", fNamePedestalCamIn));
549 rc = kTRUE;
550 }
551
552 if (IsEnvDefined(env, prefix, "NamePedestalCamInter", print))
553 {
554 SetNamePedestalCamInter(GetEnvValue(env, prefix, "NamePedestalCamInter", fNamePedestalCamInter));
555 rc = kTRUE;
556 }
557
558 if (IsEnvDefined(env, prefix, "NamePedestalCamOut", print))
559 {
560 SetNamePedestalCamOut(GetEnvValue(env, prefix, "NamePedestalCamOut", fNamePedestalCamOut));
561 rc = kTRUE;
562 }
563
564 return rc;
565}
566
567// ---------------------------------------------------------------------------------
568//
569// Calculates for pixel "idx":
570//
571// Ped per slice = sum / n / fExtractWinSize;
572// RMS per slice = sqrt { (sum2 - sum*sum/n) / (n-1) / fExtractWinSize }
573// ABOffset per slice = (fSumAB0[idx] - fSumAB1[idx]) / n / fExtractWinSize;
574//
575// Stores the results in MPedestalCam[pixid]
576//
577void MExtractPedestal::CalcPixResults(const UInt_t nevts, const UInt_t pixid)
578{
579 const Float_t sum = fSumx[pixid];
580 const Float_t sum2 = fSumx2[pixid];
581
582 // 1. Calculate the mean of the sums:
583 Float_t ped = sum/nevts;
584
585 // 2. Calculate the Variance of the sums:
586 Float_t var = (sum2-sum*sum/nevts)/(nevts-1.);
587
588 // 3. Calculate the amplitude of the 150MHz "AB" noise
589 Float_t abOffs = (fSumAB0[pixid] - fSumAB1[pixid]) / nevts;
590
591 // 4. Scale the mean, variance and AB-noise to the number of slices:
592 ped /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
593 var /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
594 abOffs /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
595
596 // 5. Calculate the RMS from the Variance:
597 const Float_t rms = var<0 ? 0 : TMath::Sqrt(var);
598
599 (*fPedestalsOut)[pixid].Set(ped, rms, abOffs, nevts);
600}
601
602// ---------------------------------------------------------------------------------
603//
604// Calculates for area idx "aidx" with "napix" valid pixels:
605//
606// Ped per slice = sum / nevts / fExtractWinSize / napix;
607// RMS per slice = sqrt { (sum2 - sum*sum/nevts) / (nevts-1) / fExtractWinSize / napix }
608// ABOffset per slice = (fSumAB0[idx] - fSumAB1[idx]) / nevts / fExtractWinSize / napix;
609//
610// Stores the results in MPedestalCam::GetAverageArea(aidx)
611//
612void MExtractPedestal::CalcAreaResults(const UInt_t nevts, const UInt_t napix, const UInt_t aidx)
613{
614 const Float_t sum = fAreaSumx[aidx];
615 const Float_t sum2 = fAreaSumx2[aidx];
616
617 // 1. Calculate the mean of the sums:
618 Float_t ped = sum/nevts;
619
620 // 2. Calculate the Variance of the sums:
621 Float_t var = (sum2-sum*sum/nevts)/(nevts-1.);
622
623 // 3. Calculate the amplitude of the 150MHz "AB" noise
624 Float_t abOffs = (fAreaSumAB0[aidx] - fAreaSumAB1[aidx]) / nevts;
625
626 // 4. Scale the mean, variance and AB-noise to the number of slices:
627 ped /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
628 var /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
629 abOffs /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
630
631 // 5. Scale the mean, variance and AB-noise to the number of pixels:
632 ped /= napix;
633 var /= napix;
634 abOffs /= napix;
635
636 // 6. Calculate the RMS from the Variance:
637 const Float_t rms = var<0 ? 0 : TMath::Sqrt(var);
638
639 fPedestalsOut->GetAverageArea(aidx).Set(ped, rms, abOffs, nevts);
640}
641
642// ---------------------------------------------------------------------------------
643//
644// Calculates for sector idx "sector" with "nspix" valid pixels:
645//
646// Ped per slice = sum / nevts / fExtractWinSize / nspix;
647// RMS per slice = sqrt { (sum2 - sum*sum/nevts) / (nevts-1) / fExtractWinSize / nspix }
648// ABOffset per slice = (fSumAB0[idx] - fSumAB1[idx]) / nevts / fExtractWinSize / nspix;
649//
650// Stores the results in MPedestalCam::GetAverageSector(sector)
651//
652void MExtractPedestal::CalcSectorResults(const UInt_t nevts, const UInt_t nspix, const UInt_t sector)
653{
654 const Float_t sum = fSectorSumx[sector];
655 const Float_t sum2 = fSectorSumx2[sector];
656
657 // 1. Calculate the mean of the sums:
658 Float_t ped = sum/nevts;
659
660 // 2. Calculate the Variance of the sums:
661 Float_t var = (sum2-sum*sum/nevts)/(nevts-1.);
662
663 // 3. Calculate the amplitude of the 150MHz "AB" noise
664 Float_t abOffs = (fSectorSumAB0[sector] - fSectorSumAB1[sector]) / nevts;
665
666 // 4. Scale the mean, variance and AB-noise to the number of slices:
667 ped /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
668 var /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
669 abOffs /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
670
671 // 5. Scale the mean, variance and AB-noise to the number of pixels:
672 ped /= nspix;
673 var /= nspix;
674 abOffs /= nspix;
675
676 // 6. Calculate the RMS from the Variance:
677 const Float_t rms = var<0 ? 0 : TMath::Sqrt(var);
678
679 fPedestalsOut->GetAverageSector(sector).Set(ped, rms, abOffs, nevts);
680}
681
682void MExtractPedestal::Print(Option_t *o) const
683{
684 *fLog << GetDescriptor() << ":" << endl;
685 *fLog << "Name of input MPedestalCam: " << (fPedestalsIn?fPedestalsIn->GetName():fNamePedestalCamIn.Data()) << " (" << fPedestalsIn << ")" << endl;
686 *fLog << "Name of interm. MPedestalCam: " << (fPedestalsInter?fPedestalsInter->GetName():fNamePedestalCamInter.Data()) << " (" << fPedestalsInter << ")" << endl;
687 *fLog << "Name of output MPedestalCam: " << (fPedestalsOut?fPedestalsOut->GetName():fNamePedestalCamOut.Data()) << " (" << fPedestalsOut << ")" << endl;
688 *fLog << "Intermediate Storage is " << (fIntermediateStorage?"on":"off") << endl;
689 *fLog << "Pedestal Update is " << (fPedestalUpdate?"on":"off") << endl;
690 if (fPedestalUpdate)
691 {
692 *fLog << "Num evts for pedestal calc: " << fNumEventsDump << endl;
693 *fLog << "Num evts for avg.areas calc: " << fNumAreasDump << endl;
694 *fLog << "Num evts for avg.sector calc: " << fNumSectorsDump << endl;
695 }
696 if (fExtractor)
697 {
698 *fLog << "Extractor used: " << fExtractor->ClassName() << " (";
699 *fLog << (fRandomCalculation?"":"non-") << "random)" << endl;
700 }
701}
Note: See TracBrowser for help on using the repository browser.