14 #include "boost/regex.hpp"
19 #include "TGTextEntry.h"
20 #include "TGNumberEntry.h"
24 #include "TApplication.h"
53 m_filesNeedUpdate(
true),
54 m_newFileOnNextEvent(
false),
56 m_maxNumberOfFilesToChain(1),
59 m_guiFilter(nullptr) {
76 fwLog(
fwlog::kError) <<
"Navigator::openFile ecaught exception FWFileEntry constructor " << iException.what()
104 fwLog(
fwlog::kError) <<
"Navigator::openFile caught exception " << iException.what() << std::endl;
115 fwLog(
fwlog::kError) <<
"Navigator::appendFile caught exception FWFileEntry constructor " << iException.what()
122 if (checkFileQueueSize) {
124 while (toErase > 0) {
155 std::cerr <<
"Navigator::openFile caught exception " << iException.what() << std::endl;
173 fwLog(
fwlog::kDebug) <<
"CmsShowNavigator::setCurrentFile [" << (*fi)->file()->GetName() <<
"] file idx in chain ["
174 << cnt <<
"/" <<
m_files.size() - 1 <<
"]" << std::endl;
176 fwLog(
fwlog::kInfo) <<
"Set current file to " << (*fi)->file()->GetName() <<
".\n";
188 int total = (*fi)->tree()->GetEntries();
195 gSystem->GetCpuInfo(&cpuInfo, 0);
196 gSystem->GetMemInfo(&memInfo);
197 gSystem->GetProcInfo(&procInfo);
205 fwLog(
fwlog::kDebug) <<
"procInfo.fMemResident\t" << procInfo.fMemResident << std::endl;
206 fwLog(
fwlog::kDebug) <<
"procInfo.fMemVirtual\t" << procInfo.fMemVirtual << std::endl;
212 printf(
"FWTTreeCache statistics before going to event %d:\n",
event);
213 (*m_currentFile)->tree()->PrintCacheStats();
216 (*m_currentFile)->event()->to(
event);
217 (*m_currentFile)->tree()->LoadTree(
event);
239 if ((*x)->hasSelectedEvents()) {
240 goTo(
x, (*x)->firstSelectedEvent());
255 if ((*x)->hasSelectedEvents()) {
256 goTo(
x, (*x)->lastSelectedEvent());
262 goTo(
x, (*x)->lastEvent());
277 if ((*i)->hasSelectedEvents()) {
278 goTo(
i, (*i)->firstSelectedEvent());
295 goTo(
last, (*last)->firstSelectedEvent());
322 int prevEv = (*m_currentFile)->previousSelectedEvent(
m_currentEvent);
330 if ((*i)->hasSelectedEvents()) {
331 goTo(
i, (*i)->lastSelectedEvent());
353 goTo(
x, (*x)->lastEvent());
394 std::list<FWFileEntry::Filter>::iterator it;
397 (*file)->needUpdate();
406 bool changeCurrentEvent = !(*m_currentFile)->isEventSelected(
m_currentEvent);
407 if (changeCurrentEvent) {
428 fwLog(
fwlog::kDebug) <<
"CmsShowNavigator::removeFilter " << (*si)->m_expression << std::endl;
430 std::list<FWFileEntry::Filter*>::iterator it;
432 for (it = (*file)->filters().begin(); it != (*file)->filters().end(); ++it) {
433 if ((*it)->m_selector == *si) {
436 (*file)->filters().erase(it);
462 std::list<FWFileEntry::Filter*>::iterator it;
464 for (it = (*file)->filters().begin(); it != (*file)->filters().end(); ++it) {
465 if ((*it)->m_selector == selector) {
467 (*it)->m_needsUpdate =
true;
468 (*it)->m_selector->m_expression = selector->
m_expression;
487 std::list<FWEventSelector*>::iterator si =
m_selectors.begin();
503 if (*si == (*gi)->origSelector()) {
506 bool filterNeedUpdate =
o->m_expression !=
g->m_expression;
507 if (filterNeedUpdate ||
o->m_enabled !=
g->m_enabled) {
511 o->m_description =
g->m_description;
515 }
else if ((*gi)->origSelector() ==
nullptr) {
537 if ((*file)->hasSelectedEvents()) {
538 firstSelectedFile =
file;
557 if ((*file)->hasSelectedEvents())
558 lastSelectedFile =
file;
575 std::list<FWEventSelector*>::const_iterator
sel =
m_selectors.begin();
577 (*sel)->m_selected = 0;
578 (*sel)->m_updated =
true;
583 std::list<FWFileEntry::Filter*>::iterator
i;
585 std::list<FWFileEntry::Filter*>&
filters = (*file)->filters();
587 if ((*i)->m_eventList) {
588 (*i)->m_selector->m_selected += (*i)->m_eventList->GetN();
591 if ((*i)->m_needsUpdate)
592 (*i)->m_selector->m_updated =
false;
598 (*gs)->updateNEvents();
607 if ((*file)->globalSelection())
608 sum += (*file)->globalSelection()->GetN();
616 sum += (*file)->tree()->GetEntries();
626 return "Filtering is OFF.";
628 return "Filtering is disabled.";
632 bool haveActiveFilters =
false;
634 if ((*file)->hasActiveFilters()) {
635 haveActiveFilters =
true;
640 bool btnEnabled = haveActiveFilters;
686 int numberOfFilters = 0;
689 numberOfFilters = atoi(nfvalue->
value().c_str());
691 for (
int i = 0;
i < numberOfFilters; ++
i) {
696 std::istringstream
s(
value->value());
713 std::istringstream
s(
value->value());
721 std::istringstream
s(
value->value());
737 (*file)->filters().clear();
764 if (!(*sel)->m_triggerProcess.empty())
767 tmp.addKeyValue(Form(
"------Filter[%d]------", cnt),
filter,
true);
803 TString
name = (*m_currentFile)->file()->GetName();
804 int l =
name.Last(
'/');
806 name.Remove(0,
l + 1);
808 return Form(
"%s [%d/%d], event [%d/%d]",
813 (*m_currentFile)->lastEvent() + 1);
819 res = (*m_currentFile)->getGlobalTag();