Changeset 4903 for trunk/MagicSoft/Mars/mcalib
- Timestamp:
- 09/09/04 17:37:26 (20 years ago)
- Location:
- trunk/MagicSoft/Mars/mcalib
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeBlindPix.cc
r4885 r4903 260 260 } 261 261 262 MH GausEvents::Clear();262 MHCalibrationPix::Clear(); 263 263 return; 264 264 } … … 266 266 // -------------------------------------------------------------------------- 267 267 // 268 // Empty function to overload MH GausEvents::Reset()268 // Empty function to overload MHCalibrationChargePix::Reset() 269 269 // 270 270 void MHCalibrationChargeBlindPix::Reset() … … 385 385 } 386 386 387 MH GausEvents::InitBins();387 MHCalibrationPix::InitBins(); 388 388 389 389 return kTRUE; … … 1164 1164 1165 1165 oldpad->cd(2); 1166 MH GausEvents::Draw("fourierevents");1167 } 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1166 MHCalibrationPix::Draw("fourierevents"); 1167 } 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargeCam.cc
r4884 r4903 26 26 // MHCalibrationChargeCam 27 27 // 28 // Fills the extracted signals of MExtractedSignalCam into the MH GausEvents-classes28 // Fills the extracted signals of MExtractedSignalCam into the MHCalibrationPix-classes 29 29 // MHCalibrationChargeHiGainPix and MHCalibrationChargeLoGainPix for every: 30 30 // … … 54 54 // the fit is declared valid. 55 55 // Otherwise, the fit is repeated within ranges of the previous mean 56 // +- MH GausEvents::fPickupLimit (default: 5) sigma (see MHGausEvents::RepeatFit())56 // +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit()) 57 57 // In case this does not make the fit valid, the histogram means and RMS's are 58 // taken directly (see MH GausEvents::BypassFit()) and the following flags are set:58 // taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set: 59 59 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted ) or 60 60 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted ) and 61 61 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun ) 62 62 // 63 // Outliers of more than MH GausEvents::fPickupLimit (default: 5) sigmas64 // from the mean are counted as Pickup events (stored in MH GausEvents::fPickup)63 // Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas 64 // from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup) 65 65 // 66 66 // Unless more than fNumHiGainSaturationLimit (default: 1%) of the overall FADC … … 120 120 #include "MHCalibrationChargeLoGainPix.h" 121 121 #include "MHCalibrationChargePix.h" 122 123 #include "MCalibrationCam.h" 124 122 #include "MHCalibrationPix.h" 123 124 #include "MCalibrationIntensityCam.h" 125 125 #include "MCalibrationChargeCam.h" 126 126 #include "MCalibrationChargePix.h" … … 128 128 #include "MGeomCam.h" 129 129 #include "MGeomPix.h" 130 131 #include "MHGausEvents.h"132 130 133 131 #include "MBadPixelsCam.h" … … 260 258 } 261 259 262 fCam = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam")); 263 if (!fCam) 264 { 265 fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationChargeCam")); 260 fIntensCam = (MCalibrationIntensityCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityChargeCam")); 261 if (fIntensCam) 262 *fLog << inf << "Found MCalibrationIntensityChargeCam ... " << endl; 263 else 264 { 265 fCam = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationChargeCam")); 266 266 if (!fCam) 267 267 { 268 gLog << err << "Cannot find nor create MCalibrationChargeCam ... abort." << endl; 269 return kFALSE; 268 fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationChargeCam")); 269 if (!fCam) 270 { 271 *fLog << err << "Cannot find nor create MCalibrationChargeCam ... abort." << endl; 272 return kFALSE; 273 } 274 fCam->Init(*fGeom); 270 275 } 271 else272 fCam->Init(*fGeom);273 276 } 274 277 … … 278 281 fLastLoGain = signal->GetLastUsedSliceLoGain(); 279 282 283 /* 280 284 const Float_t numhigain = signal->GetNumUsedHiGainFADCSlices(); 281 285 const Float_t numlogain = signal->GetNumUsedLoGainFADCSlices(); 282 286 283 if (fCam->GetNumHiGainFADCSlices() == 0.) 284 fCam->SetNumHiGainFADCSlices ( numhigain ); 285 else if (fCam->GetNumHiGainFADCSlices() != numhigain) 286 { 287 *fLog << err << GetDescriptor() 288 << ": Number of High Gain FADC extraction slices has changed, abort..." << endl; 289 return kFALSE; 290 } 291 292 if (fCam->GetNumLoGainFADCSlices() == 0.) 293 fCam->SetNumLoGainFADCSlices ( numlogain ); 294 else if (fCam->GetNumLoGainFADCSlices() != numlogain) 295 { 296 *fLog << err << GetDescriptor() 297 << ": Number of Low Gain FADC extraction slices has changes, abort..." << endl; 298 return kFALSE; 299 } 300 287 288 if (fCam) 289 { 290 if (fCam->GetNumHiGainFADCSlices() == 0.) 291 fCam->SetNumHiGainFADCSlices ( numhigain ); 292 else if (fCam->GetNumHiGainFADCSlices() != numhigain) 293 { 294 *fLog << err << GetDescriptor() 295 << ": Number of High Gain FADC extraction slices has changed, abort..." << endl; 296 return kFALSE; 297 } 298 299 if (fCam->GetNumLoGainFADCSlices() == 0.) 300 fCam->SetNumLoGainFADCSlices ( numlogain ); 301 else if (fCam->GetNumLoGainFADCSlices() != numlogain) 302 { 303 *fLog << err << GetDescriptor() 304 << ": Number of Low Gain FADC extraction slices has changes, abort..." << endl; 305 return kFALSE; 306 } 307 } 308 */ 309 310 301 311 const Int_t npixels = fGeom->GetNumPixels(); 302 312 const Int_t nsectors = fGeom->GetNumSectors(); … … 311 321 for (Int_t i=0; i<npixels; i++) 312 322 { 313 (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix ;323 (*fHiGainArray)[i] = new MHCalibrationChargeHiGainPix("ChargeHiGainPix"); 314 324 MHCalibrationChargePix &pix = (MHCalibrationChargePix&)(*this)[i]; 315 325 pix.SetAbsTimeNbins(higainsamples); … … 317 327 InitHists((*this)[i],(*fBadPixels)[i],i); 318 328 } 319 fHiGainOverFlow.Set(npixels);320 329 } 321 330 … … 326 335 for (Int_t i=0; i<npixels; i++) 327 336 { 328 (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix ;329 MH GausEvents&lopix = (*this)(i);337 (*fLoGainArray)[i] = new MHCalibrationChargeLoGainPix("ChargeLoGainPix"); 338 MHCalibrationPix &lopix = (*this)(i); 330 339 // 331 340 // Adapt the range for the case, the intense blue is used: … … 345 354 InitHists(lopix,(*fBadPixels)[i],i); 346 355 } 347 fLoGainOverFlow.Set(npixels);348 356 } 349 357 … … 355 363 { 356 364 (*fAverageHiGainAreas)[j] = 357 new MHCalibrationChargeHiGainPix(" AverageHiGainArea",365 new MHCalibrationChargeHiGainPix("ChargeAverageHiGainArea", 358 366 "Average HiGain FADC sums area idx "); 359 367 … … 373 381 { 374 382 hist.GetHGausHist()->SetTitle("Signal averaged on event-by-event basis High Gain Area Idx "); 375 InitHists(hist,f Cam->GetAverageBadArea(j),j);383 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 376 384 } 377 385 } … … 386 394 { 387 395 (*fAverageLoGainAreas)[j] = 388 new MHCalibrationChargeLoGainPix(" AverageLoGainArea",396 new MHCalibrationChargeLoGainPix("ChargeAverageLoGainArea", 389 397 "Average LoGain FADC sums of pixel area idx "); 390 398 … … 418 426 else 419 427 { 420 hist.GetHGausHist()->SetTitle("Signal averaged on event-by-event basis HighGain Area Idx ");421 InitHists(hist,f Cam->GetAverageBadArea(j),j);428 hist.GetHGausHist()->SetTitle("Signal averaged on event-by-event basis Low Gain Area Idx "); 429 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 422 430 } 423 431 } … … 431 439 { 432 440 (*fAverageHiGainSectors)[j] = 433 new MHCalibrationChargeHiGainPix(" AverageHiGainSector",434 "Average HiGain FADC sums of pixel sector ");441 new MHCalibrationChargeHiGainPix("ChargeAverageHiGainSector", 442 "Averaged HiGain Signals Sector "); 435 443 436 444 MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageHiGainSector(j); 437 445 438 hist.GetHGausHist()->SetTitle("S ummed FADC slices averageHiGain Sector ");446 hist.GetHGausHist()->SetTitle("Signals averaged on event-by-event basis HiGain Sector "); 439 447 hist.SetNbins(fAverageNbins); 440 448 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average HiGain Sector "); 441 449 442 InitHists(hist,fCam->GetAverageBadSector(j),j); 443 450 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 444 451 } 445 452 } … … 452 459 { 453 460 (*fAverageLoGainSectors)[j] = 454 new MHCalibrationChargeLoGainPix(" AverageLoGainSector",455 "Average LoGain FADC sums of pixel sector ");461 new MHCalibrationChargeLoGainPix("ChargeAverageLoGainSector", 462 "Average LoGain Signals Sector "); 456 463 457 464 MHCalibrationChargePix &hist = (MHCalibrationChargePix&)GetAverageLoGainSector(j); 458 465 459 hist.GetHGausHist()->SetTitle("S ummed FADC slices averageLoGain Sector ");466 hist.GetHGausHist()->SetTitle("Signals averaged on event-by-event basis LoGain Sector "); 460 467 hist.SetNbins(fgAverageNbinsLoGain); 461 468 … … 477 484 hist.GetHAbsTime()->SetTitle("Absolute Arrival Time average LoGain Sector "); 478 485 479 InitHists(hist,f Cam->GetAverageBadSector(j),j);486 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 480 487 } 481 488 } … … 565 572 const Int_t sathi = (Int_t)pix.GetNumHiGainSaturated(); 566 573 567 if (!histhi.FillHistAndArray(sumhi)) 568 fHiGainOverFlow[i]++; 569 574 histhi.FillHistAndArray(sumhi); 570 575 histhi.SetSaturated(sathi); 571 576 … … 585 590 const Int_t satlo = (Int_t)pix.GetNumLoGainSaturated(); 586 591 587 if (!histlo.FillHistAndArray(sumlo)) 588 fLoGainOverFlow[i]++; 589 592 histlo.FillHistAndArray(sumlo); 590 593 histlo.SetSaturated(satlo); 591 594 … … 706 709 707 710 MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)(*this)[i]; 708 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i];709 MBadPixelsPix &bad = (*fBadPixels)[i];710 711 711 712 if (histhi.IsExcluded()) 712 713 continue; 713 714 715 MCalibrationChargePix &pix = fIntensCam 716 ? (MCalibrationChargePix&)(*fIntensCam)[i] 717 : (MCalibrationChargePix&)(*fCam)[i]; 718 714 719 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) 715 720 { … … 719 724 } 720 725 721 if (fHiGainOverFlow[i]) 726 MBadPixelsPix &bad = (*fBadPixels)[i]; 727 728 Stat_t overflow = histhi.GetHGausHist()->GetBinContent(histhi.GetHGausHist()->GetNbinsX()+1); 729 if (overflow > 0.1) 722 730 { 723 731 *fLog << warn << GetDescriptor() 724 << ": Hi-Gain Histogram Overflow occurred " << fHiGainOverFlow[i] 732 << ": HiGain Histogram Overflow occurred " << overflow 733 << " times in pixel: " << i << " (without saturation!) " << endl; 734 bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow ); 735 } 736 737 overflow = histhi.GetHGausHist()->GetBinContent(0); 738 if (overflow > 0.1) 739 { 740 *fLog << warn << GetDescriptor() 741 << ": HiGain Histogram Underflow occurred " << overflow 725 742 << " times in pixel: " << i << " (without saturation!) " << endl; 726 743 bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow ); … … 748 765 } 749 766 750 if (fLoGainOverFlow[i] > 1) 767 Stat_t overflow = histlo.GetHGausHist()->GetBinContent(histlo.GetHGausHist()->GetNbinsX()+1); 768 if (overflow > 0.1) 751 769 { 752 770 *fLog << warn << GetDescriptor() 753 << ": Lo-Gain Histogram Overflow occurred " << fLoGainOverFlow[i] 771 << ": Lo-Gain Histogram Overflow occurred " << overflow 772 << " times in pixel: " << i << " (without saturation!) " << endl; 773 bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow ); 774 } 775 776 overflow = histlo.GetHGausHist()->GetBinContent(0); 777 if (overflow > 0.1) 778 { 779 *fLog << warn << GetDescriptor() 780 << ": Lo-Gain Histogram Underflow occurred " << overflow 754 781 << " times in pixel: " << i << " (without saturation!) " << endl; 755 782 bad.SetUncalibrated( MBadPixelsPix::kLoGainOverFlow ); 756 783 } 757 784 758 MCalibrationChargePix &pix = (MCalibrationChargePix&)(*fCam)[i]; 785 MCalibrationChargePix &pix = fIntensCam 786 ? (MCalibrationChargePix&)(*fIntensCam)[i] 787 : (MCalibrationChargePix&)(*fCam)[i]; 759 788 760 789 if (pix.IsHiGainSaturation()) … … 766 795 767 796 MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainArea(j); 768 MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageArea(j); 769 MBadPixelsPix &bad = fCam->GetAverageBadArea(j); 770 797 MCalibrationChargePix &pix = fIntensCam 798 ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(j) 799 : (MCalibrationChargePix&)fCam->GetAverageArea(j); 800 771 801 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) 772 802 { … … 775 805 continue; 776 806 } 807 808 MBadPixelsPix &bad = fIntensCam 809 ? fIntensCam->GetAverageBadArea(j) 810 : fCam->GetAverageBadArea(j); 777 811 778 812 FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain); … … 784 818 785 819 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainArea(j); 786 MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageArea(j); 787 MBadPixelsPix &bad = fCam->GetAverageBadArea(j); 788 820 789 821 if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries()) 790 822 { … … 794 826 } 795 827 828 MCalibrationChargePix &pix = fIntensCam 829 ? (MCalibrationChargePix&)fIntensCam->GetAverageArea(j) 830 : (MCalibrationChargePix&)fCam->GetAverageArea(j) ; 831 796 832 if (pix.IsHiGainSaturation()) 797 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); 833 { 834 MBadPixelsPix &bad = fIntensCam 835 ? fIntensCam->GetAverageBadArea(j) 836 : fCam->GetAverageBadArea(j); 837 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); 838 } 839 798 840 } 799 841 … … 802 844 803 845 MHCalibrationChargePix &histhi = (MHCalibrationChargePix&)GetAverageHiGainSector(j); 804 MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageSector(j); 805 MBadPixelsPix &bad = fCam->GetAverageBadSector(j); 846 MCalibrationChargePix &pix = fIntensCam 847 ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(j) 848 : (MCalibrationChargePix&)fCam->GetAverageSector(j); 806 849 807 850 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) … … 811 854 continue; 812 855 } 856 857 MBadPixelsPix &bad = fIntensCam 858 ? fIntensCam->GetAverageBadSector(j) 859 : fCam->GetAverageBadSector(j); 813 860 814 861 FinalizeAbsTimes(histhi, pix, bad, fFirstHiGain, fLastHiGain); … … 820 867 821 868 MHCalibrationChargePix &histlo = (MHCalibrationChargePix&)GetAverageLoGainSector(j); 822 MCalibrationChargePix &pix = (MCalibrationChargePix&)fCam->GetAverageSector(j); 823 MBadPixelsPix &bad = fCam->GetAverageBadSector(j); 869 MBadPixelsPix &bad = fIntensCam 870 ? fIntensCam->GetAverageBadSector(j) 871 : fCam->GetAverageBadSector(j); 824 872 825 873 if (histlo.GetSaturated() > fNumLoGainSaturationLimit*histlo.GetHGausHist()->GetEntries()) … … 831 879 } 832 880 881 MCalibrationChargePix &pix = fIntensCam 882 ? (MCalibrationChargePix&)fIntensCam->GetAverageSector(j) 883 : (MCalibrationChargePix&)fCam->GetAverageSector(j); 884 833 885 if (pix.IsHiGainSaturation()) 834 886 FinalizeAbsTimes(histlo, pix, bad, fFirstLoGain, fLastLoGain); … … 838 890 // Perform the fitting for the High Gain (done in MHCalibrationCam) 839 891 // 840 FitHiGainArrays((MCalibrationCam&)(*fCam),(*fBadPixels), 892 FitHiGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam), 893 *fBadPixels, 841 894 MBadPixelsPix::kHiGainNotFitted, 842 895 MBadPixelsPix::kHiGainOscillating); 896 843 897 // 844 898 // Perform the fitting for the Low Gain (done in MHCalibrationCam) 845 899 // 846 900 if (fLoGain) 847 FitLoGainArrays((MCalibrationCam&)(*fCam),(*fBadPixels), 901 FitLoGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam), 902 *fBadPixels, 848 903 MBadPixelsPix::kLoGainNotFitted, 849 904 MBadPixelsPix::kLoGainOscillating); 850 905 851 906 return kTRUE; 852 907 } … … 908 963 909 964 MBadPixelsPix &bad = (*fBadPixels)[i]; 910 MCalibrationPix &pix = (*fCam)[i];965 MCalibrationPix &pix = fIntensCam ? (*fIntensCam)[i] : (*fCam)[i]; 911 966 912 967 if (bad.IsUncalibrated( MBadPixelsPix::kHiGainNotFitted )) … … 941 996 // -------------------------------------------------------------------------- 942 997 // 943 // Calls MH GausEvents::DrawClone() for pixel idx998 // Calls MHCalibrationPix::DrawClone() for pixel idx 944 999 // 945 1000 void MHCalibrationChargeCam::DrawPixelContent(Int_t idx) const … … 1077 1132 null->SetDirectory(NULL); 1078 1133 null->SetBit(kCanDelete); 1134 null->SetStats(kFALSE); 1079 1135 // 1080 1136 // set the labels bigger -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePINDiode.cc
r4885 r4903 154 154 { 155 155 156 MH GausEvents::InitBins();156 MHCalibrationPix::InitBins(); 157 157 158 158 fHAbsTime. SetBins(fAbsTimeNbins, fAbsTimeFirst, fAbsTimeLast); … … 339 339 // 340 340 // "": displays the fHGausHist with fits and fHRmsCharge 341 // "all": executes additionally MH GausEvents::Draw(), with option "fourierevents"341 // "all": executes additionally MHCalibrationPix::Draw(), with option "fourierevents" 342 342 // 343 343 void MHCalibrationChargePINDiode::Draw(const Option_t *opt) … … 391 391 392 392 oldpad->cd(2); 393 MH GausEvents::Draw("fourierevents");394 } 395 396 397 398 393 MHCalibrationPix::Draw("fourierevents"); 394 } 395 396 397 398 -
trunk/MagicSoft/Mars/mcalib/MHCalibrationChargePINDiode.h
r4882 r4903 10 10 class MExtractedSignalPINDiode; 11 11 class MCalibrationChargePINDiode; 12 13 12 class MHCalibrationChargePINDiode : public MHCalibrationChargePix 14 13 { -
trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimeCam.cc
r4885 r4903 27 27 // 28 28 // Fills the extracted relative arrival times of MArrivalTimeCam into 29 // the MH GausEvents-classes MHCalibrationRelTimePix for every:29 // the MHCalibrationPix-classes MHCalibrationRelTimePix for every: 30 30 // 31 31 // - Pixel, stored in the TObjArray's MHCalibrationCam::fHiGainArray … … 52 52 // the fit is declared valid. 53 53 // Otherwise, the fit is repeated within ranges of the previous mean 54 // +- MH GausEvents::fPickupLimit (default: 5) sigma (see MHGausEvents::RepeatFit())54 // +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit()) 55 55 // In case this does not make the fit valid, the histogram means and RMS's are 56 // taken directly (see MH GausEvents::BypassFit()) and the following flags are set:56 // taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set: 57 57 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kRelTimeNotFitted ) and 58 58 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun ) 59 59 // 60 // Outliers of more than MH GausEvents::fPickupLimit (default: 5) sigmas61 // from the mean are counted as Pickup events (stored in MH GausEvents::fPickup)60 // Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas 61 // from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup) 62 62 // 63 63 // The class also fills arrays with the signal vs. event number, creates a fourier … … 88 88 #include "MHCalibrationRelTimePix.h" 89 89 90 #include "MHCalibrationPix.h" 91 90 92 #include "MLog.h" 91 93 #include "MLogManip.h" … … 93 95 #include "MParList.h" 94 96 97 #include "MCalibrationIntensityRelTimeCam.h" 98 95 99 #include "MCalibrationRelTimeCam.h" 100 #include "MCalibrationRelTimePix.h" 96 101 #include "MCalibrationPix.h" 97 102 … … 104 109 #include "MBadPixelsCam.h" 105 110 #include "MBadPixelsPix.h" 106 107 #include "MHGausEvents.h"108 111 109 112 ClassImp(MHCalibrationRelTimeCam); … … 163 166 { 164 167 165 166 fCam = (MCalibrationCam*)pList->FindObject("MCalibrationRelTimeCam"); 167 if (!fCam) 168 { 169 fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationRelTimeCam")); 168 fIntensCam = (MCalibrationIntensityCam*)pList->FindObject(AddSerialNumber("MCalibrationIntensityRelTimeCam")); 169 if (fIntensCam) 170 *fLog << inf << "Found MCalibrationIntensityRelTimeCam ... " << endl; 171 else 172 { 173 fCam = (MCalibrationCam*)pList->FindObject(AddSerialNumber("MCalibrationRelTimeCam")); 170 174 if (!fCam) 171 175 { 172 gLog << err << "Cannot find nor create MCalibrationRelTimeCam ... abort." << endl; 173 return kFALSE; 174 } 175 else 176 fCam->Init(*fGeom); 177 } 178 176 fCam = (MCalibrationCam*)pList->FindCreateObj(AddSerialNumber("MCalibrationRelTimeCam")); 177 if (!fCam) 178 { 179 *fLog << err << "Cannot find nor create MCalibrationRelTimeCam ... abort." << endl; 180 return kFALSE; 181 } 182 fCam->Init(*fGeom); 183 } 184 } 179 185 180 186 MArrivalTimeCam *signal = (MArrivalTimeCam*)pList->FindObject("MArrivalTimeCam"); … … 219 225 { 220 226 (*fAverageHiGainAreas)[j] = 221 new MHCalibrationRelTimePix(" MHCalibrationRelTimeAverageAreaHiGain",227 new MHCalibrationRelTimePix("RelTimeAverageHiGainArea", 222 228 "Average Rel. Arr. Times Hi-Gain Area Idx "); 223 229 224 GetAverageHiGainArea(j).GetHGausHist()->SetTitle("Rel. Arr. Times HiGain Area Idx "); 225 GetAverageHiGainArea(j).SetNbins(fAverageNbins); 226 227 InitHists(GetAverageHiGainArea(j),fCam->GetAverageBadArea(j),j); 230 MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageHiGainArea(j); 231 232 hist.SetNbins(fAverageNbins); 233 hist.GetHGausHist()->SetTitle("Rel. Arr. Times average HiGain Area Idx "); 234 235 if (fGeom->InheritsFrom("MGeomCamMagic")) 236 { 237 hist.GetHGausHist()->SetTitle(Form("%s%s%s","Signal averaged on event-by-event basis ", 238 j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: ")); 239 hist.InitBins(); 240 hist.SetEventFrequency(fPulserFrequency); 241 } 242 else 243 { 244 hist.GetHGausHist()->SetTitle("Signal averaged on event-by-event basis High Gain Area Idx "); 245 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 246 } 228 247 } 229 248 } … … 236 255 { 237 256 (*fAverageLoGainAreas)[j] = 238 new MHCalibrationRelTimePix(" MHCalibrationRelTimeAverageAreaLoGain",257 new MHCalibrationRelTimePix("RelTimeAverageAreaLoGain", 239 258 "Average Rel. Arr. Times Lo-Gain Area Idx "); 240 259 241 GetAverageLoGainArea(j).GetHGausHist()->SetTitle("Rel. Arr. Times LoGain Area Idx "); 242 GetAverageLoGainArea(j).SetNbins(fAverageNbins); 243 244 InitHists(GetAverageLoGainArea(j),fCam->GetAverageBadArea(j),j); 260 MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageLoGainArea(j); 261 hist.SetNbins(fAverageNbins); 262 263 if (fGeom->InheritsFrom("MGeomCamMagic")) 264 { 265 hist.GetHGausHist()->SetTitle(Form("%s%s%s","Rel. Arr. Times averaged on event-by-event basis ", 266 j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: ")); 267 hist.InitBins(); 268 hist.SetEventFrequency(fPulserFrequency); 269 } 270 else 271 { 272 hist.GetHGausHist()->SetTitle("Rel. Arr. Times averaged on event-by-event basis Low Gain Area Idx "); 273 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 274 } 245 275 } 246 276 } … … 253 283 { 254 284 (*fAverageHiGainSectors)[j] = 255 new MHCalibrationRelTimePix(" MHCalibrationRelTimeAverageSectorHiGain",256 "Average Rel. Arr. Times Hi-GainSector ");285 new MHCalibrationRelTimePix("RelTimeAverageSectorHiGain", 286 "Average HiGain Rel. Arr. Times Sector "); 257 287 258 GetAverageHiGainSector(j).GetHGausHist()->SetTitle("Rel. Arr. Times HiGain Sector "); 259 GetAverageHiGainSector(j).SetNbins(fAverageNbins); 288 MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageHiGainSector(j); 289 290 hist.GetHGausHist()->SetTitle("Rel. Arr. Times averaged on event-by-event basis HiGain Sector "); 291 hist.SetNbins(fAverageNbins); 260 292 261 InitHists( GetAverageHiGainSector(j),fCam->GetAverageBadSector(j),j);293 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 262 294 } 263 295 } … … 270 302 { 271 303 (*fAverageLoGainSectors)[j] = 272 new MHCalibrationRelTimePix(" MHCalibrationRelTimeAverageSectorLoGain",273 "Average Rel. Arr. Times Lo-GainSector ");304 new MHCalibrationRelTimePix("RelTimeAverageSectorLoGain", 305 "Average LoGain Rel. Arr. Times Sector "); 274 306 275 GetAverageLoGainSector(j).GetHGausHist()->SetTitle("Rel. Arr. Times LoGain Sector "); 276 GetAverageLoGainSector(j).SetNbins(fAverageNbins); 307 MHCalibrationRelTimePix &hist = (MHCalibrationRelTimePix&)GetAverageLoGainSector(j); 308 309 hist.GetHGausHist()->SetTitle("Rel. Arr. Times averaged on event-by-event basis LoGain Sector "); 310 hist.SetNbins(fAverageNbins); 277 311 278 InitHists(GetAverageLoGainSector(j),fCam->GetAverageBadSector(j),j); 279 312 InitHists(hist,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 280 313 } 281 314 } … … 338 371 { 339 372 340 MH GausEvents&histhi = (*this)[i];341 MH GausEvents&histlo = (*this)(i);373 MHCalibrationPix &histhi = (*this)[i]; 374 MHCalibrationPix &histlo = (*this)(i); 342 375 343 376 if (histhi.IsExcluded()) … … 372 405 for (Int_t j=0; j<nareas; j++) 373 406 { 374 MH GausEvents&histhi = GetAverageHiGainArea(j);407 MHCalibrationPix &histhi = GetAverageHiGainArea(j); 375 408 histhi.FillHistAndArray(fNumareahi[j] == 0 ? 0. : fSumareahi[j]/fNumareahi[j]); 376 409 377 410 if (fLoGain) 378 411 { 379 MH GausEvents&histlo = GetAverageLoGainArea(j);412 MHCalibrationPix &histlo = GetAverageLoGainArea(j); 380 413 histlo.FillHistAndArray(fNumarealo[j] == 0 ? 0. : fSumarealo[j]/fNumarealo[j]); 381 414 } … … 384 417 for (Int_t j=0; j<nsectors; j++) 385 418 { 386 MH GausEvents&histhi = GetAverageHiGainSector(j);419 MHCalibrationPix &histhi = GetAverageHiGainSector(j); 387 420 histhi.FillHistAndArray(fNumsectorhi[j] == 0 ? 0. : fSumsectorhi[j]/fNumsectorhi[j]); 388 421 389 422 if (fLoGain) 390 423 { 391 MH GausEvents&histlo = GetAverageLoGainSector(j);424 MHCalibrationPix &histlo = GetAverageLoGainSector(j); 392 425 histlo.FillHistAndArray(fNumsectorlo[j] == 0 ? 0. : fSumsectorlo[j]/fNumsectorlo[j]); 393 426 } … … 415 448 continue; 416 449 450 MCalibrationRelTimePix &pix = fIntensCam 451 ? (MCalibrationRelTimePix&)(*fIntensCam)[i] 452 : (MCalibrationRelTimePix&)(*fCam)[i]; 453 417 454 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) 418 455 { 419 (*fCam)[i].SetHiGainSaturation();456 pix.SetHiGainSaturation(); 420 457 histhi.SetExcluded(); 421 458 } … … 423 460 if (fLoGain) 424 461 (*this)(i).SetExcluded(); 425 426 } 427 462 463 Stat_t overflow = histhi.GetHGausHist()->GetBinContent(histhi.GetHGausHist()->GetNbinsX()+1); 464 if (overflow > 0.1) 465 { 466 *fLog << warn << GetDescriptor() 467 << ": HiGain Histogram Overflow occurred " << overflow 468 << " times in pixel: " << i << " (without saturation!) " << endl; 469 // bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow ); 470 } 471 472 overflow = histhi.GetHGausHist()->GetBinContent(0); 473 if (overflow > 0.1) 474 { 475 *fLog << warn << GetDescriptor() 476 << ": HiGain Histogram Underflow occurred " << overflow 477 << " times in pixel: " << i << " (without saturation!) " << endl; 478 // bad.SetUncalibrated( MBadPixelsPix::kHiGainOverFlow ); 479 } 480 } 428 481 429 482 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++) … … 434 487 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) 435 488 { 436 fCam->GetAverageArea(j).SetHiGainSaturation(); 489 MCalibrationRelTimePix &pix = fIntensCam 490 ? (MCalibrationRelTimePix&)fIntensCam->GetAverageArea(j) 491 : (MCalibrationRelTimePix&)fCam->GetAverageArea(j); 492 pix.SetHiGainSaturation(); 437 493 histhi.SetExcluded(); 438 494 } … … 447 503 448 504 MHCalibrationRelTimePix &histhi = (MHCalibrationRelTimePix&)GetAverageHiGainSector(j); 505 MCalibrationRelTimePix &pix = fIntensCam 506 ? (MCalibrationRelTimePix&)fIntensCam->GetAverageSector(j) 507 : (MCalibrationRelTimePix&)fCam->GetAverageSector(j); 449 508 450 509 if (histhi.GetSaturated() > fNumHiGainSaturationLimit*histhi.GetHGausHist()->GetEntries()) 451 510 { 452 fCam->GetAverageSector(j).SetHiGainSaturation();511 pix.SetHiGainSaturation(); 453 512 histhi.SetExcluded(); 454 513 } … … 458 517 } 459 518 460 FitHiGainArrays((*fCam),*fBadPixels, 519 FitHiGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam), 520 *fBadPixels, 461 521 MBadPixelsPix::kRelTimeNotFitted, 462 522 MBadPixelsPix::kRelTimeOscillating); 463 523 464 524 if (fLoGain) 465 FitLoGainArrays((*fCam),*fBadPixels, 525 FitLoGainArrays(fIntensCam ? (MCalibrationCam&)(*fIntensCam->GetCam()) : (MCalibrationCam&)(*fCam), 526 *fBadPixels, 466 527 MBadPixelsPix::kRelTimeNotFitted, 467 528 MBadPixelsPix::kRelTimeOscillating); … … 557 618 // -------------------------------------------------------------------------- 558 619 // 559 // Calls MH GausEvents::DrawClone() for pixel idx620 // Calls MHCalibrationPix::DrawClone() for pixel idx 560 621 // 561 622 void MHCalibrationRelTimeCam::DrawPixelContent(Int_t idx) const -
trunk/MagicSoft/Mars/mcalib/MHCalibrationTestCam.cc
r4809 r4903 49 49 // the fit is declared valid. 50 50 // Otherwise, the fit is repeated within ranges of the previous mean 51 // +- MH GausEvents::fPickupLimit (default: 5) sigma (see MHGausEvents::RepeatFit())51 // +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit()) 52 52 // In case this does not make the fit valid, the histogram means and RMS's are 53 // taken directly (see MH GausEvents::BypassFit()) and the following flags are set:53 // taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set: 54 54 // - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted ) and 55 55 // - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun ) 56 56 // 57 // Outliers of more than MH GausEvents::fPickupLimit (default: 5) sigmas58 // from the mean are counted as Pickup events (stored in MH GausEvents::fPickup)57 // Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas 58 // from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup) 59 59 // 60 60 // The class also fills arrays with the signal vs. event number, creates a fourier … … 85 85 #include "MHCalibrationTestPix.h" 86 86 87 #include "MHCalibrationPix.h" 88 87 89 #include "MLog.h" 88 90 #include "MLogManip.h" … … 130 132 // 131 133 // Initializes, if empty to MGeomCam::GetNumAreas() for: 132 // - MHCalibrationCam::fAverageHiGainAreas , MHCalibrationCam::fAverageLoGainAreas134 // - MHCalibrationCam::fAverageHiGainAreas 133 135 // 134 136 // Initializes, if empty to MGeomCam::GetNumSectors() for: 135 // - MHCalibrationCam::fAverageHiGainSectors , MHCalibrationCam::fAverageLoGainSectors137 // - MHCalibrationCam::fAverageHiGainSectors 136 138 // 137 139 // Calls MHCalibrationCam::InitHists() for every entry in: … … 174 176 } 175 177 176 if (fLoGainArray->GetEntries()==0)177 {178 fLoGainArray->Expand(npixels);179 for (Int_t i=0; i<npixels; i++)180 {181 (*fLoGainArray)[i] = new MHCalibrationTestPix("Calibrated Events",182 "Test Calibration Pixel");183 InitHists((*this)(i),(*fBadPixels)[i],i);184 }185 }186 187 178 188 179 if (fAverageHiGainAreas->GetEntries()==0) … … 207 198 } 208 199 209 if (fAverageLoGainAreas->GetEntries()==0)210 {211 fAverageLoGainAreas->Expand(nareas);212 213 for (Int_t j=0; j<nareas; j++)214 {215 (*fAverageLoGainAreas)[j] =216 new MHCalibrationTestPix("MHCalibrationTestAverageArea",217 "Average Test Calibrations Area Idx ");218 219 GetAverageLoGainArea(j).GetHGausHist()->SetTitle("Test Calibrations Area Idx ");220 GetAverageLoGainArea(j).SetNbins(fAverageNbins);221 GetAverageLoGainArea(j).InitBins();222 GetAverageLoGainArea(j).ChangeHistId(j);223 GetAverageLoGainArea(j).SetEventFrequency(fPulserFrequency);224 225 }226 }227 228 200 229 201 if (fAverageHiGainSectors->GetEntries()==0) … … 250 222 251 223 252 if (fAverageLoGainSectors->GetEntries()==0)253 {254 fAverageLoGainSectors->Expand(nsectors);255 256 for (Int_t j=0; j<nsectors; j++)257 {258 (*fAverageLoGainSectors)[j] =259 new MHCalibrationTestPix("MHCalibrationTestAverageSector",260 "Average Test Calibrations Sector ");261 262 GetAverageLoGainSector(j).GetHGausHist()->SetTitle("Test Calibrations Sector ");263 GetAverageLoGainSector(j).SetNbins(fAverageNbins);264 GetAverageLoGainSector(j).InitBins();265 GetAverageLoGainSector(j).ChangeHistId(j);266 GetAverageLoGainSector(j).SetEventFrequency(fPulserFrequency);267 }268 }269 270 271 224 fMeanMeanPhotPerArea.Set(nareas); 272 225 fRmsMeanPhotPerArea .Set(nareas); 273 226 fMeanSigmaPhotPerArea.Set(nareas); 274 227 fRmsSigmaPhotPerArea.Set(nareas); 228 229 fLoGain = kFALSE; 275 230 276 231 return kTRUE; … … 287 242 // - number of sectors 288 243 // 289 // Fills HiGain or LoGain histograms (MHGausEvents::FillHistAndArray()), respectively 290 // depending on MCerPhotPix::IsLoGainUsed(), with: 291 // - MCerPhotPix::GetArrivalTime(pixid) - MCerPhotPix::GetArrivalTime(1); 292 // (i.e. the time difference between pixel i and pixel 1 (hardware number: 2) ) 244 // Fills HiGain histograms (MHGausEvents::FillHistAndArray()) 245 // with: 246 // - MCerPhotPix::GetNumPhotons(pixid); 293 247 // 294 248 Bool_t MHCalibrationTestCam::FillHists(const MParContainer *par, const Stat_t w) … … 298 252 if (!calibration) 299 253 { 300 gLog << err << "No argument in MHCalibration RelTimeCam::Fill... abort." << endl;254 gLog << err << "No argument in MHCalibrationTestCam::Fill... abort." << endl; 301 255 return kFALSE; 302 256 } … … 314 268 { 315 269 316 MH GausEvents&histhi = (*this)[i];270 MHCalibrationPix &histhi = (*this)[i]; 317 271 318 272 const MCerPhotPix *pix = calibration->GetPixById(i); … … 339 293 for (Int_t j=0; j<nareas; j++) 340 294 { 341 MH GausEvents&histhi = GetAverageHiGainArea(j);295 MHCalibrationPix &histhi = GetAverageHiGainArea(j); 342 296 histhi.FillHistAndArray(numareahi[j] == 0 ? 0. : sumareahi[j]/numareahi[j]); 343 297 } … … 345 299 for (Int_t j=0; j<nsectors; j++) 346 300 { 347 MH GausEvents&histhi = GetAverageHiGainSector(j);301 MHCalibrationPix &histhi = GetAverageHiGainSector(j); 348 302 histhi.FillHistAndArray(numsectorhi[j] == 0 ? 0. : sumsectorhi[j]/numsectorhi[j]); 349 303 … … 358 312 // - MHCalibrationCam::FitHiGainArrays() with flags: 359 313 // MBadPixelsPix::kTestNotFitted and MBadPixelsPix::kTestOscillating 360 // - MHCalibrationCam::FitLoGainArrays() with flags:361 // MBadPixelsPix::kTestNotFitted and MBadPixelsPix::kTestOscillating362 314 // 363 315 Bool_t MHCalibrationTestCam::FinalizeHists() … … 372 324 { 373 325 374 MH GausEvents&hist = (*this)[i];326 MHCalibrationPix &hist = (*this)[i]; 375 327 376 328 if (hist.IsEmpty()) … … 397 349 { 398 350 399 MH GausEvents&hist = GetAverageHiGainArea(j);351 MHCalibrationPix &hist = GetAverageHiGainArea(j); 400 352 if (hist.IsEmpty()) 401 353 continue; … … 424 376 { 425 377 426 MH GausEvents&hist = GetAverageHiGainSector(j);378 MHCalibrationPix &hist = GetAverageHiGainSector(j); 427 379 if (hist.IsEmpty()) 428 380 continue; … … 476 428 return kFALSE; 477 429 478 const MH GausEvents&pix = (*this)[idx];430 const MHCalibrationPix &pix = (*this)[idx]; 479 431 480 432 if (pix.IsEmpty()) … … 526 478 // -------------------------------------------------------------------------- 527 479 // 528 // Calls MH GausEvents::DrawClone() for pixel idx480 // Calls MHCalibrationPix::DrawClone() for pixel idx 529 481 // 530 482 void MHCalibrationTestCam::DrawPixelContent(Int_t idx) const … … 545 497 { 546 498 547 MH GausEvents&hist = GetAverageHiGainArea(j);499 MHCalibrationPix &hist = GetAverageHiGainArea(j); 548 500 549 501 const Float_t numsqr = TMath::Sqrt((Float_t)fAverageAreaNum[j]);
Note:
See TracChangeset
for help on using the changeset viewer.