Changeset 5858
- Timestamp:
- 01/16/05 17:31:49 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r5855 r5858 33 33 - speed up Process by storing pre-calculated calibration constants 34 34 in arrays (needed 40% of CPU time of the eventloop before, now: 23%) 35 36 * mcalib/MCalibCalcFromPast.[h,cc] 37 - committed final version, now also in the Makefile 35 38 36 39 -
trunk/MagicSoft/Mars/mcalib/CalibLinkDef.h
r5749 r5858 7 7 #pragma link C++ class MCalibColorSet+; 8 8 #pragma link C++ class MCalibColorSteer+; 9 #pragma link C++ class MCalibCalcFromPast+; 9 10 10 11 #pragma link C++ class MCalibrate+; -
trunk/MagicSoft/Mars/mcalib/MCalibCalcFromPast.cc
r5857 r5858 233 233 // -------------------------------------------------------------------------- 234 234 // 235 // Initializes new containers in the 236 // Intensity Cams, if the number of calibration events has reach fNumEventsDump. 237 // Executes CallPostProcess of the MCalibration*Calc classes in that case. 238 // 235 // - Initializes new containers in the 236 // - Intensity Cams, if the number of calibration events has reach fNumEventsDump. 237 // - Executes Finalize() of the MCalibration*Calc classes in that case. 238 // - Sets the latest MCalibrationChargeCam as update class into MCalibrateData 239 // - Initialize new MCalibration*Cams into the intensity cams. 240 // 239 241 Int_t MCalibCalcFromPast::Process() 240 242 { -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityChargeCam.cc
r5690 r5858 45 45 #include <TGraphErrors.h> 46 46 #include <TOrdCollection.h> 47 #include <TH1D.h> 47 48 48 49 #include "MLog.h" 50 #include "MLogManip.h" 51 52 #include "MHCamera.h" 49 53 50 54 #include "MGeomCam.h" … … 540 544 return nvalid; 541 545 } 546 547 548 // ------------------------------------------------------------------- 549 // 550 // Returns a TGraphErrors with the development of the number of 551 // photo-electrons vs. camera number for pixel 'pixid' 552 // 553 TGraphErrors *MCalibrationIntensityChargeCam::GetVarVsTime( const Int_t pixid , const Option_t *opt ) 554 { 555 556 const Int_t size = GetSize(); 557 558 if (size == 0) 559 return NULL; 560 561 TString option(opt); 562 563 TArrayF nr(size); 564 TArrayF nrerr(size); 565 TArrayF var (size); 566 TArrayF varerr(size); 567 568 for (Int_t i=0;i<size;i++) 569 { 570 // 571 // Get the calibration cam from the intensity cam 572 // 573 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i); 574 // 575 // Get the calibration pix from the calibration cam 576 // 577 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*cam)[pixid]; 578 // 579 nr[i] = i; 580 nrerr[i] = 0.; 581 var[i] = -1.; 582 varerr[i] = -1.; 583 // 584 // Don't use bad pixels 585 // 586 if (!pix.IsFFactorMethodValid()) 587 continue; 588 // 589 if (option.Contains("RSigma")) 590 { 591 var [i] = pix.GetRSigma(); 592 varerr[i] = pix.GetRSigmaErr(); 593 } 594 if (option.Contains("AbsTime")) 595 { 596 var [i] = pix.GetAbsTimeMean(); 597 varerr[i] = pix.GetAbsTimeRms(); 598 } 599 if (option.Contains("ConversionHiLo")) 600 { 601 var [i] = pix.GetConversionHiLo(); 602 varerr[i] = pix.GetConversionHiLoErr(); 603 } 604 if (option.Contains("ConvertedMean")) 605 { 606 var [i] = pix.GetConvertedMean(); 607 varerr[i] = pix.GetConvertedMeanErr(); 608 } 609 if (option.Contains("ConvertedSigma")) 610 { 611 var [i] = pix.GetConvertedSigma(); 612 varerr[i] = pix.GetConvertedSigmaErr(); 613 } 614 if (option.Contains("ConvertedRSigma")) 615 { 616 var [i] = pix.GetConvertedRSigma(); 617 varerr[i] = pix.GetConvertedRSigmaErr(); 618 } 619 if (option.Contains("MeanConvFADC2Phe")) 620 { 621 var [i] = pix.GetMeanConvFADC2Phe(); 622 varerr[i] = pix.GetMeanConvFADC2PheErr(); 623 } 624 if (option.Contains("MeanFFactorFADC2Phot")) 625 { 626 var [i] = pix.GetMeanFFactorFADC2Phot(); 627 varerr[i] = pix.GetMeanFFactorFADC2PhotErr(); 628 } 629 if (option.Contains("Ped")) 630 { 631 var [i] = pix.GetPed(); 632 varerr[i] = pix.GetPedErr(); 633 } 634 if (option.Contains("PedRms")) 635 { 636 var [i] = pix.GetPedRms(); 637 varerr[i] = pix.GetPedRmsErr(); 638 } 639 if (option.Contains("PheFFactorMethod")) 640 { 641 var [i] = pix.GetPheFFactorMethod(); 642 varerr[i] = pix.GetPheFFactorMethodErr(); 643 } 644 if (option.Contains("RSigmaPerCharge")) 645 { 646 var [i] = pix.GetRSigmaPerCharge(); 647 varerr[i] = pix.GetRSigmaPerChargeErr(); 648 } 649 } 650 651 652 TGraphErrors *gr = new TGraphErrors(size, 653 nr.GetArray(),var.GetArray(), 654 nrerr.GetArray(),varerr.GetArray()); 655 gr->SetTitle(Form("%s%3i","Pixel ",pixid)); 656 gr->GetXaxis()->SetTitle("Camera Nr."); 657 // gr->GetYaxis()->SetTitle("<Q> [FADC cnts]"); 658 return gr; 659 } 660 661 // -------------------------------------------------------------------------------- 662 // 663 // Returns a TGraphErrors with a pre-defined variable with name (handed over in 'opt') 664 // per area index 'aidx' vs. the calibration camera number 665 // 666 TGraphErrors *MCalibrationIntensityChargeCam::GetVarPerAreaVsTime( const Int_t aidx, const MGeomCam &geom, const Option_t *opt) 667 { 668 669 const Int_t size = GetSize(); 670 671 if (size == 0) 672 return NULL; 673 674 TString option(opt); 675 676 TArrayF vararea(size); 677 TArrayF varareaerr(size); 678 TArrayF nr(size); 679 TArrayF nrerr(size); 680 681 TH1D *h = 0; 682 683 for (Int_t i=0;i<GetSize();i++) 684 { 685 // 686 // Get the calibration cam from the intensity cam 687 // 688 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i); 689 690 // 691 // Get the calibration pix from the calibration cam 692 // 693 Double_t variab = 0.; 694 Double_t variab2 = 0.; 695 Double_t variance = 0.; 696 Int_t num = 0; 697 Float_t pvar = 0.; 698 699 MHCamera camcharge(geom,"CamCharge","Variable;;channels"); 700 // 701 // Get the area calibration pix from the calibration cam 702 // 703 for (Int_t j=0; j<cam->GetSize(); j++) 704 { 705 const MCalibrationChargePix &pix = (MCalibrationChargePix&)(*cam)[j]; 706 // 707 // Don't use bad pixels 708 // 709 if (!pix.IsFFactorMethodValid()) 710 continue; 711 // 712 // 713 if (aidx != geom[j].GetAidx()) 714 continue; 715 716 pvar = 0.; 717 718 if (option.Contains("RSigma")) 719 pvar = pix.GetRSigma(); 720 if (option.Contains("AbsTime")) 721 pvar = pix.GetAbsTimeMean(); 722 if (option.Contains("ConversionHiLo")) 723 pvar = pix.GetConversionHiLo(); 724 if (option.Contains("ConvertedMean")) 725 pvar = pix.GetConvertedMean(); 726 if (option.Contains("ConvertedSigma")) 727 pvar = pix.GetConvertedSigma(); 728 if (option.Contains("ConvertedRSigma")) 729 pvar = pix.GetConvertedRSigma(); 730 if (option.Contains("MeanConvFADC2Phe")) 731 pvar = pix.GetMeanConvFADC2Phe(); 732 if (option.Contains("MeanFFactorFADC2Phot")) 733 pvar = pix.GetMeanFFactorFADC2Phot(); 734 if (option.Contains("Ped")) 735 pvar = pix.GetPed(); 736 if (option.Contains("PedRms")) 737 pvar = pix.GetPedRms(); 738 if (option.Contains("PheFFactorMethod")) 739 pvar = pix.GetPheFFactorMethod(); 740 if (option.Contains("RSigmaPerCharge")) 741 pvar = pix.GetRSigmaPerCharge(); 742 743 variab += pvar; 744 variab2 += pvar*pvar; 745 num++; 746 747 camcharge.Fill(j,pvar); 748 camcharge.SetUsed(j); 749 } 750 751 if (num > 1) 752 { 753 variab /= num; 754 variance = (variab2 - variab*variab*num) / (num-1); 755 756 vararea[i] = variab; 757 if (variance > 0.) 758 varareaerr[i] = TMath::Sqrt(variance); 759 else 760 varareaerr[i] = 999999999.; 761 762 // 763 // Make also a Gauss-fit to the distributions. The RMS can be determined by 764 // outlier, thus we look at the sigma and the RMS and take the smaller one, afterwards. 765 // 766 h = camcharge.ProjectionS(TArrayI(),TArrayI(1,&aidx),"_py",750); 767 h->SetDirectory(NULL); 768 h->Fit("gaus","QL"); 769 TF1 *fit = h->GetFunction("gaus"); 770 771 Float_t ci2 = fit->GetChisquare(); 772 Float_t sigma = fit->GetParameter(2); 773 774 if (ci2 > 500. || sigma > varareaerr[i]) 775 { 776 h->Fit("gaus","QLM"); 777 fit = h->GetFunction("gaus"); 778 779 ci2 = fit->GetChisquare(); 780 sigma = fit->GetParameter(2); 781 } 782 783 const Float_t mean = fit->GetParameter(1); 784 const Float_t ndf = fit->GetNDF(); 785 786 *fLog << inf << "Camera Nr: " << i << endl; 787 *fLog << inf << option.Data() << " area idx: " << aidx << " Results: " << endl; 788 *fLog << inf << "Mean: " << Form("%4.3f",mean) 789 << "+-" << Form("%4.3f",fit->GetParError(1)) 790 << " Sigma: " << Form("%4.3f",sigma) << "+-" << Form("%4.3f",fit->GetParError(2)) 791 << " Chisquare: " << Form("%4.3f",fit->GetChisquare()) << " NDF : " << ndf << endl; 792 delete h; 793 gROOT->GetListOfFunctions()->Remove(fit); 794 795 if (sigma < varareaerr[i] && ndf > 2) 796 { 797 vararea [i] = mean; 798 varareaerr[i] = sigma; 799 } 800 } 801 else 802 { 803 vararea[i] = -1.; 804 varareaerr[i] = 0.; 805 } 806 807 nr[i] = i; 808 nrerr[i] = 0.; 809 } 810 811 TGraphErrors *gr = new TGraphErrors(size, 812 nr.GetArray(),vararea.GetArray(), 813 nrerr.GetArray(),varareaerr.GetArray()); 814 gr->SetTitle(Form("%s Area %3i Average",option.Data(),aidx)); 815 gr->GetXaxis()->SetTitle("Camera Nr."); 816 // gr->GetYaxis()->SetTitle("<Q> [1]"); 817 return gr; 818 } 819 820 821 // ------------------------------------------------------------------- 822 // 823 // Returns a TGraphErrors with the mean effective number of photo-electrons per 824 // area index 'aidx' vs. the calibration camera number 825 // 826 TGraphErrors *MCalibrationIntensityChargeCam::GetPhePerAreaVsTime( const Int_t aidx, const MGeomCam &geom) 827 { 828 829 const Int_t size = GetSize(); 830 831 if (size == 0) 832 return NULL; 833 834 TArrayF phearea(size); 835 TArrayF pheareaerr(size); 836 TArrayF time(size); 837 TArrayF timeerr(size); 838 839 for (Int_t i=0;i<GetSize();i++) 840 { 841 // 842 // Get the calibration cam from the intensity cam 843 // 844 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i); 845 846 // 847 // Get the calibration pix from the calibration cam 848 // 849 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(aidx); 850 const Float_t phe = apix.GetPheFFactorMethod(); 851 const Float_t pheerr = apix.GetPheFFactorMethodErr(); 852 853 phearea[i] = phe; 854 pheareaerr[i] = pheerr; 855 856 time[i] = i; 857 timeerr[i] = 0.; 858 } 859 860 TGraphErrors *gr = new TGraphErrors(size, 861 time.GetArray(),phearea.GetArray(), 862 timeerr.GetArray(),pheareaerr.GetArray()); 863 gr->SetTitle(Form("%s%3i","Phes Area %d Average",aidx)); 864 gr->GetXaxis()->SetTitle("Camera Nr."); 865 gr->GetYaxis()->SetTitle("<N_phes> [1]"); 866 return gr; 867 } 868 869 // ------------------------------------------------------------------- 870 // 871 // Returns a TGraphErrors with the event-by-event averaged charge per 872 // area index 'aidx' vs. the calibration camera number 873 // 874 TGraphErrors *MCalibrationIntensityChargeCam::GetChargePerAreaVsTime( const Int_t aidx, const MGeomCam &geom) 875 { 876 877 const Int_t size = GetSize(); 878 879 if (size == 0) 880 return NULL; 881 882 TArrayF chargearea(size); 883 TArrayF chargeareaerr(size); 884 TArrayF nr(size); 885 TArrayF nrerr(size); 886 887 for (Int_t i=0;i<GetSize();i++) 888 { 889 // 890 // Get the calibration cam from the intensity cam 891 // 892 MCalibrationChargeCam *cam = (MCalibrationChargeCam*)GetCam(i); 893 894 // 895 // Get the calibration pix from the calibration cam 896 // 897 const MCalibrationChargePix &apix = (MCalibrationChargePix&)cam->GetAverageArea(aidx); 898 const Float_t charge = apix.GetConvertedMean(); 899 const Float_t chargeerr = apix.GetConvertedSigma(); 900 901 chargearea[i] = charge; 902 chargeareaerr[i] = chargeerr; 903 904 nr[i] = i; 905 nrerr[i] = 0.; 906 } 907 908 TGraphErrors *gr = new TGraphErrors(size, 909 nr.GetArray(),chargearea.GetArray(), 910 nrerr.GetArray(),chargeareaerr.GetArray()); 911 gr->SetTitle(Form("%s%3i","Averaged Charges Area Idx %d",aidx)); 912 gr->GetXaxis()->SetTitle("Camera Nr."); 913 gr->GetYaxis()->SetTitle("<Q> [FADC cnts]"); 914 return gr; 915 } 916 -
trunk/MagicSoft/Mars/mcalib/MCalibrationIntensityChargeCam.h
r5653 r5858 28 28 MCalibrationIntensityChargeCam(const char *name=NULL, const char *title=NULL); 29 29 30 // Setters31 void SetFFactorMethodValid ( const Bool_t b=kTRUE ) {32 ((MCalibrationChargeCam*)GetCam())->SetFFactorMethodValid(b); }33 void SetNumPhotonsBlindPixelMethod ( const Float_t f ) {34 ((MCalibrationChargeCam*)GetCam())->SetNumPhotonsBlindPixelMethod(f); }35 void SetNumPhotonsFFactorMethod ( const Float_t f ) {36 ((MCalibrationChargeCam*)GetCam())->SetNumPhotonsFFactorMethod (f); }37 void SetNumPhotonsPINDiodeMethod ( const Float_t f ) {38 ((MCalibrationChargeCam*)GetCam())->SetNumPhotonsPINDiodeMethod (f); }39 void SetNumPhotonsBlindPixelMethodErr( const Float_t f ) {40 ((MCalibrationChargeCam*)GetCam())->SetNumPhotonsBlindPixelMethodErr(f); }41 void SetNumPhotonsFFactorMethodErr ( const Float_t f ) {42 ((MCalibrationChargeCam*)GetCam())->SetNumPhotonsFFactorMethodErr(f); }43 void SetNumPhotonsPINDiodeMethodErr ( const Float_t f ) {44 ((MCalibrationChargeCam*)GetCam())->SetNumPhotonsPINDiodeMethodErr(f); }45 46 30 Int_t CountNumValidEntries(const UInt_t pixid, const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE) const; 47 31 … … 52 36 TGraphErrors *GetPheVsChargePerArea( const Int_t aidx, const MCalibrationCam::PulserColor_t col=MCalibrationCam::kNONE); 53 37 TH2F *GetRazmikPlotResults( const Int_t aidx, const MGeomCam &geom ); 38 39 TGraphErrors *GetPhePerAreaVsTime( const Int_t aidx, const MGeomCam &geom ); 40 TGraphErrors *GetChargePerAreaVsTime( const Int_t aidx, const MGeomCam &geom ); 41 TGraphErrors *GetVarPerAreaVsTime( const Int_t aidx, const MGeomCam &geom, const Option_t *opt ); 42 43 TGraphErrors *GetVarVsTime( const Int_t pixid , const Option_t *opt ); 54 44 55 45 ClassDef(MCalibrationIntensityChargeCam, 1) // Container Intensity Charge Calibration Results Camera -
trunk/MagicSoft/Mars/mcalib/Makefile
r5857 r5858 21 21 INCLUDES = -I. -I../mbase -I../mgui -I../mgeom -I../mhcalib -I../mhbase \ 22 22 -I../manalysis -I../mraw -I../mtools -I../mmc -I../mhist \ 23 -I../mimage -I../msignal -I../mbadpixels -I../mpedestal \ 24 -I../mtrigger 25 23 -I../mimage -I../msignal -I../mbadpixels -I../mpedestal 26 24 # mhbase: MBinning MH 27 25 # mgui: MCamEvent (McalibrationCam) -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc
r5851 r5858 81 81 82 82 #include "MRawRunHeader.h" 83 #include "MTriggerPattern.h"84 83 85 84 ClassImp(MHCalibrationCam); … … 121 120 fColor(MCalibrationCam::kNONE), fIntensBad(NULL), 122 121 fBadPixels(NULL), fIntensCam(NULL), fCam(NULL), fGeom(NULL), 123 fRunHeader(NULL), fTrigPattern(NULL), fInterlacedFlags(0), 124 fMaskInterlaced(0) 122 fRunHeader(NULL) 125 123 { 126 124 … … 151 149 SetOscillations(kTRUE); 152 150 SetSizeCheck (kTRUE); 153 SetInterlaced (kFALSE);154 151 } 155 152 … … 515 512 } 516 513 517 if (IsInterlaced())518 {519 fTrigPattern = (MTriggerPattern*)pList->FindObject("MTriggerPattern");520 if (!fTrigPattern)521 {522 *fLog << err << "MTriggerPattern not found... abort." << endl;523 return kFALSE;524 }525 if (IsInterlacedTypePed())526 fMaskInterlaced |= MTriggerPattern::kPedestal;527 if (IsInterlacedTypeCal())528 fMaskInterlaced |= MTriggerPattern::kCalibration;529 if (IsInterlacedTypePin())530 fMaskInterlaced |= MTriggerPattern::kPinDiode;531 }532 533 514 return SetupHists(pList); 534 515 } … … 863 844 { 864 845 865 if (IsInterlaced())866 // check whether one of the bits in fMaskInterlaced is set in the trigger pattern867 if (!(fTrigPattern->GetPrescaled() & fMaskInterlaced))868 return kTRUE;869 870 846 if (!IsSizeCheck()) 871 847 return FillHists(par,w); -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.h
r5851 r5858 29 29 class MGeomCam; 30 30 class MRawRunHeader; 31 class MTriggerPattern;32 31 class MCalibrationIntensityCam; 33 32 class MCalibrationCam; … … 89 88 MGeomCam *fGeom; //! Camera geometry 90 89 MRawRunHeader *fRunHeader; //! Run Header 91 MTriggerPattern *fTrigPattern; //! Trigger Pattern92 90 93 91 TOrdCollection *fHiGainArray; // Array of calibration pixels, one per pixel … … 97 95 98 96 enum { kDebug, kLoGain, kAverageing, 99 kOscillations, kSizeCheck, 100 kInterlaced }; // Possible global flags 97 kOscillations, kSizeCheck }; // Possible global flags 101 98 102 99 Byte_t fFlags; // Bit-field to hold the global flags 103 104 enum InterlacedMode_t105 {106 kInterlacedPed = BIT(0),107 kInterlacedCal = BIT(1),108 kInterlacedPin = BIT(2)109 }; // Possible interlaced event types to be treated110 111 Byte_t fInterlacedFlags; // Bit-field to hold the interlaced flags112 Byte_t fMaskInterlaced; // Mask to define the interlaced event types113 100 114 101 virtual Bool_t SetupHists ( const MParList *pList ) { return kTRUE; } … … 157 144 Bool_t IsOscillations() const { return TESTBIT(fFlags,kOscillations); } 158 145 Bool_t IsSizeCheck () const { return TESTBIT(fFlags,kSizeCheck); } 159 Bool_t IsInterlaced () const { return TESTBIT(fFlags,kInterlaced); } 160 161 Bool_t IsInterlacedTypePed() const { return TESTBIT(fInterlacedFlags,kInterlacedPed); } 162 Bool_t IsInterlacedTypeCal() const { return TESTBIT(fInterlacedFlags,kInterlacedCal); } 163 Bool_t IsInterlacedTypePin() const { return TESTBIT(fInterlacedFlags,kInterlacedPin); } 164 146 165 147 void Remove ( TOrdCollection *col ); 166 148 … … 222 204 ? SETBIT(fFlags,kSizeCheck) 223 205 : CLRBIT(fFlags,kSizeCheck); } 224 void SetInterlaced ( const Bool_t b=kTRUE ) { b225 ? SETBIT(fFlags,kInterlaced)226 : CLRBIT(fFlags,kInterlaced); }227 228 void SetInterlacedTypePed() { SETBIT(fInterlacedFlags,kInterlacedPed); }229 void SetInterlacedTypeCal() { SETBIT(fInterlacedFlags,kInterlacedCal); }230 void SetInterlacedTypePin() { SETBIT(fInterlacedFlags,kInterlacedPin); }231 232 206 void SetHistName ( const char *name ) { fHistName = name; } 233 207 void SetHistTitle ( const char *name ) { fHistTitle = name; } -
trunk/MagicSoft/Mars/mhcalib/MHCalibrationRelTimeCam.cc
r5849 r5858 282 282 283 283 InitHiGainArrays(npixels,nareas,nsectors); 284 if (IsLoGain()) 285 InitLoGainArrays(npixels,nareas,nsectors); 284 InitLoGainArrays(npixels,nareas,nsectors); 286 285 287 286 fSumareahi .Set(nareas); -
trunk/MagicSoft/Mars/mjobs/MJCalibrateSignalFromOutside.h
r5683 r5858 43 43 Byte_t fStorage; // Bit-field for chosen storage type 44 44 45 Bool_t fInterlaced; // Distinguish interlaced from other calibrations 46 45 47 Bool_t IsNoStorage () const { return TESTBIT(fStorage,kNoStorage); } 46 48 Bool_t IsHistsStorage () const { return TESTBIT(fStorage,kHistsStorage); } … … 66 68 void SetNoStorage ( const Bool_t b=kTRUE ) { b ? SETBIT(fStorage,kNoStorage) : CLRBIT(fStorage,kNoStorage); } 67 69 void SetHistsStorage ( const Bool_t b=kTRUE ) { b ? SETBIT(fStorage,kHistsStorage) : CLRBIT(fStorage,kHistsStorage); } 70 void SetInterlaced ( const Bool_t b=kTRUE ) { fInterlaced = b; } 68 71 69 72 Bool_t ProcessFile(MPedestalCam &camab, MPedestalCam &cam, MCalibrationChargeCam &chargecam,
Note:
See TracChangeset
for help on using the changeset viewer.