- Timestamp:
- 02/11/04 18:35:50 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r3094 r3102 4 4 5 5 -*-*- END OF LINE -*-*- 6 7 2004/02/11: Hendrik Bartko 8 * manalysis/MExtractSignal2 (Signal Extraction with a Sliding Window) 9 - introduced a validity check for the set-function of the window size (even number of slices, WindowSize < NumberSlices) 10 * manalysis/MArrivalTimeCalc2 (Arrival Time Calculation with a Sliding Window) 11 - introduced the calculation of the arrival time as the signal weighted mean of the time slices in the maximum window 12 13 6 14 2004/02/11: Markus Gaug 7 15 * mcalib/MCalibrationCalc.cc -
trunk/MagicSoft/Mars/manalysis/MExtractSignal2.cc
r3094 r3102 17 17 ! 18 18 ! Author(s): Thomas Bretz, 02/2004 <mailto:tbretz@astro.uni-wuerzburg.de> 19 ! Hendrik Bartko, 01/2004 <mailto:hbartko@mppmu.mpg.de> 19 20 ! 20 21 ! Copyright: MAGIC Software Development, 2000-2004 … … 27 28 // MExtractSignal2 28 29 // 29 // Calculate the signal as the fWindow time slices which have the highest30 // Calculate the signal as the fWindowSize time slices which have the highest 30 31 // integral contents. 31 32 // 32 // Calculation of arrival time not yet implemented33 // 33 34 // 34 35 ////////////////////////////////////////////////////////////////////////////// … … 49 50 #include "MExtractedSignalPix.h" 50 51 52 //#include "MArrivalTime.h" 53 51 54 ClassImp(MExtractSignal2); 52 55 … … 54 57 55 58 const Byte_t MExtractSignal2::fgSaturationLimit = 254; 56 const Byte_t MExtractSignal2::fgFirst = 2;59 const Byte_t MExtractSignal2::fgFirst = 0; 57 60 const Byte_t MExtractSignal2::fgLast = 14; 58 const Byte_t MExtractSignal2::fgWindow = 8;61 const Byte_t MExtractSignal2::fgWindowSize = 6; 59 62 60 63 // -------------------------------------------------------------------------- … … 74 77 } 75 78 76 void MExtractSignal2::SetRange(Byte_t first, Byte_t last, Byte_t window) 77 { 78 79 fNumHiGainSamples = last-first+1; 80 fNumLoGainSamples = last-first+1; 81 82 fHiGainFirst = first; 83 fLoGainFirst = first; 84 85 fWindow = window & ~1; 86 fWindowSqrt = TMath::Sqrt((Float_t)fWindow); 87 88 if (fWindow==window) 89 return; 90 91 *fLog << warn << "MExtractSignal2::SetRange - Window size set to even " << fWindow << endl; 92 } 79 void MExtractSignal2::SetRange(Byte_t hifirst, Byte_t hilast, Byte_t lofirst, Byte_t lolast, Byte_t windowsize) 80 { 81 82 fNumHiGainSamples = hilast-hifirst+1; 83 fNumLoGainSamples = lolast-lofirst+1; 84 85 fHiGainFirst = hifirst; 86 fLoGainFirst = lofirst; 87 88 89 fWindowSize = windowsize & ~1; 90 91 if (fWindowSize != windowsize) 92 *fLog << warn << "MExtractSignal2::SetRange - window size has to be even, set to: " << int(fWindowSize) << " samples " << endl; 93 94 if (fWindowSize<2) 95 { 96 fWindowSize = 2; 97 *fLog << warn << "MExtractSignal2::SetRange - window size set to two samples" << endl; 98 } 99 100 if (fWindowSize > fNumHiGainSamples) 101 { 102 fWindowSize = fNumLoGainSamples & ~1; 103 *fLog << warn << "MExtractSignal2::SetRange - window size set to " << int(fWindowSize) << " samples " << endl; 104 } 105 106 if (fWindowSize > fNumLoGainSamples) 107 { 108 fWindowSize = fNumLoGainSamples & ~1; 109 *fLog << warn << "MExtractSignal2::SetRange - window size set to " << int(fWindowSize) << " samples " << endl; 110 } 111 112 fWindowSizeSqrt = TMath::Sqrt((Float_t)fWindowSize); 113 114 } 115 116 93 117 94 118 // -------------------------------------------------------------------------- … … 126 150 return kFALSE; 127 151 } 152 /* 153 fArrivalTime = (MArrivalTime*)pList->FindCreateObj(AddSerialNumber("MArrivalTime")); 154 if (!fArrivalTime) 155 return kFALSE; 156 */ 128 157 return kTRUE; 129 158 } … … 136 165 137 166 // 138 // Calculate the sum of the first fWindow slices167 // Calculate the sum of the first fWindowSize slices 139 168 // 140 169 sat = 0; 141 170 Byte_t *p = ptr; 142 while (p<ptr+fWindow )171 while (p<ptr+fWindowSize) 143 172 { 144 173 sum += *p; … … 159 188 // This is fast and accurate (because we are using int's) 160 189 // 161 max= 0;162 for (p=ptr; p+fWindow <end; p++)163 { 164 sum += *(p+fWindow ) - *p;190 max=sum; 191 for (p=ptr; p+fWindowSize<end; p++) 192 { 193 sum += *(p+fWindowSize) - *p; 165 194 if (sum>max) 166 195 max = sum; … … 170 199 // -------------------------------------------------------------------------- 171 200 // 172 // Calculate the integral of the FADC of fWindow time slices which have the201 // Calculate the integral of the FADC of fWindowSize time slices which have the 173 202 // highest signal 174 203 // … … 178 207 fSignals->Clear(); 179 208 180 TString satpixels;181 209 Int_t sat=0; 182 183 210 while (pixel.Next()) 184 211 { … … 190 217 FindSignal(pixel.GetLoGainSamples()+fLoGainFirst, fNumLoGainSamples, sumlo, satlo); 191 218 if (satlo) 192 {193 219 sat++; 194 satpixels += Form("%d%s",pixel.GetPixelId()," "); 195 } 196 220 197 221 // 198 222 // Take correspodning pedestal … … 209 233 // Set extracted signal with pedestal substracted 210 234 // 211 pix.SetExtractedSignal(sumhi - pedes*fWindow , pedrms*fWindowSqrt,212 sumlo - pedes*fWindow , pedrms*fWindowSqrt);235 pix.SetExtractedSignal(sumhi - pedes*fWindowSize, pedrms*fWindowSizeSqrt, 236 sumlo - pedes*fWindowSize, pedrms*fWindowSizeSqrt); 213 237 214 238 pix.SetGainSaturation(sathi, sathi, satlo); … … 219 243 // 220 244 if (sat) 221 *fLog << warn << "WARNING - Lo Gain saturated in " << sat << " pixels: " << satpixels<< endl;245 *fLog << warn << "WARNING - Lo Gain saturated in " << sat << " pixels." << endl; 222 246 223 247 fSignals->SetReadyToSave();
Note:
See TracChangeset
for help on using the changeset viewer.