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///
34class HepMC3ViewerFrame : public TGMainFrame
35{
36private:
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
54public:
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};
Definition of class GenEvent.
Definition of interface Reader.
Definition of class HepMC3ViewerFrame used for simple GUI viewer.
void DrawEvent()
Draw evemt.
virtual ~HepMC3ViewerFrame()
Destructor.
TCanvas * fAnalysisCanvas
Analysis canvas.
void ReadFile(const char *a)
Open file.
std::map< std::string, TH1 * > fAnalysisH
Analysis histograms.
static const size_t m_char_buffer_size
Size of writer buffer.
TGCompositeFrame * fButtonFrame
Button frame.
std::shared_ptr< HepMC3::Reader > fReader
Reader.
TRootEmbeddedCanvas * fEmbAnalysisCanvas
Analysis canvas.
TCanvas * fEventImageCanvas
Event canvas.
TGCompositeFrame * fMainFrame
Main frame.
TGTextButton * fChooseInput
Button.
std::vector< HepMC3::GenEvent * > fEventsCache
Cache of events.
TGTextButton * fExit
Button.
TImage * fGraphImage
Image passed from graphviz.
TGTextButton * fPreviousEvent
Button.
TGTextButton * fClearEventCache
Button.
TGTextButton * fNextEvent
Button.
HepMC3::GenEvent * fCurrentEvent
Event.
void DoAnalysis()
Do analysis.
TRootEmbeddedCanvas * fEmbEventImageCanvas
Event canvas.
Stores event-related information.
Definition: GenEvent.h:41