Changeset 3106 for trunk/MagicSoft/Mars
- Timestamp:
- 02/12/04 00:22:58 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3103 r3106 26 26 pixel numbers. 27 27 28 * mbase/MArray.[h,cc] 29 - introduced function to cut array edges with zeros. 30 (Thomas, should we keep it there or move it to another class? ) 31 32 * mcalib/MCalibrationCalc.[h,cc] 33 - new function SetBlindPixelRange to set start and end of FADC slices 34 used for the blind pixel signal extraction. 35 - remove fEvents which are not necessary any more after the shift 36 to MFCosmics. 37 28 38 29 39 2004/02/11: Abelardo Moralejo … … 59 69 spectrum 60 70 61 * mfilter/M Cosmics.[h,cc]71 * mfilter/MFCosmics.[h,cc] 62 72 * mfilter/Makefile 63 73 * mfilter/FilterLinkDef.h -
trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.cc
r3090 r3106 116 116 const Byte_t MCalibrationCalc::fgSaturationLimit = 254; 117 117 const Byte_t MCalibrationCalc::fgBlindPixelFirst = 3; 118 const Byte_t MCalibrationCalc::fgBlindPixelLast = 16;118 const Byte_t MCalibrationCalc::fgBlindPixelLast = 8; 119 119 120 120 // -------------------------------------------------------------------------- … … 136 136 137 137 Clear(); 138 SetBlindPixelRange(); 138 139 } 139 140 … … 150 151 CLRBIT(fFlags, kUsePinDiodeFit); 151 152 152 153 154 fEvents = 0; 153 fBlindPixelFirst = 0; 154 fBlindPixelLast = 0; 155 155 156 156 fNumHiGainSamples = 0; … … 160 160 161 161 fColor = kECT1; 162 } 163 164 void MCalibrationCalc::SetBlindPixelRange(Byte_t first, Byte_t last) 165 { 166 167 fBlindPixelFirst = first; 168 fBlindPixelLast = last; 162 169 } 163 170 … … 387 394 MRawEvtPixelIter pixel(fRawEvt); 388 395 389 fEvents++;390 391 396 // 392 397 // Create a (second) loop to do fill the calibration histograms … … 431 436 if (pixid == 1) 432 437 referencetime = (Float_t)pixel.GetIdxMaxHiGainSample(); 433 #endif434 438 if (sig.IsLoGainUsed()) 435 439 { … … 445 449 // } /* if Use Times */ 446 450 451 #endif 447 452 switch(pixid) 448 453 { … … 453 458 { 454 459 460 Byte_t *ptr = pixel.GetHiGainSamples(); 461 455 462 Float_t blindpixelsumhi = 0.; 456 463 Float_t blindpixelsumlo = 0.; … … 458 465 // We need a dedicated signal extractor for the blind pixel 459 466 // 460 MPedestalPix &ped = (*fPedestals)[pixid]; 461 if (!CalcSignalBlindPixel(pixel.GetHiGainSamples(), blindpixelsumhi, ped.GetPedestal())) 462 return kFALSE; 463 464 CalcSignalBlindPixel(pixel.GetLoGainSamples(), blindpixelsumlo, ped.GetPedestal()); 465 466 blindpixel.FillGraphs(blindpixelsumhi,blindpixelsumlo); 467 467 MPedestalPix &ped = (*fPedestals)[fBlindPixelId]; 468 469 Int_t diff = 0; 470 471 if (fBlindPixelLast > 15) 472 { 473 diff = fBlindPixelLast - 15; 474 fBlindPixelLast = 15; 475 } 476 477 Byte_t *start = ptr + fBlindPixelFirst - 1; 478 Byte_t *end = start + fBlindPixelLast - fBlindPixelFirst + 1; 479 480 ptr = start; 481 482 Int_t sum = 0; 483 484 while (ptr<end) 485 { 486 sum += *ptr; 487 ptr++; 488 } 489 490 if (diff > 0) 491 { 492 ptr = pixel.GetLoGainSamples(); 493 494 end = ptr + diff + 1; 495 496 while (ptr<end) 497 { 498 sum += *ptr; 499 ptr++; 500 } 501 } 502 503 blindpixelsumhi = (Float_t)sum; 504 505 ptr = pixel.GetLoGainSamples(); 506 507 start = ptr + fBlindPixelFirst - 1; 508 end = ptr + fBlindPixelLast; 509 510 ptr = start; 511 512 sum = 0; 513 514 while (++ptr<end) 515 sum += *ptr; 516 517 blindpixelsumlo = (Float_t)sum; 518 519 // if (!CalcSignalBlindPixel(hiptr, blindpixelsumhi)) 520 // return kFALSE; 521 468 522 if (!blindpixel.FillCharge(blindpixelsumhi)) 469 523 *fLog << warn << 470 524 "Overflow or Underflow occurred filling Blind Pixel sum = " << blindpixelsumhi << endl; 471 525 472 Byte_t *hiptr = pixel.GetHiGainSamples(); 473 Byte_t *loptr = pixel.GetHiGainSamples(); 474 526 // Byte_t *loptr = pixel.GetLoGainSamples(); 527 // CalcSignalBlindPixel(loptr, blindpixelsumlo); 528 529 blindpixel.FillGraphs(blindpixelsumhi,blindpixelsumlo); 530 531 #if 0 475 532 TH1I *hist = blindpixel.GetSinglePheFADCSlices(); 476 533 477 if (blindpixelsumhi > 100.)534 if (blindpixelsumhi > 300.) 478 535 { 536 ptr = pixel.GetHiGainSamples(); 479 537 for (Int_t i=0;i<15;i++) 480 hist->Fill(i,*hiptr++); 538 hist->Fill(i,*ptr++); 539 ptr = pixel.GetLoGainSamples(); 481 540 for (Int_t i=15;i<30;i++) 482 hist->Fill(i,* loptr++);541 hist->Fill(i,*ptr++); 483 542 } 484 543 #endif 485 544 } /* if use blind pixel */ 486 545 487 break; 488 546 // break; 489 547 case fPINDiodeId: 490 548 … … 504 562 if (!pindiode.FillGraphs(sumhi,sumlo)) 505 563 *fLog << warn 506 << "Overflow or Underflow occurred filling PINDiode: eventnr = " 507 << fEvents << endl; 564 << "Overflow or Underflow occurred filling PINDiode: eventnr = " << endl; 508 565 509 566 } /* if use PIN Diode */ 510 567 511 break;568 // break; 512 569 513 570 default: … … 563 620 *fLog << inf << endl; 564 621 565 if (fEvents == 0)566 {567 *fLog << err << GetDescriptor()568 << ": This run contains no calibration data! " << endl;569 return kFALSE;570 }571 572 622 *fLog << inf << GetDescriptor() << ": Cut Histogram Edges" << endl; 573 623 … … 595 645 if (fPedestals->GetHistSize() > fBlindPixelId) 596 646 { 647 648 Float_t pedestal; 649 Float_t pederr; 650 Float_t pedsigma; 651 Float_t pedsigmaerr; 652 653 const ULong_t nentries = fPedestals->GetTotalEntries(); 654 const Float_t nslices = (Float_t)(fgBlindPixelLast-fgBlindPixelFirst+1); 655 const Float_t sqrslice = TMath::Sqrt(nslices); 597 656 // 598 657 // retrieve the pedestal pix of the blind pixel 599 658 // 600 MHPedestalPixel &pedhist = (*fPedestals)(fBlindPixelId); 601 MPedestalPix &pedpix = (*fPedestals)[fBlindPixelId]; 659 if (fPedestals->GetHistSize() != 0) 660 { 661 MHPedestalPixel &pedhist = (*fPedestals)(fBlindPixelId); 662 pedestal = pedhist.GetChargeMean()*nslices; 663 pederr = pedhist.GetChargeMeanErr()*nslices; 664 // 665 // Fitted sigma: 1. one sqrt(Nr. slices) for the division which is not 666 // not appropriate: sigma(real)/slice = GetSigma*sqrt(nslices) 667 // 2. another sqrt(Nr. slices) to calculate back to number 668 // of slices 669 // 670 pedsigma = pedhist.GetChargeSigma()*nslices; 671 pedsigmaerr = pedhist.GetChargeSigmaErr()*nslices; 672 } 673 else 674 { 675 MPedestalPix &pedpix = (*fPedestals)[fBlindPixelId]; 676 pedestal = pedpix.GetPedestal()*nslices; 677 pederr = pedpix.GetPedestalRms()*nslices/nentries; 678 pedsigma = pedpix.GetPedestalRms()*sqrslice; 679 pedsigmaerr = pederr/2.; 680 } 602 681 // 603 682 // retrieve the histogram containers 604 683 // 605 684 MHCalibrationBlindPixel *hist = blindpixel.GetHist(); 606 // 607 // Set the corresponding values 608 // 609 const Float_t nslices = (Float_t)(fgBlindPixelLast-fgBlindPixelFirst+1); 610 const Float_t sqrslice = TMath::Sqrt(nslices); 611 const ULong_t nentries = fPedestals->GetTotalEntries(); 612 613 const Float_t peddiff = (pedhist.GetChargeMean()-pedpix.GetPedestal())*nslices; 614 615 Float_t pederr = pedhist.GetChargeMeanErr()*pedhist.GetChargeMeanErr(); 616 pederr += pedpix.GetPedestalRms()*pedpix.GetPedestalRms()/nentries; 617 pederr = TMath::Sqrt(pederr)*sqrslice; 618 619 // 620 // Fitted sigma: 1. one sqrt(Nr. slices) for the division which is not 621 // not appropriate: sigma(real)/slice = GetSigma*sqrt(nslices) 622 // 2. another sqrt(Nr. slices) to calculate back to number 623 // of slices 624 // 625 const Float_t pedsigma = pedhist.GetChargeSigma()*nslices; 626 const Float_t pedsigmaerr = pedhist.GetChargeSigmaErr()*nslices; 627 628 hist->SetMeanPedestal(peddiff); 685 686 hist->SetMeanPedestal(pedestal); 629 687 hist->SetMeanPedestalErr(pederr); 630 688 hist->SetSigmaPedestal(pedsigma); … … 724 782 725 783 726 Bool_t MCalibrationCalc::CalcSignalBlindPixel(Byte_t *ptr, Float_t &signal, const Float_t ped) const 727 { 728 729 Byte_t *start = ptr + fgBlindPixelFirst-1; 730 Byte_t *end = ptr + fgBlindPixelLast; 784 Bool_t MCalibrationCalc::CalcSignalBlindPixel(Byte_t *ptr, Float_t &signal) const 785 { 786 787 Byte_t *newptr = ptr; 788 Byte_t *start = ptr + fBlindPixelFirst-1; 789 Byte_t *end = ptr + fBlindPixelLast; 790 Byte_t nsamples = fBlindPixelLast-fgBlindPixelFirst+1; 731 791 732 792 Byte_t sum = 0; 733 793 Int_t sat = 0; 734 794 735 ptr = start;795 newptr = start; 736 796 737 797 while (ptr<end) … … 739 799 sum += *ptr; 740 800 if (*ptr++ >= fgSaturationLimit) 741 801 sat++; 742 802 } 743 803 … … 746 806 *fLog << err << "HI Gain Saturation occurred in the blind pixel! " 747 807 << " Do not know yet how to treat this ... aborting " << endl; 808 *fLog << err << "If you need absolutely any other kind of calibration, " 809 << " use SkipBlindPixelFit() " << endl; 748 810 return kFALSE; 749 811 } 750 812 751 signal = (Float_t)sum - ped*(Float_t)(fgBlindPixelLast-fgBlindPixelFirst+1);813 signal = (Float_t)sum; 752 814 753 815 return kTRUE; -
trunk/MagicSoft/Mars/mcalib/MCalibrationCalc.h
r3084 r3106 53 53 MTime *fEvtTime; // Time of the event 54 54 55 Int_t fEvents; // Number of events56 57 55 Byte_t fNumHiGainSamples; 58 56 Byte_t fNumLoGainSamples; 59 57 Float_t fSqrtHiGainSamples; 58 59 Byte_t fBlindPixelFirst; 60 Byte_t fBlindPixelLast; 60 61 61 62 Float_t fConversionHiLo; … … 69 70 kHiLoGainCalibration, 70 71 kHiGainOverFlow, kLoGainOverFlow }; 71 72 72 73 public: 73 74 … … 83 84 Int_t PostProcess(); 84 85 85 Bool_t CalcSignalBlindPixel(Byte_t *ptr, Float_t &signal , const Float_t ped) const;86 Bool_t CalcSignalBlindPixel(Byte_t *ptr, Float_t &signal) const; 86 87 87 88 public: … … 105 106 void SetConversionHiLo(Float_t conv) { fConversionHiLo = conv; } 106 107 108 void SetBlindPixelRange(Byte_t first=fgBlindPixelFirst, Byte_t last=fgBlindPixelLast); 109 107 110 // Getters 108 111 MCalibrationBlindPix *GetBlindPixel() const;
Note:
See TracChangeset
for help on using the changeset viewer.