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());
702 if (strstr(
selector->m_expression.c_str(),
"HLT"))
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();
int getNSelectedEvents() override
EFilterState m_filterState
sigc::signal< void()> newEvent_
std::vector< std::string > & getProcessList() const
void showEventFilterGUI(const TGWindow *p)
const FWEventItemsManager * eventItemsManager() const
const char * frameTitle()
const CmsShowMain & m_main
void removeFilter(std::list< FWEventSelector *>::iterator)
unsigned int m_maxNumberOfFilesToChain
unsigned long long EventNumber_t
const edm::EventBase * getCurrentEvent() const override
LogLevel presentLogLevel()
FWJobMetadataManager * metadataManager() const
const char * filterStatusMessage()
void addFilter(FWEventSelector *)
unsigned int LuminosityBlockNumber_t
std::vector< TPRegexp > filters
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
FWGUIEventFilter * m_guiFilter
bool openFile(const std::string &fileName)
void newFile(FileQueue_i)
bool appendFile(const std::string &fileName, bool checkFileQueueSize, bool live)
const std::string & value(unsigned int iIndex=0) const
bool nextSelectedEvent() override
bool isFirstEvent() override
bool isLastEvent() override
void changeFilter(FWEventSelector *, bool filterNeedUpdate)
FileQueue_i m_currentFile
bool m_newFileOnNextEvent
void applyFiltersFromGUI()
int getNTotalEvents() override
bool previousSelectedEvent() override
void goToRunEvent(edm::RunNumber_t, edm::LuminosityBlockNumber_t, edm::EventNumber_t) override
void nextEvent() override
CmsShowNavigator(const CmsShowMain &)
void updateFilterStateLabel(int)
bool getVersionCheck() const
void goTo(FileQueue_i fi, int event)
void editFiltersExternally()
sigc::signal< void(const TFile *)> fileChanged_
bool canEditFiltersExternally()
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
FWConfiguration & addKeyValue(const std::string &, const FWConfiguration &)
sigc::signal< void(int)> filterStateChanged_
void updateSelectorsInfo()
void show(std::list< FWEventSelector *> *sels, int filterMode, int state)
void lastEvent() override
void CloseWindow() override
void setFrom(const FWConfiguration &) override
bool getGlobalTagCheck() const
KeyValues::const_iterator KeyValuesIt
const FWConfiguration * valueForKey(const std::string &iKey) const
std::list< FWGUIEventSelector * > & guiSelectors()
void addTo(FWConfiguration &) const override
void previousEvent() override
void toggleFilterEnable()
std::string getCurrentGlobalTag()
void setupDisableFilteringButton(bool)
void setCurrentFile(FileQueue_i)
void firstEvent() override
std::list< FWEventSelector * > m_selectors
const KeyValues * keyValues() const
sigc::signal< void(bool)> editFiltersExternally_
const fireworks::Context * context() const
sigc::signal< void(bool)> postFiltering_
~CmsShowNavigator() override