Changeset 2377 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 10/04/03 12:47:13 (21 years ago)
- Location:
- trunk/MagicSoft/Mars/mhist
- Files:
-
- 6 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++) -
trunk/MagicSoft/Mars/mhist/MHCamera.h
r2298 r2377 38 38 39 39 //TGStatusBar *fStatusBar; 40 void Init(); 40 41 41 42 Int_t GetColor(Float_t val, Float_t min, Float_t max, Bool_t islog); … … 72 73 MHCamera(const MGeomCam &geom, const char *name="", const char *title=""); 73 74 ~MHCamera(); 75 76 void SetGeometry(const MGeomCam &geom, const char *name="", const char *title=""); 77 const MGeomCam* GetGeometry() const { return fGeomCam; } 74 78 75 79 Bool_t IsUsed(Int_t idx) const { return TESTBIT(const_cast<TArrayC&>(fUsed)[idx], kIsUsed); } -
trunk/MagicSoft/Mars/mhist/MHCurrents.cc
r2191 r2377 53 53 void MHCurrents::Clear(const Option_t *) 54 54 { 55 const Int_t n = fCam ? fCam->GetNumPixels() : 577; 56 55 57 // FIXME: Implement a clear function with setmem 56 for (int i=0; i<577; i++) 58 fSum.Set(n); // also clears memory 59 fRms.Set(n); 60 /* for (int i=0; i<577; i++) 57 61 { 58 62 fSum[i] = 0; 59 63 fRms[i] = 0; 60 } 64 }*/ 61 65 62 66 fEntries = 0; … … 69 73 // 70 74 MHCurrents::MHCurrents(const char *name, const char *title) 71 : fSum(577), fRms(577),fCam(NULL), fEvt(NULL), fDispl(NULL)75 : /*fSum(577), fRms(577), */fCam(NULL), fEvt(NULL), fDispl(NULL) 72 76 { 73 77 // … … 113 117 114 118 fCam = (MGeomCam*)plist->FindObject("MGeomCam"); 115 if (!fCam) 116 *fLog << warn << GetDescriptor() << ": No MGeomCam found." << endl; 119 /* 120 if (!fCam) 121 *fLog << warn << GetDescriptor() << ": No MGeomCam found... assuming Magic geometry!" << endl; 122 */ 123 if (!fCam) 124 { 125 *fLog << err << GetDescriptor() << ": No MGeomCam found... aborting." << endl; 126 return kFALSE; 127 } 117 128 118 129 Clear(); 119 130 131 const Int_t n = fSum.GetSize(); 132 120 133 MBinning bins; 121 bins.SetEdges( 577, -0.5, 576.5);134 bins.SetEdges(n, -0.5, n-0.5); 122 135 bins.Apply(fHist); 123 136 … … 138 151 } 139 152 140 for (UInt_t idx=0; idx<577; idx++) 153 const Int_t n = fSum.GetSize(); 154 for (UInt_t idx=0; idx<n; idx++) 141 155 { 142 156 Float_t val; … … 166 180 } 167 181 168 for (UInt_t i=0; i<577; i++) 182 const Int_t n = fSum.GetSize(); 183 for (UInt_t i=0; i<n; i++) 169 184 { 170 185 // calc sdev^2 for pixel index i -
trunk/MagicSoft/Mars/mhist/MHFadcCam.cc
r2333 r2377 37 37 #include "MLogManip.h" 38 38 39 #include "MParList.h" 40 #include "MGeomCam.h" 41 39 42 #include "MRawEvtData.h" 40 43 #include "MRawEvtPixelIter.h" … … 49 52 // creates an a list of histograms for all pixels and both gain channels 50 53 // 51 MHFadcCam::MHFadcCam( const Int_t n,MHFadcPix::Type_t t, const char *name, const char *title)54 MHFadcCam::MHFadcCam(/*const Int_t n,*/ MHFadcPix::Type_t t, const char *name, const char *title) 52 55 : fNumHiGains(-1), fNumLoGains(-1), fType(t) 53 56 { … … 63 66 // connect all the histogram with the container fHist 64 67 // 65 fArray = new TObjArray(n); 68 fArray = new TObjArray; 69 fArray->SetOwner(); 66 70 67 for (Int_t i=0; i<n; i++)68 (*fArray)[i] = new MHFadcPix(i, fType);71 // for (Int_t i=0; i<n; i++) 72 // (*fArray)[i] = new MHFadcPix(i, fType); 69 73 } 70 74 … … 87 91 // FIXME, this might be done faster and more elegant, by direct copy. 88 92 // 89 MHFadcCam *cam = new MHFadcCam(n); 93 MHFadcCam *cam = new MHFadcCam(fType); 94 95 cam->fArray->Expand(n); 90 96 91 97 for (int i=0; i<n; i++) … … 95 101 } 96 102 return cam; 103 } 104 105 // -------------------------------------------------------------------------- 106 // 107 // To setup the object we get the number of pixels from a MGeomCam object 108 // in the Parameter list. 109 // 110 Bool_t MHFadcCam::SetupFill(const MParList *pList) 111 { 112 MGeomCam *cam = (MGeomCam*)pList->FindObject("MGeomCam"); 113 if (!cam) 114 { 115 *fLog << err << "MGeomCam (Camera Geometry) missing in Parameter List... aborting." << endl; 116 return kFALSE; 117 } 118 119 const Int_t n = cam->GetNumPixels(); 120 121 fArray->Delete(); 122 fArray->Expand(n); 123 124 for (Int_t i=0; i<n; i++) 125 (*fArray)[i] = new MHFadcPix(i, fType); 126 127 return kTRUE; 97 128 } 98 129 -
trunk/MagicSoft/Mars/mhist/MHFadcCam.h
r2333 r2377 33 33 34 34 public: 35 MHFadcCam( const Int_t n=577,MHFadcPix::Type_t t=MHFadcPix::kValue, const char *name=NULL, const char *title=NULL);35 MHFadcCam(/*const Int_t n=577,*/ MHFadcPix::Type_t t=MHFadcPix::kValue, const char *name=NULL, const char *title=NULL); 36 36 ~MHFadcCam(); 37 37 … … 45 45 const TH1F *GetHistLo(UInt_t i) const { return (*this)[i].GetHistLo(); } 46 46 47 Bool_t SetupFill(const MParList *pList); 47 48 Bool_t Fill(const MParContainer *par, const Stat_t w=1); 48 49 Bool_t Fill(const MRawEvtData *par); -
trunk/MagicSoft/Mars/mhist/MHTriggerLvl0.cc
r2298 r2377 100 100 MGeomCam *cam = (MGeomCam*)plist->FindObject("MGeomCam"); 101 101 if (!cam) 102 *fLog << warn << GetDescriptor() << ": No MGeomCam found." << endl; 102 { 103 *fLog << err << GetDescriptor() << ": No MGeomCam found... aborting." << endl; 104 return kFALSE; 105 } 103 106 104 107 if (fSum)
Note:
See TracChangeset
for help on using the changeset viewer.