Changeset 2377 for trunk/MagicSoft/Mars/mhist/MHCamera.cc
- Timestamp:
- 10/04/03 12:47:13 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r2327 r2377 78 78 using namespace std; 79 79 80 // ------------------------------------------------------------------------ 81 // 82 // Default Constructor. To be used by the root system ONLY. 83 // 84 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend) 80 void MHCamera::Init() 85 81 { 86 82 SetDirectory(NULL); 87 83 88 fNotify = NULL; 84 SetLineColor(kGreen); 85 SetMarkerStyle(kFullDotMedium); 86 SetXTitle("Pixel Index"); 87 88 fNotify = new TList; 89 89 90 90 #if ROOT_VERSION_CODE < ROOT_VERSION(3,01,06) … … 97 97 // ------------------------------------------------------------------------ 98 98 // 99 // Default Constructor. To be used by the root system ONLY. 100 // 101 MHCamera::MHCamera() : TH1D(), fGeomCam(NULL), fColors(kItemsLegend) 102 { 103 Init(); 104 } 105 106 // ------------------------------------------------------------------------ 107 // 99 108 // Constructor. Makes a clone of MGeomCam. Removed the TH1D from the 100 109 // current directory. Calls Sumw2(). Set the histogram line color … … 102 111 // 103 112 MHCamera::MHCamera(const MGeomCam &geom, const char *name, const char *title) 104 : TH1D(name, title, geom.GetNumPixels(), -0.5, geom.GetNumPixels()-0.5), 105 fUsed(geom.GetNumPixels()), fColors(kItemsLegend) 106 { 107 fGeomCam = (MGeomCam*)geom.Clone(); 108 109 SetDirectory(NULL); 110 Sumw2(); 111 112 SetLineColor(kGreen); 113 SetMarkerStyle(kFullDotMedium); 114 SetXTitle("Pixel Index"); 115 116 fNotify = new TList; 117 118 // 119 // create the hexagons of the display 113 : fGeomCam(NULL), /*TH1D(name, title, geom.GetNumPixels(), -0.5, geom.GetNumPixels()-0.5), 114 fUsed(geom.GetNumPixels()),*/ fColors(kItemsLegend) 115 { 116 //fGeomCam = (MGeomCam*)geom.Clone(); 117 SetGeometry(geom, name, title); 118 Init(); 119 120 120 // 121 121 // root 3.02 … … 123 123 // register BIT(8) as kNoContextMenu. If an object has this bit set it will 124 124 // not get an automatic context menu when clicked with the right mouse button. 125 126 // 127 // Construct all hexagons. Use new-operator with placement 128 // 125 } 126 127 void MHCamera::SetGeometry(const MGeomCam &geom, const char *name, const char *title) 128 { 129 SetNameTitle(name, title); 130 131 TAxis &x = *GetXaxis(); 132 133 SetBins(geom.GetNumPixels(), 0, 1); 134 x.Set(geom.GetNumPixels(), -0.5, geom.GetNumPixels()-0.5); 135 136 //SetBins(geom.GetNumPixels(), -0.5, geom.GetNumPixels()-0.5); 137 //Rebuild(); 138 139 Sumw2(); // necessary? 140 141 if (fGeomCam) 142 delete fGeomCam; 143 fGeomCam = (MGeomCam*)geom.Clone(); 144 145 fUsed.Set(geom.GetNumPixels()); 129 146 for (Int_t i=0; i<fNcells-2; i++) 130 147 ResetUsed(i); 131 148 132 #if ROOT_VERSION_CODE < ROOT_VERSION(3,01,06)133 SetPalette(1, 0);134 #else135 SetPalette(51, 0);136 #endif137 149 } 138 150 … … 229 241 Int_t MHCamera::Fill(Axis_t x, Axis_t y, Stat_t w) 230 242 { 243 if (fNcells<=1) 244 return -1; 245 231 246 for (Int_t idx=0; idx<fNcells-2; idx++) 232 247 { … … 243 258 Stat_t MHCamera::GetMean(Int_t axis) const 244 259 { 260 if (fNcells<=1) 261 return 0; 262 245 263 Stat_t mean = 0; 246 264 for (int i=1; i<fNcells-1; i++) … … 252 270 Stat_t MHCamera::GetRMS(Int_t axis) const 253 271 { 272 if (fNcells<=1) 273 return -1; 274 254 275 const Int_t n = fNcells-2; 255 276 … … 278 299 return fMinimum; 279 300 301 if (fNcells<=1) 302 return 0; 303 280 304 Double_t minimum=FLT_MAX; 281 305 … … 304 328 if (fMaximum != -1111) 305 329 return fMaximum; 330 331 if (fNcells<=1) 332 return 1; 306 333 307 334 Double_t maximum=-FLT_MAX; … … 491 518 void MHCamera::Paint(Option_t *o) 492 519 { 520 if (fNcells<=1) 521 return; 522 493 523 TString opt(o); 494 524 opt.ToLower(); … … 585 615 void MHCamera::DrawPixelIndices() 586 616 { 617 if (fNcells<=1) 618 return; 619 587 620 // FIXME: Is this correct? 588 621 for (int i=0; i<kItemsLegend; i++) … … 609 642 void MHCamera::DrawSectorIndices() 610 643 { 644 if (fNcells<=1) 645 return; 646 611 647 for (int i=0; i<kItemsLegend; i++) 612 648 fColors[i] = 16; … … 637 673 void MHCamera::AddCamContent(const MCamEvent &event, Int_t type) 638 674 { 675 if (fNcells<=1) 676 return; 677 639 678 // FIXME: Security check missing! 640 679 for (Int_t idx=0; idx<fNcells-2; idx++) … … 717 756 void MHCamera::CntCamContent(const MCamEvent &event, Double_t threshold, Int_t type) 718 757 { 758 if (fNcells<=1) 759 return; 760 719 761 // FIXME: Security check missing! 720 762 for (Int_t idx=0; idx<fNcells-2; idx++) … … 757 799 void MHCamera::FillRandom() 758 800 { 801 if (fNcells<=1) 802 return; 803 759 804 Reset(); 760 805 … … 775 820 void MHCamera::FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2) 776 821 { 822 if (fNcells<=1) 823 return; 824 777 825 SetCamContent(event, 2); 778 826 … … 807 855 void MHCamera::Reset(Option_t *opt) 808 856 { 857 if (fNcells<=1) 858 return; 859 809 860 TH1::Reset(opt); 810 861 … … 965 1016 Int_t MHCamera::DistancetoPrimitive(Int_t px, Int_t py) 966 1017 { 1018 if (fNcells<=1) 1019 return 999999; 1020 967 1021 const Int_t kMaxDiff = 7; 968 1022 … … 1014 1068 Int_t MHCamera::GetPixelIndex(Int_t px, Int_t py) const 1015 1069 { 1070 if (fNcells<=1) 1071 return -1; 1072 1016 1073 Int_t i; 1017 1074 for (i=0; i<fNcells-2; i++)
Note:
See TracChangeset
for help on using the changeset viewer.