GENIEGenerator
Loading...
Searching...
No Matches
genie::masterclass::GNuMcMainFrame Class Reference

#include <GNuMcMainFrame.h>

Inheritance diagram for genie::masterclass::GNuMcMainFrame:
[legend]
Collaboration diagram for genie::masterclass::GNuMcMainFrame:
[legend]

Public Member Functions

 GNuMcMainFrame (const TGWindow *p, UInt_t w, UInt_t h)
virtual ~GNuMcMainFrame ()
void Close (void)
void Exit (void)
void FileOpen (void)
void NextEvent (void)
void ShowEvent (EventRecord *ev_rec)

Private Member Functions

void Init (void)
void BuildHelpers (void)
void BuildGUI (const TGWindow *p, UInt_t w, UInt_t h)
void BuildMainFrames (void)
void BuildTabs (void)
void BuildMCTruthTab (void)
void BuildFastSimScintCaloTab (void)
void BuildFastSimCherenkovTab (void)
void BuildStatusBar (void)
TGGroupFrame * BuildImageButtonFrame (void)
const char * Icon (const char *name)

Private Attributes

TGMainFrame * fMain
TGGroupFrame * fImgButtonGroupFrame
TGCompositeFrame * fMainFrame
TGCompositeFrame * fUpperFrame
TGCompositeFrame * fLowerFrame
TGTab * fViewerTabs
TGCompositeFrame * fFeynmanTab
TGCompositeFrame * fGHepTab
TRootEmbeddedCanvas * fEmbeddedCanvas
TGTextEdit * fGHep
TGStatusBar * fStatusBar
TGLayoutHints * fFeynmanTabLayout
TGLayoutHints * fGHepTabLayout
TGLayoutHints * fStatusBarLayout
TGLayoutHints * fViewerTabsLayout
TGMatrixLayout * fButtonMatrixLayout
TGPictureButton * fFileOpenButton
TGPictureButton * fNextEventButton
TGPictureButton * fExitButton
unsigned int fViewTabWidth
unsigned int fViewTabHeight
MCTruthDisplayfTruthDisplay
string fEventFilename
TFile * fEventFile
TTree * fGHepTree
NtpMCEventRecordfMCRecord
Long64_t fNuOfEvents
Long64_t fCurrEventNu

Detailed Description

Definition at line 88 of file GNuMcMainFrame.h.

Constructor & Destructor Documentation

◆ GNuMcMainFrame()

genie::masterclass::GNuMcMainFrame::GNuMcMainFrame ( const TGWindow * p,
UInt_t w,
UInt_t h )

Referenced by ClassImp().

◆ ~GNuMcMainFrame()

GNuMcMainFrame::~GNuMcMainFrame ( )
virtual

Definition at line 134 of file GNuMcMainFrame.cxx.

135{
136 fMain->Cleanup();
137 delete fMain;
138
139 delete fTruthDisplay;
140}

References fMain, and fTruthDisplay.

Member Function Documentation

◆ BuildFastSimCherenkovTab()

void GNuMcMainFrame::BuildFastSimCherenkovTab ( void )
private

Definition at line 257 of file GNuMcMainFrame.cxx.

258{
259// Build tab for displaying fast simulation results of Cherenkov detector
260// response and for controlling simulation inputs.
261//
262 TGCompositeFrame * tf = 0;
263
264 tf = fViewerTabs->AddTab("FastSim/Cherenkov");
265
266}

References fViewerTabs.

Referenced by BuildTabs().

◆ BuildFastSimScintCaloTab()

void GNuMcMainFrame::BuildFastSimScintCaloTab ( void )
private

Definition at line 246 of file GNuMcMainFrame.cxx.

247{
248// Build tab for displaying fast simulation results of scintillator calorimeter
249// response and for controlling simulation inputs.
250//
251 TGCompositeFrame * tf = 0;
252
253 tf = fViewerTabs->AddTab("FastSim/ScintCalo");
254
255}

References fViewerTabs.

Referenced by BuildTabs().

◆ BuildGUI()

void GNuMcMainFrame::BuildGUI ( const TGWindow * p,
UInt_t w,
UInt_t h )
private

Definition at line 108 of file GNuMcMainFrame.cxx.

109{
110 fMain = new TGMainFrame(p,w,h);
111
112 fMain->Connect(
113 "CloseWindow()", "genie::GNuMcMainFrame", this, "Close()");
114
115 this->BuildMainFrames();
116
117 //
118 // UPPER FRAME: add image buttons frame
119 //
120
122 fUpperFrame -> AddFrame( fImgButtonGroupFrame );
123
124 this->BuildTabs();
125 this->BuildStatusBar();
126
127 // initialize
128 fMain->SetWindowName("GENIE Event Viewer");
129 fMain->MapSubwindows();
130 fMain->Resize( fMain->GetDefaultSize() );
131 fMain->MapWindow();
132}
TGGroupFrame * BuildImageButtonFrame(void)

References BuildImageButtonFrame(), BuildMainFrames(), BuildStatusBar(), BuildTabs(), fImgButtonGroupFrame, fMain, and fUpperFrame.

◆ BuildHelpers()

void GNuMcMainFrame::BuildHelpers ( void )
private

Definition at line 292 of file GNuMcMainFrame.cxx.

293{
294 fTruthDisplay = new MCTruthDisplay(fEmbeddedCanvas,fGHep);
295}
TRootEmbeddedCanvas * fEmbeddedCanvas

References fEmbeddedCanvas, fGHep, and fTruthDisplay.

◆ BuildImageButtonFrame()

TGGroupFrame * GNuMcMainFrame::BuildImageButtonFrame ( void )
private

Definition at line 153 of file GNuMcMainFrame.cxx.

154{
155 TGGroupFrame * bf = new TGGroupFrame(
156 fUpperFrame, "Viewer Control Buttons", kHorizontalFrame);
157
159 new TGPictureButton(bf, gClient->GetPicture(Icon("open"),32,32));
161 new TGPictureButton(bf, gClient->GetPicture(Icon("next"),32,32));
163 new TGPictureButton(bf, gClient->GetPicture(Icon("exit"), 32,32),
164 "gApplication->Terminate(0)");
165
166 fFileOpenButton -> SetToolTipText( "Open event file" , 1);
167 fNextEventButton -> SetToolTipText( "Get next event" , 1);
168 fExitButton -> SetToolTipText( "Exit", 1);
169
170 fFileOpenButton -> Connect(
171 "Clicked()","genie::masterclass::GNuMcMainFrame", this,"FileOpen()");
172 fNextEventButton -> Connect(
173 "Clicked()","genie::masterclass::GNuMcMainFrame", this,"NextEvent()");
174
175 bf -> AddFrame( fFileOpenButton );
176 bf -> AddFrame( fNextEventButton );
177 bf -> AddFrame( fExitButton );
178
179 return bf;
180}
const char * Icon(const char *name)

References fExitButton, fFileOpenButton, fNextEventButton, fUpperFrame, and Icon().

Referenced by BuildGUI().

◆ BuildMainFrames()

void GNuMcMainFrame::BuildMainFrames ( void )
private

Definition at line 142 of file GNuMcMainFrame.cxx.

143{
144 fMainFrame = new TGCompositeFrame(fMain, 1, 1, kVerticalFrame );
145 fUpperFrame = new TGCompositeFrame(fMainFrame, 3, 3, kHorizontalFrame);
146 fLowerFrame = new TGCompositeFrame(fMainFrame, 3, 3, kHorizontalFrame);
147
148 fMainFrame -> AddFrame ( fUpperFrame );
149 fMainFrame -> AddFrame ( fLowerFrame );
150 fMain -> AddFrame ( fMainFrame );
151}

References fLowerFrame, fMain, fMainFrame, and fUpperFrame.

Referenced by BuildGUI().

◆ BuildMCTruthTab()

void GNuMcMainFrame::BuildMCTruthTab ( void )
private

Definition at line 201 of file GNuMcMainFrame.cxx.

202{
203// Add tab for displaying MC truth
204//
205 TGCompositeFrame * tf = 0;
206
207 unsigned int w = fViewTabWidth;
208 unsigned int h = fViewTabHeight;
209
210 // tab: Draw "Feynman" diagram
211
212 tf = fViewerTabs->AddTab( "Feynman Diagram" );
213
214 fFeynmanTab = new TGCompositeFrame(tf, w, h, kVerticalFrame);
215 fEmbeddedCanvas = new TRootEmbeddedCanvas("fEmbeddedCanvas", fFeynmanTab, w, h);
216
217 fEmbeddedCanvas -> GetCanvas() -> SetBorderMode (0);
218 fEmbeddedCanvas -> GetCanvas() -> SetFillColor (0);
219
220 ULong_t hintFeynmanTabLayout =
221 kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY;
223 new TGLayoutHints(hintFeynmanTabLayout, 5, 5, 10, 1);
224
226 tf -> AddFrame( fFeynmanTab, fFeynmanTabLayout );
227
228 // tab: Print GHEP record
229
230 tf = fViewerTabs->AddTab("GHEP Record");
231
232 fGHepTab = new TGCompositeFrame(tf, w, h, kVerticalFrame);
233
234 fGHep = new TGTextEdit(fGHepTab, w, h, kSunkenFrame | kDoubleBorder);
235 fGHep->AddLine( "GHEP:" );
236
237 ULong_t hintGHepTabLayout =
238 kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY;
240 = new TGLayoutHints(hintGHepTabLayout, 5, 5, 10, 1);
241
242 fGHepTab -> AddFrame(fGHep, fGHepTabLayout);
243 tf -> AddFrame(fGHepTab, fGHepTabLayout);
244}

References fEmbeddedCanvas, fFeynmanTab, fFeynmanTabLayout, fGHep, fGHepTab, fGHepTabLayout, fViewerTabs, fViewTabHeight, and fViewTabWidth.

Referenced by BuildTabs().

◆ BuildStatusBar()

void GNuMcMainFrame::BuildStatusBar ( void )
private

Definition at line 268 of file GNuMcMainFrame.cxx.

269{
270 Int_t parts[] = { 60, 20, 20 };
271 fStatusBar = new TGStatusBar(fMain, 50, 10, kHorizontalFrame);
272 fStatusBar->SetParts(parts, 3);
273
274 ULong_t hintStatusBarLayout =
275 kLHintsBottom | kLHintsLeft | kLHintsExpandX;
277 = new TGLayoutHints(hintStatusBarLayout, 0, 0, 2, 0);
278
280}

References fMain, fStatusBar, and fStatusBarLayout.

Referenced by BuildGUI().

◆ BuildTabs()

void GNuMcMainFrame::BuildTabs ( void )
private

Definition at line 182 of file GNuMcMainFrame.cxx.

183{
184 fViewTabWidth = 780;
185 fViewTabHeight = 300;
186
187 fViewerTabs = new TGTab(fLowerFrame, 1, 1);
188
189 this->BuildMCTruthTab ();
192
193 ULong_t hintViewerTabsLayout =
194 kLHintsTop | kLHintsExpandX | kLHintsExpandY;
196 = new TGLayoutHints(hintViewerTabsLayout, 5, 5, 10, 1);
197
199}

References BuildFastSimCherenkovTab(), BuildFastSimScintCaloTab(), BuildMCTruthTab(), fLowerFrame, fViewerTabs, fViewerTabsLayout, fViewTabHeight, and fViewTabWidth.

Referenced by BuildGUI().

◆ Close()

void genie::masterclass::GNuMcMainFrame::Close ( void )
inline

Definition at line 94 of file GNuMcMainFrame.h.

94{ gApplication->Terminate(0); }

Referenced by Exit().

◆ Exit()

void genie::masterclass::GNuMcMainFrame::Exit ( void )
inline

Definition at line 95 of file GNuMcMainFrame.h.

References Close().

◆ FileOpen()

void GNuMcMainFrame::FileOpen ( void )

Definition at line 297 of file GNuMcMainFrame.cxx.

298{
299 fStatusBar->SetText( "Asking for event file name...", 0);
300
301 static TString dir(".");
302 const char * kFileExt[] = {"GHEP/ROOT event files", "*.root", 0, 0};
303
304 TGFileInfo fi;
305 fi.fFileTypes = kFileExt;
306 fi.fIniDir = StrDup(dir.Data());
307
308 new TGFileDialog(gClient->GetRoot(), fMain, kFDOpen, &fi);
309
310 if( fi.fFilename ) {
311 fEventFilename = string( fi.fFilename );
312
313 ostringstream cmd;
314 cmd << "Will read events from: " << fEventFilename;
315 fStatusBar -> SetText( cmd.str().c_str(), 0 );
316
317 if(fEventFile) {
318 fEventFile->Close();
319 delete fEventFile;
320 }
321 if(fGHepTree) {
322 delete fGHepTree;
323 }
324
325 fEventFile =
326 new TFile(fEventFilename.c_str(),"READ");
327 fGHepTree =
328 dynamic_cast <TTree *> (fEventFile->Get("gtree"));
329 if(!fGHepTree) {
330 LOG("MasterClass", pFATAL)
331 << "No GHEP event tree in input file: " << fEventFilename;
332 gAbortingInErr=true;
333 exit(1);
334 }
335 fCurrEventNu = 0;
336 fNuOfEvents = fGHepTree->GetEntries();
337 LOG("MasterClass", pNOTICE)
338 << "Input GHEP event tree has " << fNuOfEvents
339 << ((fNuOfEvents==1) ? " entry." : " entries.");
340
341 NtpMCTreeHeader * thdr =
342 dynamic_cast <NtpMCTreeHeader *> ( fEventFile->Get("header") );
343 LOG("MasterClass", pNOTICE)
344 << "Input tree header: " << *thdr;
345
346 fGHepTree->SetBranchAddress("gmcrec", &fMCRecord);
347
348 }
349}
string dir
#define pNOTICE
Definition Messenger.h:61
#define pFATAL
Definition Messenger.h:56
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE,...
Definition Messenger.h:96
bool gAbortingInErr
Definition Messenger.cxx:34

References dir, fCurrEventNu, fEventFile, fEventFilename, fGHepTree, fMain, fMCRecord, fNuOfEvents, fStatusBar, genie::gAbortingInErr, LOG, pFATAL, and pNOTICE.

◆ Icon()

const char * GNuMcMainFrame::Icon ( const char * name)
private

Definition at line 282 of file GNuMcMainFrame.cxx.

283{
284 ostringstream pic;
285 pic << gSystem->Getenv("GENIE") << "/data/icons/" << name << ".xpm";
286
287 LOG("MasterClass", pINFO) << "Loading icon: " << pic.str();
288
289 return pic.str().c_str();
290}
#define pINFO
Definition Messenger.h:62

References LOG, and pINFO.

Referenced by BuildImageButtonFrame().

◆ Init()

◆ NextEvent()

void GNuMcMainFrame::NextEvent ( void )

Definition at line 351 of file GNuMcMainFrame.cxx.

352{
353 if(fCurrEventNu >= fNuOfEvents-1) {
354 exit(1);
355 }
356
357 fGHepTree->GetEntry(fCurrEventNu);
358 fCurrEventNu++;
359
360 EventRecord * event = fMCRecord->event;
361
362 this->ShowEvent(event);
363}
void ShowEvent(EventRecord *ev_rec)

References fCurrEventNu, fGHepTree, fMCRecord, fNuOfEvents, and ShowEvent().

◆ ShowEvent()

void GNuMcMainFrame::ShowEvent ( EventRecord * ev_rec)

Definition at line 365 of file GNuMcMainFrame.cxx.

366{
367 fTruthDisplay->DrawDiagram(event);
368 fTruthDisplay->PrintEventRecord(event);
369}

References fTruthDisplay.

Referenced by NextEvent().

Member Data Documentation

◆ fButtonMatrixLayout

TGMatrixLayout* genie::masterclass::GNuMcMainFrame::fButtonMatrixLayout
private

Definition at line 130 of file GNuMcMainFrame.h.

Referenced by Init().

◆ fCurrEventNu

Long64_t genie::masterclass::GNuMcMainFrame::fCurrEventNu
private

Definition at line 146 of file GNuMcMainFrame.h.

Referenced by FileOpen(), Init(), and NextEvent().

◆ fEmbeddedCanvas

TRootEmbeddedCanvas* genie::masterclass::GNuMcMainFrame::fEmbeddedCanvas
private

Definition at line 123 of file GNuMcMainFrame.h.

Referenced by BuildHelpers(), BuildMCTruthTab(), and Init().

◆ fEventFile

TFile* genie::masterclass::GNuMcMainFrame::fEventFile
private

Definition at line 142 of file GNuMcMainFrame.h.

Referenced by FileOpen(), and Init().

◆ fEventFilename

string genie::masterclass::GNuMcMainFrame::fEventFilename
private

Definition at line 141 of file GNuMcMainFrame.h.

Referenced by FileOpen(), and Init().

◆ fExitButton

TGPictureButton* genie::masterclass::GNuMcMainFrame::fExitButton
private

Definition at line 133 of file GNuMcMainFrame.h.

Referenced by BuildImageButtonFrame(), and Init().

◆ fFeynmanTab

TGCompositeFrame* genie::masterclass::GNuMcMainFrame::fFeynmanTab
private

Definition at line 121 of file GNuMcMainFrame.h.

Referenced by BuildMCTruthTab(), and Init().

◆ fFeynmanTabLayout

TGLayoutHints* genie::masterclass::GNuMcMainFrame::fFeynmanTabLayout
private

Definition at line 126 of file GNuMcMainFrame.h.

Referenced by BuildMCTruthTab(), and Init().

◆ fFileOpenButton

TGPictureButton* genie::masterclass::GNuMcMainFrame::fFileOpenButton
private

Definition at line 131 of file GNuMcMainFrame.h.

Referenced by BuildImageButtonFrame(), and Init().

◆ fGHep

TGTextEdit* genie::masterclass::GNuMcMainFrame::fGHep
private

Definition at line 124 of file GNuMcMainFrame.h.

Referenced by BuildHelpers(), BuildMCTruthTab(), and Init().

◆ fGHepTab

TGCompositeFrame* genie::masterclass::GNuMcMainFrame::fGHepTab
private

Definition at line 122 of file GNuMcMainFrame.h.

Referenced by BuildMCTruthTab(), and Init().

◆ fGHepTabLayout

TGLayoutHints* genie::masterclass::GNuMcMainFrame::fGHepTabLayout
private

Definition at line 127 of file GNuMcMainFrame.h.

Referenced by BuildMCTruthTab(), and Init().

◆ fGHepTree

TTree* genie::masterclass::GNuMcMainFrame::fGHepTree
private

Definition at line 143 of file GNuMcMainFrame.h.

Referenced by FileOpen(), Init(), and NextEvent().

◆ fImgButtonGroupFrame

TGGroupFrame* genie::masterclass::GNuMcMainFrame::fImgButtonGroupFrame
private

Definition at line 116 of file GNuMcMainFrame.h.

Referenced by BuildGUI(), and Init().

◆ fLowerFrame

TGCompositeFrame* genie::masterclass::GNuMcMainFrame::fLowerFrame
private

Definition at line 119 of file GNuMcMainFrame.h.

Referenced by BuildMainFrames(), BuildTabs(), and Init().

◆ fMain

TGMainFrame* genie::masterclass::GNuMcMainFrame::fMain
private

◆ fMainFrame

TGCompositeFrame* genie::masterclass::GNuMcMainFrame::fMainFrame
private

Definition at line 117 of file GNuMcMainFrame.h.

Referenced by BuildMainFrames(), and Init().

◆ fMCRecord

NtpMCEventRecord* genie::masterclass::GNuMcMainFrame::fMCRecord
private

Definition at line 144 of file GNuMcMainFrame.h.

Referenced by FileOpen(), Init(), and NextEvent().

◆ fNextEventButton

TGPictureButton* genie::masterclass::GNuMcMainFrame::fNextEventButton
private

Definition at line 132 of file GNuMcMainFrame.h.

Referenced by BuildImageButtonFrame(), and Init().

◆ fNuOfEvents

Long64_t genie::masterclass::GNuMcMainFrame::fNuOfEvents
private

Definition at line 145 of file GNuMcMainFrame.h.

Referenced by FileOpen(), Init(), and NextEvent().

◆ fStatusBar

TGStatusBar* genie::masterclass::GNuMcMainFrame::fStatusBar
private

Definition at line 125 of file GNuMcMainFrame.h.

Referenced by BuildStatusBar(), FileOpen(), and Init().

◆ fStatusBarLayout

TGLayoutHints* genie::masterclass::GNuMcMainFrame::fStatusBarLayout
private

Definition at line 128 of file GNuMcMainFrame.h.

Referenced by BuildStatusBar(), and Init().

◆ fTruthDisplay

MCTruthDisplay* genie::masterclass::GNuMcMainFrame::fTruthDisplay
private

Definition at line 138 of file GNuMcMainFrame.h.

Referenced by BuildHelpers(), Init(), ShowEvent(), and ~GNuMcMainFrame().

◆ fUpperFrame

TGCompositeFrame* genie::masterclass::GNuMcMainFrame::fUpperFrame
private

Definition at line 118 of file GNuMcMainFrame.h.

Referenced by BuildGUI(), BuildImageButtonFrame(), BuildMainFrames(), and Init().

◆ fViewerTabs

TGTab* genie::masterclass::GNuMcMainFrame::fViewerTabs
private

◆ fViewerTabsLayout

TGLayoutHints* genie::masterclass::GNuMcMainFrame::fViewerTabsLayout
private

Definition at line 129 of file GNuMcMainFrame.h.

Referenced by BuildTabs(), and Init().

◆ fViewTabHeight

unsigned int genie::masterclass::GNuMcMainFrame::fViewTabHeight
private

Definition at line 135 of file GNuMcMainFrame.h.

Referenced by BuildMCTruthTab(), BuildTabs(), and Init().

◆ fViewTabWidth

unsigned int genie::masterclass::GNuMcMainFrame::fViewTabWidth
private

Definition at line 134 of file GNuMcMainFrame.h.

Referenced by BuildMCTruthTab(), BuildTabs(), and Init().


The documentation for this class was generated from the following files: