Public Member Functions | Public Attributes | List of all members
evdb::ParameterSetEditFrame Class Reference

A frame for editing a single paramter set. More...

#include "/cvmfs/nova.opensciencegrid.org/externals/nuevdb/v1_00_02/source/nuevdb/EventDisplayBase/ParameterSetEditDialog.h"

Public Member Functions

 ParameterSetEditFrame (TGCompositeFrame *mother, unsigned int psetid)
 
 ~ParameterSetEditFrame ()
 
std::string AsFHICL () const
 
void HandleMouseWheel (Event_t *event)
 
void Modified ()
 
void Finalize ()
 

Public Attributes

TGCompositeFrame * fTopFrame
 
TGCanvas * fCanvas
 
TGLayoutHints * fCanvasH
 
TGCompositeFrame * fContainer
 
TGTableLayout * fLayout
 
std::vector< TGHorizontalFrame * > fLHS
 
std::vector< TGHorizontalFrame * > fRHS
 
std::vector< TGTableLayoutHints * > fLHSHints
 
std::vector< TGTableLayoutHints * > fRHSHints
 
std::vector< ParameterSetEditRow * > fRow
 
unsigned int fParameterSetID
 
bool fIsModified
 

Detailed Description

A frame for editing a single paramter set.

===================================================================

Definition at line 167 of file ParameterSetEditDialog.h.

Constructor & Destructor Documentation

ParameterSetEditFrame::ParameterSetEditFrame ( TGCompositeFrame *  mother,
unsigned int  psetid 
)

Definition at line 653 of file ParameterSetEditDialog.cxx.

References fCanvas, fCanvasH, fContainer, fLayout, fLHS, fLHSHints, fRHS, fRHSHints, fRow, fhicl::ParameterSet::get_names(), evdb::ServiceTable::GetParameterSet(), MECModelEnuComparisons::i, evdb::ServiceTable::Instance(), calib::j, findDuplicateFiles::key, kHeight, kWidth, and push_back().

654  :
655  fParameterSetID(psetid),
656  fIsModified(false)
657 {
658  unsigned int i, j;
659 
660  fCanvas = new TGCanvas(mother, kWidth-6, kHeight-50);
661  fCanvasH = new TGLayoutHints(kLHintsExpandX|kLHintsExpandY);
662  mother->AddFrame(fCanvas, fCanvasH);
663 
664  fContainer = new TGCompositeFrame(fCanvas->GetViewPort());
665  fCanvas->SetContainer(fContainer);
666 
667  //
668  // Locate the parameter set connected to this frame
669  //
670  const ServiceTable& st = ServiceTable::Instance();
671  const fhicl::ParameterSet& pset = st.GetParameterSet(psetid);
672  std::vector<std::string> key = pset.get_names();
673  unsigned int nkey = key.size();
674 
675  //
676  // Count the number of "non system" parameters - each of these will
677  // need an row in the dialog window.
678  //
679  unsigned int nparam = 0;
680  for (i=0; i<nkey; ++i) {
681  if (!((key[i]=="service_type") ||
682  (key[i]=="module_type") ||
683  (key[i]=="module_label"))) {
684  ++nparam;
685  }
686  }
687 
688  //
689  // Build the layout
690  //
691  fLayout = new TGTableLayout(fContainer, nparam, 2);
692  fContainer->SetLayoutManager(fLayout);
693 
694  for (i=0, j=0; i<nkey; ++i) {
695  if (!((key[i]=="service_type") ||
696  (key[i]=="module_type") ||
697  (key[i]=="module_label"))) {
698 
699  TGHorizontalFrame* lhs = new TGHorizontalFrame(fContainer);
700  TGHorizontalFrame* rhs = new TGHorizontalFrame(fContainer);
701 
702  TGTableLayoutHints* lhsh = new TGTableLayoutHints(0,1,j,j+1);
703  TGTableLayoutHints* rhsh = new TGTableLayoutHints(1,2,j,j+1);
704 
705  fContainer->AddFrame(lhs, lhsh);
706  fContainer->AddFrame(rhs, rhsh);
707 
708  fLHS. push_back(lhs);
709  fRHS. push_back(rhs);
710  fLHSHints.push_back(lhsh);
711  fRHSHints.push_back(rhsh);
712 
713  fRow.push_back(new ParameterSetEditRow(this, lhs, rhs, pset, key[i]));
714  ++j;
715  }
716  }
717 
718  fCanvas->Connect("ProcessedEvent(Event_t*)", "evdb::ParameterSetEditFrame",
719  this,
720  "HandleMouseWheel(Event_t*)");
721 
722  fCanvas->Resize();
723 }
static const unsigned int kHeight
static ServiceTable & Instance()
std::vector< ParameterSetEditRow * > fRow
Collection of Services used in the event display.
Definition: ServiceTable.h:36
std::vector< TGTableLayoutHints * > fRHSHints
std::vector< TGHorizontalFrame * > fLHS
base_types push_back(int_type())
const double j
Definition: BetheBloch.cxx:29
std::vector< std::string > get_names() const
std::vector< TGTableLayoutHints * > fLHSHints
std::vector< TGHorizontalFrame * > fRHS
A single row for editing a single parameter in a set.
fhicl::ParameterSet const & GetParameterSet(unsigned int i) const
static const unsigned int kWidth
ParameterSetEditFrame::~ParameterSetEditFrame ( )

Definition at line 727 of file ParameterSetEditDialog.cxx.

References fCanvas, fCanvasH, fLayout, fLHS, fLHSHints, fRHS, fRHSHints, fRow, and MECModelEnuComparisons::i.

728 {
729  unsigned int i;
730  for (i=0; i<fRow.size(); ++i) delete fRow[i];
731  for (i=0; i<fRHSHints.size(); ++i) delete fRHSHints[i];
732  for (i=0; i<fLHSHints.size(); ++i) delete fLHSHints[i];
733  for (i=0; i<fRHS.size(); ++i) delete fRHS[i];
734  for (i=0; i<fLHS.size(); ++i) delete fLHS[i];
735  delete fLayout;
736  //
737  // Parent takes care of delete for fContainer, I think. Anyhow,
738  // trying to delete it causes a seg fault.
739  //
740  // delete fContainer;
741  delete fCanvasH;
742  delete fCanvas;
743 }
std::vector< ParameterSetEditRow * > fRow
std::vector< TGTableLayoutHints * > fRHSHints
std::vector< TGHorizontalFrame * > fLHS
std::vector< TGTableLayoutHints * > fLHSHints
std::vector< TGHorizontalFrame * > fRHS

Member Function Documentation

std::string ParameterSetEditFrame::AsFHICL ( ) const

Definition at line 788 of file ParameterSetEditDialog.cxx.

References fRow, and MECModelEnuComparisons::i.

789 {
790  unsigned int i;
791  std::ostringstream s;
792  for (i=0; i<fRow.size(); ++i) {
793  s << fRow[i]->AsFHICL() << "\n";
794  }
795  return s.str();
796 }
std::vector< ParameterSetEditRow * > fRow
const XML_Char * s
Definition: expat.h:262
void ParameterSetEditFrame::Finalize ( )

Definition at line 780 of file ParameterSetEditDialog.cxx.

References fRow, and MECModelEnuComparisons::i.

781 {
782  unsigned int i;
783  for (i=0; i<fRow.size(); ++i) fRow[i]->Finalize();
784 }
std::vector< ParameterSetEditRow * > fRow
void ParameterSetEditFrame::HandleMouseWheel ( Event_t *  event)

Definition at line 746 of file ParameterSetEditDialog.cxx.

References fCanvas, and makeDatasetsPage::page.

747 {
748  // Handle mouse wheel to scroll.
749  if (event->fType != kButtonPress && event->fType != kButtonRelease)
750  return;
751 
752  Int_t page = 0;
753  if (event->fCode == kButton4 || event->fCode == kButton5) {
754  if (!fCanvas) return;
755  if (fCanvas->GetContainer()->GetHeight())
756  page = Int_t(Float_t(fCanvas->GetViewPort()->GetHeight() *
757  fCanvas->GetViewPort()->GetHeight()) /
758  fCanvas->GetContainer()->GetHeight());
759  }
760 
761  if (event->fCode == kButton4) {
762  //scroll up
763  Int_t newpos = fCanvas->GetVsbPosition() - page;
764  if (newpos < 0) newpos = 0;
765  fCanvas->SetVsbPosition(newpos);
766  }
767  if (event->fCode == kButton5) {
768  // scroll down
769  Int_t newpos = fCanvas->GetVsbPosition() + page;
770  fCanvas->SetVsbPosition(newpos);
771  }
772 
773  return;
774 }
void ParameterSetEditFrame::Modified ( )

Member Data Documentation

TGCanvas* evdb::ParameterSetEditFrame::fCanvas
TGLayoutHints* evdb::ParameterSetEditFrame::fCanvasH

Definition at line 184 of file ParameterSetEditDialog.h.

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

TGCompositeFrame* evdb::ParameterSetEditFrame::fContainer

Definition at line 185 of file ParameterSetEditDialog.h.

Referenced by ParameterSetEditFrame().

bool evdb::ParameterSetEditFrame::fIsModified

Definition at line 194 of file ParameterSetEditDialog.h.

Referenced by Modified().

TGTableLayout* evdb::ParameterSetEditFrame::fLayout

Definition at line 186 of file ParameterSetEditDialog.h.

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

std::vector<TGHorizontalFrame*> evdb::ParameterSetEditFrame::fLHS

Definition at line 187 of file ParameterSetEditDialog.h.

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

std::vector<TGTableLayoutHints*> evdb::ParameterSetEditFrame::fLHSHints

Definition at line 189 of file ParameterSetEditDialog.h.

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

unsigned int evdb::ParameterSetEditFrame::fParameterSetID

Definition at line 193 of file ParameterSetEditDialog.h.

std::vector<TGHorizontalFrame*> evdb::ParameterSetEditFrame::fRHS

Definition at line 188 of file ParameterSetEditDialog.h.

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

std::vector<TGTableLayoutHints*> evdb::ParameterSetEditFrame::fRHSHints

Definition at line 190 of file ParameterSetEditDialog.h.

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

std::vector<ParameterSetEditRow*> evdb::ParameterSetEditFrame::fRow
TGCompositeFrame* evdb::ParameterSetEditFrame::fTopFrame

Definition at line 182 of file ParameterSetEditDialog.h.


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