FairRoot
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FairEveGeoTracksEditor.cxx
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2020 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 /*
9  * FairGeoTracksEditor.cxx
10  *
11  * Created on: 23 kwi 2020
12  * Author: Daniel Wielanek
13  * E-mail: daniel.wielanek@gmail.com
14  * Warsaw University of Technology, Faculty of Physics
15  */
16 
17  #include "FairEveGeoTracksEditor.h"
18  #include <TGButton.h> // for TGTextButton
19  #include <TGLayout.h> // for TGLayoutHints, kLHintsExpandX, kLHints...
20  #include <TObject.h> // for TObject
21  #include "FairEveCut.h" // for FairEveMinMaxCut, FairEveBoolCut, Fair...
22  #include "FairEveGeoTracks.h" // for FairEveGeoTracks
23  class TGWindow;
24 
26  Int_t width,
27  Int_t height,
28  UInt_t options,
29  Pixel_t back)
30  : TGedFrame(p, width, height, options | kVerticalFrame, back)
31  , fGeoTracks(nullptr)
32 {
33 
34  MakeTitle("FairGeoTracksEditor");
35  SetName("MCtracksEditor");
36 
37  TGVerticalFrame *kinFrame = CreateEditorTabSubFrame("Kin");
38  fPtCut.reset(new FairEveMinMaxCut(this, kinFrame, "Pt", width));
39  fEtaCut.reset(new FairEveMinMaxCut(this, kinFrame, "Eta", width));
40  fEnergyCut.reset(new FairEveMinMaxCut(this, kinFrame, "E", width));
41  fPtCut->Init();
42  fEtaCut->Init();
43  fEnergyCut->Init();
44  fPtCut->AddUpdateButton();
45 
46  TGVerticalFrame *statFrame = CreateEditorTabSubFrame("Status");
47 
48  fPrimary.reset(new FairEveBoolCut(this, statFrame, "Primary", width));
49  fPrimary->UpdateWhenChanged();
50  fPrimary->SetInitStatus(kTRUE);
51  fSecondary.reset(new FairEveBoolCut(this, statFrame, "Secondary", width));
52  fSecondary->SetInitStatus(kTRUE);
53  fSecondary->UpdateWhenChanged();
54  fPdgCut.reset(new FairEveIntCut(this, statFrame, "PDG", width));
55  fPrimary->Init();
56  fSecondary->Init();
57  fPdgCut->Init();
58  fPdgCut->AddUpdateButton();
59 
60  TGCompositeFrame *ToogleFrame = new TGCompositeFrame(statFrame, width, 20, kHorizontalFrame | kFixedWidth);
61  TGTextButton *ToogleButton = new TGTextButton(ToogleFrame, "Toggle Tracks");
62  ToogleButton->Connect("Clicked()", this->ClassName(), this, "ToggleTracks()");
63  ToogleFrame->AddFrame(ToogleButton, new TGLayoutHints(kLHintsRight | kLHintsExpandX, 1, 1, 2, 1));
64  statFrame->AddFrame(ToogleFrame, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
65 
66  TGCompositeFrame *ToogleGroupFrame = new TGCompositeFrame(statFrame, width, 20, kHorizontalFrame | kFixedWidth);
67  TGTextButton *ToogleGroupButton = new TGTextButton(ToogleGroupFrame, "Toggle Groups");
68  ToogleGroupButton->Connect("Clicked()", this->ClassName(), this, "ToggleGroups()");
69  ToogleGroupFrame->AddFrame(ToogleGroupButton, new TGLayoutHints(kLHintsRight | kLHintsExpandX, 1, 1, 2, 1));
70  statFrame->AddFrame(ToogleGroupFrame, new TGLayoutHints(kLHintsTop, 1, 1, 2, 1));
71 }
72 
73 void FairEveGeoTracksEditor::SetModel(TObject *obj) { fGeoTracks = dynamic_cast<FairEveGeoTracks *>(obj); }
74 
76 {
77  if (fGeoTracks)
78  fGeoTracks->ToggleTracks();
79 }
80 
82 {
83  Double_t min, max;
84  Bool_t use = fPtCut->GetValues(min, max);
85  fGeoTracks->SetPtCut(min, max, use);
86  use = fEtaCut->GetValues(min, max);
87  fGeoTracks->SetEtaCut(min, max, use);
88  use = fEnergyCut->GetValues(min, max);
89  fGeoTracks->SetEnergyCut(min, max, use);
90  Int_t pdg_code;
91  use = fPdgCut->GetValue(pdg_code);
92  fGeoTracks->SetPdgCut(pdg_code, use);
93  fGeoTracks->SetShowPrimSec(fPrimary->GetValue(), fSecondary->GetValue());
94  TGedFrame::Update();
95  fGeoTracks->Repaint();
96 }
97 
99 
void SetPdgCut(Int_t pdg, Bool_t use)
virtual void SetModel(TObject *obj)
FairEveGeoTracksEditor(const TGWindow *p=0, Int_t width=170, Int_t height=30, UInt_t options=kChildFrame, Pixel_t back=GetDefaultFrameBackground())
void SetPtCut(Double_t min, Double_t max, Bool_t use)
Definition: FairEveTracks.h:87
void SetEtaCut(Double_t min, Double_t max, Bool_t use)
Definition: FairEveTracks.h:99
void SetShowPrimSec(Bool_t prim, Bool_t sec)
void SetEnergyCut(Double_t min, Double_t max, Bool_t use)