19 #include <TVirtualX.h> 
   20 #include <TGListBox.h> 
   21 #include <TGComboBox.h> 
   25 #include <TGNumberEntry.h> 
   26 #include <TGTextEntry.h> 
   31 #include <TGFileDialog.h> 
   32 #include <TGTextEdit.h> 
   33 #include <TGStatusBar.h> 
   34 #include <TGProgressBar.h> 
   35 #include <TGColorSelect.h> 
   37 #include <TGraphAsymmErrors.h> 
   38 #include <TRootEmbeddedCanvas.h> 
   39 #include <TLorentzVector.h> 
   54 using std::ostringstream;
 
   55 using std::setprecision;
 
   59 using namespace genie;
 
   60 using namespace genie::masterclass;
 
   69   this->BuildGUI(p,w,h);
 
   76    fImgButtonGroupFrame = 0;
 
   86    fFeynmanTabLayout    = 0;
 
   89    fViewerTabsLayout    = 0;
 
   90    fButtonMatrixLayout  = 0;
 
  108 void GNuMcMainFrame::BuildGUI(
const TGWindow * p, UInt_t w, UInt_t h)
 
  110   fMain = 
new TGMainFrame(p,w,h);
 
  113      "CloseWindow()", 
"genie::GNuMcMainFrame", 
this, 
"Close()");
 
  115   this->BuildMainFrames();
 
  121   fImgButtonGroupFrame = this->BuildImageButtonFrame();
 
  122   fUpperFrame -> AddFrame( fImgButtonGroupFrame );
 
  125   this->BuildStatusBar();
 
  128   fMain->SetWindowName(
"GENIE Event Viewer");
 
  129   fMain->MapSubwindows();
 
  130   fMain->Resize( fMain->GetDefaultSize() );
 
  134 GNuMcMainFrame::~GNuMcMainFrame()
 
  139   delete fTruthDisplay;
 
  142 void GNuMcMainFrame::BuildMainFrames(
void)
 
  144   fMainFrame  = 
new TGCompositeFrame(fMain,      1, 1, kVerticalFrame  );
 
  145   fUpperFrame = 
new TGCompositeFrame(fMainFrame, 3, 3, kHorizontalFrame);
 
  146   fLowerFrame = 
new TGCompositeFrame(fMainFrame, 3, 3, kHorizontalFrame);
 
  148   fMainFrame -> AddFrame ( fUpperFrame );
 
  149   fMainFrame -> AddFrame ( fLowerFrame );
 
  150   fMain      -> AddFrame ( fMainFrame  );
 
  153 TGGroupFrame * GNuMcMainFrame::BuildImageButtonFrame(
void)
 
  155   TGGroupFrame * bf = 
new TGGroupFrame(
 
  156         fUpperFrame, 
"Viewer Control Buttons", kHorizontalFrame);
 
  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)");
 
  166   fFileOpenButton   -> SetToolTipText( 
"Open event file" , 1);
 
  167   fNextEventButton  -> SetToolTipText( 
"Get next event" ,  1);
 
  168   fExitButton       -> SetToolTipText( 
"Exit",             1);
 
  170   fFileOpenButton  -> Connect(
 
  171      "Clicked()",
"genie::masterclass::GNuMcMainFrame", 
this,
"FileOpen()");
 
  172   fNextEventButton  -> Connect(
 
  173      "Clicked()",
"genie::masterclass::GNuMcMainFrame", 
this,
"NextEvent()");
 
  175   bf -> AddFrame( fFileOpenButton   );
 
  176   bf -> AddFrame( fNextEventButton  );
 
  177   bf -> AddFrame( fExitButton       );
 
  182 void GNuMcMainFrame::BuildTabs(
void)
 
  185   fViewTabHeight = 300;
 
  187   fViewerTabs = 
new TGTab(fLowerFrame, 1, 1);
 
  189   this->BuildMCTruthTab          ();
 
  190   this->BuildFastSimScintCaloTab ();
 
  191   this->BuildFastSimCherenkovTab ();
 
  193   ULong_t hintViewerTabsLayout =
 
  194        kLHintsTop | kLHintsExpandX | kLHintsExpandY;
 
  196        = 
new TGLayoutHints(hintViewerTabsLayout, 5, 5, 10, 1);
 
  198   fLowerFrame -> AddFrame ( fViewerTabs, fViewerTabsLayout );
 
  201 void GNuMcMainFrame::BuildMCTruthTab(
void)
 
  205   TGCompositeFrame * tf = 0;
 
  207   unsigned int w = fViewTabWidth;
 
  208   unsigned int h = fViewTabHeight;
 
  212   tf = fViewerTabs->AddTab( 
"Feynman Diagram" );
 
  214   fFeynmanTab = 
new TGCompositeFrame(tf, w, h, kVerticalFrame);
 
  215   fEmbeddedCanvas =  
new TRootEmbeddedCanvas(
"fEmbeddedCanvas", fFeynmanTab, w, h);
 
  217   fEmbeddedCanvas -> GetCanvas() -> SetBorderMode (0);
 
  218   fEmbeddedCanvas -> GetCanvas() -> SetFillColor  (0);
 
  220   ULong_t hintFeynmanTabLayout  =
 
  221      kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY;
 
  223      new TGLayoutHints(hintFeynmanTabLayout, 5, 5, 10, 1);
 
  225   fFeynmanTab -> AddFrame( fEmbeddedCanvas, fFeynmanTabLayout );
 
  226   tf          -> AddFrame( fFeynmanTab,     fFeynmanTabLayout );
 
  230   tf = fViewerTabs->AddTab(
"GHEP Record");
 
  232   fGHepTab = 
new TGCompositeFrame(tf, w, h, kVerticalFrame);
 
  234   fGHep = 
new TGTextEdit(fGHepTab, w, h, kSunkenFrame | kDoubleBorder);
 
  235   fGHep->AddLine( 
"GHEP:" );
 
  237   ULong_t hintGHepTabLayout =
 
  238      kLHintsTop | kLHintsLeft | kLHintsExpandX | kLHintsExpandY;
 
  240      = 
new TGLayoutHints(hintGHepTabLayout, 5, 5, 10, 1);
 
  242   fGHepTab -> AddFrame(fGHep,    fGHepTabLayout);
 
  243   tf       -> AddFrame(fGHepTab, fGHepTabLayout);
 
  246 void GNuMcMainFrame::BuildFastSimScintCaloTab (
void)
 
  251   TGCompositeFrame * tf = 0;
 
  253   tf = fViewerTabs->AddTab(
"FastSim/ScintCalo");
 
  257 void GNuMcMainFrame::BuildFastSimCherenkovTab (
void)
 
  262   TGCompositeFrame * tf = 0;
 
  264   tf = fViewerTabs->AddTab(
"FastSim/Cherenkov");
 
  268 void GNuMcMainFrame::BuildStatusBar(
void)
 
  270   Int_t parts[] = { 60, 20, 20 };
 
  271   fStatusBar = 
new TGStatusBar(fMain, 50, 10, kHorizontalFrame);
 
  272   fStatusBar->SetParts(parts, 3);
 
  274   ULong_t hintStatusBarLayout =
 
  275      kLHintsBottom | kLHintsLeft | kLHintsExpandX;
 
  277      = 
new TGLayoutHints(hintStatusBarLayout, 0, 0,  2, 0);
 
  279   fMain->AddFrame(fStatusBar, fStatusBarLayout);
 
  282 const char * GNuMcMainFrame::Icon(
const char * name)
 
  285   pic  << gSystem->Getenv(
"GENIE") << 
"/data/icons/" << name << 
".xpm";
 
  287   LOG(
"MasterClass", 
pINFO) << 
"Loading icon: " << pic.str();
 
  289   return pic.str().c_str();
 
  292 void GNuMcMainFrame::BuildHelpers(
void)
 
  297 void GNuMcMainFrame::FileOpen(
void)
 
  299   fStatusBar->SetText( 
"Asking for event file name...", 0);
 
  301   static TString 
dir(
".");
 
  302   const char * kFileExt[] = {
"GHEP/ROOT event files", 
"*.root", 0, 0};
 
  305   fi.fFileTypes = kFileExt;
 
  306   fi.fIniDir    = StrDup(dir.Data());
 
  308   new TGFileDialog(gClient->GetRoot(), fMain, kFDOpen, &fi);
 
  311      fEventFilename = string( fi.fFilename );
 
  314      cmd << 
"Will read events from: " << fEventFilename;
 
  315      fStatusBar -> SetText( cmd.str().c_str(), 0 );
 
  326          new TFile(fEventFilename.c_str(),
"READ");
 
  328          dynamic_cast <TTree *> (fEventFile->Get(
"gtree"));
 
  331             << 
"No GHEP event tree in input file: " << fEventFilename;
 
  336      fNuOfEvents  = fGHepTree->GetEntries();
 
  338        << 
"Input GHEP event tree has " << fNuOfEvents
 
  339        << ((fNuOfEvents==1) ? 
" entry." : 
" entries.");
 
  344          << 
"Input tree header: " << *thdr;
 
  346      fGHepTree->SetBranchAddress(
"gmcrec", &fMCRecord);
 
  351 void GNuMcMainFrame::NextEvent(
void)
 
  353   if(fCurrEventNu >= fNuOfEvents-1) {
 
  357   fGHepTree->GetEntry(fCurrEventNu);
 
  362   this->ShowEvent(event);
 
  367   fTruthDisplay->DrawDiagram(event);
 
  368   fTruthDisplay->PrintEventRecord(event);
 
#define LOG(stream, priority)
A macro that returns the requested log4cpp::Category appending a string (using the FILE...
Generated Event Record. It is a GHepRecord object that can accept / be visited by EventRecordVisitorI...