Changeset 2236 for trunk/MagicSoft/Mars/mhist/MHCamera.cc
- Timestamp:
- 06/26/03 16:21:57 (21 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mhist/MHCamera.cc
r2231 r2236 364 364 } 365 365 366 if (min==max) 367 max += 1; 368 366 369 UpdateLegend(min, max, islog); 367 370 … … 506 509 void MHCamera::Paint(Option_t *o) 507 510 { 508 const TString opt(o); 509 510 if (opt.Contains("hist", TString::kIgnoreCase)) 511 { 511 TString opt(o); 512 opt.ToLower(); 513 514 if (opt.Contains("hist")) 515 { 516 opt.ReplaceAll("hist", ""); 517 512 518 Int_t mode = gStyle->GetOptStat(); 513 519 TVirtualPad *save = gPad; … … 525 531 SetRange(); 526 532 527 Bool_t isbox = opt.Contains("box" , TString::kIgnoreCase);528 Bool_t iscol = isbox ? !opt.Contains("nocol" , TString::kIgnoreCase) : 1;533 Bool_t isbox = opt.Contains("box"); 534 Bool_t iscol = isbox ? !opt.Contains("nocol") : 1; 529 535 530 536 // Update Contents of the pixels and paint legend … … 595 601 void MHCamera::DrawPixelIndices() 596 602 { 603 // FIXME: Is this correct? 597 604 for (int i=0; i<kItemsLegend; i++) 598 605 fColors[i] = 16; … … 609 616 TString num; 610 617 num += i; 618 619 const MGeomPix &h = (*fGeomCam)[i]; 620 TText *nt = txt.DrawText(h.GetX(), h.GetY(), num); 621 nt->SetTextSize(0.3*h.GetD()/fGeomCam->GetMaxRadius()); 622 } 623 } 624 625 void MHCamera::DrawSectorIndices() 626 { 627 for (int i=0; i<kItemsLegend; i++) 628 fColors[i] = 16; 629 630 if (!gPad) 631 Draw(); 632 633 TText txt; 634 txt.SetTextFont(122); 635 txt.SetTextAlign(22); // centered/centered 636 637 for (Int_t i=0; i<fNcells-2; i++) 638 { 639 TString num; 640 num += (*fGeomCam)[i].GetSector(); 611 641 612 642 const MGeomPix &h = (*fGeomCam)[i]; … … 678 708 // Only 'used' pixels are added. 679 709 // 680 void MHCamera::AddCamContent(const TArrayD &event, Bool_t ispos)710 void MHCamera::AddCamContent(const TArrayD &event, const TArrayC *used) 681 711 { 682 712 if (event.GetSize()!=fNcells-2) 683 713 return; 684 714 715 if (used && used->GetSize()!=fNcells-2) 716 return; 717 685 718 for (Int_t idx=0; idx<fNcells-2; idx++) 686 719 { 687 720 Fill(idx, const_cast<TArrayD&>(event)[idx]); // FIXME: Slow! 688 721 689 if ( !ispos || fArray[idx+1]>0)722 if (used && (*used)[idx]) 690 723 SetUsed(idx); 691 724 } … … 814 847 Int_t MHCamera::GetColor(Float_t val, Float_t min, Float_t max, Bool_t islog) 815 848 { 849 if (TMath::IsNaN(val)) // FIXME: gLog! 850 { 851 cout << "MHCamera::GetColor: " << GetName() << " <" << GetTitle() << "> - Color for val=NaN (Not a Number) requested... set val=min." << endl; 852 val = min; 853 } 854 816 855 // 817 856 // first treat the over- and under-flows … … 833 872 else 834 873 ratio = (val-min) / (max-min); 874 835 875 const Int_t colidx = (Int_t)(ratio*maxcolidx + .5); 836 876 return fColors[colidx]; … … 930 970 return TH1D::DistancetoPrimitive(px, py); 931 971 932 Int_t dist = 999999;933 934 972 for (Int_t i=0; i<fNcells-2; i++) 935 973 { 936 974 MHexagon hex((*fGeomCam)[i]); 937 Int_t d = hex.DistancetoPrimitive(px, py); 938 939 if (d<dist) 940 dist=d; 941 } 942 return dist==0?0:999999; 975 if (hex.DistancetoPrimitive(px, py)==0) 976 return 0; 977 } 978 return 999999; 943 979 } 944 980
Note:
See TracChangeset
for help on using the changeset viewer.