Debian Codegraph @

examples/ViewerExample/include/HepMC3ViewerFrame.h

raw
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
47 HepMC3::GenEvent *fCurrentEvent; ///<Event
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 };