Changeset 5219 for trunk/MagicSoft/Mars/mpedestal/MPedCalcPedRun.cc
- Timestamp:
- 10/11/04 17:36:35 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note:
See TracChangeset
for help on using the changeset viewer.