Changeset 5219 for trunk/MagicSoft
- Timestamp:
- 10/11/04 17:36:35 (20 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r5212 r5219 19 19 20 20 -*-*- END OF LINE -*-*- 21 22 2004/10/11: Markus Gaug 23 24 * mpedestal/MPedCalcPedRun.[h,cc] 25 - calculate addtionally to the usual pedestal the ABOffset, like 26 in MPedCalcFromLoGain. 27 21 28 22 29 2004/10/08: Markus Meyer and Keiichi Mase -
trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc
r5204 r5219 190 190 fRunHeader = NULL; 191 191 fPedestals = NULL; 192 193 // If the size is yet set, set the size 194 if (fSumx.GetSize()>0) 195 { 196 // Reset contents of arrays. 197 fSumx.Reset(); 198 fSumx2.Reset(); 199 fSumAB0.Reset(); 200 fSumAB1.Reset(); 201 202 fAreaSumx. Reset(); 203 fAreaSumx2.Reset(); 204 fAreaSumAB0.Reset(); 205 fAreaSumAB1.Reset(); 206 fAreaValid.Reset(); 207 208 fSectorSumx. Reset(); 209 fSectorSumx2.Reset(); 210 fSectorSumAB0.Reset(); 211 fSectorSumAB1.Reset(); 212 fSectorValid.Reset(); 213 } 192 214 } 193 215 … … 241 263 { 242 264 *fLog << warn; 243 *fLog << GetDescriptor() << ": HiGain window currently set to 0, will set it to 2 samples " ;265 *fLog << GetDescriptor() << ": HiGain window currently set to 0, will set it to 2 samples " << endl; 244 266 fWindowSizeHiGain = 2; 245 267 } … … 248 270 { 249 271 *fLog << warn; 250 *fLog << GetDescriptor() << ": LoGain window currently set to 0, will set it to 2 samples " ;272 *fLog << GetDescriptor() << ": LoGain window currently set to 0, will set it to 2 samples " << endl; 251 273 fWindowSizeLoGain = 2; 252 274 } … … 346 368 Bool_t MPedCalcPedRun::ReInit(MParList *pList) 347 369 { 370 348 371 Int_t lastdesired = (Int_t)fLoGainLast; 349 372 Int_t lastavailable = (Int_t)fRunHeader->GetNumSamplesLoGain()-1; … … 414 437 if (fSumx.GetSize()==0) 415 438 { 416 fSumx. Set(npixels); 417 fSumx2.Set(npixels); 418 419 fAreaSumx. Set(areas); 420 fAreaSumx2.Set(areas); 421 fAreaValid.Set(areas); 422 423 fSectorSumx. Set(sectors); 424 fSectorSumx2.Set(sectors); 425 fSectorValid.Set(sectors); 426 427 fSumx.Reset(); 439 fSumx. Set(npixels); 440 fSumx2. Set(npixels); 441 fSumAB0.Set(npixels); 442 fSumAB1.Set(npixels); 443 444 fAreaSumx. Set(areas); 445 fAreaSumx2. Set(areas); 446 fAreaSumAB0.Set(areas); 447 fAreaSumAB1.Set(areas); 448 fAreaValid. Set(areas); 449 450 fSectorSumx. Set(sectors); 451 fSectorSumx2. Set(sectors); 452 fSectorSumAB0.Set(sectors); 453 fSectorSumAB1.Set(sectors); 454 fSectorValid. Set(sectors); 455 456 fSumx. Reset(); 428 457 fSumx2.Reset(); 429 458 } … … 454 483 Int_t MPedCalcPedRun::Process() 455 484 { 485 456 486 MRawEvtPixelIter pixel(fRawEvt); 457 487 … … 467 497 UInt_t sum = 0; 468 498 UInt_t sqr = 0; 499 UInt_t ab0 = 0; 500 UInt_t ab1 = 0; 501 Int_t cnt = 0; 469 502 470 503 if (fWindowSizeHiGain != 0) … … 474 507 sum += *ptr; 475 508 sqr += *ptr * *ptr; 509 510 if (pixel.IsABFlagValid()) 511 { 512 const Int_t abFlag = (fHiGainFirst + pixel.HasABFlag() + cnt) & 0x1; 513 if (abFlag) 514 ab1 += *ptr; 515 else 516 ab0 += *ptr; 517 518 cnt++; 519 } 476 520 } 477 521 while (++ptr != end); 478 522 } 523 524 cnt = 0; 479 525 480 526 if (fWindowSizeLoGain != 0) … … 488 534 sum += *ptr; 489 535 sqr += *ptr * *ptr; 536 537 if (pixel.IsABFlagValid()) 538 { 539 const Int_t abFlag = (fLoGainFirst + pixel.GetNumHiGainSamples() + pixel.HasABFlag() + cnt) 540 & 0x1; 541 if (abFlag) 542 ab1 += *ptr; 543 else 544 ab0 += *ptr; 545 546 cnt++; 547 } 548 490 549 } 491 550 while (++ptr != end); … … 506 565 fAreaSumx[aidx] += msum; 507 566 fSectorSumx[sector] += msum; 567 508 568 // 509 569 // The old version: … … 518 578 fAreaSumx2[aidx] += sqrsum; 519 579 fSectorSumx2[sector] += sqrsum; 580 581 // 582 // Now, the sums separated for AB0 and AB1 583 // 584 fSumAB0[idx] += ab0; 585 fSumAB1[idx] += ab1; 586 587 fAreaSumAB0[aidx] += ab0; 588 fAreaSumAB1[aidx] += ab1; 589 590 fSectorSumAB0[aidx] += ab0; 591 fSectorSumAB1[aidx] += ab1; 520 592 } 521 593 … … 532 604 Int_t MPedCalcPedRun::PostProcess() 533 605 { 606 534 607 // Compute pedestals and rms from the whole run 535 608 const ULong_t n = fNumSamplesTot; … … 563 636 higainVar /= (Float_t)(fWindowSizeHiGain+fWindowSizeLoGain); 564 637 // 3. Calculate the RMS from the Variance: 565 (*fPedestals)[pixid].Set(higainped, higainVar < 0 ? 0. : TMath::Sqrt(higainVar)); 638 const Float_t rms = higainVar<0 ? 0. : TMath::Sqrt(higainVar); 639 // 4. Calculate the amplitude of the 150MHz "AB" noise 640 const Float_t abOffs = (fSumAB0.At(pixid) - fSumAB1.At(pixid)) / n; 641 642 *fLog << "THIS is the aboffs: " << abOffs << endl; 643 644 (*fPedestals)[pixid].Set(higainped,rms,abOffs); 566 645 567 646 } … … 594 673 // in order to be comparable to the mean of pedRMS of that area 595 674 higainrms *= TMath::Sqrt((Float_t)napix); 596 597 fPedestals->GetAverageArea(aidx).Set(higainped, higainrms); 675 // 5. Calculate the amplitude of the 150MHz "AB" noise 676 const Float_t abOffs = (fAreaSumAB0.At(aidx) - fAreaSumAB1.At(aidx)) / an; 677 678 fPedestals->GetAverageArea(aidx).Set(higainped, higainrms,abOffs); 598 679 } 599 680 … … 625 706 // in order to be comparable to the mean of pedRMS of that sector 626 707 higainrms *= TMath::Sqrt((Float_t)nspix); 627 628 fPedestals->GetAverageSector(sector).Set(higainped, higainrms); 708 // 5. Calculate the amplitude of the 150MHz "AB" noise 709 const Float_t abOffs = (fSectorSumAB0.At(sector) - fSectorSumAB1.At(sector)) / sn; 710 711 fPedestals->GetAverageSector(sector).Set(higainped, higainrms, abOffs); 629 712 } 630 713 -
trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.h
r4629 r5219 15 15 16 16 class MGeomCam; 17 18 17 class MPedCalcPedRun : public MExtractor 19 18 { 20 static const Byte_t fgHiGainFirst; // First FADC slice Hi-Gain (currently set to: 3)21 static const Byte_t fgHiGainLast; // Last FADC slice Hi-Gain (currently set to: 14)22 static const Byte_t fgLoGainFirst; // First FADC slice Lo-Gain (currently set to: 3)23 static const Byte_t fgLoGainLast; // Last FADC slice Lo-Gain (currently set to: 14)24 static const Byte_t fgHiGainWindowSize; // The extraction window Hi-Gain25 static const Byte_t fgLoGainWindowSize; // The extraction window Lo-Gain26 19 27 UInt_t fNumSamplesTot; 28 Byte_t fWindowSizeHiGain; // Number of Hi Gain slices in window 29 Byte_t fWindowSizeLoGain; // Number of Lo Gain slices in window 20 static const Byte_t fgHiGainFirst; // First FADC slice Hi-Gain (currently set to: 3) 21 static const Byte_t fgHiGainLast; // Last FADC slice Hi-Gain (currently set to: 14) 22 static const Byte_t fgLoGainFirst; // First FADC slice Lo-Gain (currently set to: 3) 23 static const Byte_t fgLoGainLast; // Last FADC slice Lo-Gain (currently set to: 14) 24 static const Byte_t fgHiGainWindowSize; // The extraction window Hi-Gain 25 static const Byte_t fgLoGainWindowSize; // The extraction window Lo-Gain 26 27 UInt_t fNumSamplesTot; 28 Byte_t fWindowSizeHiGain; // Number of Hi Gain slices in window 29 Byte_t fWindowSizeLoGain; // Number of Lo Gain slices in window 30 31 MGeomCam *fGeom; // Camera geometry 32 33 TArrayD fSumx; // sum of values 34 TArrayD fSumx2; // sum of squared values 35 TArrayD fSumAB0; // sum of ABFlag=0 slices 36 TArrayD fSumAB1; // sum of ABFlag=1 slices 37 TArrayD fAreaSumx; // averaged sum of values per area idx 38 TArrayD fAreaSumx2; // averaged sum of squared values per area idx 39 TArrayD fAreaSumAB0; // averaged sum of ABFlag=0 slices per area idx 40 TArrayD fAreaSumAB1; // averaged sum of ABFlag=1 slices per area idx 41 TArrayI fAreaValid; // number of valid pixel with area idx 42 TArrayD fSectorSumx; // averaged sum of values per sector 43 TArrayD fSectorSumx2; // averaged sum of squared values per sector 44 TArrayD fSectorSumAB0; // averaged sum of ABFlag=0 slices per sector 45 TArrayD fSectorSumAB1; // averaged sum of ABFlag=1 slices per sector 46 TArrayI fSectorValid; // number of valid pixel with sector idx 47 48 Int_t PreProcess (MParList *pList); 49 Bool_t ReInit (MParList *pList); 50 Int_t Process (); 51 Int_t PostProcess(); 52 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 53 54 public: 30 55 31 MGeomCam *fGeom; // Camera geometry 32 33 TArrayD fSumx; // sum of values 34 TArrayD fSumx2; // sum of squared values 35 TArrayD fAreaSumx; // averaged sum of values per area idx 36 TArrayD fAreaSumx2; // averaged sum of squared values per area idx 37 TArrayI fAreaValid; // number of valid pixel with area idx 38 TArrayD fSectorSumx; // averaged sum of values per sector 39 TArrayD fSectorSumx2; // averaged sum of squared values per sector 40 TArrayI fSectorValid; // number of valid pixel with sector idx 41 42 Int_t PreProcess (MParList *pList); 43 Bool_t ReInit (MParList *pList); 44 Int_t Process (); 45 Int_t PostProcess(); 46 Int_t ReadEnv(const TEnv &env, TString prefix, Bool_t print); 47 48 public: 49 MPedCalcPedRun(const char *name=NULL, const char *title=NULL); 50 51 void Clear(const Option_t *o=""); 52 void SetRange(Byte_t hifirst=0, Byte_t hilast=0, Byte_t lofirst=0, Byte_t lolast=0); 53 void SetWindowSize(Byte_t windowh=0, Byte_t windowl=0); 54 55 ClassDef(MPedCalcPedRun, 0) // Task to calculate pedestals from pedestal runs raw data 56 MPedCalcPedRun(const char *name=NULL, const char *title=NULL); 57 58 void Clear(const Option_t *o=""); 59 60 void SetRange ( const Byte_t hifirst=0, const Byte_t hilast=0, 61 const Byte_t lofirst=0, const Byte_t lolast=0 ); 62 void SetWindowSize ( const Byte_t windowh=0, const Byte_t windowl=0 ); 63 64 ClassDef(MPedCalcPedRun, 0) // Task to calculate pedestals from pedestal runs raw data 56 65 }; 57 66
Note:
See TracChangeset
for help on using the changeset viewer.