Changeset 4374
- Timestamp:
- 07/14/04 18:12:32 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r4373 r4374 25 25 - added new function GetNumBlindPixels() 26 26 - added more comments 27 28 * msignal/MExtractBlindPixel.[h,cc] 29 - adapted to new configuration of now three blind pixels 30 - runs with run number smaller than 31693 are treated in the old way 31 - runs with run number higher than 31693 have no more NSB filter, 32 but possibility to choose between integral or amplitude (with spline) 33 extraction. Default is amplitude. 27 34 28 35 -
trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.cc
r4342 r4374 61 61 using namespace std; 62 62 63 const Int_t MExtractBlindPixel::fgBlindPixelIdx = 559; 64 const Int_t MExtractBlindPixel::fgNSBFilterLimit = 70; 65 const Byte_t MExtractBlindPixel::fgHiGainFirst = 10; 66 const Byte_t MExtractBlindPixel::fgHiGainLast = 29; 67 const Byte_t MExtractBlindPixel::fgLoGainFirst = 0; 68 const Byte_t MExtractBlindPixel::fgLoGainLast = 6; 69 const Float_t MExtractBlindPixel::fgResolution = 0.003; 63 const UInt_t MExtractBlindPixel::fgBlindPixelIds[3] = { 559, 560, 561 }; 64 const UInt_t MExtractBlindPixel::fgBlindPixelIdx = 559; 65 const Byte_t MExtractBlindPixel::fgFirst = 0; 66 const Byte_t MExtractBlindPixel::fgLast = 7; 67 const Byte_t MExtractBlindPixel::fgHiGainFirst = 10; 68 const Byte_t MExtractBlindPixel::fgHiGainLast = 29; 69 const Byte_t MExtractBlindPixel::fgLoGainFirst = 0; 70 const Byte_t MExtractBlindPixel::fgLoGainLast = 6; 71 const Int_t MExtractBlindPixel::fgNSBFilterLimit = 70; 72 const Float_t MExtractBlindPixel::fgResolution = 0.003; 73 const UInt_t MExtractBlindPixel::gkModificationRun = 31693; 74 const Float_t MExtractBlindPixel::gkOverflow = 300.; 70 75 // -------------------------------------------------------------------------- 71 76 // … … 76 81 // - fNSBFilterLimit to fgNSBFilterLimit 77 82 // - fResolution to fgResolution 83 // - fExtractionType to kAmplitude 78 84 // 79 85 // Calls: … … 91 97 AddToBranchList("MRawEvtData.*"); 92 98 93 fBlindPixelIdx.Set(1);94 95 SetBlindPixelIdx();96 99 SetResolution(); 97 100 SetNSBFilterLimit(); 98 101 SetRange(fgHiGainFirst, fgHiGainLast, fgLoGainFirst, fgLoGainLast); 99 100 } 101 102 103 SetFirst(); 104 SetLast(); 105 106 SetExtractionType(); 107 108 Clear(); 109 110 } 111 112 // -------------------------------------------------------------------------- 113 // 114 // Destructor: 115 // 116 // - Deletes, (if not NULL): 117 // fHiGainSignal; 118 // fHiGainFirstDeriv; 119 // fHiGainSecondDeriv; 120 // 102 121 MExtractBlindPixel::~MExtractBlindPixel() 103 122 { 104 123 105 124 if (fHiGainSignal) 106 delete fHiGainSignal;125 delete [] fHiGainSignal; 107 126 if (fHiGainFirstDeriv) 108 delete fHiGainFirstDeriv;127 delete [] fHiGainFirstDeriv; 109 128 if (fHiGainSecondDeriv) 110 delete fHiGainSecondDeriv; 129 delete [] fHiGainSecondDeriv; 130 131 } 132 133 // -------------------------------------------------------------------------- 134 // 135 // Clear 136 // 137 // Initializes: 138 // - fModified to kFALSE 139 // - fBlindPixelIdx to 0 140 // 141 // Calls: 142 // - SetBlindPixelIdx() 143 // 144 // Deletes and sets to NULL (if exists): 145 // - fHiGainSignal 146 // - fHiGainFirstDeriv 147 // - fHiGainSecondDeriv 148 // 149 void MExtractBlindPixel::Clear( const Option_t *o) 150 { 151 152 fModified = kFALSE; 153 154 fBlindPixelIdx.Set(0); 155 SetBlindPixelIdx(); 156 157 if (fHiGainSignal) 158 { 159 delete [] fHiGainSignal; 160 fHiGainSignal = NULL; 161 } 162 if (fHiGainFirstDeriv) 163 { 164 delete [] fHiGainFirstDeriv; 165 fHiGainFirstDeriv = NULL; 166 } 167 if (fHiGainSecondDeriv) 168 { 169 delete [] fHiGainSecondDeriv; 170 fHiGainSecondDeriv = NULL; 171 } 111 172 112 173 } … … 129 190 // -------------------------------------------------------------------------- 130 191 // 131 // The PreProcess searches for the following input containers: 132 // - MRawEvtData 192 // Calls: 193 // - MExtractor::PreProcess(pList) 194 // 195 // Sets fModified to kTRUE if the current run number is greater or equal gkModificationRun 133 196 // 134 197 // The following output containers are also searched and created if … … 137 200 // - MExtractedBlindPixel 138 201 // 202 // 203 // 139 204 Int_t MExtractBlindPixel::PreProcess(MParList *pList) 140 205 { … … 142 207 if (!MExtractor::PreProcess(pList)) 143 208 return kFALSE; 144 209 145 210 fBlindPixel = (MExtractedSignalBlindPixel*)pList->FindCreateObj(AddSerialNumber("MExtractedSignalBlindPixel")); 146 211 if (!fBlindPixel) 147 212 return kFALSE; 148 213 149 fBlindPixel->SetBlindPixelIdx(fBlindPixelIdx.At(0));150 fBlindPixel->SetUsedFADCSlices(fHiGainFirst, fHiGainLast);151 152 MPedestalPix &pedpix = (*fPedestals)[fBlindPixelIdx.At(0)];153 154 if (&pedpix)155 {156 fBlindPixel->SetPed ( pedpix.GetPedestal() * fNumLoGainSamples );157 fBlindPixel->SetPedErr ( pedpix.GetPedestalRms()* fNumLoGainSamples158 / TMath::Sqrt((Float_t)fPedestals->GetTotalEntries()) );159 fBlindPixel->SetPedRms ( pedpix.GetPedestalRms()* TMath::Sqrt((Float_t)fNumLoGainSamples) );160 fBlindPixel->SetPedRmsErr( fBlindPixel->GetPedErr()/2. );161 }162 214 163 215 return kTRUE; … … 184 236 185 237 if (fHiGainSignal) 186 delete fHiGainSignal;238 delete [] fHiGainSignal; 187 239 if (fHiGainFirstDeriv) 188 delete fHiGainFirstDeriv;240 delete [] fHiGainFirstDeriv; 189 241 if (fHiGainSecondDeriv) 190 delete fHiGainSecondDeriv; 242 delete [] fHiGainSecondDeriv; 243 244 if ( fRunHeader->GetRunNumber() >= gkModificationRun ) 245 { 246 fModified = kTRUE; 247 SetRange(fFirst,fLast); 248 for (Int_t i=0;i<3;i++) 249 { 250 SetBlindPixelIdx(fgBlindPixelIds[i],i); 251 fBlindPixel->SetBlindPixelIdx(fgBlindPixelIds[i],i); 252 } 253 } 254 else 255 { 256 fBlindPixel->SetBlindPixelIdx(fBlindPixelIdx.At(0)); 257 } 258 259 fBlindPixel->SetUsedFADCSlices(fHiGainFirst, fHiGainLast); 260 261 for (Int_t i=0;i<fBlindPixelIdx.GetSize();i++) 262 { 263 264 MPedestalPix &pedpix = (*fPedestals)[fBlindPixelIdx.At(i)]; 265 266 if (&pedpix) 267 { 268 fBlindPixel->SetPed ( pedpix.GetPedestal() * fNumLoGainSamples, i ); 269 fBlindPixel->SetPedErr ( pedpix.GetPedestalRms()* fNumLoGainSamples 270 / TMath::Sqrt((Float_t)fPedestals->GetTotalEntries()), i ); 271 fBlindPixel->SetPedRms ( pedpix.GetPedestalRms()* TMath::Sqrt((Float_t)fNumLoGainSamples), i ); 272 fBlindPixel->SetPedRmsErr( fBlindPixel->GetPedErr()/2., i ); 273 } 274 } 191 275 192 276 const Int_t firstdesired = (Int_t)fHiGainFirst; … … 194 278 195 279 if (firstdesired > lastavailable) 196 280 { 197 281 const Int_t diff = firstdesired - lastavailable; 198 282 *fLog << endl; … … 235 319 const Int_t range = fHiLoFirst ? fHiLoLast - fHiLoFirst + 1 : fHiGainLast - fHiGainFirst + fHiLoLast + 1; 236 320 237 fHiGainSignal = new Float_t[range];321 fHiGainSignal = new Float_t[range]; 238 322 memset(fHiGainSignal,0,range*sizeof(Float_t)); 239 fHiGainFirstDeriv = new Float_t[range];323 fHiGainFirstDeriv = new Float_t[range]; 240 324 memset(fHiGainFirstDeriv,0,range*sizeof(Float_t)); 241 325 fHiGainSecondDeriv = new Float_t[range]; 242 326 memset(fHiGainSecondDeriv,0,range*sizeof(Float_t)); 243 244 327 245 328 *fLog << endl; … … 267 350 // - Add contents of *logain to sum 268 351 // 269 void MExtractBlindPixel::Find SignalHiGain(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const352 void MExtractBlindPixel::FindIntegral(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) 270 353 { 271 354 … … 309 392 // - Add contents of *logain to sum 310 393 // 311 void MExtractBlindPixel::FindAmplitude(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) const394 void MExtractBlindPixel::FindAmplitude(Byte_t *ptr, Byte_t *logain, Float_t &sum, Byte_t &sat) 312 395 { 313 396 … … 325 408 326 409 range = fHiGainLast - fHiGainFirst + 1; 410 327 411 end = ptr + range; 328 412 // 329 413 // Check for saturation in all other slices 330 414 // 331 while (++p<end) 415 while (p++<end) 416 { 417 418 fHiGainSignal[count] = (Float_t)*p; 419 summ += *p; 420 421 if (*p > max) 422 { 423 max = *p; 424 maxpos = count; 425 } 426 427 count++; 428 429 if (*p >= fSaturationLimit) 430 sat++; 431 } 432 } 433 434 if (fHiLoLast != 0) 435 { 436 437 p = logain + fHiLoFirst; 438 end = logain + fHiLoLast + 1; 439 440 while (p<end) 332 441 { 333 442 … … 344 453 count++; 345 454 346 if (*p >= fSaturationLimit) 347 { 455 if (*p++ >= fSaturationLimit) 348 456 sat++; 349 break;350 }351 457 } 352 458 } 353 354 if (fHiLoLast != 0) 355 { 356 357 p = logain + fHiLoFirst; 358 end = logain + fHiLoLast + 1; 359 360 while (p<end) 361 { 362 363 fHiGainSignal[count] = (Float_t)*p; 364 summ += *p; 365 366 if (*p > max) 367 { 368 max = *p; 369 maxpos = count; 370 } 371 372 range++; 373 count++; 374 375 if (*p++ >= fSaturationLimit) 376 { 377 sat++; 378 break; 379 } 380 } 381 } 382 383 // sum = (Float_t)summ; 384 // return; 385 459 386 460 // 387 461 // allow one saturated slice 388 462 // 389 463 if (sat > 1) 464 { 465 sum = gkOverflow; 390 466 return; 467 } 391 468 392 469 // … … 394 471 // 395 472 if (maxpos < 2) 473 { 474 sum = (Float_t)max; 396 475 return; 476 } 397 477 398 478 Float_t pp; 399 fHiGainSecondDeriv[0] = 0.;400 fHiGainFirstDeriv[0] = 0.;401 479 402 480 for (Int_t i=1;i<range-1;i++) … … 586 664 { 587 665 588 pixel.Jump(fBlindPixelIdx .At(id));666 pixel.Jump(fBlindPixelIdx[id]); 589 667 590 668 Int_t sum = 0; 591 669 Byte_t sat = 0; 592 670 593 FindSignalFilter(pixel.GetHiGainSamples()+fLoGainFirst, sum, sat); 594 595 if (sum > fNSBFilterLimit) 596 { 597 fBlindPixel->SetExtractedSignal(-1.); 598 fBlindPixel->SetNumSaturated(sat); 599 fBlindPixel->SetReadyToSave(); 600 continue; 601 } 602 671 if (!fModified) 672 { 673 674 FindSignalFilter(pixel.GetHiGainSamples()+fLoGainFirst, sum, sat); 675 676 if (sum > fNSBFilterLimit) 677 { 678 fBlindPixel->SetExtractedSignal(-1.); 679 fBlindPixel->SetNumSaturated(sat); 680 fBlindPixel->SetReadyToSave(); 681 continue; 682 } 683 } 684 603 685 Float_t newsum = 0.; 604 686 sat = 0; 605 687 606 FindSignalHiGain(pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), newsum, sat); 688 if (IsExtractionType(kAmplitude)) 689 FindAmplitude (pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), newsum, sat); 690 else 691 FindIntegral (pixel.GetHiGainSamples()+fHiGainFirst, pixel.GetLoGainSamples(), newsum, sat); 607 692 608 693 fBlindPixel->SetExtractedSignal(newsum,id); … … 614 699 } 615 700 701 // -------------------------------------------------------------------------- 702 // 703 // Sets the extraction type. Available are: kAmplitude and kIntegral 704 // 705 Bool_t MExtractBlindPixel::IsExtractionType( const ExtractionType_t typ ) 706 { 707 708 return TESTBIT( fExtractionType, typ ); 709 710 } 711 712 // -------------------------------------------------------------------------- 713 // 714 // Sets the extraction type. Available are: kAmplitude and kIntegral 715 // 716 void MExtractBlindPixel::SetExtractionType( const ExtractionType_t typ ) 717 { 718 719 fExtractionType = 0; 720 SETBIT( fExtractionType, typ ); 721 722 } -
trunk/MagicSoft/Mars/msignal/MExtractBlindPixel.h
r4342 r4374 1 1 #ifndef MARS_MExtractBlindPixel 2 2 #define MARS_MExtractBlindPixel 3 4 /////////////////////////////////////////////////////////////////////////////5 // //6 // MExtractBlindPixel //7 // //8 // Integrates the time slices of the all pixels of a calibration event //9 // and substract the pedestal value //10 // //11 /////////////////////////////////////////////////////////////////////////////12 3 13 4 #ifndef MARS_MExtractor … … 24 15 private: 25 16 26 static const Int_t fgBlindPixelIdx; 27 static const Int_t fgNSBFilterLimit; 28 static const Byte_t fgHiGainFirst; // First FADC slice Hi-Gain (currently set to: 0) 29 static const Byte_t fgHiGainLast; // Last FADC slice Hi-Gain (currently set to: 11) 30 static const Byte_t fgLoGainFirst; // First FADC slice Lo-Gain (currently set to: 0) 31 static const Byte_t fgLoGainLast; // Last FADC slice Lo-Gain (currently set to: 2) 32 static const Float_t fgResolution; // Default for fResolution (now set to: 0.003) 33 34 MExtractedSignalBlindPixel *fBlindPixel; // Extracted signal of the Blind Pixel 17 static const UInt_t fgBlindPixelIds[3]; //! Default blind pixel indices after modification run 18 static const UInt_t fgBlindPixelIdx; //! Default blind pixels index before modification run 19 static const Byte_t fgFirst; //! Default First FADC slice after modification run (currently set to: 2 ) 20 static const Byte_t fgLast ; //! Default Last FADC slice after modification run (currently set to: 13 ) 21 static const Byte_t fgHiGainFirst; //! Default First FADC slice Hi-Gain Signal (currently set to: 10 ) 22 static const Byte_t fgHiGainLast; //! Default Last FADC slice Hi-Gain Signal (currently set to: 29 ) 23 static const Byte_t fgLoGainFirst; //! Default First FADC slice Filter (currently set to: 0 ) 24 static const Byte_t fgLoGainLast; //! Default Last FADC slice Filter (currently set to: 6 ) 25 static const Int_t fgNSBFilterLimit; //! Default for fNSBFilterLimit 26 static const Float_t fgResolution; //! Default for fResolution (currently set to: 0.003) 27 static const UInt_t gkModificationRun; //! The run number from which on three blind pixels are used 28 static const Float_t gkOverflow; //! Default sum to assign overflow in case of saturation 35 29 36 Byte_t fHiLoFirst; 30 MExtractedSignalBlindPixel *fBlindPixel; // Extracted signal of the Blind Pixel 31 32 Byte_t fFirst; 33 Byte_t fLast; 34 Byte_t fHiLoFirst; 37 35 Float_t *fHiGainSignal; // Need fast access to the signals in a float way 38 36 Float_t *fHiGainFirstDeriv; … … 43 41 Int_t fNSBFilterLimit; 44 42 45 void FindAmplitude(Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat) const; 46 void FindSignalHiGain(Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat) const; 47 void FindSignalFilter(Byte_t *ptr, Int_t &sum, Byte_t &sat) const; 43 Bool_t fModified; 44 Byte_t fExtractionType; 45 46 enum ExtractionType_t { kAmplitude, kIntegral }; 47 48 void FindAmplitude (Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat); 49 void FindIntegral (Byte_t *firstused, Byte_t *lowgain, Float_t &sum, Byte_t &sat); 50 void FindSignalFilter(Byte_t *ptr, Int_t &sum, Byte_t &sat) const; 48 51 49 52 Int_t PreProcess(MParList *pList); … … 55 58 MExtractBlindPixel(const char *name=NULL, const char *title=NULL); 56 59 ~MExtractBlindPixel(); 60 61 void Clear( const Option_t *o =""); 57 62 63 // Getters 64 Bool_t IsExtractionType ( const ExtractionType_t typ ); 65 58 66 // Setters 59 void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0); 67 void SetExtractionType( const ExtractionType_t typ=kAmplitude ); 68 void SetFirst( const Byte_t first=fgFirst) { fFirst = first; } 69 void SetLast ( const Byte_t last =fgLast) { fLast = last; } 70 void SetRange( const Byte_t hifirst=0, const Byte_t hilast=0, 71 const Byte_t lofirst=0, const Byte_t lolast=0); 60 72 void SetBlindPixelIdx( const Int_t idx=fgBlindPixelIdx, const Int_t nr=0) { 61 if (nr>fBlindPixelIdx.GetSize() +1)73 if (nr>fBlindPixelIdx.GetSize()-1) 62 74 fBlindPixelIdx.Set(nr+1); 63 75 fBlindPixelIdx.AddAt(idx,nr); } -
trunk/MagicSoft/Mars/msignal/MExtractedSignalBlindPixel.cc
r4311 r4374 27 27 // MExtractedSignalBlindPixel 28 28 // 29 // This is the storage container to hold informations about the extracted signal 30 // (offset) value of the calibration Blind Pixel. 31 // 29 // The storage container of the extracted signal of the calibration Blind Pixel(s). 30 // Additionally, the number of saturated Slices are stored. 32 31 // There is place for various blind pixels set into the camera in July. Default 33 32 // is one blind pixel. 33 // 34 // Default values for the extracted signals are: gkSignalInitializer 34 35 // 35 36 ///////////////////////////////////////////////////////////////////////////// … … 47 48 // ------------------------------------------------------------------------ 48 49 // 49 // MExtractedSignalBlindPixel holds the extracted signal50 // of the FADC slices and its error.51 50 // 52 // Additionally, the number of saturated Slices are stored. 53 // 54 // Default values for the extracted signals are: 99999.9 51 // Sets: 52 // - the dimenstion of fBlindPixelIdx to 1 53 // - the dimenstion of fExtractedSignal to 1 54 // - the dimenstion of fNumSaturated to 1 55 // - the dimenstion of fPed. to 1; 56 // - the dimenstion of fPedErr. to 1;) 57 // - the dimenstion of fPedRms. to 1; 58 // - the dimenstion of fPedRmsErr. to 1; 59 // 60 // Calls: 61 // - Clear() 55 62 // 56 63 MExtractedSignalBlindPixel::MExtractedSignalBlindPixel(const char* name, const char* title) … … 74 81 // ------------------------------------------------------------------------ 75 82 // 76 // Invalidate values 83 // Set values of: 84 // - fNumSaturated 85 // - fExtractedSignal 86 // to gkSignalInitializer 77 87 // 78 88 void MExtractedSignalBlindPixel::Clear(Option_t *o) … … 83 93 fNumSaturated .AddAt(gkSignalInitializer,i); 84 94 fExtractedSignal.AddAt(gkSignalInitializer,i); 85 fPed .AddAt(gkSignalInitializer,i);86 fPedErr .AddAt(gkSignalInitializer,i);87 fPedRms .AddAt(gkSignalInitializer,i);88 fPedRmsErr .AddAt(gkSignalInitializer,i);89 95 } 90 91 96 } 92 97 98 // ------------------------------------------------------------------------ 99 // 100 // Set number num of used FADC slices, starting from (including) first 101 // 93 102 void MExtractedSignalBlindPixel::SetUsedFADCSlices(const Byte_t first, const Byte_t num) 94 103 { … … 97 106 } 98 107 99 108 // -------------------------------------------------------------------------------------------- 109 // 110 // Returns true, if fExtractedSignal is greater or equal 0 and smaller than gkSignalInitializer 111 // 100 112 Bool_t MExtractedSignalBlindPixel::IsValid( const Int_t i ) const 101 113 { … … 103 115 } 104 116 117 // -------------------------------------------------------------------------------------------- 118 // 119 // Prints for all stored blind pixels the ID, the signal and the number of saturated slices 120 // 105 121 void MExtractedSignalBlindPixel::Print(Option_t *o) const 106 122 {
Note:
See TracChangeset
for help on using the changeset viewer.