Changeset 845
- Timestamp:
- 06/12/01 13:27:42 (24 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r844 r845 18 18 - use of SetHasChanged added 19 19 20 * manalysis/MPedCalcPedRun.[h,cc]: 21 - made fNumHiGainSamples a class member 22 - renamed some member functions 23 - made the 'internal' member functions private 24 - added SetHasChanged 25 - made these functions const 26 20 27 * mbase/BaseLinkDef.h 21 28 - MWriteAsciiFile added -
trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.cc
r841 r845 17 17 ! 18 18 ! Author(s): Josep Flix 04/2001 (jflix@ifae.es) 19 ! Thomas Bretz 05/2001 (tbretz@uni-sw.gwdg.de) 19 20 ! 20 21 ! Copyright: MAGIC Software Development, 2000-2001 … … 61 62 fPedestals = (MPedestalCam*)pList->FindCreateObj("MPedestalCam"); 62 63 if (!fPedestals) 63 {64 *fLog << dbginf << "MPedestalCam not found... aborting." << endl;65 64 return kFALSE; 66 } 65 66 fNumHiGainSamples = fRawEvt->GetNumHiGainSamples(); 67 67 68 68 return kTRUE; … … 72 72 Bool_t MPedCalcPedRun::Process() 73 73 { 74 75 74 MRawEvtPixelIter pixel(fRawEvt); 76 const Byte_t HiGainSamples = fRawEvt->GetNumHiGainSamples();77 75 78 76 while (pixel.Next()) 79 77 { 78 Byte_t *ptr = pixel.GetHiGainFadcSamples(); 79 const Byte_t *end = ptr + fRawEvt->GetNumHiGainSamples(); 80 81 const Float_t higainped = CalcHiGainMean(ptr, end); 82 const Float_t higainrms = CalcHiGainRms(ptr, end, higainped); 83 84 const Float_t higainpederr = CalcHiGainMeanErr(higainrms); 85 const Float_t higainrmserr = CalcHiGainRmsErr(higainrms); 86 80 87 const UInt_t pixid = pixel.GetPixelId(); 88 MPedestalPix &pix = (*fPedestals)[pixid]; 81 89 82 Byte_t *ptr = pixel.GetHiGainFadcSamples(); 83 const Byte_t *end = ptr + HiGainSamples; 84 85 Float_t HiGainPed = PedMeanCalcHiGain(ptr,end,HiGainSamples); 86 Float_t HiGainRms = PedRmsCalcHiGain(ptr,end,HiGainPed,HiGainSamples); 87 88 Float_t HiGainPedErr = PedMeanErrCalcHiGain(HiGainRms,HiGainSamples); 89 Float_t HiGainRmsErr = PedRmsErrCalcHiGain(HiGainRms,HiGainSamples); 90 91 (*fPedestals)[pixid].SetPedestal(HiGainPed,HiGainRms); 92 (*fPedestals)[pixid].SetPedestalRms(HiGainPedErr,HiGainRmsErr); 93 90 pix.SetPedestal(higainped, higainrms); 91 pix.SetPedestalRms(higainpederr, higainrmserr); 94 92 } 95 93 94 fPedestals->SetHasChanged(); 95 96 96 return kTRUE; 97 } 97 98 99 Float_t MPedCalcPedRun::CalcHiGainMean(Byte_t *ptr, const Byte_t *end) const 100 { 101 Int_t sum=0; 102 103 do sum += *ptr; 104 while (++ptr != end); 105 106 return (Float_t)sum/fNumHiGainSamples; 98 107 } 99 108 100 109 110 Float_t MPedCalcPedRun::CalcHiGainRms(Byte_t *ptr, const Byte_t *end, Float_t higainped) const 111 { 112 Float_t rms = 0; 101 113 102 Float_t MPedCalcPedRun::PedMeanCalcHiGain(Byte_t *ptr, const Byte_t *end, const Byte_t HiGainSamples) 103 {104 Float_t sum=0;114 do 115 { 116 const Float_t diff = (Float_t)(*ptr)-higainped; 105 117 106 do sum += *ptr++;107 while (ptr != end);118 rms += diff*diff; 119 } while (++ptr != end); 108 120 109 sum = sum/(Int_t)HiGainSamples; 110 111 return sum; 121 return sqrt(rms/(fNumHiGainSamples-1)); 112 122 } 113 123 114 115 Float_t MPedCalcPedRun::PedRmsCalcHiGain(Byte_t *ptr, const Byte_t *end, Float_t HiGainPed, const Byte_t HiGainSamples) 124 Float_t MPedCalcPedRun::CalcHiGainMeanErr(Float_t higainrms) const 116 125 { 117 118 Float_t rms = 0; 119 120 do{ 121 rms = rms + (*ptr - HiGainPed)*(*ptr - HiGainPed); 122 *ptr++; 123 }while (ptr != end); 124 125 rms = sqrt((Float_t)rms/((Int_t)HiGainSamples-1)); 126 127 return rms; 126 return higainrms/sqrt(fNumHiGainSamples); 128 127 } 129 128 130 131 Float_t MPedCalcPedRun::PedMeanErrCalcHiGain(Float_t HiGainRms, const Byte_t HiGainSamples){132 return HiGainRms/sqrt((Int_t)HiGainSamples);129 Float_t MPedCalcPedRun::CalcHiGainRmsErr(Float_t higainrms) const 130 { 131 return higainrms/sqrt(2.*fNumHiGainSamples); 133 132 } 134 133 135 136 Float_t MPedCalcPedRun::PedRmsErrCalcHiGain(Float_t HiGainRms, const Byte_t HiGainSamples){137 return HiGainRms/sqrt(2*(Int_t)HiGainSamples);138 }139 -
trunk/MagicSoft/Mars/manalysis/MPedCalcPedRun.h
r840 r845 19 19 class MPedCalcPedRun : public MTask 20 20 { 21 Byte_t fNumHiGainSamples; 21 22 22 23 MRawEvtData *fRawEvt; // raw event data (time slices) 23 24 MPedestalCam *fPedestals; // Pedestals of all pixels in the camera 25 26 Float_t CalcHiGainMean(Byte_t *ptr, const Byte_t *end) const; 27 Float_t CalcHiGainRms(Byte_t *ptr, const Byte_t *end, Float_t higainped) const; 28 Float_t CalcHiGainMeanErr(Float_t higainrms) const; 29 Float_t CalcHiGainRmsErr(Float_t higainrms) const; 24 30 25 31 public: … … 30 36 Bool_t Process(); 31 37 32 Float_t PedMeanCalcHiGain(Byte_t *ptr, const Byte_t *end, const Byte_t HiGainSamples);33 Float_t PedRmsCalcHiGain(Byte_t *ptr, const Byte_t *end, Float_t HiGainPed, const Byte_t HiGainSamples);34 Float_t PedMeanErrCalcHiGain(Float_t HiGainRms, const Byte_t HiGainSamples);35 Float_t PedRmsErrCalcHiGain(Float_t HiGainRms, const Byte_t HiGainSamples);36 37 38 ClassDef(MPedCalcPedRun, 0) // Task to calculate pedestals from pedestal runs raw data 38 39 };
Note:
See TracChangeset
for help on using the changeset viewer.