| 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 09/2003 <mailto:markus@ifae.es>
|
|---|
| 19 | !
|
|---|
| 20 | ! Copyright: MAGIC Software Development, 2000-2001
|
|---|
| 21 | !
|
|---|
| 22 | !
|
|---|
| 23 | \* ======================================================================== */
|
|---|
| 24 |
|
|---|
| 25 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 26 | // //
|
|---|
| 27 | // MCalibrationCalc //
|
|---|
| 28 | // //
|
|---|
| 29 | // This is a task which calculates the number of photons from the FADC //
|
|---|
| 30 | // time slices. At the moment it integrates simply the FADC values. //
|
|---|
| 31 | // //
|
|---|
| 32 | // Input Containers: //
|
|---|
| 33 | // MRawEvtData //
|
|---|
| 34 | // //
|
|---|
| 35 | // Output Containers: //
|
|---|
| 36 | // MCalibrationCam //
|
|---|
| 37 | // //
|
|---|
| 38 | // //
|
|---|
| 39 | // The class MCalibrationCam hold one entry of type MCalibrationPix for //
|
|---|
| 40 | // every pixel. It is filled in the following way: //
|
|---|
| 41 | // PreParocess: MalibrationCam::InitSize(577) is called which allocates //
|
|---|
| 42 | // memory in an TClonesArray of type MCalibrationPix and //
|
|---|
| 43 | // all pointers to NULL. //
|
|---|
| 44 | // //
|
|---|
| 45 | // Process: The NULL pointer is tested on every pixel via //
|
|---|
| 46 | // MalibrationCam::IsPixelUsed(npix). //
|
|---|
| 47 | // //
|
|---|
| 48 | // In case, IsPixelUsed returns NULL, //
|
|---|
| 49 | // MalibrationCam::AddPixel(npix) is invoked which creates a //
|
|---|
| 50 | // new MCalibrationPix(npix) in the npix's entry //
|
|---|
| 51 | // of the TClonesArray. //
|
|---|
| 52 | // //
|
|---|
| 53 | // Every MCalibrationPix holds a histogram class, //
|
|---|
| 54 | // MHCalibrationPixel which itself hold histograms of type: //
|
|---|
| 55 | // HCharge(npix) (distribution of summed FADC time slice entries)
|
|---|
| 56 | // HTime(npix) (distribution of position of maximum)
|
|---|
| 57 | // HChargevsN(npix) (distribution of charges vs. event number.
|
|---|
| 58 | //
|
|---|
| 59 | // PostProcess: All histograms HCharge(npix) are fitted to a Gaussian
|
|---|
| 60 | // All histograms HTime(npix) are fitted to a Gaussian
|
|---|
| 61 | // The histogram HBlindPixelCharge (blind pixel) is fitted to a single
|
|---|
| 62 | // PhE fit
|
|---|
| 63 | // The histogram HBlindPixelTime (blind pixel) is fitted to a Gaussian
|
|---|
| 64 | // The histograms of the PIN Diode are fitted to Gaussians
|
|---|
| 65 | //
|
|---|
| 66 | // Fits can be excluded via the commands:
|
|---|
| 67 | // MalibrationCam::SetSkipTimeFits() (skip all time fits)
|
|---|
| 68 | // MalibrationCam::SetSkipBlindPixelFits() (skip all blind pixel fits)
|
|---|
| 69 | // MalibrationCam::SetSkipPinDiodeFits() (skip all PIN Diode fits)
|
|---|
| 70 | //
|
|---|
| 71 | //////////////////////////////////////////////////////////////////////////////
|
|---|
| 72 |
|
|---|
| 73 | #include "MCalibrationCalc.h"
|
|---|
| 74 | #include "MCalibrationConfig.h"
|
|---|
| 75 | #include "MCalibrationFits.h"
|
|---|
| 76 |
|
|---|
| 77 | #include "MCalibrationCam.h"
|
|---|
| 78 | #include "MCalibrationPix.h"
|
|---|
| 79 | #include "MCalibrationBlindPix.h"
|
|---|
| 80 | #include "MCalibrationPINDiode.h"
|
|---|
| 81 |
|
|---|
| 82 | #include "MPedestalCam.h"
|
|---|
| 83 | #include "MPedestalPix.h"
|
|---|
| 84 |
|
|---|
| 85 | #include "MLog.h"
|
|---|
| 86 | #include "MLogManip.h"
|
|---|
| 87 |
|
|---|
| 88 | #include "MParList.h"
|
|---|
| 89 | #include "MH.h"
|
|---|
| 90 |
|
|---|
| 91 | #include "MRawRunHeader.h"
|
|---|
| 92 | #include "MRawEvtData.h" // MRawEvtData::GetNumPixels
|
|---|
| 93 | #include "MRawEvtPixelIter.h"
|
|---|
| 94 |
|
|---|
| 95 | #include "MExtractedSignalCam.h"
|
|---|
| 96 | #include "MExtractedSignalPix.h"
|
|---|
| 97 |
|
|---|
| 98 | #include "MTime.h"
|
|---|
| 99 | #include "TMath.h"
|
|---|
| 100 |
|
|---|
| 101 | ClassImp(MCalibrationCalc);
|
|---|
| 102 |
|
|---|
| 103 | using namespace std;
|
|---|
| 104 | // --------------------------------------------------------------------------
|
|---|
| 105 | //
|
|---|
| 106 | // Default constructor. b is the number of slices before the maximum slice,
|
|---|
| 107 | // a the number of slices behind the maximum slice which is taken as signal.
|
|---|
| 108 | //
|
|---|
| 109 | MCalibrationCalc::MCalibrationCalc(const char *name, const char *title)
|
|---|
| 110 | : fColor(kEBlue)
|
|---|
| 111 | {
|
|---|
| 112 |
|
|---|
| 113 | fName = name ? name : "MCalibrationCalc";
|
|---|
| 114 | fTitle = title ? title : "Task to calculate the calibration constants and MCalibrationCam ";
|
|---|
| 115 |
|
|---|
| 116 | AddToBranchList("MRawEvtData.fHiGainPixId");
|
|---|
| 117 | AddToBranchList("MRawEvtData.fLoGainPixId");
|
|---|
| 118 | AddToBranchList("MRawEvtData.fHiGainFadcSamples");
|
|---|
| 119 | AddToBranchList("MRawEvtData.fLoGainFadcSamples");
|
|---|
| 120 |
|
|---|
| 121 | SETBIT(fFlags, kUseTimeFits);
|
|---|
| 122 | SETBIT(fFlags, kUseBlindPixelFit);
|
|---|
| 123 | SETBIT(fFlags, kUsePinDiodeFit);
|
|---|
| 124 | }
|
|---|
| 125 |
|
|---|
| 126 | // --------------------------------------------------------------------------
|
|---|
| 127 | //
|
|---|
| 128 | // The PreProcess searches for the following input containers:
|
|---|
| 129 | // - MRawEvtData
|
|---|
| 130 | // - MPedestalCam
|
|---|
| 131 | //
|
|---|
| 132 | // The following output containers are also searched and created if
|
|---|
| 133 | // they were not found:
|
|---|
| 134 | //
|
|---|
| 135 | // - MHCalibrationBlindPixel
|
|---|
| 136 | // - MCalibrationCam
|
|---|
| 137 | // - MTime
|
|---|
| 138 | //
|
|---|
| 139 | Int_t MCalibrationCalc::PreProcess(MParList *pList)
|
|---|
| 140 | {
|
|---|
| 141 |
|
|---|
| 142 | fHistOverFlow = 0;
|
|---|
| 143 | fEvents = 0;
|
|---|
| 144 | fCosmics = 0;
|
|---|
| 145 |
|
|---|
| 146 | fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");
|
|---|
| 147 | if (!fRawEvt)
|
|---|
| 148 | {
|
|---|
| 149 | *fLog << dbginf << "MRawEvtData not found... aborting." << endl;
|
|---|
| 150 | return kFALSE;
|
|---|
| 151 | }
|
|---|
| 152 |
|
|---|
| 153 | const MRawRunHeader *runheader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
|
|---|
| 154 | if (!runheader)
|
|---|
| 155 | *fLog << warn << dbginf << "Warning - cannot check file type, MRawRunHeader not found." << endl;
|
|---|
| 156 | else
|
|---|
| 157 | if (runheader->GetRunType() == kRTMonteCarlo)
|
|---|
| 158 | {
|
|---|
| 159 | return kTRUE;
|
|---|
| 160 | }
|
|---|
| 161 |
|
|---|
| 162 | fCalibrations = (MCalibrationCam*)pList->FindCreateObj("MCalibrationCam");
|
|---|
| 163 | if (!fCalibrations)
|
|---|
| 164 | {
|
|---|
| 165 | *fLog << err << dbginf << "MCalibrationCam could not be created ... aborting." << endl;
|
|---|
| 166 | return kFALSE;
|
|---|
| 167 | }
|
|---|
| 168 |
|
|---|
| 169 |
|
|---|
| 170 | switch (fColor)
|
|---|
| 171 | {
|
|---|
| 172 | case kEBlue:
|
|---|
| 173 | fCalibrations->SetColor(MCalibrationCam::kECBlue);
|
|---|
| 174 | break;
|
|---|
| 175 | case kEGreen:
|
|---|
| 176 | fCalibrations->SetColor(MCalibrationCam::kECGreen);
|
|---|
| 177 | break;
|
|---|
| 178 | case kEUV:
|
|---|
| 179 | fCalibrations->SetColor(MCalibrationCam::kECUV);
|
|---|
| 180 | break;
|
|---|
| 181 | case kECT1:
|
|---|
| 182 | fCalibrations->SetColor(MCalibrationCam::kECCT1);
|
|---|
| 183 | break;
|
|---|
| 184 | default:
|
|---|
| 185 | fCalibrations->SetColor(MCalibrationCam::kECCT1);
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 | fPedestals = (MPedestalCam*)pList->FindObject("MPedestalCam");
|
|---|
| 189 | if (!fPedestals)
|
|---|
| 190 | {
|
|---|
| 191 | *fLog << err << dbginf << "Cannot find MPedestalCam ... aborting" << endl;
|
|---|
| 192 | return kFALSE;
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 |
|
|---|
| 196 | fSignals = (MExtractedSignalCam*)pList->FindObject("MExtractedSignalCam");
|
|---|
| 197 | if (!fSignals)
|
|---|
| 198 | {
|
|---|
| 199 | *fLog << err << dbginf << "Cannot find MExtractedSignalCam ... aborting" << endl;
|
|---|
| 200 | return kFALSE;
|
|---|
| 201 | }
|
|---|
| 202 |
|
|---|
| 203 | return kTRUE;
|
|---|
| 204 | }
|
|---|
| 205 |
|
|---|
| 206 |
|
|---|
| 207 | // --------------------------------------------------------------------------
|
|---|
| 208 | //
|
|---|
| 209 | // The ReInit searches for the following input containers:
|
|---|
| 210 | // - MRawRunHeader
|
|---|
| 211 | //
|
|---|
| 212 | Bool_t MCalibrationCalc::ReInit(MParList *pList )
|
|---|
| 213 | {
|
|---|
| 214 |
|
|---|
| 215 | fRunHeader = (MRawRunHeader*)pList->FindObject("MRawRunHeader");
|
|---|
| 216 | if (!fRunHeader)
|
|---|
| 217 | {
|
|---|
| 218 | *fLog << dbginf << "MRawRunHeader not found... aborting." << endl;
|
|---|
| 219 | return kFALSE;
|
|---|
| 220 | }
|
|---|
| 221 |
|
|---|
| 222 | // fNumHiGainSamples = fRunHeader->GetNumSamplesHiGain();
|
|---|
| 223 | // fNumLoGainSamples = fRunHeader->GetNumSamplesLoGain();
|
|---|
| 224 | fNumHiGainSamples = 6;
|
|---|
| 225 | fNumLoGainSamples = 6;
|
|---|
| 226 |
|
|---|
| 227 | //
|
|---|
| 228 | // FIXME: The next statement simply does not work:
|
|---|
| 229 | // fRawEvt->GetNumPixels() returns always 0
|
|---|
| 230 | // fCalibrations->InitSize(fRawEvt->GetNumPixels());
|
|---|
| 231 | //
|
|---|
| 232 |
|
|---|
| 233 | fCalibrations->InitSize(577);
|
|---|
| 234 |
|
|---|
| 235 | for (Int_t i=0;i<577;i++)
|
|---|
| 236 | {
|
|---|
| 237 | MCalibrationPix &pix = (*fCalibrations)[i];
|
|---|
| 238 | pix.DefinePixId(i);
|
|---|
| 239 | }
|
|---|
| 240 |
|
|---|
| 241 | return kTRUE;
|
|---|
| 242 |
|
|---|
| 243 | }
|
|---|
| 244 |
|
|---|
| 245 |
|
|---|
| 246 | // --------------------------------------------------------------------------
|
|---|
| 247 | //
|
|---|
| 248 | // Calculate the integral of the FADC time slices and store them as a new
|
|---|
| 249 | // pixel in the MCerPhotEvt container.
|
|---|
| 250 | //
|
|---|
| 251 | Int_t MCalibrationCalc::Process()
|
|---|
| 252 | {
|
|---|
| 253 |
|
|---|
| 254 | Int_t cosmicpix = 0;
|
|---|
| 255 |
|
|---|
| 256 | MCalibrationBlindPix &blindpixel = *(fCalibrations->GetBlindPixel());
|
|---|
| 257 | MCalibrationPINDiode &pindiode = *(fCalibrations->GetPINDiode());
|
|---|
| 258 |
|
|---|
| 259 | MRawEvtPixelIter pixel(fRawEvt);
|
|---|
| 260 |
|
|---|
| 261 | //
|
|---|
| 262 | // Create a first loop to sort out the cosmics ...
|
|---|
| 263 | //
|
|---|
| 264 | // This is a very primitive check for the number of cosmicpixs
|
|---|
| 265 | // The cut will be applied in the fit, but for the blind pixel,
|
|---|
| 266 | // we need to remove this event
|
|---|
| 267 | //
|
|---|
| 268 | // FIXME: In the future need a much more sophisticated one!!!
|
|---|
| 269 | //
|
|---|
| 270 |
|
|---|
| 271 | while (pixel.Next())
|
|---|
| 272 | {
|
|---|
| 273 |
|
|---|
| 274 | const UInt_t pixid = pixel.GetPixelId();
|
|---|
| 275 |
|
|---|
| 276 | MExtractedSignalPix &sig = (*fSignals)[pixid];
|
|---|
| 277 | MPedestalPix &ped = (*fPedestals)[pixid];
|
|---|
| 278 | Float_t pedrms = ped.GetPedestalRms();
|
|---|
| 279 | Float_t sumhi = sig.GetExtractedSignalHiGain();
|
|---|
| 280 |
|
|---|
| 281 | if (sumhi < 15.*pedrms ) // cut at 3.5 sigma
|
|---|
| 282 | cosmicpix++;
|
|---|
| 283 | }
|
|---|
| 284 |
|
|---|
| 285 | if (cosmicpix > 100.)
|
|---|
| 286 | {
|
|---|
| 287 | fCosmics++;
|
|---|
| 288 | return kCONTINUE;
|
|---|
| 289 | }
|
|---|
| 290 |
|
|---|
| 291 | pixel.Reset();
|
|---|
| 292 | fEvents++;
|
|---|
| 293 |
|
|---|
| 294 | //
|
|---|
| 295 | // Create a second loop to do fill the calibration histograms
|
|---|
| 296 | //
|
|---|
| 297 |
|
|---|
| 298 | while (pixel.Next())
|
|---|
| 299 | {
|
|---|
| 300 |
|
|---|
| 301 | const UInt_t pixid = pixel.GetPixelId();
|
|---|
| 302 |
|
|---|
| 303 | MExtractedSignalPix &sig = (*fSignals)[pixid];
|
|---|
| 304 |
|
|---|
| 305 | Float_t sumhi = sig.GetExtractedSignalHiGain();
|
|---|
| 306 | Float_t sumlo = sig.GetExtractedSignalLoGain();
|
|---|
| 307 | Bool_t logain = sig.IsLoGainUsed();
|
|---|
| 308 |
|
|---|
| 309 | Float_t mtime = sig.GetMeanArrivalTime();
|
|---|
| 310 |
|
|---|
| 311 | MCalibrationPix &pix = (*fCalibrations)[pixid];
|
|---|
| 312 |
|
|---|
| 313 | switch(pixid)
|
|---|
| 314 | {
|
|---|
| 315 |
|
|---|
| 316 | case gkCalibrationBlindPixelId:
|
|---|
| 317 |
|
|---|
| 318 | if (!blindpixel.FillCharge(sumhi))
|
|---|
| 319 | *fLog << warn <<
|
|---|
| 320 | "Overflow or Underflow occurred filling Blind Pixel sum = " << sumhi << endl;
|
|---|
| 321 |
|
|---|
| 322 | if (!blindpixel.FillTime((int)mtime))
|
|---|
| 323 | *fLog << warn <<
|
|---|
| 324 | "Overflow or Underflow occurred filling Blind Pixel time = " << mtime << endl;
|
|---|
| 325 |
|
|---|
| 326 | if (!blindpixel.FillRChargevsTime(sumhi,fEvents))
|
|---|
| 327 | *fLog << warn <<
|
|---|
| 328 | "Overflow or Underflow occurred filling Blind Pixel eventnr = " << fEvents << endl;
|
|---|
| 329 | break;
|
|---|
| 330 |
|
|---|
| 331 | case gkCalibrationPINDiodeId:
|
|---|
| 332 | if (!pindiode.FillCharge(sumhi))
|
|---|
| 333 | *fLog << warn <<
|
|---|
| 334 | "Overflow or Underflow occurred filling HCharge: means = " << sumhi << endl;
|
|---|
| 335 | if (!pindiode.FillTime((int)mtime))
|
|---|
| 336 | *fLog << warn <<
|
|---|
| 337 | "Overflow or Underflow occurred filling HTime: time = " << mtime << endl;
|
|---|
| 338 | if (!pindiode.FillRChargevsTime(sumhi,fEvents))
|
|---|
| 339 | *fLog << warn <<
|
|---|
| 340 | "Overflow or Underflow occurred filling HChargevsN: eventnr = " << fEvents << endl;
|
|---|
| 341 | break;
|
|---|
| 342 |
|
|---|
| 343 | default:
|
|---|
| 344 |
|
|---|
| 345 | pix.SetChargesInGraph(sumhi,sumlo);
|
|---|
| 346 |
|
|---|
| 347 | if (!pix.FillRChargevsTimeLoGain(sumlo,fEvents))
|
|---|
| 348 | *fLog << warn << "Could not fill Lo Gain Charge vs. EvtNr of pixel: "
|
|---|
| 349 | << pixid << " signal = " << sumlo << " event Nr: " << fEvents << endl;
|
|---|
| 350 |
|
|---|
| 351 | if (!pix.FillRChargevsTimeHiGain(sumhi,fEvents))
|
|---|
| 352 | *fLog << warn << "Could not fill Hi Gain Charge vs. EvtNr of pixel: "
|
|---|
| 353 | << pixid << " signal = " << sumhi << " event Nr: " << fEvents << endl;
|
|---|
| 354 |
|
|---|
| 355 | if (logain)
|
|---|
| 356 | {
|
|---|
| 357 |
|
|---|
| 358 | if (!pix.FillChargeLoGain(sumlo))
|
|---|
| 359 | *fLog << warn << "Could not fill Lo Gain Charge of pixel: " << pixid
|
|---|
| 360 | << " signal = " << sumlo << endl;
|
|---|
| 361 |
|
|---|
| 362 | if (!pix.FillTimeLoGain((int)mtime))
|
|---|
| 363 | *fLog << warn << "Could not fill Lo Gain Time of pixel: "
|
|---|
| 364 | << pixid << " time = " << mtime << endl;
|
|---|
| 365 |
|
|---|
| 366 | }
|
|---|
| 367 | else
|
|---|
| 368 | {
|
|---|
| 369 | if (!pix.FillChargeHiGain(sumhi))
|
|---|
| 370 | *fLog << warn << "Could not fill Hi Gain Charge of pixel: " << pixid
|
|---|
| 371 | << " signal = " << sumhi << endl;
|
|---|
| 372 |
|
|---|
| 373 | if (!pix.FillTimeHiGain((int)mtime))
|
|---|
| 374 | *fLog << warn << "Could not fill Hi Gain Time of pixel: "
|
|---|
| 375 | << pixid << " time = " << mtime << endl;
|
|---|
| 376 |
|
|---|
| 377 | }
|
|---|
| 378 | break;
|
|---|
| 379 |
|
|---|
| 380 | } /* switch(pixid) */
|
|---|
| 381 |
|
|---|
| 382 | } /* while (pixel.Next()) */
|
|---|
| 383 |
|
|---|
| 384 | return kTRUE;
|
|---|
| 385 | }
|
|---|
| 386 |
|
|---|
| 387 | Int_t MCalibrationCalc::PostProcess()
|
|---|
| 388 | {
|
|---|
| 389 |
|
|---|
| 390 |
|
|---|
| 391 | *fLog << inf << endl;
|
|---|
| 392 | *fLog << GetDescriptor() << " Cut Histogram Edges" << endl;
|
|---|
| 393 |
|
|---|
| 394 | //
|
|---|
| 395 | // Cut edges to make fits and viewing of the hists easier
|
|---|
| 396 | //
|
|---|
| 397 | fCalibrations->CutEdges();
|
|---|
| 398 |
|
|---|
| 399 | //
|
|---|
| 400 | // Get pointer to blind pixel
|
|---|
| 401 | //
|
|---|
| 402 | MCalibrationBlindPix &blindpixel = *(fCalibrations->GetBlindPixel());
|
|---|
| 403 |
|
|---|
| 404 | *fLog << GetDescriptor() << " Fitting the Blind Pixel" << endl;
|
|---|
| 405 |
|
|---|
| 406 | //
|
|---|
| 407 | // Fit the blind pixel
|
|---|
| 408 | //
|
|---|
| 409 | if (TESTBIT(fFlags,kUseBlindPixelFit))
|
|---|
| 410 | {
|
|---|
| 411 | if (blindpixel.FitCharge())
|
|---|
| 412 | {
|
|---|
| 413 | if (!fCalibrations->CalcNrPhotInnerPixel())
|
|---|
| 414 | *fLog << err << dbginf << "Could not calculate Number of photons from the blind pixel " << endl;
|
|---|
| 415 | }
|
|---|
| 416 | else
|
|---|
| 417 | {
|
|---|
| 418 | *fLog << err << dbginf << "Could not fit the blind pixel " << endl;
|
|---|
| 419 | }
|
|---|
| 420 |
|
|---|
| 421 | if (!blindpixel.FitTime())
|
|---|
| 422 | *fLog << warn << "Could not the Times of the blind pixel " << endl;
|
|---|
| 423 |
|
|---|
| 424 | blindpixel.Draw();
|
|---|
| 425 |
|
|---|
| 426 | }
|
|---|
| 427 |
|
|---|
| 428 | *fLog << GetDescriptor() << " Fitting the Normal Pixels" << endl;
|
|---|
| 429 |
|
|---|
| 430 | //
|
|---|
| 431 | // loop over the pedestal events and check if we have calibration
|
|---|
| 432 | //
|
|---|
| 433 | for (Int_t pixid=0; pixid<fPedestals->GetSize(); pixid++)
|
|---|
| 434 | {
|
|---|
| 435 |
|
|---|
| 436 | MCalibrationPix &pix = (*fCalibrations)[pixid];
|
|---|
| 437 |
|
|---|
| 438 | const Float_t ped = (*fPedestals)[pixid].GetPedestal() * fNumHiGainSamples;
|
|---|
| 439 | const Float_t prms = (*fPedestals)[pixid].GetPedestalRms() * TMath::Sqrt((float)fNumHiGainSamples);
|
|---|
| 440 |
|
|---|
| 441 | pix.SetPedestal(ped,prms);
|
|---|
| 442 |
|
|---|
| 443 | pix.FitCharge();
|
|---|
| 444 |
|
|---|
| 445 | if (TESTBIT(fFlags,kUseTimeFits))
|
|---|
| 446 | pix.FitTime();
|
|---|
| 447 |
|
|---|
| 448 | }
|
|---|
| 449 |
|
|---|
| 450 | fCalibrations->SetReadyToSave();
|
|---|
| 451 |
|
|---|
| 452 | if (GetNumExecutions()==0)
|
|---|
| 453 | return kTRUE;
|
|---|
| 454 |
|
|---|
| 455 | *fLog << endl;
|
|---|
| 456 | *fLog << dec << setfill(' ') << fCosmics << " Events presumably cosmics" << endl;
|
|---|
| 457 |
|
|---|
| 458 | return kTRUE;
|
|---|
| 459 | }
|
|---|