| 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 | ! | 
|---|
| 19 | !   Author(s): Markus Gaug   11/2003 <mailto:markus@ifae.es> | 
|---|
| 20 | ! | 
|---|
| 21 | !   Copyright: MAGIC Software Development, 2000-2004 | 
|---|
| 22 | ! | 
|---|
| 23 | ! | 
|---|
| 24 | \* ======================================================================== */ | 
|---|
| 25 |  | 
|---|
| 26 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 27 | // | 
|---|
| 28 | // MCalibrationChargeCam | 
|---|
| 29 | // | 
|---|
| 30 | // Hold the whole Calibration results of the camera: | 
|---|
| 31 | // | 
|---|
| 32 | // 1) MCalibrationChargeCam initializes a TClonesArray whose elements are | 
|---|
| 33 | //    pointers to MCalibrationChargePix Containers | 
|---|
| 34 | // 2) It initializes a pointer to an MCalibrationBlindPix container | 
|---|
| 35 | // 3) It initializes a pointer to an MCalibrationPINDiode container | 
|---|
| 36 | // | 
|---|
| 37 | // | 
|---|
| 38 | // The calculated values (types of GetPixelContent) are: | 
|---|
| 39 | // | 
|---|
| 40 | // -------------------------------------------------------------------------- | 
|---|
| 41 | // | 
|---|
| 42 | // The types are as follows: | 
|---|
| 43 | // | 
|---|
| 44 | // Fitted values: | 
|---|
| 45 | // ============== | 
|---|
| 46 | // | 
|---|
| 47 | // 0: Fitted Charge | 
|---|
| 48 | // 1: Error of fitted Charge | 
|---|
| 49 | // 2: Sigma of fitted Charge | 
|---|
| 50 | // 3: Error of Sigma of fitted Charge | 
|---|
| 51 | // | 
|---|
| 52 | // Useful variables derived from the fit results: | 
|---|
| 53 | // ============================================= | 
|---|
| 54 | // | 
|---|
| 55 | // 4: Returned probability of Gauss fit to Charge distribution | 
|---|
| 56 | // 5: Reduced Sigma of fitted Charge --> sqrt(sigma_Q^2 - PedRMS^2) | 
|---|
| 57 | // 6: Error Reduced Sigma of fitted Charge | 
|---|
| 58 | // 7: Reduced Sigma per Charge | 
|---|
| 59 | // 8: Error of Reduced Sigma per Charge | 
|---|
| 60 | // | 
|---|
| 61 | // Results of the different calibration methods: | 
|---|
| 62 | // ============================================= | 
|---|
| 63 | // | 
|---|
| 64 | // 9: Number of Photo-electrons obtained with the F-Factor method | 
|---|
| 65 | // 10: Error on Number of Photo-electrons obtained with the F-Factor method | 
|---|
| 66 | // 11: Mean conversion factor obtained with the F-Factor method | 
|---|
| 67 | // 12: Error on the mean conversion factor obtained with the F-Factor method | 
|---|
| 68 | // 13: Overall F-Factor of the readout obtained with the F-Factor method | 
|---|
| 69 | // 14: Error on Overall F-Factor of the readout obtained with the F-Factor method | 
|---|
| 70 | // 15: Number of Photons inside Plexiglass obtained with the Blind Pixel method | 
|---|
| 71 | // 16: Error on Number of Photons inside Plexiglass obtained with the Blind Pixel method | 
|---|
| 72 | // 17: Mean conversion factor obtained with the Blind Pixel method | 
|---|
| 73 | // 18: Error on the mean conversion factor obtained with the Blind Pixel method | 
|---|
| 74 | // 19: Overall F-Factor of the readout obtained with the Blind Pixel method | 
|---|
| 75 | // 20: Error on Overall F-Factor of the readout obtained with the Blind Pixel method | 
|---|
| 76 | // 21: Number of Photons outside Plexiglass obtained with the PIN Diode method | 
|---|
| 77 | // 22: Error on Number of Photons outside Plexiglass obtained with the PIN Diode method | 
|---|
| 78 | // 23: Mean conversion factor obtained with the PIN Diode method | 
|---|
| 79 | // 24: Error on the mean conversion factor obtained with the PIN Diode method | 
|---|
| 80 | // 25: Overall F-Factor of the readout obtained with the PIN Diode method | 
|---|
| 81 | // 26: Error on Overall F-Factor of the readout obtained with the PIN Diode method | 
|---|
| 82 | // | 
|---|
| 83 | // Localized defects: | 
|---|
| 84 | // ================== | 
|---|
| 85 | // | 
|---|
| 86 | // 27: Excluded Pixels | 
|---|
| 87 | // 28: Pixels where the fit did not succeed --> results obtained only from the histograms | 
|---|
| 88 | // 29: Pixels with apparently wrong results | 
|---|
| 89 | // 30: Pixels with un-expected behavior in the Hi Gain fourier spectrum (e.g. oscillations) | 
|---|
| 90 | // 31: Pixels with un-expected behavior in the Lo Gain fourier spectrum (e.g. oscillations)a | 
|---|
| 91 | // 32: Number of probable pickup events in the Hi Gain | 
|---|
| 92 | // 33: Number of probable pickup events in the Lo Gain | 
|---|
| 93 | // | 
|---|
| 94 | // Other classifications of pixels: | 
|---|
| 95 | // ================================ | 
|---|
| 96 | // | 
|---|
| 97 | // 34: Pixels with saturated Hi-Gain | 
|---|
| 98 | // | 
|---|
| 99 | // Classification of validity of the calibrations: | 
|---|
| 100 | // =============================================== | 
|---|
| 101 | // | 
|---|
| 102 | // 35: Pixels with valid calibration by the F-Factor-Method | 
|---|
| 103 | // 36: Pixels with valid calibration by the Blind Pixel-Method | 
|---|
| 104 | // 37: Pixels with valid calibration by the PIN Diode-Method | 
|---|
| 105 | // | 
|---|
| 106 | // Used Pedestals: | 
|---|
| 107 | // =============== | 
|---|
| 108 | // | 
|---|
| 109 | // 38: Mean Pedestal over the entire range of signal extraction | 
|---|
| 110 | // 39: Error on the Mean Pedestal over the entire range of signal extraction | 
|---|
| 111 | // 40: Pedestal RMS over the entire range of signal extraction | 
|---|
| 112 | // 41: Error on the Pedestal RMS over the entire range of signal extraction | 
|---|
| 113 | // | 
|---|
| 114 | // Calculated absolute arrival times (very low precision!): | 
|---|
| 115 | // ======================================================== | 
|---|
| 116 | // | 
|---|
| 117 | // 42: Absolute Arrival time of the signal | 
|---|
| 118 | // 43: RMS of the Absolute Arrival time of the signal | 
|---|
| 119 | // | 
|---|
| 120 | ///////////////////////////////////////////////////////////////////////////// | 
|---|
| 121 | #include "MCalibrationChargeCam.h" | 
|---|
| 122 |  | 
|---|
| 123 | #include <TH2.h> | 
|---|
| 124 | #include <TCanvas.h> | 
|---|
| 125 | #include <TClonesArray.h> | 
|---|
| 126 |  | 
|---|
| 127 | #include "MLog.h" | 
|---|
| 128 | #include "MLogManip.h" | 
|---|
| 129 |  | 
|---|
| 130 | #include "MGeomCam.h" | 
|---|
| 131 | #include "MGeomPix.h" | 
|---|
| 132 |  | 
|---|
| 133 | #include "MBadPixelsCam.h" | 
|---|
| 134 | #include "MBadPixelsPix.h" | 
|---|
| 135 |  | 
|---|
| 136 | #include "MCalibrationChargePix.h" | 
|---|
| 137 | #include "MCalibrationChargeBlindPix.h" | 
|---|
| 138 | #include "MCalibrationChargePINDiode.h" | 
|---|
| 139 |  | 
|---|
| 140 |  | 
|---|
| 141 | ClassImp(MCalibrationChargeCam); | 
|---|
| 142 |  | 
|---|
| 143 | using namespace std; | 
|---|
| 144 |  | 
|---|
| 145 | // -------------------------------------------------------------------------- | 
|---|
| 146 | // | 
|---|
| 147 | // Default constructor. | 
|---|
| 148 | // | 
|---|
| 149 | // Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry | 
|---|
| 150 | // Later, a call to MCalibrationChargeCam::InitSize(Int_t size) has to be performed | 
|---|
| 151 | // | 
|---|
| 152 | // Creates an MCalibrationBlindPix container | 
|---|
| 153 | // | 
|---|
| 154 | MCalibrationChargeCam::MCalibrationChargeCam(const char *name, const char *title) | 
|---|
| 155 | : fBlindPixel(NULL), | 
|---|
| 156 | fPINDiode(NULL), | 
|---|
| 157 | fGeomCam(NULL), | 
|---|
| 158 | fBadPixels(NULL), | 
|---|
| 159 | fOffsets(NULL), | 
|---|
| 160 | fSlopes(NULL), | 
|---|
| 161 | fOffvsSlope(NULL) | 
|---|
| 162 | { | 
|---|
| 163 | fName  = name  ? name  : "MCalibrationChargeCam"; | 
|---|
| 164 | fTitle = title ? title : "Storage container for the Calibration Information in the camera"; | 
|---|
| 165 |  | 
|---|
| 166 | fPixels          = new TClonesArray("MCalibrationChargePix",1); | 
|---|
| 167 | fAverageInnerPix = new MCalibrationChargePix("AverageInnerPix","Container of the fit results of the camera average inner pixels"); | 
|---|
| 168 | fAverageOuterPix = new MCalibrationChargePix("AverageOuterPix","Container of the fit results of the camera average outer pixels"); | 
|---|
| 169 | fAverageInnerBadPix = new MBadPixelsPix("AverageInnerBadPix","Bad Pixel Container of the camera average inner pixels"); | 
|---|
| 170 | fAverageOuterBadPix = new MBadPixelsPix("AverageOuterBadPix","Bad Pixel Container of the camera average outer pixels"); | 
|---|
| 171 |  | 
|---|
| 172 | Clear(); | 
|---|
| 173 | } | 
|---|
| 174 |  | 
|---|
| 175 | // -------------------------------------------------------------------------- | 
|---|
| 176 | // | 
|---|
| 177 | // Delete the TClonesArray of MCalibrationPix containers | 
|---|
| 178 | // Delete the MCalibrationPINDiode and the MCalibrationBlindPix | 
|---|
| 179 | // | 
|---|
| 180 | // Delete the histograms if they exist | 
|---|
| 181 | // | 
|---|
| 182 | MCalibrationChargeCam::~MCalibrationChargeCam() | 
|---|
| 183 | { | 
|---|
| 184 |  | 
|---|
| 185 | // | 
|---|
| 186 | // delete fPixels should delete all Objects stored inside | 
|---|
| 187 | // | 
|---|
| 188 | delete fPixels; | 
|---|
| 189 | delete fAverageInnerPix; | 
|---|
| 190 | delete fAverageOuterPix; | 
|---|
| 191 |  | 
|---|
| 192 | delete fAverageInnerBadPix; | 
|---|
| 193 | delete fAverageOuterBadPix; | 
|---|
| 194 |  | 
|---|
| 195 | if (fOffsets) | 
|---|
| 196 | delete fOffsets; | 
|---|
| 197 | if (fSlopes) | 
|---|
| 198 | delete fSlopes; | 
|---|
| 199 | if (fOffvsSlope) | 
|---|
| 200 | delete fOffvsSlope; | 
|---|
| 201 |  | 
|---|
| 202 | } | 
|---|
| 203 |  | 
|---|
| 204 | // ------------------------------------------------------------------- | 
|---|
| 205 | // | 
|---|
| 206 | // This function simply allocates memory via the ROOT command: | 
|---|
| 207 | // (TObject**) TStorage::ReAlloc(fCont, newSize * sizeof(TObject*), | 
|---|
| 208 | //                                      fSize * sizeof(TObject*)); | 
|---|
| 209 | // newSize corresponds to size in our case | 
|---|
| 210 | // fSize is the old size (in most cases: 1) | 
|---|
| 211 | // | 
|---|
| 212 | void MCalibrationChargeCam::InitSize(const UInt_t i) | 
|---|
| 213 | { | 
|---|
| 214 |  | 
|---|
| 215 | fPixels->ExpandCreate(i); | 
|---|
| 216 |  | 
|---|
| 217 | } | 
|---|
| 218 |  | 
|---|
| 219 | // -------------------------------------------------------------------------- | 
|---|
| 220 | // | 
|---|
| 221 | // This function returns the current size of the TClonesArray | 
|---|
| 222 | // independently if the MCalibrationPix is filled with values or not. | 
|---|
| 223 | // | 
|---|
| 224 | // It is the size of the array fPixels. | 
|---|
| 225 | // | 
|---|
| 226 | Int_t MCalibrationChargeCam::GetSize() const | 
|---|
| 227 | { | 
|---|
| 228 | return fPixels->GetEntriesFast(); | 
|---|
| 229 | } | 
|---|
| 230 |  | 
|---|
| 231 |  | 
|---|
| 232 | // -------------------------------------------------------------------------- | 
|---|
| 233 | // | 
|---|
| 234 | // Get i-th pixel (pixel number) | 
|---|
| 235 | // | 
|---|
| 236 | MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i) | 
|---|
| 237 | { | 
|---|
| 238 | return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i)); | 
|---|
| 239 | } | 
|---|
| 240 |  | 
|---|
| 241 | // -------------------------------------------------------------------------- | 
|---|
| 242 | // | 
|---|
| 243 | // Get i-th pixel (pixel number) | 
|---|
| 244 | // | 
|---|
| 245 | const MCalibrationChargePix &MCalibrationChargeCam::operator[](UInt_t i) const | 
|---|
| 246 | { | 
|---|
| 247 | return *static_cast<MCalibrationChargePix*>(fPixels->UncheckedAt(i)); | 
|---|
| 248 | } | 
|---|
| 249 |  | 
|---|
| 250 |  | 
|---|
| 251 | // -------------------------------------- | 
|---|
| 252 | // | 
|---|
| 253 | void MCalibrationChargeCam::Clear(Option_t *o) | 
|---|
| 254 | { | 
|---|
| 255 |  | 
|---|
| 256 | fPixels->ForEach(TObject, Clear)(); | 
|---|
| 257 | fAverageInnerPix->Clear(); | 
|---|
| 258 | fAverageOuterPix->Clear(); | 
|---|
| 259 |  | 
|---|
| 260 | fAverageInnerBadPix->Clear(); | 
|---|
| 261 | fAverageOuterBadPix->Clear(); | 
|---|
| 262 |  | 
|---|
| 263 | fNumExcludedPixels                 = 0; | 
|---|
| 264 |  | 
|---|
| 265 | CLRBIT(fFlags,kBlindPixelMethodValid); | 
|---|
| 266 | CLRBIT(fFlags,kPINDiodeMethodValid); | 
|---|
| 267 |  | 
|---|
| 268 | return; | 
|---|
| 269 | } | 
|---|
| 270 |  | 
|---|
| 271 | void MCalibrationChargeCam::SetBlindPixelMethodValid(const Bool_t b) | 
|---|
| 272 | { | 
|---|
| 273 | b ? SETBIT(fFlags, kBlindPixelMethodValid) : CLRBIT(fFlags, kBlindPixelMethodValid); | 
|---|
| 274 | } | 
|---|
| 275 |  | 
|---|
| 276 | void MCalibrationChargeCam::SetPINDiodeMethodValid(const Bool_t b) | 
|---|
| 277 | { | 
|---|
| 278 | b ? SETBIT(fFlags, kPINDiodeMethodValid) : CLRBIT(fFlags, kPINDiodeMethodValid); | 
|---|
| 279 | } | 
|---|
| 280 |  | 
|---|
| 281 | Bool_t  MCalibrationChargeCam::IsBlindPixelMethodValid()   const | 
|---|
| 282 | { | 
|---|
| 283 | return TESTBIT(fFlags,kBlindPixelMethodValid); | 
|---|
| 284 | } | 
|---|
| 285 |  | 
|---|
| 286 | Bool_t  MCalibrationChargeCam::IsPINDiodeMethodValid() const | 
|---|
| 287 | { | 
|---|
| 288 | return TESTBIT(fFlags,kPINDiodeMethodValid); | 
|---|
| 289 | } | 
|---|
| 290 |  | 
|---|
| 291 |  | 
|---|
| 292 | // -------------------------------------------------------------------------- | 
|---|
| 293 | // | 
|---|
| 294 | // Print first the well fitted pixels | 
|---|
| 295 | // and then the ones which are not FitValid | 
|---|
| 296 | // | 
|---|
| 297 | void MCalibrationChargeCam::Print(Option_t *o) const | 
|---|
| 298 | { | 
|---|
| 299 |  | 
|---|
| 300 | *fLog << all << GetDescriptor() << ":" << endl; | 
|---|
| 301 | int id = 0; | 
|---|
| 302 |  | 
|---|
| 303 | *fLog << all << "Succesfully calibrated pixels:" << endl; | 
|---|
| 304 | *fLog << all << endl; | 
|---|
| 305 |  | 
|---|
| 306 | TIter Next(fPixels); | 
|---|
| 307 | MCalibrationChargePix *pix; | 
|---|
| 308 | while ((pix=(MCalibrationChargePix*)Next())) | 
|---|
| 309 | { | 
|---|
| 310 |  | 
|---|
| 311 | if ((*fBadPixels)[pix->GetPixId()].IsCalibrationResultOK() && !pix->IsExcluded()) | 
|---|
| 312 | { | 
|---|
| 313 |  | 
|---|
| 314 | *fLog << all << "Pix " << pix->GetPixId() | 
|---|
| 315 | << ":  Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr() | 
|---|
| 316 | << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetSigmaCharge() | 
|---|
| 317 | << "   Reduced Sigma: "        << pix->GetRSigmaCharge() | 
|---|
| 318 | << "   Nr Phe's: "             << pix->GetPheFFactorMethod() | 
|---|
| 319 | << " Saturated? :" << pix->IsHiGainSaturation() | 
|---|
| 320 | << endl; | 
|---|
| 321 | id++; | 
|---|
| 322 | } | 
|---|
| 323 | } | 
|---|
| 324 |  | 
|---|
| 325 | *fLog << all << id << " succesful pixels :-))" << endl; | 
|---|
| 326 | id = 0; | 
|---|
| 327 |  | 
|---|
| 328 | *fLog << all << endl; | 
|---|
| 329 | *fLog << all << "Pixels with errors:" << endl; | 
|---|
| 330 | *fLog << all << endl; | 
|---|
| 331 |  | 
|---|
| 332 | TIter Next2(fPixels); | 
|---|
| 333 | while ((pix=(MCalibrationChargePix*)Next2())) | 
|---|
| 334 | { | 
|---|
| 335 |  | 
|---|
| 336 | if (!pix->IsExcluded() && !(*fBadPixels)[pix->GetPixId()].IsCalibrationResultOK()) | 
|---|
| 337 | { | 
|---|
| 338 |  | 
|---|
| 339 |  | 
|---|
| 340 | *fLog << all << "Pix " << pix->GetPixId() | 
|---|
| 341 | << ":  Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr() | 
|---|
| 342 | << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetSigmaCharge() | 
|---|
| 343 | << "   Reduced Sigma: "        << pix->GetRSigmaCharge() | 
|---|
| 344 | << "   Nr Phe's: "             << pix->GetPheFFactorMethod() | 
|---|
| 345 | << " Saturated? :" << pix->IsHiGainSaturation() | 
|---|
| 346 | << endl; | 
|---|
| 347 | id++; | 
|---|
| 348 | } | 
|---|
| 349 | } | 
|---|
| 350 | *fLog << all << id << " pixels with errors :-((" << endl; | 
|---|
| 351 |  | 
|---|
| 352 | *fLog << all << endl; | 
|---|
| 353 | *fLog << all << "Pixels with oscillations:" << endl; | 
|---|
| 354 | *fLog << all << endl; | 
|---|
| 355 |  | 
|---|
| 356 | id = 0; | 
|---|
| 357 |  | 
|---|
| 358 | TIter Next3(fPixels); | 
|---|
| 359 | while ((pix=(MCalibrationChargePix*)Next3())) | 
|---|
| 360 | { | 
|---|
| 361 |  | 
|---|
| 362 | if ( (*fBadPixels)[pix->GetPixId()].IsCalibrationOscillating()  && !pix->IsExcluded()) | 
|---|
| 363 | { | 
|---|
| 364 |  | 
|---|
| 365 | *fLog << all << "Pix " << pix->GetPixId() | 
|---|
| 366 | << ":  Ped.  Rms: "            << pix->GetPedRms()        << " +- " << pix->GetPedRmsErr() | 
|---|
| 367 | << "   Mean signal: "          << pix->GetMeanCharge()    << " +- " << pix->GetSigmaCharge() | 
|---|
| 368 | << "   Reduced Sigma: "        << pix->GetRSigmaCharge() | 
|---|
| 369 | << "   Nr Phe's: "             << pix->GetPheFFactorMethod() | 
|---|
| 370 | << " Saturated? :" << pix->IsHiGainSaturation() | 
|---|
| 371 | << endl; | 
|---|
| 372 | id++; | 
|---|
| 373 | } | 
|---|
| 374 | } | 
|---|
| 375 | *fLog << all << id << " Oscillating pixels :-((" << endl; | 
|---|
| 376 |  | 
|---|
| 377 |  | 
|---|
| 378 | *fLog << all << endl; | 
|---|
| 379 | *fLog << all << "Excluded pixels:" << endl; | 
|---|
| 380 | *fLog << all << endl; | 
|---|
| 381 |  | 
|---|
| 382 | id = 0; | 
|---|
| 383 |  | 
|---|
| 384 | TIter Next4(fPixels); | 
|---|
| 385 | while ((pix=(MCalibrationChargePix*)Next4())) | 
|---|
| 386 | { | 
|---|
| 387 | if (pix->IsExcluded()) | 
|---|
| 388 | { | 
|---|
| 389 | *fLog << all << pix->GetPixId() << endl; | 
|---|
| 390 | id++; | 
|---|
| 391 | } | 
|---|
| 392 | } | 
|---|
| 393 | *fLog << all << id << " Excluded pixels " << endl; | 
|---|
| 394 | *fLog << endl; | 
|---|
| 395 | *fLog << all << "Average Inner Pix:" | 
|---|
| 396 | << "   Ped.  Rms: "            << fAverageInnerPix->GetPedRms()        << " +- " << fAverageInnerPix->GetPedRmsErr() | 
|---|
| 397 | << "   Mean signal: "          << fAverageInnerPix->GetMeanCharge()    << " +- " << fAverageInnerPix->GetMeanChargeErr() | 
|---|
| 398 | << "   Sigma signal: "         << fAverageInnerPix->GetSigmaCharge()    << " +- "<< fAverageInnerPix->GetSigmaChargeErr() | 
|---|
| 399 | << "   Reduced Sigma: "        << fAverageInnerPix->GetRSigmaCharge() | 
|---|
| 400 | << "   Nr Phe's: "             << fAverageInnerPix->GetPheFFactorMethod() | 
|---|
| 401 | << endl; | 
|---|
| 402 | *fLog << all << "Average Outer Pix:" | 
|---|
| 403 | << "   Ped.  Rms: "            << fAverageOuterPix->GetPedRms()        << " +- " << fAverageOuterPix->GetPedRmsErr() | 
|---|
| 404 | << "   Mean signal: "          << fAverageOuterPix->GetMeanCharge()    << " +- " << fAverageOuterPix->GetMeanChargeErr() | 
|---|
| 405 | << "   Sigma signal: "         << fAverageOuterPix->GetSigmaCharge()    << " +- "<< fAverageOuterPix->GetSigmaChargeErr() | 
|---|
| 406 | << "   Reduced Sigma: "        << fAverageOuterPix->GetRSigmaCharge() | 
|---|
| 407 | << "   Nr Phe's: "             << fAverageOuterPix->GetPheFFactorMethod() | 
|---|
| 408 | << endl; | 
|---|
| 409 |  | 
|---|
| 410 | } | 
|---|
| 411 |  | 
|---|
| 412 |  | 
|---|
| 413 | // -------------------------------------------------------------------------- | 
|---|
| 414 | // | 
|---|
| 415 | // The types are as follows: | 
|---|
| 416 | // | 
|---|
| 417 | // Fitted values: | 
|---|
| 418 | // ============== | 
|---|
| 419 | // | 
|---|
| 420 | // 0: Fitted Charge | 
|---|
| 421 | // 1: Error of fitted Charge | 
|---|
| 422 | // 2: Sigma of fitted Charge | 
|---|
| 423 | // 3: Error of Sigma of fitted Charge | 
|---|
| 424 | // | 
|---|
| 425 | // Useful variables derived from the fit results: | 
|---|
| 426 | // ============================================= | 
|---|
| 427 | // | 
|---|
| 428 | // 4: Returned probability of Gauss fit to Charge distribution | 
|---|
| 429 | // 5: Reduced Sigma of fitted Charge --> sqrt(sigma_Q^2 - PedRMS^2) | 
|---|
| 430 | // 6: Error Reduced Sigma of fitted Charge | 
|---|
| 431 | // 7: Reduced Sigma per Charge | 
|---|
| 432 | // 8: Error of Reduced Sigma per Charge | 
|---|
| 433 | // | 
|---|
| 434 | // Results of the different calibration methods: | 
|---|
| 435 | // ============================================= | 
|---|
| 436 | // | 
|---|
| 437 | // 9: Number of Photo-electrons obtained with the F-Factor method | 
|---|
| 438 | // 10: Error on Number of Photo-electrons obtained with the F-Factor method | 
|---|
| 439 | // 11: Mean conversion factor obtained with the F-Factor method | 
|---|
| 440 | // 12: Error on the mean conversion factor obtained with the F-Factor method | 
|---|
| 441 | // 13: Overall F-Factor of the readout obtained with the F-Factor method | 
|---|
| 442 | // 14: Error on Overall F-Factor of the readout obtained with the F-Factor method | 
|---|
| 443 | // 15: Number of Photons inside Plexiglass obtained with the Blind Pixel method | 
|---|
| 444 | // 16: Error on Number of Photons inside Plexiglass obtained with the Blind Pixel method | 
|---|
| 445 | // 17: Mean conversion factor obtained with the Blind Pixel method | 
|---|
| 446 | // 18: Error on the mean conversion factor obtained with the Blind Pixel method | 
|---|
| 447 | // 19: Overall F-Factor of the readout obtained with the Blind Pixel method | 
|---|
| 448 | // 20: Error on Overall F-Factor of the readout obtained with the Blind Pixel method | 
|---|
| 449 | // 21: Number of Photons outside Plexiglass obtained with the PIN Diode method | 
|---|
| 450 | // 22: Error on Number of Photons outside Plexiglass obtained with the PIN Diode method | 
|---|
| 451 | // 23: Mean conversion factor obtained with the PIN Diode method | 
|---|
| 452 | // 24: Error on the mean conversion factor obtained with the PIN Diode method | 
|---|
| 453 | // 25: Overall F-Factor of the readout obtained with the PIN Diode method | 
|---|
| 454 | // 26: Error on Overall F-Factor of the readout obtained with the PIN Diode method | 
|---|
| 455 | // | 
|---|
| 456 | // Localized defects: | 
|---|
| 457 | // ================== | 
|---|
| 458 | // | 
|---|
| 459 | // 27: Excluded Pixels | 
|---|
| 460 | // 28: Pixels where the fit did not succeed --> results obtained only from the histograms | 
|---|
| 461 | // 29: Pixels with apparently wrong results | 
|---|
| 462 | // 30: Pixels with un-expected behavior in the Hi Gain fourier spectrum (e.g. oscillations) | 
|---|
| 463 | // 31: Pixels with un-expected behavior in the Lo Gain fourier spectrum (e.g. oscillations)a | 
|---|
| 464 | // 32: Number of probable pickup events in the Hi Gain | 
|---|
| 465 | // 33: Number of probable pickup events in the Lo Gain | 
|---|
| 466 | // | 
|---|
| 467 | // Other classifications of pixels: | 
|---|
| 468 | // ================================ | 
|---|
| 469 | // | 
|---|
| 470 | // 34: Pixels with saturated Hi-Gain | 
|---|
| 471 | // | 
|---|
| 472 | // Classification of validity of the calibrations: | 
|---|
| 473 | // =============================================== | 
|---|
| 474 | // | 
|---|
| 475 | // 35: Pixels with valid calibration by the F-Factor-Method | 
|---|
| 476 | // 36: Pixels with valid calibration by the Blind Pixel-Method | 
|---|
| 477 | // 37: Pixels with valid calibration by the PIN Diode-Method | 
|---|
| 478 | // | 
|---|
| 479 | // Used Pedestals: | 
|---|
| 480 | // =============== | 
|---|
| 481 | // | 
|---|
| 482 | // 38: Mean Pedestal over the entire range of signal extraction | 
|---|
| 483 | // 39: Error on the Mean Pedestal over the entire range of signal extraction | 
|---|
| 484 | // 40: Pedestal RMS over the entire range of signal extraction | 
|---|
| 485 | // 41: Error on the Pedestal RMS over the entire range of signal extraction | 
|---|
| 486 | // | 
|---|
| 487 | // Calculated absolute arrival times (very low precision!): | 
|---|
| 488 | // ======================================================== | 
|---|
| 489 | // | 
|---|
| 490 | // 42: Absolute Arrival time of the signal | 
|---|
| 491 | // 43: RMS of the Absolute Arrival time of the signal | 
|---|
| 492 | // | 
|---|
| 493 | Bool_t MCalibrationChargeCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const | 
|---|
| 494 | { | 
|---|
| 495 |  | 
|---|
| 496 | if (idx > GetSize()) | 
|---|
| 497 | return kFALSE; | 
|---|
| 498 |  | 
|---|
| 499 | Float_t area = cam[idx].GetA(); | 
|---|
| 500 |  | 
|---|
| 501 | if (area == 0) | 
|---|
| 502 | return kFALSE; | 
|---|
| 503 |  | 
|---|
| 504 | switch (type) | 
|---|
| 505 | { | 
|---|
| 506 | case 0: | 
|---|
| 507 | if ((*this)[idx].IsExcluded()) | 
|---|
| 508 | return kFALSE; | 
|---|
| 509 | val = (*this)[idx].GetMeanCharge(); | 
|---|
| 510 | break; | 
|---|
| 511 | case 1: | 
|---|
| 512 | if ((*this)[idx].IsExcluded()) | 
|---|
| 513 | return kFALSE; | 
|---|
| 514 | val = (*this)[idx].GetMeanChargeErr(); | 
|---|
| 515 | break; | 
|---|
| 516 | case 2: | 
|---|
| 517 | if ((*this)[idx].IsExcluded()) | 
|---|
| 518 | return kFALSE; | 
|---|
| 519 | val = (*this)[idx].GetSigmaCharge(); | 
|---|
| 520 | break; | 
|---|
| 521 | case 3: | 
|---|
| 522 | if ((*this)[idx].IsExcluded()) | 
|---|
| 523 | return kFALSE; | 
|---|
| 524 | val = (*this)[idx].GetSigmaChargeErr(); | 
|---|
| 525 | break; | 
|---|
| 526 | case 4: | 
|---|
| 527 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK()) | 
|---|
| 528 | return kFALSE; | 
|---|
| 529 | val = (*this)[idx].GetChargeProb(); | 
|---|
| 530 | break; | 
|---|
| 531 | case 5: | 
|---|
| 532 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK()) | 
|---|
| 533 | return kFALSE; | 
|---|
| 534 | if ((*this)[idx].GetRSigmaCharge() == -1.) | 
|---|
| 535 | return kFALSE; | 
|---|
| 536 | val = (*this)[idx].GetRSigmaCharge(); | 
|---|
| 537 | break; | 
|---|
| 538 | case 6: | 
|---|
| 539 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK()) | 
|---|
| 540 | return kFALSE; | 
|---|
| 541 | if ((*this)[idx].GetRSigmaCharge() == -1.) | 
|---|
| 542 | return kFALSE; | 
|---|
| 543 | val = (*this)[idx].GetRSigmaChargeErr(); | 
|---|
| 544 | break; | 
|---|
| 545 | case 7: | 
|---|
| 546 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK()) | 
|---|
| 547 | return kFALSE; | 
|---|
| 548 | if ((*this)[idx].GetRSigmaCharge() == -1.) | 
|---|
| 549 | return kFALSE; | 
|---|
| 550 | val = (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge(); | 
|---|
| 551 | break; | 
|---|
| 552 | case 8: | 
|---|
| 553 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK()) | 
|---|
| 554 | return kFALSE; | 
|---|
| 555 | if ((*this)[idx].GetRSigmaCharge() == -1.) | 
|---|
| 556 | return kFALSE; | 
|---|
| 557 | // relative error RsigmaCharge square | 
|---|
| 558 | val =    (*this)[idx].GetRSigmaChargeErr()* (*this)[idx].GetRSigmaChargeErr() | 
|---|
| 559 | / ((*this)[idx].GetRSigmaCharge()   * (*this)[idx].GetRSigmaCharge()   ); | 
|---|
| 560 | // relative error Charge square | 
|---|
| 561 | val +=   (*this)[idx].GetMeanChargeErr() * (*this)[idx].GetMeanChargeErr() | 
|---|
| 562 | / ((*this)[idx].GetMeanCharge()    * (*this)[idx].GetMeanCharge()   ); | 
|---|
| 563 | // calculate relative error out of squares | 
|---|
| 564 | val  =   TMath::Sqrt(val) ; | 
|---|
| 565 | // multiply with value to get absolute error | 
|---|
| 566 | val  *=  (*this)[idx].GetRSigmaCharge() / (*this)[idx].GetMeanCharge(); | 
|---|
| 567 | break; | 
|---|
| 568 | case 9: | 
|---|
| 569 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) | 
|---|
| 570 | return kFALSE; | 
|---|
| 571 | val = (*this)[idx].GetPheFFactorMethod(); | 
|---|
| 572 | break; | 
|---|
| 573 | case 10: | 
|---|
| 574 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) | 
|---|
| 575 | return kFALSE; | 
|---|
| 576 | val = (*this)[idx].GetPheFFactorMethodErr(); | 
|---|
| 577 | break; | 
|---|
| 578 | case 11: | 
|---|
| 579 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) | 
|---|
| 580 | return kFALSE; | 
|---|
| 581 | val = (*this)[idx].GetMeanConversionFFactorMethod(); | 
|---|
| 582 | break; | 
|---|
| 583 | case 12: | 
|---|
| 584 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) | 
|---|
| 585 | return kFALSE; | 
|---|
| 586 | val = (*this)[idx].GetConversionFFactorMethodErr(); | 
|---|
| 587 | break; | 
|---|
| 588 | case 13: | 
|---|
| 589 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) | 
|---|
| 590 | return kFALSE; | 
|---|
| 591 | val = (*this)[idx].GetTotalFFactorFFactorMethod(); | 
|---|
| 592 | break; | 
|---|
| 593 | case 14: | 
|---|
| 594 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsFFactorMethodValid()) | 
|---|
| 595 | return kFALSE; | 
|---|
| 596 | val = (*this)[idx].GetTotalFFactorErrFFactorMethod(); | 
|---|
| 597 | break; | 
|---|
| 598 | case 15: | 
|---|
| 599 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) | 
|---|
| 600 | return kFALSE; | 
|---|
| 601 | val = fBlindPixel->GetMeanFluxInsidePlexiglass()*area; | 
|---|
| 602 | break; | 
|---|
| 603 | case 16: | 
|---|
| 604 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) | 
|---|
| 605 | return kFALSE; | 
|---|
| 606 | val = fBlindPixel->GetMeanFluxErrInsidePlexiglass()*area; | 
|---|
| 607 | break; | 
|---|
| 608 | case 17: | 
|---|
| 609 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) | 
|---|
| 610 | return kFALSE; | 
|---|
| 611 | val = (*this)[idx].GetMeanConversionBlindPixelMethod(); | 
|---|
| 612 | break; | 
|---|
| 613 | case 18: | 
|---|
| 614 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) | 
|---|
| 615 | return kFALSE; | 
|---|
| 616 | val = (*this)[idx].GetConversionBlindPixelMethodErr(); | 
|---|
| 617 | break; | 
|---|
| 618 | case 19: | 
|---|
| 619 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) | 
|---|
| 620 | return kFALSE; | 
|---|
| 621 | val = (*this)[idx].GetTotalFFactorBlindPixelMethod(); | 
|---|
| 622 | break; | 
|---|
| 623 | case 20: | 
|---|
| 624 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsBlindPixelMethodValid()) | 
|---|
| 625 | return kFALSE; | 
|---|
| 626 | val = (*this)[idx].GetTotalFFactorErrBlindPixelMethod(); | 
|---|
| 627 | break; | 
|---|
| 628 | case 21: | 
|---|
| 629 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) | 
|---|
| 630 | return kFALSE; | 
|---|
| 631 | val = fPINDiode->GetMeanFluxOutsidePlexiglass()*area; | 
|---|
| 632 | break; | 
|---|
| 633 | case 22: | 
|---|
| 634 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) | 
|---|
| 635 | return kFALSE; | 
|---|
| 636 | val = fPINDiode->GetMeanFluxErrOutsidePlexiglass()*area; | 
|---|
| 637 | break; | 
|---|
| 638 | case 23: | 
|---|
| 639 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) | 
|---|
| 640 | return kFALSE; | 
|---|
| 641 | val = (*this)[idx].GetMeanConversionPINDiodeMethod(); | 
|---|
| 642 | break; | 
|---|
| 643 | case 24: | 
|---|
| 644 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) | 
|---|
| 645 | return kFALSE; | 
|---|
| 646 | val = (*this)[idx].GetConversionPINDiodeMethodErr(); | 
|---|
| 647 | break; | 
|---|
| 648 | case 25: | 
|---|
| 649 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) | 
|---|
| 650 | return kFALSE; | 
|---|
| 651 | val = (*this)[idx].GetTotalFFactorPINDiodeMethod(); | 
|---|
| 652 | break; | 
|---|
| 653 | case 26: | 
|---|
| 654 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK() || !(*this)[idx].IsPINDiodeMethodValid()) | 
|---|
| 655 | return kFALSE; | 
|---|
| 656 | val = (*this)[idx].GetTotalFFactorErrPINDiodeMethod(); | 
|---|
| 657 | break; | 
|---|
| 658 | case 27: | 
|---|
| 659 | if ((*this)[idx].IsExcluded()) | 
|---|
| 660 | val = 1.; | 
|---|
| 661 | else | 
|---|
| 662 | return kFALSE; | 
|---|
| 663 | break; | 
|---|
| 664 | case 28: | 
|---|
| 665 | if ((*this)[idx].IsExcluded()) | 
|---|
| 666 | return kFALSE; | 
|---|
| 667 | if (!(*this)[idx].IsFitted()) | 
|---|
| 668 | val = 1; | 
|---|
| 669 | else | 
|---|
| 670 | return kFALSE; | 
|---|
| 671 | break; | 
|---|
| 672 | case 29: | 
|---|
| 673 | if ((*this)[idx].IsExcluded()) | 
|---|
| 674 | return kFALSE; | 
|---|
| 675 | if (!(*fBadPixels)[idx].IsCalibrationSignalOK()) | 
|---|
| 676 | val = 1; | 
|---|
| 677 | else | 
|---|
| 678 | return kFALSE; | 
|---|
| 679 | break; | 
|---|
| 680 | case 30: | 
|---|
| 681 | if ((*this)[idx].IsExcluded()) | 
|---|
| 682 | return kFALSE; | 
|---|
| 683 | if ((*fBadPixels)[idx].IsCalibrationOscillating()) | 
|---|
| 684 | val = 1; | 
|---|
| 685 | else | 
|---|
| 686 | return kFALSE; | 
|---|
| 687 | break; | 
|---|
| 688 | case 31: | 
|---|
| 689 | if ((*this)[idx].IsExcluded()) | 
|---|
| 690 | return kFALSE; | 
|---|
| 691 | if ((*fBadPixels)[idx].IsCalibrationOscillating()) | 
|---|
| 692 | val = 1; | 
|---|
| 693 | else | 
|---|
| 694 | return kFALSE; | 
|---|
| 695 | break; | 
|---|
| 696 | case 32: | 
|---|
| 697 | if ((*this)[idx].IsExcluded()) | 
|---|
| 698 | return kFALSE; | 
|---|
| 699 | val = (*this)[idx].GetHiGainNumPickup(); | 
|---|
| 700 | break; | 
|---|
| 701 | case 33: | 
|---|
| 702 | if ((*this)[idx].IsExcluded()) | 
|---|
| 703 | return kFALSE; | 
|---|
| 704 | val = (*this)[idx].GetLoGainNumPickup(); | 
|---|
| 705 | break; | 
|---|
| 706 | case 34: | 
|---|
| 707 | if ((*this)[idx].IsExcluded()) | 
|---|
| 708 | return kFALSE; | 
|---|
| 709 | val = (*this)[idx].IsHiGainSaturation(); | 
|---|
| 710 | break; | 
|---|
| 711 | case 35: | 
|---|
| 712 | if ((*this)[idx].IsExcluded()) | 
|---|
| 713 | return kFALSE; | 
|---|
| 714 | if ((*this)[idx].IsFFactorMethodValid()) | 
|---|
| 715 | val = 1; | 
|---|
| 716 | else | 
|---|
| 717 | return kFALSE; | 
|---|
| 718 | break; | 
|---|
| 719 | case 36: | 
|---|
| 720 | if ((*this)[idx].IsExcluded()) | 
|---|
| 721 | return kFALSE; | 
|---|
| 722 | if ((*this)[idx].IsBlindPixelMethodValid()) | 
|---|
| 723 | val = 1; | 
|---|
| 724 | else | 
|---|
| 725 | return kFALSE; | 
|---|
| 726 | break; | 
|---|
| 727 | case 37: | 
|---|
| 728 | if ((*this)[idx].IsExcluded()) | 
|---|
| 729 | return kFALSE; | 
|---|
| 730 | if ((*this)[idx].IsPINDiodeMethodValid()) | 
|---|
| 731 | val = 1; | 
|---|
| 732 | else | 
|---|
| 733 | return kFALSE; | 
|---|
| 734 | break; | 
|---|
| 735 | case 38: | 
|---|
| 736 | if ((*this)[idx].IsExcluded()) | 
|---|
| 737 | return kFALSE; | 
|---|
| 738 | val = (*this)[idx].GetPed(); | 
|---|
| 739 | break; | 
|---|
| 740 | case 39: | 
|---|
| 741 | if ((*this)[idx].IsExcluded()) | 
|---|
| 742 | return kFALSE; | 
|---|
| 743 | val = (*this)[idx].GetPedErr(); | 
|---|
| 744 | break; | 
|---|
| 745 | case 40: | 
|---|
| 746 | if ((*this)[idx].IsExcluded()) | 
|---|
| 747 | return kFALSE; | 
|---|
| 748 | val = (*this)[idx].GetPedRms(); | 
|---|
| 749 | break; | 
|---|
| 750 | case 41: | 
|---|
| 751 | if ((*this)[idx].IsExcluded()) | 
|---|
| 752 | return kFALSE; | 
|---|
| 753 | val = (*this)[idx].GetPedErr()/2.; | 
|---|
| 754 | break; | 
|---|
| 755 | case 42: | 
|---|
| 756 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK()) | 
|---|
| 757 | return kFALSE; | 
|---|
| 758 | val = (*this)[idx].GetAbsTimeMean(); | 
|---|
| 759 | break; | 
|---|
| 760 | case 43: | 
|---|
| 761 | if ((*this)[idx].IsExcluded() || !(*fBadPixels)[idx].IsCalibrationSignalOK()) | 
|---|
| 762 | return kFALSE; | 
|---|
| 763 | val = (*this)[idx].GetAbsTimeRms(); | 
|---|
| 764 | break; | 
|---|
| 765 | default: | 
|---|
| 766 | return kFALSE; | 
|---|
| 767 | } | 
|---|
| 768 | return val!=-1.; | 
|---|
| 769 | } | 
|---|
| 770 |  | 
|---|
| 771 | // -------------------------------------------------------------------------- | 
|---|
| 772 | // | 
|---|
| 773 | // What MHCamera needs in order to draw an individual pixel in the camera | 
|---|
| 774 | // | 
|---|
| 775 | void MCalibrationChargeCam::DrawPixelContent(Int_t idx) const | 
|---|
| 776 | { | 
|---|
| 777 | if (idx == -1) | 
|---|
| 778 | fAverageInnerPix->DrawClone(); | 
|---|
| 779 | if (idx == -2) | 
|---|
| 780 | fAverageOuterPix->DrawClone(); | 
|---|
| 781 |  | 
|---|
| 782 | (*this)[idx].DrawClone(); | 
|---|
| 783 | } | 
|---|
| 784 |  | 
|---|
| 785 | void MCalibrationChargeCam::ApplyBlindPixelCalibration() | 
|---|
| 786 | { | 
|---|
| 787 |  | 
|---|
| 788 | Float_t flux    = fBlindPixel->GetMeanFluxInsidePlexiglass(); | 
|---|
| 789 | Float_t fluxerr = fBlindPixel->GetMeanFluxErrInsidePlexiglass(); | 
|---|
| 790 |  | 
|---|
| 791 | TIter Next(fPixels); | 
|---|
| 792 | MCalibrationChargePix *pix; | 
|---|
| 793 | while ((pix=(MCalibrationChargePix*)Next())) | 
|---|
| 794 | { | 
|---|
| 795 |  | 
|---|
| 796 | if((*fBadPixels)[pix->GetPixId()].IsCalibrationResultOK()) | 
|---|
| 797 | { | 
|---|
| 798 |  | 
|---|
| 799 | const Int_t idx = pix->GetPixId(); | 
|---|
| 800 |  | 
|---|
| 801 | const Float_t charge    = pix->GetMeanCharge(); | 
|---|
| 802 | const Float_t area      = (*fGeomCam)[idx].GetA(); | 
|---|
| 803 | const Float_t chargeerr = pix->GetMeanChargeErr(); | 
|---|
| 804 |  | 
|---|
| 805 | const Float_t nphot      = flux    * area; | 
|---|
| 806 | const Float_t nphoterr   = fluxerr * area; | 
|---|
| 807 | const Float_t conversion = nphot/charge; | 
|---|
| 808 | Float_t conversionerr; | 
|---|
| 809 |  | 
|---|
| 810 | conversionerr  = nphoterr/charge | 
|---|
| 811 | * nphoterr/charge ; | 
|---|
| 812 | conversionerr += chargeerr/charge | 
|---|
| 813 | * chargeerr/charge | 
|---|
| 814 | * conversion*conversion; | 
|---|
| 815 | conversionerr = TMath::Sqrt(conversionerr); | 
|---|
| 816 |  | 
|---|
| 817 | const Float_t conversionsigma = 0.; | 
|---|
| 818 |  | 
|---|
| 819 | pix->SetConversionBlindPixelMethod(conversion, conversionerr, conversionsigma); | 
|---|
| 820 |  | 
|---|
| 821 | if (conversionerr/conversion < 0.1) | 
|---|
| 822 | pix->SetBlindPixelMethodValid(); | 
|---|
| 823 | } | 
|---|
| 824 | } | 
|---|
| 825 | } | 
|---|
| 826 |  | 
|---|
| 827 |  | 
|---|
| 828 | void MCalibrationChargeCam::ApplyPINDiodeCalibration() | 
|---|
| 829 | { | 
|---|
| 830 |  | 
|---|
| 831 | Float_t flux    = fPINDiode->GetMeanFluxOutsidePlexiglass(); | 
|---|
| 832 | Float_t fluxerr = fPINDiode->GetMeanFluxErrOutsidePlexiglass(); | 
|---|
| 833 |  | 
|---|
| 834 | TIter Next(fPixels); | 
|---|
| 835 | MCalibrationChargePix *pix; | 
|---|
| 836 | while ((pix=(MCalibrationChargePix*)Next())) | 
|---|
| 837 | { | 
|---|
| 838 |  | 
|---|
| 839 | if((*fBadPixels)[pix->GetPixId()].IsCalibrationResultOK()) | 
|---|
| 840 | { | 
|---|
| 841 |  | 
|---|
| 842 | const Int_t idx = pix->GetPixId(); | 
|---|
| 843 |  | 
|---|
| 844 | const Float_t charge    = pix->GetMeanCharge(); | 
|---|
| 845 | const Float_t area      = (*fGeomCam)[idx].GetA(); | 
|---|
| 846 | const Float_t chargeerr = pix->GetMeanChargeErr(); | 
|---|
| 847 |  | 
|---|
| 848 | const Float_t nphot      = flux    * area; | 
|---|
| 849 | const Float_t nphoterr   = fluxerr * area; | 
|---|
| 850 | const Float_t conversion = nphot/charge; | 
|---|
| 851 |  | 
|---|
| 852 | Float_t conversionerr; | 
|---|
| 853 |  | 
|---|
| 854 | conversionerr  = nphoterr/charge | 
|---|
| 855 | * nphoterr/charge ; | 
|---|
| 856 | conversionerr += chargeerr/charge | 
|---|
| 857 | * chargeerr/charge | 
|---|
| 858 | * conversion*conversion; | 
|---|
| 859 | if (conversionerr > 0.) | 
|---|
| 860 | conversionerr = TMath::Sqrt(conversionerr); | 
|---|
| 861 |  | 
|---|
| 862 | const Float_t conversionsigma = 0.; | 
|---|
| 863 |  | 
|---|
| 864 | pix->SetConversionPINDiodeMethod(conversion, conversionerr, conversionsigma); | 
|---|
| 865 |  | 
|---|
| 866 | if (conversionerr/conversion < 0.1) | 
|---|
| 867 | pix->SetPINDiodeMethodValid(); | 
|---|
| 868 |  | 
|---|
| 869 | } | 
|---|
| 870 | } | 
|---|
| 871 | } | 
|---|
| 872 |  | 
|---|
| 873 |  | 
|---|
| 874 |  | 
|---|
| 875 | Bool_t MCalibrationChargeCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) | 
|---|
| 876 | { | 
|---|
| 877 |  | 
|---|
| 878 | mean  = (*this)[ipx].GetMeanConversionBlindPixelMethod(); | 
|---|
| 879 | err   = (*this)[ipx].GetConversionBlindPixelMethodErr(); | 
|---|
| 880 | sigma = (*this)[ipx].GetSigmaConversionBlindPixelMethod(); | 
|---|
| 881 |  | 
|---|
| 882 | return kTRUE; | 
|---|
| 883 | } | 
|---|
| 884 |  | 
|---|
| 885 |  | 
|---|
| 886 | Bool_t MCalibrationChargeCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) | 
|---|
| 887 | { | 
|---|
| 888 |  | 
|---|
| 889 | Float_t conv = (*this)[ipx].GetMeanConversionFFactorMethod(); | 
|---|
| 890 |  | 
|---|
| 891 | if (conv < 0.) | 
|---|
| 892 | return kFALSE; | 
|---|
| 893 |  | 
|---|
| 894 | mean  = conv; | 
|---|
| 895 | err   = (*this)[ipx].GetConversionFFactorMethodErr(); | 
|---|
| 896 | sigma = (*this)[ipx].GetSigmaConversionFFactorMethod(); | 
|---|
| 897 |  | 
|---|
| 898 | return kTRUE; | 
|---|
| 899 | } | 
|---|
| 900 |  | 
|---|
| 901 |  | 
|---|
| 902 | //----------------------------------------------------------------------------------- | 
|---|
| 903 | // | 
|---|
| 904 | // Calculates the conversion factor between the integral of FADCs slices | 
|---|
| 905 | // (as defined in the signal extractor MExtractSignal.cc) | 
|---|
| 906 | // and the number of photons reaching the plexiglass for one Inner Pixel | 
|---|
| 907 | // | 
|---|
| 908 | // FIXME: The PINDiode is still not working and so is the code | 
|---|
| 909 | // | 
|---|
| 910 | Bool_t MCalibrationChargeCam::GetConversionFactorPINDiode(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) | 
|---|
| 911 | { | 
|---|
| 912 |  | 
|---|
| 913 | mean  = (*this)[ipx].GetMeanConversionPINDiodeMethod(); | 
|---|
| 914 | err   = (*this)[ipx].GetConversionPINDiodeMethodErr(); | 
|---|
| 915 | sigma = (*this)[ipx].GetSigmaConversionPINDiodeMethod(); | 
|---|
| 916 |  | 
|---|
| 917 | return kFALSE; | 
|---|
| 918 |  | 
|---|
| 919 | } | 
|---|
| 920 |  | 
|---|
| 921 | //----------------------------------------------------------------------------------- | 
|---|
| 922 | // | 
|---|
| 923 | // Calculates the best combination of the three used methods possible | 
|---|
| 924 | // between the integral of FADCs slices | 
|---|
| 925 | // (as defined in the signal extractor MExtractSignal.cc) | 
|---|
| 926 | // and the number of photons reaching one Inner Pixel. | 
|---|
| 927 | // The procedure is not yet defined. | 
|---|
| 928 | // | 
|---|
| 929 | // FIXME: The PINDiode is still not working and so is the code | 
|---|
| 930 | // | 
|---|
| 931 | Bool_t MCalibrationChargeCam::GetConversionFactorCombined(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma) | 
|---|
| 932 | { | 
|---|
| 933 | return kFALSE; | 
|---|
| 934 |  | 
|---|
| 935 | } | 
|---|
| 936 |  | 
|---|
| 937 | /* | 
|---|
| 938 | void MCalibrationChargeCam::DrawHiLoFits() | 
|---|
| 939 | { | 
|---|
| 940 |  | 
|---|
| 941 | if (!fOffsets) | 
|---|
| 942 | fOffsets = new TH1D("pp","Offsets of the HiGain LoGain Fit",100,-600.,400.); | 
|---|
| 943 | if (!fSlopes) | 
|---|
| 944 | fSlopes  = new TH1D("mm","Slopes of the HiGain LoGain Fit",100,-2.,2.); | 
|---|
| 945 | if (!fOffvsSlope) | 
|---|
| 946 | fOffvsSlope = new TH2D("aa","Slopes vs Offsets of the HiGain LoGain Fit",100,-600.,400.,100,-2.,2.); | 
|---|
| 947 |  | 
|---|
| 948 | TIter Next(fPixels); | 
|---|
| 949 | MCalibrationPix *pix; | 
|---|
| 950 | MHCalibrationPixel *hist; | 
|---|
| 951 | while ((pix=(MCalibrationPix*)Next())) | 
|---|
| 952 | { | 
|---|
| 953 | hist = pix->GetHist(); | 
|---|
| 954 | hist->FitHiGainvsLoGain(); | 
|---|
| 955 | fOffsets->Fill(hist->GetOffset(),1.); | 
|---|
| 956 | fSlopes->Fill(hist->GetSlope(),1.); | 
|---|
| 957 | fOffvsSlope->Fill(hist->GetOffset(),hist->GetSlope(),1.); | 
|---|
| 958 | } | 
|---|
| 959 |  | 
|---|
| 960 | TCanvas *c1 = new TCanvas(); | 
|---|
| 961 |  | 
|---|
| 962 | c1->Divide(1,3); | 
|---|
| 963 | c1->cd(1); | 
|---|
| 964 | fOffsets->Draw(); | 
|---|
| 965 | gPad->Modified(); | 
|---|
| 966 | gPad->Update(); | 
|---|
| 967 |  | 
|---|
| 968 | c1->cd(2); | 
|---|
| 969 | fSlopes->Draw(); | 
|---|
| 970 | gPad->Modified(); | 
|---|
| 971 | gPad->Update(); | 
|---|
| 972 |  | 
|---|
| 973 | c1->cd(3); | 
|---|
| 974 | fOffvsSlope->Draw("col1"); | 
|---|
| 975 | gPad->Modified(); | 
|---|
| 976 | gPad->Update(); | 
|---|
| 977 | } | 
|---|
| 978 |  | 
|---|
| 979 | */ | 
|---|