GENIEGenerator
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
genie::masterclass::GNuMcMainFrame Class Reference

#include <GNuMcMainFrame.h>

Inheritance diagram for genie::masterclass::GNuMcMainFrame:
Inheritance graph
[legend]
Collaboration diagram for genie::masterclass::GNuMcMainFrame:
Collaboration graph
[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::GNuMcMainFrame ( const TGWindow *  p,
UInt_t  w,
UInt_t  h 
)

Definition at line 65 of file GNuMcMainFrame.cxx.

References Init().

65  :
66 TGMainFrame(p, w, h)
67 {
68  this->Init();
69  this->BuildGUI(p,w,h);
70  this->BuildHelpers();
71 }
void BuildGUI(const TGWindow *p, UInt_t w, UInt_t h)
GNuMcMainFrame::~GNuMcMainFrame ( )
virtual

Definition at line 134 of file GNuMcMainFrame.cxx.

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

Member Function Documentation

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 }
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 }
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)
void GNuMcMainFrame::BuildHelpers ( void  )
private

Definition at line 292 of file GNuMcMainFrame.cxx.

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));
162  fExitButton =
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)
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 }
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 }
TRootEmbeddedCanvas * fEmbeddedCanvas
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 
279  fMain->AddFrame(fStatusBar, fStatusBarLayout);
280 }
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 ();
190  this->BuildFastSimScintCaloTab ();
191  this->BuildFastSimCherenkovTab ();
192 
193  ULong_t hintViewerTabsLayout =
194  kLHintsTop | kLHintsExpandX | kLHintsExpandY;
196  = new TGLayoutHints(hintViewerTabsLayout, 5, 5, 10, 1);
197 
198  fLowerFrame -> AddFrame ( fViewerTabs, fViewerTabsLayout );
199 }
void genie::masterclass::GNuMcMainFrame::Close ( void  )
inline

Definition at line 94 of file GNuMcMainFrame.h.

Referenced by Exit().

94 { gApplication->Terminate(0); }
void genie::masterclass::GNuMcMainFrame::Exit ( void  )
inline

Definition at line 95 of file GNuMcMainFrame.h.

References Close().

void GNuMcMainFrame::FileOpen ( void  )

Definition at line 297 of file GNuMcMainFrame.cxx.

References dir, genie::gAbortingInErr, LOG, pFATAL, and pNOTICE.

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 }
#define pFATAL
Definition: Messenger.h:56
string dir
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
MINOS-style Ntuple Class to hold an output MC Tree Header.
#define pNOTICE
Definition: Messenger.h:61
bool gAbortingInErr
Definition: Messenger.cxx:34
const char * GNuMcMainFrame::Icon ( const char *  name)
private

Definition at line 282 of file GNuMcMainFrame.cxx.

References LOG, and pINFO.

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 LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:96
#define pINFO
Definition: Messenger.h:62
const char * name
void GNuMcMainFrame::Init ( void  )
private

Definition at line 73 of file GNuMcMainFrame.cxx.

74 {
75  fMain = 0;
77  fMainFrame = 0;
78  fUpperFrame = 0;
79  fLowerFrame = 0;
80  fViewerTabs = 0;
81  fFeynmanTab = 0;
82  fGHepTab = 0;
83  fEmbeddedCanvas = 0;
84  fGHep = 0;
85  fStatusBar = 0;
87  fGHepTabLayout = 0;
88  fStatusBarLayout = 0;
91  fFileOpenButton = 0;
92  fNextEventButton = 0;
93  fExitButton = 0;
94  fViewTabWidth = 0;
95  fViewTabHeight = 0;
96 
97  fTruthDisplay = 0;
98 
99  fEventFilename = "";
100  fEventFile = 0;
101  fGHepTree = 0;
102  fMCRecord = 0;
103  fNuOfEvents = 0;
104  fCurrEventNu = 0;
105 
106 }
TRootEmbeddedCanvas * fEmbeddedCanvas
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)
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
Definition: EventRecord.h:37
EventRecord * event
event
void GNuMcMainFrame::ShowEvent ( EventRecord ev_rec)

Definition at line 365 of file GNuMcMainFrame.cxx.

366 {
367  fTruthDisplay->DrawDiagram(event);
369 }
void PrintEventRecord(EventRecord *event)
void DrawDiagram(EventRecord *event)

Member Data Documentation

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

Definition at line 130 of file GNuMcMainFrame.h.

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

Definition at line 146 of file GNuMcMainFrame.h.

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

Definition at line 123 of file GNuMcMainFrame.h.

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

Definition at line 142 of file GNuMcMainFrame.h.

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

Definition at line 141 of file GNuMcMainFrame.h.

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

Definition at line 133 of file GNuMcMainFrame.h.

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

Definition at line 121 of file GNuMcMainFrame.h.

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

Definition at line 126 of file GNuMcMainFrame.h.

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

Definition at line 131 of file GNuMcMainFrame.h.

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

Definition at line 124 of file GNuMcMainFrame.h.

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

Definition at line 122 of file GNuMcMainFrame.h.

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

Definition at line 127 of file GNuMcMainFrame.h.

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

Definition at line 143 of file GNuMcMainFrame.h.

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

Definition at line 116 of file GNuMcMainFrame.h.

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

Definition at line 119 of file GNuMcMainFrame.h.

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

Definition at line 115 of file GNuMcMainFrame.h.

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

Definition at line 117 of file GNuMcMainFrame.h.

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

Definition at line 144 of file GNuMcMainFrame.h.

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

Definition at line 132 of file GNuMcMainFrame.h.

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

Definition at line 145 of file GNuMcMainFrame.h.

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

Definition at line 125 of file GNuMcMainFrame.h.

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

Definition at line 128 of file GNuMcMainFrame.h.

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

Definition at line 138 of file GNuMcMainFrame.h.

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

Definition at line 118 of file GNuMcMainFrame.h.

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

Definition at line 120 of file GNuMcMainFrame.h.

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

Definition at line 129 of file GNuMcMainFrame.h.

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

Definition at line 135 of file GNuMcMainFrame.h.

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

Definition at line 134 of file GNuMcMainFrame.h.


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