CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | Friends
FWPSetTableManager Class Reference

#include <Fireworks/FWInterface/interface/FWPSetTableManager.h>

Inheritance diagram for FWPSetTableManager:
FWTableManagerBase

Classes

struct  ModuleInfo
 
struct  PathInfo
 
struct  PathUpdate
 
struct  PSetData
 

Public Member Functions

bool cellDataIsSortable () const override
 
FWTableCellRendererBasecellRenderer (int iSortedRowNumber, int iCol) const override
 
std::vector< PSetData > & data ()
 
 FWPSetTableManager ()
 
 FWPSetTableManager (const FWPSetTableManager &)=delete
 
std::vector< std::string > getTitles () const override
 returns the title names for each column More...
 
void implSort (int, bool) override
 Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'. More...
 
std::vector< unsigned int > maxWidthForColumns () const override
 for each column in the table this returns the present maximum width for that column More...
 
int numberOfColumns () const override
 Number of columns in the table. More...
 
int numberOfRows () const override
 Number of rows in the table. More...
 
const FWPSetTableManageroperator= (const FWPSetTableManager &)=delete
 
virtual bool rowIsSelected (int row) const
 
std::vector< int > & rowToIndex ()
 
int selectedColumn () const
 
int selectedRow () const
 
virtual const std::string title () const
 
int unsortedRowNumber (int unsorted) const override
 when passed the index to the sorted order of the rows it returns the original row number from the underlying data More...
 
virtual void updateFilter (const char *filter)
 
 ~FWPSetTableManager () override
 
- Public Member Functions inherited from FWTableManagerBase
virtual void buttonPressedInRowHeader (Int_t row, Event_t *event, Int_t relX, Int_t relY)
 Called if mouse button pressed in Row Header, defaults is to do nothing. More...
 
virtual void buttonReleasedInRowHeader (Int_t row, Event_t *event, Int_t relX, Int_t relY)
 
virtual unsigned int cellHeight () const
 require all cells to be the same height More...
 
 ClassDefOverride (FWTableManagerBase, 0)
 
void dataChanged ()
 Classes which inherit from FWTableManagerBase must call this when their underlying data changes. More...
 
 FWTableManagerBase ()
 
virtual bool hasLabelHeaders () const
 
virtual bool hasRowHeaders () const
 Returns 'true' if this table has row headers. Defaults return value is false. More...
 
virtual FWTableCellRendererBaserowHeader (int iSortedRowNumber) const
 Returns the renderer for the row header for the sorted row number iSortedRowNumber. More...
 
void sort (int iCol, bool iSortOrder)
 Call to have table sorted on values in column iCol with the sort order being descending if iSortOrder is 'true'. More...
 
int sortColumn (void)
 The current sort column. More...
 
bool sortOrder (void)
 The current sort order for the table. More...
 
void visualPropertiesChanged ()
 Classes which inherit from FWTableManagerBase must call this when how the data is shown (e.g. color) changes. More...
 
 ~FWTableManagerBase () override
 

Protected Member Functions

bool applyEditor ()
 
void cancelEditor ()
 
std::vector< PSetData > & entries ()
 
std::vector< ModuleInfo > & modules ()
 
void setExpanded (int row)
 
void setSelection (int row, int column, int mask)
 
void update (std::vector< PathUpdate > &pathUpdates)
 
void updateSchedule (const edm::ScheduleInfo *info)
 

Private Member Functions

template<class T >
void createScalarString (PSetData &data, T v)
 
template<typename T >
void createVectorString (FWPSetTableManager::PSetData &data, const T &v, bool quotes)
 
void handleEntry (const edm::Entry &entry, const std::string &key)
 
void handlePSet (edm::ParameterSet *psp)
 
void handlePSetEntry (edm::ParameterSetEntry &entry, const std::string &key)
 
void handleVPSetEntry (edm::VParameterSetEntry &entry, const std::string &key)
 
void recalculateVisibility ()
 
void setCellValueEditor (FWPSetCellEditor *editor)
 

Private Attributes

std::vector< std::string > m_availablePaths
 
FWPSetCellEditorm_editor
 
std::vector< PSetDatam_entries
 
std::string m_filter
 
std::vector< ModuleInfom_modules
 
std::vector< size_t > m_parentStack
 
std::map< std::string, size_t > m_pathIndex
 
std::vector< PathInfom_paths
 
FWTextTreeCellRenderer m_renderer
 
std::vector< int > m_row_to_index
 
int m_selectedColumn
 
int m_selectedRow
 

Friends

class FWPathsPopup
 

Detailed Description

Description: [one line class summary]

Usage: <usage>

Definition at line 33 of file FWPSetTableManager.h.

Constructor & Destructor Documentation

◆ FWPSetTableManager() [1/2]

FWPSetTableManager::FWPSetTableManager ( )

Definition at line 86 of file FWPSetTableManager.cc.

References FWTextTableCellRenderer::getDefaultHighlightGC(), m_renderer, recalculateVisibility(), FWTextTableCellRenderer::setHighlightContext(), and FWTableManagerBase::visualPropertiesChanged().

86  : m_selectedRow(-1) {
88  hc->SetForeground(0xdddddd);
89 
91 
94 }
FWTextTreeCellRenderer m_renderer
void setHighlightContext(const TGGC *context)
static const TGGC & getDefaultHighlightGC()
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...

◆ ~FWPSetTableManager()

FWPSetTableManager::~FWPSetTableManager ( )
override

Definition at line 96 of file FWPSetTableManager.cc.

96 {}

◆ FWPSetTableManager() [2/2]

FWPSetTableManager::FWPSetTableManager ( const FWPSetTableManager )
delete

Member Function Documentation

◆ applyEditor()

bool FWPSetTableManager::applyEditor ( )
protected

This is invoked every single time the editor contents must be applied to the selected entry in the pset.

Returns
true on success.

Definition at line 519 of file FWPSetTableManager.cc.

References FWPSetCellEditor::apply(), data(), MillePedeFileConverter_cfg::e, m_editor, m_entries, m_modules, m_row_to_index, m_selectedColumn, m_selectedRow, class-composition::parent, setSelection(), and summarizeEdmComparisonLogfiles::success.

Referenced by FWPathsPopup::applyEditor(), and FWPathsPopup::updateFilterString().

519  {
520  if (!m_editor)
521  return false;
522 
523  if (m_selectedRow == -1 || m_selectedColumn != 1)
524  return false;
525 
526  // printf("FWPSetTableManager::applyEditor() \n");
528  PSetData &parent = m_entries[data.parent];
529  bool success = false;
530  try {
532 
533  if (success) {
534  data.value = m_editor->GetText();
535  m_modules[data.module].dirty = true;
536  setSelection(-1, -1, 0);
537  m_editor->UnmapWindow();
538  // ???
539  // copy current to orig
540  } else {
541  // ???
542  // set current from orig? reimport module ... hmmh, hard.
543  }
544  } catch (cms::Exception &e) {
545  m_editor->SetForegroundColor(gVirtualX->GetPixel(kRed));
546  }
547  return success;
548 }
std::vector< ModuleInfo > m_modules
std::vector< PSetData > & data()
std::vector< int > m_row_to_index
std::vector< PSetData > m_entries
bool apply(FWPSetTableManager::PSetData &data, FWPSetTableManager::PSetData &parent)
FWPSetCellEditor * m_editor
void setSelection(int row, int column, int mask)

◆ cancelEditor()

void FWPSetTableManager::cancelEditor ( )
protected

Does not apply changes and closes window.

Definition at line 506 of file FWPSetTableManager.cc.

References m_editor, and setSelection().

Referenced by FWPathsPopup::HandleKey().

506  {
507  if (!m_editor)
508  return;
509 
510  // printf("FWPSetTableManager::cancelEditor() \n");
511  setSelection(-1, -1, 0);
512  m_editor->UnmapWindow();
513 }
FWPSetCellEditor * m_editor
void setSelection(int row, int column, int mask)

◆ cellDataIsSortable()

bool FWPSetTableManager::cellDataIsSortable ( ) const
inlineoverridevirtual

Reimplemented from FWTableManagerBase.

Definition at line 100 of file FWPSetTableManager.h.

100 { return false; }

◆ cellRenderer()

FWTableCellRendererBase * FWPSetTableManager::cellRenderer ( int  iSortedRowNumber,
int  iCol 
) const
overridevirtual

Returns the particular renderer used to handle the requested cell. Arguments: iSortedRowNumber: the row number from the present sort (i.e. the cell number of the view) iCol: the column number of the cell. The returned value must be used immediately and not held onto since the same Renderer can be used for subsequent calls

Implements FWTableManagerBase.

Definition at line 642 of file FWPSetTableManager.cc.

References fireworks::boldGC(), data(), fwLog, FWTextTableCellRenderer::getDefaultGC(), FWTextTreeCellRenderer::iconWidth(), validateAlignments::indent, fireworks::italicGC(), fwlog::kWarning, label, m_entries, m_filter, m_modules, m_paths, m_renderer, m_row_to_index, m_selectedColumn, m_selectedRow, reco_skim_cfg_mod::maxSize, castor_dqm_sourceclient_file_cfg::path, DivergingColor::red, FWTextTableCellRenderer::setData(), FWTextTableCellRenderer::setGraphicsContext(), FWTextTreeCellRenderer::setIndentation(), FWTextTreeCellRenderer::setIsOpen(), FWTextTreeCellRenderer::setIsParent(), FWTextTreeCellRenderer::showEditor(), AlCaHLTBitMon_QueryRunRegistry::string, sTypeTranslations, TypeTrans::table_, and relativeConstraints::value.

642  {
643  const static size_t maxSize = 512; // maximum string length
644 
645  static TGGC boldGC(fireworks::boldGC());
646  static TGGC italicGC(fireworks::italicGC());
647  static TGGC defaultGC(FWTextTableCellRenderer::getDefaultGC());
648 
649  const static Pixel_t gray = 0x777777;
650  const static Pixel_t red = gVirtualX->GetPixel(kRed - 5);
651  const static Pixel_t green = gVirtualX->GetPixel(kGreen - 5);
652 
653  // return in case if nothing maches filter
654  if (static_cast<int>(m_row_to_index.size()) <= iSortedRowNumber) {
655  m_renderer.setData(std::string(), false);
656  return &m_renderer;
657  }
658 
659  int unsortedRow = m_row_to_index[iSortedRowNumber];
660  const PSetData &data = m_entries[unsortedRow];
661 
664  TGGC *gc = nullptr;
665  if (data.level == 0) {
666  const PathInfo &path = m_paths[data.path];
667  label = data.label + " (" + data.value + ")";
668  gc = &boldGC;
669  gc->SetForeground(path.passed ? green : red);
670  } else if (data.level == 1) {
671  // "passed" means if module made decision on path
672  const ModuleInfo &module = m_modules[m_paths[data.path].moduleStart + data.module];
673  label = data.label + " (" + data.value + ")";
674  gc = (TGGC *)&boldGC;
675  gc->SetForeground(module.passed ? green : red);
676  } else {
677  if (data.type > 0)
678  label = data.label + " (" + sTypeTranslations.table_[data.type] + ")";
679  else
680  label = data.label;
681  value = data.value;
682 
683  if (data.editable) {
684  gc = &defaultGC;
685  } else {
686  gc = &italicGC;
687  gc->SetForeground(gray);
688  }
689  }
690 
691  // check string size and cut it if necessary (problems with X11)
692  if (iCol == 1 && value.size() >= maxSize) {
693  if (iSortedRowNumber == m_selectedRow)
694  fwLog(fwlog::kWarning) << "label: " << label << " has too long value " << value << std::endl << std::endl;
695 
696  value = value.substr(0, maxSize);
697  value += "[truncated]";
698  gc->SetForeground(gVirtualX->GetPixel(kMagenta));
699  }
700 
701  // debug
702  // label = Form("%s m[%d] childm[%d] ", label.c_str(), data.matches, data.childMatches);
703 
704  // set text attributes
706  bool selected = data.matches && (m_filter.empty() == false);
707  m_renderer.setData(iCol ? value : label, selected);
708 
709  // set tree attributes
710  bool isParent = false;
711  bool isOpen = false;
712  int indent = 0;
713  if (iCol == 0) {
714  if (m_filter.empty()) {
715  size_t nextIdx = unsortedRow + 1;
716  isParent = (nextIdx < m_entries.size() && m_entries[nextIdx].parent == (size_t)unsortedRow);
717  isOpen = data.expandedUser;
718  } else {
719  isParent = data.childMatches;
720  isOpen = data.expandedFilter && data.childMatches;
721  }
722 
723  indent = data.level * 10;
724  if (!isParent)
726  }
727  m_renderer.setIsParent(isParent);
728  m_renderer.setIsOpen(isOpen);
730 
731  // If we are rendering the selected cell,
732  // we show the editor.
733  bool showEdit =
734  (iCol == 1 && iSortedRowNumber == m_selectedRow && iCol == m_selectedColumn && value.size() < maxSize);
735  m_renderer.showEditor(data.editable && showEdit);
736 
737  return &m_renderer;
738 } // cellRender()
static TypeTrans const sTypeTranslations
std::vector< PathInfo > m_paths
FWTextTreeCellRenderer m_renderer
std::vector< ModuleInfo > m_modules
char const * label
std::vector< PSetData > & data()
static const TGGC & getDefaultGC()
std::vector< int > m_row_to_index
std::vector< PSetData > m_entries
Definition: value.py:1
void setGraphicsContext(const TGGC *iContext)
virtual void setIndentation(int indentation=0)
void setData(const std::string &, bool isSelected)
#define fwLog(_level_)
Definition: fwLog.h:45
const TGGC & italicGC()
const TGGC & boldGC()
virtual void showEditor(bool value)

◆ createScalarString()

template<class T >
void FWPSetTableManager::createScalarString ( PSetData data,
T  v 
)
private

Definition at line 174 of file FWPSetTableManager.cc.

References data(), m_entries, contentValuesCheck::ss, and findQualityFiles::v.

Referenced by handleEntry().

174  {
175  std::stringstream ss;
176  ss << v;
177  data.value = ss.str();
178  m_entries.push_back(data);
179 }
std::vector< PSetData > & data()
std::vector< PSetData > m_entries

◆ createVectorString()

template<typename T >
void FWPSetTableManager::createVectorString ( FWPSetTableManager::PSetData data,
const T v,
bool  quotes 
)
private

Definition at line 182 of file FWPSetTableManager.cc.

References data(), cuy::ii, m_entries, contentValuesCheck::ss, and findQualityFiles::v.

Referenced by handleEntry().

182  {
183  std::stringstream ss;
184  ss << "[";
185  for (size_t ii = 0, ie = v.size(); ii != ie; ++ii) {
186  if (quotes)
187  ss << "\"";
188  ss << v[ii];
189  if (quotes)
190  ss << "\"";
191  if (ii + 1 != ie)
192  ss << ", ";
193  }
194  ss << "]";
195  data.value = ss.str();
196  m_entries.push_back(data);
197 }
std::vector< PSetData > & data()
std::vector< PSetData > m_entries
ii
Definition: cuy.py:589

◆ data()

std::vector<PSetData>& FWPSetTableManager::data ( )
inline

◆ entries()

std::vector<PSetData>& FWPSetTableManager::entries ( )
inlineprotected

Definition at line 144 of file FWPSetTableManager.h.

References m_entries.

Referenced by FWPathsPopup::scheduleReloadEvent().

144 { return m_entries; }
std::vector< PSetData > m_entries

◆ getTitles()

std::vector< std::string > FWPSetTableManager::getTitles ( ) const
overridevirtual

returns the title names for each column

Implements FWTableManagerBase.

Definition at line 557 of file FWPSetTableManager.cc.

References numberOfColumns().

557  {
558  std::vector<std::string> returnValue;
559  returnValue.reserve(numberOfColumns());
560  returnValue.push_back("Label");
561  returnValue.push_back("Value");
562  return returnValue;
563 }
int numberOfColumns() const override
Number of columns in the table.

◆ handleEntry()

void FWPSetTableManager::handleEntry ( const edm::Entry entry,
const std::string &  key 
)
private

Definition at line 199 of file FWPSetTableManager.cc.

References createScalarString(), createVectorString(), data(), mps_splice::entry, submitPVResolutionJobs::key, m_entries, m_modules, m_parentStack, diffTwoXMLs::ranges, contentValuesCheck::ss, and triggerMatcherToHLTDebug_cfi::tags.

Referenced by handlePSet().

199  {
200  std::stringstream ss;
202  data.label = key;
203  data.tracked = entry.isTracked();
204  data.type = entry.typeCode();
205  data.level = m_parentStack.size();
206  data.parent = m_parentStack.back();
207  data.module = m_modules.size() - 1;
208  data.type = entry.typeCode();
209  if (data.label[0] == '@')
210  data.editable = false;
211  else
212  data.editable = true;
213 
214  switch (entry.typeCode()) {
215  case 'b': {
216  data.value = entry.getBool() ? "True" : "False";
217  m_entries.push_back(data);
218  break;
219  }
220  case 'B': {
221  data.value = entry.getBool() ? "True" : "False";
222  m_entries.push_back(data);
223  break;
224  }
225  case 'i': {
226  createVectorString(data, entry.getVInt32(), false);
227  break;
228  }
229  case 'I': {
230  createScalarString(data, entry.getInt32());
231  break;
232  }
233  case 'u': {
234  createVectorString(data, entry.getVUInt32(), false);
235  break;
236  }
237  case 'U': {
238  createScalarString(data, entry.getUInt32());
239  break;
240  }
241  case 'l': {
242  createVectorString(data, entry.getVInt64(), false);
243  break;
244  }
245  case 'L': {
246  createScalarString(data, entry.getInt32());
247  break;
248  }
249  case 'x': {
250  createVectorString(data, entry.getVUInt64(), false);
251  break;
252  }
253  case 'X': {
254  createScalarString(data, entry.getUInt64());
255  break;
256  }
257  case 's': {
258  createVectorString(data, entry.getVString(), false);
259  break;
260  }
261  case 'S': {
262  createScalarString(data, entry.getString());
263  break;
264  }
265  case 'd': {
266  createVectorString(data, entry.getVDouble(), false);
267  break;
268  }
269  case 'D': {
270  createScalarString(data, entry.getDouble());
271  break;
272  }
273  case 'p': {
274  // Matevz ???
275  throw std::runtime_error("FWPSetTableManager::handleEntryGet, entry type 'p' not expected.");
276  // std::vector<edm::ParameterSet> psets = entry.getVPSet();
277  // for (size_t psi = 0, pse = psets.size(); psi != pse; ++psi)
278  // handlePSet(psets[psi]);
279  break;
280  }
281  case 'P': {
282  // Matevz ???
283  throw std::runtime_error("FWPSetTableManager::handleEntry, entry type 'P not expected.");
284  // handlePSet(entry.getPSet());
285  break;
286  }
287  case 't': {
288  data.value = entry.getInputTag().encode();
289  m_entries.push_back(data);
290  break;
291  }
292  case 'v': {
293  std::vector<std::string> tags;
294  tags.resize(entry.getVInputTag().size());
295  for (size_t iti = 0, ite = tags.size(); iti != ite; ++iti)
296  tags[iti] = entry.getVInputTag()[iti].encode();
297  createVectorString(data, tags, true);
298  break;
299  }
300  case 'g': {
301  data.value = entry.getESInputTag().encode();
302  m_entries.push_back(data);
303  break;
304  }
305  case 'G': {
306  std::vector<std::string> tags;
307  tags.resize(entry.getVESInputTag().size());
308  for (size_t iti = 0, ite = tags.size(); iti != ite; ++iti)
309  tags[iti] = entry.getVESInputTag()[iti].encode();
310  createVectorString(data, tags, true);
311  break;
312  }
313  case 'F': {
314  createScalarString(data, entry.getFileInPath().relativePath());
315  break;
316  }
317  case 'e': {
318  data.editable = false;
319  std::vector<edm::EventID> ids;
320  ids.resize(entry.getVEventID().size());
321  for (size_t iri = 0, ire = ids.size(); iri != ire; ++iri)
322  ids[iri] = entry.getVEventID()[iri];
323  createVectorString(data, ids, true);
324  break;
325  }
326  case 'E': {
327  data.editable = false;
328  createScalarString(data, entry.getEventID());
329  break;
330  }
331  case 'm': {
332  data.editable = false;
333  std::vector<edm::LuminosityBlockID> ids;
334  ids.resize(entry.getVLuminosityBlockID().size());
335  for (size_t iri = 0, ire = ids.size(); iri != ire; ++iri)
336  ids[iri] = entry.getVLuminosityBlockID()[iri];
337  createVectorString(data, ids, true);
338  break;
339  }
340  case 'M': {
341  data.editable = false;
342  createScalarString(data, entry.getLuminosityBlockID());
343  break;
344  }
345  case 'a': {
346  data.editable = false;
347  std::vector<edm::LuminosityBlockRange> ranges;
348  ranges.resize(entry.getVLuminosityBlockRange().size());
349  for (size_t iri = 0, ire = ranges.size(); iri != ire; ++iri)
350  ranges[iri] = entry.getVLuminosityBlockRange()[iri];
352  break;
353  }
354  case 'A': {
355  data.editable = false;
356  createScalarString(data, entry.getLuminosityBlockRange());
357  break;
358  }
359  case 'r': {
360  data.editable = false;
361  std::vector<edm::EventRange> ranges;
362  ranges.resize(entry.getVEventRange().size());
363  for (size_t iri = 0, ire = ranges.size(); iri != ire; ++iri)
364  ranges[iri] = entry.getVEventRange()[iri];
366  break;
367  }
368  case 'R': {
369  data.editable = false;
370  createScalarString(data, entry.getEventRange());
371  break;
372  }
373  default: {
374  break;
375  }
376  }
377 }
std::vector< size_t > m_parentStack
void createVectorString(FWPSetTableManager::PSetData &data, const T &v, bool quotes)
std::vector< ModuleInfo > m_modules
std::vector< PSetData > & data()
std::vector< PSetData > m_entries
key
prepare the HTCondor submission files and eventually submit them
string ranges
Definition: diffTwoXMLs.py:79
void createScalarString(PSetData &data, T v)

◆ handlePSet()

void FWPSetTableManager::handlePSet ( edm::ParameterSet psp)
private

Definition at line 157 of file FWPSetTableManager.cc.

References MillePedeFileConverter_cfg::e, handleEntry(), handlePSetEntry(), handleVPSetEntry(), mps_fire::i, edm::ParameterSet::psetTable(), edm::ParameterSet::tbl(), and edm::ParameterSet::vpsetTable().

Referenced by handlePSetEntry(), handleVPSetEntry(), and updateSchedule().

157  {
158  edm::ParameterSet &ps = *psp;
159 
160  typedef edm::ParameterSet::table::const_iterator TIterator;
161  for (TIterator i = ps.tbl().begin(), e = ps.tbl().end(); i != e; ++i)
162  handleEntry(i->second, i->first);
163 
164  typedef edm::ParameterSet::psettable::const_iterator PSIterator;
165  for (PSIterator i = ps.psetTable().begin(), e = ps.psetTable().end(); i != e; ++i)
166  handlePSetEntry(const_cast<edm::ParameterSetEntry &>(i->second), i->first);
167 
168  typedef edm::ParameterSet::vpsettable::const_iterator VPSIterator;
169  for (VPSIterator i = ps.vpsetTable().begin(), e = ps.vpsetTable().end(); i != e; ++i)
170  handleVPSetEntry(const_cast<edm::VParameterSetEntry &>(i->second), i->first);
171 }
table const & tbl() const
Definition: ParameterSet.h:234
void handlePSetEntry(edm::ParameterSetEntry &entry, const std::string &key)
void handleVPSetEntry(edm::VParameterSetEntry &entry, const std::string &key)
void handleEntry(const edm::Entry &entry, const std::string &key)
vpsettable const & vpsetTable() const
Definition: ParameterSet.h:240
psettable const & psetTable() const
Definition: ParameterSet.h:237

◆ handlePSetEntry()

void FWPSetTableManager::handlePSetEntry ( edm::ParameterSetEntry entry,
const std::string &  key 
)
private

Definition at line 104 of file FWPSetTableManager.cc.

References data(), mps_splice::entry, handlePSet(), submitPVResolutionJobs::key, m_entries, m_modules, m_parentStack, and m_paths.

Referenced by handlePSet().

104  {
105  PSetData data;
106  data.label = key;
107  data.tracked = entry.isTracked();
108  data.level = m_parentStack.size();
109  data.parent = m_parentStack.back();
110  data.type = 'P';
111  data.module = m_modules.size() - 1;
112  data.path = m_paths.size() - 1;
113  data.pset = &entry.psetForUpdate();
114  data.editable = false;
115  m_parentStack.push_back(m_entries.size());
116  m_entries.push_back(data);
117 
118  handlePSet(data.pset);
119  m_parentStack.pop_back();
120 }
std::vector< PathInfo > m_paths
std::vector< size_t > m_parentStack
std::vector< ModuleInfo > m_modules
std::vector< PSetData > & data()
std::vector< PSetData > m_entries
key
prepare the HTCondor submission files and eventually submit them
void handlePSet(edm::ParameterSet *psp)

◆ handleVPSetEntry()

void FWPSetTableManager::handleVPSetEntry ( edm::VParameterSetEntry entry,
const std::string &  key 
)
private

Definition at line 122 of file FWPSetTableManager.cc.

References data(), MillePedeFileConverter_cfg::e, FWPSetTableManager::PSetData::editable, mps_splice::entry, handlePSet(), mps_fire::i, submitPVResolutionJobs::key, FWPSetTableManager::PSetData::label, FWPSetTableManager::PSetData::level, m_entries, m_modules, m_parentStack, m_paths, FWPSetTableManager::PSetData::module, FWPSetTableManager::PSetData::parent, FWPSetTableManager::PSetData::path, FWPSetTableManager::PSetData::pset, contentValuesCheck::ss, and FWPSetTableManager::PSetData::tracked.

Referenced by handlePSet().

122  {
123  PSetData data;
124  data.label = key;
125  data.tracked = entry.isTracked();
126  data.level = m_parentStack.size();
127  data.parent = m_parentStack.back();
128  data.type = 'p';
129  data.module = m_modules.size() - 1;
130  data.path = m_paths.size() - 1;
131  data.editable = false;
132  m_parentStack.push_back(m_entries.size());
133  m_entries.push_back(data);
134 
135  std::stringstream ss;
136 
137  for (size_t i = 0, e = entry.vpset().size(); i != e; ++i) {
138  ss.str("");
139  ss << key << "[" << i << "]";
140  PSetData vdata;
141  vdata.label = ss.str();
142  vdata.tracked = entry.isTracked();
143  vdata.level = m_parentStack.size();
144  vdata.parent = m_parentStack.back();
145  vdata.module = m_modules.size() - 1;
146  vdata.path = m_paths.size() - 1;
147  vdata.editable = false;
148  vdata.pset = &entry.vpsetForUpdate()[i];
149  m_parentStack.push_back(m_entries.size());
150  m_entries.push_back(vdata);
151  handlePSet(&entry.vpsetForUpdate()[i]);
152  m_parentStack.pop_back();
153  }
154  m_parentStack.pop_back();
155 }
std::vector< PathInfo > m_paths
std::vector< size_t > m_parentStack
std::vector< ModuleInfo > m_modules
std::vector< PSetData > & data()
std::vector< PSetData > m_entries
key
prepare the HTCondor submission files and eventually submit them
void handlePSet(edm::ParameterSet *psp)

◆ implSort()

void FWPSetTableManager::implSort ( int  iCol,
bool  iSortOrder 
)
overridevirtual

Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.

Implements FWTableManagerBase.

Definition at line 617 of file FWPSetTableManager.cc.

Referenced by update().

617 {}

◆ maxWidthForColumns()

std::vector< unsigned int > FWPSetTableManager::maxWidthForColumns ( ) const
overridevirtual

for each column in the table this returns the present maximum width for that column

Reimplemented from FWTableManagerBase.

Definition at line 606 of file FWPSetTableManager.cc.

References FWTableManagerBase::cellHeight(), m_editor, FWTableManagerBase::maxWidthForColumns(), and ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::ww.

606  {
607  std::vector<unsigned int> ww = FWTableManagerBase::maxWidthForColumns();
608  if (ww.size() > 1 && ww[1] > 0) {
609  // printf("dim W %d \n",ww[1]);
610  // printf("dim H %d \n",cellHeight());
611  if (m_editor)
612  m_editor->MoveResize(m_editor->GetX(), m_editor->GetY(), ww[1], cellHeight());
613  }
614  return ww;
615 }
virtual std::vector< unsigned int > maxWidthForColumns() const
for each column in the table this returns the present maximum width for that column ...
FWPSetCellEditor * m_editor
virtual unsigned int cellHeight() const
require all cells to be the same height

◆ modules()

std::vector<ModuleInfo>& FWPSetTableManager::modules ( )
inlineprotected

Definition at line 143 of file FWPSetTableManager.h.

References m_modules.

Referenced by FWPathsPopup::scheduleReloadEvent().

143 { return m_modules; }
std::vector< ModuleInfo > m_modules

◆ numberOfColumns()

int FWPSetTableManager::numberOfColumns ( ) const
overridevirtual

Number of columns in the table.

Implements FWTableManagerBase.

Definition at line 575 of file FWPSetTableManager.cc.

Referenced by getTitles().

575 { return 2; }

◆ numberOfRows()

int FWPSetTableManager::numberOfRows ( ) const
overridevirtual

Number of rows in the table.

Implements FWTableManagerBase.

Definition at line 573 of file FWPSetTableManager.cc.

References m_row_to_index.

573 { return m_row_to_index.size(); }
std::vector< int > m_row_to_index

◆ operator=()

const FWPSetTableManager& FWPSetTableManager::operator= ( const FWPSetTableManager )
delete

◆ recalculateVisibility()

void FWPSetTableManager::recalculateVisibility ( )
private

Definition at line 817 of file FWPSetTableManager.cc.

References data(), MillePedeFileConverter_cfg::e, mps_fire::i, m_entries, m_filter, and m_row_to_index.

Referenced by FWPSetTableManager(), setExpanded(), updateFilter(), and updateSchedule().

817  {
818  m_row_to_index.clear();
819 
820  // Decide about visibility.
821  // * If the items are toplevel and they match the filter, they get shown
822  // in any case.
823  // * If the item or any of its children match the filter, the item
824  // is visible.
825  // * If the filter is empty and the parent is expanded.
826  for (size_t i = 0, e = m_entries.size(); i != e; ++i) {
827  PSetData &data = m_entries[i];
828  if (data.parent == ((size_t)-1)) {
829  data.visible = data.childMatches || data.matches || m_filter.empty();
830  } else {
831  if (m_filter.empty()) {
832  data.visible = m_entries[data.parent].expandedUser && m_entries[data.parent].visible;
833  } else {
834  if (data.level < 2)
835  data.visible = m_entries[data.parent].expandedFilter && m_entries[data.parent].visible &&
836  (data.matches || data.childMatches);
837  else
838  data.visible = m_entries[data.parent].expandedFilter && m_entries[data.parent].visible;
839  }
840  }
841  }
842 
843  // Put in the index only the entries which are visible.
844  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
845  if (m_entries[i].visible)
846  m_row_to_index.push_back(i);
847 }
std::vector< PSetData > & data()
std::vector< int > m_row_to_index
std::vector< PSetData > m_entries

◆ rowIsSelected()

bool FWPSetTableManager::rowIsSelected ( int  row) const
virtual

Definition at line 569 of file FWPSetTableManager.cc.

References m_selectedRow.

569 { return m_selectedRow == row; }

◆ rowToIndex()

std::vector<int>& FWPSetTableManager::rowToIndex ( )
inline

Definition at line 107 of file FWPSetTableManager.h.

References m_row_to_index.

Referenced by FWPathsPopup::cellClicked(), and setExpanded().

107 { return m_row_to_index; }
std::vector< int > m_row_to_index

◆ selectedColumn()

int FWPSetTableManager::selectedColumn ( ) const

Definition at line 567 of file FWPSetTableManager.cc.

References m_selectedColumn.

Referenced by FWPathsPopup::cellClicked().

567 { return m_selectedColumn; }

◆ selectedRow()

int FWPSetTableManager::selectedRow ( ) const

Definition at line 565 of file FWPSetTableManager.cc.

References m_selectedRow.

Referenced by FWPathsPopup::cellClicked().

565 { return m_selectedRow; }

◆ setCellValueEditor()

void FWPSetTableManager::setCellValueEditor ( FWPSetCellEditor editor)
private

Definition at line 500 of file FWPSetTableManager.cc.

References m_editor, m_renderer, and FWTextTreeCellRenderer::setCellEditor().

Referenced by FWPathsPopup::FWPathsPopup().

500  {
501  m_editor = editor;
503 }
FWTextTreeCellRenderer m_renderer
virtual void setCellEditor(TGTextEntry *editor)
FWPSetCellEditor * m_editor

◆ setExpanded()

void FWPSetTableManager::setExpanded ( int  row)
protected

Definition at line 620 of file FWPSetTableManager.cc.

References data(), FWTableManagerBase::dataChanged(), m_entries, m_filter, recalculateVisibility(), rowToIndex(), and FWTableManagerBase::visualPropertiesChanged().

Referenced by FWPathsPopup::cellClicked().

620  {
621  if (row == -1)
622  return;
623 
624  int index = rowToIndex()[row];
625  PSetData &data = m_entries[index];
626 
627  if (m_filter.empty() == false && data.childMatches == false)
628  return;
629 
630  if (m_filter.empty())
631  data.expandedUser = !data.expandedUser;
632  else
633  data.expandedFilter = !data.expandedFilter;
634 
636  dataChanged();
638 }
std::vector< int > & rowToIndex()
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
std::vector< PSetData > & data()
std::vector< PSetData > m_entries
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...

◆ setSelection()

void FWPSetTableManager::setSelection ( int  row,
int  column,
int  mask 
)
protected

Definition at line 577 of file FWPSetTableManager.cc.

References FWTableManagerBase::cellHeight(), data(), m_editor, m_entries, m_row_to_index, m_selectedColumn, m_selectedRow, and FWTableManagerBase::visualPropertiesChanged().

Referenced by applyEditor(), cancelEditor(), FWPathsPopup::cellClicked(), FWPathsPopup::HandleKey(), and FWPathsPopup::updateFilterString().

577  {
578  // printf("set selection %d %d mode %d\n", iRow, iColumn, mask);
579 
580  // Nothing changes if we clicked selected
581  // twice the same cell.
582  if (iRow == m_selectedRow && iColumn == m_selectedColumn)
583  return;
584 
585  // Otherwise update the selection information
586  // and notify observers.
587  m_selectedRow = iRow;
588  m_selectedColumn = iColumn;
589  if (iColumn == 1 && iRow > 0) {
590  int unsortedRow = m_row_to_index[iRow];
591  const PSetData &data = m_entries[unsortedRow];
592  if (m_editor && data.editable) {
593  m_editor->MoveResize(0, cellHeight() * iRow, m_editor->GetWidth(), m_editor->GetHeight());
594  m_editor->MapWindow();
595  m_editor->SetText(data.value.c_str());
596  m_editor->SetFocus();
597  m_editor->SetCursorPosition(data.value.size() - 1);
598  }
599  } else {
600  if (m_editor)
601  m_editor->UnmapWindow();
602  }
604 }
std::vector< PSetData > & data()
std::vector< int > m_row_to_index
std::vector< PSetData > m_entries
FWPSetCellEditor * m_editor
virtual unsigned int cellHeight() const
require all cells to be the same height
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...

◆ title()

const std::string FWPSetTableManager::title ( ) const
virtual

Definition at line 555 of file FWPSetTableManager.cc.

555 { return "Modules & their parameters"; }

◆ unsortedRowNumber()

int FWPSetTableManager::unsortedRowNumber ( int  iSortedRowNumber) const
overridevirtual

when passed the index to the sorted order of the rows it returns the original row number from the underlying data

Implements FWTableManagerBase.

Definition at line 571 of file FWPSetTableManager.cc.

571 { return unsorted; }

◆ update()

void FWPSetTableManager::update ( std::vector< PathUpdate > &  pathUpdates)
protected

Update the status of a given path. This is the information that changes on event by event basis.

Definition at line 466 of file FWPSetTableManager.cc.

References fwLog, implSort(), fwlog::kError, m_modules, m_pathIndex, m_paths, hlt_dqm_clientPB-live_cfg::me, FWPSetTableManager::PathInfo::moduleEnd, FWPSetTableManager::PathInfo::moduleStart, TriggerAnalyzer::passed, FWPSetTableManager::ModuleInfo::passed, FWPSetTableManager::PathInfo::passed, and pi.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), progressbar.ProgressBar::finish(), MatrixUtil.Steps::overwrite(), and FWPathsPopup::postEvent().

466  {
467  // Reset all the path / module status information, so that
468  // by default paths and modules are considered "not passed".
469  for (size_t pi = 0, pe = m_paths.size(); pi != pe; ++pi)
470  m_paths[pi].passed = false;
471  for (size_t mi = 0, me = m_modules.size(); mi != me; ++mi)
472  m_modules[mi].passed = false;
473 
474  // Update whether or not a given path / module passed selection.
475  for (size_t pui = 0, pue = pathUpdates.size(); pui != pue; ++pui) {
476  PathUpdate &update = pathUpdates[pui];
477  std::map<std::string, size_t>::const_iterator index = m_pathIndex.find(update.pathName);
478  if (index == m_pathIndex.end()) {
479  fwLog(fwlog::kError) << "Path " << update.pathName << "cannot be found!" << std::endl;
480  continue;
481  }
482  PathInfo &pathInfo = m_paths[index->second];
483  pathInfo.passed = update.passed;
484 
485  for (size_t mi = pathInfo.moduleStart, me = pathInfo.moduleEnd; mi != me; ++mi) {
486  ModuleInfo &moduleInfo = m_modules[mi];
487  moduleInfo.passed = update.passed || ((mi - pathInfo.moduleStart) < update.choiceMaker);
488  }
489  }
490 
491  implSort(-1, true);
492 }
std::vector< PathInfo > m_paths
void implSort(int, bool) override
Called by &#39;sort&#39; method to actually handle the sorting of the rows. Arguments are the same as &#39;sort&#39;...
std::vector< ModuleInfo > m_modules
const Double_t pi
std::map< std::string, size_t > m_pathIndex
#define fwLog(_level_)
Definition: fwLog.h:45
void update(std::vector< PathUpdate > &pathUpdates)

◆ updateFilter()

void FWPSetTableManager::updateFilter ( const char *  filter)
virtual

Definition at line 742 of file FWPSetTableManager.cc.

References data(), FWTableManagerBase::dataChanged(), MillePedeFileConverter_cfg::e, ALCARECOTkAlBeamHalo_cff::filter, mps_fire::i, m_entries, m_filter, pi, recalculateVisibility(), and svgfig::stack.

Referenced by FWPathsPopup::updateFilterString().

742  {
743  m_filter = filter;
744 
745  if (m_filter.empty()) {
746  // collapse entries when filter is removed
747  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
748  m_entries[i].expandedFilter = false;
749  } else {
750  // Decide whether or not items match the filter.
751  for (size_t i = 0, e = m_entries.size(); i != e; ++i) {
752  PSetData &data = m_entries[i];
753 
754  // First of all decide whether or not we match
755  // the filter.
756  if (strstr(data.label.c_str(), m_filter.c_str()) || strstr(data.value.c_str(), m_filter.c_str()))
757  data.matches = true;
758  else
759  data.matches = false;
760  }
761 
762  // We reset whether or not a given parent has children that match the
763  // filter, and we recompute the whole information by checking all the
764  // children.
765  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
766  m_entries[i].childMatches = false;
767 
768  std::vector<int> stack;
769  int previousLevel = 0;
770  for (size_t i = 0, e = m_entries.size(); i != e; ++i) {
771  PSetData &data = m_entries[i];
772  // Top level.
773  if (data.parent == (size_t)-1) {
774  previousLevel = 0;
775  // std::cout << "reset stack for top level " << data.label << std::endl;
776  stack.clear();
777  continue;
778  }
779  // If the level is greater than the previous one,
780  // it means we are among the children of the
781  // previous level, hence we push the parent to
782  // the stack.
783  // If the level is not greater than the previous
784  // one it means we have popped out n levels of
785  // parents, where N is the difference between the
786  // new and the old level. In this case we
787  // pop up N parents from the stack.
788  if (data.level > previousLevel)
789  stack.push_back(data.parent);
790  else
791  for (size_t pi = 0, pe = previousLevel - data.level; pi != pe; ++pi)
792  stack.pop_back();
793 
794  if (data.matches && m_entries[stack.back()].childMatches == false) {
795  // printf("match for %s with level %d\n",data.label.c_str(), data.level );
796  for (size_t pi = 0, pe = stack.size(); pi != pe; ++pi) {
797  // printf("set child match to parent %s with level %d \n",m_entries[stack[pi]].label.c_str(), m_entries[stack[pi]].level);
798  m_entries[stack[pi]].childMatches = true;
799  }
800  }
801 
802  previousLevel = data.level;
803  }
804 
805  // expand to matching children
806  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
807  m_entries[i].expandedFilter = m_entries[i].childMatches;
808  }
809 
811 
812  dataChanged();
813 } // updateFilter()
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
const Double_t pi
std::vector< PSetData > & data()
std::vector< PSetData > m_entries
stack
Definition: svgfig.py:559

◆ updateSchedule()

void FWPSetTableManager::updateSchedule ( const edm::ScheduleInfo info)
protected

Definition at line 383 of file FWPSetTableManager.cc.

References cms::cuda::assert(), FWPSetTableManager::ModuleInfo::current_pset, FWPSetTableManager::ModuleInfo::dirty, MillePedeFileConverter_cfg::e, FWPSetTableManager::PSetData::editable, FWPSetTableManager::ModuleInfo::entry, FWPSetTableManager::PathInfo::entryId, handlePSet(), mps_fire::i, info(), FWPSetTableManager::PSetData::label, FWPSetTableManager::PSetData::level, m_availablePaths, m_entries, m_filter, m_modules, m_parentStack, m_pathIndex, m_paths, hlt_dqm_clientPB-live_cfg::me, FWPSetTableManager::PSetData::module, FWPSetTableManager::PathInfo::moduleStart, FWPSetTableManager::ModuleInfo::orig_pset, FWPSetTableManager::PSetData::parent, FWPSetTableManager::ModuleInfo::passed, FWPSetTableManager::PathInfo::passed, FWPSetTableManager::PSetData::path, FWPSetTableManager::ModuleInfo::path, hltMonBTagIPClient_cfi::pathName, FWPSetTableManager::PSetData::pset, recalculateVisibility(), AlCaHLTBitMon_QueryRunRegistry::string, edm::ParameterSet::tbl(), and FWPSetTableManager::PSetData::value.

Referenced by FWPathsPopup::postEvent().

383  {
384  if (!m_entries.empty())
385  return;
386  // Execute only once since the schedule itself
387  // cannot be altered.
388  assert(m_availablePaths.empty());
389  info->availablePaths(m_availablePaths);
390 
391  for (size_t i = 0, e = m_availablePaths.size(); i != e; ++i) {
392  PSetData pathEntry;
394  pathEntry.label = pathName;
395  m_pathIndex.insert(std::make_pair(pathName, m_paths.size()));
396 
397  pathEntry.value = "Path";
398  pathEntry.level = 0;
399  pathEntry.parent = -1;
400  pathEntry.path = i;
401  pathEntry.editable = false;
402 
403  PathInfo pathInfo;
404  pathInfo.entryId = m_entries.size();
405  pathInfo.passed = false;
406  pathInfo.moduleStart = m_modules.size();
407  m_paths.push_back(pathInfo);
408 
409  m_parentStack.push_back(m_entries.size());
410  m_entries.push_back(pathEntry);
411 
412  std::vector<std::string> pathModules;
413  info->modulesInPath(pathName, pathModules);
414 
415  for (size_t mi = 0, me = pathModules.size(); mi != me; ++mi) {
416  PSetData moduleEntry;
417 
418  const edm::ParameterSet *ps = info->parametersForModule(pathModules[mi]);
419 
420  const edm::ParameterSet::table &pst = ps->tbl();
421  const edm::ParameterSet::table::const_iterator ti = pst.find("@module_edm_type");
422  if (ti == pst.end())
423  moduleEntry.value = "Unknown module name";
424  else
425  moduleEntry.value = ti->second.getString();
426 
427  moduleEntry.label = pathModules[mi];
428  moduleEntry.parent = m_parentStack.back();
429  moduleEntry.level = m_parentStack.size();
430  moduleEntry.module = mi;
431  moduleEntry.path = i;
432  moduleEntry.editable = false;
433 
434  ModuleInfo moduleInfo;
435  moduleInfo.path = m_paths.size() - 1;
436  moduleInfo.entry = m_entries.size();
437  moduleInfo.passed = false;
438  moduleInfo.dirty = false;
439  moduleInfo.orig_pset = new edm::ParameterSet(*ps);
440  moduleInfo.current_pset = new edm::ParameterSet(*ps);
441  m_modules.push_back(moduleInfo);
442 
443  moduleEntry.pset = moduleInfo.current_pset;
444 
445  m_parentStack.push_back(m_entries.size());
446  m_entries.push_back(moduleEntry);
447  handlePSet(moduleEntry.pset);
448  m_parentStack.pop_back();
449  }
450  m_paths.back().moduleEnd = m_modules.size();
451  m_parentStack.pop_back();
452  }
453 
454  // Nothing is expanded by default.
455  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
456  m_entries[i].expandedUser = false;
457 
458  m_filter = "";
459 
461 } //updateSchedule
std::vector< std::string > m_availablePaths
static const TGPicture * info(bool iBackgroundIsBlack)
std::vector< PathInfo > m_paths
table const & tbl() const
Definition: ParameterSet.h:234
std::vector< size_t > m_parentStack
assert(be >=bs)
std::vector< ModuleInfo > m_modules
std::map< std::string, size_t > m_pathIndex
std::vector< PSetData > m_entries
void handlePSet(edm::ParameterSet *psp)
std::map< std::string, Entry, std::less<> > table
Definition: ParameterSet.h:233

Friends And Related Function Documentation

◆ FWPathsPopup

friend class FWPathsPopup
friend

Definition at line 34 of file FWPSetTableManager.h.

Member Data Documentation

◆ m_availablePaths

std::vector<std::string> FWPSetTableManager::m_availablePaths
private

Definition at line 185 of file FWPSetTableManager.h.

Referenced by updateSchedule().

◆ m_editor

FWPSetCellEditor* FWPSetTableManager::m_editor
private

◆ m_entries

std::vector<PSetData> FWPSetTableManager::m_entries
private

◆ m_filter

std::string FWPSetTableManager::m_filter
private

◆ m_modules

std::vector<ModuleInfo> FWPSetTableManager::m_modules
private

◆ m_parentStack

std::vector<size_t> FWPSetTableManager::m_parentStack
private

◆ m_pathIndex

std::map<std::string, size_t> FWPSetTableManager::m_pathIndex
private

Definition at line 178 of file FWPSetTableManager.h.

Referenced by update(), and updateSchedule().

◆ m_paths

std::vector<PathInfo> FWPSetTableManager::m_paths
private

Index in m_entries where to find paths

Definition at line 176 of file FWPSetTableManager.h.

Referenced by cellRenderer(), handlePSetEntry(), handleVPSetEntry(), update(), and updateSchedule().

◆ m_renderer

FWTextTreeCellRenderer FWPSetTableManager::m_renderer
mutableprivate

Definition at line 187 of file FWPSetTableManager.h.

Referenced by cellRenderer(), FWPSetTableManager(), and setCellValueEditor().

◆ m_row_to_index

std::vector<int> FWPSetTableManager::m_row_to_index
private

◆ m_selectedColumn

int FWPSetTableManager::m_selectedColumn
private

Definition at line 182 of file FWPSetTableManager.h.

Referenced by applyEditor(), cellRenderer(), selectedColumn(), and setSelection().

◆ m_selectedRow

int FWPSetTableManager::m_selectedRow
private