Changeset 5946 for trunk/MagicSoft/Mars/mhcalib
- Timestamp:
- 01/23/05 13:49:09 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mhcalib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhcalib/MHCalibrationHiLoCam.cc
r5864 r5946 95 95 #include "MExtractedSignalCam.h" 96 96 #include "MExtractedSignalPix.h" 97 98 #include "M RawEvtPixelIter.h"97 #include "MArrivalTimeCam.h" 98 #include "MArrivalTimePix.h" 99 99 100 100 #include "MGeomCam.h" … … 128 128 const TString MHCalibrationHiLoCam::gsHistXTitle = "Amplification Ratio [1]"; 129 129 const TString MHCalibrationHiLoCam::gsHistYTitle = "Nr. events"; 130 const Byte_t MHCalibrationHiLoCam::fgLowerLim = 200;131 const Byte_t MHCalibrationHiLoCam::fgUpperLim = 252;132 130 // -------------------------------------------------------------------------- 133 131 // … … 164 162 SetHistYTitle(gsHistYTitle.Data()); 165 163 166 SetLowerLim();167 SetUpperLim();168 164 } 169 165 … … 207 203 208 204 const Int_t navhi = fAverageHiGainAreas->GetSize(); 205 const Int_t navlo = fAverageLoGainAreas->GetSize(); 209 206 210 207 for (int i=0; i<navhi; i++) 211 208 cam->fAverageHiGainAreas->AddAt(GetAverageHiGainArea(i).Clone(),i); 212 209 210 for (int i=0; i<navlo; i++) 211 cam->fAverageLoGainAreas->AddAt(GetAverageLoGainArea(i).Clone(),i); 212 213 213 return cam; 214 }215 216 // --------------------------------------------------------------------------217 //218 // Gets the pointers to:219 // - MRawEvtData220 //221 Bool_t MHCalibrationHiLoCam::SetupHists(const MParList *pList)222 {223 224 fRawEvt = (MRawEvtData*)pList->FindObject("MRawEvtData");225 if (!fRawEvt)226 {227 *fLog << err << dbginf << "MRawEvtData not found... aborting." << endl;228 return kFALSE;229 }230 231 return kTRUE;232 214 } 233 215 … … 239 221 // Searches pointer to: 240 222 // - MExtractedSignalCam 223 // - MArrivalTimeCam 241 224 // 242 225 // Calls: 243 226 // - MHCalibrationCam::InitHiGainArrays() 227 // - MHCalibrationCam::InitLoGainArrays() 244 228 // 245 229 // Sets: 246 // - SetLoGain(kFALSE);247 230 // - fSumarea to nareas 248 231 // - fSumsector to nareas … … 263 246 } 264 247 248 MArrivalTimeCam *times = (MArrivalTimeCam*)pList->FindObject("MArrivalTimeCam"); 249 if (!times) 250 { 251 *fLog << warn << "MArrivalTimeCam not found... cannot calibrated arrival times between " 252 <<"high and low-gain" << endl; 253 SetLoGain(kFALSE); 254 } 255 265 256 const Int_t npixels = fGeom->GetNumPixels(); 266 257 const Int_t nsectors = fGeom->GetNumSectors(); … … 268 259 269 260 InitHiGainArrays(npixels,nareas,nsectors); 270 271 fSumarea .Set(nareas); 272 fSumsector.Set(nsectors); 273 fNumarea .Set(nareas); 274 fNumsector.Set(nsectors); 275 276 SetLoGain(kFALSE); 277 261 InitLoGainArrays(npixels,nareas,nsectors); 262 263 fSumareahi .Set(nareas); 264 fSumsectorhi.Set(nsectors); 265 fNumareahi .Set(nareas); 266 fNumsectorhi.Set(nsectors); 267 if (IsLoGain()) 268 { 269 fSumarealo .Set(nareas); 270 fSumsectorlo.Set(nsectors); 271 fNumarealo .Set(nareas); 272 fNumsectorlo.Set(nsectors); 273 } 278 274 return kTRUE; 279 275 } … … 290 286 // Fills histograms (MHGausEvents::FillHistAndArray()) with: 291 287 // - MExtractedSignalPix::GetExtractedSignalHiGain(pixid) / MExtractedSignalPix::GetExtractedSignalLoGain; 292 // if the high-gain signal lies in between the limits: fLowerLim and fUpperLim 288 // if the high-gain signal does not show high-gain saturation, but the low-gain 289 // has been extracted. 290 // - MArrivalTimePix::GetArrivalTimeHiGain(pixid) / MArrivalTimePix::GetArrivalTimeLoGain; 291 // if the high-gain signal does not show high-gain saturation, but the low-gain 292 // has been extracted. 293 293 // 294 294 Bool_t MHCalibrationHiLoCam::FillHists(const MParContainer *par, const Stat_t w) … … 302 302 } 303 303 304 MArrivalTimeCam *times = (MArrivalTimeCam*)par; 305 306 const Int_t npixels = fGeom->GetNumPixels(); 304 307 const Int_t nareas = fGeom->GetNumAreas(); 305 308 const Int_t nsectors = fGeom->GetNumSectors(); 306 309 307 fSumarea .Reset(); 308 fSumsector.Reset(); 309 fNumarea .Reset(); 310 fNumsector.Reset(); 311 312 MRawEvtPixelIter pixel(fRawEvt); 313 314 while (pixel.Next()) 315 { 316 317 const Byte_t max = pixel.GetMaxHiGainSample(); 318 319 if (max < fLowerLim || max > fUpperLim) 320 continue; 321 322 const UInt_t pixidx = pixel.GetPixelId(); 323 324 MHCalibrationPix &hist = (*this)[pixidx]; 325 326 if (hist.IsExcluded()) 310 fSumareahi .Reset(); 311 fSumsectorhi.Reset(); 312 fNumareahi .Reset(); 313 fNumsectorhi.Reset(); 314 fSumarealo .Reset(); 315 fSumsectorlo.Reset(); 316 fNumarealo .Reset(); 317 fNumsectorlo.Reset(); 318 319 for (Int_t i=0; i<npixels; i++) 320 { 321 const MExtractedSignalPix &pix = (*signal)[i]; 322 const Int_t aidx = (*fGeom)[i].GetAidx(); 323 const Int_t sector = (*fGeom)[i].GetSector(); 324 325 const Float_t siglo = pix.GetExtractedSignalLoGain(); 326 327 // 328 // Skip all pixels with: 329 // - Saturated high-gain 330 // - Not extracted low-gain 331 // (see MExtractTimeAndCharge::fLoGainSwitch for setting the criteria) 332 // 333 if (siglo < 0.5 || pix.GetNumHiGainSaturated() > 0) 327 334 continue; 328 335 329 const MExtractedSignalPix &pix = (*signal)[pixidx]; 330 const Int_t aidx = (*fGeom)[pixidx].GetAidx(); 331 const Int_t sector = (*fGeom)[pixidx].GetSector(); 332 333 const Float_t ratio = pix.GetExtractedSignalHiGain() / pix.GetExtractedSignalLoGain(); 334 335 hist.FillHistAndArray(ratio) ; 336 fSumarea [aidx] += ratio; 337 fNumarea [aidx] ++; 338 fSumsector[sector] += ratio; 339 fNumsector[sector] ++; 336 const Float_t sighi = pix.GetExtractedSignalHiGain(); 337 const Float_t ratio = sighi / siglo; 338 339 MHCalibrationPix &histhi = (*this)[i]; 340 341 histhi.FillHistAndArray(ratio); 342 fSumareahi [aidx] += ratio; 343 fNumareahi [aidx] ++; 344 fSumsectorhi[sector] += ratio; 345 fNumsectorhi[sector] ++; 346 347 if (IsLoGain()) 348 { 349 const MArrivalTimePix &tix = (*times)[i]; 350 MHCalibrationPix &histlo = (*this)(i); 351 352 const Float_t diff = tix.GetArrivalTimeLoGain() - tix.GetArrivalTimeHiGain(); 353 354 histlo.FillHistAndArray(diff); 355 fSumarealo [aidx] += diff; 356 fNumarealo [aidx] ++; 357 fSumsectorlo[sector] += diff; 358 fNumsectorlo[sector] ++; 359 } 340 360 } 341 361 342 362 for (Int_t j=0; j<nareas; j++) 343 363 { 344 MHCalibrationPix &hist = GetAverageHiGainArea(j); 345 hist.FillHistAndArray(fNumarea[j] == 0 ? 0. : fSumarea[j]/fNumarea[j]); 364 MHCalibrationPix &histhi = GetAverageHiGainArea(j); 365 histhi.FillHistAndArray(fNumareahi[j] == 0 ? 0. : fSumareahi[j]/fNumareahi[j]); 366 367 if (IsLoGain()) 368 { 369 MHCalibrationPix &histlo = GetAverageLoGainArea(j); 370 histlo.FillHistAndArray(fNumarealo[j] == 0 ? 0. : fSumarealo[j]/fNumarealo[j]); 371 } 346 372 } 347 373 … … 349 375 { 350 376 MHCalibrationPix &hist = GetAverageHiGainSector(j); 351 hist.FillHistAndArray(fNumsector[j] == 0 ? 0. : fSumsector[j]/fNumsector[j]); 377 hist.FillHistAndArray(fNumsectorhi[j] == 0 ? 0. : fSumsectorhi[j]/fNumsectorhi[j]); 378 379 if (IsLoGain()) 380 { 381 MHCalibrationPix &histlo = GetAverageLoGainSector(j); 382 histlo.FillHistAndArray(fNumsectorlo[j] == 0 ? 0. : fSumsectorlo[j]/fNumsectorlo[j]); 383 } 352 384 } 353 385 … … 369 401 370 402 MCalibrationCam *hilocam = fIntensCam ? fIntensCam->GetCam() : fCam; 371 MBadPixelsCam *badcam = fIntensBad ? fIntensBad->GetCam() : fBadPixels;372 373 const Int_t nareas = fAverageHiGainAreas->GetSize();403 MBadPixelsCam *badcam = fIntensBad ? fIntensBad->GetCam() : fBadPixels; 404 405 const Int_t nareas = fAverageHiGainAreas->GetSize(); 374 406 const Int_t nsectors = fAverageHiGainSectors->GetSize(); 375 376 TArrayI satarea(nareas);377 TArrayI satsect(nsectors);378 fNumarea .Reset();379 fNumsector.Reset();380 407 381 408 for (Int_t i=0; i<fHiGainArray->GetSize(); i++) … … 387 414 continue; 388 415 389 const Int_t aidx = (*fGeom)[i].GetAidx();390 const Int_t sector = (*fGeom)[i].GetSector();391 392 fNumarea[aidx]++;393 fNumsector[sector]++;394 //395 // Check histogram overflow396 //397 416 CheckOverflow(hist); 398 417 } … … 422 441 MBadPixelsPix::kHiLoOscillating); 423 442 443 if (!IsLoGain()) 444 return kTRUE; 445 446 for (Int_t i=0; i<fLoGainArray->GetSize(); i++) 447 { 448 449 MHCalibrationPix &hist = (*this)(i); 450 451 if (hist.IsExcluded()) 452 continue; 453 454 CheckOverflow(hist); 455 } 456 457 for (Int_t j=0; j<nareas; j++) 458 { 459 460 MHCalibrationPix &hist = GetAverageLoGainArea(j); 461 CheckOverflow(hist); 462 } 463 464 for (Int_t j=0; j<nsectors; j++) 465 { 466 467 MHCalibrationPix &hist = GetAverageLoGainSector(j); 468 CheckOverflow(hist); 469 } 470 471 FitLoGainArrays(*hilocam,*badcam, 472 MBadPixelsPix::kHiLoNotFitted, 473 MBadPixelsPix::kHiLoOscillating); 474 424 475 return kTRUE; 425 476 } … … 478 529 return kFALSE; 479 530 480 const MHCalibrationPix &pix = (*this)[idx]; 531 const MHCalibrationPix &pixhi = (*this)[idx]; 532 const MHCalibrationPix &pixlo = (*this)(idx); 481 533 482 534 switch (type) 483 535 { 484 536 case 0: 485 val = pix .GetMean();537 val = pixhi.GetMean(); 486 538 break; 487 539 case 1: 488 val = pix .GetMeanErr();540 val = pixhi.GetMeanErr(); 489 541 break; 490 542 case 2: 491 val = pix .GetSigma();543 val = pixhi.GetSigma(); 492 544 break; 493 545 case 3: 494 val = pix .GetSigmaErr();546 val = pixhi.GetSigmaErr(); 495 547 break; 496 548 case 4: 497 val = pix .GetProb();549 val = pixhi.GetProb(); 498 550 break; 499 551 case 5: 500 if (!pix .IsGausFitOK())552 if (!pixhi.IsGausFitOK()) 501 553 val = 1.; 502 554 break; 503 555 case 6: 504 if (!pix.IsFourierSpectrumOK()) 556 if (!pixhi.IsFourierSpectrumOK()) 557 val = 1.; 558 break; 559 case 7: 560 if (!IsLoGain()) 561 break; 562 val = pixlo.GetMean(); 563 break; 564 case 8: 565 if (!IsLoGain()) 566 break; 567 val = pixlo.GetMeanErr(); 568 break; 569 case 9: 570 if (!IsLoGain()) 571 break; 572 val = pixlo.GetSigma(); 573 break; 574 case 10: 575 if (!IsLoGain()) 576 break; 577 val = pixlo.GetSigmaErr(); 578 break; 579 case 11: 580 if (!IsLoGain()) 581 break; 582 val = pixlo.GetProb(); 583 break; 584 case 12: 585 if (!IsLoGain()) 586 break; 587 if (!pixlo.IsGausFitOK()) 588 val = 1.; 589 break; 590 case 13: 591 if (!IsLoGain()) 592 break; 593 if (!pixlo.IsFourierSpectrumOK()) 505 594 val = 1.; 506 595 break; -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationHiLoCam.h
r5749 r5946 33 33 static const TString gsHistYTitle; //! Default Histogram y-axis titles 34 34 35 static const Byte_t fgLowerLim; //! Default for fLowerLimt (now set to: 200) 36 static const Byte_t fgUpperLim; //! Default for fUpperLimt (now set to: 252) 35 MArrayD fSumareahi ; // 36 MArrayD fSumsectorhi; // 37 MArrayI fNumareahi ; // 38 MArrayI fNumsectorhi; // 39 MArrayD fSumarealo ; // 40 MArrayD fSumsectorlo; // 41 MArrayI fNumarealo ; // 42 MArrayI fNumsectorlo; // 37 43 38 Byte_t fLowerLim; // Lower allowed FADC value limit for max. slicey39 Byte_t fUpperLim; // Upper allowed FADC value limit for max. slicey40 41 MArrayD fSumarea ; //42 MArrayD fSumsector; //43 MArrayI fNumarea ; //44 MArrayI fNumsector; //45 46 MRawEvtData *fRawEvt; //! Raw event data47 48 Bool_t SetupHists(const MParList *pList);49 44 Bool_t ReInitHists(MParList *pList); 50 45 Bool_t FillHists(const MParContainer *par, const Stat_t w=1); … … 62 57 TObject *Clone(const char *name="") const; 63 58 64 Byte_t GetLowerLim() const { return fLowerLim; }65 Byte_t GetUpperLim() const { return fUpperLim; }66 67 void SetLowerLim( const UInt_t i=fgLowerLim) { fLowerLim = i; }68 void SetUpperLim( const UInt_t i=fgUpperLim) { fUpperLim = i; }69 70 59 Bool_t GetPixelContent(Double_t &val, Int_t idx, const MGeomCam &cam, Int_t type=0) const; 71 60 void DrawPixelContent(Int_t idx) const;
Note:
See TracChangeset
for help on using the changeset viewer.