FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairBoxSetEditor.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2014 GSI Helmholtzzentrum fuer Schwerionenforschung GmbH *
3  * *
4  * This software is distributed under the terms of the *
5  * GNU Lesser General Public Licence (LGPL) version 3, *
6  * copied verbatim in the file "LICENSE" *
7  ********************************************************************************/
8 #include "FairBoxSetEditor.h"
9 
10 #include "FairEventManager.h" // for FairEventManager
11 
12 #include <TGLabel.h> // for TGLabel
13 #include <TGLayout.h> // for TGLayoutHints, etc
14 #include <TGNumberEntry.h> // for TGNumberEntry, etc
15 #include <fairlogger/Logger.h>
16 
17 class TGWindow;
18 
19 #include <iostream> // for operator<<, basic_ostream, etc
20 
21 // FairBoxSetEditor
22 //
23 // Specialization of TGedEditor for proper update propagation to
24 // TEveManager.
25 
27 
28 FairBoxSetEditor::FairBoxSetEditor(const TGWindow* p, Int_t width, Int_t height, UInt_t options, Pixel_t back)
29  : TGedFrame(p, width, height, options | kVerticalFrame, back)
30  , fInfoFrame(nullptr)
31  , fTimeWindowPlus(nullptr)
32  , fTimeWindowMinus(nullptr)
33  , fObject(nullptr)
34  , fM(nullptr)
35 {
36  LOG(info) << "FairBoxSetEditor called!";
37  Init();
38 }
39 
41 {
42  // FairRootManager* fRootManager=FairRootManager::Instance();
43  // TChain* chain =fRootManager->GetInChain();
44  // Int_t Entries= chain->GetEntriesFast();
45 
46  MakeTitle("FairBoxSet Editor");
47  fInfoFrame = CreateEditorTabSubFrame("Time");
48 
49  TGCompositeFrame* title1 =
50  new TGCompositeFrame(fInfoFrame, 250, 10, kVerticalFrame | kLHintsExpandX | kFixedWidth | kOwnBackground);
51 
52  TGLabel* label1 = new TGLabel(title1, "Time window after event time [ns]: ");
53  title1->AddFrame(label1, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1));
54 
56  new TGNumberEntry(title1); //, 0, 5, -1, TGNumberFormat::kNESRealTwo); //, TGNumberFormat::kNEANonNegative);
57  // fTimeWindow->SetLimits(0, MAXE, 2501, TGNumberFormat::kNESRealOne);
58  fTimeWindowPlus->GetNumberEntry()->SetToolTipText("Time window in ns for which points are shown");
59  fTimeWindowPlus->Connect("ValueSet(Long_t)", "FairBoxSetEditor", this, "TimeWindow()");
60  title1->AddFrame(fTimeWindowPlus, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
61 
62  fInfoFrame->AddFrame(title1);
63 
64  TGCompositeFrame* title2 =
65  new TGCompositeFrame(fInfoFrame, 250, 10, kVerticalFrame | kLHintsExpandX | kFixedWidth | kOwnBackground);
66 
67  TGLabel* label2 = new TGLabel(title2, "Time window before event time [ns]: ");
68  title2->AddFrame(label2, new TGLayoutHints(kLHintsLeft | kLHintsCenterY, 1, 2, 1, 1));
69  fTimeWindowMinus = new TGNumberEntry(
70  title2,
71  0.,
72  6,
73  -1,
74  TGNumberFormat::kNESInteger,
75  TGNumberFormat::kNEANonNegative); //, 1, 5, -1, TGNumberFormat::kNESRealTwo, TGNumberFormat::kNEANonNegative);
76  // fTimeWindow->SetLimits(0, MAXE, 2501, TGNumberFormat::kNESRealOne);
77  fTimeWindowMinus->GetNumberEntry()->SetToolTipText("Time window in ns for which points are shown");
78  fTimeWindowMinus->Connect("ValueSet(Long_t)", "FairBoxSetEditor", this, "TimeWindow()");
79  title2->AddFrame(fTimeWindowMinus, new TGLayoutHints(kLHintsTop, 1, 1, 1, 0));
80 
81  fInfoFrame->AddFrame(title2);
82 }
83 
85 {
86  LOG(debug) << "FairBoxSetEditor::TimeWindowPlus " << fTimeWindowPlus->GetNumber();
87  LOG(debug) << "FairBoxSetEditor::TimeWindowMinus " << fTimeWindowMinus->GetNumber();
88  fM->SetTimeWindowPlus(fTimeWindowPlus->GetNumber());
89  fM->SetTimeWindowMinus(fTimeWindowMinus->GetNumber());
91  man->GotoEvent(man->GetCurrentEvent());
92  Update();
93 }
virtual Int_t GetCurrentEvent()
ClassImp(FairEventBuilder)
TGNumberEntry * fTimeWindowMinus
TGNumberEntry * fTimeWindowPlus
void SetTimeWindowMinus(Double_t time)
Definition: FairBoxSet.h:40
TGVerticalFrame * fInfoFrame
static FairEventManager * Instance()
virtual void GotoEvent(Int_t event)
FairBoxSetEditor(const TGWindow *p=0, Int_t width=170, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
virtual void Init()
virtual void TimeWindow()
void SetTimeWindowPlus(Double_t time)
Definition: FairBoxSet.h:39