HepMC3 event record library
HepMC3ViewerFrame.h
1 // -*- C++ -*-
2 //
3 // This file is part of HepMC
4 // Copyright (C) 2014-2019 The HepMC collaboration (see AUTHORS for details)
5 //
6 ///
7 /// @class HepMC3ViewerFrame
8 /// @brief Definition of \b class HepMC3ViewerFrame used for simple GUI viewer
9 ///
10 #include <TGClient.h>
11 #include <TBuffer.h>
12 #include <TGButton.h>
13 #include <TGFrame.h>
14 #include "TImage.h"
15 #include "TCanvas.h"
16 #include "TGCanvas.h"
17 #include "TRootEmbeddedCanvas.h"
18 #include <TGClient.h>
19 #include <TCanvas.h>
20 #include <TBuffer.h>
21 #include <TGButton.h>
22 #include <TGFrame.h>
23 #include "TROOT.h"
24 #include "TImage.h"
25 #include "TH1S.h"
26 #include "TGFileDialog.h"
27 
28 #include "HepMC3/GenEvent.h"
29 #include "HepMC3/Reader.h"
30 ///
31 /// @class HepMC3ViewerFrame
32 /// @brief Definition of \b class HepMC3ViewerFrame
33 ///
34 class HepMC3ViewerFrame : public TGMainFrame
35 {
36 private:
37  TGCompositeFrame *fMainFrame; ///< Main frame
38  TGCompositeFrame *fButtonFrame; ///< Button frame
39  TGTextButton *fNextEvent; ///< Button
40  TGTextButton *fPreviousEvent; ///< Button
41  TGTextButton *fExit; ///< Button
42  TGTextButton *fChooseInput; ///< Button
43  TGTextButton *fClearEventCache; ///< Button
44  TRootEmbeddedCanvas *fEmbEventImageCanvas; ///< Event canvas
45  TRootEmbeddedCanvas *fEmbAnalysisCanvas; ///< Analysis canvas
46  std::shared_ptr<HepMC3::Reader> fReader; ///< Reader
48  std::vector<HepMC3::GenEvent*> fEventsCache; ///<Cache of events
49  TCanvas* fEventImageCanvas; ///< Event canvas
50  TCanvas *fAnalysisCanvas; ///<Analysis canvas
51  TImage *fGraphImage; ///<Image passed from graphviz
52  std::map<std::string, TH1*> fAnalysisH; ///< Analysis histograms
53  static const size_t m_char_buffer_size=100000; ///<Size of writer buffer
54 public:
55  void ReadFile(const char* a); ///< Open file
56  HepMC3ViewerFrame(const TGWindow *p, UInt_t w, UInt_t h); ///< Constructor
57  virtual ~HepMC3ViewerFrame(); ///< Destructor
58 //Helper functions
59 //To get image from graphviz
60  void DrawEvent(); ///< Draw evemt
61 //To do extra analysiz of the event
62  void DoAnalysis(); ///< Do analysis
63  // slots
64  void NextEvent(); ///< slot
65  void PreviousEvent();///< slot
66  void ClearEventCache();///< slot
67  void ChooseInput();///< slot
68 // ClassDef(HepMC3ViewerFrame, 0)
69 };
HepMC3ViewerFrame::ChooseInput
void ChooseInput()
slot
Definition: HepMC3ViewerFrame.cc:263
GenEvent.h
Definition of class GenEvent.
HepMC3ViewerFrame::fAnalysisH
std::map< std::string, TH1 * > fAnalysisH
Analysis histograms.
Definition: HepMC3ViewerFrame.h:52
HepMC3::GenEvent
Stores event-related information.
Definition: GenEvent.h:41
HepMC3ViewerFrame
Definition of class HepMC3ViewerFrame used for simple GUI viewer.
Definition: HepMC3ViewerFrame.h:35
HepMC3ViewerFrame::fEventImageCanvas
TCanvas * fEventImageCanvas
Event canvas.
Definition: HepMC3ViewerFrame.h:49
HepMC3ViewerFrame::fNextEvent
TGTextButton * fNextEvent
Button.
Definition: HepMC3ViewerFrame.h:39
HepMC3ViewerFrame::DrawEvent
void DrawEvent()
Draw evemt.
Definition: HepMC3ViewerFrame.cc:137
HepMC3ViewerFrame::NextEvent
void NextEvent()
slot
Definition: HepMC3ViewerFrame.cc:241
HepMC3ViewerFrame::fCurrentEvent
HepMC3::GenEvent * fCurrentEvent
Event.
Definition: HepMC3ViewerFrame.h:47
HepMC3ViewerFrame::fEmbEventImageCanvas
TRootEmbeddedCanvas * fEmbEventImageCanvas
Event canvas.
Definition: HepMC3ViewerFrame.h:44
HepMC3ViewerFrame::fAnalysisCanvas
TCanvas * fAnalysisCanvas
Analysis canvas
Definition: HepMC3ViewerFrame.h:50
HepMC3ViewerFrame::fEventsCache
std::vector< HepMC3::GenEvent * > fEventsCache
Cache of events.
Definition: HepMC3ViewerFrame.h:48
HepMC3ViewerFrame::fReader
std::shared_ptr< HepMC3::Reader > fReader
Reader.
Definition: HepMC3ViewerFrame.h:46
HepMC3ViewerFrame::fChooseInput
TGTextButton * fChooseInput
Button.
Definition: HepMC3ViewerFrame.h:42
HepMC3ViewerFrame::ClearEventCache
void ClearEventCache()
slot
Definition: HepMC3ViewerFrame.cc:221
HepMC3ViewerFrame::fGraphImage
TImage * fGraphImage
Image passed from graphviz.
Definition: HepMC3ViewerFrame.h:51
HepMC3ViewerFrame::fMainFrame
TGCompositeFrame * fMainFrame
Main frame.
Definition: HepMC3ViewerFrame.h:37
HepMC3ViewerFrame::PreviousEvent
void PreviousEvent()
slot
Definition: HepMC3ViewerFrame.cc:227
HepMC3ViewerFrame::fExit
TGTextButton * fExit
Button.
Definition: HepMC3ViewerFrame.h:41
HepMC3ViewerFrame::fEmbAnalysisCanvas
TRootEmbeddedCanvas * fEmbAnalysisCanvas
Analysis canvas.
Definition: HepMC3ViewerFrame.h:45
HepMC3ViewerFrame::ReadFile
void ReadFile(const char *a)
Open file.
Definition: HepMC3ViewerFrame.cc:237
HepMC3ViewerFrame::m_char_buffer_size
static const size_t m_char_buffer_size
Size of writer buffer.
Definition: HepMC3ViewerFrame.h:53
HepMC3ViewerFrame::DoAnalysis
void DoAnalysis()
Do analysis.
Definition: HepMC3ViewerFrame.cc:167
HepMC3ViewerFrame::~HepMC3ViewerFrame
virtual ~HepMC3ViewerFrame()
Destructor.
Definition: HepMC3ViewerFrame.cc:332
HepMC3ViewerFrame::fButtonFrame
TGCompositeFrame * fButtonFrame
Button frame.
Definition: HepMC3ViewerFrame.h:38
HepMC3ViewerFrame::fPreviousEvent
TGTextButton * fPreviousEvent
Button.
Definition: HepMC3ViewerFrame.h:40
Reader.h
Definition of interface Reader.
HepMC3ViewerFrame::HepMC3ViewerFrame
HepMC3ViewerFrame(const TGWindow *p, UInt_t w, UInt_t h)
Constructor.
Definition: HepMC3ViewerFrame.cc:275
HepMC3ViewerFrame::fClearEventCache
TGTextButton * fClearEventCache
Button.
Definition: HepMC3ViewerFrame.h:43