CMS 3D CMS Logo

FWPSetTableManager.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: FWInterface
4 // Class : FWPSetTableManager
5 //
6 // Implementation:
7 // [Notes on implementation]
8 //
9 // Original Author:
10 // Created: Mon Feb 28 17:06:54 CET 2011
11 //
12 
13 #include <map>
14 #include <stdexcept>
15 
21 
25 //
26 // constants, enums and typedefs
27 //
28 
29 //
30 // static data member definitions
31 //
32 
33 // FIXME: copied from Entry.cc should find a way to use the original
34 // table.
35 struct TypeTrans {
36  TypeTrans();
37 
38  typedef std::vector<std::string> CodeMap;
40  std::map<std::string, char> type2Code_;
41 };
42 
44  table_['b'] = "vBool";
45  table_['B'] = "bool";
46  table_['i'] = "vint32";
47  table_['I'] = "int32";
48  table_['u'] = "vuint32";
49  table_['U'] = "uint32";
50  table_['l'] = "vint64";
51  table_['L'] = "int64";
52  table_['x'] = "vuint64";
53  table_['X'] = "uint64";
54  table_['s'] = "vstring";
55  table_['S'] = "string";
56  table_['d'] = "vdouble";
57  table_['D'] = "double";
58  table_['p'] = "vPSet";
59  table_['P'] = "PSet";
60  table_['T'] = "path";
61  table_['F'] = "FileInPath";
62  table_['t'] = "InputTag";
63  table_['v'] = "VInputTag";
64  table_['g'] = "ESInputTag";
65  table_['G'] = "VESInputTag";
66  table_['e'] = "VEventID";
67  table_['E'] = "EventID";
68  table_['m'] = "VLuminosityBlockID";
69  table_['M'] = "LuminosityBlockID";
70  table_['a'] = "VLuminosityBlockRange";
71  table_['A'] = "LuminosityBlockRange";
72  table_['r'] = "VEventRange";
73  table_['R'] = "EventRange";
74 
75  for (CodeMap::const_iterator itCode = table_.begin(), itCodeEnd = table_.end(); itCode != itCodeEnd; ++itCode) {
76  type2Code_[*itCode] = (itCode - table_.begin());
77  }
78 }
79 
81 
82 //
83 // constructors and destructor
84 //
85 
88  hc->SetForeground(0xdddddd);
89 
91 
94 }
95 
97 
98 //==============================================================================
99 //==============================================================================
100 //========== IMPORT CMSSW CONFIG TO TABLE ======================================
101 //==============================================================================
102 //==============================================================================
103 
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 }
121 
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 }
156 
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 }
172 
173 template <class T>
175  std::stringstream ss;
176  ss << v;
177  data.value = ss.str();
178  m_entries.push_back(data);
179 }
180 
181 template <typename T>
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 }
198 
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 }
378 
379 /* the actual structure of the model will not change, only
380  its contents, because of the way CMSSW is designed,
381  hence this method only needs to be called once.
382  */
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
462 
466 void FWPSetTableManager::update(std::vector<PathUpdate> &pathUpdates) {
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 }
493 
494 //==============================================================================
495 //==============================================================================
496 //=============== CELL EDITOR ACTIONS ==========================================
497 //==============================================================================
498 //==============================================================================
499 
501  m_editor = editor;
503 }
504 
507  if (!m_editor)
508  return;
509 
510  // printf("FWPSetTableManager::cancelEditor() \n");
511  setSelection(-1, -1, 0);
512  m_editor->UnmapWindow();
513 }
514 
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 }
549 
550 //==============================================================================
551 //==============================================================================
552 //======== TABLE UI MNG (virutals FWTableManagerBase virtuals, etc.) =========
553 //==============================================================================
554 //==============================================================================
555 const std::string FWPSetTableManager::title() const { return "Modules & their parameters"; }
556 
557 std::vector<std::string> FWPSetTableManager::getTitles() const {
558  std::vector<std::string> returnValue;
559  returnValue.reserve(numberOfColumns());
560  returnValue.push_back("Label");
561  returnValue.push_back("Value");
562  return returnValue;
563 }
564 
566 
568 
569 bool FWPSetTableManager::rowIsSelected(int row) const { return m_selectedRow == row; }
570 
571 int FWPSetTableManager::unsortedRowNumber(int unsorted) const { return unsorted; }
572 
573 int FWPSetTableManager::numberOfRows() const { return m_row_to_index.size(); }
574 
575 int FWPSetTableManager::numberOfColumns() const { return 2; }
576 
577 void FWPSetTableManager::setSelection(int iRow, int iColumn, int mask) {
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 }
605 
606 std::vector<unsigned int> FWPSetTableManager::maxWidthForColumns() const {
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 }
616 
618 //______________________________________________________________________________
619 
621  if (row == -1)
622  return;
623 
624  int index = rowToIndex()[row];
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 }
639 
640 //______________________________________________________________________________
641 
642 FWTableCellRendererBase *FWPSetTableManager::cellRenderer(int iSortedRowNumber, int iCol) const {
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()
739 
740 //______________________________________________________________________________
741 
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()
814 
815 //______________________________________________________________________________
816 
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 }
FWPSetTableManager::PathInfo::passed
bool passed
Definition: FWPSetTableManager.h:155
diffTwoXMLs.ranges
string ranges
Definition: diffTwoXMLs.py:79
fireworks::boldGC
const TGGC & boldGC()
Definition: GlobalContexts.cc:11
TypeTrans::table_
CodeMap table_
Definition: FWPSetTableManager.cc:39
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:355
FWPSetTableManager::implSort
void implSort(int, bool) override
Called by 'sort' method to actually handle the sorting of the rows. Arguments are the same as 'sort'.
Definition: FWPSetTableManager.cc:617
FWPSetTableManager::ModuleInfo::path
size_t path
Definition: FWPSetTableManager.h:115
FWPSetTableManager::handleVPSetEntry
void handleVPSetEntry(edm::VParameterSetEntry &entry, const std::string &key)
Definition: FWPSetTableManager.cc:122
FWPSetTableManager::title
virtual const std::string title() const
Definition: FWPSetTableManager.cc:555
FWPSetTableManager::getTitles
std::vector< std::string > getTitles() const override
returns the title names for each column
Definition: FWPSetTableManager.cc:557
FWPSetTableManager.h
ScheduleInfo.h
FWPSetTableManager::m_filter
std::string m_filter
Definition: FWPSetTableManager.h:184
FWPSetTableManager::handleEntry
void handleEntry(const edm::Entry &entry, const std::string &key)
Definition: FWPSetTableManager.cc:199
FWPSetTableManager::setCellValueEditor
void setCellValueEditor(FWPSetCellEditor *editor)
Definition: FWPSetTableManager.cc:500
mps_splice.entry
entry
Definition: mps_splice.py:68
TypeTrans::CodeMap
std::vector< std::string > CodeMap
Definition: FWPSetTableManager.cc:38
FWPSetTableManager::handlePSetEntry
void handlePSetEntry(edm::ParameterSetEntry &entry, const std::string &key)
Definition: FWPSetTableManager.cc:104
FWPSetTableManager::ModuleInfo::current_pset
edm::ParameterSet * current_pset
Definition: FWPSetTableManager.h:124
FWPSetTableManager::ModuleInfo::passed
bool passed
Definition: FWPSetTableManager.h:117
FWPSetCellEditor::apply
bool apply(FWPSetTableManager::PSetData &data, FWPSetTableManager::PSetData &parent)
Definition: FWPSetCellEditor.cc:219
fireworks::italicGC
const TGGC & italicGC()
Definition: GlobalContexts.cc:49
FWPSetTableManager::m_modules
std::vector< ModuleInfo > m_modules
Definition: FWPSetTableManager.h:178
FWPSetTableManager::recalculateVisibility
void recalculateVisibility()
Definition: FWPSetTableManager.cc:817
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:152
FWPSetTableManager::data
std::vector< PSetData > & data()
Definition: FWPSetTableManager.h:104
edm::ParameterSet::table
std::map< std::string, Entry > table
Definition: ParameterSet.h:221
FWPSetTableManager::numberOfRows
int numberOfRows() const override
Number of rows in the table.
Definition: FWPSetTableManager.cc:573
edm::ParameterSet::tbl
table const & tbl() const
Definition: ParameterSet.h:222
findQualityFiles.v
v
Definition: findQualityFiles.py:179
FWTextTreeCellRenderer::showEditor
virtual void showEditor(bool value)
Definition: FWTextTreeCellRenderer.h:61
FWPSetTableManager::selectedRow
int selectedRow() const
Definition: FWPSetTableManager.cc:565
FWPSetTableManager::handlePSet
void handlePSet(edm::ParameterSet *psp)
Definition: FWPSetTableManager.cc:157
FWTableManagerBase::visualPropertiesChanged
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e....
Definition: FWTableManagerBase.cc:70
FWPSetTableManager::FWPSetTableManager
FWPSetTableManager()
Definition: FWPSetTableManager.cc:86
electronCompare.red
red
Definition: electronCompare.py:135
FWTextTableCellRenderer::setHighlightContext
void setHighlightContext(const TGGC *context)
Definition: FWTextTableCellRenderer.h:58
edm::ParameterSet::psetTable
psettable const & psetTable() const
Definition: ParameterSet.h:225
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
FWPSetTableManager::update
void update(std::vector< PathUpdate > &pathUpdates)
Definition: FWPSetTableManager.cc:466
FWPSetTableManager::m_editor
FWPSetCellEditor * m_editor
Definition: FWPSetTableManager.h:185
FWTextTableCellRenderer::getDefaultHighlightGC
static const TGGC & getDefaultHighlightGC()
Definition: FWTextTableCellRenderer.cc:133
hltMonBTagIPClient_cfi.pathName
pathName
Definition: hltMonBTagIPClient_cfi.py:5
FWTextTreeCellRenderer::iconWidth
static int iconWidth()
Definition: FWTextTreeCellRenderer.h:57
FWPSetTableManager::m_renderer
FWTextTreeCellRenderer m_renderer
Definition: FWPSetTableManager.h:188
FWPSetTableManager::updateSchedule
void updateSchedule(const edm::ScheduleInfo *info)
Definition: FWPSetTableManager.cc:383
summarizeEdmComparisonLogfiles.success
success
Definition: summarizeEdmComparisonLogfiles.py:115
FWPSetTableManager::numberOfColumns
int numberOfColumns() const override
Number of columns in the table.
Definition: FWPSetTableManager.cc:575
FWPSetTableManager::PSetData
Definition: FWPSetTableManager.h:38
FWPSetTableManager::m_selectedRow
int m_selectedRow
Definition: FWPSetTableManager.h:182
FWPSetTableManager::createVectorString
void createVectorString(FWPSetTableManager::PSetData &data, const T &v, bool quotes)
Definition: FWPSetTableManager.cc:182
ALCARECOTkAlBeamHalo_cff.filter
filter
Definition: ALCARECOTkAlBeamHalo_cff.py:27
FWPSetTableManager::PSetData::value
std::string value
Definition: FWPSetTableManager.h:62
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWPSetTableManager::unsortedRowNumber
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 und...
Definition: FWPSetTableManager.cc:571
FWTextTableCellRenderer::setGraphicsContext
void setGraphicsContext(const TGGC *iContext)
Definition: FWTextTableCellRenderer.h:57
svgfig.stack
stack
Definition: svgfig.py:559
FWPSetTableManager::PSetData::editable
bool editable
Definition: FWPSetTableManager.h:78
TypeTrans
Definition: FWPSetTableManager.cc:35
FWTableManagerBase::dataChanged
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes.
Definition: FWTableManagerBase.cc:63
edm::ParameterSet
Definition: ParameterSet.h:36
FWPSetTableManager::rowIsSelected
virtual bool rowIsSelected(int row) const
Definition: FWPSetTableManager.cc:569
FWPSetTableManager::maxWidthForColumns
std::vector< unsigned int > maxWidthForColumns() const override
for each column in the table this returns the present maximum width for that column
Definition: FWPSetTableManager.cc:606
FWPSetTableManager::m_availablePaths
std::vector< std::string > m_availablePaths
Definition: FWPSetTableManager.h:186
FWPSetTableManager::PathInfo
Definition: FWPSetTableManager.h:149
FWTabularWidget.h
FWPSetTableManager::PSetData::level
int level
Definition: FWPSetTableManager.h:64
TypeTrans::type2Code_
std::map< std::string, char > type2Code_
Definition: FWPSetTableManager.cc:40
FWTextTableCellRenderer::getDefaultGC
static const TGGC & getDefaultGC()
Definition: FWTextTableCellRenderer.cc:128
FWPSetTableManager::m_paths
std::vector< PathInfo > m_paths
Definition: FWPSetTableManager.h:177
FWPSetTableManager::cellRenderer
FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const override
Definition: FWPSetTableManager.cc:642
FWPSetTableManager::m_parentStack
std::vector< size_t > m_parentStack
Definition: FWPSetTableManager.h:180
value
Definition: value.py:1
FWTableCellRendererBase
Definition: FWTableCellRendererBase.h:44
FWPSetTableManager::ModuleInfo::entry
size_t entry
Definition: FWPSetTableManager.h:116
FWPSetTableManager::m_pathIndex
std::map< std::string, size_t > m_pathIndex
Definition: FWPSetTableManager.h:179
FWPSetTableManager::PSetData::pset
edm::ParameterSet * pset
Definition: FWPSetTableManager.h:80
FWPSetTableManager::setSelection
void setSelection(int row, int column, int mask)
Definition: FWPSetTableManager.cc:577
fwlog::kWarning
Definition: fwLog.h:35
fwLog.h
edm::ScheduleInfo
Definition: ScheduleInfo.h:32
FWPSetTableManager::PathInfo::moduleStart
size_t moduleStart
Definition: FWPSetTableManager.h:153
FWPSetTableManager::rowToIndex
std::vector< int > & rowToIndex()
Definition: FWPSetTableManager.h:105
module
Definition: vlib.h:198
FWPSetCellEditor.h
FWTextTableCellRenderer::setData
void setData(const std::string &, bool isSelected)
Definition: FWTextTableCellRenderer.cc:98
TypeTrans::TypeTrans
TypeTrans()
Definition: FWPSetTableManager.cc:43
reco_skim_cfg_mod.maxSize
maxSize
Definition: reco_skim_cfg_mod.py:154
GlobalContexts.h
edm::ParameterSet::vpsetTable
vpsettable const & vpsetTable() const
Definition: ParameterSet.h:228
FWPSetTableManager::m_selectedColumn
int m_selectedColumn
Definition: FWPSetTableManager.h:183
FWPSetTableManager::PathInfo::moduleEnd
size_t moduleEnd
Definition: FWPSetTableManager.h:154
T
long double T
Definition: Basic3DVectorLD.h:48
relativeConstraints.value
value
Definition: relativeConstraints.py:53
FWPSetCellEditor
Definition: FWPSetCellEditor.h:24
sTypeTranslations
static const TypeTrans sTypeTranslations
Definition: FWPSetTableManager.cc:80
TriggerAnalyzer.passed
passed
Definition: TriggerAnalyzer.py:62
util.rrClient.indent
indent
Definition: rrClient.py:41
edm::VParameterSetEntry
Definition: VParameterSetEntry.h:24
FWPSetTableManager::PSetData::module
size_t module
Definition: FWPSetTableManager.h:69
Exception.h
edm::ParameterSetEntry
Definition: ParameterSetEntry.h:23
FWPSetTableManager::ModuleInfo::orig_pset
edm::ParameterSet * orig_pset
Definition: FWPSetTableManager.h:123
data
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:79
FWTextTreeCellRenderer::setCellEditor
virtual void setCellEditor(TGTextEntry *editor)
Definition: FWTextTreeCellRenderer.h:60
triggerMatcherToHLTDebug_cfi.tags
tags
Definition: triggerMatcherToHLTDebug_cfi.py:9
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
FWTextTreeCellRenderer::setIsOpen
void setIsOpen(bool value)
Definition: FWTextTreeCellRenderer.h:64
fwlog::kError
Definition: fwLog.h:35
pi
const Double_t pi
Definition: trackSplitPlot.h:36
cms::Exception
Definition: Exception.h:70
castor_dqm_sourceclient_file_cfg.path
path
Definition: castor_dqm_sourceclient_file_cfg.py:37
FWPSetTableManager::applyEditor
bool applyEditor()
Definition: FWPSetTableManager.cc:519
ParameterSet.h
hlt_dqm_clientPB-live_cfg.me
me
Definition: hlt_dqm_clientPB-live_cfg.py:56
FWPSetTableManager::createScalarString
void createScalarString(PSetData &data, T v)
Definition: FWPSetTableManager.cc:174
FWPSetTableManager::PSetData::tracked
bool tracked
Definition: FWPSetTableManager.h:65
FWTextTreeCellRenderer::setIsParent
void setIsParent(bool value)
Definition: FWTextTreeCellRenderer.h:63
crabWrapper.key
key
Definition: crabWrapper.py:19
FWPSetTableManager::~FWPSetTableManager
~FWPSetTableManager() override
Definition: FWPSetTableManager.cc:96
FWPSetTableManager::ModuleInfo
Definition: FWPSetTableManager.h:110
FWPSetTableManager::m_row_to_index
std::vector< int > m_row_to_index
Definition: FWPSetTableManager.h:181
class-composition.parent
parent
Definition: class-composition.py:88
FWPSetTableManager::m_entries
std::vector< PSetData > m_entries
Definition: FWPSetTableManager.h:175
FWPSetTableManager::ModuleInfo::dirty
bool dirty
Definition: FWPSetTableManager.h:121
edm::Entry
Definition: Entry.h:40
cuy.ii
ii
Definition: cuy.py:590
FWPSetTableManager::PathUpdate
Definition: FWPSetTableManager.h:128
table_
Table table_
Definition: ExceptionActions.cc:21
label
const char * label
Definition: PFTauDecayModeTools.cc:11
FWTableManagerBase::cellHeight
virtual unsigned int cellHeight() const
require all cells to be the same height
Definition: FWTableManagerBase.cc:75
FWPSetTableManager::PSetData::path
size_t path
Definition: FWPSetTableManager.h:70
FWTextTreeCellRenderer::setIndentation
virtual void setIndentation(int indentation=0)
Definition: FWTextTreeCellRenderer.h:59
FWPSetTableManager::PSetData::parent
size_t parent
Definition: FWPSetTableManager.h:67
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37
FWTableManagerBase::maxWidthForColumns
virtual std::vector< unsigned int > maxWidthForColumns() const
for each column in the table this returns the present maximum width for that column
Definition: FWTableManagerBase.cc:89
FWPSetTableManager::PathInfo::entryId
size_t entryId
Definition: FWPSetTableManager.h:151
FWPSetTableManager::setExpanded
void setExpanded(int row)
Definition: FWPSetTableManager.cc:620
FWPSetTableManager::PSetData::label
std::string label
Definition: FWPSetTableManager.h:61