CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // $Id: FWPSetTableManager.cc,v 1.14 2011/03/07 13:13:51 amraktad Exp $
12 //
13 
14 #include <map>
15 
21 
26 //
27 // constants, enums and typedefs
28 //
29 
30 //
31 // static data member definitions
32 //
33 
34 
35 // FIXME: copied from Entry.cc should find a way to use the original
36 // table.
37 struct TypeTrans {
38  TypeTrans();
39 
40  typedef std::vector<std::string> CodeMap;
42  std::map<std::string, char> type2Code_;
43 };
44 
46  table_['b'] = "vBool";
47  table_['B'] = "bool";
48  table_['i'] = "vint32";
49  table_['I'] = "int32";
50  table_['u'] = "vuint32";
51  table_['U'] = "uint32";
52  table_['l'] = "vint64";
53  table_['L'] = "int64";
54  table_['x'] = "vuint64";
55  table_['X'] = "uint64";
56  table_['s'] = "vstring";
57  table_['S'] = "string";
58  table_['d'] = "vdouble";
59  table_['D'] = "double";
60  table_['p'] = "vPSet";
61  table_['P'] = "PSet";
62  table_['T'] = "path";
63  table_['F'] = "FileInPath";
64  table_['t'] = "InputTag";
65  table_['v'] = "VInputTag";
66  table_['g'] = "ESInputTag";
67  table_['G'] = "VESInputTag";
68  table_['e'] = "VEventID";
69  table_['E'] = "EventID";
70  table_['m'] = "VLuminosityBlockID";
71  table_['M'] = "LuminosityBlockID";
72  table_['a'] = "VLuminosityBlockRange";
73  table_['A'] = "LuminosityBlockRange";
74  table_['r'] = "VEventRange";
75  table_['R'] = "EventRange";
76 
77  for(CodeMap::const_iterator itCode = table_.begin(), itCodeEnd = table_.end();
78  itCode != itCodeEnd;
79  ++itCode) {
80  type2Code_[*itCode] = (itCode - table_.begin());
81  }
82 }
83 
85 
86 
87 //
88 // constructors and destructor
89 //
90 
92  : m_selectedRow(-1)
93 {
94 
96  hc->SetForeground(0xdddddd);
97 
99 
102 }
103 
105 {
106 }
107 
108 //==============================================================================
109 //==============================================================================
110 //========== IMPORT CMSSW CONFIG TO TABLE ======================================
111 //==============================================================================
112 //==============================================================================
113 
115 {
117  data.label = key;
118  data.tracked = entry.isTracked();
119  data.level = m_parentStack.size();
120  data.parent = m_parentStack.back();
121  data.type = 'P';
122  data.module = m_modules.size() - 1;
123  data.path = m_paths.size() - 1;
124  data.pset = entry.pset();
125  data.editable = false;
126  m_parentStack.push_back(m_entries.size());
127  m_entries.push_back(data);
128 
129  handlePSet(entry.pset());
130  m_parentStack.pop_back();
131 }
132 
134 {
135  PSetData data;
136  data.label = key;
137  data.tracked = entry.isTracked();
138  data.level = m_parentStack.size();
139  data.parent = m_parentStack.back();
140  data.type = 'p';
141  data.module = m_modules.size() - 1;
142  data.path = m_paths.size() - 1;
143  data.editable = false;
144  m_parentStack.push_back(m_entries.size());
145  m_entries.push_back(data);
146 
147  std::stringstream ss;
148 
149  for (size_t i = 0, e = entry.vpset().size(); i != e; ++i)
150  {
151  ss.str("");
152  ss << key << "[" << i << "]";
154  vdata.label = ss.str();
155  vdata.tracked = entry.isTracked();
156  vdata.level = m_parentStack.size();
157  vdata.parent = m_parentStack.back();
158  vdata.module = m_modules.size() - 1;
159  vdata.path = m_paths.size() - 1;
160  vdata.editable = false;
161  m_parentStack.push_back(m_entries.size());
162  m_entries.push_back(vdata);
163  handlePSet(entry.vpset()[i]);
164  m_parentStack.pop_back();
165  }
166  m_parentStack.pop_back();
167 }
168 
170 {
171  typedef edm::ParameterSet::table::const_iterator TIterator;
172  for (TIterator i = ps.tbl().begin(), e = ps.tbl().end(); i != e; ++i)
173  handleEntry(i->second, i->first);
174 
175  typedef edm::ParameterSet::psettable::const_iterator PSIterator;
176  for (PSIterator i = ps.psetTable().begin(), e = ps.psetTable().end(); i != e; ++i)
177  handlePSetEntry(i->second, i->first);
178 
179  typedef edm::ParameterSet::vpsettable::const_iterator VPSIterator;
180  for (VPSIterator i = ps.vpsetTable().begin(), e = ps.vpsetTable().end(); i != e; ++i)
181  handleVPSetEntry(i->second, i->first);
182 }
183 
184 template <class T>
186 {
187  std::stringstream ss;
188  ss << v;
189  data.value = ss.str();
190  m_entries.push_back(data);
191 }
192 
193 template <typename T>
195 {
196  std::stringstream ss;
197  ss << "[";
198  for (size_t ii = 0, ie = v.size(); ii != ie; ++ii)
199  {
200  if (quotes)
201  ss << "\"";
202  ss << v[ii];
203  if (quotes)
204  ss << "\"";
205  if (ii + 1 != ie)
206  ss << ", ";
207  }
208  ss << "]";
209  data.value = ss.str();
210  m_entries.push_back(data);
211 }
212 
213 void FWPSetTableManager::handleEntry(const edm::Entry &entry,const std::string &key)
214 {
215  std::stringstream ss;
217  data.label = key;
218  data.tracked = entry.isTracked();
219  data.type = entry.typeCode();
220  data.level = m_parentStack.size();
221  data.parent = m_parentStack.back();
222  data.module = m_modules.size() - 1;
223  data.type = entry.typeCode();
224  if (data.label[0] == '@' || data.level > 2)
225  data.editable = false;
226  else
227  data.editable = true;
228 
229  switch(entry.typeCode())
230  {
231  case 'b':
232  {
233  data.value = entry.getBool() ? "True" : "False";
234  m_entries.push_back(data);
235  break;
236  }
237  case 'B':
238  {
239  data.value = entry.getBool() ? "True" : "False";
240  m_entries.push_back(data);
241  break;
242  }
243  case 'i':
244  {
245  createVectorString(data, entry.getVInt32(), false);
246  break;
247  }
248  case 'I':
249  {
250  createScalarString(data, entry.getInt32());
251  break;
252  }
253  case 'u':
254  {
255  createVectorString(data, entry.getVUInt32(), false);
256  break;
257  }
258  case 'U':
259  {
260  createScalarString(data, entry.getUInt32());
261  break;
262  }
263  case 'l':
264  {
265  createVectorString(data, entry.getVInt64(), false);
266  break;
267  }
268  case 'L':
269  {
270  createScalarString(data, entry.getInt32());
271  break;
272  }
273  case 'x':
274  {
275  createVectorString(data, entry.getVUInt64(), false);
276  break;
277  }
278  case 'X':
279  {
280  createScalarString(data, entry.getUInt64());
281  break;
282  }
283  case 's':
284  {
285  createVectorString(data, entry.getVString(), false);
286  break;
287  }
288  case 'S':
289  {
290  createScalarString(data, entry.getString());
291  break;
292  }
293  case 'd':
294  {
295  createVectorString(data, entry.getVDouble(), false);
296  break;
297  }
298  case 'D':
299  {
300  createScalarString(data, entry.getDouble());
301  break;
302  }
303  case 'p':
304  {
305  std::vector<edm::ParameterSet> psets = entry.getVPSet();
306  for (size_t psi = 0, pse = psets.size(); psi != pse; ++psi)
307  handlePSet(psets[psi]);
308  break;
309  }
310  case 'P':
311  {
312  handlePSet(entry.getPSet());
313  break;
314  }
315  case 't':
316  {
317  data.value = entry.getInputTag().encode();
318  m_entries.push_back(data);
319  break;
320  }
321  case 'v':
322  {
323  std::vector<std::string> tags;
324  tags.resize(entry.getVInputTag().size());
325  for (size_t iti = 0, ite = tags.size(); iti != ite; ++iti)
326  tags[iti] = entry.getVInputTag()[iti].encode();
327  createVectorString(data, tags, true);
328  break;
329  }
330  case 'g':
331  {
332  data.value = entry.getESInputTag().encode();
333  m_entries.push_back(data);
334  break;
335  }
336  case 'G':
337  {
338  std::vector<std::string> tags;
339  tags.resize(entry.getVESInputTag().size());
340  for (size_t iti = 0, ite = tags.size(); iti != ite; ++iti)
341  tags[iti] = entry.getVESInputTag()[iti].encode();
342  createVectorString(data, tags, true);
343  break;
344  }
345  case 'F':
346  {
348  break;
349  }
350  case 'e':
351  {
352  data.editable = false;
353  std::vector<edm::EventID> ids;
354  ids.resize(entry.getVEventID().size());
355  for ( size_t iri = 0, ire = ids.size(); iri != ire; ++iri )
356  ids[iri] = entry.getVEventID()[iri];
357  createVectorString(data, ids, true);
358  break;
359  }
360  case 'E':
361  {
362  data.editable = false;
363  createScalarString(data, entry.getEventID());
364  break;
365  }
366  case 'm':
367  {
368  data.editable = false;
369  std::vector<edm::LuminosityBlockID> ids;
370  ids.resize(entry.getVLuminosityBlockID().size());
371  for ( size_t iri = 0, ire = ids.size(); iri != ire; ++iri )
372  ids[iri] = entry.getVLuminosityBlockID()[iri];
373  createVectorString(data, ids, true);
374  break;
375  }
376  case 'M':
377  {
378  data.editable = false;
380  break;
381  }
382  case 'a':
383  {
384  data.editable = false;
385  std::vector<edm::LuminosityBlockRange> ranges;
386  ranges.resize(entry.getVLuminosityBlockRange().size());
387  for ( size_t iri = 0, ire = ranges.size(); iri != ire; ++iri )
388  ranges[iri] = entry.getVLuminosityBlockRange()[iri];
389  createVectorString(data, ranges, true);
390  break;
391  }
392  case 'A':
393  {
394  data.editable = false;
396  break;
397  }
398  case 'r':
399  {
400  data.editable = false;
401  std::vector<edm::EventRange> ranges;
402  ranges.resize(entry.getVEventRange().size());
403  for ( size_t iri = 0, ire = ranges.size(); iri != ire; ++iri )
404  ranges[iri] = entry.getVEventRange()[iri];
405  createVectorString(data, ranges, true);
406  break;
407  }
408  case 'R':
409  {
410  data.editable = false;
411  createScalarString(data, entry.getEventRange());
412  break;
413  }
414  default:
415  {
416  break;
417  }
418  }
419 }
420 
421 /* the actual structure of the model will not change, only
422  its contents, because of the way CMSSW is designed,
423  hence this method only needs to be called once.
424  */
426 {
427  if (!m_entries.empty())
428  return;
429  // Execute only once since the schedule itself
430  // cannot be altered.
431  assert(m_availablePaths.empty());
433 
434  for (size_t i = 0, e = m_availablePaths.size(); i != e; ++i)
435  {
436  PSetData pathEntry;
437  const std::string &pathName = m_availablePaths[i];
438  pathEntry.label = pathName;
439  m_pathIndex.insert(std::make_pair(pathName, m_paths.size()));
440 
441  pathEntry.value = "Path";
442  pathEntry.level= 0;
443  pathEntry.parent = -1;
444  pathEntry.path = i;
445  pathEntry.editable = false;
446 
447  PathInfo pathInfo;
448  pathInfo.entryId = m_entries.size();
449  pathInfo.passed = false;
450  pathInfo.moduleStart = m_modules.size();
451  m_paths.push_back(pathInfo);
452 
453  m_parentStack.push_back(m_entries.size());
454  m_entries.push_back(pathEntry);
455 
456  std::vector<std::string> pathModules;
457  info->modulesInPath(pathName, pathModules);
458 
459  for (size_t mi = 0, me = pathModules.size(); mi != me; ++mi)
460  {
461  PSetData moduleEntry;
462 
463  const edm::ParameterSet* ps = info->parametersForModule(pathModules[mi]);
464  const edm::ParameterSet::table& pst = ps->tbl();
465  const edm::ParameterSet::table::const_iterator ti = pst.find("@module_edm_type");
466 
467  if (ti == pst.end())
468  moduleEntry.value = "Unknown module name";
469  else
470  moduleEntry.value = ti->second.getString();
471 
472  moduleEntry.label = pathModules[mi];
473  moduleEntry.parent = m_parentStack.back();
474  moduleEntry.level = m_parentStack.size();
475  moduleEntry.module = mi;
476  moduleEntry.path = i;
477  moduleEntry.pset = *ps;
478  moduleEntry.editable = false;
479  ModuleInfo moduleInfo;
480  moduleInfo.path = m_paths.size() - 1;
481  moduleInfo.entry = m_entries.size();
482  moduleInfo.passed = false;
483  moduleInfo.dirty = false;
484  m_modules.push_back(moduleInfo);
485  m_parentStack.push_back(m_entries.size());
486  m_entries.push_back(moduleEntry);
487  handlePSet(moduleEntry.pset);
488  m_parentStack.pop_back();
489  }
490  m_paths.back().moduleEnd = m_modules.size();
491  m_parentStack.pop_back();
492  }
493 
494  // Nothing is expanded by default.
495  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
496  m_entries[i].expandedUser = false;
497 
498  m_filter = "";
499 
501 } //updateSchedule
502 
503 
507 void FWPSetTableManager::update(std::vector<PathUpdate> &pathUpdates)
508 {
509  // Reset all the path / module status information, so that
510  // by default paths and modules are considered "not passed".
511  for (size_t pi = 0, pe = m_paths.size(); pi != pe; ++pi)
512  m_paths[pi].passed = false;
513  for (size_t mi = 0, me = m_modules.size(); mi != me; ++mi)
514  m_modules[mi].passed = false;
515 
516  // Update whether or not a given path / module passed selection.
517  for (size_t pui = 0, pue = pathUpdates.size(); pui != pue; ++pui)
518  {
519  PathUpdate &update = pathUpdates[pui];
520  std::map<std::string, size_t>::const_iterator index = m_pathIndex.find(update.pathName);
521  if (index == m_pathIndex.end())
522  {
523  fwLog(fwlog::kError) << "Path " << update.pathName << "cannot be found!" << std::endl;
524  continue;
525  }
526  PathInfo &pathInfo = m_paths[index->second];
527  pathInfo.passed = update.passed;
528 
529  for (size_t mi = pathInfo.moduleStart, me = pathInfo.moduleEnd; mi != me; ++mi)
530  {
531  ModuleInfo &moduleInfo = m_modules[mi];
532  moduleInfo.passed = update.passed || ((mi-pathInfo.moduleStart) < update.choiceMaker);
533  }
534  }
535 
536  implSort(-1, true);
537 }
538 
539 //==============================================================================
540 //==============================================================================
541 //=============== CELL EDITOR ACTIONS ==========================================
542 //==============================================================================
543 //==============================================================================
544 
546 {
547  m_editor = editor;
549 }
550 
551 
554 {
555  if (!m_editor)
556  return;
557 
558  // printf("FWPSetTableManager::cancelEditor() \n");
559  setSelection(-1, -1, 0);
560  m_editor->UnmapWindow();
561 }
562 
568 {
569  if (!m_editor)
570  return false;
571 
572  if (m_selectedRow == -1 ||m_selectedColumn != 1 )
573  return false;
574 
575 
576  // printf("FWPSetTableManager::applyEditor() \n");
578  PSetData &parent = m_entries[data.parent];
579  bool success = false;
580  try
581  {
582  success = m_editor->apply(data, parent);
583  if (success)
584  {
585  data.value = m_editor->GetText();
586  m_modules[data.module].dirty = true;
587  setSelection(-1, -1, 0);
588  m_editor->UnmapWindow();
589  }
590  }
591  catch(cms::Exception &e)
592  {
593  m_editor->SetForegroundColor(gVirtualX->GetPixel(kRed));
594  }
595  return success;
596 }
597 
598 
599 //==============================================================================
600 //==============================================================================
601 //======== TABLE UI MNG (virutals FWTableManagerBase virtuals, etc.) =========
602 //==============================================================================
603 //==============================================================================
604 const std::string FWPSetTableManager::title() const {
605  return "Modules & their parameters";
606 }
607 
608 std::vector<std::string> FWPSetTableManager::getTitles() const
609 {
610  std::vector<std::string> returnValue;
611  returnValue.reserve(numberOfColumns());
612  returnValue.push_back("Label");
613  returnValue.push_back("Value");
614  return returnValue;
615 }
616 
618  return m_selectedRow;
619 }
620 
622  return m_selectedColumn;
623 }
624 
626 {
627  return m_selectedRow == row;
628 }
629 
631 {
632  return unsorted;
633 }
634 
636  return m_row_to_index.size();
637 }
638 
640  return 2;
641 }
642 
643 void FWPSetTableManager::setSelection (int iRow, int iColumn, int mask)
644 {
645  // printf("set selection %d %d mode %d\n", iRow, iColumn, mask);
646 
647  // Nothing changes if we clicked selected
648  // twice the same cell.
649  if (iRow == m_selectedRow && iColumn == m_selectedColumn)
650  return;
651 
652  // Otherwise update the selection information
653  // and notify observers.
654  m_selectedRow = iRow;
655  m_selectedColumn = iColumn;
656  if (iColumn == 1 && iRow > 0 )
657  {
658  int unsortedRow = m_row_to_index[iRow];
659  const PSetData& data = m_entries[unsortedRow];
660  if (m_editor && data.editable) {
661  m_editor->MoveResize(0, cellHeight()*iRow, m_editor->GetWidth() , m_editor->GetHeight());
662  m_editor->MapWindow();
663  m_editor->SetText(data.value.c_str());
664  m_editor->SetFocus();
665  m_editor->SetCursorPosition(data.value.size()-1);
666  }
667  }
668  else
669  {
670  if (m_editor) m_editor->UnmapWindow();
671  }
673 }
674 
675 std::vector<unsigned int> FWPSetTableManager::maxWidthForColumns() const
676 {
677  std::vector<unsigned int> ww = FWTableManagerBase::maxWidthForColumns();
678  if (ww.size() > 1 && ww[1] > 0)
679  {
680  // printf("dim W %d \n",ww[1]);
681  // printf("dim H %d \n",cellHeight());
682  if (m_editor)
683  m_editor->MoveResize(m_editor->GetX(),m_editor->GetY(), ww[1], cellHeight());
684  }
685  return ww;
686 
687 }
688 
690 {
691 }
692 //______________________________________________________________________________
693 
695 {
696  if (row == -1)
697  return;
698 
699  int index = rowToIndex()[row];
701 
702  if (m_filter.empty() == false && data.childMatches == false)
703  return;
704 
705  if (m_filter.empty())
706  data.expandedUser = !data.expandedUser;
707  else
708  data.expandedFilter = !data.expandedFilter;
709 
711  dataChanged();
713 }
714 
715 //______________________________________________________________________________
716 
717 FWTableCellRendererBase* FWPSetTableManager::cellRenderer(int iSortedRowNumber, int iCol) const
718 {
719  static size_t maxSize = 512; // maximum string length
720 
721  static TGGC boldGC(fireworks::boldGC());
722  static TGGC italicGC(fireworks::italicGC());
723  static TGGC defaultGC(FWTextTableCellRenderer::getDefaultGC());
724 
725  const static Pixel_t gray = 0x777777;
726  const static Pixel_t red = gVirtualX->GetPixel(kRed-5);
727  const static Pixel_t green = gVirtualX->GetPixel(kGreen-5);
728 
729  // return in case if nothing maches filter
730  if (static_cast<int>(m_row_to_index.size()) <= iSortedRowNumber)
731  {
732  m_renderer.setData(std::string(), false);
733  return &m_renderer;
734  }
735 
736 
737  int unsortedRow = m_row_to_index[iSortedRowNumber];
738  const PSetData& data = m_entries[unsortedRow];
739 
740  std::string value;
741  std::string label;
742  TGGC* gc = 0;
743  if (data.level == 0)
744  {
745  const PathInfo &path = m_paths[data.path];
746  label = data.label + " (" + data.value + ")";
747  gc = &boldGC;
748  gc->SetForeground(path.passed ? green: red);
749  }
750  else if (data.level == 1)
751  {
752  // "passed" means if module made decision on path
753  const ModuleInfo &module = m_modules[m_paths[data.path].moduleStart + data.module];
754  label = data.label + " (" + data.value + ")";
755  gc = (TGGC*)&boldGC;
756  gc->SetForeground(module.passed ? green : red);
757  }
758  else
759  {
760  if (data.type > 0)
761  label = data.label + " (" + sTypeTranslations.table_[data.type] + ")";
762  else
763  label = data.label;
764  value = data.value;
765 
766  if (data.editable)
767  {
768  gc = &defaultGC;
769  }
770  else
771  {
772  gc = &italicGC;
773  gc->SetForeground(gray);
774  }
775  }
776 
777  // check string size and cut it if necessary (problems with X11)
778  if (iCol == 1 && value.size() >= maxSize)
779  {
780  if (iSortedRowNumber == m_selectedRow)
781  fwLog(fwlog::kWarning) << "label: " << label << " has too long value " << value << std::endl << std::endl;
782 
783  value = value.substr(0, maxSize);
784  value += "[truncated]";
785  gc->SetForeground(gVirtualX->GetPixel(kMagenta));
786  }
787 
788  // debug
789  // label = Form("%s m[%d] childm[%d] ", label.c_str(), data.matches, data.childMatches);
790 
791  // set text attributes
793  bool selected = data.matches && (m_filter.empty() == false);
794  m_renderer.setData(iCol ? value : label, selected);
795 
796  // set tree attributes
797  bool isParent = false;
798  bool isOpen = false;
799  int indent = 0;
800  if (iCol == 0)
801  {
802  if (m_filter.empty())
803  {
804  size_t nextIdx = unsortedRow + 1;
805  isParent = (nextIdx < m_entries.size() && m_entries[nextIdx].parent == (size_t)unsortedRow);
806  isOpen = data.expandedUser;
807  }
808  else
809  {
810  isParent = data.childMatches;
811  isOpen = data.expandedFilter && data.childMatches;
812  }
813 
814  indent = data.level * 10 ;
815  if (!isParent) indent += FWTextTreeCellRenderer::iconWidth();
816  }
817  m_renderer.setIsParent(isParent);
818  m_renderer.setIsOpen(isOpen);
819  m_renderer.setIndentation(indent);
820 
821 
822  // If we are rendering the selected cell,
823  // we show the editor.
824  bool showEdit = (iCol == 1 && iSortedRowNumber == m_selectedRow && iCol == m_selectedColumn && value.size() < maxSize);
825  m_renderer.showEditor(data.editable && showEdit);
826 
827  return &m_renderer;
828 } // cellRender()
829 
830 //______________________________________________________________________________
831 
833 {
834  m_filter = filter;
835 
836  if (m_filter.empty())
837  {
838  // collapse entries when filter is removed
839  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
840  m_entries[i].expandedFilter = false;
841  }
842  else
843  {
844  // Decide whether or not items match the filter.
845  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
846  {
847  PSetData &data = m_entries[i];
848 
849  // First of all decide whether or not we match
850  // the filter.
851  if (strstr(data.label.c_str(), m_filter.c_str()) || strstr(data.value.c_str(), m_filter.c_str()) )
852  data.matches = true;
853  else
854  data.matches = false;
855  }
856 
857  // We reset whether or not a given parent has children that match the
858  // filter, and we recompute the whole information by checking all the
859  // children.
860  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
861  m_entries[i].childMatches = false;
862 
863  std::vector<int> stack;
864  int previousLevel = 0;
865  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
866  {
867  PSetData &data = m_entries[i];
868  // Top level.
869  if (data.parent == (size_t)-1)
870  {
871  previousLevel = 0;
872  // std::cout << "reset stack for top level " << data.label << std::endl;
873  stack.clear();
874  continue;
875  }
876  // If the level is greater than the previous one,
877  // it means we are among the children of the
878  // previous level, hence we push the parent to
879  // the stack.
880  // If the level is not greater than the previous
881  // one it means we have popped out n levels of
882  // parents, where N is the difference between the
883  // new and the old level. In this case we
884  // pop up N parents from the stack.
885  if (data.level > previousLevel)
886  stack.push_back(data.parent);
887  else
888  for (size_t pi = 0, pe = previousLevel - data.level; pi != pe; ++pi)
889  stack.pop_back();
890 
891  if (data.matches && m_entries[stack.back()].childMatches == false)
892  {
893  // printf("match for %s with level %d\n",data.label.c_str(), data.level );
894  for (size_t pi = 0, pe = stack.size(); pi != pe; ++pi)
895  {
896  // printf("set child match to parent %s with level %d \n",m_entries[stack[pi]].label.c_str(), m_entries[stack[pi]].level);
897  m_entries[stack[pi]].childMatches = true;
898 
899  }
900  }
901 
902  previousLevel = data.level;
903  }
904 
905  // expand to matching children
906  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
907  m_entries[i].expandedFilter = m_entries[i].childMatches;
908 
909  }
910 
912 
913  dataChanged();
914 } // updateFilter()
915 
916 //______________________________________________________________________________
917 
919 {
920  m_row_to_index.clear();
921 
922  // Decide about visibility.
923  // * If the items are toplevel and they match the filter, they get shown
924  // in any case.
925  // * If the item or any of its children match the filter, the item
926  // is visible.
927  // * If the filter is empty and the parent is expanded.
928  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
929  {
930  PSetData &data = m_entries[i];
931  if (data.parent == ((size_t) -1))
932  {
933  data.visible = data.childMatches || data.matches || m_filter.empty();
934  }
935  else
936  {
937  if (m_filter.empty())
938  {
939  data.visible = m_entries[data.parent].expandedUser && m_entries[data.parent].visible;
940  }
941  else
942  {
943  if (data.level < 2)
944  data.visible = m_entries[data.parent].expandedFilter && m_entries[data.parent].visible && (data.matches || data.childMatches);
945  else
946  data.visible = m_entries[data.parent].expandedFilter && m_entries[data.parent].visible;
947  }
948  }
949  }
950 
951  // Put in the index only the entries which are visible.
952  for (size_t i = 0, e = m_entries.size(); i != e; ++i)
953  if (m_entries[i].visible)
954  m_row_to_index.push_back(i);
955 }
956 
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 ...
std::vector< unsigned > getVUInt32() const
Definition: Entry.cc:698
std::vector< double > getVDouble() const
Definition: Entry.cc:743
int i
Definition: DBlmapReader.cc:9
virtual FWTableCellRendererBase * cellRenderer(int iSortedRowNumber, int iCol) const
std::vector< std::string > m_availablePaths
virtual std::vector< unsigned int > maxWidthForColumns() const
for each column in the table this returns the present maximum width for that column ...
void handlePSet(const edm::ParameterSet &ps)
std::vector< unsigned long long > getVUInt64() const
Definition: Entry.cc:721
std::vector< LuminosityBlockID > getVLuminosityBlockID() const
Definition: Entry.cc:869
static TypeTrans const sTypeTranslations
std::vector< PathInfo > m_paths
std::vector< std::string > CodeMap
ParameterSet getPSet() const
Definition: Entry.cc:924
virtual bool rowIsSelected(int row) const
list parent
Definition: dbtoconf.py:74
const std::string & label
Definition: MVAComputer.cc:186
int getInt32() const
Definition: Entry.cc:640
virtual void implSort(int, bool)
Called by &#39;sort&#39; method to actually handle the sorting of the rows. Arguments are the same as &#39;sort&#39;...
FWTextTreeCellRenderer m_renderer
unsigned getUInt32() const
Definition: Entry.cc:687
std::vector< size_t > m_parentStack
std::vector< InputTag > getVInputTag() const
Definition: Entry.cc:800
std::vector< int > & rowToIndex()
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::string relativePath() const
Definition: FileInPath.cc:151
std::vector< ModuleInfo > m_modules
LuminosityBlockRange getLuminosityBlockRange() const
Definition: Entry.cc:879
void handleVPSetEntry(const edm::VParameterSetEntry &entry, const std::string &key)
std::string encode() const
Definition: InputTag.cc:72
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:732
std::vector< EventID > getVEventID() const
Definition: Entry.cc:846
std::map< std::string, int, std::less< std::string > > psi
virtual const std::string title() const
int path() const
Definition: HLTadd.h:3
const std::string * pathName() const
Definition: HLTadd.h:31
unsigned long long getUInt64() const
Definition: Entry.cc:710
std::map< std::string, size_t > m_pathIndex
ParameterSet const & pset() const
std::vector< PSetData > & data()
static const TGGC & getDefaultGC()
tuple maxSize
&#39;/store/data/Commissioning08/BeamHalo/RECO/StuffAlmostToP5_v1/000/061/642/10A0FE34-A67D-DD11-AD05-000...
std::vector< int > m_row_to_index
std::vector< PSetData > m_entries
bool isTracked() const
Definition: Entry.h:168
std::pair< std::string, MonitorElement * > entry
Definition: ME_MAP.h:8
void setHighlightContext(const TGGC *context)
std::vector< ParameterSet > getVPSet() const
Definition: Entry.cc:935
virtual void setCellEditor(TGTextEntry *editor)
stack
Definition: svgfig.py:558
virtual std::vector< std::string > getTitles() const
returns the title names for each column
bool getBool() const
Definition: Entry.cc:628
InputTag getInputTag() const
Definition: Entry.cc:788
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
std::vector< long long > getVInt64() const
Definition: Entry.cc:674
std::vector< ESInputTag > getVESInputTag() const
Definition: Entry.cc:824
void setGraphicsContext(const TGGC *iContext)
FWPSetCellEditor * m_editor
std::vector< EventRange > getVEventRange() const
Definition: Entry.cc:912
virtual void setIndentation(int indentation=0)
void updateSchedule(const edm::ScheduleInfo *info)
tuple tags
Definition: o2o.py:248
void createScalarString(PSetData &data, T v)
void setData(const std::string &, bool isSelected)
FileInPath getFileInPath() const
Definition: Entry.cc:777
psettable const & psetTable() const
Definition: ParameterSet.h:250
virtual void updateFilter(const char *filter)
tuple filter
USE THIS FOR SKIMMED TRACKS process.p = cms.Path(process.hltLevel1GTSeed*process.skimming*process.offlineBeamSpot*process.TrackRefitter2) OTHERWISE USE THIS.
Definition: align_tpl.py:86
const edm::ParameterSet * parametersForModule(const std::string &iLabel) const
Definition: ScheduleInfo.cc:83
std::string encode() const
Definition: ESInputTag.cc:91
#define fwLog(_level_)
Definition: fwLog.h:51
tuple editor
Definition: idDealer.py:73
std::vector< int > getVInt32() const
Definition: Entry.cc:651
void setCellValueEditor(FWPSetCellEditor *editor)
std::map< std::string, Entry > table
Definition: ParameterSet.h:246
LuminosityBlockID getLuminosityBlockID() const
Definition: Entry.cc:858
const TGGC & italicGC()
list key
Definition: combine.py:13
vpsettable const & vpsetTable() const
Definition: ParameterSet.h:253
EventRange getEventRange() const
Definition: Entry.cc:901
void update(std::vector< PathUpdate > &pathUpdates)
void visualPropertiesChanged()
Classes which inherit from FWTableManagerBase must call this when how the data is shown (e...
const TGGC & boldGC()
virtual int unsortedRowNumber(int unsorted) const
when passed the index to the sorted order of the rows it returns the original row number from the und...
std::vector< LuminosityBlockRange > getVLuminosityBlockRange() const
Definition: Entry.cc:890
void handlePSetEntry(const edm::ParameterSetEntry &entry, const std::string &key)
void setSelection(int row, int column, int mask)
char typeCode() const
Definition: Entry.h:170
ESInputTag getESInputTag() const
Definition: Entry.cc:812
virtual unsigned int cellHeight() const
require all cells to be the same height
double pi
table const & tbl() const
Definition: ParameterSet.h:247
long double T
virtual int numberOfColumns() const
Number of columns in the table.
Definition: vlib.h:209
Table table_
Definition: Actions.cc:23
virtual int numberOfRows() const
Number of rows in the table.
std::vector< std::string > getVString() const
Definition: Entry.cc:765
mathSSE::Vec4< T > v
void availablePaths(std::vector< std::string > &oLabelsToFill) const
adds to oLabelsToFill the labels for all paths in the process
Definition: ScheduleInfo.cc:99
std::string getString() const
Definition: Entry.cc:754
virtual void showEditor(bool value)
EventID getEventID() const
Definition: Entry.cc:835