LArSoft  v07_13_02
Liquid Argon Software toolkit - http://larsoft.org/
evdb::ScanWindow Class Reference

#include "ScanWindow.h"

Inheritance diagram for evdb::ScanWindow:

Public Member Functions

 ScanWindow ()
 
 ~ScanWindow ()
 
void CloseWindow ()
 
void Rec ()
 
void Prev ()
 
void Next ()
 
void BuildButtonBar (TGHorizontalFrame *f)
 
void BuildUserFields (TGCompositeFrame *f)
 
void OpenOutputFile ()
 

Private Attributes

TGCanvas * fUserFieldsCanvas
 Scrollable frame for all user defined fields. More...
 
TGCompositeFrame * fUserFieldsFrame
 
TGLayoutHints * fUserFieldsHints
 
TGHorizontalFrame * fButtonBar
 Frame to hold the buttons at the bottom of the window. More...
 
TGLayoutHints * fButtonBarHints
 
TGLabel * fCommentLabel
 
TGTextEntry * fCommentEntry
 
TGTextButton * fPrevButton
 
TGTextButton * fNextButton
 
TGTextButton * fRcrdButton
 
TGLayoutHints * fButtonBarHintsL
 
TGLayoutHints * fButtonBarHintsC
 
TGLayoutHints * fButtonBarHintsR
 
ScanFramefScanFrame
 The frame containing the scanner check boxes etc. More...
 
std::string fOutFileName
 Output file name for scan results. More...
 

Detailed Description

Definition at line 83 of file ScanWindow.h.

Constructor & Destructor Documentation

evdb::ScanWindow::ScanWindow ( )

Definition at line 442 of file ScanWindow.cxx.

References BuildButtonBar(), BuildUserFields(), fButtonBar, fButtonBarHints, fUserFieldsFrame, fUserFieldsHints, kHeight, kWidth, and OpenOutputFile().

442  :
443  TGTransientFrame(gClient->GetRoot(), gClient->GetRoot(), 50, 50),
445  fUserFieldsFrame(0),
446  fUserFieldsHints(0),
447  fButtonBar(0),
448  fButtonBarHints(0),
449  fCommentLabel(0),
450  fCommentEntry(0),
451  fPrevButton(0),
452  fNextButton(0),
453  fRcrdButton(0),
454  fButtonBarHintsL(0),
455  fButtonBarHintsC(0),
456  fButtonBarHintsR(0),
457  fScanFrame(0)
458  {
459  //
460  // Create a frame to hold the user-configurabale fields
461  //
462  unsigned int kWidth = 5*50;
463  unsigned int kHeight = 7*50;
465  new TGCompositeFrame(this, kWidth, kHeight);
467  new TGLayoutHints(kLHintsTop|kLHintsLeft|kLHintsExpandX|kLHintsExpandY);
468  this->AddFrame(fUserFieldsFrame, fUserFieldsHints);
469 
470  //
471  // Create a frame to hold the button bar at the bottom
472  //
473  unsigned int kButtonBarWidth = 388;
474  unsigned int kButtonBarHeight = 30;
475  fButtonBar =
476  new TGHorizontalFrame(this, kButtonBarHeight, kButtonBarWidth);
477  fButtonBarHints =
478  new TGLayoutHints(kLHintsBottom|kLHintsLeft);
479  this->AddFrame(fButtonBar, fButtonBarHints);
480 
481  this->BuildButtonBar (fButtonBar);
483  this->OpenOutputFile();
484 
485  //
486  // Finalize the window for display
487  //
488  this->Resize(kButtonBarWidth,kHeight+kButtonBarHeight);
489  this->MapSubwindows();
490  this->MapWindow();
491  this->SetWindowName("Scan dialog window");
492  }
TGTextButton * fNextButton
Definition: ScanWindow.h:114
static const unsigned int kHeight
TGTextEntry * fCommentEntry
Definition: ScanWindow.h:112
void BuildUserFields(TGCompositeFrame *f)
Definition: ScanWindow.cxx:423
TGLayoutHints * fButtonBarHints
Definition: ScanWindow.h:110
TGLayoutHints * fUserFieldsHints
Definition: ScanWindow.h:106
TGLayoutHints * fButtonBarHintsL
Definition: ScanWindow.h:116
TGCanvas * fUserFieldsCanvas
Scrollable frame for all user defined fields.
Definition: ScanWindow.h:104
TGHorizontalFrame * fButtonBar
Frame to hold the buttons at the bottom of the window.
Definition: ScanWindow.h:109
TGLabel * fCommentLabel
Definition: ScanWindow.h:111
ScanFrame * fScanFrame
The frame containing the scanner check boxes etc.
Definition: ScanWindow.h:121
void BuildButtonBar(TGHorizontalFrame *f)
Definition: ScanWindow.cxx:392
TGTextButton * fPrevButton
Definition: ScanWindow.h:113
TGTextButton * fRcrdButton
Definition: ScanWindow.h:115
TGCompositeFrame * fUserFieldsFrame
Definition: ScanWindow.h:105
static const unsigned int kWidth
TGLayoutHints * fButtonBarHintsR
Definition: ScanWindow.h:118
TGLayoutHints * fButtonBarHintsC
Definition: ScanWindow.h:117
evdb::ScanWindow::~ScanWindow ( )

Definition at line 542 of file ScanWindow.cxx.

References fButtonBar, fButtonBarHints, fButtonBarHintsC, fButtonBarHintsL, fButtonBarHintsR, fCommentEntry, fCommentLabel, fNextButton, fPrevButton, fRcrdButton, fScanFrame, fUserFieldsCanvas, fUserFieldsFrame, and fUserFieldsHints.

543  {
544  delete fScanFrame;
545  delete fButtonBarHintsR;
546  delete fButtonBarHintsC;
547  delete fButtonBarHintsL;
548  delete fRcrdButton;
549  delete fNextButton;
550  delete fPrevButton;
551  delete fCommentEntry;
552  delete fCommentLabel;
553  delete fButtonBarHints;
554  delete fButtonBar;
555  delete fUserFieldsHints;
556  delete fUserFieldsFrame;
557  delete fUserFieldsCanvas;
558  }
TGTextButton * fNextButton
Definition: ScanWindow.h:114
TGTextEntry * fCommentEntry
Definition: ScanWindow.h:112
TGLayoutHints * fButtonBarHints
Definition: ScanWindow.h:110
TGLayoutHints * fUserFieldsHints
Definition: ScanWindow.h:106
TGLayoutHints * fButtonBarHintsL
Definition: ScanWindow.h:116
TGCanvas * fUserFieldsCanvas
Scrollable frame for all user defined fields.
Definition: ScanWindow.h:104
TGHorizontalFrame * fButtonBar
Frame to hold the buttons at the bottom of the window.
Definition: ScanWindow.h:109
TGLabel * fCommentLabel
Definition: ScanWindow.h:111
ScanFrame * fScanFrame
The frame containing the scanner check boxes etc.
Definition: ScanWindow.h:121
TGTextButton * fPrevButton
Definition: ScanWindow.h:113
TGTextButton * fRcrdButton
Definition: ScanWindow.h:115
TGCompositeFrame * fUserFieldsFrame
Definition: ScanWindow.h:105
TGLayoutHints * fButtonBarHintsR
Definition: ScanWindow.h:118
TGLayoutHints * fButtonBarHintsC
Definition: ScanWindow.h:117

Member Function Documentation

void evdb::ScanWindow::BuildButtonBar ( TGHorizontalFrame *  f)

Definition at line 392 of file ScanWindow.cxx.

Referenced by ScanWindow().

393  {
394  fCommentLabel = new TGLabel (f, " Comments:");
395  fCommentEntry = new TGTextEntry (f);
396  fPrevButton = new TGTextButton(f, " <<Prev ");
397  fNextButton = new TGTextButton(f, " Next>> ");
398  fRcrdButton = new TGTextButton(f, " Record ");
399 
400  fPrevButton->Connect("Clicked()", "evdb::ScanWindow", this, "Prev()");
401  fNextButton->Connect("Clicked()", "evdb::ScanWindow", this, "Next()");
402  fRcrdButton->Connect("Clicked()", "evdb::ScanWindow", this, "Rec()");
403 
404  Pixel_t c;
405  gClient->GetColorByName("pink", c);
406  fRcrdButton->ChangeBackground(c);
407 
408  fButtonBarHintsL = new TGLayoutHints(kLHintsBottom|kLHintsLeft,
409  4,2,2,8);
410  fButtonBarHintsC = new TGLayoutHints(kLHintsBottom|kLHintsLeft,
411  2,2,2,8);
412  fButtonBarHintsR = new TGLayoutHints(kLHintsBottom|kLHintsLeft,
413  2,4,2,8);
414  f->AddFrame(fCommentLabel, fButtonBarHintsL);
415  f->AddFrame(fCommentEntry, fButtonBarHintsC);
416  f->AddFrame(fPrevButton, fButtonBarHintsC);
417  f->AddFrame(fNextButton, fButtonBarHintsC);
418  f->AddFrame(fRcrdButton, fButtonBarHintsR);
419  }
TGTextButton * fNextButton
Definition: ScanWindow.h:114
TGTextEntry * fCommentEntry
Definition: ScanWindow.h:112
TFile f
Definition: plotHisto.C:6
TGLayoutHints * fButtonBarHintsL
Definition: ScanWindow.h:116
TGLabel * fCommentLabel
Definition: ScanWindow.h:111
TGTextButton * fPrevButton
Definition: ScanWindow.h:113
TGTextButton * fRcrdButton
Definition: ScanWindow.h:115
TGLayoutHints * fButtonBarHintsR
Definition: ScanWindow.h:118
TGLayoutHints * fButtonBarHintsC
Definition: ScanWindow.h:117
void evdb::ScanWindow::BuildUserFields ( TGCompositeFrame *  f)

Definition at line 423 of file ScanWindow.cxx.

References evdb::ScanFrame::ScanFrame().

Referenced by ScanWindow().

424  {
425  unsigned int kCanvasWidth = 390;
426  unsigned int kCanvasHeight = 500;
427 
428  fUserFieldsCanvas = new
429  TGCanvas(f, kCanvasWidth, kCanvasHeight);
430  TGLayoutHints*
431  fUserFieldsCanvasHints = new TGLayoutHints(kLHintsExpandX|
432  kLHintsExpandY);
433  f->AddFrame(fUserFieldsCanvas, fUserFieldsCanvasHints);
434 
435  fScanFrame = new ScanFrame(fUserFieldsCanvas->GetViewPort());
436  fUserFieldsCanvas->SetContainer(fScanFrame->GetFrame());
437  fScanFrame->GetFrame()->SetCleanup(kDeepCleanup);
438  }
TFile f
Definition: plotHisto.C:6
TGCanvas * fUserFieldsCanvas
Scrollable frame for all user defined fields.
Definition: ScanWindow.h:104
ScanFrame * fScanFrame
The frame containing the scanner check boxes etc.
Definition: ScanWindow.h:121
TGGroupFrame * GetFrame() const
Definition: ScanWindow.h:48
void evdb::ScanWindow::CloseWindow ( )

Definition at line 561 of file ScanWindow.cxx.

561 { delete this; }
void evdb::ScanWindow::Next ( )

Definition at line 571 of file ScanWindow.cxx.

References evdb::ScanFrame::ClearFields(), fScanFrame, evdb::kNEXT_EVENT, and evdb::NavState::Set().

572  {
575  }
static void Set(int which)
Definition: NavState.cxx:24
ScanFrame * fScanFrame
The frame containing the scanner check boxes etc.
Definition: ScanWindow.h:121
void evdb::ScanWindow::OpenOutputFile ( )

Definition at line 496 of file ScanWindow.cxx.

References evdb::ScanOptions::fCategories, evdb::ScanOptions::fFieldLabels, evdb::ScanOptions::fFieldsPerCategory, evdb::ScanOptions::fIncludeMCInfo, fOutFileName, and evdb::ScanOptions::fScanFileBase.

Referenced by ScanWindow().

497  {
498  // set up the file name to store the information
500  std::string user(gSystem->Getenv("USER"));
501  user.append("_");
502  TTimeStamp cur;
503  std::string time(cur.AsString("s"));
504  time.replace(time.find(" "), 1, "_");
505  fOutFileName.append(opts->fScanFileBase);
506  fOutFileName.append(user);
507  fOutFileName.append(time);
508  fOutFileName.append(".txt");
509 
510  std::ofstream outfile(fOutFileName.c_str());
511 
512  //output the labels so we know what each is
513  outfile << "Run Subrun Event ";
514 
515  //
516  // figure out how many categories and maximum number of items for
517  // a category
518  //
519  unsigned int maxFields = 1;
520  unsigned int pos = 0;
521  for(unsigned int c = 0; c < opts->fCategories.size(); ++c){
522  for(unsigned int p = 0; p < opts->fFieldsPerCategory[c]; ++p){
523  if(opts->fFieldsPerCategory[c] > maxFields) {
524  maxFields = opts->fFieldsPerCategory[c];
525  }
526  outfile << opts->fCategories[c].c_str() << ":"
527  << opts->fFieldLabels[pos+p].c_str() << " ";
528  }
529  pos += opts->fFieldsPerCategory[c];
530  } // end loop over categories
531 
532  if(opts->fIncludeMCInfo)
533  outfile << "Truth:PDG Vtx_x Vtx_y Vtx_Z "
534  << "Nu_E CCNC Lepton_E InteractionType ";
535 
536  outfile << "comments" << std::endl;
537  }
std::vector< unsigned int > fFieldsPerCategory
names of the various categories for the scan
Definition: ScanOptions.h:41
std::string fScanFileBase
true if MC information is to be included in scan output
Definition: ScanOptions.h:31
std::string fOutFileName
Output file name for scan results.
Definition: ScanWindow.h:122
std::vector< std::string > fFieldLabels
types of the fields, ie TextEntry, Buttons, NumberEntry, etc
Definition: ScanOptions.h:43
std::vector< std::string > fCategories
base file name for scanning
Definition: ScanOptions.h:40
void evdb::ScanWindow::Prev ( void  )

Definition at line 564 of file ScanWindow.cxx.

References evdb::ScanFrame::ClearFields(), fScanFrame, evdb::kPREV_EVENT, and evdb::NavState::Set().

565  {
568  }
static void Set(int which)
Definition: NavState.cxx:24
ScanFrame * fScanFrame
The frame containing the scanner check boxes etc.
Definition: ScanWindow.h:121
void evdb::ScanWindow::Rec ( )

Definition at line 578 of file ScanWindow.cxx.

References fCommentEntry, fOutFileName, fScanFrame, evdb::kNEXT_EVENT, evdb::ScanFrame::Record(), and evdb::NavState::Set().

579  {
581  fCommentEntry->SetText("");
583  }
static void Set(int which)
Definition: NavState.cxx:24
void Record(std::string outfilename, const char *comments)
Definition: ScanWindow.cxx:261
std::string fOutFileName
Output file name for scan results.
Definition: ScanWindow.h:122
TGTextEntry * fCommentEntry
Definition: ScanWindow.h:112
ScanFrame * fScanFrame
The frame containing the scanner check boxes etc.
Definition: ScanWindow.h:121

Member Data Documentation

TGHorizontalFrame* evdb::ScanWindow::fButtonBar
private

Frame to hold the buttons at the bottom of the window.

Definition at line 109 of file ScanWindow.h.

Referenced by ScanWindow(), and ~ScanWindow().

TGLayoutHints* evdb::ScanWindow::fButtonBarHints
private

Definition at line 110 of file ScanWindow.h.

Referenced by ScanWindow(), and ~ScanWindow().

TGLayoutHints* evdb::ScanWindow::fButtonBarHintsC
private

Definition at line 117 of file ScanWindow.h.

Referenced by ~ScanWindow().

TGLayoutHints* evdb::ScanWindow::fButtonBarHintsL
private

Definition at line 116 of file ScanWindow.h.

Referenced by ~ScanWindow().

TGLayoutHints* evdb::ScanWindow::fButtonBarHintsR
private

Definition at line 118 of file ScanWindow.h.

Referenced by ~ScanWindow().

TGTextEntry* evdb::ScanWindow::fCommentEntry
private

Definition at line 112 of file ScanWindow.h.

Referenced by Rec(), and ~ScanWindow().

TGLabel* evdb::ScanWindow::fCommentLabel
private

Definition at line 111 of file ScanWindow.h.

Referenced by ~ScanWindow().

TGTextButton* evdb::ScanWindow::fNextButton
private

Definition at line 114 of file ScanWindow.h.

Referenced by ~ScanWindow().

std::string evdb::ScanWindow::fOutFileName
private

Output file name for scan results.

Definition at line 122 of file ScanWindow.h.

Referenced by OpenOutputFile(), and Rec().

TGTextButton* evdb::ScanWindow::fPrevButton
private

Definition at line 113 of file ScanWindow.h.

Referenced by ~ScanWindow().

TGTextButton* evdb::ScanWindow::fRcrdButton
private

Definition at line 115 of file ScanWindow.h.

Referenced by ~ScanWindow().

ScanFrame* evdb::ScanWindow::fScanFrame
private

The frame containing the scanner check boxes etc.

Definition at line 121 of file ScanWindow.h.

Referenced by Next(), Prev(), Rec(), and ~ScanWindow().

TGCanvas* evdb::ScanWindow::fUserFieldsCanvas
private

Scrollable frame for all user defined fields.

Definition at line 104 of file ScanWindow.h.

Referenced by ~ScanWindow().

TGCompositeFrame* evdb::ScanWindow::fUserFieldsFrame
private

Definition at line 105 of file ScanWindow.h.

Referenced by ScanWindow(), and ~ScanWindow().

TGLayoutHints* evdb::ScanWindow::fUserFieldsHints
private

Definition at line 106 of file ScanWindow.h.

Referenced by ScanWindow(), and ~ScanWindow().


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