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

Last change on this file since 6893 was 6824, checked in by tbretz, 20 years ago
*** empty log message ***
File size: 22.1 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";
177
178// --------------------------------------------------------------------------
179//
180// Default constructor:
181//
182// Sets:
183// - all pointers to NULL
184//
185// Calls:
186// - AddToBranchList("fHiGainPixId");
187// - AddToBranchList("fHiGainFadcSamples");
188// - Clear()
189//
190MExtractPedestal::MExtractPedestal(const char *name, const char *title)
191 : fGeom(NULL), fPedestalsIn(NULL), fPedestalsInter(NULL), fPedestalsOut(NULL),
192 fExtractor(NULL), fExtractWinFirst(0), fExtractWinSize(0)
193{
194 fName = name ? name : "MExtractPedestal";
195 fTitle = title ? title : "Base class to calculate pedestals";
196
197 AddToBranchList("fHiGainPixId");
198 AddToBranchList("fLoGainPixId");
199 AddToBranchList("fHiGainFadcSamples");
200 AddToBranchList("fLoGainFadcSamples");
201
202 SetIntermediateStorage( kFALSE );
203 SetPedestalUpdate ( kTRUE );
204 SetRandomCalculation ( kTRUE );
205
206 SetNamePedestalCamIn();
207 SetNamePedestalCamOut();
208 SetNumDump();
209
210 Clear();
211}
212
213void MExtractPedestal::ResetArrays()
214{
215 // Reset contents of arrays.
216 fSumx.Reset();
217 fSumx2.Reset();
218 fSumAB0.Reset();
219 fSumAB1.Reset();
220 fAreaSumx.Reset();
221 fAreaSumx2.Reset();
222 fAreaSumAB0.Reset();
223 fAreaSumAB1.Reset();
224 fAreaFilled.Reset();
225 fAreaValid.Reset();
226 fSectorSumx.Reset();
227 fSectorSumx2.Reset();
228 fSectorSumAB0.Reset();
229 fSectorSumAB1.Reset();
230 fSectorFilled.Reset();
231 fSectorValid.Reset();
232
233}
234
235// --------------------------------------------------------------------------
236//
237// Resets Arrays:
238//
239// Sets:
240// - fRawEvt to NULL
241// - fRunHeader to NULL
242// - fEvtHeader to NULL
243//
244void MExtractPedestal::Clear(const Option_t *o)
245{
246
247 fRawEvt = NULL;
248 fRunHeader = NULL;
249 fEvtHeader = NULL;
250
251 // If the size is yet set, set the size
252 if (fSumx.GetSize()>0)
253 ResetArrays();
254
255}
256
257// --------------------------------------------------------------------------
258//
259// Checks:
260// - if a window is odd
261//
262Bool_t MExtractPedestal::SetExtractWindow(UShort_t windowf, UShort_t windows)
263{
264
265 Bool_t rc = kTRUE;
266
267 const Int_t odd = windows & 0x1;
268
269 if (odd && !fExtractor)
270 {
271 *fLog << warn << GetDescriptor();
272 *fLog << " - WARNING: Window size in SetExtractWindow has to be even... ";
273 *fLog << " raising from " << windows << " to ";
274 windows += 1;
275 *fLog << windows << "!" << endl;
276 rc = kFALSE;
277 }
278
279 if (windows==0)
280 {
281 *fLog << warn << GetDescriptor();
282 *fLog << " - WARNING: Window size in SetExtractWindow has to be > 0... adjusting to 2!" << endl;
283 windows = 2;
284 rc = kFALSE;
285 }
286
287 fExtractWinSize = windows;
288 fExtractWinFirst = windowf;
289 fExtractWinLast = fExtractWinFirst+fExtractWinSize-1;
290
291 return rc;
292}
293
294// --------------------------------------------------------------------------
295//
296// Look for the following input containers:
297//
298// - MRawEvtData
299// - MRawRunHeader
300// - MRawEvtHeader
301// - MGeomCam
302//
303// The following output containers are also searched and created if
304// they were not found:
305//
306// - MPedestalCam with the name fPedContainerName
307//
308Int_t MExtractPedestal::PreProcess(MParList *pList)
309{
310
311 Clear();
312
313 fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData"));
314 if (!fRawEvt)
315 {
316 *fLog << err << AddSerialNumber("MRawEvtData") << " not found... aborting." << endl;
317 return kFALSE;
318 }
319
320 fRunHeader = (MRawRunHeader*)pList->FindObject(AddSerialNumber("MRawRunHeader"));
321 if (!fRunHeader)
322 {
323 *fLog << err << AddSerialNumber("MRawRunHeader") << " not found... aborting." << endl;
324 return kFALSE;
325 }
326
327 fEvtHeader = (MRawEvtHeader*)pList->FindObject(AddSerialNumber("MRawEvtHeader"));
328 if (!fEvtHeader)
329 {
330 *fLog << err << AddSerialNumber("MRawEvtHeader") << " not found... aborting." << endl;
331 return kFALSE;
332 }
333
334 fGeom = (MGeomCam*)pList->FindObject(AddSerialNumber("MGeomCam"));
335 if (!fGeom)
336 {
337 *fLog << err << AddSerialNumber("MGeomCam") << " not found... aborting." << endl;
338 return kFALSE;
339 }
340
341 if (fExtractor && !fPedestalsIn)
342 {
343 fPedestalsIn = (MPedestalCam*)pList->FindObject(AddSerialNumber(fNamePedestalCamIn), "MPedestalCam");
344 if (!fPedestalsIn)
345 {
346 *fLog << err << AddSerialNumber(fNamePedestalCamIn) << " not found... aborting." << endl;
347 return kFALSE;
348 }
349 }
350
351 if (!fPedestalsInter && fIntermediateStorage)
352 {
353 fPedestalsInter = (MPedestalCam*)pList->FindCreateObj("MPedestalCam", AddSerialNumber(fNamePedestalCamInter));
354 if (!fPedestalsInter)
355 return kFALSE;
356 }
357
358 if (!fPedestalsOut)
359 {
360 fPedestalsOut = (MPedestalCam*)pList->FindCreateObj("MPedestalCam", AddSerialNumber(fNamePedestalCamOut));
361 if (!fPedestalsOut)
362 return kFALSE;
363 }
364
365 *fLog << inf;
366 Print();
367
368 return fExtractor ? fExtractor->CallPreProcess(pList) : kTRUE;
369}
370
371Int_t MExtractPedestal::Process()
372{
373 if (fExtractor)
374 fExtractor->SetNoiseCalculation(fRandomCalculation);
375
376 const Int_t rc = Calc();
377
378 if (fExtractor)
379 fExtractor->SetNoiseCalculation(kFALSE);
380
381 return rc;
382}
383
384// ---------------------------------------------------------------------------------
385//
386// Sets the size (from MPedestalCam::GetSize() ) and resets the following arrays:
387// - fSumx
388// - fSumx2
389// - fSumAB0
390// - fSumAB1
391// - fAreaSumx
392// - fAreaSumx2
393// - fAreaSumAB0
394// - fAreaSumAB1
395// - fAreaFilled
396// - fAreaValid
397// - fSectorSumx
398// - fSectorSumx2
399// - fSectorSumAB0
400// - fSectorSumAB1
401// - fSectorFilled
402// - fSectorValid
403//
404Bool_t MExtractPedestal::ReInit(MParList *pList)
405{
406 // If the size is not yet set, set the size
407 if (fSumx.GetSize()==0)
408 {
409 const Int_t npixels = fPedestalsOut->GetSize();
410 const Int_t areas = fPedestalsOut->GetNumAverageArea();
411 const Int_t sectors = fPedestalsOut->GetNumAverageSector();
412
413 fSumx. Set(npixels);
414 fSumx2. Set(npixels);
415 fSumAB0.Set(npixels);
416 fSumAB1.Set(npixels);
417
418 fAreaSumx. Set(areas);
419 fAreaSumx2. Set(areas);
420 fAreaSumAB0.Set(areas);
421 fAreaSumAB1.Set(areas);
422 fAreaFilled.Set(areas);
423 fAreaValid .Set(areas);
424
425 fSectorSumx. Set(sectors);
426 fSectorSumx2. Set(sectors);
427 fSectorSumAB0.Set(sectors);
428 fSectorSumAB1.Set(sectors);
429 fSectorFilled.Set(sectors);
430 fSectorValid .Set(sectors);
431
432 for (Int_t i=0; i<npixels; i++)
433 {
434 const UInt_t aidx = (*fGeom)[i].GetAidx();
435 const UInt_t sector = (*fGeom)[i].GetSector();
436
437 fAreaValid [aidx] ++;
438 fSectorValid[sector]++;
439 }
440 }
441
442 if (fExtractor)
443 {
444 if (!((MTask*)fExtractor)->ReInit(pList))
445 return kFALSE;
446
447 if (!fExtractor->InitArrays())
448 return kFALSE;
449
450 SetExtractWindow(fExtractor->GetHiGainFirst(), (Int_t)TMath::Nint(fExtractor->GetNumHiGainSamples()));
451 }
452
453 return kTRUE;
454}
455
456Int_t MExtractPedestal::PostProcess()
457{
458 fPedestalsIn = NULL;
459 return fExtractor ? fExtractor->CallPostProcess() : kTRUE;
460}
461
462
463// --------------------------------------------------------------------------
464//
465// The following resources are available:
466// ExtractWindowFirst: 15
467// ExtractWindowSize: 6
468// NumEventsDump: 500
469// PedestalUpdate: yes
470// RandomCalculation: yes
471//
472Int_t MExtractPedestal::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
473{
474 Bool_t rc=kFALSE;
475
476 // find resource for numeventsdump
477 if (IsEnvDefined(env, prefix, "NumEventsDump", print))
478 {
479 SetNumEventsDump(GetEnvValue(env, prefix, "NumEventsDump", (Int_t)fNumEventsDump));
480 rc = kTRUE;
481 }
482
483 // find resource for numeventsdump
484 if (IsEnvDefined(env, prefix, "NumAreasDump", print))
485 {
486 SetNumAreasDump(GetEnvValue(env, prefix, "NumAreasDump", (Int_t)fNumAreasDump));
487 rc = kTRUE;
488 }
489
490 // find resource for numeventsdump
491 if (IsEnvDefined(env, prefix, "NumSectorsDump", print))
492 {
493 SetNumSectorsDump(GetEnvValue(env, prefix, "NumSectorsDump", (Int_t)fNumSectorsDump));
494 rc = kTRUE;
495 }
496
497 // find resource for pedestal update
498 if (IsEnvDefined(env, prefix, "PedestalUpdate", print))
499 {
500 SetPedestalUpdate(GetEnvValue(env, prefix, "PedestalUpdate", fPedestalUpdate));
501 rc = kTRUE;
502 }
503
504 if (IsEnvDefined(env, prefix, "IntermediateStorage", print))
505 {
506 SetIntermediateStorage(GetEnvValue(env, prefix, "IntermediateStorage", fIntermediateStorage));
507 rc = kTRUE;
508 }
509
510 // find resource for random calculation
511 if (IsEnvDefined(env, prefix, "RandomCalculation", print))
512 {
513 SetRandomCalculation(GetEnvValue(env, prefix, "RandomCalculation", fRandomCalculation));
514 rc = kTRUE;
515 }
516
517 // Find resources for ExtractWindow
518 Int_t ef = fExtractWinFirst;
519 Int_t es = fExtractWinSize;
520 if (IsEnvDefined(env, prefix, "ExtractWinFirst", print))
521 {
522 ef = GetEnvValue(env, prefix, "ExtractWinFirst", ef);
523 rc = kTRUE;
524 }
525 if (IsEnvDefined(env, prefix, "ExtractWinSize", print))
526 {
527 es = GetEnvValue(env, prefix, "ExtractWinSize", es);
528 rc = kTRUE;
529 }
530
531 SetExtractWindow(ef,es);
532
533 // find resource for MPedestalCam
534 if (IsEnvDefined(env, prefix, "NamePedestalCamIn", print))
535 {
536 SetNamePedestalCamIn(GetEnvValue(env, prefix, "NamePedestalCamIn", fNamePedestalCamIn));
537 rc = kTRUE;
538 }
539
540 if (IsEnvDefined(env, prefix, "NamePedestalCamInter", print))
541 {
542 SetNamePedestalCamInter(GetEnvValue(env, prefix, "NamePedestalCamInter", fNamePedestalCamInter));
543 rc = kTRUE;
544 }
545
546 if (IsEnvDefined(env, prefix, "NamePedestalCamOut", print))
547 {
548 SetNamePedestalCamOut(GetEnvValue(env, prefix, "NamePedestalCamOut", fNamePedestalCamOut));
549 rc = kTRUE;
550 }
551
552 return rc;
553}
554
555// ---------------------------------------------------------------------------------
556//
557// Calculates for pixel "idx":
558//
559// Ped per slice = sum / n / fExtractWinSize;
560// RMS per slice = sqrt { (sum2 - sum*sum/n) / (n-1) / fExtractWinSize }
561// ABOffset per slice = (fSumAB0[idx] - fSumAB1[idx]) / n / fExtractWinSize;
562//
563// Stores the results in MPedestalCam[pixid]
564//
565void MExtractPedestal::CalcPixResults(const UInt_t nevts, const UInt_t pixid)
566{
567 const Float_t sum = fSumx[pixid];
568 const Float_t sum2 = fSumx2[pixid];
569
570 // 1. Calculate the mean of the sums:
571 Float_t ped = sum/nevts;
572
573 // 2. Calculate the Variance of the sums:
574 Float_t var = (sum2-sum*sum/nevts)/(nevts-1.);
575
576 // 3. Calculate the amplitude of the 150MHz "AB" noise
577 Float_t abOffs = (fSumAB0[pixid] - fSumAB1[pixid]) / nevts;
578
579 // 4. Scale the mean, variance and AB-noise to the number of slices:
580 ped /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
581 var /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
582 abOffs /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
583
584 // 5. Calculate the RMS from the Variance:
585 const Float_t rms = var<0 ? 0 : TMath::Sqrt(var);
586
587 (*fPedestalsOut)[pixid].Set(ped, rms, abOffs, nevts);
588}
589
590// ---------------------------------------------------------------------------------
591//
592// Calculates for area idx "aidx" with "napix" valid pixels:
593//
594// Ped per slice = sum / nevts / fExtractWinSize / napix;
595// RMS per slice = sqrt { (sum2 - sum*sum/nevts) / (nevts-1) / fExtractWinSize / napix }
596// ABOffset per slice = (fSumAB0[idx] - fSumAB1[idx]) / nevts / fExtractWinSize / napix;
597//
598// Stores the results in MPedestalCam::GetAverageArea(aidx)
599//
600void MExtractPedestal::CalcAreaResults(const UInt_t nevts, const UInt_t napix, const UInt_t aidx)
601{
602 const Float_t sum = fAreaSumx[aidx];
603 const Float_t sum2 = fAreaSumx2[aidx];
604
605 // 1. Calculate the mean of the sums:
606 Float_t ped = sum/nevts;
607
608 // 2. Calculate the Variance of the sums:
609 Float_t var = (sum2-sum*sum/nevts)/(nevts-1.);
610
611 // 3. Calculate the amplitude of the 150MHz "AB" noise
612 Float_t abOffs = (fAreaSumAB0[aidx] - fAreaSumAB1[aidx]) / nevts;
613
614 // 4. Scale the mean, variance and AB-noise to the number of slices:
615 ped /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
616 var /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
617 abOffs /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
618
619 // 5. Scale the mean, variance and AB-noise to the number of pixels:
620 ped /= napix;
621 var /= napix;
622 abOffs /= napix;
623
624 // 6. Calculate the RMS from the Variance:
625 const Float_t rms = var<0 ? 0 : TMath::Sqrt(var);
626
627 fPedestalsOut->GetAverageArea(aidx).Set(ped, rms, abOffs, nevts);
628}
629
630// ---------------------------------------------------------------------------------
631//
632// Calculates for sector idx "sector" with "nspix" valid pixels:
633//
634// Ped per slice = sum / nevts / fExtractWinSize / nspix;
635// RMS per slice = sqrt { (sum2 - sum*sum/nevts) / (nevts-1) / fExtractWinSize / nspix }
636// ABOffset per slice = (fSumAB0[idx] - fSumAB1[idx]) / nevts / fExtractWinSize / nspix;
637//
638// Stores the results in MPedestalCam::GetAverageSector(sector)
639//
640void MExtractPedestal::CalcSectorResults(const UInt_t nevts, const UInt_t nspix, const UInt_t sector)
641{
642 const Float_t sum = fSectorSumx[sector];
643 const Float_t sum2 = fSectorSumx2[sector];
644
645 // 1. Calculate the mean of the sums:
646 Float_t ped = sum/nevts;
647
648 // 2. Calculate the Variance of the sums:
649 Float_t var = (sum2-sum*sum/nevts)/(nevts-1.);
650
651 // 3. Calculate the amplitude of the 150MHz "AB" noise
652 Float_t abOffs = (fSectorSumAB0[sector] - fSectorSumAB1[sector]) / nevts;
653
654 // 4. Scale the mean, variance and AB-noise to the number of slices:
655 ped /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
656 var /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
657 abOffs /= fExtractor ? fExtractor->GetNumHiGainSamples() : fExtractWinSize;
658
659 // 5. Scale the mean, variance and AB-noise to the number of pixels:
660 ped /= nspix;
661 var /= nspix;
662 abOffs /= nspix;
663
664 // 6. Calculate the RMS from the Variance:
665 const Float_t rms = var<0 ? 0 : TMath::Sqrt(var);
666
667 fPedestalsOut->GetAverageSector(sector).Set(ped, rms, abOffs, nevts);
668}
669
670void MExtractPedestal::Print(Option_t *o) const
671{
672 *fLog << GetDescriptor() << ":" << endl;
673 *fLog << "Name of input MPedestalCam: " << (fPedestalsIn?fPedestalsIn->GetName():fNamePedestalCamIn.Data()) << " (" << fPedestalsIn << ")" << endl;
674 *fLog << "Name of interm. MPedestalCam: " << (fPedestalsInter?fPedestalsInter->GetName():fNamePedestalCamInter.Data()) << " (" << fPedestalsInter << ")" << endl;
675 *fLog << "Name of output MPedestalCam: " << (fPedestalsOut?fPedestalsOut->GetName():fNamePedestalCamOut.Data()) << " (" << fPedestalsOut << ")" << endl;
676 *fLog << "Intermediate Storage is " << (fIntermediateStorage?"on":"off") << endl;
677 *fLog << "Pedestal Update is " << (fPedestalUpdate?"on":"off") << endl;
678 if (fPedestalUpdate)
679 {
680 *fLog << "Num evts for pedestal calc: " << fNumEventsDump << endl;
681 *fLog << "Num evts for avg.areas calc: " << fNumAreasDump << endl;
682 *fLog << "Num evts for avg.sector calc: " << fNumSectorsDump << endl;
683 }
684 if (fExtractor)
685 {
686 *fLog << "Extractor used: " << fExtractor->ClassName() << " (";
687 *fLog << (fRandomCalculation?"":"non-") << "random)" << endl;
688 }
689}
Note: See TracBrowser for help on using the repository browser.