MpdBoxSetEditor.cxx 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. // MpdBoxSetEditor
  2. //
  3. // Specialization of TGedEditor for proper update propagation to TEveManager
  4. #include "MpdBoxSetEditor.h"
  5. #include "MpdEventManager.h"
  6. #include "TGLabel.h"
  7. #include "TGLayout.h" // for TGLayoutHints, etc
  8. #include <iostream>
  9. using namespace std;
  10. MpdBoxSetEditor::MpdBoxSetEditor(const TGWindow* p, Int_t width, Int_t height, UInt_t options, Pixel_t back)
  11. : TGedFrame(p, width, height, options | kVerticalFrame, back),
  12. fInfoFrame(NULL), fTimeWindowPlus(NULL), fTimeWindowMinus(NULL), fObject(NULL), fM(NULL)
  13. {
  14. cout<<"MpdBoxSetEditor called!"<<endl;
  15. Init();
  16. }
  17. void MpdBoxSetEditor::Init()
  18. {
  19. MakeTitle("MpdBoxSet Editor");
  20. fInfoFrame = CreateEditorTabSubFrame("Time");
  21. TGCompositeFrame* title1 = new TGCompositeFrame(fInfoFrame, 250, 10,
  22. kVerticalFrame | kLHintsExpandX |
  23. kFixedWidth | kOwnBackground);
  24. TGLabel* label1 = new TGLabel(title1,"Time window after event time [ns]: ");
  25. title1->AddFrame(label1, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1));
  26. fTimeWindowPlus = new TGNumberEntry(title1);//, 0, 5, -1, TGNumberFormat::kNESRealTwo); //, TGNumberFormat::kNEANonNegative);
  27. //fTimeWindow->SetLimits(0, MAXE, 2501, TGNumberFormat::kNESRealOne);
  28. fTimeWindowPlus->GetNumberEntry()->SetToolTipText("Time window in ns for which points are shown");
  29. fTimeWindowPlus->Connect("ValueSet(Long_t)", "MpdBoxSetEditor",this, "TimeWindow()");
  30. title1->AddFrame(fTimeWindowPlus, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
  31. fInfoFrame->AddFrame(title1);
  32. TGCompositeFrame* title2 = new TGCompositeFrame(fInfoFrame, 250, 10,
  33. kVerticalFrame | kLHintsExpandX |
  34. kFixedWidth | kOwnBackground);
  35. TGLabel* label2 = new TGLabel(title2, "Time window before event time [ns]: ");
  36. title2->AddFrame(label2, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1));
  37. fTimeWindowMinus = new TGNumberEntry(title2, 0., 6, -1, TGNumberFormat::kNESInteger, TGNumberFormat::kNEANonNegative);//, 1, 5, -1, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
  38. //fTimeWindow->SetLimits(0, MAXE, 2501, TGNumberFormat::kNESRealOne);
  39. fTimeWindowMinus->GetNumberEntry()->SetToolTipText("Time window in ns for which points are shown");
  40. fTimeWindowMinus->Connect("ValueSet(Long_t)", "MpdBoxSetEditor",this, "TimeWindow()");
  41. title2->AddFrame(fTimeWindowMinus, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
  42. fInfoFrame->AddFrame(title2);
  43. }
  44. void MpdBoxSetEditor::TimeWindow()
  45. {
  46. cout<<"MpdBoxSetEditor::TimeWindowPlus "<<fTimeWindowPlus->GetNumber()<<endl;
  47. cout<<"MpdBoxSetEditor::TimeWindowMinus "<<fTimeWindowMinus->GetNumber()<<endl;
  48. fM->SetTimeWindowPlus(fTimeWindowPlus->GetNumber());
  49. fM->SetTimeWindowMinus(fTimeWindowMinus->GetNumber());
  50. MpdEventManager* man = MpdEventManager::Instance();
  51. man->GotoEvent(man->GetCurrentEvent());
  52. Update();
  53. }
  54. ClassImp(MpdBoxSetEditor)