Changeset 8398 for trunk/MagicSoft/Mars/mhist
- Timestamp:
- 04/12/07 12:47:20 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r8286 r8398 1 1 /* ======================================================================== *\ 2 ! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.10 1 2007-02-01 15:14:28tbretz Exp $2 ! $Name: not supported by cvs2svn $:$Id: MHCamera.cc,v 1.102 2007-04-12 11:47:19 tbretz Exp $ 3 3 ! -------------------------------------------------------------------------- 4 4 ! … … 22 22 ! Author(s): Markus Gaug, 03/2004 <mailto:markus@ifae.es> 23 23 ! 24 ! Copyright: MAGIC Software Development, 2000-200 424 ! Copyright: MAGIC Software Development, 2000-2007 25 25 ! 26 26 ! … … 1194 1194 { 1195 1195 gStyle->SetPalette(51, NULL); 1196 TArrayI c(kItemsLegend); 1197 for (int i=0; i<kItemsLegend; i++) 1198 c[kItemsLegend-i-1] = gStyle->GetColorPalette(i); 1199 gStyle->SetPalette(kItemsLegend, c.GetArray()); 1196 1197 const Int_t n = GetContour()==0?50:GetContour(); 1198 1199 TArrayI c(n); 1200 for (int i=0; i<n; i++) 1201 c[n-i-1] = gStyle->GetColorPalette(i); 1202 gStyle->SetPalette(n, c.GetArray()); 1200 1203 } 1201 1204 else … … 1721 1724 // first treat the over- and under-flows 1722 1725 // 1723 const Int_t maxcolidx = kItemsLegend-1; 1726 const Int_t ncol = GetContour()==0?50:GetContour(); 1727 1728 const Int_t maxcolidx = ncol-1; 1724 1729 1725 1730 if (!TMath::Finite(val)) // FIXME: gLog! … … 1741 1746 ratio = (val-min) / (max-min); 1742 1747 1743 const Int_t colidx = (Int_t)(ratio*maxcolidx + .5);1748 const Int_t colidx = TMath::FloorNint(ratio*ncol); 1744 1749 return gStyle->GetColorPalette(colidx); 1745 1750 } … … 1796 1801 const Float_t offset = hndc*range; 1797 1802 1798 const Float_t h = 2./kItemsLegend; 1803 const Int_t ncol = GetContour()==0 ? 50 : GetContour(); 1804 1805 const Float_t h = 2./ncol; 1799 1806 const Float_t w = range/sqrt((float)(fNcells-2)); 1800 1807 … … 1808 1815 #endif 1809 1816 1810 const Float_t step = (islog && min>0 ? log10(max/min) : max-min) / kItemsLegend;1811 const Int_t firsts = step *3 < 1e-8 ? 8 : (Int_t)floor(log10(step*3));1817 const Float_t step = (islog && min>0 ? log10(max/min) : max-min); 1818 const Int_t firsts = step/48*3 < 1e-8 ? 8 : (Int_t)floor(log10(step/48*3)); 1812 1819 const TString opt = Form("%%.%if", firsts>0 ? 0 : TMath::Abs(firsts)); 1813 1814 for (Int_t i=0; i< kItemsLegend+1; i+=3)1820 /* 1821 for (Int_t i=0; i<ncol+1; i+=3) 1815 1822 { 1816 1823 Float_t val; … … 1822 1829 //const bool dispexp = max-min>1.5 && fabs(val)>0.1 && fabs(val)<1e6; 1823 1830 newtxt.PaintText(range+1.5*w, H*(i*h-1)-offset, Form(opt, val)); 1824 } 1825 1826 for (Int_t i=0; i<kItemsLegend; i++) 1831 } 1832 */ 1833 const MBinning bins(25, min, max, islog&&min>0?"log":"lin"); 1834 1835 for (Int_t i=0; i<=25; i++) 1836 newtxt.PaintText(range+1.5*w, H*(i*ncol/25*h-1)-offset, Form(opt, bins[i])); 1837 1838 for (Int_t i=0; i<ncol; i++) 1827 1839 { 1828 1840 newbox.SetFillColor(gStyle->GetColorPalette(i));
Note:
See TracChangeset
for help on using the changeset viewer.