CMS 3D CMS Logo

CmsShowNavigator.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 #ifndef Fireworks_Core_CmsShowNavigator_h
3 #define Fireworks_Core_CmsShowNavigator_h
4 //
5 // Package: newVersion
6 // Class : CmsShowNavigator
7 //
8 
9 // system include files
10 #include <string>
11 #include <sigc++/sigc++.h>
12 
13 // user include files
18 
20 
21 #include "TEventList.h"
22 
23 // forward declarations
24 class TEventList;
25 class CSGAction;
26 class CmsShowMain;
27 class TFile;
28 class TGWindow;
29 class FWGUIEventFilter;
30 
31 namespace edm {
32  class EventBase;
33  class EventID;
34 }
35 
37 {
38 public:
39  enum EFilterState { kOff, kOn, kWithdrawn };
40  enum EFilterMode { kOr = 1, kAnd = 2 };
41 
42 private:
43  typedef std::list<FWFileEntry*> FQBase_t;
44  typedef FQBase_t::iterator FQBase_i;
45 
46 
47  struct FileQueue_t : public FQBase_t
48  {
49  struct iterator : public FQBase_i
50  {
51  private:
52  bool m_isSet;
53 
54  public:
55  iterator() : m_isSet(false) {}
56  iterator(FQBase_i i) : FQBase_i(i), m_isSet(true) {}
57 
58  bool isSet() const { return m_isSet; }
59 
61  {
62  // Go back one element, set to end() when falling off the end.
63  if (*this == cont.begin())
64  *this = cont.end();
65  else
66  FQBase_i::operator--();
67  return *this;
68  }
69  };
70 
71  FileQueue_t() : FQBase_t() {}
72 
75  };
76 
78 
79 public:
81  virtual ~CmsShowNavigator();
82 
83  //configuration management interface
84  virtual void addTo(FWConfiguration&) const;
85  virtual void setFrom(const FWConfiguration&);
86 
87  Int_t realEntry(Int_t rawEntry);
88  bool openFile(const std::string& fileName);
89  bool appendFile(const std::string& fileName, bool checkFileQueueSize, bool live);
90 
91  virtual void nextEvent();
92  virtual void previousEvent();
93  virtual bool nextSelectedEvent();
94  virtual bool previousSelectedEvent();
95  virtual void firstEvent();
96  virtual void lastEvent();
98  void goTo(FileQueue_i fi, int event);
99 
100  void eventFilterEnableCallback(Bool_t);
101  void filterEvents();
102  void filterEventsAndReset();
103 
104  void setMaxNumberOfFilesToChain( unsigned int i ) {
105  m_maxNumberOfFilesToChain = i;
106  }
107 
108  virtual bool isLastEvent();
109  virtual bool isFirstEvent();
110 
111  void showEventFilterGUI(const TGWindow* p);
112  void applyFiltersFromGUI();
113  void toggleFilterEnable();
114  void withdrawFilter();
115  void resumeFilter();
116 
117  virtual const edm::EventBase* getCurrentEvent() const;
118 
119  const char* frameTitle();
120  const char* filterStatusMessage();
121  int getNSelectedEvents();
122  int getNTotalEvents();
123  bool canEditFiltersExternally();
124  bool filesNeedUpdate() const { return m_filesNeedUpdate; }
125  int getFilterState() { return m_filterState; }
126 
127  void editFiltersExternally();
128 
129  void activateNewFileOnNextEvent() { m_newFileOnNextEvent = true; }
130  void resetNewFileOnNextEvent() { m_newFileOnNextEvent = false; }
131 
132  std::vector<std::string>& getProcessList() const;
133 
134  sigc::signal<void, const TFile*> fileChanged_;
135  sigc::signal<void> preFiltering_;
136  sigc::signal<void, bool> postFiltering_;
137  sigc::signal<void, bool> editFiltersExternally_;
138  sigc::signal<void, int> filterStateChanged_;
139 
140 private:
141  CmsShowNavigator(const CmsShowNavigator&); // stop default
142  const CmsShowNavigator& operator=(const CmsShowNavigator&); // stop default
143 
144  void setCurrentFile(FileQueue_i);
145  void updateFileFilters();
146  void updateSelectorsInfo();
147 
148  void removeFilter(std::list<FWEventSelector*>::iterator);
149  void addFilter(FWEventSelector*);
150  void changeFilter(FWEventSelector*, bool filterNeedUpdate);
151 
152  void newFile(FileQueue_i);
153 
154  // ---------- member data --------------------------------
155 
156  std::list<FWEventSelector*> m_selectors;
158  FileQueue_i m_currentFile;
160 
165 
167  // entry is an event index nubmer which runs from 0 to
168  // #events or #selected_events depending on if we filter
169  // events or not
172 };
173 
174 #endif
EFilterState m_filterState
const CmsShowMain & m_main
sigc::signal< void, bool > editFiltersExternally_
unsigned int m_maxNumberOfFilesToChain
bool filesNeedUpdate() const
unsigned long long EventNumber_t
void resetNewFileOnNextEvent()
FileQueue_t::iterator FileQueue_i
unsigned int LuminosityBlockNumber_t
std::list< FWFileEntry * > FQBase_t
sigc::signal< void > preFiltering_
FWGUIEventFilter * m_guiFilter
void activateNewFileOnNextEvent()
FileQueue_i m_currentFile
sigc::signal< void, bool > postFiltering_
#define end
Definition: vmac.h:37
sigc::signal< void, const TFile * > fileChanged_
#define begin
Definition: vmac.h:30
HLT enums.
FQBase_t::iterator FQBase_i
void setMaxNumberOfFilesToChain(unsigned int i)
unsigned int RunNumber_t
std::list< FWEventSelector * > m_selectors
sigc::signal< void, int > filterStateChanged_
iterator & previous(FileQueue_t &cont)
Definition: event.py:1