source: trunk/MagicSoft/Mars/mbadpixels/MBadPixelsPix.cc@ 3806

Last change on this file since 3806 was 3601, checked in by gaug, 21 years ago
*** empty log message ***
File size: 7.6 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): Thomas Bretz, 1/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
19! Markus Gaug, 3/2004 <mailto:markus@ifae.es>
20!
21! Copyright: MAGIC Software Development, 2000-2004
22!
23!
24\* ======================================================================== */
25/////////////////////////////////////////////////////////////////////////////
26//
27// MBadPixelsPix
28//
29// The bits of an integer array fInfo are used to declare and inform about
30// possible defects in a pixel. Default and absence of defects create an array
31// of zeros.
32//
33// The first index (fInfo[0]) holds general information which is coded as follows:
34// * BIT(1): Unsuitable Run: The pixel is not suited for analysis for the entire run
35// * BIT(2): Unsuitable Evt: The pixel is not suited for analysis for the current event
36// * BIT(3): Unreliable Run: The pixel can in principle be used for analysis, although
37// previous analysis steps have yielded certain inconsistencies
38//
39// These bits can be called with the enum MBadPixelsPix::UnsuitableTupe_t in combination
40// with the function IsUnsuitable(MBadPixelsPix::UnsuitableTupe_t), e.g.
41// MBadPixelsPix::IsUnsuitalbe(MBadPixelsPix::kUnsuitableRun) asks if the first bit is set.
42//
43// The second index (fInfo[1]) hold information acquired during the calibration. The bits
44// are coded in the following form:
45// BIT(1 ): kHiGainNotCalibrated : Any High Gain signal is not calibrated and cannot be used
46// BIT(2 ): kLoGainNotCalibrated : Any Low Gain signal is not calibrated and cannot be used
47// BIT(3 ): kHiGainNotFitted : Any High Gain signal is calibrated without a Gauss Fit to the signal distribution
48// BIT(4 ): kLoGainNotFitted : Any Low Gain signal is calibrated without a Gauss Fit to the signal distribution
49// BIT(5 ): kHiGainOscillating : The High Gain signals fourier transform showed abnormal behavior
50// BIT(6 ): kLoGainOscillating : The Low Gain signals fourier transform showed abnormal behavior
51// BIT(7 ): kLoGainSaturation : The Low Gain signals were saturated during calibration
52// BIT(8 ): kChargeIsPedestal : The calibration signal contained only pedestals - presumably dead pixel
53// BIT(10): kChargeRelErrNotValid: The relative error of the derived charge was too large or too small
54// BIT(11): kChargeSigmaNotValid : The sigma of the pedestal distribution smaller than the pedestal RMS - presumably a pixel with a star in its FOV only during the pedestal taking
55// BIT(12): kMeanTimeInFirstBin : The signal has its mean maximum in the first used FADC slice - signal extractor bad
56// BIT(13): kMeanTimeInLast2Bins : The signal has its mean maximum in the last two used FADC slice - signal extractor bad
57// BIT(14): kDeviatingNumPhes : The calculated number of photo-electrons deviates too much from the mean - inconsitency
58//
59// These bits can be called with the enum MBadPixelsPix::UncalibratedType_t in combination
60// with the function IsUncalibrated(MBadPixelsPix::UncalibratedTupe_t), e.g.
61// MBadPixelsPix::IsUncalibrated(MBadPixelsPix::kHiGainNotCalibrated) asks if the Hi Gain signal
62// could be calibrated.
63//
64// Two additional functions yield specific calibration information:
65// * IsCalibrationSignalOK() asks if the extracted calibration signal showed any inconsistency
66// * IsCalibrationResultOK() asks if the applied calibration can be used at all.
67//
68/////////////////////////////////////////////////////////////////////////////
69#include "MBadPixelsPix.h"
70
71#include "MLog.h"
72#include "MLogManip.h"
73
74ClassImp(MBadPixelsPix);
75
76using namespace std;
77
78const Int_t MBadPixelsPix::fgRunMask =
79 MBadPixelsPix::kUnsuitableRun |
80 MBadPixelsPix::kUnreliableRun;
81
82// ------------------------------------------------------------------------
83//
84// Initialize Pixel to be Ok.
85//
86MBadPixelsPix::MBadPixelsPix(const char* name, const char* title)
87 : fInfo(5)
88{
89 fName = name ? name : "MBadPixelsPix";
90 fTitle = title ? title : "Container storing bad pixel information for a single pixel";
91
92 fInfo[1] = 0;
93}
94
95// ------------------------------------------------------------------------
96//
97// Invalidate all bits which are not run-wise. This will be called for
98// all entries in the parameter list, just before each time the task-list
99// is executed.
100//
101void MBadPixelsPix::Reset()
102{
103 fInfo[0] &= fgRunMask;
104}
105
106// ------------------------------------------------------------------------
107//
108// Invalidate values (set=0 which mean Pixel OK)
109//
110void MBadPixelsPix::Clear(Option_t *o)
111{
112 fInfo.Reset(0);
113}
114
115// ------------------------------------------------------------------------
116//
117// Merge (bitwise or) the information in pix into this pixel.
118//
119void MBadPixelsPix::Merge(const MBadPixelsPix &pix)
120{
121 const Int_t n = pix.fInfo.GetSize();
122 if (n>fInfo.GetSize())
123 fInfo.Set(n);
124
125 for (int i=0; i<n; i++)
126 fInfo[i] |= pix.fInfo[i];
127}
128
129
130/****************************************************************************
131 This is a collection of possible defects for later use
132 ****************************************************************************/
133
134/*
135 1 PMT defective.
136 2 Preamplifier defective.
137 3 Optical link defective.
138 4 HV cannot be set.
139 7 HV unstable.
140 5 HV readout defective.
141 8 DC unstable.
142 6 DC readout defective.
143 9 Discriminator threshold cannot be set.
144 10 Trigger delay cannot be set.
145 11 Discriminator gives no output.
146 <-? 12 Pixel out of L1T.
147 13 FADC defective.
148 14 FADC board digital information defective.
149 */
150
151/*
152 1 Pixel shows no signal
153 */
154
155/*
156 MCalibrationCalc - valid for the result of a calibration run:
157
158 3 Hi-Gain saturated, no LoGain available
159
160 4 Conversion Factor HiGain - LoGain not valid
161
162 5 Cannot be calibrated at all
163 6 Cannot be fitted - calibrated using Histogram Mean and RMS
164
165 */
166
167/*
168
169Hardware defects which cannot be detected automatically by software. This might be stored at least in the data-base. I think we should wait until we implement these things...
170Preamplifier defective.
171Optical link defective.
172HV cannot be set.
173HV readout defective.
174DC readout defective.
175Discriminator threshold cannot be set.
176Trigger delay cannot be set.
177Discriminator gives no output.
178FADC defective.
179FADC board digital information defective.
180Pixel out of L1T. (this is an important information, but not necessarily a defect, is it?)
181
182In addition here are some cases which I think can be detected by software:
183- no signal
184- wrong signal
185- hv problem
186- dc problem
187- Conversion Factor HiGain - LoGain not valid (what does this mean?)
188- No calibration possible
189- No fit possible - calibrated using Histogram Mean and RMS
190- Mean Charge smaller than PedRMS
191- Sigma Charge smaller than PedRMS
192- Calib.methods inconsistency (there are in pricipal 6 combinations... do we need 6 bits?)
193- Gains oscillate (what does it mean?)
194- Sigma Arrival Time bigger than FADC window (from calib)
195- Mean Arrival Time at edge of FADC window (from calib)
196*/
Note: See TracBrowser for help on using the repository browser.