Changeset 2158 for trunk/MagicSoft/Mars
- Timestamp:
- 06/03/03 17:45:39 (21 years ago)
- Location:
- trunk/MagicSoft/Mars
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/Changelog
r2157 r2158 28 28 * mhist/Makefile, mhist/HistLinkDef.h: 29 29 - added MHCurrents 30 31 * mgui/MCamDisplay.[h,cc]: 32 - changed number of ItemsLegend to display the maximum, too 33 34 * macros/sumcurrents.C: 35 - added 30 36 31 37 -
trunk/MagicSoft/Mars/macros/sumcurrents.C
r2157 r2158 29 29 // This macro shows how to fill and display a histogram using Mars 30 30 // 31 void sumcurrents(const char *fname="../currents/dcs_ vega.dat")31 void sumcurrents(const char *fname="../currents/dcs_arcturus.dat") 32 32 { 33 33 // -
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r2153 r2158 66 66 #include "MImgCleanStd.h" 67 67 68 #define kItemsLegend 50// see SetPalette(1,0)68 #define kItemsLegend 48 // see SetPalette(1,0) 69 69 70 70 ClassImp(MCamDisplay); … … 74 74 // Default Constructor. To be used by the root system ONLY. 75 75 // 76 MCamDisplay::MCamDisplay() 77 : fGeomCam(NULL), fAutoScale(kTRUE) 76 MCamDisplay::MCamDisplay() : fGeomCam(NULL), fAutoScale(kTRUE) 78 77 { 79 78 fNumPixels = 0; … … 90 89 fMinimum = 0; 91 90 fMaximum = 1; 92 93 //fData.Set(0);94 91 } 95 92 … … 99 96 // 100 97 MCamDisplay::MCamDisplay(MGeomCam *geom) 101 : fGeomCam(NULL), fAutoScale(kTRUE), f Data(geom->GetNumPixels()), fMinimum(0), fMaximum(1)98 : fGeomCam(NULL), fAutoScale(kTRUE), fColors(kItemsLegend), fData(geom->GetNumPixels()), fMinimum(0), fMaximum(1) 102 99 { 103 100 fGeomCam = (MGeomCam*)geom->Clone(); … … 139 136 140 137 fLegend = new TClonesArray("TBox", kItemsLegend); 141 fLegText = new TClonesArray("TText", kItemsLegend); 142 143 for (Int_t i = 0; i<kItemsLegend; i++) 144 { 145 TBox &newbox = *new ((*fLegend)[i]) TBox; 146 TText &newtxt = *new ((*fLegText)[i]) TText; 147 138 fLegText = new TClonesArray("TText", kItemsLegend+1); 139 140 for (Int_t i=0; i<kItemsLegend; i++) 141 { 142 TBox &newbox = *new ((*fLegend)[i]) TBox; 148 143 newbox.SetX1(fRange); 149 144 newbox.SetX2(fRange+w); … … 154 149 newbox.SetBit(/*kNoContextMenu|*/kCannotPick); 155 150 #endif 156 151 } 152 153 for (Int_t i=0; i<kItemsLegend+1; i++) 154 { 155 TText &newtxt = *new ((*fLegText)[i]) TText; 157 156 newtxt.SetTextSize(0.025); 158 157 newtxt.SetTextAlign(12); … … 344 343 { 345 344 gStyle->SetPalette(51, NULL); 346 Int_t c[50];347 for (int i=0; i< 50; i++)348 c[ 49-i] = gStyle->GetColorPalette(i);349 gStyle->SetPalette( 50, c);345 TArrayI c(kItemsLegend); 346 for (int i=0; i<kItemsLegend; i++) 347 c[kItemsLegend-i-1] = gStyle->GetColorPalette(i); 348 gStyle->SetPalette(kItemsLegend, c.GetArray()); 350 349 } 351 350 else … … 714 713 void MCamDisplay::UpdateLegend(Float_t minphe, Float_t maxphe, Bool_t islog) 715 714 { 716 for (Int_t i=0; i<kItemsLegend ; i+=3)715 for (Int_t i=0; i<kItemsLegend+1; i+=3) 717 716 { 718 717 const Float_t pos = (Float_t)i/kItemsLegend; … … 724 723 val = minphe + pos * (maxphe-minphe); 725 724 726 TText &txt = * GetText(i);725 TText &txt = *(TText*)fLegText->At(i); 727 726 txt.SetText(txt.GetX(), txt.GetY(), Form(val<1e6?"%5.1f":"%5.1e", val)); 728 727 } -
trunk/MagicSoft/Mars/mgui/MCamDisplay.h
r2153 r2158 10 10 #ifndef ROOT_TArrayF 11 11 #include <TArrayF.h> 12 #endif 13 #ifndef ROOT_TArrayI 14 #include <TArrayI.h> 12 15 #endif 13 16 #ifndef ROOT_TClonesArray … … 40 43 Float_t fRange; // the range in millimeters of the present geometry 41 44 42 Int_t fColors[50];45 TArrayI fColors; 43 46 44 47 TArrow *fArrowX; // Coordinate System … … 58 61 59 62 TBox *GetBox(Int_t i) { return (TBox*) fLegend->At(i); } 60 TText *GetText(Int_t i) { return (TText*)fLegText->At(i); }61 63 62 64 MHexagon &operator[](int i) { return *((MHexagon*)fPixels->At(i)); }
Note:
See TracChangeset
for help on using the changeset viewer.