Changeset 4340 for trunk/MagicSoft/Mars/msignal
- Timestamp:
- 06/23/04 02:00:32 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/msignal
- Files:
-
- 2 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.cc
r4298 r4340 186 186 // - If *logain is greater than fSaturationLimit, raise sat by 1 187 187 // 188 void MExtractFixedWindow::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const 189 { 188 void MExtractFixedWindow::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const 189 { 190 191 Int_t summ = 0; 190 192 191 193 Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1; … … 193 195 while (ptr<end) 194 196 { 195 sum += *ptr;197 summ += *ptr; 196 198 if (*ptr++ >= fSaturationLimit) 197 199 sat++; 198 200 } 199 201 200 if (fHiLoLast == 0) 201 return; 202 202 Byte_t *p = logain; 203 203 end = logain + fHiLoLast; 204 while (logain<end) 205 { 206 sum += *logain; 207 208 if (*logain++ >= fSaturationLimit) 204 while (p<end) 205 { 206 summ += *p; 207 if (*p++ >= fSaturationLimit) 209 208 sat++; 210 209 } 210 211 sum = (Float_t)summ; 212 213 return; 211 214 } 212 215 … … 221 224 // - Add contents of *logain to sum 222 225 // 223 void MExtractFixedWindow::FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const 224 { 226 void MExtractFixedWindow::FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const 227 { 228 229 Int_t summ = 0; 225 230 226 231 Byte_t *end = ptr + fLoGainLast - fLoGainFirst + 1; … … 228 233 while (ptr<end) 229 234 { 230 sum += *ptr;235 summ += *ptr; 231 236 232 237 if (*ptr++ >= fSaturationLimit) 233 238 sat++; 234 239 } 240 241 sum = (Float_t)summ; 235 242 } 236 243 -
trunk/MagicSoft/Mars/msignal/MExtractFixedWindow.h
r3951 r4340 22 22 static const Byte_t fgLoGainLast; // Last FADC slice Lo-Gain (currently set to: 14) 23 23 24 void FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const;25 void FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const;24 void FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const; 25 void FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const; 26 26 void StreamPrimitive(ofstream &out) const; 27 27 -
trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.cc
r4252 r4340 299 299 // - If *ptr is greater than fSaturationLimit, raise sat by 1 300 300 // 301 void MExtractFixedWindowPeakSearch::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const301 void MExtractFixedWindowPeakSearch::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const 302 302 { 303 303 304 304 Byte_t *end = ptr + fWindowSizeHiGain-fHiLoLast; 305 305 306 Int_t summ = 0; 306 307 // 307 308 // Calculate the sum of the "window" slices starting in ptr … … 309 310 while (ptr<end) 310 311 { 311 sum += *ptr;312 summ += *ptr; 312 313 if (*ptr++ >= fSaturationLimit) 313 314 sat++; … … 323 324 { 324 325 325 sum += *p;326 summ += *p; 326 327 if (*p++ >= fSaturationLimit) 327 328 sat++; 328 329 } 329 330 331 sum = (Float_t)summ; 330 332 return; 331 333 } … … 339 341 // - If *ptr is greater than fSaturationLimit, raise sat by 1 340 342 // 341 void MExtractFixedWindowPeakSearch::FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const343 void MExtractFixedWindowPeakSearch::FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const 342 344 { 343 345 // … … 345 347 // 346 348 Byte_t *p = ptr; 349 Int_t summ = 0; 347 350 348 351 while (p<ptr+fWindowSizeLoGain) 349 352 { 350 sum += *p;353 summ += *p; 351 354 if (*p++ >= fSaturationLimit) 352 355 sat++; 353 356 } 354 357 358 sum = (Float_t)summ; 355 359 return; 356 360 } … … 417 421 // Find signal in hi- and lo-gain 418 422 // 419 Int_t sumhi=0;423 Float_t sumhi=0.; 420 424 Byte_t sathi=0; 421 425 422 426 FindSignalHiGain(pixel.GetHiGainSamples()+hiGainFirst, pixel.GetLoGainSamples(), sumhi, sathi); 423 427 424 Int_t sumlo=0;428 Float_t sumlo=0.; 425 429 Byte_t satlo=0; 426 430 if (pixel.HasLoGain()) … … 449 453 450 454 pix.SetGainSaturation(sathi, sathi, satlo); 455 456 // pix.SetNumHiGainSlices(fNumHiGainSamples); 457 // pix.SetNumLoGainSlices(fNumLoGainSamples); 458 451 459 } /* while (pixel.Next()) */ 452 460 -
trunk/MagicSoft/Mars/msignal/MExtractFixedWindowPeakSearch.h
r4252 r4340 26 26 Byte_t fLowGainPeakShift; // Shift of the low gain pulse with respect to the high gain pulse, in slices: it is 0 if the low gain is delayed with respect to HG by 15 slices. 27 27 28 void FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const;29 void FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const;28 void FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const; 29 void FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const; 30 30 31 31 void FindPeak(Byte_t *ptr, Byte_t window, Byte_t &startslice, Int_t &signal, Int_t &sat) const; -
trunk/MagicSoft/Mars/msignal/MExtractFixedWindowSpline.cc
r4276 r4340 224 224 // - If *logain is greater than fSaturationLimit, raise sat by 1 225 225 // 226 void MExtractFixedWindowSpline::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const226 void MExtractFixedWindowSpline::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const 227 227 { 228 228 … … 236 236 fHiGainFirstDeriv[0] = 0.; 237 237 238 Float_t sumf = *ptr++/2.; 238 Int_t summ = 0; 239 sum = (Float_t)*ptr++/2.; 239 240 // 240 241 // Check for saturation in all other slices … … 243 244 { 244 245 245 sum f+= *ptr;246 summ += *ptr; 246 247 i++; 247 248 … … 260 261 if (fHiLoLast == 0) 261 262 { 262 sum f +=*ptr/2.;263 sum += (Float_t)*ptr/2.; 263 264 fHiGainSecondDeriv[++i] = 0.; 264 265 … … 266 267 else 267 268 { 268 sum f+= *ptr;269 summ += *ptr; 269 270 i++; 270 271 … … 279 280 { 280 281 281 sum f+= *logain;282 summ += *logain; 282 283 i++; 283 284 … … 291 292 292 293 } 293 sum f +=*logain/2;294 sum += (Float_t)*logain/2; 294 295 fHiGainSecondDeriv[++i] = 0.; 295 296 } … … 298 299 { 299 300 fHiGainSecondDeriv[k] = fHiGainSecondDeriv[k]*fHiGainSecondDeriv[k+1] + fHiGainFirstDeriv[k]; 300 sum f+= 0.25*fHiGainSecondDeriv[k];301 } 302 303 sum = (Int_t)sumf;301 sum += 0.25*fHiGainSecondDeriv[k]; 302 } 303 304 sum += (Float_t)summ; 304 305 } 305 306 … … 312 313 // - If *ptr is greater than fSaturationLimit, raise sat by 1 313 314 // 314 void MExtractFixedWindowSpline::FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const315 void MExtractFixedWindowSpline::FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const 315 316 { 316 317 … … 324 325 fLoGainFirstDeriv[0] = 0.; 325 326 326 Float_t sumf = *ptr++/2.; 327 Int_t summ = 0; 328 sum = (Float_t)*ptr++/2.; 327 329 // 328 330 // Check for saturation in all other slices … … 331 333 { 332 334 333 sum f+= *ptr;335 summ += *ptr; 334 336 i++; 335 337 … … 346 348 sat++; 347 349 348 sum f +=*ptr/2.;350 sum += (Float_t)*ptr/2.; 349 351 fLoGainSecondDeriv[++i] = 0.; 350 352 … … 352 354 { 353 355 fLoGainSecondDeriv[k] = fLoGainSecondDeriv[k]*fLoGainSecondDeriv[k+1] + fLoGainFirstDeriv[k]; 354 sum f+= 0.25*fLoGainSecondDeriv[k];355 } 356 357 sum = (Int_t)sumf;358 } 359 356 sum += 0.25*fLoGainSecondDeriv[k]; 357 } 358 359 sum += (Float_t)summ; 360 } 361 -
trunk/MagicSoft/Mars/msignal/MExtractFixedWindowSpline.h
r4276 r4340 23 23 Bool_t ReInit (MParList *pList); 24 24 25 void FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &sum, Byte_t &sat) const;26 void FindSignalLoGain(Byte_t *ptr, Int_t &sum, Byte_t &sat) const;25 void FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const; 26 void FindSignalLoGain(Byte_t *ptr, Float_t &sum, Byte_t &sat) const; 27 27 28 28 public: -
trunk/MagicSoft/Mars/msignal/MExtractSlidingWindow.cc
r3951 r4340 215 215 // - Check if the sum has become bigger and store it in case yes. 216 216 // 217 void MExtractSlidingWindow::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &max, Byte_t &sat) const217 void MExtractSlidingWindow::FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &max, Byte_t &sat) const 218 218 { 219 219 const Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1; 220 220 221 221 Int_t sum=0; 222 Int_t sumtot =0; 222 223 223 224 // … … 259 260 // This is fast and accurate (because we are using int's) 260 261 // 261 max=sum;262 sumtot=sum; 262 263 for (p=ptr; p+fWindowSizeHiGain-fHiLoLast<end; p++) 263 264 { 264 265 sum += *(p+fWindowSizeHiGain-fHiLoLast) - *p; 265 if (sum> max)266 max= sum;266 if (sum>sumtot) 267 sumtot = sum; 267 268 } 268 269 … … 270 271 { 271 272 sum += *l - *p++; 272 if (sum> max)273 max= sum;274 } 275 273 if (sum>sumtot) 274 sumtot = sum; 275 } 276 max = (Float_t)sumtot; 276 277 } 277 278 … … 288 289 // - Check if the sum has become bigger and store it in case yes. 289 290 // 290 void MExtractSlidingWindow::FindSignalLoGain(Byte_t *ptr, Int_t &max, Byte_t &sat) const291 void MExtractSlidingWindow::FindSignalLoGain(Byte_t *ptr, Float_t &max, Byte_t &sat) const 291 292 { 292 293 const Byte_t *end = ptr + fLoGainLast - fLoGainFirst + 1; 293 294 294 295 Int_t sum=0; 295 296 Int_t sumtot=0; 296 297 // 297 298 // Calculate the sum of the first fWindowSize slices … … 318 319 // This is fast and accurate (because we are using int's) 319 320 // 320 max=sum;321 sumtot=sum; 321 322 for (p=ptr; p+fWindowSizeLoGain<end; p++) 322 323 { 323 324 sum += *(p+fWindowSizeLoGain) - *p; 324 if (sum>max) 325 max = sum; 326 } 327 } 328 325 if (sum>sumtot) 326 sumtot = sum; 327 } 328 max = (Float_t)sumtot; 329 } 330 331 -
trunk/MagicSoft/Mars/msignal/MExtractSlidingWindow.h
r3951 r4340 20 20 Byte_t fWindowSizeLoGain; // Number of Lo Gain slices in window 21 21 22 void FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Int_t &max, Byte_t &sat) const;23 void FindSignalLoGain(Byte_t *ptr, Int_t &max, Byte_t &sat) const;22 void FindSignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &max, Byte_t &sat) const; 23 void FindSignalLoGain(Byte_t *ptr, Float_t &max, Byte_t &sat) const; 24 24 25 25 Bool_t ReInit(MParList *pList); -
trunk/MagicSoft/Mars/msignal/MExtractor.cc
r4235 r4340 228 228 229 229 230 void MExtractor::FindSignalHiGain(Byte_t *firstused, Byte_t *logain, Int_t &sum, Byte_t &sat) const230 void MExtractor::FindSignalHiGain(Byte_t *firstused, Byte_t *logain, Float_t &sum, Byte_t &sat) const 231 231 { 232 232 return; 233 233 } 234 234 235 void MExtractor::FindSignalLoGain(Byte_t *firstused, Int_t &sum, Byte_t &sat) const235 void MExtractor::FindSignalLoGain(Byte_t *firstused, Float_t &sum, Byte_t &sat) const 236 236 { 237 237 return; … … 251 251 while (pixel.Next()) 252 252 { 253 Int_t sumhi = 0;253 Float_t sumhi = 0.; 254 254 Byte_t sathi = 0; 255 255 256 256 FindSignalHiGain(pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), sumhi, sathi); 257 257 258 Int_t sumlo = 0;258 Float_t sumlo = 0.; 259 259 Byte_t satlo = 0; 260 260 … … 269 269 const Float_t pedes = ped.GetPedestal(); 270 270 const Float_t pedrms = ped.GetPedestalRms(); 271 271 272 272 pix.SetExtractedSignal(sumhi - pedes*fNumHiGainSamples, pedrms*fSqrtHiGainSamples, 273 273 sumlo - pedes*fNumLoGainSamples, pedrms*fSqrtLoGainSamples); -
trunk/MagicSoft/Mars/msignal/Makefile
r4276 r4340 37 37 MExtractFixedWindowPeakSearch.cc \ 38 38 MExtractFixedWindowSpline.cc \ 39 MExtractAmplitudeSpline.cc \ 39 40 MExtractSignal.cc \ 40 41 MExtractSignal2.cc \ -
trunk/MagicSoft/Mars/msignal/SignalLinkDef.h
r4276 r4340 19 19 #pragma link C++ class MExtractFixedWindowPeakSearch+; 20 20 #pragma link C++ class MExtractFixedWindowSpline+; 21 #pragma link C++ class MExtractAmplitudeSpline+; 21 22 #pragma link C++ class MExtractPINDiode++; 22 23 #pragma link C++ class MExtractBlindPixel++;
Note:
See TracChangeset
for help on using the changeset viewer.