Changeset 3556 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 03/19/04 20:11:30 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.cc
r3555 r3556 405 405 // 406 406 // 407 void MCalibrationChargeCalc::FinalizePedestals( MPedestalPix &ped, MCalibrationChargePix &cal,408 Float_t &avped, Float_t &avrms , Float_t &avnum)407 void MCalibrationChargeCalc::FinalizePedestals(const MPedestalPix &ped, MCalibrationChargePix &cal, 408 Float_t &avped, Float_t &avrms) 409 409 { 410 410 … … 421 421 avped += pedes; 422 422 avrms += prms; 423 avnum++;424 423 425 424 // … … 442 441 } 443 442 444 445 443 void MCalibrationChargeCalc::FinalizeAvPedestals(MCalibrationChargePix &cal, 444 Float_t avped, Float_t avrms, Int_t avnum) 445 { 446 447 // 448 // set the pedestans in the calibration camera 449 // 450 if (cal.IsHiGainSaturation()) 451 { 452 cal.SetPedestal(avped/avnum * fNumLoGainSamples, 453 avrms/avnum * fSqrtLoGainSamples, 454 avrms/avnum * fSqrtLoGainSamples/avnum); 455 cal.CalcLoGainPedestal((Float_t)fNumLoGainSamples); 456 } 457 else 458 { 459 cal.SetPedestal(avped/avnum * fNumHiGainSamples, 460 avrms/avnum * fSqrtHiGainSamples, 461 avrms/avnum * fSqrtHiGainSamples/avnum); 462 } 463 } 464 465 // 466 // Finalize charges per pixel: 467 // * Check chage validity 468 // * check absolute time validity 469 // * calculate the reduced sigma 470 // * caluclate the number of photo-electrons 471 // 472 // 473 Bool_t MCalibrationChargeCalc::FinalizeCharges(MCalibrationChargePix &cal, MBadPixelsPix &bad) 474 { 475 476 cal.CheckChargeValidity (&bad); 477 cal.CheckTimeValidity (&bad); 478 479 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun)) 480 return kFALSE; 481 482 if (!cal.CalcReducedSigma()) 483 { 484 *fLog << warn << GetDescriptor() 485 << ": Could not calculate reduced sigmas of pixel: " << cal.GetPixId() << endl; 486 bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 487 return kFALSE; 488 } 489 490 if (!cal.CalcFFactorMethod()) 491 { 492 *fLog << warn << GetDescriptor() 493 << ": Could not calculate F-Factor of pixel: " << cal.GetPixId() << endl; 494 bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 495 return kFALSE; 496 } 497 return kTRUE; 498 } 499 500 // 501 // * Finalize the pedestals 502 // * Do the quality checks 503 // * Calculate the reduced sigma 504 // * Calculate the F-Factor Method 505 // 446 506 Int_t MCalibrationChargeCalc::PostProcess() 447 507 { … … 450 510 // loop over the pedestal events and check if we have calibration 451 511 // 452 Int_t nvalid= 0;453 Float_t avinnerped = 0 ;454 Float_t avinnerprms = 0 ;455 Float_tavinnernum = 0;456 Float_t avouterped = 0 ;457 Float_t avouterprms = 0 ;458 Float_tavouternum = 0;512 Int_t nvalid = 0; 513 Float_t avinnerped = 0.; 514 Float_t avinnerprms = 0.; 515 Int_t avinnernum = 0; 516 Float_t avouterped = 0.; 517 Float_t avouterprms = 0.; 518 Int_t avouternum = 0; 459 519 460 520 for (Int_t pixid=0; pixid<fPedestals->GetSize(); pixid++) … … 468 528 continue; 469 529 470 MPedestalPix &ped = (*fPedestals)[pixid];471 530 MPedestalPix &ped = (*fPedestals)[pixid]; 531 MBadPixelsPix &bad = (*fBadPixels)[pixid]; 472 532 473 533 if (fGeom->GetPixRatio(pixid) == 1.) 474 FinalizePedestals(ped,pix,avinnerped,avinnerprms,avinnernum); 534 { 535 FinalizePedestals(ped,pix,avinnerped,avinnerprms); 536 avinnernum++; 537 } 475 538 else 476 FinalizePedestals(ped,pix,avouterped,avouterprms,avouternum);477 478 479 MBadPixelsPix &bad = (*fBadPixels)[pixid];480 481 pix.CheckChargeValidity (&bad);482 pix.CheckTimeValidity (&bad);483 484 if (bad.IsUnsuitable(MBadPixelsPix::kUnsuitableRun))485 continue;486 487 nvalid++;488 489 if (!pix.CalcReducedSigma())490 539 { 491 *fLog << warn << GetDescriptor() 492 << ": Could not calculate reduced sigmas of pixel: " << pix.GetPixId() << endl; 493 bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 494 continue; 540 FinalizePedestals(ped,pix,avouterped,avouterprms); 541 avouternum++; 495 542 } 496 497 if (!pix.CalcFFactorMethod()) 498 { 499 *fLog << warn << GetDescriptor() 500 << ": Could not calculate F-Factor of pixel: " << pix.GetPixId() << endl; 501 bad.SetUnsuitable(MBadPixelsPix::kUnsuitableRun); 502 } 543 544 if (FinalizeCharges(pix,bad)) 545 nvalid++; 503 546 } 504 547 … … 516 559 } 517 560 518 MCalibrationChargePix *avinnerpix = fCam->GetAverageInnerPix(); 519 MCalibrationChargePix *avouterpix = fCam->GetAverageOuterPix(); 520 // 521 // set the pedestans in the calibration camera 522 // 523 if (avinnerpix->IsHiGainSaturation()) 524 { 525 avinnerpix->SetPedestal(avinnerped/avinnernum * fNumLoGainSamples, 526 avinnerprms/avinnernum * fSqrtLoGainSamples, 527 avinnerprms/avinnernum * fSqrtLoGainSamples/avinnernum); 528 avinnerpix->CalcLoGainPedestal((Float_t)fNumLoGainSamples); 529 } 530 else 531 { 532 avinnerpix->SetPedestal(avinnerped/avinnernum * fNumHiGainSamples, 533 avinnerprms/avinnernum * fSqrtHiGainSamples, 534 avinnerprms/avinnernum * fSqrtHiGainSamples/avinnernum); 535 } 536 537 if (avouterpix->IsHiGainSaturation()) 538 { 539 avouterpix->SetPedestal(avouterped/avouternum * fNumLoGainSamples, 540 avouterprms/avouternum * fSqrtLoGainSamples, 541 avouterprms/avouternum * fSqrtLoGainSamples/avouternum); 542 avouterpix->CalcLoGainPedestal((Float_t)fNumLoGainSamples); 543 } 544 else 545 { 546 avouterpix->SetPedestal(avouterped/avouternum * fNumHiGainSamples, 547 avouterprms/avouternum * fSqrtHiGainSamples, 548 avouterprms/avouternum * fSqrtHiGainSamples/avouternum); 549 } 550 551 MBadPixelsPix *bad = fCam->GetAverageInnerBadPix(); 552 553 avinnerpix->CheckChargeValidity(bad); 554 avinnerpix->CheckTimeValidity(bad); 555 556 if (bad->IsCalibrationSignalOK()) 557 if (!avinnerpix->CalcReducedSigma()) 558 avinnerpix->CalcFFactorMethod(); 559 560 bad = fCam->GetAverageInnerBadPix(); 561 562 avouterpix->CheckChargeValidity(bad); 563 avouterpix->CheckTimeValidity(bad); 564 565 if (bad->IsCalibrationSignalOK()) 566 if (!avouterpix->CalcReducedSigma()) 567 avouterpix->CalcFFactorMethod(); 561 FinalizeAvPedestals(*fCam->GetAverageInnerPix(), avinnerped, avinnerprms,avinnernum); 562 FinalizeAvPedestals(*fCam->GetAverageOuterPix(), avouterped, avouterprms,avouternum); 563 564 FinalizeCharges(*fCam->GetAverageInnerPix(),*fCam->GetAverageInnerBadPix()); 565 FinalizeCharges(*fCam->GetAverageOuterPix(),*fCam->GetAverageOuterBadPix()); 568 566 569 567 // -
trunk/MagicSoft/Mars/mcalib/MCalibrationChargeCalc.h
r3555 r3556 27 27 class MExtractedSignalCam; 28 28 class MBadPixelsCam; 29 class MBadPixelsPix; 29 30 class MTime; 30 31 class MCalibrationChargeCalc : public MTask … … 62 63 Int_t PostProcess(); 63 64 64 void FinalizePedestals(MPedestalPix &ped, MCalibrationChargePix &cal, 65 Float_t &avped, Float_t &avrms, Float_t &avnum); 65 void FinalizePedestals(const MPedestalPix &ped, MCalibrationChargePix &cal, 66 Float_t &avped, Float_t &avrms); 67 void FinalizeAvPedestals(MCalibrationChargePix &cal, Float_t avped, Float_t avrms, Int_t avnum); 66 68 69 Bool_t FinalizeCharges(MCalibrationChargePix &cal, MBadPixelsPix &bad); 67 70 68 71 public:
Note:
See TracChangeset
for help on using the changeset viewer.