Changeset 2135 for trunk/MagicSoft/Mars/mgui
- Timestamp:
- 05/23/03 17:30:31 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mgui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r2122 r2135 41 41 #include <TLatex.h> 42 42 #include <TStyle.h> 43 #include <TMarker.h> 43 44 #include <TCanvas.h> 45 #include <TArrayF.h> 44 46 #include <TClonesArray.h> 45 47 … … 48 50 49 51 #include "MGeomCam.h" 52 53 #include "MRflEvtData.h" 50 54 51 55 #include "MCerPhotPix.h" … … 99 103 // register BIT(8) as kNoContextMenu. If an object has this bit set it will 100 104 // not get an automatic context menu when clicked with the right mouse button. 105 106 fPhotons = new TClonesArray("TMarker", 0); 101 107 102 108 // … … 180 186 fLegend->Delete(); 181 187 fLegText->Delete(); 188 fPhotons->Delete(); 182 189 183 190 delete fPixels; 184 191 delete fLegend; 185 192 delete fLegText; 193 delete fPhotons; 186 194 187 195 delete fArrowX; … … 322 330 323 331 // 324 // Paint primitives 325 // 326 for (UInt_t i=0; i<fNumPixels; i++) 327 (*this)[i].Paint(); 328 329 for (Int_t i=0; i<kItemsLegend; i++) 330 { 331 GetBox(i)->Paint(); 332 GetText(i)->Paint(); 333 } 334 332 // Paint Legend 333 // 335 334 fArrowX->Paint(">"); 336 335 fArrowY->Paint(">"); … … 338 337 fLegRadius->Paint(); 339 338 fLegDegree->Paint(); 339 340 // 341 // Paint primitives (pixels, color legend, photons, ...) 342 // 343 { fPixels->ForEach(TObject, Paint)(); } 344 { fLegend->ForEach(TObject, Paint)(); } 345 { fLegText->ForEach(TObject, Paint)(); } 346 { fPhotons->ForEach(TObject, Paint)(); } 340 347 } 341 348 … … 671 678 // ------------------------------------------------------------------------ 672 679 // 680 // Show a reflector event. EMarkerStyle is defined in root/include/Gtypes.h 681 // To remove the photons from the display call FillRflEvent(NULL) 682 // 683 void MCamDisplay::ShowRflEvent(const MRflEvtData *event, EMarkerStyle ms) 684 { 685 const Int_t num = event ? event->GetNumPhotons() : 0; 686 687 fPhotons->ExpandCreate(num); 688 if (num < 1) 689 return; 690 691 Int_t i=num-1; 692 do 693 { 694 const MRflSinglePhoton &ph = event->GetPhoton(i); 695 TMarker &m = (TMarker&)*fPhotons->UncheckedAt(i); 696 m.SetX(ph.GetX()); 697 m.SetY(ph.GetY()); 698 m.SetMarkerStyle(ms); 699 } while (i--); 700 } 701 702 // ------------------------------------------------------------------------ 703 // 704 // Fill a reflector event. Sums all pixels in each pixel as the 705 // pixel contents. 706 // 707 // WARNING: Due to the estimation in DistanceToPrimitive and the 708 // calculation in pixels instead of x, y this is only a 709 // rough estimate. 710 // 711 void MCamDisplay::FillRflEvent(const MRflEvtData &event) 712 { 713 // 714 // reset pixel colors to background color 715 // 716 Reset(); 717 718 // 719 // sum the photons content in each pixel 720 // 721 const Int_t entries = event.GetNumPhotons(); 722 723 TArrayF arr(fNumPixels); 724 for (Int_t i=0; i<entries; i++) 725 { 726 const MRflSinglePhoton &ph = event.GetPhoton(i); 727 728 UInt_t id; 729 for (id=0; id<fNumPixels; id++) 730 { 731 if ((*this)[id].DistanceToPrimitive(ph.GetX(), ph.GetY())<0) 732 break; 733 } 734 if (id==fNumPixels) 735 continue; 736 737 arr[id] += 1; 738 } 739 740 // 741 // Scale with the area and determin maximum 742 // 743 Float_t max = 0; 744 for (UInt_t id=0; id<fNumPixels; id++) 745 { 746 arr[id] *= fGeomCam->GetPixRatio(id); 747 if (arr[id]>max) 748 max = arr[id]; 749 } 750 751 // 752 // Update legend 753 // 754 if (fAutoScale) 755 UpdateLegend(0, max==0 ? 1 : max); 756 757 // 758 // Set color of pixels 759 // 760 for (UInt_t id=0; id<fNumPixels; id++) 761 if (arr[id]>0) 762 (*this)[id].SetFillColor(GetColor(arr[id], 0, max)); 763 } 764 765 // ------------------------------------------------------------------------ 766 // 673 767 // Reset the all pixel colors to a default value 674 768 // -
trunk/MagicSoft/Mars/mgui/MCamDisplay.h
r2109 r2135 4 4 #ifndef MARS_MAGIC 5 5 #include "MAGIC.h" 6 #endif 7 #ifndef ROOT_Gtypes 8 #include <Gtypes.h> 6 9 #endif 7 10 #ifndef ROOT_TClonesArray … … 15 18 class MGeomCam; 16 19 class MHexagon; 20 class MRflEvtData; 17 21 class MCerPhotEvt; 18 22 class MCerPhotPix; … … 42 46 TClonesArray *fLegend; // array of all color bars 43 47 TClonesArray *fLegText; // array of all texts 44 48 TClonesArray *fPhotons; // array of reflector photons 49 45 50 UInt_t fW; // Width of canvas 46 51 UInt_t fH; // Height of canvas … … 74 79 void FillLevels(const MCerPhotEvt &event, const MImgCleanStd &clean); 75 80 void FillPedestals(const MPedestalCam &event); 81 void FillRflEvent(const MRflEvtData &event); 82 void ShowRflEvent(const MRflEvtData *event=NULL, EMarkerStyle m=kFullDotMedium); 76 83 77 84 void DrawPixelNumbers(); -
trunk/MagicSoft/Mars/mgui/MHexagon.cc
r1965 r2135 67 67 fX = pix.GetX(); 68 68 fY = pix.GetY(); 69 fD = pix.Get R();69 fD = pix.GetD(); 70 70 } 71 71 … … 139 139 // comput the distance of hexagon center to pixel border 140 140 // 141 const Double_t dx = fD * cosa / 2;142 const Double_t dy = fD * sina / 2;141 const Double_t dx = fD/2 * cosa; 142 const Double_t dy = fD/2 * sina; 143 143 144 144 const Int_t pxborder = gPad->XtoAbsPixel(fX + dx); … … 155 155 // 156 156 return distborder < disthex ? (int)(disthex-distborder+1) : 0; 157 } 158 159 // ------------------------------------------------------------------------ 160 // 161 // compute the distance of a point (px,py) to the Hexagon in world 162 // coordinates. Return -1 if inside. 163 // 164 Float_t MHexagon::DistanceToPrimitive(Float_t px, Float_t py) 165 { 166 // 167 // compute the distance of the Point to the center of the Hexagon 168 // 169 const Double_t dx = px-fX; 170 const Double_t dy = py-fY; 171 172 const Double_t disthex = TMath::Sqrt(dx*dx + dy*dy); 173 174 // 175 // compute the distance from the border of Pixel 176 // here in the first implementation is just circle inside 177 // 178 return fD*0.5772 < disthex ? disthex-fD*0.5772 : -1; 157 179 } 158 180 -
trunk/MagicSoft/Mars/mgui/MHexagon.h
r1880 r2135 50 50 ; 51 51 52 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py); 52 virtual Int_t DistancetoPrimitive(Int_t px, Int_t py); 53 virtual Float_t DistanceToPrimitive(Float_t px, Float_t py); 53 54 virtual void DrawHexagon(Float_t x, Float_t y, Float_t d); 54 55 -
trunk/MagicSoft/Mars/mgui/Makefile
r1965 r2135 22 22 # connect the include files defined in the config.mk file 23 23 # 24 INCLUDES = -I. -I../mbase -I../mgeom -I../manalysis -I../mimage -I../mhist 24 INCLUDES = -I. -I../mbase -I../mgeom -I../manalysis -I../mimage -I../mhist \ 25 -I../mreflector 25 26 26 27 #------------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.