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;
39  CodeMap table_;
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': {
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;
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];
351  createVectorString(data, ranges, true);
352  break;
353  }
354  case 'A': {
355  data.editable = false;
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];
365  createVectorString(data, ranges, true);
366  break;
367  }
368  case 'R': {
369  data.editable = false;
370  createScalarString(data, entry.getEventRange());
371  break;
372  }
373  default: { break; }
374  }
375 }
376 
377 /* the actual structure of the model will not change, only
378  its contents, because of the way CMSSW is designed,
379  hence this method only needs to be called once.
380  */
382  if (!m_entries.empty())
383  return;
384  // Execute only once since the schedule itself
385  // cannot be altered.
386  assert(m_availablePaths.empty());
388 
389  for (size_t i = 0, e = m_availablePaths.size(); i != e; ++i) {
390  PSetData pathEntry;
392  pathEntry.label = pathName;
393  m_pathIndex.insert(std::make_pair(pathName, m_paths.size()));
394 
395  pathEntry.value = "Path";
396  pathEntry.level = 0;
397  pathEntry.parent = -1;
398  pathEntry.path = i;
399  pathEntry.editable = false;
400 
401  PathInfo pathInfo;
402  pathInfo.entryId = m_entries.size();
403  pathInfo.passed = false;
404  pathInfo.moduleStart = m_modules.size();
405  m_paths.push_back(pathInfo);
406 
407  m_parentStack.push_back(m_entries.size());
408  m_entries.push_back(pathEntry);
409 
410  std::vector<std::string> pathModules;
411  info->modulesInPath(pathName, pathModules);
412 
413  for (size_t mi = 0, me = pathModules.size(); mi != me; ++mi) {
414  PSetData moduleEntry;
415 
416  const edm::ParameterSet *ps = info->parametersForModule(pathModules[mi]);
417 
418  const edm::ParameterSet::table &pst = ps->tbl();
419  const edm::ParameterSet::table::const_iterator ti = pst.find("@module_edm_type");
420  if (ti == pst.end())
421  moduleEntry.value = "Unknown module name";
422  else
423  moduleEntry.value = ti->second.getString();
424 
425  moduleEntry.label = pathModules[mi];
426  moduleEntry.parent = m_parentStack.back();
427  moduleEntry.level = m_parentStack.size();
428  moduleEntry.module = mi;
429  moduleEntry.path = i;
430  moduleEntry.editable = false;
431 
432  ModuleInfo moduleInfo;
433  moduleInfo.path = m_paths.size() - 1;
434  moduleInfo.entry = m_entries.size();
435  moduleInfo.passed = false;
436  moduleInfo.dirty = false;
437  moduleInfo.orig_pset = new edm::ParameterSet(*ps);
438  moduleInfo.current_pset = new edm::ParameterSet(*ps);
439  m_modules.push_back(moduleInfo);
440 
441  moduleEntry.pset = moduleInfo.current_pset;
442 
443  m_parentStack.push_back(m_entries.size());
444  m_entries.push_back(moduleEntry);
445  handlePSet(moduleEntry.pset);
446  m_parentStack.pop_back();
447  }
448  m_paths.back().moduleEnd = m_modules.size();
449  m_parentStack.pop_back();
450  }
451 
452  // Nothing is expanded by default.
453  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
454  m_entries[i].expandedUser = false;
455 
456  m_filter = "";
457 
459 } //updateSchedule
460 
464 void FWPSetTableManager::update(std::vector<PathUpdate> &pathUpdates) {
465  // Reset all the path / module status information, so that
466  // by default paths and modules are considered "not passed".
467  for (size_t pi = 0, pe = m_paths.size(); pi != pe; ++pi)
468  m_paths[pi].passed = false;
469  for (size_t mi = 0, me = m_modules.size(); mi != me; ++mi)
470  m_modules[mi].passed = false;
471 
472  // Update whether or not a given path / module passed selection.
473  for (size_t pui = 0, pue = pathUpdates.size(); pui != pue; ++pui) {
474  PathUpdate &update = pathUpdates[pui];
475  std::map<std::string, size_t>::const_iterator index = m_pathIndex.find(update.pathName);
476  if (index == m_pathIndex.end()) {
477  fwLog(fwlog::kError) << "Path " << update.pathName << "cannot be found!" << std::endl;
478  continue;
479  }
480  PathInfo &pathInfo = m_paths[index->second];
481  pathInfo.passed = update.passed;
482 
483  for (size_t mi = pathInfo.moduleStart, me = pathInfo.moduleEnd; mi != me; ++mi) {
484  ModuleInfo &moduleInfo = m_modules[mi];
485  moduleInfo.passed = update.passed || ((mi - pathInfo.moduleStart) < update.choiceMaker);
486  }
487  }
488 
489  implSort(-1, true);
490 }
491 
492 //==============================================================================
493 //==============================================================================
494 //=============== CELL EDITOR ACTIONS ==========================================
495 //==============================================================================
496 //==============================================================================
497 
499  m_editor = editor;
501 }
502 
505  if (!m_editor)
506  return;
507 
508  // printf("FWPSetTableManager::cancelEditor() \n");
509  setSelection(-1, -1, 0);
510  m_editor->UnmapWindow();
511 }
512 
518  if (!m_editor)
519  return false;
520 
521  if (m_selectedRow == -1 || m_selectedColumn != 1)
522  return false;
523 
524  // printf("FWPSetTableManager::applyEditor() \n");
526  PSetData &parent = m_entries[data.parent];
527  bool success = false;
528  try {
529  success = m_editor->apply(data, parent);
530 
531  if (success) {
532  data.value = m_editor->GetText();
533  m_modules[data.module].dirty = true;
534  setSelection(-1, -1, 0);
535  m_editor->UnmapWindow();
536  // ???
537  // copy current to orig
538  } else {
539  // ???
540  // set current from orig? reimport module ... hmmh, hard.
541  }
542  } catch (cms::Exception &e) {
543  m_editor->SetForegroundColor(gVirtualX->GetPixel(kRed));
544  }
545  return success;
546 }
547 
548 //==============================================================================
549 //==============================================================================
550 //======== TABLE UI MNG (virutals FWTableManagerBase virtuals, etc.) =========
551 //==============================================================================
552 //==============================================================================
553 const std::string FWPSetTableManager::title() const { return "Modules & their parameters"; }
554 
555 std::vector<std::string> FWPSetTableManager::getTitles() const {
556  std::vector<std::string> returnValue;
557  returnValue.reserve(numberOfColumns());
558  returnValue.push_back("Label");
559  returnValue.push_back("Value");
560  return returnValue;
561 }
562 
564 
566 
567 bool FWPSetTableManager::rowIsSelected(int row) const { return m_selectedRow == row; }
568 
569 int FWPSetTableManager::unsortedRowNumber(int unsorted) const { return unsorted; }
570 
571 int FWPSetTableManager::numberOfRows() const { return m_row_to_index.size(); }
572 
573 int FWPSetTableManager::numberOfColumns() const { return 2; }
574 
575 void FWPSetTableManager::setSelection(int iRow, int iColumn, int mask) {
576  // printf("set selection %d %d mode %d\n", iRow, iColumn, mask);
577 
578  // Nothing changes if we clicked selected
579  // twice the same cell.
580  if (iRow == m_selectedRow && iColumn == m_selectedColumn)
581  return;
582 
583  // Otherwise update the selection information
584  // and notify observers.
585  m_selectedRow = iRow;
586  m_selectedColumn = iColumn;
587  if (iColumn == 1 && iRow > 0) {
588  int unsortedRow = m_row_to_index[iRow];
589  const PSetData &data = m_entries[unsortedRow];
590  if (m_editor && data.editable) {
591  m_editor->MoveResize(0, cellHeight() * iRow, m_editor->GetWidth(), m_editor->GetHeight());
592  m_editor->MapWindow();
593  m_editor->SetText(data.value.c_str());
594  m_editor->SetFocus();
595  m_editor->SetCursorPosition(data.value.size() - 1);
596  }
597  } else {
598  if (m_editor)
599  m_editor->UnmapWindow();
600  }
602 }
603 
604 std::vector<unsigned int> FWPSetTableManager::maxWidthForColumns() const {
605  std::vector<unsigned int> ww = FWTableManagerBase::maxWidthForColumns();
606  if (ww.size() > 1 && ww[1] > 0) {
607  // printf("dim W %d \n",ww[1]);
608  // printf("dim H %d \n",cellHeight());
609  if (m_editor)
610  m_editor->MoveResize(m_editor->GetX(), m_editor->GetY(), ww[1], cellHeight());
611  }
612  return ww;
613 }
614 
616 //______________________________________________________________________________
617 
619  if (row == -1)
620  return;
621 
622  int index = rowToIndex()[row];
624 
625  if (m_filter.empty() == false && data.childMatches == false)
626  return;
627 
628  if (m_filter.empty())
629  data.expandedUser = !data.expandedUser;
630  else
631  data.expandedFilter = !data.expandedFilter;
632 
634  dataChanged();
636 }
637 
638 //______________________________________________________________________________
639 
640 FWTableCellRendererBase *FWPSetTableManager::cellRenderer(int iSortedRowNumber, int iCol) const {
641  const static size_t maxSize = 512; // maximum string length
642 
643  static TGGC boldGC(fireworks::boldGC());
644  static TGGC italicGC(fireworks::italicGC());
645  static TGGC defaultGC(FWTextTableCellRenderer::getDefaultGC());
646 
647  const static Pixel_t gray = 0x777777;
648  const static Pixel_t red = gVirtualX->GetPixel(kRed - 5);
649  const static Pixel_t green = gVirtualX->GetPixel(kGreen - 5);
650 
651  // return in case if nothing maches filter
652  if (static_cast<int>(m_row_to_index.size()) <= iSortedRowNumber) {
653  m_renderer.setData(std::string(), false);
654  return &m_renderer;
655  }
656 
657  int unsortedRow = m_row_to_index[iSortedRowNumber];
658  const PSetData &data = m_entries[unsortedRow];
659 
662  TGGC *gc = nullptr;
663  if (data.level == 0) {
664  const PathInfo &path = m_paths[data.path];
665  label = data.label + " (" + data.value + ")";
666  gc = &boldGC;
667  gc->SetForeground(path.passed ? green : red);
668  } else if (data.level == 1) {
669  // "passed" means if module made decision on path
670  const ModuleInfo &module = m_modules[m_paths[data.path].moduleStart + data.module];
671  label = data.label + " (" + data.value + ")";
672  gc = (TGGC *)&boldGC;
673  gc->SetForeground(module.passed ? green : red);
674  } else {
675  if (data.type > 0)
676  label = data.label + " (" + sTypeTranslations.table_[data.type] + ")";
677  else
678  label = data.label;
679  value = data.value;
680 
681  if (data.editable) {
682  gc = &defaultGC;
683  } else {
684  gc = &italicGC;
685  gc->SetForeground(gray);
686  }
687  }
688 
689  // check string size and cut it if necessary (problems with X11)
690  if (iCol == 1 && value.size() >= maxSize) {
691  if (iSortedRowNumber == m_selectedRow)
692  fwLog(fwlog::kWarning) << "label: " << label << " has too long value " << value << std::endl << std::endl;
693 
694  value = value.substr(0, maxSize);
695  value += "[truncated]";
696  gc->SetForeground(gVirtualX->GetPixel(kMagenta));
697  }
698 
699  // debug
700  // label = Form("%s m[%d] childm[%d] ", label.c_str(), data.matches, data.childMatches);
701 
702  // set text attributes
704  bool selected = data.matches && (m_filter.empty() == false);
705  m_renderer.setData(iCol ? value : label, selected);
706 
707  // set tree attributes
708  bool isParent = false;
709  bool isOpen = false;
710  int indent = 0;
711  if (iCol == 0) {
712  if (m_filter.empty()) {
713  size_t nextIdx = unsortedRow + 1;
714  isParent = (nextIdx < m_entries.size() && m_entries[nextIdx].parent == (size_t)unsortedRow);
715  isOpen = data.expandedUser;
716  } else {
717  isParent = data.childMatches;
718  isOpen = data.expandedFilter && data.childMatches;
719  }
720 
721  indent = data.level * 10;
722  if (!isParent)
724  }
725  m_renderer.setIsParent(isParent);
726  m_renderer.setIsOpen(isOpen);
727  m_renderer.setIndentation(indent);
728 
729  // If we are rendering the selected cell,
730  // we show the editor.
731  bool showEdit =
732  (iCol == 1 && iSortedRowNumber == m_selectedRow && iCol == m_selectedColumn && value.size() < maxSize);
733  m_renderer.showEditor(data.editable && showEdit);
734 
735  return &m_renderer;
736 } // cellRender()
737 
738 //______________________________________________________________________________
739 
741  m_filter = filter;
742 
743  if (m_filter.empty()) {
744  // collapse entries when filter is removed
745  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
746  m_entries[i].expandedFilter = false;
747  } else {
748  // Decide whether or not items match the filter.
749  for (size_t i = 0, e = m_entries.size(); i != e; ++i) {
750  PSetData &data = m_entries[i];
751 
752  // First of all decide whether or not we match
753  // the filter.
754  if (strstr(data.label.c_str(), m_filter.c_str()) || strstr(data.value.c_str(), m_filter.c_str()))
755  data.matches = true;
756  else
757  data.matches = false;
758  }
759 
760  // We reset whether or not a given parent has children that match the
761  // filter, and we recompute the whole information by checking all the
762  // children.
763  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
764  m_entries[i].childMatches = false;
765 
766  std::vector<int> stack;
767  int previousLevel = 0;
768  for (size_t i = 0, e = m_entries.size(); i != e; ++i) {
769  PSetData &data = m_entries[i];
770  // Top level.
771  if (data.parent == (size_t)-1) {
772  previousLevel = 0;
773  // std::cout << "reset stack for top level " << data.label << std::endl;
774  stack.clear();
775  continue;
776  }
777  // If the level is greater than the previous one,
778  // it means we are among the children of the
779  // previous level, hence we push the parent to
780  // the stack.
781  // If the level is not greater than the previous
782  // one it means we have popped out n levels of
783  // parents, where N is the difference between the
784  // new and the old level. In this case we
785  // pop up N parents from the stack.
786  if (data.level > previousLevel)
787  stack.push_back(data.parent);
788  else
789  for (size_t pi = 0, pe = previousLevel - data.level; pi != pe; ++pi)
790  stack.pop_back();
791 
792  if (data.matches && m_entries[stack.back()].childMatches == false) {
793  // printf("match for %s with level %d\n",data.label.c_str(), data.level );
794  for (size_t pi = 0, pe = stack.size(); pi != pe; ++pi) {
795  // printf("set child match to parent %s with level %d \n",m_entries[stack[pi]].label.c_str(), m_entries[stack[pi]].level);
796  m_entries[stack[pi]].childMatches = true;
797  }
798  }
799 
800  previousLevel = data.level;
801  }
802 
803  // expand to matching children
804  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
805  m_entries[i].expandedFilter = m_entries[i].childMatches;
806  }
807 
809 
810  dataChanged();
811 } // updateFilter()
812 
813 //______________________________________________________________________________
814 
816  m_row_to_index.clear();
817 
818  // Decide about visibility.
819  // * If the items are toplevel and they match the filter, they get shown
820  // in any case.
821  // * If the item or any of its children match the filter, the item
822  // is visible.
823  // * If the filter is empty and the parent is expanded.
824  for (size_t i = 0, e = m_entries.size(); i != e; ++i) {
825  PSetData &data = m_entries[i];
826  if (data.parent == ((size_t)-1)) {
827  data.visible = data.childMatches || data.matches || m_filter.empty();
828  } else {
829  if (m_filter.empty()) {
830  data.visible = m_entries[data.parent].expandedUser && m_entries[data.parent].visible;
831  } else {
832  if (data.level < 2)
833  data.visible = m_entries[data.parent].expandedFilter && m_entries[data.parent].visible &&
834  (data.matches || data.childMatches);
835  else
836  data.visible = m_entries[data.parent].expandedFilter && m_entries[data.parent].visible;
837  }
838  }
839  }
840 
841  // Put in the index only the entries which are visible.
842  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
843  if (m_entries[i].visible)
844  m_row_to_index.push_back(i);
845 }
void modulesInPath(const std::string &iPathLabel, std::vector< std::string > &oLabelsToFill) const
add to oLabelsToFill in execution order the labels of all modules in path iPathLabel ...
Definition: ScheduleInfo.cc:91
std::vector< unsigned > getVUInt32() const
Definition: Entry.cc:854
std::vector< double > getVDouble() const
Definition: Entry.cc:902
std::vector< std::string > m_availablePaths
static const TGPicture * info(bool iBackgroundIsBlack)
std::vector< unsigned long long > getVUInt64() const
Definition: Entry.cc:878
std::vector< LuminosityBlockID > getVLuminosityBlockID() const
Definition: Entry.cc:1034
static TypeTrans const sTypeTranslations
std::vector< PathInfo > m_paths
std::vector< std::string > CodeMap
virtual bool rowIsSelected(int row) const
~FWPSetTableManager() override
int getInt32() const
Definition: Entry.cc:794
FWTextTreeCellRenderer m_renderer
unsigned getUInt32() const
Definition: Entry.cc:842
std::vector< size_t > m_parentStack
std::vector< InputTag > getVInputTag() const
Definition: Entry.cc:962
std::vector< int > & rowToIndex()
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< std::string > getTitles() const override
returns the title names for each column
void handlePSetEntry(edm::ParameterSetEntry &entry, const std::string &key)
void createVectorString(FWPSetTableManager::PSetData &data, const T &v, bool quotes)
void dataChanged()
Classes which inherit from FWTableManagerBase must call this when their underlying data changes...
std::vector< ParameterSet > & vpsetForUpdate()
std::vector< ModuleInfo > m_modules
LuminosityBlockRange getLuminosityBlockRange() const
Definition: Entry.cc:1045
std::string encode() const
Definition: InputTag.cc:159
virtual std::vector< unsigned int > maxWidthForColumns() const
for each column in the table this returns the present maximum width for that column ...
double getDouble() const
Definition: Entry.cc:890
std::vector< EventID > getVEventID() const
Definition: Entry.cc:1010
virtual const std::string title() const
const Double_t pi
unsigned long long getUInt64() const
Definition: Entry.cc:866
char const * label
std::map< std::string, size_t > m_pathIndex
std::vector< PSetData > & data()
void handleVPSetEntry(edm::VParameterSetEntry &entry, const std::string &key)
static const TGGC & getDefaultGC()
std::vector< int > m_row_to_index
std::vector< PSetData > m_entries
bool isTracked() const
Definition: Entry.h:174
void setHighlightContext(const TGGC *context)
virtual void setCellEditor(TGTextEntry *editor)
stack
Definition: svgfig.py:559
int numberOfRows() const override
Number of rows in the table.
bool getBool() const
Definition: Entry.cc:782
InputTag getInputTag() const
Definition: Entry.cc:950
std::map< std::string, char > type2Code_
bool apply(FWPSetTableManager::PSetData &data, FWPSetTableManager::PSetData &parent)
void handleEntry(const edm::Entry &entry, const std::string &key)
static const TGGC & getDefaultHighlightGC()
std::vector< ParameterSet > const & vpset() const
returns the VPSet
std::vector< long long > getVInt64() const
Definition: Entry.cc:830
void handlePSet(edm::ParameterSet *psp)
std::vector< unsigned int > maxWidthForColumns() const override
for each column in the table this returns the present maximum width for that column ...
std::vector< ESInputTag > getVESInputTag() const
Definition: Entry.cc:986
void setGraphicsContext(const TGGC *iContext)
FWPSetCellEditor * m_editor
std::vector< EventRange > getVEventRange() const
Definition: Entry.cc:1081
FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const override
ii
Definition: cuy.py:590
int numberOfColumns() const override
Number of columns in the table.
string ranges
Definition: diffTwoXMLs.py:79
virtual void setIndentation(int indentation=0)
void updateSchedule(const edm::ScheduleInfo *info)
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...
void createScalarString(PSetData &data, T v)
void setData(const std::string &, bool isSelected)
FileInPath getFileInPath() const
Definition: Entry.cc:938
psettable const & psetTable() const
Definition: ParameterSet.h:225
virtual void updateFilter(const char *filter)
const edm::ParameterSet * parametersForModule(const std::string &iLabel) const
Definition: ScheduleInfo.cc:73
std::string encode() const
Definition: ESInputTag.cc:54
#define fwLog(_level_)
Definition: fwLog.h:45
std::vector< int > getVInt32() const
Definition: Entry.cc:806
void setCellValueEditor(FWPSetCellEditor *editor)
std::map< std::string, Entry > table
Definition: ParameterSet.h:221
LuminosityBlockID getLuminosityBlockID() const
Definition: Entry.cc:1022
const TGGC & italicGC()
ParameterSet & psetForUpdate()
vpsettable const & vpsetTable() const
Definition: ParameterSet.h:228
EventRange getEventRange() const
Definition: Entry.cc:1069
void update(std::vector< PathUpdate > &pathUpdates)
susybsm::HSCParticleCollection hc
Definition: classes.h:25
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
const TGGC & boldGC()
std::vector< LuminosityBlockRange > getVLuminosityBlockRange() const
Definition: Entry.cc:1057
void setSelection(int row, int column, int mask)
char typeCode() const
Definition: Entry.h:176
ESInputTag getESInputTag() const
Definition: Entry.cc:974
virtual unsigned int cellHeight() const
require all cells to be the same height
std::string relativePath() const
Definition: FileInPath.cc:159
table const & tbl() const
Definition: ParameterSet.h:222
long double T
Definition: vlib.h:198
std::vector< std::string > getVString() const
Definition: Entry.cc:926
void availablePaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all paths in the process
Definition: ScheduleInfo.cc:87
std::string getString() const
Definition: Entry.cc:914
virtual void showEditor(bool value)
EventID getEventID() const
Definition: Entry.cc:998