Changeset 8158 for trunk/MagicSoft/Mars/msignal
- Timestamp:
- 10/24/06 13:40:58 (18 years ago)
- Location:
- trunk/MagicSoft/Mars/msignal
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc
r8155 r8158 61 61 #include "MRawEvtPixelIter.h" 62 62 63 #include "MPedestalSubtractedEvt.h" 63 64 #include "MExtractedSignalBlindPixel.h" 64 65 65 66 #include "MPedestalCam.h" 66 67 #include "MPedestalPix.h" 68 69 #include "MCalibrationBlindCam.h" 70 #include "MCalibrationBlindPix.h" 71 72 #include "MExtralgoSpline.h" 67 73 68 74 ClassImp(MExtractBlindPixel); … … 78 84 const Float_t MExtractBlindPixel::fgResolution = 0.003; 79 85 const Float_t MExtractBlindPixel::gkOverflow = 300.; 86 80 87 // -------------------------------------------------------------------------- 81 88 // … … 92 99 // 93 100 MExtractBlindPixel::MExtractBlindPixel(const char *name, const char *title) 94 : fBlindPixel(0), fHiLoLast(0),fDataType(0)101 : fBlindPixel(0), /*fHiLoLast(0),*/ fDataType(0) 95 102 { 96 103 … … 102 109 SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast); 103 110 104 SetNumBlindPixels(); 111 // SetNumBlindPixels(); 112 fBlindPixelIdx.Set(1); 113 fBlindPixelIdx[0] = fgBlindPixelIdx; 105 114 106 115 Clear(); … … 128 137 fExtractionType = 0; 129 138 130 fBlindPixelIdx.Set(0); 131 SetBlindPixelIdx(); 139 fBlindPixelIdx.Set(1); 140 fBlindPixelIdx[0] = fgBlindPixelIdx; 141 } 142 143 void MExtractBlindPixel::SetBlindPixels(const MCalibrationBlindCam &cam) 144 { 145 const Int_t n = cam.GetSize(); 146 147 fBlindPixelIdx.Set(n); 148 for (Int_t i=0; i<n; i++) 149 fBlindPixelIdx[i] = cam[i].GetPixId(); 132 150 } 133 151 … … 138 156 139 157 fNumHiGainSamples = (Float_t)(fHiGainLast-fHiGainFirst+1); 140 if (lolast)141 fNumLoGainSamples = (Float_t)(fLoGainLast-fLoGainFirst+1);142 else158 // if (lolast) 159 // fNumLoGainSamples = (Float_t)(fLoGainLast-fLoGainFirst+1); 160 // else 143 161 fNumLoGainSamples = 0.; 144 162 … … 146 164 fSqrtLoGainSamples = TMath::Sqrt(fNumLoGainSamples); 147 165 148 fHiLoFirst = 0;149 fHiLoLast = 0;166 //fHiLoFirst = 0; 167 //fHiLoLast = 0; 150 168 } 151 169 … … 170 188 return kFALSE; 171 189 172 if (IsDataType(kRawEvt2)) 173 fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData2")); 174 else 175 fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber("MRawEvtData")); 176 190 const TString raw = IsDataType(kRawEvt2) ? "MRawEvtData2" : "MRawEvtData"; 191 const TString sig = IsDataType(kRawEvt2) ? "MPedestalSubtractedEvt2" : "MPedestalSubtractedEvt"; 192 193 fRawEvt = (MRawEvtData*)pList->FindObject(AddSerialNumber(raw), "MRawEvtData"); 177 194 if (!fRawEvt) 178 195 { 179 *fLog << err << GetDescriptor() 180 << Form("%s%s",IsDataType(kRawEvt2) ? "MRawEvtData2" : "MRawEvtData", 181 " not found... aborting.") << endl; 196 *fLog << err << raw << " [MRawEvtData] not found... aborting." << endl; 182 197 return kFALSE; 183 198 } 199 200 fSignal = (MPedestalSubtractedEvt*)pList->FindObject(AddSerialNumber(sig), "MPedestalSubtractedEvt"); 201 if (!fSignal) 202 { 203 *fLog << err << sig << " [MPedestalSubtractedEvt] not found... aborting." << endl; 204 return kFALSE; 205 } 206 184 207 return kTRUE; 185 208 } … … 204 227 { 205 228 206 for ( Int_t i=0;i<fNumBlindPixels;i++)207 fBlindPixel->SetBlindPixelIdx(fBlindPixelIdx.At(i),i);229 for (UInt_t i=0;i<fBlindPixelIdx.GetSize();i++) 230 fBlindPixel->SetBlindPixelIdx(fBlindPixelIdx[i], i); 208 231 209 232 fBlindPixel->SetExtractionType(fExtractionType); … … 223 246 } 224 247 } 225 248 /* 226 249 const Int_t higainsamples = fRunHeader->GetNumSamplesHiGain(); 227 250 const Int_t logainsamples = fRunHeader->GetNumSamplesLoGain(); … … 265 288 fHiLoLast = logainsamples ? diff : 0; 266 289 } 267 268 const Int_t range = fHi LoFirst ? fHiLoLast - fHiLoFirst + 1 : fHiGainLast - fHiGainFirst + fHiLoLast + 1;269 270 fHiGainSignal.Set(range);271 fHiGainSignal.Reset();290 */ 291 const Int_t range = fHiGainLast-fHiGainFirst+1; //fHiLoFirst ? fHiLoLast - fHiLoFirst + 1 : fHiGainLast - fHiGainFirst + fHiLoLast + 1; 292 293 // fHiGainSignal.Set(range); 294 // fHiGainSignal.Reset(); 272 295 273 296 fHiGainFirstDeriv.Set(range); … … 280 303 *fLog << inf << "Extracting " 281 304 << (IsExtractionType(kAmplitude) ? "Amplitude" : " Integral") 282 << " using " << range << " FADC samples from " 283 << (fHiLoFirst ? "Low Gain slice" : " High Gain slice") 284 << (fHiLoFirst ? (Int_t)fHiLoFirst : (Int_t)fHiGainFirst) 285 << " to (including) " 286 << (fHiLoLast ? "Low Gain slice" : "High Gain slice") 287 << (fHiLoLast ? (Int_t)fHiLoLast-1 : (Int_t)fHiGainLast) 288 << endl; 305 << " using " << range << " FADC samples from slice " 306 << (Int_t)fHiGainFirst << " to " << (Int_t)fHiGainLast << " (incl)" << endl; 289 307 290 308 if (IsExtractionType(kFilter)) 291 309 *fLog << inf << "Will use Filter using " 292 310 << (Int_t)(fLoGainLast-fLoGainFirst+1) << " FADC slices" 293 << " from High Gainslice " << (Int_t)fLoGainFirst294 << " to High Gain slice" << (Int_t)fLoGainLast << endl;311 << " from slice " << (Int_t)fLoGainFirst 312 << " to " << (Int_t)fLoGainLast << endl; 295 313 296 314 fBlindPixel->SetUsedFADCSlices(fHiGainFirst, range); … … 303 321 // 304 322 // FindSignalHiGain: 323 // 324 // - Loop from ptr to (ptr+fHiGainLast-fHiGainFirst) 325 // - Sum up contents of *ptr 326 // - If *ptr is greater than fSaturationLimit, raise sat by 1 327 // - If fHiLoLast is set, loop from logain to (logain+fHiLoLast) 328 // - Add contents of *logain to sum 329 // 330 /* 331 void MExtractBlindPixel::FindIntegral(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) 332 { 333 const Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1; 334 335 Int_t summ = 0; 336 while (p<end) 337 { 338 summ += *ptr; 339 340 if (*ptr++ >= fSaturationLimit) 341 sat++; 342 } 343 344 sum = (Float_t)summ; 345 } 346 */ 347 348 // -------------------------------------------------------------------------- 349 // 350 // FindSignalPhe: 305 351 // 306 352 // - Loop from ptr to (ptr+fHiGainLast-fHiGainFirst) … … 310 356 // - Add contents of *logain to sum 311 357 // 312 void MExtractBlindPixel::FindIntegral(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) 313 { 314 315 Int_t summ = 0; 316 Byte_t *p = ptr; 317 Byte_t *end = ptr + fHiGainLast - fHiGainFirst + 1; 318 319 if (fHiLoFirst == 0) 320 { 321 322 while (p<end) 323 { 324 summ += *ptr; 325 326 if (*p++ >= fSaturationLimit) 327 sat++; 328 } 329 330 } 331 332 p = logain + fHiLoFirst; 333 end = logain + fHiLoLast; 334 while (p<end) 335 { 336 summ += *p; 337 338 if (*p++ >= fSaturationLimit) 339 sat++; 340 } 341 342 sum = (Float_t)summ; 343 } 344 345 // -------------------------------------------------------------------------- 346 // 347 // FindSignalPhe: 348 // 349 // - Loop from ptr to (ptr+fHiGainLast-fHiGainFirst) 350 // - Sum up contents of *ptr 351 // - If *ptr is greater than fSaturationLimit, raise sat by 1 352 // - If fHiLoLast is set, loop from logain to (logain+fHiLoLast) 353 // - Add contents of *logain to sum 354 // 355 void MExtractBlindPixel::FindAmplitude(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) 356 { 357 358 //void MExtractBlindPixel::FindAmplitude(Float_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) 359 Float_t MExtractBlindPixel::FindAmplitude(Int_t idx, Int_t numsat) const 360 { 361 Int_t sat0 = fHiGainFirst; // First slice to extract and first saturating slice 362 Int_t sat1 = fHiGainLast; // Last slice to extract and last saturating slice 363 364 Int_t maxcont; 365 Int_t maxpos = fSignal->GetMax(idx, sat0, sat1, maxcont); 366 367 // numsat = fSignal->GetSaturation(idx, fSaturationLimit, sat0, sat1); 368 369 const Float_t *ptr = fSignal->GetSamples(idx); 370 const Int_t num = fHiGainLast-fHiGainFirst+1; 371 372 MExtralgoSpline s(ptr, num, fHiGainFirstDeriv.GetArray(), fHiGainSecondDeriv.GetArray()); 373 374 s.SetExtractionType(MExtralgoSpline::kAmplitude); 375 376 s.Extract(numsat, maxpos); 377 378 return s.GetSignal(); 379 /* 358 380 Int_t range = 0; 359 381 Int_t count = 0; … … 586 608 } 587 609 } 588 610 */ 589 611 } 590 612 … … 596 618 // - Sum up contents of *ptr 597 619 // - If *ptr is greater than fSaturationLimit, raise sat by 1 598 // 599 void MExtractBlindPixel::FindSignalFilter(Byte_t *ptr, Int_t &sum, Byte_t &sat) const 600 { 601 602 Byte_t *end = ptr + fLoGainLast - fLoGainFirst + 1; 620 // 621 /* 622 void MExtractBlindPixel::FindSignalFilter(Byte_t *ptr, Int_t range, Int_t &sum, Byte_t &sat) const 623 { 624 625 Byte_t *end = ptr + range; 603 626 604 627 while (ptr<end) … … 610 633 } 611 634 } 635 */ 612 636 613 637 // -------------------------------------------------------------------------- … … 624 648 625 649 for (UInt_t id=0;id<fBlindPixelIdx.GetSize();id++) 626 627 628 pixel.Jump(fBlindPixelIdx[id]);629 630 Int_t sum = 0; 631 Byte_t sat = 0;632 650 { 651 // Be carefull: GetSaturation changed sat0 and sat1 652 Int_t sat0 = fHiGainFirst; // First slice to extract and first saturating slice 653 Int_t sat1 = fHiGainLast; // Last slice to extract and last saturating slice 654 655 const Int_t sat = fSignal->GetSaturation(fBlindPixelIdx[id], fSaturationLimit, sat0, sat1); 656 633 657 if (IsExtractionType(kFilter)) 634 658 { 635 636 FindSignalFilter(pixel.GetHiGainSamples()+fLoGainFirst, sum, sat); 637 659 // FIXME: fLoGain* is used to determine the FILTER/CHECK range 660 const Int_t numh = pixel.GetNumHiGainSamples(); 661 662 const Int_t sum = fSignal->GetIntegralRaw(fBlindPixelIdx[id], fLoGainFirst+numh, fLoGainLast+numh); 638 663 if (sum > fNSBFilterLimit) 639 664 { … … 644 669 } 645 670 671 /* 646 672 sum = 0; 647 673 if (pixel.HasLoGain()) 648 FindSignalFilter(pixel.GetLoGainSamples(), sum, sat); 649 650 /* 674 FindSignalFilter(sl+pixel.GetNumLoGainSamples()+fLoGainFirst, fLoGainLast - fLoGainFirst + 1, sum, sat); 675 651 676 if (fModified) 652 677 { … … 661 686 */ 662 687 } 663 688 689 664 690 Float_t newsum = 0.; 665 sat = 0;666 667 691 if (IsExtractionType(kAmplitude)) 668 FindAmplitude (pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), newsum, sat);692 newsum = FindAmplitude(fBlindPixelIdx[id], sat); 669 693 else 670 FindIntegral (pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), newsum, sat); 671 672 673 fBlindPixel->SetExtractedSignal(newsum,id); 674 fBlindPixel->SetNumSaturated(sat,id); 675 } 676 694 newsum = fSignal->GetIntegralRaw(fBlindPixelIdx[id], fHiGainFirst, fHiGainLast); 695 696 fBlindPixel->SetExtractedSignal(newsum, id); 697 fBlindPixel->SetNumSaturated(sat, id); 698 } 699 677 700 fBlindPixel->SetReadyToSave(); 678 701 return kTRUE; … … 686 709 Bool_t MExtractBlindPixel::IsDataType( const DataType_t typ ) 687 710 { 688 689 711 return TESTBIT( fDataType, typ ); 690 691 712 } 692 713 … … 698 719 Bool_t MExtractBlindPixel::IsExtractionType( const ExtractionType_t typ ) 699 720 { 700 701 721 return TESTBIT( fExtractionType, typ ); 702 703 722 } 704 723 -
trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h
r8155 r8158 13 13 #endif 14 14 15 class MCalibrationBlindCam; 15 16 class MExtractedSignalBlindPixel; 16 17 … … 30 31 MExtractedSignalBlindPixel *fBlindPixel; // Extracted signal of the Blind Pixel 31 32 32 Byte_t fHiLoFirst; // If not zero, start extraction from fHiLoFirst slice of Low-Gain33 Byte_t fHiLoLast;33 // Byte_t fHiLoFirst; // If not zero, start extraction from fHiLoFirst slice of Low-Gain 34 // Byte_t fHiLoLast; 34 35 35 MArrayF fHiGainSignal; //! Need fast access to the signals in a float way36 // MArrayF fHiGainSignal; //! Need fast access to the signals in a float way 36 37 MArrayF fHiGainFirstDeriv; //! First derivative at intersection 37 38 MArrayF fHiGainSecondDeriv; //! Second derivative at intersection … … 43 44 Byte_t fExtractionType; // What extraction type has been chosen? 44 45 Byte_t fDataType; // What data container type is needed? 45 Int_t fNumBlindPixels; // Current number of blind pixels46 // Int_t fNumBlindPixels; // Current number of blind pixels 46 47 47 48 public: … … 50 51 51 52 private: 52 void FindAmplitude (Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat);53 void FindIntegral (Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat);54 void FindSignalFilter(Byte_t *ptr,Int_t &sum, Byte_t &sat) const;53 Float_t FindAmplitude(Int_t idx, Int_t numsat) const; 54 // void FindIntegral (Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat); 55 // void FindSignalFilter(Byte_t *ptr, Int_t range, Int_t &sum, Byte_t &sat) const; 55 56 56 57 Int_t PreProcess(MParList *pList); … … 69 70 70 71 // Setters 72 /* 71 73 void SetBlindPixelIdx( const Int_t idx=fgBlindPixelIdx, const UInt_t nr=0 ) 72 74 { … … 74 76 fBlindPixelIdx.Set(nr+1); 75 77 fBlindPixelIdx[nr] = idx; 76 } 78 } 79 */ 80 81 void SetBlindPixels(const MCalibrationBlindCam &cam); 82 77 83 void SetExtractionType( const ExtractionType_t typ=kAmplitude ); 78 84 void SetDataType ( const DataType_t typ=kRawEvt ); 79 85 void SetNSBFilterLimit( const Int_t lim=fgNSBFilterLimit ) { fNSBFilterLimit = lim; } 80 86 81 void SetNumBlindPixels( const Int_t num=1 ) { fNumBlindPixels = num; }87 // void SetNumBlindPixels( const Int_t num=1 ) { fNumBlindPixels = num; } 82 88 83 89 void SetRange ( const Byte_t hifirst=0, const Byte_t hilast=0, -
trunk/MagicSoft/Mars/msignal/MExtractTimeAndChargeSpline.cc
r8154 r8158 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeSpline.cc,v 1.6 1 2006-10-24 08:24:52tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MExtractTimeAndChargeSpline.cc,v 1.62 2006-10-24 12:39:00 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 182 182 // 183 183 MExtractTimeAndChargeSpline::MExtractTimeAndChargeSpline(const char *name, const char *title) 184 : fRandomIter(0),fExtractionType(kIntegral)184 : /*fRandomIter(0),*/ fExtractionType(kIntegral) 185 185 { 186 186 … … 377 377 378 378 s.SetRiseFallTime(fRiseTimeHiGain, fFallTimeHiGain); 379 s.SetResolution(fResolution);379 // s.SetResolution(fResolution); 380 380 381 381 if (IsNoiseCalculation()) 382 382 { 383 if (fRandomIter == int(1./fResolution))384 fRandomIter = 0;385 386 sum = s.ExtractNoise( fRandomIter);387 fRandomIter++;383 // if (fRandomIter == int(1./fResolution)) 384 // fRandomIter = 0; 385 386 sum = s.ExtractNoise(/*fRandomIter*/); 387 // fRandomIter++; 388 388 return; 389 389 } … … 402 402 403 403 s.SetRiseFallTime(fRiseTimeLoGain, fFallTimeLoGain); 404 s.SetResolution(fResolution);404 // s.SetResolution(fResolution); 405 405 406 406 if (IsNoiseCalculation()) 407 407 { 408 if (fRandomIter == int(1./fResolution))409 fRandomIter = 0;410 411 sum = s.ExtractNoise( fRandomIter);408 // if (fRandomIter == int(1./fResolution)) 409 // fRandomIter = 0; 410 411 sum = s.ExtractNoise(/*fRandomIter*/); 412 412 return; 413 413 }
Note:
See TracChangeset
for help on using the changeset viewer.