source: trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc@ 3698

Last change on this file since 3698 was 3698, checked in by gaug, 21 years ago
*** empty log message ***
File size: 43.9 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 02/2004 <mailto:markus@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25//////////////////////////////////////////////////////////////////////////////
26//
27// MCalibrationChargeCalc
28//
29// Task to calculate the calibration conversion factors and quantum efficiencies
30// from the fit results to the summed FADC slice distributions delivered by
31// MCalibrationChargeCam, MCalibrationChargePix, MCalibrationChargeBlindPix and
32// MCalibrationChargePINDiode, calculated and filled by MHCalibrationChargeCam,
33// MHCalibrationChargePix, MHCalibrationChargeBlindPix and MHCalibrationChargePINDiode.
34//
35// PreProcess(): Initialize pointers to MCalibrationChargeCam, MCalibrationChargeBlindPix
36// MCalibrationChargePINDiode and MCalibrationQECam
37//
38// Initialize pulser light wavelength
39//
40// ReInit(): MCalibrationCam::InitSize(NumPixels) is called from MGeomApply (which allocates
41// memory in a TClonesArray of type MCalibrationChargePix)
42// Initializes pointer to MBadPixelsCam
43//
44// Process(): Nothing to be done, histograms getting filled by MHCalibrationChargeCam
45//
46// PostProcess(): - FinalizePedestals()
47// - FinalizeAvPedestals()
48// - FinalizeCharges()
49// - FinalizeFFactorMethod()
50// - FinalizeBadPixels()
51// - FinalizeBlindPixel()
52// - FinalizePINDiode()
53// - FinalizeFFactorQECam()
54// - FinalizeBlindPixelQECam()
55// - FinalizePINDiodeQECam()
56//
57// Input Containers:
58// MCalibrationChargeCam
59// MCalibrationChargeBlindPix
60// MCalibrationChargePINDiode
61// MCalibrationQECam
62// MExtractedSignalCam
63// MExtractedSignalBlindPixel
64// MExtractedSignalPINDiode
65// MPedestalCam
66// MBadPixelsCam
67// MGeomCam
68// MTime
69//
70// Output Containers:
71// MCalibrationChargeCam
72// MCalibrationChargeBlindPix
73// MCalibrationChargePINDiode
74// MCalibrationQECam
75// MBadPixelsCam
76//
77//
78// Preliminary description of the calibration in photons (email from 12/02/04)
79//
80// Why calibrating in photons:
81// ===========================
82//
83// At the Barcelona meeting in 2002, we decided to calibrate the camera in
84// photons. This for the following reasons:
85//
86// * The physical quantity arriving at the camera are photons. This is
87// the direct physical information from the air shower. The photons
88// have a flux and a spectrum.
89//
90// * The photon fluxes depend mostly on the shower energy (with
91// corrections deriving from the observation conditions), while the photon
92// spectra depend mostly on the observation conditions: zenith angle,
93// quality of the air, also the impact parameter of the shower.
94//
95// * The photomultiplier, in turn, has different response properties
96// (quantum efficiencies) for photons of different colour. (Moreover,
97// different pixels have slightly different quantum efficiencies).
98// The resulting number of photo-electrons is then amplified (linearly)
99// with respect to the photo-electron flux.
100//
101// * In the ideal case, one would like to disentagle the effects
102// of the observation conditions from the primary particle energy (which
103// one likes to measure). To do so, one needs:
104//
105// 1) A reliable calibration relating the FADC counts to the photo-electron
106// flux -> This is accomplished with the F-Factor method.
107//
108// 2) A reliable calibration of the wavelength-dependent quantum efficiency
109// -> This is accomplished with the combination of the three methods,
110// together with QE-measurements performed by David in order to do
111// the interpolation.
112//
113// 3) A reliable calibration of the observation conditions. This means:
114// - Tracing the atmospheric conditions -> LIDAR
115// - Tracing the observation zenith angle -> Drive System
116//
117// 4) Some knowlegde about the impact parameter:
118// - This is the only part which cannot be accomplished well with a
119// single telescope. We would thus need to convolute the spectrum
120// over the distribution of impact parameters.
121//
122//
123// How an ideal calibration would look like:
124// =========================================
125//
126// We know from the combined PIN-Diode and Blind-Pixel Method the response of
127// each pixel to well-measured light fluxes in three representative
128// wavelengths (green, blue, UV). We also know the response to these light
129// fluxes in photo-electrons. Thus, we can derive:
130//
131// - conversion factors to photo-electrons
132// - conversion factors to photons in three wavelengths.
133//
134// Together with David's measurements and some MC-simulation, we should be
135// able to derive tables for typical Cherenkov-photon spectra - convoluted
136// with the impact parameters and depending on the athmospheric conditions
137// and the zenith angle (the "outer parameters").
138//
139// From these tables we can create "calibration tables" containing some
140// effective quantum efficiency depending on these outer parameters and which
141// are different for each pixel.
142//
143// In an ideal MCalibrate, one would thus have to convert first the FADC
144// slices to Photo-electrons and then, depending on the outer parameters,
145// look up the effective quantum efficiency and get the mean number of
146// photons which is then used for the further analysis.
147//
148// How the (first) MAGIC calibration should look like:
149// ===================================================
150//
151// For the moment, we have only one reliable calibration method, although
152// with very large systematic errors. This is the F-Factor method. Knowing
153// that the light is uniform over the whole camera (which I would not at all
154// guarantee in the case of the CT1 pulser), one could in principle already
155// perform a relative calibration of the quantum efficiencies in the UV.
156// However, the spread in QE at UV is about 10-15% (according to the plot
157// that Abelardo sent around last time. The spread in photo-electrons is 15%
158// for the inner pixels, but much larger (40%) for the outer ones.
159//
160// I'm not sure if we can already say that we have measured the relative
161// difference in quantum efficiency for the inner pixels and produce a first
162// QE-table for each pixel. To so, I would rather check in other wavelengths
163// (which we can do in about one-two weeks when the optical transmission of
164// the calibration trigger is installed).
165//
166// Thus, for the moment being, I would join Thomas proposal to calibrate in
167// photo-electrons and apply one stupid average quantum efficiency for all
168// pixels. This keeping in mind that we will have much preciser information
169// in about one to two weeks.
170//
171//
172// What MCalibrate should calculate and what should be stored:
173// ===========================================================
174//
175// It is clear that in the end, MCerPhotEvt will store photons.
176// MCalibrationCam stores the conversionfactors to photo-electrons and also
177// some tables of how to apply the conversion to photons, given the outer
178// parameters. This is not yet implemented and not even discussed.
179//
180// To start, I would suggest that we define the "average quantum efficiency"
181// (maybe something like 25+-3%) and apply them equally to all
182// photo-electrons. Later, this average factor can be easily replaced by a
183// pixel-dependent factor and later by a (pixel-dependent) table.
184//
185//
186//
187//////////////////////////////////////////////////////////////////////////////
188#include "MCalibrationChargeCalc.h"
189
190#include <TSystem.h>
191#include <TH1.h>
192
193#include "MLog.h"
194#include "MLogManip.h"
195
196#include "MParList.h"
197
198#include "MRawRunHeader.h"
199#include "MRawEvtPixelIter.h"
200
201#include "MGeomCam.h"
202#include "MGeomPix.h"
203
204#include "MPedestalCam.h"
205#include "MPedestalPix.h"
206
207#include "MCalibrationChargeCam.h"
208#include "MCalibrationChargePix.h"
209#include "MCalibrationChargePINDiode.h"
210#include "MCalibrationChargeBlindPix.h"
211
212#include "MExtractedSignalCam.h"
213#include "MExtractedSignalPix.h"
214#include "MExtractedSignalBlindPixel.h"
215#include "MExtractedSignalPINDiode.h"
216
217#include "MBadPixelsCam.h"
218#include "MBadPixelsPix.h"
219
220#include "MCalibrationQECam.h"
221#include "MCalibrationQEPix.h"
222
223#include "MCalibrationCam.h"
224
225ClassImp(MCalibrationChargeCalc);
226
227using namespace std;
228
229const Float_t MCalibrationChargeCalc::fgChargeLimit = 3.;
230const Float_t MCalibrationChargeCalc::fgChargeErrLimit = 0.;
231const Float_t MCalibrationChargeCalc::fgChargeRelErrLimit = 1.;
232const Float_t MCalibrationChargeCalc::fgLambdaErrLimit = 0.2;
233const Float_t MCalibrationChargeCalc::fgLambdaCheckLimit = 0.2;
234const Float_t MCalibrationChargeCalc::fgPheErrLimit = 5.;
235// --------------------------------------------------------------------------
236//
237// Default constructor.
238//
239// Sets all pointers to NULL
240//
241// Calls AddToBranchList for:
242// - MRawEvtData.fHiGainPixId
243// - MRawEvtData.fLoGainPixId
244// - MRawEvtData.fHiGainFadcSamples
245// - MRawEvtData.fLoGainFadcSamples
246//
247// Initializes:
248// - fChargeLimit to fgChargeLimit
249// - fChargeErrLimit to fgChargeErrLimit
250// - fChargeRelErrLimit to fgChargeRelErrLimit
251// - fLambdaCheckLimit to fgLambdaCheckLimit
252// - fLambdaErrLimit to fgLambdaErrLimit
253// - fPheErrLimit to fgPheErrLimit
254// - fPulserColor to MCalibrationCam::kCT1
255//
256// Calls:
257// - Clear()
258//
259MCalibrationChargeCalc::MCalibrationChargeCalc(const char *name, const char *title)
260 : fBadPixels(NULL), fCam(NULL), fBlindPixel(NULL), fPINDiode(NULL),
261 fQECam(NULL), fGeom(NULL), fPedestals(NULL), fEvtTime(NULL)
262 {
263
264 fName = name ? name : "MCalibrationChargeCalc";
265 fTitle = title ? title : "Task to calculate the calibration constants and MCalibrationCam ";
266
267 AddToBranchList("MRawEvtData.fHiGainPixId");
268 AddToBranchList("MRawEvtData.fLoGainPixId");
269 AddToBranchList("MRawEvtData.fHiGainFadcSamples");
270 AddToBranchList("MRawEvtData.fLoGainFadcSamples");
271
272 SetChargeLimit();
273 SetChargeErrLimit();
274 SetChargeRelErrLimit();
275 SetLambdaCheckLimit();
276 SetLambdaErrLimit();
277 SetPheErrLimit();
278 SetPulserColor(MCalibrationCam::kCT1);
279
280 Clear();
281
282}
283
284// --------------------------------------------------------------------------
285//
286// Sets:
287// - all variables to 0.,
288// - all flags to kFALSE
289//
290void MCalibrationChargeCalc::Clear(const Option_t *o)
291{
292
293 fNumHiGainSamples = 0.;
294 fNumLoGainSamples = 0.;
295 fSqrtHiGainSamples = 0.;
296 fSqrtLoGainSamples = 0.;
297 SkipHiLoGainCalibration( kFALSE );
298}
299
300
301// -----------------------------------------------------------------------------------
302//
303// The following container are searched for and execution aborted if not in MParList:
304// - MPedestalCam
305//
306// The following containers are searched and created if they were not found:
307//
308// - MCalibrationQECam
309// - MBadPixelsCam
310//
311// The following output containers are only searched, but not created. If they
312// cannot be found, the corresponding calibration part is only skipped.
313//
314// - MTime
315//
316Int_t MCalibrationChargeCalc::PreProcess(MParList *pList)
317{
318
319 //
320 // Containers that have to be there.
321 //
322 fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
323 if (!fPedestals)
324 {
325 *fLog << err << "MPedestalCam not found... aborting" << endl;
326 return kFALSE;
327 }
328
329 //
330 // Containers that are created in case that they are not there.
331 //
332 fQECam = (MCalibrationQECam*)pList->FindCreateObj("MCalibrationQECam");
333 if (!fQECam)
334 {
335 *fLog << err << "Cannot find nor create MCalibrationQECam... aborting" << endl;
336 return kFALSE;
337 }
338
339 fBadPixels = (MBadPixelsCam*)pList->FindCreateObj("MBadPixelsCam");
340 if (!fBadPixels)
341 {
342 *fLog << err << "Could not find or create MBadPixelsCam ... aborting." << endl;
343 return kFALSE;
344 }
345
346
347 fEvtTime = (MTime*)pList->FindObject("MTime");
348
349 return kTRUE;
350}
351
352
353// --------------------------------------------------------------------------
354//
355// Search for the following input containers and abort if not existing:
356// - MGeomCam
357// - MCalibrationChargeCam
358//
359// Search for the following input containers and give a warning if not existing:
360// - MCalibrationChargeBlindPix
361// - MCalibrationChargePINDiode
362//
363// Sets the pulser colour in:
364//
365// - MCalibrationChargeCam
366// - MCalibrationChargeBlindPix (if existing)
367// - MCalibrationChargePINDiode (if existing)
368//
369// It retrieves the following variables from MCalibrationChargeCam:
370//
371// - fNumHiGainSamples
372// - fNumLoGainSamples
373//
374// It defines the PixId of every pixel in:
375//
376// - MCalibrationChargeCam
377// - MCalibrationQECam
378//
379// It sets all pixels in excluded which have the flag fBadBixelsPix::IsBad() set in:
380//
381// - MCalibrationChargePix
382// - MCalibrationQEPix
383//
384// It tests the pulser colour one more time...
385//
386Bool_t MCalibrationChargeCalc::ReInit(MParList *pList )
387{
388
389 fGeom = (MGeomCam*)pList->FindObject("MGeomCam");
390 if (!fGeom)
391 {
392 *fLog << err << "No MGeomCam found... aborting." << endl;
393 return kFALSE;
394 }
395
396 fCam = (MCalibrationChargeCam*)pList->FindObject("MCalibrationChargeCam");
397 if (!fCam)
398 {
399 *fLog << err << "Cannot find MCalibrationChargeCam... aborting" << endl;
400 *fLog << err << "Maybe you forget to call an MFillH for the MHCalibrationChargeCam before..." << endl;
401 return kFALSE;
402 }
403
404 //
405 // Optional Containers
406 //
407 fBlindPixel = (MCalibrationChargeBlindPix*)pList->FindObject("MCalibrationChargeBlindPix");
408 if (!fBlindPixel)
409 *fLog << warn << GetDescriptor()
410 << ": MCalibrationChargeBlindPix not found... no blind pixel method! " << endl;
411
412 fPINDiode = (MCalibrationChargePINDiode*)pList->FindObject("MCalibrationChargePINDiode");
413 if (!fPINDiode)
414 *fLog << warn << GetDescriptor()
415 << "MCalibrationChargePINDiode not found... no PIN Diode method! " << endl;
416
417 //
418 // Initialize the pulser colours
419 //
420 if (fPulserColor != fCam->GetPulserColor())
421 {
422 *fLog << err << GetDescriptor() << ": Pulser colour has changed w.r.t. last file."
423 << "This feature is not yet implemented, sorry ... aborting " << endl;
424 return kFALSE;
425 }
426
427 fCam->SetPulserColor( fPulserColor );
428
429 if (fBlindPixel)
430 fBlindPixel->SetColor( fPulserColor );
431
432 if (fPINDiode)
433 fPINDiode->SetColor( fPulserColor );
434
435
436 fNumHiGainSamples = fCam->GetNumHiGainFADCSlices();
437 fNumLoGainSamples = fCam->GetNumLoGainFADCSlices();
438 fSqrtHiGainSamples = TMath::Sqrt(fNumHiGainSamples);
439 fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples);
440
441 UInt_t npixels = fGeom->GetNumPixels();
442
443 for (UInt_t i=0; i<npixels; i++)
444 {
445
446 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam) [i];
447 MCalibrationQEPix &pqe = (MCalibrationQEPix&) (*fQECam)[i];
448 MBadPixelsPix &bad = (*fBadPixels)[i];
449
450 pix.SetPixId(i);
451 pqe.SetPixId(i);
452
453 if (bad.IsBad())
454 {
455 pix.SetExcluded();
456 pqe.SetExcluded();
457 continue;
458 }
459
460 }
461
462 return kTRUE;
463}
464
465// ----------------------------------------------------------------------------------
466//
467// Nothing to be done in Process, but have a look at MHCalibrationChargeCam, instead
468//
469Int_t MCalibrationChargeCalc::Process()
470{
471 return kTRUE;
472}
473
474// ----------------------------------------------------------------------------------
475//
476// Finalize pedestals:
477//
478// - Retrieve pedestal and pedestal RMS from MPedestalPix
479// - Retrieve total entries from MPedestalCam
480// - Sum up pedestal and pedestalRMS for the average pixel
481// - Set pedestal*number of used samples in MCalibrationChargePix
482// - Set pedestal RMS * sqrt of number of used samples in MCalibrationChargePix
483//
484//
485void MCalibrationChargeCalc::FinalizePedestals(const MPedestalPix &ped, MCalibrationChargePix &cal,
486 Float_t &avped, Float_t &avrms)
487{
488
489 //
490 // get the pedestals
491 //
492 const Float_t pedes = ped.GetPedestal();
493 const Float_t prms = ped.GetPedestalRms();
494 const Float_t num = TMath::Sqrt((Float_t)fPedestals->GetTotalEntries());
495
496 //
497 // Calculate the average pedestal
498 //
499 avped += pedes;
500 avrms += prms;
501
502 //
503 // set them in the calibration camera
504 //
505 if (cal.IsHiGainSaturation())
506 {
507 cal.SetPedestal(pedes* fNumLoGainSamples,
508 prms * fSqrtLoGainSamples,
509 prms * fNumLoGainSamples / num);
510 cal.CalcLoGainPedestal((Float_t)fNumLoGainSamples);
511 }
512 else
513 {
514 cal.SetPedestal(pedes* fNumHiGainSamples,
515 prms * fSqrtHiGainSamples,
516 prms * fNumHiGainSamples / num);
517 }
518
519}
520
521void MCalibrationChargeCalc::FinalizeAvPedestals(MCalibrationChargePix &cal,
522 Float_t avped, Float_t avrms, Int_t avnum)
523{
524
525 //
526 // set the pedestans in the calibration camera
527 //
528 if (cal.IsHiGainSaturation())
529 {
530 cal.SetPedestal(avped/avnum * fNumLoGainSamples,
531 avrms/avnum * fSqrtLoGainSamples,
532 avrms/avnum * fSqrtLoGainSamples/avnum);
533 cal.CalcLoGainPedestal((Float_t)fNumLoGainSamples);
534 }
535 else
536 {
537 cal.SetPedestal(avped/avnum * fNumHiGainSamples,
538 avrms/avnum * fSqrtHiGainSamples,
539 avrms/avnum * fSqrtHiGainSamples/avnum);
540 }
541}
542
543// ---------------------------------------------------------------------
544//
545// Finalize charges per pixel:
546// - Check chage validity
547// - Calculate the reduced sigma
548// - Calculate the number of photo-electrons
549//
550Bool_t MCalibrationChargeCalc::FinalizeCharges(MCalibrationChargePix &cal, MBadPixelsPix &bad)
551{
552
553 //
554 // The check return kTRUE if:
555 //
556 // 1) Pixel has a fitted charge greater than fChargeLimit*PedRMS
557 // 2) Pixel has a fit error greater than fChargeVarLimit
558 // 3) Pixel has a fitted charge greater its fChargeRelVarLimit times its charge error
559 // 4) Pixel has a charge sigma bigger than its Pedestal RMS
560 //
561 if (cal.GetMean() < fChargeLimit*cal.GetPedRms())
562 {
563 *fLog << warn << GetDescriptor() << ": Fitted Charge: " << cal.GetMean() << " is smaller than "
564 << fChargeLimit << " Pedestal RMS: " << cal.GetPedRms() << " in Pixel " << cal.GetPixId() << endl;
565 bad.SetUncalibrated( MBadPixelsPix::kChargeIsPedestal);
566 }
567
568 if (cal.GetMeanErr() < fChargeErrLimit)
569 {
570 *fLog << warn << GetDescriptor() << ": Error of Fitted Charge: " << cal.GetMeanErr()
571 << " is smaller than " << fChargeErrLimit << " in Pixel " << cal.GetPixId() << endl;
572 bad.SetUncalibrated( MBadPixelsPix::kChargeErrNotValid );
573 }
574
575 if (cal.GetMean() < fChargeRelErrLimit*cal.GetMeanErr())
576 {
577 *fLog << warn << GetDescriptor() << ": Fitted Charge: " << cal.GetMean() << " is smaller than "
578 << fChargeRelErrLimit << "* its error: " << cal.GetMeanErr()
579 << " in Pixel " << cal.GetPixId() << endl;
580 bad.SetUncalibrated( MBadPixelsPix::kChargeRelErrNotValid );
581 }
582
583 if (cal.GetSigma() < cal.GetPedRms())
584 {
585 *fLog << warn << GetDescriptor() << ": Sigma of Fitted Charge: " << cal.GetSigma()
586 << " smaller than Pedestal RMS: " << cal.GetPedRms() << " in Pixel " << cal.GetPixId() << endl;
587 bad.SetUncalibrated( MBadPixelsPix::kChargeSigmaNotValid );
588 }
589
590 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))
591 return kFALSE;
592
593 if (!cal.CalcReducedSigma())
594 {
595 *fLog << warn << GetDescriptor()
596 << ": Could not calculate reduced sigmas of pixel: " << cal.GetPixId() << endl;
597 bad.SetUncalibrated(MBadPixelsPix::kChargeIsPedestal);
598 return kFALSE;
599 }
600
601 if (!cal.CalcFFactorMethod())
602 {
603 *fLog << warn << GetDescriptor()
604 << ": Could not calculate F-Factor of pixel: " << cal.GetPixId() << endl;
605 bad.SetUncalibrated(MBadPixelsPix::kDeviatingNumPhes);
606 return kFALSE;
607 }
608 return kTRUE;
609}
610
611// ------------------------------------------------------------------------
612//
613// Returns kFALSE if pointer to MExtractedSignalPINDiode is NULL
614// Returns kFALSE if pointer to MCalibrationChargePINDiode is NULL
615//
616// The check returns kFALSE if:
617//
618// 1) PINDiode has a fitted charge smaller than fChargeLimit*PedRMS
619// 2) PINDiode has a fit error smaller than fChargeErrLimit
620// 3) PINDiode has a fitted charge smaller its fChargeRelErrLimit times its charge error
621// 4) PINDiode has a charge sigma smaller than its Pedestal RMS
622//
623// Calls:
624// - MCalibrationChargePINDiode::CalcFluxOutsidePlexiglass()
625//
626Bool_t MCalibrationChargeCalc::FinalizePINDiode()
627{
628
629 if (!fPINDiode)
630 return kFALSE;
631
632 if (fPINDiode->GetMean() < fChargeLimit*fPINDiode->GetPedRms())
633 {
634 *fLog << warn << GetDescriptor() << ": Fitted Charge is smaller than "
635 << fChargeLimit << " Pedestal RMS in PINDiode " << endl;
636 return kFALSE;
637 }
638
639 if (fPINDiode->GetMeanErr() < fChargeErrLimit)
640 {
641 *fLog << warn << GetDescriptor() << ": Error of Fitted Charge is smaller than "
642 << fChargeErrLimit << " in PINDiode " << endl;
643 return kFALSE;
644 }
645
646 if (fPINDiode->GetMean() < fChargeRelErrLimit*fPINDiode->GetMeanErr())
647 {
648 *fLog << warn << GetDescriptor() << ": Fitted Charge is smaller than "
649 << fChargeRelErrLimit << "* its error in PINDiode " << endl;
650 return kFALSE;
651 }
652
653 if (fPINDiode->GetSigma() < fPINDiode->GetPedRms())
654 {
655 *fLog << warn << GetDescriptor()
656 << ": Sigma of Fitted Charge smaller than Pedestal RMS in PINDiode " << endl;
657 return kFALSE;
658 }
659
660
661 if (!fPINDiode->CalcFluxOutsidePlexiglass())
662 {
663 *fLog << warn << "Could not calculate the flux of photons from the PIN Diode, "
664 << "will skip PIN Diode Calibration " << endl;
665 return kFALSE;
666 }
667
668 return kTRUE;
669}
670
671// ------------------------------------------------------------------------
672//
673// Returns kFALSE if pointer to MExtractedSignalBlindPixel is NULL
674// Returns kFALSE if pointer to MCalibrationChargeBlindPix is NULL
675//
676// The check returns kFALSE if:
677//
678// 1) fLambda and fLambdaCheck are separated relatively to each other by more than fLambdaCheckLimit
679// 2) BlindPixel has an fLambdaErr greater than fLambdaErrLimit
680//
681// Calls:
682// - MCalibrationChargeBlindPix::CalcFluxInsidePlexiglass()
683//
684Bool_t MCalibrationChargeCalc::FinalizeBlindPixel()
685{
686
687 if (!fBlindPixel)
688 return kFALSE;
689
690 const Float_t lambda = fBlindPixel->GetLambda();
691 const Float_t lambdaerr = fBlindPixel->GetLambdaErr();
692 const Float_t lambdacheck = fBlindPixel->GetLambdaCheck();
693
694 if (2.*(lambdacheck-lambda)/(lambdacheck+lambda) < fLambdaCheckLimit)
695 {
696 *fLog << warn << GetDescriptor() << ": Lambda and Lambda-Check differ by more than "
697 << fLambdaCheckLimit << " in the Blind Pixel " << endl;
698 return kFALSE;
699 }
700
701 if (lambdaerr < fLambdaErrLimit)
702 {
703 *fLog << warn << GetDescriptor() << ": Error of Fitted Lambda is greater than "
704 << fLambdaErrLimit << " in Blind Pixel " << endl;
705 return kFALSE;
706 }
707
708 if (!fBlindPixel->CalcFluxInsidePlexiglass())
709 {
710 *fLog << warn << "Could not calculate the flux of photons from the Blind Pixel, "
711 << "will skip Blind Pixel Calibration " << endl;
712 return kFALSE;
713 }
714
715 return kTRUE;
716}
717
718// ------------------------------------------------------------------------
719//
720//
721Bool_t MCalibrationChargeCalc::FinalizeFFactorMethod()
722{
723
724 const UInt_t npixels = fGeom->GetNumPixels();
725 const UInt_t nareas = fGeom->GetNumAreas();
726 const UInt_t nsectors = fGeom->GetNumSectors();
727
728 Float_t lowlim [nareas];
729 Float_t upplim [nareas];
730 Float_t areavars [nareas];
731 Float_t areaweights [nareas], sectorweights [nsectors];
732 Float_t areaphes [nareas], sectorphes [nsectors];
733 Int_t numareavalid[nareas], numsectorvalid[nsectors];
734
735 memset(lowlim ,0, nareas * sizeof(Float_t));
736 memset(upplim ,0, nareas * sizeof(Float_t));
737 memset(areaphes ,0, nareas * sizeof(Float_t));
738 memset(areavars ,0, nareas * sizeof(Float_t));
739 memset(areaweights ,0, nareas * sizeof(Float_t));
740 memset(numareavalid ,0, nareas * sizeof(Int_t ));
741 memset(sectorweights ,0, nsectors * sizeof(Float_t));
742 memset(sectorphes ,0, nsectors * sizeof(Float_t));
743 memset(numsectorvalid,0, nsectors * sizeof(Int_t ));
744
745 //
746 // First loop: Get mean number of photo-electrons and the RMS
747 // The loop is only to recognize later pixels with very deviating numbers
748 //
749 for (UInt_t i=0; i<npixels; i++)
750 {
751
752 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam) [i];
753 MBadPixelsPix &bad = (*fBadPixels)[i];
754
755 if (!pix.IsFFactorMethodValid())
756 continue;
757
758 if (!bad.IsCalibrationResultOK())
759 {
760 pix.SetFFactorMethodValid(kFALSE);
761 continue;
762 }
763
764 const Float_t nphe = pix.GetPheFFactorMethod();
765 const Float_t nvar = pix.GetPheFFactorMethodVar();
766 const Int_t aidx = (*fGeom)[i].GetAidx();
767
768 if (nvar > 0.)
769 {
770 areaphes [aidx] += nphe;
771 areavars [aidx] += nvar;
772 numareavalid[aidx] ++;
773 }
774 }
775
776 for (UInt_t i=0; i<nareas; i++)
777 {
778 if (numareavalid[i] == 0)
779 {
780 *fLog << warn << GetDescriptor() << ": No pixels with valid number of photo-electrons found "
781 << "in area index: " << i << endl;
782 continue;
783 }
784
785 areaphes[i] = areaphes[i] / numareavalid[i];
786 areavars[i] = areavars[i] / numareavalid[i];
787 lowlim [i] = areaphes[i] - fPheErrLimit*TMath::Sqrt(areavars[i]);
788 upplim [i] = areaphes[i] + fPheErrLimit*TMath::Sqrt(areavars[i]);
789 }
790
791 memset(numareavalid,0,nareas*sizeof(Int_t));
792 memset(areaphes ,0,nareas*sizeof(Int_t));
793 memset(areavars ,0,nareas*sizeof(Int_t));
794
795 //
796 // Second loop: Get weighted mean number of photo-electrons and its RMS excluding
797 // pixels deviating by more than fPheErrLimit sigma.
798 // Set the conversion factor FADC counts to photo-electrons
799 //
800 for (UInt_t i=0; i<npixels; i++)
801 {
802
803 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
804
805 if (!pix.IsFFactorMethodValid())
806 continue;
807
808 const Float_t nvar = pix.GetPheFFactorMethodVar();
809
810 if (nvar <= 0.)
811 {
812 pix.SetFFactorMethodValid(kFALSE);
813 continue;
814 }
815
816 MBadPixelsPix &bad = (*fBadPixels)[i];
817
818 const Int_t aidx = (*fGeom)[i].GetAidx();
819 const Int_t sector = (*fGeom)[i].GetSector();
820 const Float_t nphe = pix.GetPheFFactorMethod();
821
822 if ( nphe < lowlim[aidx] || nphe > upplim[aidx] )
823 {
824 *fLog << warn << GetDescriptor() << ": Deviating number of photo-electrons: "
825 << Form("%4.2f",nphe) << " out of accepted limits: ["
826 << Form("%4.2f%s%4.2f",lowlim[aidx],",",upplim[aidx]) << "] in pixel " << i << endl;
827 bad.SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
828 bad.SetUnsuitable ( MBadPixelsPix::kUnreliableRun );
829 continue;
830 }
831
832 const Float_t weight = 1./nvar;
833
834 areaweights [aidx] += weight;
835 areaphes [aidx] += weight*nphe;
836 numareavalid [aidx] ++;
837 sectorweights [sector] += weight;
838 sectorphes [sector] += weight*nphe;
839 numsectorvalid[sector] ++;
840 }
841
842 for (UInt_t aidx=0; aidx<nareas; aidx++)
843 {
844
845 MCalibrationChargePix &apix = (MCalibrationChargePix&)fCam->GetAverageArea(aidx);
846
847 if (areaweights[aidx] <= 0. || areaphes[aidx] <= 0.)
848 {
849 *fLog << warn << " Mean number of phe's from area index " << aidx << " cannot be calculated: "
850 << " Sum of weights: " << areaweights[aidx]
851 << " Sum of weighted phes: " << areaphes[aidx] << endl;
852 apix.SetFFactorMethodValid(kFALSE);
853 continue;
854 }
855
856 *fLog << inf << "Replacing number photo-electrons of average area idx " << aidx << ": "
857 << Form("%5.3f%s%5.3f",apix.GetPheFFactorMethod()," +- ",apix.GetPheFFactorMethodErr()) << endl;
858 *fLog << inf << " by average number of photo-electrons from area idx " << aidx << ": "
859 << Form("%5.3f%s%5.3f",areaphes[aidx] / areaweights[aidx]," +- ",
860 TMath::Sqrt(1./areaweights[aidx])) << endl;
861
862 apix.SetPheFFactorMethod ( areaphes[aidx]/ areaweights[aidx] );
863 apix.SetPheFFactorMethodVar( 1. / areaweights[aidx] );
864 apix.SetFFactorMethodValid ( kTRUE );
865
866 }
867
868 for (UInt_t sector=0; sector<nsectors; sector++)
869 {
870
871 MCalibrationChargePix &spix = (MCalibrationChargePix&)fCam->GetAverageSector(sector);
872
873 if (sectorweights[sector] <= 0. || sectorphes[sector] <= 0.)
874 {
875 *fLog << warn << " Mean number of phe's from sector " << sector << " cannot be calculated: "
876 << " Sum of weights: " << sectorweights[sector]
877 << " Sum of weighted phes: " << sectorphes[sector] << endl;
878 spix.SetFFactorMethodValid(kFALSE);
879 continue;
880 }
881
882 *fLog << inf << "Replacing number photo-electrons of average sector " << sector << ": "
883 << Form("%5.3f%s%5.3f",spix.GetPheFFactorMethod()," +- ",spix.GetPheFFactorMethodErr()) << endl;
884 *fLog << inf << " by average number photo-electrons from sector " << sector << ": "
885 << Form("%5.3f%s%5.3f",sectorphes[sector]/ sectorweights[sector]," +- ",
886 TMath::Sqrt(1./sectorweights[sector])) << endl;
887
888 spix.SetPheFFactorMethod ( sectorphes[sector]/ sectorweights[sector] );
889 spix.SetPheFFactorMethodVar( 1. / sectorweights[sector] );
890 spix.SetFFactorMethodValid ( kTRUE );
891
892 }
893
894 return kTRUE;
895}
896
897
898// ----------------------------------------------------------------------
899//
900// Sets all pixels to MBadPixelsPix::kUnsuitableRun, if following flags are set:
901// - MBadPixelsPix::kChargeIsPedestal
902// - MBadPixelsPix::kChargeErrNotValid
903// - MBadPixelsPix::kChargeRelErrNotValid
904// - MBadPixelsPix::kChargeSigmaNotValid
905// - MBadPixelsPix::kMeanTimeInFirstBin
906// - MBadPixelsPix::kMeanTimeInLast2Bins
907//
908// Sets all pixels to MBadPixelsPix::kUnreliableRun, if following flags are set:
909// - MBadPixelsPix::kDeviatingNumPhes
910//
911void MCalibrationChargeCalc::FinalizeBadPixels()
912{
913
914 for (Int_t i=0; i<fBadPixels->GetSize(); i++)
915 {
916
917 MBadPixelsPix &bad = (*fBadPixels)[i];
918
919 if (bad.IsUncalibrated( MBadPixelsPix::kChargeIsPedestal))
920 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun );
921
922 if (bad.IsUncalibrated( MBadPixelsPix::kChargeErrNotValid ))
923 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun );
924
925 if (bad.IsUncalibrated( MBadPixelsPix::kChargeRelErrNotValid ))
926 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun );
927
928 if (bad.IsUncalibrated( MBadPixelsPix::kChargeSigmaNotValid ))
929 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun );
930
931 if (bad.IsUncalibrated( MBadPixelsPix::kMeanTimeInFirstBin ))
932 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun );
933
934 if (bad.IsUncalibrated( MBadPixelsPix::kMeanTimeInLast2Bins ))
935 bad.SetUnsuitable( MBadPixelsPix::kUnsuitableRun );
936
937 if (bad.IsUncalibrated( MBadPixelsPix::kDeviatingNumPhes ))
938 bad.SetUnsuitable( MBadPixelsPix::kUnreliableRun );
939 }
940}
941
942// ------------------------------------------------------------------------
943//
944//
945void MCalibrationChargeCalc::FinalizeFFactorQECam()
946{
947
948 MCalibrationChargePix &avpix = (MCalibrationChargePix&)fCam->GetAverageArea(0);
949 MCalibrationQEPix &qepix = (MCalibrationQEPix&) fQECam->GetAverageArea(0);
950
951 const Float_t avphotons = avpix.GetPheFFactorMethod()
952 / qepix.GetQEFFactor(fPulserColor)
953 / fQECam->GetPlexiglassQE();
954
955 const Float_t avphotrelvar = avpix.GetPheFFactorMethodRelVar()
956 + qepix.GetQEFFactorRelVar(fPulserColor)
957 + fQECam->GetPlexiglassQERelVar();
958
959 const UInt_t npixels = fGeom->GetNumPixels();
960
961 for (UInt_t i=0; i<npixels; i++)
962 {
963
964 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
965 MCalibrationQEPix &qepix = (MCalibrationQEPix&) (*fQECam)[i];
966
967 if (!pix.IsFFactorMethodValid())
968 {
969 qepix.SetFFactorMethodValid(kFALSE,fPulserColor);
970 continue;
971 }
972
973 const Float_t photons = avphotons / fGeom->GetPixRatio(i);
974 const Float_t qe = pix.GetPheFFactorMethod() / photons ;
975
976 if (!pix.CalcMeanFFactor( photons , avphotrelvar ))
977 {
978 pix.SetFFactorMethodValid(kFALSE);
979 qepix.SetFFactorMethodValid(kFALSE, fPulserColor);
980 (*fBadPixels)[i].SetUncalibrated( MBadPixelsPix::kDeviatingNumPhes );
981 }
982
983 const Float_t qerelvar = avphotrelvar + pix.GetPheFFactorMethodRelVar();
984
985 qepix.SetQEFFactor ( qe , fPulserColor );
986 qepix.SetQEFFactorVar ( qerelvar*qe*qe, fPulserColor );
987 qepix.SetFFactorMethodValid( kTRUE , fPulserColor );
988
989 if (!qepix.UpdateFFactorMethod())
990 *fLog << warn << GetDescriptor() << ": Cannot update Quantum efficiencies with the F-Factor Method" << endl;
991 }
992}
993
994// ------------------------------------------------------------------------
995//
996//
997void MCalibrationChargeCalc::FinalizeBlindPixelQECam()
998{
999
1000 const UInt_t npixels = fGeom->GetNumPixels();
1001
1002 //
1003 // With the knowledge of the overall photon flux, calculate the
1004 // quantum efficiencies after the Blind Pixel and PIN Diode method
1005 //
1006 for (UInt_t i=0; i<npixels; i++)
1007 {
1008
1009 MCalibrationQEPix &qepix = (MCalibrationQEPix&) (*fQECam)[i];
1010
1011 if (!fBlindPixel)
1012 {
1013 qepix.SetBlindPixelMethodValid(kFALSE, fPulserColor);
1014 continue;
1015 }
1016
1017 if (!fBlindPixel->IsFluxInsidePlexiglassAvailable())
1018 {
1019 qepix.SetBlindPixelMethodValid(kFALSE, fPulserColor);
1020 continue;
1021 }
1022
1023 MBadPixelsPix &bad = (*fBadPixels)[i];
1024
1025 if (!bad.IsUnsuitable (MBadPixelsPix::kUnsuitableRun))
1026 {
1027 qepix.SetBlindPixelMethodValid(kFALSE, fPulserColor);
1028 continue;
1029 }
1030
1031 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
1032 MGeomPix &geo = (*fGeom)[i];
1033
1034 const Float_t conv = fBlindPixel->GetFluxInsidePlexiglass()
1035 * geo.GetA()
1036 / fQECam->GetPlexiglassQE()
1037 / pix.GetPheFFactorMethod();
1038
1039 const Float_t convrelvar = fBlindPixel->GetFluxInsidePlexiglassRelVar()
1040 + fQECam->GetPlexiglassQERelVar()
1041 + pix.GetPheFFactorMethodRelVar();
1042
1043 qepix.SetQEBlindPixel ( conv , fPulserColor );
1044 qepix.SetQEBlindPixelVar ( convrelvar * conv * conv, fPulserColor );
1045 qepix.UpdateBlindPixelMethod();
1046 }
1047}
1048
1049// ------------------------------------------------------------------------
1050//
1051//
1052void MCalibrationChargeCalc::FinalizePINDiodeQECam()
1053{
1054
1055 const UInt_t npixels = fGeom->GetNumPixels();
1056
1057 //
1058 // With the knowledge of the overall photon flux, calculate the
1059 // quantum efficiencies after the PIN Diode method
1060 //
1061 for (UInt_t i=0; i<npixels; i++)
1062 {
1063
1064 MCalibrationQEPix &qepix = (MCalibrationQEPix&) (*fQECam)[i];
1065
1066 if (!fPINDiode)
1067 {
1068 qepix.SetPINDiodeMethodValid(kFALSE, fPulserColor);
1069 continue;
1070 }
1071
1072 if (!fPINDiode->IsFluxOutsidePlexiglassAvailable())
1073 {
1074 qepix.SetPINDiodeMethodValid(kFALSE, fPulserColor);
1075 continue;
1076 }
1077
1078 MBadPixelsPix &bad = (*fBadPixels)[i];
1079
1080 if (!bad.IsUnsuitable (MBadPixelsPix::kUnsuitableRun))
1081 {
1082 qepix.SetPINDiodeMethodValid(kFALSE, fPulserColor);
1083 continue;
1084 }
1085
1086 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];
1087 MGeomPix &geo = (*fGeom)[i];
1088
1089 const Float_t conv = fPINDiode->GetFluxOutsidePlexiglass() * geo.GetA() / pix.GetPheFFactorMethod();
1090 const Float_t convrelvar = fPINDiode->GetFluxOutsidePlexiglassRelVar() + pix.GetPheFFactorMethodRelVar();
1091
1092 qepix.SetQEPINDiode ( conv , fPulserColor );
1093 qepix.SetQEPINDiodeVar ( convrelvar * conv * conv, fPulserColor );
1094 qepix.UpdateBlindPixelMethod();
1095 }
1096}
1097
1098
1099// -----------------------------------------------------------------------
1100//
1101// - Finalize the pedestals
1102// - Do the quality checks
1103// - Calculate the reduced sigma
1104// - Calculate the F-Factor Method
1105//
1106Int_t MCalibrationChargeCalc::PostProcess()
1107{
1108
1109 if (GetNumExecutions()==0)
1110 return kFALSE;
1111
1112 //
1113 // loop over the pedestal events and check if we have calibration
1114 //
1115 Int_t nvalid = 0;
1116 Float_t avinnerped = 0.;
1117 Float_t avinnerprms = 0.;
1118 Int_t avinnernum = 0;
1119 Float_t avouterped = 0.;
1120 Float_t avouterprms = 0.;
1121 Int_t avouternum = 0;
1122
1123 for (Int_t pixid=0; pixid<fPedestals->GetSize(); pixid++)
1124 {
1125
1126 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[pixid];
1127 //
1128 // Check if the pixel has been excluded from the fits
1129 //
1130 if (pix.IsExcluded())
1131 continue;
1132
1133 MPedestalPix &ped = (*fPedestals)[pixid];
1134 MBadPixelsPix &bad = (*fBadPixels)[pixid];
1135
1136 if (fGeom->GetPixRatio(pixid) == 1.)
1137 {
1138 FinalizePedestals(ped,pix,avinnerped,avinnerprms);
1139 avinnernum++;
1140 }
1141 else
1142 {
1143 FinalizePedestals(ped,pix,avouterped,avouterprms);
1144 avouternum++;
1145 }
1146
1147 if (FinalizeCharges(pix,bad))
1148 nvalid++;
1149 }
1150
1151 //
1152 // The Michele check ...
1153 //
1154 if (nvalid == 0)
1155 {
1156 *fLog << err << GetDescriptor() << ": All pixels have non-valid calibration. "
1157 << "Did you forget to fill the histograms "
1158 << "(filling MHCalibrationChargeCam from MExtractedSignalCam using MFillH) ? " << endl;
1159 *fLog << err << GetDescriptor() << ": Or, maybe, you have used a pedestal run "
1160 << "instead of a calibration run " << endl;
1161 return kFALSE;
1162 }
1163
1164 for (UInt_t aidx=0; aidx<fGeom->GetNumAreas(); aidx++)
1165 {
1166
1167 FinalizeAvPedestals((MCalibrationChargePix&)fCam->GetAverageArea(aidx),
1168 avinnerped, avinnerprms,avinnernum);
1169 FinalizeCharges((MCalibrationChargePix&)fCam->GetAverageArea(aidx),
1170 fCam->GetAverageBadArea(aidx));
1171 }
1172
1173 for (UInt_t sector=0; sector<fGeom->GetNumSectors(); sector++)
1174 {
1175
1176 FinalizeAvPedestals((MCalibrationChargePix&)fCam->GetAverageSector(sector),
1177 avinnerped, avinnerprms,avinnernum);
1178 FinalizeCharges((MCalibrationChargePix&)fCam->GetAverageSector(sector),
1179 fCam->GetAverageBadSector(sector));
1180 }
1181
1182 //
1183 // Finalize Bad Pixels
1184 //
1185 FinalizeBadPixels();
1186
1187 //
1188 // Finalize F-Factor method
1189 //
1190 if (!FinalizeFFactorMethod())
1191 {
1192 *fLog << warn << "Could not calculate the photons flux from the F-Factor method " << endl;
1193 fCam->SetFFactorMethodValid(kFALSE);
1194 return kFALSE;
1195 }
1196 else
1197 fCam->SetFFactorMethodValid(kTRUE);
1198
1199 //
1200 // Finalize Blind Pixel
1201 //
1202 if (FinalizeBlindPixel())
1203 fQECam->SetBlindPixelMethodValid(kTRUE);
1204 else
1205 fQECam->SetBlindPixelMethodValid(kFALSE);
1206
1207 //
1208 // Finalize PIN Diode
1209 //
1210 if (FinalizePINDiode())
1211 fQECam->SetPINDiodeMethodValid(kTRUE);
1212 else
1213 fQECam->SetPINDiodeMethodValid(kFALSE);
1214
1215 //
1216 // Finalize QE Cam
1217 //
1218 FinalizeFFactorQECam();
1219 FinalizeBlindPixelQECam();
1220 FinalizePINDiodeQECam();
1221
1222 fCam ->SetReadyToSave();
1223 fQECam ->SetReadyToSave();
1224 fBadPixels->SetReadyToSave();
1225
1226 *fLog << inf << endl;
1227 *fLog << GetDescriptor() << ": Calibration statistics:" << endl;
1228 *fLog << dec << setfill(' ');
1229
1230 UInt_t countinner = 0;
1231 UInt_t countouter = 0;
1232 for (Int_t i=0; i<fBadPixels->GetSize(); i++)
1233 {
1234 MBadPixelsPix &bad = (*fBadPixels)[i];
1235 if (bad.IsOK())
1236 {
1237 if (fGeom->GetPixRatio(i) == 1.)
1238 countinner++;
1239 else
1240 countouter++;
1241 }
1242 }
1243
1244 *fLog << " " << setw(7) << "Successfully calibrated Pixels: "
1245 << "Inner: " << countinner << " Outer: " << countouter << endl;
1246
1247 PrintUnsuitable(MBadPixelsPix::kUnsuitableRun, "Bad Pixels: ");
1248 PrintUnsuitable(MBadPixelsPix::kUnreliableRun, "Unreliable Pixels: ");
1249
1250 *fLog << inf << endl;
1251 *fLog << GetDescriptor() << ": Errors statistics:" << endl;
1252
1253 PrintUncalibrated(MBadPixelsPix::kChargeIsPedestal,
1254 Form("%s%2.1f%s","Signal less than ",fChargeLimit," Pedestal RMS: "));
1255 PrintUncalibrated(MBadPixelsPix::kChargeErrNotValid,
1256 Form("%s%2.1f%s","Signal Error smaller than ",fChargeErrLimit,": "));
1257 PrintUncalibrated(MBadPixelsPix::kChargeRelErrNotValid,
1258 Form("%s%2.1f%s","Signal Error bigger than ",fChargeRelErrLimit," times Mean Signal: "));
1259 PrintUncalibrated(MBadPixelsPix::kChargeSigmaNotValid,
1260 "Signal Sigma smaller than Pedestal RMS: ");
1261 PrintUncalibrated(MBadPixelsPix::kLoGainSaturation,
1262 "Pixels with Low Gain Saturation: ");
1263 PrintUncalibrated(MBadPixelsPix::kMeanTimeInFirstBin,
1264 Form("%s%2.1f%s","Mean Abs. Arr. Time in First ",1," Bin(s): "));
1265 PrintUncalibrated(MBadPixelsPix::kMeanTimeInLast2Bins,
1266 Form("%s%2.1f%s","Mean Abs. Arr. Time in Last ",2," Bin(s): "));
1267 PrintUncalibrated(MBadPixelsPix::kHiGainOscillating,
1268 "Pixels with changing Hi Gain signal over time: ");
1269 PrintUncalibrated(MBadPixelsPix::kLoGainOscillating,
1270 "Pixels with changing Lo Gain signal over time: ");
1271 PrintUncalibrated(MBadPixelsPix::kDeviatingNumPhes,
1272 "Pixels with deviating number of phes: ");
1273 PrintUncalibrated(MBadPixelsPix::kHiGainNotFitted,
1274 "Pixels with unsuccesful Gauss fit to the Hi Gain: ");
1275 PrintUncalibrated(MBadPixelsPix::kLoGainNotFitted,
1276 "Pixels with unsuccesful Gauss fit to the Lo Gain: ");
1277
1278 return kTRUE;
1279}
1280
1281void MCalibrationChargeCalc::PrintUnsuitable(MBadPixelsPix::UnsuitableType_t typ, const char *text) const
1282{
1283
1284 UInt_t countinner = 0;
1285 UInt_t countouter = 0;
1286 for (Int_t i=0; i<fBadPixels->GetSize(); i++)
1287 {
1288 MBadPixelsPix &bad = (*fBadPixels)[i];
1289 if (bad.IsUnsuitable(typ))
1290 {
1291 if (fGeom->GetPixRatio(i) == 1.)
1292 countinner++;
1293 else
1294 countouter++;
1295 }
1296 }
1297
1298 *fLog << " " << setw(7) << text
1299 << Form("%s%3i%s%3i","Inner: ",countinner," Outer: ",countouter) << endl;
1300}
1301
1302void MCalibrationChargeCalc::PrintUncalibrated(MBadPixelsPix::UncalibratedType_t typ, const char *text) const
1303{
1304
1305 UInt_t countinner = 0;
1306 UInt_t countouter = 0;
1307 for (Int_t i=0; i<fBadPixels->GetSize(); i++)
1308 {
1309 MBadPixelsPix &bad = (*fBadPixels)[i];
1310 if (bad.IsUncalibrated(typ))
1311 {
1312 if (fGeom->GetPixRatio(i) == 1.)
1313 countinner++;
1314 else
1315 countouter++;
1316 }
1317 }
1318
1319 *fLog << " " << setw(7) << text
1320 << Form("%s%3i%s%3i","Inner: ",countinner," Outer: ",countouter) << endl;
1321}
1322
Note: See TracBrowser for help on using the repository browser.