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