Changeset 4949 for trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc
- Timestamp:
- 09/11/04 21:44:12 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhcalib/MHCalibrationCam.cc
r4946 r4949 50 50 ///////////////////////////////////////////////////////////////////////////// 51 51 #include "MHCalibrationCam.h" 52 #include "MHCalibrationPix.h" 52 53 53 54 #include <TVirtualPad.h> … … 60 61 #include "MLogManip.h" 61 62 63 #include "MCalibrationIntensityCam.h" 64 #include "MCalibrationCam.h" 62 65 #include "MCalibrationPix.h" 63 #include "MCalibrationCam.h"64 65 #include "MHCalibrationPix.h"66 66 67 67 #include "MBadPixelsPix.h" … … 80 80 81 81 const Int_t MHCalibrationCam::fgPulserFrequency = 500; 82 const TString MHCalibrationCam::gsHistName = "Hist"; 83 const TString MHCalibrationCam::gsHistTitle = ""; 84 const TString MHCalibrationCam::gsHistXTitle = ""; 85 const TString MHCalibrationCam::gsHistYTitle = "Nr. events"; 82 86 // -------------------------------------------------------------------------- 83 87 // … … 96 100 // 97 101 MHCalibrationCam::MHCalibrationCam(const char *name, const char *title) 98 : fColor(MCalibrationCam::kNONE), 102 : fHistName(gsHistName),fHistTitle(gsHistTitle), 103 fHistXTitle(gsHistXTitle),fHistYTitle(gsHistYTitle), 104 fColor(MCalibrationCam::kNONE), 99 105 fBadPixels(NULL), fIntensCam(NULL), fCam(NULL), fGeom(NULL), fRunHeader(NULL) 100 106 { … … 300 306 301 307 302 const TArrayI &MHCalibrationCam::GetRunNumbers() const303 {304 return fRunNumbers;305 }306 307 308 // -------------------------------------------------------------------------- 308 309 // … … 427 428 } 428 429 429 430 Bool_t MHCalibrationCam::SetupHists(const MParList *pList)431 {432 return kTRUE;433 }434 430 435 431 // -------------------------------------------------------------------------- … … 570 566 } 571 567 572 573 574 Bool_t MHCalibrationCam::ReInitHists(MParList *pList) 575 { 576 return kTRUE; 577 } 568 //-------------------------------------------------------------------------------------- 569 // 570 // Initializes the High Gain Arrays: 571 // 572 // - Expand fHiGainArrays to npixels 573 // - Expand fAverageHiGainAreas to nareas 574 // - Expand fAverageHiGainSectors to nsectors 575 // 576 // - For every entry in the expanded arrays: 577 // * call new MHCalibrationPix(fHistName,fHistTitle) 578 // * SetNbins(fNbins), SetFirst(fFirst), SetLast(fLast) 579 // * Set fHistName and fHistTitle in the Histogram of MHCalibrationPix 580 // * Set X-axis and Y-axis titles with fHistXTitle and fHistYTitle 581 // * Call InitHists 582 // 583 void MHCalibrationCam::InitHiGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors) 584 { 585 586 if (fHiGainArray->GetEntries()==0) 587 { 588 fHiGainArray->Expand(npixels); 589 for (Int_t i=0; i<npixels; i++) 590 { 591 (*fHiGainArray)[i] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainPix"), 592 Form("%s%s",fHistTitle.Data()," High Gain Pixel")); 593 594 MHCalibrationPix &pix = (*this)[i]; 595 pix.SetNbins(fNbins); 596 pix.SetFirst(fFirst); 597 pix.SetLast (fLast); 598 599 TH1F *h = pix.GetHGausHist(); 600 601 h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainPix")); 602 h->SetTitle(Form("%s%s",fHistTitle.Data()," High Gain Pixel ")); 603 h->SetXTitle(fHistXTitle.Data()); 604 h->SetYTitle(fHistYTitle.Data()); 605 606 InitHists(pix,(*fBadPixels)[i],i); 607 } 608 } 609 610 if (fAverageHiGainAreas->GetEntries()==0) 611 { 612 fAverageHiGainAreas->Expand(nareas); 613 614 for (Int_t j=0; j<nareas; j++) 615 { 616 (*fAverageHiGainAreas)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainArea"), 617 Form("%s%s",fHistTitle.Data()," High Gain Area Idx ")); 618 619 MHCalibrationPix &pix = GetAverageHiGainArea(j); 620 621 pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas)); 622 pix.SetFirst(fFirst); 623 pix.SetLast (fLast); 624 625 TH1F *h = pix.GetHGausHist(); 626 627 h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainArea")); 628 h->SetXTitle(fHistXTitle.Data()); 629 h->SetYTitle(fHistYTitle.Data()); 630 631 if (fGeom && fGeom->InheritsFrom("MGeomCamMagic")) 632 { 633 h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ", 634 j==0 ? "Inner Pixels " : "Outer Pixels ","High Gain Runs: ")); 635 pix.InitBins(); 636 pix.SetEventFrequency(fPulserFrequency); 637 } 638 else 639 { 640 h->SetTitle(Form("%s%s",fHistTitle.Data()," averaged on event-by-event basis High Gain Area Idx ")); 641 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 642 } 643 } 644 } 645 646 if (fAverageHiGainSectors->GetEntries()==0) 647 { 648 fAverageHiGainSectors->Expand(nsectors); 649 650 for (Int_t j=0; j<nsectors; j++) 651 { 652 (*fAverageHiGainSectors)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"HiGainSector"), 653 Form("%s%s",fHistTitle.Data()," High Gain Sector ")); 654 MHCalibrationPix &pix = GetAverageHiGainSector(j); 655 656 pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nsectors)); 657 pix.SetFirst(fFirst); 658 pix.SetLast (fLast); 659 660 TH1F *h = pix.GetHGausHist(); 661 662 h->SetName (Form("%s%s%s","H",fHistName.Data(),"HiGainSector")); 663 h->SetTitle(Form("%s%s",fHistTitle.Data()," High Gain Sector ")); 664 h->SetXTitle(fHistXTitle.Data()); 665 h->SetYTitle(fHistYTitle.Data()); 666 667 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 668 } 669 } 670 } 671 672 //-------------------------------------------------------------------------------------- 673 // 674 // Return, if IsLoGain() is kFALSE 675 // 676 // Initializes the Low Gain Arrays: 677 // 678 // - Expand fLoGainArrays to npixels 679 // - Expand fAverageLoGainAreas to nareas 680 // - Expand fAverageLoGainSectors to nsectors 681 // 682 // - For every entry in the expanded arrays: 683 // * call new MHCalibrationPix(fHistName,fHistTitle) 684 // * SetBins(fNbins), SetFirst(fFirst), SetLast(fLast) 685 // * Set fHistName and fHistTitle in the Histogram of MHCalibrationPix 686 // * Set X-axis and Y-axis titles with fHistXTitle and fHistYTitle 687 // * Call InitHists 688 // 689 void MHCalibrationCam::InitLoGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors) 690 { 691 692 if (!IsLoGain()) 693 return; 694 695 if (fLoGainArray->GetEntries()==0) 696 { 697 fLoGainArray->Expand(npixels); 698 for (Int_t i=0; i<npixels; i++) 699 { 700 (*fLoGainArray)[i] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainPix"), 701 Form("%s%s",fHistTitle.Data()," Low Gain Pixel")); 702 703 MHCalibrationPix &pix = (*this)[i]; 704 pix.SetNbins(fNbins); 705 pix.SetFirst(fFirst); 706 pix.SetLast (fLast); 707 708 TH1F *h = pix.GetHGausHist(); 709 710 h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainPix")); 711 h->SetTitle(Form("%s%s",fHistTitle.Data()," Low Gain Pixel ")); 712 h->SetXTitle(fHistXTitle.Data()); 713 h->SetYTitle(fHistYTitle.Data()); 714 715 InitHists(pix,(*fBadPixels)[i],i); 716 } 717 } 718 719 if (fAverageLoGainAreas->GetEntries()==0) 720 { 721 fAverageLoGainAreas->Expand(nareas); 722 723 for (Int_t j=0; j<nareas; j++) 724 { 725 (*fAverageLoGainAreas)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainArea"), 726 Form("%s%s",fHistTitle.Data()," Low Gain Area Idx ")); 727 728 MHCalibrationPix &pix = GetAverageLoGainArea(j); 729 730 pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nareas)); 731 pix.SetFirst(fFirst); 732 pix.SetLast (fLast); 733 734 TH1F *h = pix.GetHGausHist(); 735 736 h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainArea")); 737 h->SetXTitle(fHistXTitle.Data()); 738 h->SetYTitle(fHistYTitle.Data()); 739 740 if (fGeom && fGeom->InheritsFrom("MGeomCamMagic")) 741 { 742 h->SetTitle(Form("%s%s%s%s",fHistTitle.Data()," averaged on event-by-event basis ", 743 j==0 ? "Inner Pixels " : "Outer Pixels ","Low Gain Runs: ")); 744 pix.InitBins(); 745 pix.SetEventFrequency(fPulserFrequency); 746 } 747 else 748 { 749 h->SetTitle(Form("%s%s",fHistTitle.Data()," averaged on event-by-event basis Low Gain Area Idx ")); 750 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j); 751 } 752 } 753 } 754 755 if (fAverageLoGainSectors->GetEntries()==0) 756 { 757 fAverageLoGainSectors->Expand(nsectors); 758 759 for (Int_t j=0; j<nsectors; j++) 760 { 761 (*fAverageLoGainSectors)[j] = new MHCalibrationPix(Form("%s%s",fHistName.Data(),"LoGainSector"), 762 Form("%s%s",fHistTitle.Data()," Low Gain Sector ")); 763 MHCalibrationPix &pix = GetAverageLoGainSector(j); 764 765 pix.SetNbins(fNbins*(Int_t)TMath::Sqrt((Float_t)npixels/nsectors)); 766 pix.SetFirst(fFirst); 767 pix.SetLast (fLast); 768 769 TH1F *h = pix.GetHGausHist(); 770 771 h->SetName (Form("%s%s%s","H",fHistName.Data(),"LoGainSector")); 772 h->SetTitle(Form("%s%s",fHistTitle.Data()," Low Gain Sector ")); 773 h->SetXTitle(fHistXTitle.Data()); 774 h->SetYTitle(fHistYTitle.Data()); 775 776 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j); 777 } 778 } 779 } 780 781 578 782 579 783 //-------------------------------------------------------------------------------- … … 1099 1303 if (IsEnvDefined(env, prefix, "Oscillations", print)) 1100 1304 { 1101 Set Debug(GetEnvValue(env, prefix, "Oscillations", IsOscillations()));1305 SetOscillations(GetEnvValue(env, prefix, "Oscillations", IsOscillations())); 1102 1306 rc = kTRUE; 1103 1307 } 1104 1308 1309 if (IsEnvDefined(env, prefix, "Nbins", print)) 1310 { 1311 SetNbins(GetEnvValue(env, prefix, "Nbins", fNbins)); 1312 rc = kTRUE; 1313 } 1314 if (IsEnvDefined(env, prefix, "First", print)) 1315 { 1316 SetFirst(GetEnvValue(env, prefix, "First", fFirst)); 1317 rc = kTRUE; 1318 } 1319 if (IsEnvDefined(env, prefix, "Last", print)) 1320 { 1321 SetLast(GetEnvValue(env, prefix, "Last", fLast)); 1322 rc = kTRUE; 1323 } 1105 1324 1106 1325 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.