CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWPathsPopup Class Reference

#include <FWPathsPopup.h>

Inheritance diagram for FWPathsPopup:

Public Member Functions

void applyEditor ()
 
void cellClicked (Int_t iRow, Int_t iColumn, Int_t iButton, Int_t iKeyMod, Int_t iGlobalX, Int_t iGlobalY)
 
 FWPathsPopup (FWFFLooper *, FWGUIManager *)
 
Bool_t HandleKey (Event_t *event) override
 
bool & hasChanges ()
 
void postEvent (edm::Event const &event)
 
void postModuleEvent (edm::StreamContext const &, edm::ModuleCallingContext const &)
 
void preModuleEvent (edm::StreamContext const &, edm::ModuleCallingContext const &)
 
void scheduleReloadEvent ()
 
void setup (const edm::ScheduleInfo *info)
 
void updateFilterString (const char *str)
 
void windowIsClosing ()
 

Private Member Functions

 ClassDefOverride (FWPathsPopup, 0)
 

Private Attributes

TGTextButton * m_apply
 
FWGUIManagerm_guiManager
 
bool m_hasChanges
 
const edm::ScheduleInfom_info
 
FWFFLooperm_looper
 
TGLabel * m_moduleLabel
 
TGLabel * m_moduleName
 
FWPSetTableManagerm_psTable
 
TGTextEntry * m_search
 
FWTableWidgetm_tableWidget
 

Detailed Description

Definition at line 27 of file FWPathsPopup.h.

Constructor & Destructor Documentation

◆ FWPathsPopup()

FWPathsPopup::FWPathsPopup ( FWFFLooper looper,
FWGUIManager guiManager 
)

Definition at line 36 of file FWPathsPopup.cc.

37  : TGMainFrame(gClient->GetRoot(), 400, 600),
38  m_info(nullptr),
40  m_hasChanges(false),
41  m_moduleLabel(nullptr),
42  m_moduleName(nullptr),
43  m_apply(nullptr),
45  m_guiManager(guiManager) {
46  gVirtualX->SelectInput(GetId(),
47  kKeyPressMask | kKeyReleaseMask | kExposureMask | kPointerMotionMask | kStructureNotifyMask |
48  kFocusChangeMask | kEnterWindowMask | kLeaveWindowMask);
49  this->Connect("CloseWindow()", "FWPathsPopup", this, "windowIsClosing()");
50 
51  FWDialogBuilder builder(this);
52  builder.indent(4)
53  .spaceDown(10)
54  .addLabel("Filter:")
55  .floatLeft(4)
56  .expand(false, false)
57  .addTextEntry("", &m_search)
58  .expand(true, false)
59  .spaceDown(10)
60  .addTable(m_psTable, &m_tableWidget)
61  .expand(true, true)
62  .addTextButton("Apply changes and reload", &m_apply);
63 
65  editor->SetBackgroundColor(gVirtualX->GetPixel(kYellow - 7));
66  editor->SetFrameDrawn(false);
68  m_psTable->m_editor->Connect("ReturnPressed()", "FWPathsPopup", this, "applyEditor()");
69 
70  m_apply->Connect("Clicked()", "FWPathsPopup", this, "scheduleReloadEvent()");
71  m_apply->SetEnabled(false);
72  m_search->SetEnabled(true);
73  m_search->Connect("TextChanged(const char *)", "FWPathsPopup", this, "updateFilterString(const char *)");
77  m_tableWidget->Connect("cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)",
78  "FWPathsPopup",
79  this,
80  "cellClicked(Int_t,Int_t,Int_t,Int_t,Int_t,Int_t)");
82 
83  SetWindowName("CMSSW Configuration Editor");
84  MapSubwindows();
85  editor->UnmapWindow();
86 
87  Layout();
88 }

References FWDialogBuilder::addLabel(), FWDialogBuilder::addTable(), FWDialogBuilder::addTextButton(), FWDialogBuilder::addTextEntry(), FWTableWidget::body(), FWTableWidget::disableGrowInWidth(), FWDialogBuilder::expand(), FWDialogBuilder::floatLeft(), FWDialogBuilder::indent(), m_apply, FWPSetTableManager::m_editor, m_psTable, m_search, m_tableWidget, FWTableWidget::SetBackgroundColor(), FWPSetTableManager::setCellValueEditor(), FWTableWidget::SetHeaderBackgroundColor(), FWTableWidget::SetLineSeparatorColor(), and FWDialogBuilder::spaceDown().

Member Function Documentation

◆ applyEditor()

void FWPathsPopup::applyEditor ( )

Proxies the applyEditor() method in the model so that it can be connected to GUI, signals.

Definition at line 105 of file FWPathsPopup.cc.

105  {
106  bool applied = m_psTable->applyEditor();
107  if (applied)
108  m_apply->SetEnabled(true);
109 }

References FWPSetTableManager::applyEditor(), m_apply, and m_psTable.

Referenced by cellClicked(), and scheduleReloadEvent().

◆ cellClicked()

void FWPathsPopup::cellClicked ( Int_t  iRow,
Int_t  iColumn,
Int_t  iButton,
Int_t  iKeyMod,
Int_t  iGlobalX,
Int_t  iGlobalY 
)

Handles clicking on the table cells.

Clicking on a cell in the first column opens / closes a given node. Clicking on a cell in the second column moves the editor to that cell.

Definition at line 117 of file FWPathsPopup.cc.

117  {
118  if (iButton != kButton1)
119  return;
120 
121  if (iColumn == 0 || iColumn == 1) {
122  // Save and close the previous editor, if required.
123  if (m_psTable->selectedColumn() == 1 && m_psTable->selectedRow() != -1) {
124  int oldIndex = m_psTable->rowToIndex()[m_psTable->selectedRow()];
125  FWPSetTableManager::PSetData &oldData = m_psTable->data()[oldIndex];
126 
127  if (oldData.editable)
128  applyEditor();
129  }
130 
131  m_psTable->setSelection(iRow, iColumn, iKeyMod);
132 
133  if (iColumn == 0)
134  m_psTable->setExpanded(iRow);
135  }
136 }

References applyEditor(), FWPSetTableManager::data(), FWPSetTableManager::PSetData::editable, m_psTable, FWPSetTableManager::rowToIndex(), FWPSetTableManager::selectedColumn(), FWPSetTableManager::selectedRow(), FWPSetTableManager::setExpanded(), and FWPSetTableManager::setSelection().

◆ ClassDefOverride()

FWPathsPopup::ClassDefOverride ( FWPathsPopup  ,
 
)
private

◆ HandleKey()

Bool_t FWPathsPopup::HandleKey ( Event_t *  event)
override

Handle pressing of esc.

Definition at line 92 of file FWPathsPopup.cc.

92  {
93  UInt_t keysym = event->fCode;
94 
95  if (keysym == (UInt_t)gVirtualX->KeysymToKeycode(kKey_Escape)) {
96  // called from FWPSetCellEditor
98  m_psTable->setSelection(-1, -1, 0);
99  }
100  return TGMainFrame::HandleKey(event);
101 }

References FWPSetTableManager::cancelEditor(), m_psTable, and FWPSetTableManager::setSelection().

◆ hasChanges()

bool& FWPathsPopup::hasChanges ( )
inline

Definition at line 35 of file FWPathsPopup.h.

35 { return m_hasChanges; }

References m_hasChanges.

Referenced by FWFFLooper::duringLoop().

◆ postEvent()

void FWPathsPopup::postEvent ( edm::Event const &  event)

Definition at line 162 of file FWPathsPopup.cc.

162  {
163  m_guiManager->updateStatus("Done processing.");
164  gSystem->ProcessEvents();
165 
166  // Get the last process name from the process history:
167  // this should be the one specified in the cfg file
168 
169  if (event.processHistory().empty()) {
170  fwLog(fwlog::kInfo) << "Path GUI:: no process history available.\n";
171  return;
172  }
173  edm::ProcessHistory::const_iterator pi = event.processHistory().end() - 1;
174  std::string processName = pi->processName();
175 
176  // It's called TriggerResults but actually contains info on all paths
177  edm::InputTag tag("TriggerResults", "", processName);
179  event.getByLabel(tag, triggerResults);
180 
181  std::vector<FWPSetTableManager::PathUpdate> pathUpdates;
182 
183  if (triggerResults.isValid()) {
184  const edm::TriggerNames &triggerNames = event.triggerNames(*triggerResults);
185 
186  for (size_t i = 0, e = triggerResults->size(); i != e; ++i) {
188  update.pathName = triggerNames.triggerName(i);
189  update.passed = triggerResults->accept(i);
190  update.choiceMaker = triggerResults->index(i);
191  pathUpdates.push_back(update);
192  }
193  }
195  m_psTable->update(pathUpdates);
198 }

References FWTableWidget::body(), FWTableManagerBase::dataChanged(), FWTabularWidget::DoRedraw(), MillePedeFileConverter_cfg::e, fwLog, mps_fire::i, fwlog::kInfo, m_guiManager, m_info, m_psTable, m_tableWidget, pi, SimL1EmulatorRepack_CalouGT_cff::processName, AlCaHLTBitMon_QueryRunRegistry::string, GlobalPosition_Frontier_DevDB_cff::tag, L1TEGammaOffline_cfi::triggerNames, triggerResults, update, FWPSetTableManager::update(), FWPSetTableManager::updateSchedule(), and FWGUIManager::updateStatus().

Referenced by FWFFLooper::duringLoop().

◆ postModuleEvent()

void FWPathsPopup::postModuleEvent ( edm::StreamContext const &  s,
edm::ModuleCallingContext const &  mcc 
)

Gets called by CMSSW as modules are about to be processed.

Definition at line 151 of file FWPathsPopup.cc.

151  {
152  m_guiManager->updateStatus((mcc.moduleDescription()->moduleName() + " processed.").c_str());
153  gSystem->ProcessEvents();
154 }

References m_guiManager, edm::ModuleCallingContext::moduleDescription(), edm::ModuleDescription::moduleName(), and FWGUIManager::updateStatus().

Referenced by FWFFLooper::attachTo().

◆ preModuleEvent()

void FWPathsPopup::preModuleEvent ( edm::StreamContext const &  s,
edm::ModuleCallingContext const &  mcc 
)

Gets called by CMSSW as we process modules.

Definition at line 157 of file FWPathsPopup.cc.

157  {
158  m_guiManager->updateStatus(("Processing " + mcc.moduleDescription()->moduleName() + "...").c_str());
159  gSystem->ProcessEvents();
160 }

References m_guiManager, edm::ModuleCallingContext::moduleDescription(), edm::ModuleDescription::moduleName(), and FWGUIManager::updateStatus().

Referenced by FWFFLooper::attachTo().

◆ scheduleReloadEvent()

void FWPathsPopup::scheduleReloadEvent ( )

Modifies the module and asks the looper to reload the event.

  1. Read the configuration snippet from the GUI,
  2. Use the python interpreter to parse it and get the new parameter set.
  3. Notify the looper about the changes.

FIXME: implement 2 and 3.

Definition at line 209 of file FWPathsPopup.cc.

209  {
210  applyEditor();
211  try {
212  for (size_t mni = 0, mne = m_psTable->modules().size(); mni != mne; ++mni) {
214  if (module.dirty == false)
215  continue;
217  m_looper->requestChanges(data.label, *module.current_pset);
218  }
219  m_hasChanges = true;
220  m_apply->SetEnabled(false);
221  gSystem->ExitLoop();
222  } catch (boost::python::error_already_set const &) {
223  edm::pythonToCppException("Configuration", "");
224  Py_Finalize();
225  } catch (cms::Exception &exception) {
226  std::cout << exception.what() << std::endl;
227  }
228  // Return control to the FWFFLooper so that it can decide what to do next.
229 }

References applyEditor(), gather_cfg::cout, FWPSetTableManager::ModuleInfo::current_pset, data, FWPSetTableManager::ModuleInfo::dirty, FWPSetTableManager::entries(), FWPSetTableManager::ModuleInfo::entry, cppFunctionSkipper::exception, m_apply, m_hasChanges, m_looper, m_psTable, FWPSetTableManager::modules(), edm::pythonToCppException(), and FWFFLooper::requestChanges().

◆ setup()

void FWPathsPopup::setup ( const edm::ScheduleInfo info)

Finish the setup of the GUI

Definition at line 145 of file FWPathsPopup.cc.

145  {
146  assert(info);
147  m_info = info;
148 }

References cms::cuda::assert(), info(), and m_info.

Referenced by FWFFLooper::startingNewLoop().

◆ updateFilterString()

void FWPathsPopup::updateFilterString ( const char *  str)

◆ windowIsClosing()

void FWPathsPopup::windowIsClosing ( )

Definition at line 31 of file FWPathsPopup.cc.

31  {
32  UnmapWindow();
33  DontCallClose();
34 }

Member Data Documentation

◆ m_apply

TGTextButton* FWPathsPopup::m_apply
private

Definition at line 55 of file FWPathsPopup.h.

Referenced by applyEditor(), FWPathsPopup(), and scheduleReloadEvent().

◆ m_guiManager

FWGUIManager* FWPathsPopup::m_guiManager
private

Definition at line 59 of file FWPathsPopup.h.

Referenced by postEvent(), postModuleEvent(), and preModuleEvent().

◆ m_hasChanges

bool FWPathsPopup::m_hasChanges
private

Definition at line 50 of file FWPathsPopup.h.

Referenced by hasChanges(), and scheduleReloadEvent().

◆ m_info

const edm::ScheduleInfo* FWPathsPopup::m_info
private

Definition at line 45 of file FWPathsPopup.h.

Referenced by postEvent(), and setup().

◆ m_looper

FWFFLooper* FWPathsPopup::m_looper
private

Definition at line 48 of file FWPathsPopup.h.

Referenced by scheduleReloadEvent().

◆ m_moduleLabel

TGLabel* FWPathsPopup::m_moduleLabel
private

Definition at line 52 of file FWPathsPopup.h.

◆ m_moduleName

TGLabel* FWPathsPopup::m_moduleName
private

Definition at line 53 of file FWPathsPopup.h.

◆ m_psTable

FWPSetTableManager* FWPathsPopup::m_psTable
private

◆ m_search

TGTextEntry* FWPathsPopup::m_search
private

Definition at line 58 of file FWPathsPopup.h.

Referenced by FWPathsPopup().

◆ m_tableWidget

FWTableWidget* FWPathsPopup::m_tableWidget
private

Definition at line 57 of file FWPathsPopup.h.

Referenced by FWPathsPopup(), and postEvent().

FWTableWidget::SetBackgroundColor
void SetBackgroundColor(Pixel_t) override
Definition: FWTableWidget.cc:173
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:428
FWPathsPopup::m_psTable
FWPSetTableManager * m_psTable
Definition: FWPathsPopup.h:56
edm::pythonToCppException
void pythonToCppException(const std::string &iType, const std::string &error)
Definition: PyBind11Wrapper.cc:6
FWPSetTableManager::setCellValueEditor
void setCellValueEditor(FWPSetCellEditor *editor)
Definition: FWPSetTableManager.cc:500
gather_cfg.cout
cout
Definition: gather_cfg.py:144
FWPSetTableManager::ModuleInfo::current_pset
edm::ParameterSet * current_pset
Definition: FWPSetTableManager.h:124
triggerResults
static const std::string triggerResults
Definition: EdmProvDump.cc:45
FWPSetTableManager::updateFilter
virtual void updateFilter(const char *filter)
Definition: FWPSetTableManager.cc:742
cms::cuda::assert
assert(be >=bs)
FWPSetTableManager::selectedColumn
int selectedColumn() const
Definition: FWPSetTableManager.cc:567
FWPSetTableManager::cancelEditor
void cancelEditor()
Definition: FWPSetTableManager.cc:506
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
FWPSetTableManager::data
std::vector< PSetData > & data()
Definition: FWPSetTableManager.h:104
FWPathsPopup::m_moduleName
TGLabel * m_moduleName
Definition: FWPathsPopup.h:53
edm::Handle< edm::TriggerResults >
FWPSetTableManager::selectedRow
int selectedRow() const
Definition: FWPSetTableManager.cc:565
FWPathsPopup::m_tableWidget
FWTableWidget * m_tableWidget
Definition: FWPathsPopup.h:57
FWPSetTableManager::entries
std::vector< PSetData > & entries()
Definition: FWPSetTableManager.h:142
FWGUIManager::updateStatus
void updateStatus(const char *status)
Definition: FWGUIManager.cc:367
FWPSetTableManager::update
void update(std::vector< PathUpdate > &pathUpdates)
Definition: FWPSetTableManager.cc:466
FWTableWidget::disableGrowInWidth
void disableGrowInWidth()
Definition: FWTableWidget.cc:498
FWPathsPopup::m_guiManager
FWGUIManager * m_guiManager
Definition: FWPathsPopup.h:59
FWPSetTableManager::m_editor
FWPSetCellEditor * m_editor
Definition: FWPSetTableManager.h:185
FWDialogBuilder
Definition: FWDialogBuilder.h:93
GlobalPosition_Frontier_DevDB_cff.tag
tag
Definition: GlobalPosition_Frontier_DevDB_cff.py:11
L1TEGammaOffline_cfi.triggerNames
triggerNames
Definition: L1TEGammaOffline_cfi.py:40
FWPSetTableManager::updateSchedule
void updateSchedule(const edm::ScheduleInfo *info)
Definition: FWPSetTableManager.cc:383
str
#define str(s)
Definition: TestProcessor.cc:51
FWPathsPopup::m_search
TGTextEntry * m_search
Definition: FWPathsPopup.h:58
FWPSetTableManager::PSetData
Definition: FWPSetTableManager.h:38
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
looper
Definition: looper.py:1
FWPSetTableManager::PSetData::editable
bool editable
Definition: FWPSetTableManager.h:78
cppFunctionSkipper.exception
exception
Definition: cppFunctionSkipper.py:10
FWTableManagerBase::dataChanged
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes.
Definition: FWTableManagerBase.cc:63
FWPathsPopup::applyEditor
void applyEditor()
Definition: FWPathsPopup.cc:105
edm::ProcessHistory::const_iterator
collection_type::const_iterator const_iterator
Definition: ProcessHistory.h:19
FWPathsPopup::m_looper
FWFFLooper * m_looper
Definition: FWPathsPopup.h:48
FWPSetTableManager::ModuleInfo::entry
size_t entry
Definition: FWPSetTableManager.h:116
FWPSetTableManager::setSelection
void setSelection(int row, int column, int mask)
Definition: FWPSetTableManager.cc:577
FWPathsPopup::m_moduleLabel
TGLabel * m_moduleLabel
Definition: FWPathsPopup.h:52
FWTabularWidget::DoRedraw
void DoRedraw() override
Definition: FWTabularWidget.cc:221
FWPSetTableManager::rowToIndex
std::vector< int > & rowToIndex()
Definition: FWPSetTableManager.h:105
FWPSetTableManager
Definition: FWPSetTableManager.h:33
SimL1EmulatorRepack_CalouGT_cff.processName
processName
Definition: SimL1EmulatorRepack_CalouGT_cff.py:17
fwlog::kInfo
Definition: fwLog.h:35
FWPathsPopup::m_info
const edm::ScheduleInfo * m_info
Definition: FWPathsPopup.h:45
FWTableWidget::SetLineSeparatorColor
void SetLineSeparatorColor(Pixel_t)
Definition: FWTableWidget.cc:209
FWTableWidget::body
FWTabularWidget * body()
Definition: FWTableWidget.h:90
FWPSetCellEditor
Definition: FWPSetCellEditor.h:24
edm::TriggerNames
Definition: TriggerNames.h:55
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
FWPathsPopup::m_apply
TGTextButton * m_apply
Definition: FWPathsPopup.h:55
FWTableWidget::SetHeaderBackgroundColor
void SetHeaderBackgroundColor(Pixel_t)
Definition: FWTableWidget.cc:188
FWPSetTableManager::modules
std::vector< ModuleInfo > & modules()
Definition: FWPSetTableManager.h:141
pi
const Double_t pi
Definition: trackSplitPlot.h:36
cms::Exception
Definition: Exception.h:70
FWPSetTableManager::applyEditor
bool applyEditor()
Definition: FWPSetTableManager.cc:519
FWFFLooper::requestChanges
void requestChanges(const std::string &, const edm::ParameterSet &)
Definition: FWFFLooper.cc:449
event
Definition: event.py:1
FWPSetTableManager::ModuleInfo
Definition: FWPSetTableManager.h:110
FWPSetTableManager::ModuleInfo::dirty
bool dirty
Definition: FWPSetTableManager.h:121
FWPSetTableManager::PathUpdate
Definition: FWPSetTableManager.h:128
edm::InputTag
Definition: InputTag.h:15
FWPathsPopup::m_hasChanges
bool m_hasChanges
Definition: FWPathsPopup.h:50
update
#define update(a, b)
Definition: TrackClassifier.cc:10
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
FWPSetTableManager::setExpanded
void setExpanded(int row)
Definition: FWPSetTableManager.cc:620