Public Member Functions | Private Member Functions | Private Attributes | List of all members
genie::masterclass::GNuMcMainFrame Class Reference

#include "/cvmfs/nova.opensciencegrid.org/externals/genie/v3_00_06_p01/Linux64bit+2.6-2.12-e17-debug/GENIE-Generator/src/Tools/Masterclass/GNuMcMainFrame.h"

Inheritance diagram for genie::masterclass::GNuMcMainFrame:

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 89 of file GNuMcMainFrame.h.

Constructor & Destructor Documentation

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

Definition at line 135 of file GNuMcMainFrame.cxx.

References fMain, and fTruthDisplay.

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

Member Function Documentation

void GNuMcMainFrame::BuildFastSimCherenkovTab ( void  )
private

Definition at line 258 of file GNuMcMainFrame.cxx.

References fViewerTabs.

Referenced by BuildTabs(), and Exit().

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

Definition at line 247 of file GNuMcMainFrame.cxx.

References fViewerTabs.

Referenced by BuildTabs(), and Exit().

248 {
249 // Build tab for displaying fast simulation results of scintillator calorimeter
250 // response and for controlling simulation inputs.
251 //
252  TGCompositeFrame * tf = 0;
253 
254  tf = fViewerTabs->AddTab("FastSim/ScintCalo");
255 
256 }
Timing fit.
void GNuMcMainFrame::BuildGUI ( const TGWindow *  p,
UInt_t  w,
UInt_t  h 
)
private

Definition at line 109 of file GNuMcMainFrame.cxx.

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

Referenced by Exit().

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

Definition at line 293 of file GNuMcMainFrame.cxx.

References fEmbeddedCanvas, fGHep, and fTruthDisplay.

Referenced by Exit().

TGGroupFrame * GNuMcMainFrame::BuildImageButtonFrame ( void  )
private

Definition at line 154 of file GNuMcMainFrame.cxx.

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

Referenced by BuildGUI(), and Exit().

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

Definition at line 143 of file GNuMcMainFrame.cxx.

References fLowerFrame, fMain, fMainFrame, and fUpperFrame.

Referenced by BuildGUI(), and Exit().

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

Definition at line 202 of file GNuMcMainFrame.cxx.

References fEmbeddedCanvas, fFeynmanTab, fFeynmanTabLayout, fGHep, fGHepTab, fGHepTabLayout, fViewerTabs, fViewTabHeight, fViewTabWidth, make_syst_table_plots::h, SetFillColor(), and w.

Referenced by BuildTabs(), and Exit().

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

Definition at line 269 of file GNuMcMainFrame.cxx.

References fMain, fStatusBar, fStatusBarLayout, and submit_concat_project::parts.

Referenced by BuildGUI(), and Exit().

270 {
271  Int_t parts[] = { 60, 20, 20 };
272  fStatusBar = new TGStatusBar(fMain, 50, 10, kHorizontalFrame);
273  fStatusBar->SetParts(parts, 3);
274 
275  ULong_t hintStatusBarLayout =
276  kLHintsBottom | kLHintsLeft | kLHintsExpandX;
278  = new TGLayoutHints(hintStatusBarLayout, 0, 0, 2, 0);
279 
280  fMain->AddFrame(fStatusBar, fStatusBarLayout);
281 }
void GNuMcMainFrame::BuildTabs ( void  )
private

Definition at line 183 of file GNuMcMainFrame.cxx.

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

Referenced by BuildGUI(), and Exit().

184 {
185  fViewTabWidth = 780;
186  fViewTabHeight = 300;
187 
188  fViewerTabs = new TGTab(fLowerFrame, 1, 1);
189 
190  this->BuildMCTruthTab ();
191  this->BuildFastSimScintCaloTab ();
192  this->BuildFastSimCherenkovTab ();
193 
194  ULong_t hintViewerTabsLayout =
195  kLHintsTop | kLHintsExpandX | kLHintsExpandY;
197  = new TGLayoutHints(hintViewerTabsLayout, 5, 5, 10, 1);
198 
199  fLowerFrame -> AddFrame ( fViewerTabs, fViewerTabsLayout );
200 }
void genie::masterclass::GNuMcMainFrame::Close ( void  )
inline

Definition at line 95 of file GNuMcMainFrame.h.

Referenced by Exit().

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

Definition at line 298 of file GNuMcMainFrame.cxx.

References run_hadd::cmd, dir, exit(), fCurrEventNu, fEventFile, fEventFilename, fGHepTree, fMain, fMCRecord, fNuOfEvents, fStatusBar, genie::gAbortingInErr, LOG, pFATAL, pNOTICE, and string.

Referenced by Exit().

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

Definition at line 283 of file GNuMcMainFrame.cxx.

References LOG, and pINFO.

Referenced by BuildImageButtonFrame(), and Exit().

284 {
285  ostringstream pic;
286  pic << gSystem->Getenv("GENIE") << "/data/icons/" << name << ".xpm";
287 
288  LOG("MasterClass", pINFO) << "Loading icon: " << pic.str();
289 
290  return pic.str().c_str();
291 }
const XML_Char * name
Definition: expat.h:151
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Definition: Messenger.h:97
#define pINFO
Definition: Messenger.h:63
void GNuMcMainFrame::Init ( void  )
private

Definition at line 74 of file GNuMcMainFrame.cxx.

References fButtonMatrixLayout, fCurrEventNu, fEmbeddedCanvas, fEventFile, fEventFilename, fExitButton, fFeynmanTab, fFeynmanTabLayout, fFileOpenButton, fGHep, fGHepTab, fGHepTabLayout, fGHepTree, fImgButtonGroupFrame, fLowerFrame, fMain, fMainFrame, fMCRecord, fNextEventButton, fNuOfEvents, fStatusBar, fStatusBarLayout, fTruthDisplay, fUpperFrame, fViewerTabs, fViewerTabsLayout, fViewTabHeight, and fViewTabWidth.

Referenced by Exit().

75 {
76  fMain = 0;
78  fMainFrame = 0;
79  fUpperFrame = 0;
80  fLowerFrame = 0;
81  fViewerTabs = 0;
82  fFeynmanTab = 0;
83  fGHepTab = 0;
84  fEmbeddedCanvas = 0;
85  fGHep = 0;
86  fStatusBar = 0;
88  fGHepTabLayout = 0;
89  fStatusBarLayout = 0;
92  fFileOpenButton = 0;
93  fNextEventButton = 0;
94  fExitButton = 0;
95  fViewTabWidth = 0;
96  fViewTabHeight = 0;
97 
98  fTruthDisplay = 0;
99 
100  fEventFilename = "";
101  fEventFile = 0;
102  fGHepTree = 0;
103  fMCRecord = 0;
104  fNuOfEvents = 0;
105  fCurrEventNu = 0;
106 
107 }
TRootEmbeddedCanvas * fEmbeddedCanvas
void GNuMcMainFrame::NextEvent ( void  )

Definition at line 352 of file GNuMcMainFrame.cxx.

References genie::NtpMCEventRecord::event, exit(), fCurrEventNu, fGHepTree, fMCRecord, fNuOfEvents, and ShowEvent().

Referenced by Exit().

353 {
354  if(fCurrEventNu >= fNuOfEvents-1) {
355  exit(1);
356  }
357 
358  fGHepTree->GetEntry(fCurrEventNu);
359  fCurrEventNu++;
360 
361  EventRecord * event = fMCRecord->event;
362 
363  this->ShowEvent(event);
364 }
void ShowEvent(EventRecord *ev_rec)
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...
Definition: EventRecord.h:38
exit(0)
EventRecord * event
event
void GNuMcMainFrame::ShowEvent ( EventRecord ev_rec)

Member Data Documentation

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

Definition at line 131 of file GNuMcMainFrame.h.

Referenced by Init().

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

Definition at line 147 of file GNuMcMainFrame.h.

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

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

Definition at line 124 of file GNuMcMainFrame.h.

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

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

Definition at line 143 of file GNuMcMainFrame.h.

Referenced by FileOpen(), and Init().

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

Definition at line 142 of file GNuMcMainFrame.h.

Referenced by FileOpen(), and Init().

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

Definition at line 134 of file GNuMcMainFrame.h.

Referenced by BuildImageButtonFrame(), and Init().

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

Definition at line 122 of file GNuMcMainFrame.h.

Referenced by BuildMCTruthTab(), and Init().

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

Definition at line 127 of file GNuMcMainFrame.h.

Referenced by BuildMCTruthTab(), and Init().

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

Definition at line 132 of file GNuMcMainFrame.h.

Referenced by BuildImageButtonFrame(), and Init().

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

Definition at line 125 of file GNuMcMainFrame.h.

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

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

Definition at line 123 of file GNuMcMainFrame.h.

Referenced by BuildMCTruthTab(), and Init().

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

Definition at line 128 of file GNuMcMainFrame.h.

Referenced by BuildMCTruthTab(), and Init().

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

Definition at line 144 of file GNuMcMainFrame.h.

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

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

Definition at line 117 of file GNuMcMainFrame.h.

Referenced by BuildGUI(), and Init().

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

Definition at line 120 of file GNuMcMainFrame.h.

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

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

Definition at line 118 of file GNuMcMainFrame.h.

Referenced by BuildMainFrames(), and Init().

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

Definition at line 145 of file GNuMcMainFrame.h.

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

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

Definition at line 133 of file GNuMcMainFrame.h.

Referenced by BuildImageButtonFrame(), and Init().

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

Definition at line 146 of file GNuMcMainFrame.h.

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

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

Definition at line 126 of file GNuMcMainFrame.h.

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

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

Definition at line 129 of file GNuMcMainFrame.h.

Referenced by BuildStatusBar(), and Init().

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

Definition at line 139 of file GNuMcMainFrame.h.

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

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

Definition at line 119 of file GNuMcMainFrame.h.

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

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

Definition at line 130 of file GNuMcMainFrame.h.

Referenced by BuildTabs(), and Init().

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

Definition at line 136 of file GNuMcMainFrame.h.

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

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

Definition at line 135 of file GNuMcMainFrame.h.

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


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