Changeset 7342 for trunk/MagicSoft/Mars/mhist/MHCamera.cc
- Timestamp:
- 09/06/05 11:58:35 (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r7169 r7342 93 93 void MHCamera::Init() 94 94 { 95 Sumw2(); 96 95 97 UseCurrentStyle(); 96 98 … … 164 166 //Rebuild(); 165 167 166 Sumw2(); // necessary?167 168 168 if (fGeomCam) 169 169 delete fGeomCam; … … 893 893 for (Int_t i=0; i<fNcells-2; i++) 894 894 { 895 hex.SetFillStyle(issame ? 0 : 1001);895 hex.SetFillStyle(issame || (IsTransparent() && !IsUsed(i)) ? 0 : 1001); 896 896 897 897 if (!issame) … … 912 912 913 913 Float_t x = pix.GetX()*conv/(fAbberation+1); 914 915 914 Float_t y = pix.GetY()*conv/(fAbberation+1); 916 915 Float_t d = pix.GetD()*conv; 917 916 918 917 if (!isbox) 919 hex.PaintHexagon(x, y, d); 918 if (IsUsed(i) || !TestBit(kNoUnused)) 919 hex.PaintHexagon(x, y, d); 920 920 else 921 921 if (IsUsed(i) && !TMath::IsNaN(fArray[i+1])) … … 985 985 opt.ReplaceAll("pixelindex", ""); 986 986 opt.ReplaceAll("sectorindex", ""); 987 opt.ReplaceAll("abscontent", ""); 987 988 opt.ReplaceAll("content", ""); 988 989 opt.ReplaceAll("proj", ""); … … 990 991 opt.ReplaceAll("pal1", ""); 991 992 opt.ReplaceAll("pal2", ""); 993 opt.ReplaceAll("nopal", ""); 992 994 TH1D::Paint(opt); 993 995 return; … … 1027 1029 } 1028 1030 1029 const Bool_t pal1 = opt.Contains("pal1"); 1030 const Bool_t pal2 = opt.Contains("pal2"); 1031 1032 if (!pal1 && !pal2) 1031 const Bool_t pal1 = opt.Contains("pal1"); 1032 const Bool_t pal2 = opt.Contains("pal2"); 1033 const Bool_t nopal = opt.Contains("nopal"); 1034 1035 if (!pal1 && !pal2 && !nopal) 1033 1036 SetPrettyPalette(); 1034 1037 … … 1046 1049 1047 1050 if (opt.Contains("pixelindex")) 1051 { 1048 1052 PaintIndices(0); 1053 return; 1054 } 1049 1055 if (opt.Contains("sectorindex")) 1056 { 1050 1057 PaintIndices(1); 1058 return; 1059 } 1060 if (opt.Contains("abscontent")) 1061 { 1062 PaintIndices(3); 1063 return; 1064 } 1051 1065 if (opt.Contains("content")) 1066 { 1052 1067 PaintIndices(2); 1068 return; 1069 } 1070 if (opt.Contains("pixelentries")) 1071 { 1072 PaintIndices(4); 1073 return; 1074 } 1053 1075 } 1054 1076 … … 1198 1220 case 0: num += i; break; 1199 1221 case 1: num += h.GetSector(); break; 1200 case 2: num += (Int_t)((fArray[i+1]-min)/(max-min)); break; 1222 case 2: num += TMath::Nint((fArray[i+1]-min)/(max-min)); break; 1223 case 3: num += TMath::Nint(fArray[i+1]); break; 1224 case 4: num += fBinEntries[i+1]; break; 1201 1225 } 1202 1226 … … 1557 1581 { 1558 1582 fArray[i+1]=0; 1583 fBinEntries[i]=0; 1559 1584 ResetUsed(i); 1560 1585 } 1586 1561 1587 fArray[0] = 0; 1562 1588 fArray[fNcells-1] = 0; … … 1623 1649 const Float_t range = fGeomCam->GetMaxRadius()*1.05; 1624 1650 1625 TArrow arr; 1626 arr.PaintArrow(-range*.9, -range*.9, -range*.6, -range*.9, 0.025); 1627 arr.PaintArrow(-range*.9, -range*.9, -range*.9, -range*.6, 0.025); 1628 1629 TString text; 1630 text += (int)(range*.3); 1631 text += "mm"; 1632 1633 TText newtxt2; 1634 newtxt2.SetTextSize(0.04); 1635 newtxt2.PaintText(-range*.85, -range*.85, text); 1636 1637 text = ""; 1638 text += Form("%.2f", (float)((int)(range*.3*fGeomCam->GetConvMm2Deg()*10))/10); 1639 text += "\\circ"; 1640 text = text.Strip(TString::kLeading); 1641 1642 TLatex latex; 1643 latex.PaintLatex(-range*.85, -range*.75, 0, 0.04, text); 1644 1645 if (TestBit(kNoLegend)) 1646 return; 1647 1648 TPaveStats *stats = GetStatisticBox(); 1649 1650 const Float_t hndc = 0.92 - (stats ? stats->GetY1NDC() : 1); 1651 const Float_t H = (0.75-hndc)*range; 1652 const Float_t offset = hndc*range; 1653 1654 const Float_t h = 2./kItemsLegend; 1655 const Float_t w = range/sqrt((float)(fNcells-2)); 1656 1657 TBox newbox; 1658 TText newtxt; 1659 newtxt.SetTextSize(0.03); 1660 newtxt.SetTextAlign(12); 1651 if (!TestBit(kNoScale)) 1652 { 1653 TArrow arr; 1654 arr.PaintArrow(-range*.9, -range*.9, -range*.6, -range*.9, 0.025); 1655 arr.PaintArrow(-range*.9, -range*.9, -range*.9, -range*.6, 0.025); 1656 1657 TString text; 1658 text += (int)(range*.3); 1659 text += "mm"; 1660 1661 TText newtxt2; 1662 newtxt2.SetTextSize(0.04); 1663 newtxt2.PaintText(-range*.85, -range*.85, text); 1664 1665 text = ""; 1666 text += Form("%.2f", (float)((int)(range*.3*fGeomCam->GetConvMm2Deg()*10))/10); 1667 text += "\\circ"; 1668 text = text.Strip(TString::kLeading); 1669 1670 TLatex latex; 1671 latex.PaintLatex(-range*.85, -range*.75, 0, 0.04, text); 1672 } 1673 1674 if (!TestBit(kNoLegend)) 1675 { 1676 TPaveStats *stats = GetStatisticBox(); 1677 1678 const Float_t hndc = 0.92 - (stats ? stats->GetY1NDC() : 1); 1679 const Float_t H = (0.75-hndc)*range; 1680 const Float_t offset = hndc*range; 1681 1682 const Float_t h = 2./kItemsLegend; 1683 const Float_t w = range/sqrt((float)(fNcells-2)); 1684 1685 TBox newbox; 1686 TText newtxt; 1687 newtxt.SetTextSize(0.03); 1688 newtxt.SetTextAlign(12); 1661 1689 #if ROOT_VERSION_CODE > ROOT_VERSION(3,01,06) 1662 newtxt.SetBit(/*kNoContextMenu|*/kCannotPick);1663 newbox.SetBit(/*kNoContextMenu|*/kCannotPick);1690 newtxt.SetBit(/*kNoContextMenu|*/kCannotPick); 1691 newbox.SetBit(/*kNoContextMenu|*/kCannotPick); 1664 1692 #endif 1665 1693 1666 const Float_t step = (islog && min>0 ? log10(max/min) : max-min) / kItemsLegend; 1667 const Int_t firsts = step*3 < 1e-8 ? 8 : (Int_t)floor(log10(step*3)); 1668 const TString opt = Form("%%.%if", firsts>0 ? 0 : TMath::Abs(firsts)); 1669 1670 for (Int_t i=0; i<kItemsLegend+1; i+=3) 1671 { 1672 Float_t val; 1673 if (islog && min>0) 1674 val = pow(10, step*i) * min; 1675 else 1676 val = min + step*i; 1677 1678 //const bool dispexp = max-min>1.5 && fabs(val)>0.1 && fabs(val)<1e6; 1679 newtxt.PaintText(range+1.5*w, H*(i*h-1)-offset, Form(opt, val)); 1680 } 1681 1682 for (Int_t i=0; i<kItemsLegend; i++) 1683 { 1684 newbox.SetFillColor(gStyle->GetColorPalette(i)); 1685 newbox.PaintBox(range, H*(i*h-1)-offset, range+w, H*((i+1)*h-1)-offset); 1694 const Float_t step = (islog && min>0 ? log10(max/min) : max-min) / kItemsLegend; 1695 const Int_t firsts = step*3 < 1e-8 ? 8 : (Int_t)floor(log10(step*3)); 1696 const TString opt = Form("%%.%if", firsts>0 ? 0 : TMath::Abs(firsts)); 1697 1698 for (Int_t i=0; i<kItemsLegend+1; i+=3) 1699 { 1700 Float_t val; 1701 if (islog && min>0) 1702 val = pow(10, step*i) * min; 1703 else 1704 val = min + step*i; 1705 1706 //const bool dispexp = max-min>1.5 && fabs(val)>0.1 && fabs(val)<1e6; 1707 newtxt.PaintText(range+1.5*w, H*(i*h-1)-offset, Form(opt, val)); 1708 } 1709 1710 for (Int_t i=0; i<kItemsLegend; i++) 1711 { 1712 newbox.SetFillColor(gStyle->GetColorPalette(i)); 1713 newbox.PaintBox(range, H*(i*h-1)-offset, range+w, H*((i+1)*h-1)-offset); 1714 } 1686 1715 } 1687 1716 } … … 1881 1910 UInt_t MHCamera::GetNumPixels() const 1882 1911 { 1883 return fGeomCam ->GetNumPixels();1912 return fGeomCam ? fGeomCam->GetNumPixels() : 0; 1884 1913 } 1885 1914
Note:
See TracChangeset
for help on using the changeset viewer.