LArSoft  v09_90_00
Liquid Argon Software toolkit - https://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 440 of file ScanWindow.cxx.

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

440  :
441  TGTransientFrame(gClient->GetRoot(), gClient->GetRoot(), 50, 50),
443  fUserFieldsFrame(0),
444  fUserFieldsHints(0),
445  fButtonBar(0),
446  fButtonBarHints(0),
447  fCommentLabel(0),
448  fCommentEntry(0),
449  fPrevButton(0),
450  fNextButton(0),
451  fRcrdButton(0),
452  fButtonBarHintsL(0),
453  fButtonBarHintsC(0),
454  fButtonBarHintsR(0),
455  fScanFrame(0)
456  {
457  //
458  // Create a frame to hold the user-configurabale fields
459  //
460  unsigned int kWidth = 5*50;
461  unsigned int kHeight = 7*50;
463  new TGCompositeFrame(this, kWidth, kHeight);
465  new TGLayoutHints(kLHintsTop|kLHintsLeft|kLHintsExpandX|kLHintsExpandY);
466  this->AddFrame(fUserFieldsFrame, fUserFieldsHints);
467 
468  //
469  // Create a frame to hold the button bar at the bottom
470  //
471  unsigned int kButtonBarWidth = 388;
472  unsigned int kButtonBarHeight = 30;
473  fButtonBar =
474  new TGHorizontalFrame(this, kButtonBarHeight, kButtonBarWidth);
475  fButtonBarHints =
476  new TGLayoutHints(kLHintsBottom|kLHintsLeft);
477  this->AddFrame(fButtonBar, fButtonBarHints);
478 
479  this->BuildButtonBar (fButtonBar);
481  this->OpenOutputFile();
482 
483  //
484  // Finalize the window for display
485  //
486  this->Resize(kButtonBarWidth,kHeight+kButtonBarHeight);
487  this->MapSubwindows();
488  this->MapWindow();
489  this->SetWindowName("Scan dialog window");
490  }
TGTextButton * fNextButton
Definition: ScanWindow.h:114
TGTextEntry * fCommentEntry
Definition: ScanWindow.h:112
void BuildUserFields(TGCompositeFrame *f)
Definition: ScanWindow.cxx:421
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:390
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
evdb::ScanWindow::~ScanWindow ( )

Definition at line 540 of file ScanWindow.cxx.

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

541  {
542  delete fScanFrame;
543  delete fButtonBarHintsR;
544  delete fButtonBarHintsC;
545  delete fButtonBarHintsL;
546  delete fRcrdButton;
547  delete fNextButton;
548  delete fPrevButton;
549  delete fCommentEntry;
550  delete fCommentLabel;
551  delete fButtonBarHints;
552  delete fButtonBar;
553  delete fUserFieldsHints;
554  delete fUserFieldsFrame;
555  delete fUserFieldsCanvas;
556  }
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 390 of file ScanWindow.cxx.

Referenced by ScanWindow().

391  {
392  fCommentLabel = new TGLabel (f, " Comments:");
393  fCommentEntry = new TGTextEntry (f);
394  fPrevButton = new TGTextButton(f, " <<Prev ");
395  fNextButton = new TGTextButton(f, " Next>> ");
396  fRcrdButton = new TGTextButton(f, " Record ");
397 
398  fPrevButton->Connect("Clicked()", "evdb::ScanWindow", this, "Prev()");
399  fNextButton->Connect("Clicked()", "evdb::ScanWindow", this, "Next()");
400  fRcrdButton->Connect("Clicked()", "evdb::ScanWindow", this, "Rec()");
401 
402  Pixel_t c;
403  gClient->GetColorByName("pink", c);
404  fRcrdButton->ChangeBackground(c);
405 
406  fButtonBarHintsL = new TGLayoutHints(kLHintsBottom|kLHintsLeft,
407  4,2,2,8);
408  fButtonBarHintsC = new TGLayoutHints(kLHintsBottom|kLHintsLeft,
409  2,2,2,8);
410  fButtonBarHintsR = new TGLayoutHints(kLHintsBottom|kLHintsLeft,
411  2,4,2,8);
412  f->AddFrame(fCommentLabel, fButtonBarHintsL);
413  f->AddFrame(fCommentEntry, fButtonBarHintsC);
414  f->AddFrame(fPrevButton, fButtonBarHintsC);
415  f->AddFrame(fNextButton, fButtonBarHintsC);
416  f->AddFrame(fRcrdButton, fButtonBarHintsR);
417  }
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 421 of file ScanWindow.cxx.

References evdb::ScanFrame::ScanFrame().

Referenced by ScanWindow().

422  {
423  unsigned int kCanvasWidth = 390;
424  unsigned int kCanvasHeight = 500;
425 
426  fUserFieldsCanvas = new
427  TGCanvas(f, kCanvasWidth, kCanvasHeight);
428  TGLayoutHints*
429  fUserFieldsCanvasHints = new TGLayoutHints(kLHintsExpandX|
430  kLHintsExpandY);
431  f->AddFrame(fUserFieldsCanvas, fUserFieldsCanvasHints);
432 
433  fScanFrame = new ScanFrame(fUserFieldsCanvas->GetViewPort());
434  fUserFieldsCanvas->SetContainer(fScanFrame->GetFrame());
435  fScanFrame->GetFrame()->SetCleanup(kDeepCleanup);
436  }
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 559 of file ScanWindow.cxx.

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

Definition at line 569 of file ScanWindow.cxx.

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

570  {
573  }
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 494 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().

495  {
496  // set up the file name to store the information
498  std::string user(gSystem->Getenv("USER"));
499  user.append("_");
500  TTimeStamp cur;
501  std::string time(cur.AsString("s"));
502  time.replace(time.find(" "), 1, "_");
503  fOutFileName.append(opts->fScanFileBase);
504  fOutFileName.append(user);
505  fOutFileName.append(time);
506  fOutFileName.append(".txt");
507 
508  std::ofstream outfile(fOutFileName.c_str());
509 
510  //output the labels so we know what each is
511  outfile << "Run Subrun Event ";
512 
513  //
514  // figure out how many categories and maximum number of items for
515  // a category
516  //
517  unsigned int maxFields = 1;
518  unsigned int pos = 0;
519  for(unsigned int c = 0; c < opts->fCategories.size(); ++c){
520  for(unsigned int p = 0; p < opts->fFieldsPerCategory[c]; ++p){
521  if(opts->fFieldsPerCategory[c] > maxFields) {
522  maxFields = opts->fFieldsPerCategory[c];
523  }
524  outfile << opts->fCategories[c].c_str() << ":"
525  << opts->fFieldLabels[pos+p].c_str() << " ";
526  }
527  pos += opts->fFieldsPerCategory[c];
528  } // end loop over categories
529 
530  if(opts->fIncludeMCInfo)
531  outfile << "Truth:PDG Vtx_x Vtx_y Vtx_Z "
532  << "Nu_E CCNC Lepton_E InteractionType ";
533 
534  outfile << "comments" << std::endl;
535  }
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 562 of file ScanWindow.cxx.

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

563  {
566  }
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 576 of file ScanWindow.cxx.

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

577  {
579  fCommentEntry->SetText("");
581  }
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: