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

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