Changeset 8564
- Timestamp:
- 06/16/07 22:59:26 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/mpedestal
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.cc
r8519 r8564 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.3 1 2007-05-16 13:56:17tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MExtractPedestal.cc,v 1.32 2007-06-16 21:59:19 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 179 179 const TString MExtractPedestal::fgNameRawEvtData = "MRawEvtData"; 180 180 181 const UShort_t MExtractPedestal::fgCheckWinFirst = 0; 182 const UShort_t MExtractPedestal::fgCheckWinLast = 29; 183 const UShort_t MExtractPedestal::fgMaxSignalVar = 40; 181 const UShort_t MExtractPedestal::fgCheckWinFirst = 0; 182 const UShort_t MExtractPedestal::fgCheckWinLast = 29; 183 const UShort_t MExtractPedestal::fgMaxSignalVar = 40; 184 const UShort_t MExtractPedestal::fgMaxSignalAbs = 250; 184 185 185 186 // -------------------------------------------------------------------------- … … 210 211 SetCheckRange(fgCheckWinFirst, fgCheckWinLast); 211 212 SetMaxSignalVar(fgMaxSignalVar); 213 SetMaxSignalAbs(fgMaxSignalAbs); 212 214 213 215 Clear(); … … 598 600 // 599 601 // Check whether the signal variation between fCheckWinFirst and fCheckWinLast 600 // exceeds fMaxSignalVar or the signal is greater than 250602 // exceeds fMaxSignalVar or the signal is greater than fMaxSignalAbs 601 603 // 602 604 Bool_t MExtractPedestal::CheckVariation(UInt_t idx) const 603 605 { 604 606 // This is the fast workaround to put hi- and lo-gains together 605 Byte_t *slices = fSignal->GetSamplesRaw(idx);607 USample_t *slices = fSignal->GetSamplesRaw(idx); 606 608 607 609 // Start 'real' work 608 U Int_t max = 0;609 U Int_t min = (UInt_t)-1;610 USample_t max = 0; 611 USample_t min = (USample_t)-1; 610 612 611 613 // Find the maximum and minimum signal per slice in the high gain window 612 for ( Byte_t *slice=slices+fCheckWinFirst; slice<=slices+fCheckWinLast; slice++)614 for (USample_t *slice=slices+fCheckWinFirst; slice<=slices+fCheckWinLast; slice++) 613 615 { 614 616 if (*slice > max) … … 620 622 // If the maximum in the high gain window is smaller than 621 623 // FIXME: Precompiled value! 622 return max-min<fMaxSignalVar && max< 250;624 return max-min<fMaxSignalVar && max<fMaxSignalAbs; 623 625 } 624 626 … … 648 650 649 651 // Do some handling if maxpos is last slice? 650 const Int_t maxposhi = f Signal->GetMaxPos(idx, start, start+range-1);652 const Int_t maxposhi = fRandomCalculation ? 0 : fSignal->GetMaxPos(idx, start, start+range-1); 651 653 652 654 const Float_t *sig = fSignal->GetSamples(idx); … … 659 661 dummy[0], dummy[1], dummy[2], 660 662 0, maxposhi); 663 661 664 return sum; 662 665 } … … 672 675 const Int_t first = fExtractWinFirst+offset; 673 676 674 Byte_t *ptr = fSignal->GetSamplesRaw(pixel.GetPixelId())+first;675 Byte_t *end = ptr + fExtractWinSize;677 USample_t *ptr = fSignal->GetSamplesRaw(pixel.GetPixelId())+first; 678 USample_t *end = ptr + fExtractWinSize; 676 679 677 680 Int_t abflag = pixel.HasABFlag() + first; … … 786 789 // multiplies by this number 787 790 791 // scale to 256 792 const UInt_t scale = fExtractor ? 1 : fRunHeader->GetScale(); 793 794 ped /= scale; 795 abOffs /= scale; 796 788 797 // 5. Calculate the RMS from the Variance: 789 const Double_t rms = var<0 ? 0 : TMath::Sqrt(var) ;798 const Double_t rms = var<0 ? 0 : TMath::Sqrt(var)/scale; 790 799 791 800 // abOffs contains only half of the signal as ped. … … 834 843 // multiplies by this number 835 844 845 // scale to 256 846 const UInt_t scale = fExtractor ? 1 : fRunHeader->GetScale(); 847 836 848 // 5. Scale the mean, variance and AB-noise to the number of pixels: 837 ped /= napix; 838 var /= napix; 839 abOffs /= napix; 849 ped /= napix*scale; 850 abOffs /= napix*scale; 840 851 841 852 // 6. Calculate the RMS from the Variance: 842 const Double_t rms = var<0 ? 0 : TMath::Sqrt(var) ;853 const Double_t rms = var<0 ? 0 : TMath::Sqrt(var)/scale; 843 854 844 855 // abOffs contains only half of the signal as ped. … … 887 898 // multiplies by this number 888 899 900 // scale to 256 901 const UInt_t scale = fExtractor ? 1 : fRunHeader->GetScale(); 902 889 903 // 5. Scale the mean, variance and AB-noise to the number of pixels: 890 ped /= nspix; 891 var /= nspix; 892 abOffs /= nspix; 904 ped /= nspix*scale; 905 abOffs /= nspix*scale; 893 906 894 907 // 6. Calculate the RMS from the Variance: 895 const Double_t rms = var<0 ? 0 : TMath::Sqrt(var) ;908 const Double_t rms = var<0 ? 0 : TMath::Sqrt(var)/scale; 896 909 897 910 // abOffs contains only half of the signal as ped. … … 947 960 *fLog << "CheckWindow from slice " << fCheckWinFirst << " to " << fCheckWinLast << " incl." << endl; 948 961 *fLog << "Max.allowed signal variation: " << fMaxSignalVar << endl; 962 *fLog << "Max.allowed signal absolute: " << fMaxSignalAbs << endl; 949 963 } 950 964 … … 1020 1034 } 1021 1035 1036 if (IsEnvDefined(env, prefix, "MaxSignalAbs", print)) 1037 { 1038 SetMaxSignalAbs(GetEnvValue(env, prefix, "MaxSignalAbs", fMaxSignalAbs)); 1039 rc = kTRUE; 1040 } 1041 1042 // find resource for MPedestalCam 1022 1043 if (IsEnvDefined(env, prefix, "NamePedestalCamInter", print)) 1023 1044 { … … 1034 1055 return rc; 1035 1056 } 1036 -
trunk/MagicSoft/Mars/mpedestal/MExtractPedestal.h
r8498 r8564 24 24 class MRawEvtPixelIter; 25 25 26 //typedef UShort_t USample_t; 27 typedef Byte_t USample_t; 28 26 29 class MExtractPedestal : public MTask 27 30 { … … 33 36 static const UShort_t fgCheckWinLast; //! Last FADC slice to check for signal (currently set to: 29) 34 37 static const UShort_t fgMaxSignalVar; //! The maximum difference between the highest and lowest slice 38 static const UShort_t fgMaxSignalAbs; //! The maximum absolte slice 35 39 36 40 TString fNamePedestalCamOut; // Name of the outgoing 'MPedestalCam' container … … 64 68 65 69 UShort_t fMaxSignalVar; 70 UShort_t fMaxSignalAbs; 66 71 67 72 Bool_t fUseSpecialPixels; // Flag if the special pixels shall be treated … … 125 130 virtual Bool_t SetRangeFromExtractor(const MExtractor &ext) = 0; 126 131 127 void SetMaxSignalVar(UShort_t maxvar=40) { fMaxSignalVar = maxvar; } 132 void SetMaxSignalVar(UShort_t maxvar=40) { fMaxSignalVar = maxvar; } 133 void SetMaxSignalAbs(UShort_t maxabs=250) { fMaxSignalAbs = maxabs; } 128 134 129 135 // names
Note:
See TracChangeset
for help on using the changeset viewer.