CMS 3D CMS Logo

CmsShowNavigator.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: newVersion
4 // Class : CmsShowNavigator
5 //
6 
9 
11 
12 // system include files
13 #include "boost/bind.hpp"
14 #include "boost/regex.hpp"
15 #include "TROOT.h"
16 #include "TTree.h"
17 #include "TFile.h"
18 #include "TError.h"
19 #include "TGTextEntry.h"
20 #include "TGNumberEntry.h"
21 #include "TBranch.h"
22 #include "TAxis.h"
23 
24 #include "TApplication.h"
25 #include "TSystem.h"
26 #include "TObject.h"
27 
28 // user include files
40 
42 
43 //
44 // constructors and destructor
45 //
47  FWNavigatorBase(main),
48  m_currentEvent(0),
49 
50  m_filterState(kOff),
51  m_filterMode(kOr),
52 
53  m_filesNeedUpdate(true),
54  m_newFileOnNextEvent(false),
55 
56  m_maxNumberOfFilesToChain(1),
57 
58  m_main(main),
59  m_guiFilter(nullptr)
60 {
61  m_guiFilter = new FWGUIEventFilter(this);
63 }
64 
66 {
67  delete m_guiFilter;
68 }
69 
70 //
71 // member functions
72 //
73 
74 bool
76 {
77  fwLog(fwlog::kDebug) << "CmsShowNavigator::openFile [" << fileName << "]" << std::endl;
78  FWFileEntry* newFile = nullptr;
79  try
80  {
81  newFile = new FWFileEntry(fileName, m_main.getVersionCheck());
82  }
83  catch (std::exception& iException)
84  {
85  fwLog(fwlog::kError) <<"Navigator::openFile ecaught exception FWFileEntry constructor " << iException.what()<<std::endl;
86 
87  delete newFile;
88  return false;
89  }
90 
91  try
92  {
93  // delete all previous files
94  while ( !m_files.empty() )
95  {
96  FWFileEntry* file = m_files.front();
97  m_files.pop_front();
98  file->closeFile();
99  delete file;
100  }
101 
102  m_files.push_back(newFile);
104 
105  // set filters
106  for (std::list<FWEventSelector*>::iterator i = m_selectors.begin(); i != m_selectors.end(); ++i)
107  newFile->filters().push_back(new FWFileEntry::Filter(*i));
108 
109  if (m_filterState != kOff)
111 
112  return true;
113  }
114  catch (std::exception& iException)
115  {
116  fwLog(fwlog::kError) <<"Navigator::openFile caught exception "<<iException.what()<<std::endl;
117  return false;
118  }
119 }
120 
121 bool
122 CmsShowNavigator::appendFile(const std::string& fileName, bool checkFileQueueSize, bool live)
123 {
124  fwLog(fwlog::kDebug) << "CmsShowNavigator::appendFile [" << fileName << "]" << std::endl;
125  FWFileEntry* newFile = nullptr;
126  try
127  {
128  newFile = new FWFileEntry(fileName, m_main.getVersionCheck());
129  }
130  catch(std::exception& iException)
131  {
132  fwLog(fwlog::kError) <<"Navigator::appendFile caught exception FWFileEntry constructor "<<iException.what()<<std::endl;
133  delete newFile;
134  return false;
135  }
136 
137  try
138  {
139  if (checkFileQueueSize)
140  {
141  int toErase = m_files.size() - (m_maxNumberOfFilesToChain + 1);
142  while (toErase > 0)
143  {
144  FileQueue_i si = m_files.begin();
145  if (m_currentFile == si)
146  si++;
147  FWFileEntry* file = *si;
148  file->closeFile();
149  delete file;
150 
151  m_files.erase(si);
152  --toErase;
153  }
154 
155  if (m_files.size() > m_maxNumberOfFilesToChain)
156  fwLog(fwlog::kWarning) << " " << m_files.size() << " chained files more than maxNumberOfFilesToChain \n" << m_maxNumberOfFilesToChain << std::endl;
157  }
158 
159  m_files.push_back(newFile);
160 
161  // Needed for proper handling of first registered file when -port option is in effect.
162  if (!m_currentFile.isSet())
164 
165  // set filters
166  for (std::list<FWEventSelector*>::iterator i = m_selectors.begin(); i != m_selectors.end(); ++i)
167  newFile->filters().push_back(new FWFileEntry::Filter(*i));
168 
169  if (m_filterState != kOff)
171 
172  }
173  catch(std::exception& iException)
174  {
175  std::cerr <<"Navigator::openFile caught exception "<<iException.what()<<std::endl;
176  return false;
177  }
178 
179  return true;
180 }
181 
182 //______________________________________________________________________________
183 
185 {
187  {
188  int cnt = 0;
189  for (FileQueue_i i = m_files.begin(); i!= m_files.end(); i++)
190  {
191  if ( i == fi) break;
192  cnt++;
193  }
194 
195  fwLog(fwlog::kDebug) << "CmsShowNavigator::setCurrentFile [" << (*fi)->file()->GetName() << "] file idx in chain [" << cnt << "/" << m_files.size() -1 << "]" << std::endl;
196  }
197  else
198  {
199  fwLog(fwlog::kInfo) << "Set current file to "<< (*fi)->file()->GetName() << ".\n";
200  }
201 
202  m_currentFile = fi;
203  fileChanged_.emit((*m_currentFile)->file());
204 }
205 
206 void
208 {
209  if (fi != m_currentFile)
210  setCurrentFile(fi);
211 
213  {
214  int total = (*fi)->tree()->GetEntries();
215  fwLog(fwlog::kDebug) << "CmsShowNavigator::goTo current file event [" << event << "/" << total -1<< "]" << std::endl;
216 
217  CpuInfo_t cpuInfo;
218  MemInfo_t memInfo;
219  ProcInfo_t procInfo;
220  gSystem->GetCpuInfo(&cpuInfo, 0);
221  gSystem->GetMemInfo(&memInfo);
222  gSystem->GetProcInfo(&procInfo);
223 
224  time_t curtime;
225  time(&curtime);
226 
227  fwLog(fwlog::kDebug) << "Current Time: " << ctime(&curtime);
228  fwLog(fwlog::kDebug) << "memInfo.fMemUsed \t" << memInfo.fMemUsed << std::endl;
229  fwLog(fwlog::kDebug) << "memInfo.fSwapUsed\t" << memInfo.fSwapUsed << std::endl;
230  fwLog(fwlog::kDebug) << "procInfo.fMemResident\t" << procInfo.fMemResident << std::endl;
231  fwLog(fwlog::kDebug) << "procInfo.fMemVirtual\t" << procInfo.fMemVirtual << std::endl;
232  fwLog(fwlog::kDebug) << "cpuInfo.fLoad1m \t" << cpuInfo.fLoad1m << std::endl;
233  fwLog(fwlog::kDebug) << "cpuInfo.fLoad5m \t" << cpuInfo.fLoad5m << std::endl;
234  }
235 
237  {
238  printf("FWTTreeCache statistics before going to event %d:\n", event);
239  (*m_currentFile)->tree()->PrintCacheStats(); // ("cachedbranches");
240  }
241 
242  (*m_currentFile)->event()->to(event);
243  (*m_currentFile)->tree()->LoadTree(event);
245 
246  newEvent_.emit();
247 }
248 
249 void
251 {
252  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
253  {
254  Long64_t index = (*file)->event()->indexFromEventId(run, lumi, event);
255  if (index >= 0)
256  {
257  goTo(file, index);
258  break;
259  }
260  }
261 }
262 
263 //______________________________________________________________________________
264 
265 void
267 {
269  if (m_filterState == kOn)
270  {
271  while (x != m_files.end())
272  {
273  if ((*x)->hasSelectedEvents())
274  {
275  goTo(x, (*x)->firstSelectedEvent());
276  return;
277  }
278  ++x;
279  }
280  }
281  else
282  {
283  goTo(x, 0);
284  }
285 }
286 
287 void
289 {
290  FileQueue_i x = m_files.end();
291  if (m_filterState == kOn)
292  {
293  while (x != m_files.begin())
294  {
295  --x;
296  if ((*x)->hasSelectedEvents())
297  {
298  goTo(x, (*x)->lastSelectedEvent());
299  return;
300  }
301  }
302  }
303  else
304  {
305  --x;
306  goTo(x, (*x)->lastEvent());
307  }
308 }
309 
310 //______________________________________________________________________________
311 
312 bool
314 {
315  int nextEv = (*m_currentFile)->nextSelectedEvent(m_currentEvent);
316  if (nextEv > -1)
317  {
318  goTo(m_currentFile, nextEv);
319  return true;
320  }
321  else
322  {
324  while (i != m_files.end())
325  {
326  if ((*i)->hasSelectedEvents())
327  {
328  goTo(i, (*i)->firstSelectedEvent());
329  return true;
330  }
331  ++i;
332  }
333  }
334 
335  return false;
336 }
337 
338 //______________________________________________________________________________
339 
340 void
342 {
344  {
346  if (m_filterState == kOn)
347  goTo(last, (*last)->firstSelectedEvent());
348  else
349  goTo(last, 0);
350 
351  m_newFileOnNextEvent = false;
352  return;
353  }
354 
355  if (m_filterState == kOn)
356  {
358  return;
359  }
360  else
361  {
362  if (m_currentEvent < (*m_currentFile)->lastEvent())
363  {
365  }
366  else
367  {
369  if (x != m_files.end())
370  {
371  goTo(x, 0);
372  }
373  }
374  }
375 }
376 
377 //______________________________________________________________________________
378 
379 bool
381 {
382  int prevEv = (*m_currentFile)->previousSelectedEvent(m_currentEvent);
383  if (prevEv > -1)
384  {
385  goTo(m_currentFile, prevEv);
386  return true;
387  }
388  else
389  {
391  while (i != m_files.end())
392  {
393  if ((*i)->hasSelectedEvents())
394  {
395  goTo(i, (*i)->lastSelectedEvent());
396  return true;
397  }
398  i.previous(m_files);
399  }
400  }
401  return false;
402 }
403 
404 //______________________________________________________________________________
405 
406 void
408 {
409  if (m_filterState == kOn)
410  {
412  }
413  else
414  {
415  if (m_currentEvent > 0)
416  {
418  }
419  else
420  {
421  // last event in previous file
423  if (x != m_files.begin())
424  {
425  --x;
426  goTo(x, (*x)->lastEvent());
427  }
428  }
429  }
430 }
431 
432 //______________________________________________________________________________
433 
434 void
436 {
437  // callback
438 
439  fwLog(fwlog::kInfo) << "CmsShowNavigator::toggleFilterEnable filters enabled [" << ( m_filterState == kOff) << "]" << std::endl;
440 
441  if (m_filterState == kOff)
442  {
443  m_filterState = kOn;
445 
447  }
448  else
449  {
452  }
453 
455 }
456 
457 void
459 {
460  fwLog(fwlog::kInfo) << "CmsShowNavigator::witdrawFilter" << std::endl;
463 }
464 
465 void
467 {
468  fwLog(fwlog::kInfo) << "CmsShowNavigator::resumeFilter" << std::endl;
469  m_filterState = kOn;
471 }
472 
473 void
475 {
476  // run filters on files
477  std::list<FWFileEntry::Filter>::iterator it;
478  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
479  {
480  if ( m_filesNeedUpdate) (*file)->needUpdate();
481  (*file)->updateFilters(m_main.context()->eventItemsManager(), m_filterMode == kOr);
482  }
484  m_filesNeedUpdate = false;
485 
486  int nSelected = getNSelectedEvents();
487  if (nSelected)
488  {
489  // go to the nearest selected event/file
490  bool changeCurrentEvent = !(*m_currentFile)->isEventSelected(m_currentEvent);
491  if (changeCurrentEvent)
492  {
493  if (!nextSelectedEvent())
495  }
496 
497  if (m_filterState == kWithdrawn)
498  resumeFilter();
499 
500  postFiltering_.emit(changeCurrentEvent);
501  }
502  else
503  {
504  withdrawFilter();
505  }
506 
508  {
509  fwLog(fwlog::kDebug) << "CmsShowNavigator::updateFileFilters selected events over files [" << getNSelectedEvents() << "/" << getNTotalEvents() << "]" << std::endl;
510  }
511 }
512 
513 //=======================================================================
514 void
515 CmsShowNavigator::removeFilter(std::list<FWEventSelector*>::iterator si)
516 {
517  fwLog(fwlog::kDebug) << "CmsShowNavigator::removeFilter " << (*si)->m_expression << std::endl;
518 
519  std::list<FWFileEntry::Filter*>::iterator it;
520  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
521  {
522  for (it = (*file)->filters().begin(); it != (*file)->filters().end(); ++it)
523  {
524  if ((*it)->m_selector == *si)
525  {
526  FWFileEntry::Filter* f = *it;
527  delete f;
528  (*file)->filters().erase(it);
529  break;
530  }
531  }
532  }
533 
534  delete *si;
535  m_selectors.erase(si);
536  m_filesNeedUpdate = true;
537 }
538 
539 void
541 {
542  fwLog(fwlog::kDebug) << "CmsShowNavigator::addFilter " << ref->m_expression << std::endl;
543 
544  FWEventSelector* selector = new FWEventSelector(ref);
545  m_selectors.push_back(selector);
546 
547  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
548  {
549  (*file)->filters ().push_back(new FWFileEntry::Filter(selector));
550  }
551  m_filesNeedUpdate = true;
552 }
553 
554 void
555 CmsShowNavigator::changeFilter(FWEventSelector* selector, bool updateFilter)
556 {
557  fwLog(fwlog::kDebug) << "CmsShowNavigator::changeFilter " << selector->m_expression << std::endl;
558 
559  std::list<FWFileEntry::Filter*>::iterator it;
560  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
561  {
562  for (it = (*file)->filters().begin(); it != (*file)->filters().end(); ++it)
563  {
564  if ((*it)->m_selector == selector)
565  {
566  if (updateFilter) (*it)->m_needsUpdate = true;
567  (*it)->m_selector->m_expression = selector->m_expression;
568  break;
569  }
570  }
571  }
572  m_filesNeedUpdate = true;
573 }
574 
575 void
577 {
578  m_filesNeedUpdate = false;
579 
580  // check if filters are set ON
581  if (m_filterState == kOff)
582  {
583  m_filesNeedUpdate = true;
584  m_filterState = kOn;
586  }
587 
588  // compare changes and then call updateFileFilters
589  std::list<FWEventSelector*>::iterator si = m_selectors.begin();
590  std::list<FWGUIEventSelector*>::iterator gi = m_guiFilter->guiSelectors().begin();
591 
594  m_filesNeedUpdate = true;
595  }
596 
597  while (si != m_selectors.end() || gi != m_guiFilter->guiSelectors().end())
598  {
599  if (gi == m_guiFilter->guiSelectors().end() && si != m_selectors.end())
600  {
601  removeFilter(si++);
602  }
603  else if (si == m_selectors.end() && gi != m_guiFilter->guiSelectors().end() )
604  {
605  addFilter((*gi)->guiSelector());
606  (*gi)->setOrigSelector(m_selectors.back());
607  ++gi;
608  }
609  else
610  {
611  if (*si == (*gi)->origSelector())
612  {
613  FWEventSelector* g = (*gi)->guiSelector();
614  FWEventSelector* o = *si;
615  bool filterNeedUpdate = o->m_expression != g->m_expression;
616  if (filterNeedUpdate || o->m_enabled != g->m_enabled) {
617  *o = *g;
618  changeFilter(*si, filterNeedUpdate);
619  }
620  else
621  {
623  }
624  ++si; ++gi;
625  }
626  else if ((*gi)->origSelector() == nullptr)
627  {
628  addFilter((*gi)->guiSelector());
629  (*gi)->setOrigSelector(m_selectors.back());
630  ++gi;
631  }
632  else
633  {
634  removeFilter(si++);
635  }
636  }
637  }
638 
639  if ( m_filesNeedUpdate )
641 
643 
644 }
645 //______________________________________________________________________________
646 // helpers for gui state
647 
648 bool
650 {
651  if (m_filterState == kOn)
652  {
653  FileQueue_i firstSelectedFile;
654  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
655  {
656  if ((*file)->hasSelectedEvents())
657  {
658  firstSelectedFile = file;
659  break;
660  }
661  }
662 
663  if (firstSelectedFile == m_currentFile)
664  return (*m_currentFile)->firstSelectedEvent() == m_currentEvent;
665  }
666  else
667  {
668  if (m_currentFile == m_files.begin())
669  {
670  return m_currentEvent == 0;
671  }
672  }
673  return false;
674 }
675 
676 bool
678 {
679  if (m_filterState == kOn)
680  {
681  FileQueue_i lastSelectedFile;
682  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
683  {
684  if ((*file)->hasSelectedEvents())
685  lastSelectedFile = file;
686  }
687  if (lastSelectedFile == m_currentFile)
688  return (*m_currentFile)->lastSelectedEvent() == m_currentEvent;
689  }
690  else
691  {
692  FileQueue_i lastFile = m_files.end();
693  --lastFile;
694  if (m_currentFile == lastFile)
695  {
696  return (*m_currentFile)->lastEvent() == m_currentEvent;
697  }
698  }
699  return false;
700 }
701 
702 //______________________________________________________________________________
703 void
705 {
706 
707  // reset
708  std::list<FWEventSelector*>::const_iterator sel = m_selectors.begin();
709  while ( sel != m_selectors.end())
710  {
711  (*sel)->m_selected = 0;
712  (*sel)->m_updated = true;
713  ++sel;
714  }
715 
716  // loop file filters
717  std::list<FWFileEntry::Filter*>::iterator i;
718  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
719  {
720  std::list<FWFileEntry::Filter*>& filters = (*file)->filters();
721  for (i = filters.begin(); i != filters.end(); ++i)
722  {
723  if ((*i)->m_eventList)
724  {
725  (*i)->m_selector->m_selected += (*i)->m_eventList->GetN();
726  }
727 
728  if ((*i)->m_needsUpdate)
729  (*i)->m_selector->m_updated = false;
730  }
731  }
732  if (m_guiFilter)
733  {
734  std::list<FWGUIEventSelector*>::const_iterator gs = m_guiFilter->guiSelectors().begin();
735  while ( gs != m_guiFilter->guiSelectors().end())
736  {
737  (*gs)->updateNEvents();
738  ++gs;
739  }
740  }
741 }
742 
743 int
745 {
746  int sum = 0;
747  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
748  {
749  if ((*file)->globalSelection())
750  sum += (*file)->globalSelection()->GetN();
751  }
752  return sum;
753 }
754 
755 int
757 {
758  int sum = 0;
759  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
760  {
761  sum += (*file)->tree()->GetEntries();
762  }
763 
764  return sum;
765 }
766 
767 const char*
769 {
770  if (m_filterState == kOn)
771  return Form("%d events are selected from %d.", getNSelectedEvents(), getNTotalEvents());
772  else if (m_filterState == kOff)
773  return "Filtering is OFF.";
774  else
775  return "Filtering is disabled.";
776 }
777 
778 bool
780 {
781  bool haveActiveFilters = false;
782  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
783  {
784  if ((*file)->hasActiveFilters())
785  {
786  haveActiveFilters = true;
787  break;
788  }
789  }
790 
791  bool btnEnabled = haveActiveFilters;
792 
793  if (m_guiFilter && m_guiFilter->isOpen())
794  btnEnabled = false;
795 
796  return btnEnabled;
797 }
798 
799 void
801 {
803 }
804 
805 void
807 {
808  if (m_guiFilter->IsMapped())
809  {
811  }
812  else
813  {
816  }
817 }
818 
819 //______________________________________________________________________________
820 
821 void
823 {
824  m_filesNeedUpdate = true;
825 
826  EFilterState oldFilterState = m_filterState;
827 
828 
829  m_selectors.clear();
830 
831  // selectors
832  const FWConfiguration* sConf = iFrom.valueForKey("EventFilters");
833 
834  if (sConf)
835  {
836  const FWConfiguration::KeyValues* keyVals = sConf->keyValues();
837  if (keyVals) {
838  for(FWConfiguration::KeyValuesIt it = keyVals->begin(); it!= keyVals->end(); ++it)
839  {
840  const FWConfiguration& conf = (*it).second;
841  FWEventSelector* selector = new FWEventSelector();
842  selector->m_expression = conf.valueForKey("expression")->value();
843  selector->m_description = conf.valueForKey("comment")->value();
844  selector->m_enabled = atoi(conf.valueForKey("enabled")->value().c_str());
845  if (conf.valueForKey("triggerProcess"))
846  selector->m_triggerProcess = conf.valueForKey("triggerProcess")->value();
847  m_selectors.push_back(selector);
848  }
849  }
850  }
851  else
852  {
853  int numberOfFilters = 0;
854  const FWConfiguration* nfvalue = iFrom.valueForKey( "EventFilter_total" );
855  if(nfvalue)
856  numberOfFilters = atoi(nfvalue->value().c_str());
857 
858  for(int i=0; i<numberOfFilters; ++i)
859  {
860  FWEventSelector* selector = new FWEventSelector();
861  {
862  const FWConfiguration* value = iFrom.valueForKey( Form("EventFilter%d_enabled",i));
863  assert(value);
864  std::istringstream s(value->value());
865  s>>selector->m_enabled;
866  }
867  selector->m_expression = iFrom.valueForKey( Form("EventFilter%d_selection",i))->value();
868  selector->m_description = iFrom.valueForKey( Form("EventFilter%d_comment",i) )->value();
869 
870 
871  if (strstr(selector->m_expression.c_str(), "HLT"))
872  selector->m_triggerProcess = "HLT";
873 
874  m_selectors.push_back(selector);
875  }
876  }
877 
878  // filter mode
879  {
880  const FWConfiguration* value = iFrom.valueForKey( "EventFilter_mode" );
881  if (value)
882  {
883  std::istringstream s(value->value());
884  s>> m_filterMode;
885  }
886  }
887 
888  // filter on
889  {
890  const FWConfiguration* value = iFrom.valueForKey( "EventFilter_enabled" );
891  std::istringstream s(value->value());
892  int x;
893  s>> x;
894  m_filterState = x ? kOn : kOff;
895  }
896 
897 
898  // redesplay new filters in event filter dialog if already mapped
899  if (m_guiFilter)
900  {
901  m_guiFilter->reset();
903  }
904 
905  if (!m_files.empty())
906  {
907  // change filters in existing files
908  for (FileQueue_i file = m_files.begin(); file != m_files.end(); ++file)
909  {
910  (*file)->filters().clear();
911  for (std::list<FWEventSelector*>::iterator i = m_selectors.begin(); i != m_selectors.end(); ++i)
912  (*file)->filters().push_back(new FWFileEntry::Filter(*i));
913  }
914 
915 
916  // run new filters if enabled, else just reset
917  if (m_filterState == kOn)
919  else
920  postFiltering_.emit(true);
921  }
922  // update CmsShowMainFrame checkBoxIcon and button text
923  if (oldFilterState != m_filterState)
925 }
926 
927 void
929 {
930  // selectors
932  int cnt = 0;
933  for (std::list<FWEventSelector*>::const_iterator sel = m_selectors.begin(); sel != m_selectors.end(); ++sel)
934  {
936 
937  filter.addKeyValue("expression",FWConfiguration((*sel)->m_expression));
938  filter.addKeyValue("enabled", FWConfiguration((*sel)->m_enabled ? "1" : "0"));
939  filter.addKeyValue("comment", FWConfiguration((*sel)->m_description));
940 
941  if (!(*sel)->m_triggerProcess.empty())
942  filter.addKeyValue("triggerProcess",FWConfiguration((*sel)->m_triggerProcess));
943 
944  tmp.addKeyValue(Form("------Filter[%d]------", cnt), filter,true);
945  ++cnt;
946  }
947 
948  iTo.addKeyValue("EventFilters", tmp,true);
949 
950  // mode
951  {
952  std::stringstream s;
953  s<< m_filterMode;
954  iTo.addKeyValue("EventFilter_mode", s.str());
955  }
956 
957  // enabled
958  iTo.addKeyValue("EventFilter_enabled",FWConfiguration( m_filterState == kOn ? "1" : "0"));
959 }
960 
961 std::vector<std::string>&
963 {
965 }
966 
967 const edm::EventBase*
969 {
970  return m_currentFile.isSet() ? (*m_currentFile)->event() : nullptr;
971 }
972 
973 const char*
975 {
976  if (m_files.empty()) return "";
977 
978  int nf = 0;
979  for (FileQueue_t::const_iterator i = m_files.begin(); i!= m_files.end(); i++)
980  {
981 
982  if ( i == m_currentFile) break;
983  nf++;
984  }
985 
986  TString name = (*m_currentFile)->file()->GetName();
987  int l = name.Last('/');
988  if (l != kNPOS)
989  name.Remove(0, l+1);
990 
991  return Form("%s [%d/%d], event [%d/%d]", name.Data(),
992  nf+1, (int) m_files.size(),
993  m_currentEvent+1, (*m_currentFile)->lastEvent()+1);
994 }
virtual ~CmsShowNavigator()
EFilterState m_filterState
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
void closeFile()
Definition: FWFileEntry.cc:142
void showEventFilterGUI(const TGWindow *p)
const KeyValues * keyValues() const
virtual void previousEvent()
const FWEventItemsManager * eventItemsManager() const
Definition: Context.h:61
const char * frameTitle()
virtual void lastEvent()
virtual bool isFirstEvent()
const CmsShowMain & m_main
sigc::signal< void, bool > editFiltersExternally_
virtual void goToRunEvent(edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t)
unsigned int m_maxNumberOfFilesToChain
std::vector< std::string > & processNamesInJob()
unsigned long long EventNumber_t
std::string m_triggerProcess
void show(std::list< FWEventSelector * > *sels, int filterMode, int state)
virtual bool isLastEvent()
LogLevel presentLogLevel()
Definition: fwLog.cc:52
#define nullptr
const char * filterStatusMessage()
void addFilter(FWEventSelector *)
unsigned int LuminosityBlockNumber_t
std::vector< TPRegexp > filters
Definition: eve_filter.cc:22
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
FWGUIEventFilter * m_guiFilter
bool openFile(const std::string &fileName)
void newFile(FileQueue_i)
bool appendFile(const std::string &fileName, bool checkFileQueueSize, bool live)
void changeFilter(FWEventSelector *, bool filterNeedUpdate)
FileQueue_i m_currentFile
static bool IsLogging()
Definition: FWTTreeCache.cc:27
std::string m_expression
virtual void firstEvent()
CmsShowNavigator(const CmsShowMain &)
sigc::signal< void, bool > postFiltering_
double f[11][100]
void updateFilterStateLabel(int)
Definition: value.py:1
void goTo(FileQueue_i fi, int event)
sigc::signal< void, const TFile * > fileChanged_
std::list< Filter * > & filters()
Definition: FWFileEntry.h:65
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
virtual void nextEvent()
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
std::string m_description
virtual bool previousSelectedEvent()
const std::string & value(unsigned int iIndex=0) const
bool getVersionCheck() const
Definition: CmsShowMain.h:80
std::vector< std::string > & getProcessList() const
#define fwLog(_level_)
Definition: fwLog.h:50
FWJobMetadataManager * metadataManager() const
Definition: Context.h:69
virtual bool nextSelectedEvent()
KeyValues::const_iterator KeyValuesIt
std::list< FWGUIEventSelector * > & guiSelectors()
virtual const edm::EventBase * getCurrentEvent() const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
void setupDisableFilteringButton(bool)
void setCurrentFile(FileQueue_i)
Definition: main.py:1
unsigned int RunNumber_t
const FWConfiguration * valueForKey(const std::string &iKey) const
Definition: AbsArchive.cc:53
virtual void addTo(FWConfiguration &) const
std::list< FWEventSelector * > m_selectors
sigc::signal< void, int > filterStateChanged_
const fireworks::Context * context() const
Definition: CmsShowMain.h:79
iterator & previous(FileQueue_t &cont)
void removeFilter(std::list< FWEventSelector * >::iterator)
Definition: event.py:1
sigc::signal< void > newEvent_
virtual void CloseWindow()
virtual void setFrom(const FWConfiguration &)