Changeset 2178 for trunk/MagicSoft/Mars/mgui
- Timestamp:
- 06/16/03 13:45:01 (22 years ago)
- Location:
- trunk/MagicSoft/Mars/mgui
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/mgui/GuiLinkDef.h
r1436 r2178 6 6 7 7 #pragma link C++ class MHexagon+; 8 #pragma link C++ class MCamEvent+; 8 9 #pragma link C++ class MCamDisplay+; 9 10 -
trunk/MagicSoft/Mars/mgui/MCamDisplay.cc
r2173 r2178 63 63 64 64 #include "MCurrents.h" 65 #include "MCamEvent.h" 65 66 66 67 #include "MImgCleanStd.h" … … 91 92 fMinimum = 0; 92 93 fMaximum = 1; 94 95 fNotify = new TList; 93 96 } 94 97 … … 101 104 { 102 105 fGeomCam = (MGeomCam*)geom->Clone(); 106 107 fNotify = new TList; 103 108 104 109 // … … 211 216 212 217 delete fGeomCam; 218 219 delete fNotify; 213 220 } 214 221 … … 228 235 pad->SetBorderMode(0); 229 236 pad->SetFillColor(16); 230 237 //pad->Modified(); 238 /* 239 pad->Divide(1,1); 240 pad->cd(1); 241 gPad->SetBorderMode(0); 242 gPad->SetFillColor(16); 243 */ 231 244 AppendPad(""); 232 245 } … … 240 253 const float ratio = 1.15; 241 254 242 const float w = gPad->GetWw(); 243 const float h = gPad->GetWh()*ratio; 244 255 // 256 // Calculate width and height of the current pad in pixels 257 // 258 Float_t w = gPad->GetWw(); 259 Float_t h = gPad->GetWh()*ratio; 260 261 // 262 // This prevents the pad from resizing itself wrongly 263 // 264 if (gPad->GetMother() != gPad) 265 { 266 w *= gPad->GetMother()->GetAbsWNDC(); 267 h *= gPad->GetMother()->GetAbsHNDC(); 268 } 269 270 // 271 // Set Range (coordinate system) of pad 272 // 245 273 gPad->Range(-fRange, -fRange, (2*ratio-1)*fRange, fRange); 246 274 275 // 276 // Resize Pad to given ratio 277 // 247 278 if (h<w) 248 gPad->SetPad((1.-h/w)/2, 0, (h/w+1 )/2, 0.9999999);279 gPad->SetPad((1.-h/w)/2, 0, (h/w+1.)/2, 1); 249 280 else 250 gPad->SetPad(0, (1.-w/h)/2, 1, (w/h+1 )/2);281 gPad->SetPad(0, (1.-w/h)/2, 1, (w/h+1.)/2); 251 282 } 252 283 … … 271 302 } 272 303 304 if (fMinimum==FLT_MAX && fMaximum==-FLT_MAX) 305 fMinimum = fMaximum = 0; 273 306 if (fMinimum==fMaximum) 274 307 fMaximum = fMinimum + 1; … … 282 315 else 283 316 (*this)[i].SetFillColor(10); 284 285 317 } 286 318 } … … 314 346 315 347 // Paint primitives (pixels, color legend, photons, ...) 316 { fPixels->ForEach( TObject, Paint)(); }317 { fLegend->ForEach( TObject, Paint)(); }348 { fPixels->ForEach( TObject, Paint)(); } 349 { fLegend->ForEach( TObject, Paint)(); } 318 350 { fLegText->ForEach(TObject, Paint)(); } 319 351 { fPhotons->ForEach(TObject, Paint)(); } … … 445 477 // ------------------------------------------------------------------------ 446 478 // 447 // Call this function to fill the number of photo electron into the 448 // camera. 449 // 450 void MCamDisplay::FillPhotNum(const MCerPhotEvt &event) 479 // Call this function to fill the currents 480 // 481 void MCamDisplay::Fill(const MCamEvent &event, Int_t type) 451 482 { 452 483 Reset(); 453 484 454 const Int_t entries = event.GetNumPixels(); 455 456 for (Int_t i=0; i<entries; i++) 457 { 458 const MCerPhotPix &pix = event[i]; 459 if (!pix.IsPixelUsed()) 460 continue; 461 462 const Int_t id = pix.GetPixId(); 463 464 fData[id] = pix.GetNumPhotons()*fGeomCam->GetPixRatio(id); 465 (*this)[id].SetBit(kIsUsed); 466 } 467 } 468 469 // ------------------------------------------------------------------------ 470 // 471 // Call this function to fill the number of photo electron into the 472 // camera. 473 // 474 void MCamDisplay::FillPedestals(const MPedestalCam &event) 485 // FIXME: Security check missing! 486 for (UInt_t idx=0; idx<fNumPixels; idx++) 487 { 488 fData[idx] = 0; 489 if (event.GetPixelContent(fData[idx], idx, fGeomCam->GetPixRatio(idx), type)) 490 (*this)[idx].SetBit(kIsUsed); 491 } 492 } 493 494 // ------------------------------------------------------------------------ 495 // 496 // Call this function to fill the currents 497 // 498 void MCamDisplay::Fill(const TArrayF &event, Bool_t ispos) 475 499 { 476 500 Reset(); 477 501 478 const Int_t entries = event.GetSize(); 479 for (Int_t i=0; i<entries; i++) 480 { 481 fData[i] = event[i].GetMean()*fGeomCam->GetPixRatio(i); 482 (*this)[i].SetBit(kIsUsed); 483 } 484 } 485 486 // ------------------------------------------------------------------------ 487 // 488 // Call this function to fill the error of number of photo electron 489 // into the camera. 490 // 491 void MCamDisplay::FillErrorPhot(const MCerPhotEvt &event) 492 { 493 Reset(); 494 495 const Int_t entries = event.GetNumPixels(); 496 497 for (Int_t i=0; i<entries; i++) 498 { 499 const MCerPhotPix &pix = event[i]; 500 if (!pix.IsPixelUsed()) 501 continue; 502 503 const Int_t id = pix.GetPixId(); 504 505 fData[id] = pix.GetErrorPhot()*sqrt(fGeomCam->GetPixRatio(id)); 506 (*this)[id].SetBit(kIsUsed); 507 } 508 } 509 510 // ------------------------------------------------------------------------ 511 // 512 // Call this function to fill the ratio of the number of photons 513 // divided by its error 514 // 515 void MCamDisplay::FillRatio(const MCerPhotEvt &event) 516 { 517 Reset(); 518 519 const Int_t entries = event.GetNumPixels(); 520 521 for (Int_t i=0; i<entries; i++) 522 { 523 const MCerPhotPix &pix = event[i]; 524 525 if (!pix.IsPixelUsed()) 526 continue; 527 528 const Int_t id = pix.GetPixId(); 529 530 const Float_t entry = pix.GetNumPhotons(); 531 const Float_t noise = pix.GetErrorPhot(); 532 const Double_t ratio = TMath::Sqrt(fGeomCam->GetPixRatio(id)); 533 534 fData[id] = entry*ratio/noise; 535 (*this)[id].SetBit(kIsUsed); 536 } 537 } 538 539 // ------------------------------------------------------------------------ 540 // 541 // Call this function to fill the currents 542 // 543 void MCamDisplay::FillCurrents(const MCurrents &event) 544 { 545 Reset(); 546 547 // FIXME: Security check missing! 548 for (UInt_t i=0; i<fNumPixels; i++) 549 { 550 if (event[i]<=0) 551 continue; 552 553 (*this)[i].SetBit(kIsUsed); 554 fData[i] = event[i]; 555 } 502 fData = event; 503 504 for (UInt_t idx=0; idx<fNumPixels; idx++) 505 if (!ispos || fData[idx]>0) 506 (*this)[idx].SetBit(kIsUsed); 556 507 } 557 508 … … 562 513 void MCamDisplay::FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2) 563 514 { 564 Fill Ratio(event);515 Fill(event, 2); 565 516 566 517 for (UInt_t i=0; i<fNumPixels; i++) … … 793 744 } 794 745 746 Int_t MCamDisplay::GetPixelIndex(Int_t px, Int_t py) const 747 { 748 UInt_t i; 749 for (i=0; i<fNumPixels; i++) 750 { 751 if ((*fPixels)[i]->DistancetoPrimitive(px, py)>0) 752 continue; 753 754 return i; 755 } 756 return -1; 757 } 758 795 759 // ------------------------------------------------------------------------ 796 760 // … … 800 764 char *MCamDisplay::GetObjectInfo(Int_t px, Int_t py) const 801 765 { 802 static char info[64]; 803 804 UInt_t i; 805 for (i=0; i<fNumPixels; i++) 806 { 807 if ((*fPixels)[i]->DistancetoPrimitive(px, py)>0) 808 continue; 809 810 sprintf(info, "Pixel Id: %d", i); 811 return info; 812 } 813 return TObject::GetObjectInfo(px, py); 814 } 766 static char info[128]; 767 768 const Int_t idx=GetPixelIndex(px, py); 769 770 if (idx<0) 771 return TObject::GetObjectInfo(px, py); 772 773 sprintf(info, "Software Pixel Index: %d (Hardware Id=%d)", idx, idx+1); 774 return info; 775 } 776 777 // ------------------------------------------------------------------------ 778 // 779 // Execute a mouse event on the camera 780 // 781 void MCamDisplay::ExecuteEvent(Int_t event, Int_t px, Int_t py) 782 { 783 //if (event==kMouseMotion && fStatusBar) 784 // fStatusBar->SetText(GetObjectInfo(px, py), 0); 785 if (event!=kButton1Down) 786 return; 787 788 const Int_t idx = GetPixelIndex(px, py); 789 if (idx<0) 790 return; 791 792 cout << "Software Pixel Index: " << idx << endl; 793 cout << "Hardware Pixel Id: " << idx+1 << endl; 794 cout << "Contents: " << fData[idx] << endl; 795 796 //fNotify->Print(); 797 if (fNotify->GetSize()>0) 798 new TCanvas; 799 fNotify->ForEach(MCamEvent, DrawPixelContent)(idx); 800 } -
trunk/MagicSoft/Mars/mgui/MCamDisplay.h
r2171 r2178 22 22 class TText; 23 23 class TArrow; 24 class TGStatusBar; 24 25 25 26 class MGeomCam; 26 27 class MHexagon; 28 class MCurrents; 29 class MCamEvent; 27 30 class MRflEvtData; 28 class MCurrents;29 31 class MCerPhotEvt; 30 32 class MCerPhotPix; … … 60 62 Float_t fMaximum; 61 63 64 TList *fNotify; 65 66 //TGStatusBar *fStatusBar; 67 62 68 TBox *GetBox(Int_t i) { return (TBox*) fLegend->At(i); } 63 69 … … 71 77 void SetPalette(); 72 78 79 Int_t GetPixelIndex(Int_t px, Int_t py) const; 80 73 81 enum { 74 82 kIsUsed = BIT(14) … … 81 89 82 90 void SetAutoScale(Bool_t input=kTRUE); // *MENU* 83 void FillPhotNum(const MCerPhotEvt &event); 84 void FillRatio(const MCerPhotEvt &event); 91 92 void ShowRflEvent(const MRflEvtData *event=NULL, EMarkerStyle m=kFullDotMedium); 93 void FillRflEvent(const MRflEvtData &event); 85 94 void FillLevels(const MCerPhotEvt &event, Float_t lvl1, Float_t lvl2); 86 void FillErrorPhot(const MCerPhotEvt &event);87 95 void FillLevels(const MCerPhotEvt &event, const MImgCleanStd &clean); 88 void FillPedestals(const MPedestalCam &event); 89 void FillRflEvent(const MRflEvtData &event); 90 void FillCurrents(const MCurrents &event); 91 void ShowRflEvent(const MRflEvtData *event=NULL, EMarkerStyle m=kFullDotMedium); 96 void Fill(const MCamEvent &event, Int_t type=0); 97 void Fill(const TArrayF &event, Bool_t ispos=kTRUE); 92 98 93 99 void DrawPixelNumbers(); … … 99 105 Int_t DistancetoPrimitive(Int_t px, Int_t py); 100 106 char *GetObjectInfo(Int_t px, Int_t py) const; 101 //virtualvoid ExecuteEvent(Int_t event, Int_t px, Int_t py);107 void ExecuteEvent(Int_t event, Int_t px, Int_t py); 102 108 103 109 void SetPalette(Int_t ncolors, Int_t *colors); … … 111 117 void SetMinimum(Float_t m); // *MENU* 112 118 void SetMaximum(Float_t m); // *MENU* 119 120 void AddNotify(const MCamEvent &event) { fNotify->Add((TObject*)(&event)); } 121 122 //void SetStatusBar(TGStatusBar *bar) { fStatusBar = bar; } 113 123 114 124 ClassDef(MCamDisplay, 0) // Displays the magic camera -
trunk/MagicSoft/Mars/mgui/Makefile
r2135 r2178 23 23 # 24 24 INCLUDES = -I. -I../mbase -I../mgeom -I../manalysis -I../mimage -I../mhist \ 25 -I../mreflector 25 -I../mreflector -I../mraw 26 26 27 27 #------------------------------------------------------------------------------ … … 30 30 31 31 SRCFILES = MHexagon.cc \ 32 MCamDisplay.cc 32 MCamEvent.cc \ 33 MCamDisplay.cc 33 34 34 35 SRCS = $(SRCFILES)
Note:
See TracChangeset
for help on using the changeset viewer.