| 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-2001
|
|---|
| 22 | !
|
|---|
| 23 | !
|
|---|
| 24 | \* ======================================================================== */
|
|---|
| 25 |
|
|---|
| 26 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 27 | //
|
|---|
| 28 | // MCalibrationCam
|
|---|
| 29 | //
|
|---|
| 30 | // Hold the whole Calibration results of the camera:
|
|---|
| 31 | //
|
|---|
| 32 | // 1) MCalibrationCam initializes a TClonesArray whose elements are
|
|---|
| 33 | // pointers to MCalibrationPix Containers
|
|---|
| 34 | // 2) It initializes a pointer to an MCalibrationBlindPix container
|
|---|
| 35 | // 3) It initializes a pointer to an MCalibrationPINDiode container
|
|---|
| 36 | //
|
|---|
| 37 | // 4)
|
|---|
| 38 | //
|
|---|
| 39 | /////////////////////////////////////////////////////////////////////////////
|
|---|
| 40 | #include "MCalibrationCam.h"
|
|---|
| 41 | #include "MCalibrationPix.h"
|
|---|
| 42 | #include "MHCalibrationPixel.h"
|
|---|
| 43 | #include "MCalibrationBlindPix.h"
|
|---|
| 44 | #include "MCalibrationConfig.h"
|
|---|
| 45 |
|
|---|
| 46 | #include <TClonesArray.h>
|
|---|
| 47 |
|
|---|
| 48 | #include "MLog.h"
|
|---|
| 49 | #include "MLogManip.h"
|
|---|
| 50 |
|
|---|
| 51 | #include "TCanvas.h"
|
|---|
| 52 |
|
|---|
| 53 | #include "MGeomCam.h"
|
|---|
| 54 |
|
|---|
| 55 | ClassImp(MCalibrationCam);
|
|---|
| 56 |
|
|---|
| 57 | using namespace std;
|
|---|
| 58 | // --------------------------------------------------------------------------
|
|---|
| 59 | //
|
|---|
| 60 | // Default constructor.
|
|---|
| 61 | //
|
|---|
| 62 | // Creates a TClonesArray of MCalibrationPix containers, initialized to 1 entry
|
|---|
| 63 | // Later, a call to MCalibrationCam::InitSize(Int_t size) has to be performed
|
|---|
| 64 | //
|
|---|
| 65 | // Creates an MCalibrationBlindPix container
|
|---|
| 66 | // Creates an MCalibrationPINDiode container
|
|---|
| 67 | //
|
|---|
| 68 | MCalibrationCam::MCalibrationCam(const char *name, const char *title)
|
|---|
| 69 | : fNumPhotInsidePlexiglassAvailable(kFALSE),
|
|---|
| 70 | fMeanPhotInsidePlexiglass(-1.),
|
|---|
| 71 | fMeanPhotErrInsidePlexiglass(-1.),
|
|---|
| 72 | fNumPhotOutsidePlexiglassAvailable(kFALSE),
|
|---|
| 73 | fMeanPhotOutsidePlexiglass(-1.),
|
|---|
| 74 | fMeanPhotErrOutsidePlexiglass(-1.),
|
|---|
| 75 | fOffsets(NULL),
|
|---|
| 76 | fSlopes(NULL),
|
|---|
| 77 | fOffvsSlope(NULL)
|
|---|
| 78 | {
|
|---|
| 79 | fName = name ? name : "MCalibrationCam";
|
|---|
| 80 | fTitle = title ? title : "Storage container for the Calibration Information in the camera";
|
|---|
| 81 |
|
|---|
| 82 | fPixels = new TClonesArray("MCalibrationPix",1);
|
|---|
| 83 | fBlindPixel = new MCalibrationBlindPix();
|
|---|
| 84 | fPINDiode = new MCalibrationPINDiode();
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | // --------------------------------------------------------------------------
|
|---|
| 88 | //
|
|---|
| 89 | // Delete the TClonesArray of MCalibrationPix containers
|
|---|
| 90 | // Delete the MCalibrationPINDiode and the MCalibrationBlindPix
|
|---|
| 91 | //
|
|---|
| 92 | // Delete the histograms if they exist
|
|---|
| 93 | //
|
|---|
| 94 | MCalibrationCam::~MCalibrationCam()
|
|---|
| 95 | {
|
|---|
| 96 |
|
|---|
| 97 | //
|
|---|
| 98 | // delete fPixels should delete all Objects stored inside
|
|---|
| 99 | //
|
|---|
| 100 | delete fPixels;
|
|---|
| 101 | delete fBlindPixel;
|
|---|
| 102 | delete fPINDiode;
|
|---|
| 103 |
|
|---|
| 104 | if (fOffsets)
|
|---|
| 105 | delete fOffsets;
|
|---|
| 106 | if (fSlopes)
|
|---|
| 107 | delete fSlopes;
|
|---|
| 108 | if (fOffvsSlope)
|
|---|
| 109 | delete fOffvsSlope;
|
|---|
| 110 |
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| 113 | // -------------------------------------------------------------------
|
|---|
| 114 | //
|
|---|
| 115 | // This function simply allocates memory via the ROOT command:
|
|---|
| 116 | // (TObject**) TStorage::ReAlloc(fCont, newSize * sizeof(TObject*),
|
|---|
| 117 | // fSize * sizeof(TObject*));
|
|---|
| 118 | // newSize corresponds to size in our case
|
|---|
| 119 | // fSize is the old size (in most cases: 1)
|
|---|
| 120 | //
|
|---|
| 121 | void MCalibrationCam::InitSize(Int_t size)
|
|---|
| 122 | {
|
|---|
| 123 |
|
|---|
| 124 | //
|
|---|
| 125 | // check if we have already initialized to size
|
|---|
| 126 | //
|
|---|
| 127 | if (CheckBounds(size))
|
|---|
| 128 | return;
|
|---|
| 129 |
|
|---|
| 130 | fPixels->ExpandCreate(size);
|
|---|
| 131 |
|
|---|
| 132 | }
|
|---|
| 133 |
|
|---|
| 134 | // --------------------------------------------------------------------------
|
|---|
| 135 | //
|
|---|
| 136 | // This function returns the current size of the TClonesArray
|
|---|
| 137 | // independently if the MCalibrationPix is filled with values or not.
|
|---|
| 138 | //
|
|---|
| 139 | // It is the size of the array fPixels.
|
|---|
| 140 | //
|
|---|
| 141 | Int_t MCalibrationCam::GetSize() const
|
|---|
| 142 | {
|
|---|
| 143 | return fPixels->GetEntriesFast();
|
|---|
| 144 | }
|
|---|
| 145 |
|
|---|
| 146 | // --------------------------------------------------------------------------
|
|---|
| 147 | //
|
|---|
| 148 | // Check if position i is inside the current bounds of the TClonesArray
|
|---|
| 149 | //
|
|---|
| 150 | Bool_t MCalibrationCam::CheckBounds(Int_t i) const
|
|---|
| 151 | {
|
|---|
| 152 | return i < fPixels->GetEntriesFast();
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 |
|
|---|
| 156 | // --------------------------------------------------------------------------
|
|---|
| 157 | //
|
|---|
| 158 | // Get i-th pixel (pixel number)
|
|---|
| 159 | //
|
|---|
| 160 | MCalibrationPix &MCalibrationCam::operator[](Int_t i)
|
|---|
| 161 | {
|
|---|
| 162 |
|
|---|
| 163 | if (!CheckBounds(i))
|
|---|
| 164 | return *static_cast<MCalibrationPix*>(NULL);
|
|---|
| 165 |
|
|---|
| 166 | return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
|
|---|
| 167 | }
|
|---|
| 168 |
|
|---|
| 169 | // --------------------------------------------------------------------------
|
|---|
| 170 | //
|
|---|
| 171 | // Get i-th pixel (pixel number)
|
|---|
| 172 | //
|
|---|
| 173 | MCalibrationPix &MCalibrationCam::operator[](Int_t i) const
|
|---|
| 174 | {
|
|---|
| 175 | return *static_cast<MCalibrationPix*>(fPixels->UncheckedAt(i));
|
|---|
| 176 | }
|
|---|
| 177 |
|
|---|
| 178 | // --------------------------------------------------------------------------
|
|---|
| 179 | //
|
|---|
| 180 | // Return a pointer to the pixel with the requested idx.
|
|---|
| 181 | // NULL if it doesn't exist.
|
|---|
| 182 | //
|
|---|
| 183 | MCalibrationPix *MCalibrationCam::GetCalibrationPix(Int_t idx) const
|
|---|
| 184 | {
|
|---|
| 185 | if (idx<0)
|
|---|
| 186 | return NULL;
|
|---|
| 187 |
|
|---|
| 188 | if (!CheckBounds(idx))
|
|---|
| 189 | return NULL;
|
|---|
| 190 |
|
|---|
| 191 | return (MCalibrationPix*)fPixels->At(idx);
|
|---|
| 192 | }
|
|---|
| 193 |
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 |
|
|---|
| 197 | Bool_t MCalibrationCam::IsPixelUsed(Int_t idx) const
|
|---|
| 198 | {
|
|---|
| 199 | if (!CheckBounds(idx))
|
|---|
| 200 | return kFALSE;
|
|---|
| 201 |
|
|---|
| 202 | return kTRUE;
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | Bool_t MCalibrationCam::IsPixelFitted(Int_t idx) const
|
|---|
| 206 | {
|
|---|
| 207 | return ((*this)[idx].GetCharge() > 0. && (*this)[idx].GetErrCharge() > 0.);
|
|---|
| 208 | }
|
|---|
| 209 |
|
|---|
| 210 |
|
|---|
| 211 |
|
|---|
| 212 | void MCalibrationCam::Clear(Option_t *o)
|
|---|
| 213 | {
|
|---|
| 214 | fPixels->ForEach(TObject, Clear)();
|
|---|
| 215 | }
|
|---|
| 216 |
|
|---|
| 217 | void MCalibrationCam::CutEdges()
|
|---|
| 218 | {
|
|---|
| 219 |
|
|---|
| 220 | fBlindPixel->GetHist()->CutAllEdges();
|
|---|
| 221 |
|
|---|
| 222 | TIter Next(fPixels);
|
|---|
| 223 | MCalibrationPix *pix;
|
|---|
| 224 | while ((pix=(MCalibrationPix*)Next()))
|
|---|
| 225 | {
|
|---|
| 226 | pix->GetHist()->CutAllEdges();
|
|---|
| 227 | }
|
|---|
| 228 |
|
|---|
| 229 | return;
|
|---|
| 230 | }
|
|---|
| 231 |
|
|---|
| 232 | void MCalibrationCam::Print(Option_t *o) const
|
|---|
| 233 | {
|
|---|
| 234 | *fLog << all << GetDescriptor() << ":" << endl;
|
|---|
| 235 | int id = 0;
|
|---|
| 236 |
|
|---|
| 237 | *fLog << "Succesfully calibrated pixels:" << endl;
|
|---|
| 238 | *fLog << endl;
|
|---|
| 239 |
|
|---|
| 240 | TIter Next(fPixels);
|
|---|
| 241 | MCalibrationPix *pix;
|
|---|
| 242 | while ((pix=(MCalibrationPix*)Next()))
|
|---|
| 243 | {
|
|---|
| 244 |
|
|---|
| 245 | if (pix->GetCharge() >= 0.)
|
|---|
| 246 | {
|
|---|
| 247 | *fLog << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms()
|
|---|
| 248 | << " Reduced Charge: " << pix->GetCharge() << " +- "
|
|---|
| 249 | << pix->GetSigmaCharge() << " Reduced Sigma: " << TMath::Sqrt(pix->GetRSigmaSquare()) << endl;
|
|---|
| 250 | id++;
|
|---|
| 251 | }
|
|---|
| 252 | }
|
|---|
| 253 |
|
|---|
| 254 | *fLog << id << " succesful pixels :-))" << endl;
|
|---|
| 255 | id = 0;
|
|---|
| 256 |
|
|---|
| 257 | *fLog << endl;
|
|---|
| 258 | *fLog << "Pixels with errors:" << endl;
|
|---|
| 259 | *fLog << endl;
|
|---|
| 260 |
|
|---|
| 261 | TIter Next2(fPixels);
|
|---|
| 262 | while ((pix=(MCalibrationPix*)Next2()))
|
|---|
| 263 | {
|
|---|
| 264 |
|
|---|
| 265 | if (pix->GetCharge() == -1.)
|
|---|
| 266 | {
|
|---|
| 267 | *fLog << pix->GetPixId() << " Pedestals: " << pix->GetPed() << " +- " << pix->GetPedRms()
|
|---|
| 268 | << " Reduced Charge: " << pix->GetCharge() << " +- "
|
|---|
| 269 | << pix->GetSigmaCharge() << " Reduced Sigma: " << TMath::Sqrt(pix->GetRSigmaSquare()) << endl;
|
|---|
| 270 | id++;
|
|---|
| 271 | }
|
|---|
| 272 | }
|
|---|
| 273 | *fLog << id << " pixels with errors :-((" << endl;
|
|---|
| 274 |
|
|---|
| 275 | }
|
|---|
| 276 |
|
|---|
| 277 |
|
|---|
| 278 | Bool_t MCalibrationCam::GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type) const
|
|---|
| 279 | {
|
|---|
| 280 |
|
|---|
| 281 | if (idx > GetSize())
|
|---|
| 282 | return kFALSE;
|
|---|
| 283 |
|
|---|
| 284 | switch (type)
|
|---|
| 285 | {
|
|---|
| 286 | case 0:
|
|---|
| 287 | val = (*this)[idx].GetCharge();
|
|---|
| 288 | break;
|
|---|
| 289 | case 1:
|
|---|
| 290 | val = (*this)[idx].GetErrCharge();
|
|---|
| 291 | break;
|
|---|
| 292 | case 2:
|
|---|
| 293 | val = (*this)[idx].GetSigmaCharge();
|
|---|
| 294 | break;
|
|---|
| 295 | case 3:
|
|---|
| 296 | val = (*this)[idx].GetErrSigmaCharge();
|
|---|
| 297 | break;
|
|---|
| 298 | case 4:
|
|---|
| 299 | val = (*this)[idx].GetChargeProb();
|
|---|
| 300 | break;
|
|---|
| 301 | case 5:
|
|---|
| 302 | val = (*this)[idx].GetTime();
|
|---|
| 303 | break;
|
|---|
| 304 | case 6:
|
|---|
| 305 | val = (*this)[idx].GetSigmaTime();
|
|---|
| 306 | break;
|
|---|
| 307 | case 7:
|
|---|
| 308 | val = (*this)[idx].GetTimeChiSquare();
|
|---|
| 309 | break;
|
|---|
| 310 | case 8:
|
|---|
| 311 | val = (*this)[idx].GetPed();
|
|---|
| 312 | break;
|
|---|
| 313 | case 9:
|
|---|
| 314 | val = (*this)[idx].GetPedRms();
|
|---|
| 315 | break;
|
|---|
| 316 | case 10:
|
|---|
| 317 | if ((*this)[idx].GetRSigmaSquare() > 0.)
|
|---|
| 318 | val = TMath::Sqrt((*this)[idx].GetRSigmaSquare());
|
|---|
| 319 | else
|
|---|
| 320 | val = -1.;
|
|---|
| 321 | break;
|
|---|
| 322 | case 15:
|
|---|
| 323 | val = ((*this)[idx].GetSigmaCharge()/(*this)[idx].GetCharge())*
|
|---|
| 324 | ((*this)[idx].GetSigmaCharge()/(*this)[idx].GetCharge());
|
|---|
| 325 | break;
|
|---|
| 326 | case 11:
|
|---|
| 327 | val = (*this)[idx].GetPheFFactorMethod();
|
|---|
| 328 | break;
|
|---|
| 329 | case 12:
|
|---|
| 330 | val = (*this)[idx].GetMeanConversionFFactorMethod();
|
|---|
| 331 | break;
|
|---|
| 332 | case 13:
|
|---|
| 333 | if (idx < 397)
|
|---|
| 334 | val = (double)fMeanPhotInsidePlexiglass;
|
|---|
| 335 | else
|
|---|
| 336 | val = (double)fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea;
|
|---|
| 337 | break;
|
|---|
| 338 | case 14:
|
|---|
| 339 | if ((fMeanPhotInsidePlexiglass > 0. ) && ((*this)[idx].GetCharge() != -1.))
|
|---|
| 340 | {
|
|---|
| 341 | if (idx < 397)
|
|---|
| 342 | val = fMeanPhotInsidePlexiglass / (*this)[idx].GetCharge();
|
|---|
| 343 | else
|
|---|
| 344 | val = fMeanPhotInsidePlexiglass*gkCalibrationOutervsInnerPixelArea / (*this)[idx].GetCharge();
|
|---|
| 345 | }
|
|---|
| 346 | else
|
|---|
| 347 | {
|
|---|
| 348 | val = -1.;
|
|---|
| 349 | }
|
|---|
| 350 | break;
|
|---|
| 351 | default:
|
|---|
| 352 | return kFALSE;
|
|---|
| 353 | }
|
|---|
| 354 | return val>=0;
|
|---|
| 355 | }
|
|---|
| 356 |
|
|---|
| 357 | void MCalibrationCam::DrawPixelContent(Int_t idx) const
|
|---|
| 358 | {
|
|---|
| 359 |
|
|---|
| 360 | (*this)[idx].Draw();
|
|---|
| 361 |
|
|---|
| 362 | }
|
|---|
| 363 |
|
|---|
| 364 | Bool_t MCalibrationCam::CalcNumPhotInsidePlexiglass()
|
|---|
| 365 | {
|
|---|
| 366 |
|
|---|
| 367 | if (!fBlindPixel->IsFitOK())
|
|---|
| 368 | return kFALSE;
|
|---|
| 369 |
|
|---|
| 370 | const Float_t mean = fBlindPixel->GetLambda();
|
|---|
| 371 | const Float_t merr = fBlindPixel->GetErrLambda();
|
|---|
| 372 |
|
|---|
| 373 | switch (fColor)
|
|---|
| 374 | {
|
|---|
| 375 | case kECGreen:
|
|---|
| 376 | fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEGreen) // real photons
|
|---|
| 377 | *TMath::Power(10,gkCalibrationBlindPixelAttGreen) // correct for absorption
|
|---|
| 378 | * gkCalibrationInnerPixelArea; // correct for area
|
|---|
| 379 | break;
|
|---|
| 380 | case kECBlue:
|
|---|
| 381 | fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEBlue )
|
|---|
| 382 | *TMath::Power(10,gkCalibrationBlindPixelAttBlue)
|
|---|
| 383 | * gkCalibrationInnerPixelArea;
|
|---|
| 384 | break;
|
|---|
| 385 | case kECUV:
|
|---|
| 386 | fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQEUV )
|
|---|
| 387 | *TMath::Power(10,gkCalibrationBlindPixelAttUV)
|
|---|
| 388 | * gkCalibrationInnerPixelArea;
|
|---|
| 389 | break;
|
|---|
| 390 | case kECCT1:
|
|---|
| 391 | default:
|
|---|
| 392 | fMeanPhotInsidePlexiglass = (mean / gkCalibrationBlindPixelQECT1 )
|
|---|
| 393 | *TMath::Power(10,gkCalibrationBlindPixelAttCT1)
|
|---|
| 394 | * gkCalibrationInnerPixelArea;
|
|---|
| 395 | break;
|
|---|
| 396 | }
|
|---|
| 397 |
|
|---|
| 398 | fNumPhotInsidePlexiglassAvailable = kTRUE;
|
|---|
| 399 |
|
|---|
| 400 | TIter Next(fPixels);
|
|---|
| 401 | MCalibrationPix *pix;
|
|---|
| 402 | while ((pix=(MCalibrationPix*)Next()))
|
|---|
| 403 | {
|
|---|
| 404 |
|
|---|
| 405 | if((pix->GetCharge() > 0.) && (fMeanPhotInsidePlexiglass > 0.))
|
|---|
| 406 | pix->SetConversionBlindPixelMethod(fMeanPhotInsidePlexiglass/pix->GetCharge(), 0., 0.);
|
|---|
| 407 | }
|
|---|
| 408 | return kTRUE;
|
|---|
| 409 | }
|
|---|
| 410 |
|
|---|
| 411 |
|
|---|
| 412 | Bool_t MCalibrationCam::CalcNumPhotOutsidePlexiglass()
|
|---|
| 413 | {
|
|---|
| 414 |
|
|---|
| 415 | if (!fPINDiode->IsFitOK())
|
|---|
| 416 | return kFALSE;
|
|---|
| 417 |
|
|---|
| 418 | const Float_t mean = fPINDiode->GetMean();
|
|---|
| 419 | const Float_t merr = fPINDiode->GetMeanError();
|
|---|
| 420 |
|
|---|
| 421 | switch (fColor)
|
|---|
| 422 | {
|
|---|
| 423 | case kECGreen:
|
|---|
| 424 | fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEGreen) // real photons
|
|---|
| 425 | * gkCalibrationInnerPixelvsPINDiodeArea; // correct for area
|
|---|
| 426 | break;
|
|---|
| 427 | case kECBlue:
|
|---|
| 428 | fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEBlue )
|
|---|
| 429 | * gkCalibrationInnerPixelvsPINDiodeArea;
|
|---|
| 430 | break;
|
|---|
| 431 | case kECUV:
|
|---|
| 432 | fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQEUV )
|
|---|
| 433 | * gkCalibrationInnerPixelvsPINDiodeArea;
|
|---|
| 434 | break;
|
|---|
| 435 | case kECCT1:
|
|---|
| 436 | default:
|
|---|
| 437 | fMeanPhotOutsidePlexiglass = (mean / gkCalibrationPINDiodeQECT1 )
|
|---|
| 438 | * gkCalibrationInnerPixelvsPINDiodeArea;
|
|---|
| 439 | break;
|
|---|
| 440 | }
|
|---|
| 441 |
|
|---|
| 442 | fNumPhotOutsidePlexiglassAvailable = kTRUE;
|
|---|
| 443 |
|
|---|
| 444 | TIter Next(fPixels);
|
|---|
| 445 | MCalibrationPix *pix;
|
|---|
| 446 | while ((pix=(MCalibrationPix*)Next()))
|
|---|
| 447 | {
|
|---|
| 448 |
|
|---|
| 449 | if((pix->GetCharge() > 0.) && (fMeanPhotInsidePlexiglass > 0.))
|
|---|
| 450 | pix->SetConversionPINDiodeMethod(fMeanPhotOutsidePlexiglass/pix->GetCharge(), 0., 0.);
|
|---|
| 451 | }
|
|---|
| 452 | return kTRUE;
|
|---|
| 453 | }
|
|---|
| 454 |
|
|---|
| 455 |
|
|---|
| 456 |
|
|---|
| 457 | Bool_t MCalibrationCam::GetConversionFactorBlindPixel(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
|---|
| 458 | {
|
|---|
| 459 |
|
|---|
| 460 | if (ipx < 0 || !IsPixelFitted(ipx))
|
|---|
| 461 | return kFALSE;
|
|---|
| 462 |
|
|---|
| 463 | if (!fNumPhotInsidePlexiglassAvailable)
|
|---|
| 464 | if (!CalcNumPhotInsidePlexiglass())
|
|---|
| 465 | return kFALSE;
|
|---|
| 466 |
|
|---|
| 467 | mean = (*this)[ipx].GetMeanConversionBlindPixelMethod();
|
|---|
| 468 | err = (*this)[ipx].GetErrorConversionBlindPixelMethod();
|
|---|
| 469 | sigma = (*this)[ipx].GetSigmaConversionBlindPixelMethod();
|
|---|
| 470 |
|
|---|
| 471 | return kTRUE;
|
|---|
| 472 | }
|
|---|
| 473 |
|
|---|
| 474 |
|
|---|
| 475 | Bool_t MCalibrationCam::GetConversionFactorFFactor(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
|---|
| 476 | {
|
|---|
| 477 |
|
|---|
| 478 | if (ipx < 0 || !IsPixelFitted(ipx))
|
|---|
| 479 | return kFALSE;
|
|---|
| 480 |
|
|---|
| 481 | Float_t conv = (*this)[ipx].GetMeanConversionFFactorMethod();
|
|---|
| 482 |
|
|---|
| 483 | if (conv < 0.)
|
|---|
| 484 | return kFALSE;
|
|---|
| 485 |
|
|---|
| 486 | mean = conv;
|
|---|
| 487 | err = (*this)[ipx].GetErrorConversionFFactorMethod();
|
|---|
| 488 | sigma = (*this)[ipx].GetSigmaConversionFFactorMethod();
|
|---|
| 489 |
|
|---|
| 490 | return kTRUE;
|
|---|
| 491 | }
|
|---|
| 492 |
|
|---|
| 493 |
|
|---|
| 494 | //-----------------------------------------------------------------------------------
|
|---|
| 495 | //
|
|---|
| 496 | // Calculates the conversion factor between the integral of FADCs slices
|
|---|
| 497 | // (as defined in the signal extractor MExtractSignal.cc)
|
|---|
| 498 | // and the number of photons reaching the plexiglass for one Inner Pixel
|
|---|
| 499 | //
|
|---|
| 500 | // FIXME: The PINDiode is still not working and so is the code
|
|---|
| 501 | //
|
|---|
| 502 | Bool_t MCalibrationCam::GetConversionFactorPINDiode(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
|---|
| 503 | {
|
|---|
| 504 |
|
|---|
| 505 | if (ipx < 0 || !IsPixelFitted(ipx))
|
|---|
| 506 | return kFALSE;
|
|---|
| 507 |
|
|---|
| 508 | return kFALSE;
|
|---|
| 509 |
|
|---|
| 510 | }
|
|---|
| 511 |
|
|---|
| 512 | //-----------------------------------------------------------------------------------
|
|---|
| 513 | //
|
|---|
| 514 | // Calculates the best combination of the three used methods possible
|
|---|
| 515 | // between the integral of FADCs slices
|
|---|
| 516 | // (as defined in the signal extractor MExtractSignal.cc)
|
|---|
| 517 | // and the number of photons reaching one Inner Pixel.
|
|---|
| 518 | // The procedure is not yet defined.
|
|---|
| 519 | //
|
|---|
| 520 | // FIXME: The PINDiode is still not working and so is the code
|
|---|
| 521 | //
|
|---|
| 522 | Bool_t MCalibrationCam::GetConversionFactorCombined(Int_t ipx, Float_t &mean, Float_t &err, Float_t &sigma)
|
|---|
| 523 | {
|
|---|
| 524 |
|
|---|
| 525 | if (ipx < 0 || !IsPixelFitted(ipx))
|
|---|
| 526 | return kFALSE;
|
|---|
| 527 |
|
|---|
| 528 | return kFALSE;
|
|---|
| 529 |
|
|---|
| 530 | }
|
|---|
| 531 |
|
|---|
| 532 |
|
|---|
| 533 | void MCalibrationCam::DrawHiLoFits()
|
|---|
| 534 | {
|
|---|
| 535 |
|
|---|
| 536 | if (!fOffsets)
|
|---|
| 537 | fOffsets = new TH1D("pp","Offsets of the HiGain LoGain Fit",100,-600.,400.);
|
|---|
| 538 | if (!fSlopes)
|
|---|
| 539 | fSlopes = new TH1D("mm","Slopes of the HiGain LoGain Fit",100,-2.,2.);
|
|---|
| 540 | if (!fOffvsSlope)
|
|---|
| 541 | fOffvsSlope = new TH2D("aa","Slopes vs Offsets of the HiGain LoGain Fit",100,-600.,400.,100,-2.,2.);
|
|---|
| 542 |
|
|---|
| 543 | TIter Next(fPixels);
|
|---|
| 544 | MCalibrationPix *pix;
|
|---|
| 545 | MHCalibrationPixel *hist;
|
|---|
| 546 | while ((pix=(MCalibrationPix*)Next()))
|
|---|
| 547 | {
|
|---|
| 548 | hist = pix->GetHist();
|
|---|
| 549 | hist->FitHiGainvsLoGain();
|
|---|
| 550 | fOffsets->Fill(hist->GetOffset(),1.);
|
|---|
| 551 | fSlopes->Fill(hist->GetSlope(),1.);
|
|---|
| 552 | fOffvsSlope->Fill(hist->GetOffset(),hist->GetSlope(),1.);
|
|---|
| 553 | }
|
|---|
| 554 |
|
|---|
| 555 | TCanvas *c1 = new TCanvas();
|
|---|
| 556 |
|
|---|
| 557 | c1->Divide(1,3);
|
|---|
| 558 | c1->cd(1);
|
|---|
| 559 | fOffsets->Draw();
|
|---|
| 560 | gPad->Modified();
|
|---|
| 561 | gPad->Update();
|
|---|
| 562 |
|
|---|
| 563 | c1->cd(2);
|
|---|
| 564 | fSlopes->Draw();
|
|---|
| 565 | gPad->Modified();
|
|---|
| 566 | gPad->Update();
|
|---|
| 567 |
|
|---|
| 568 | c1->cd(3);
|
|---|
| 569 | fOffvsSlope->Draw("col1");
|
|---|
| 570 | gPad->Modified();
|
|---|
| 571 | gPad->Update();
|
|---|
| 572 | }
|
|---|
| 573 |
|
|---|