CMS 3D CMS Logo

FWFileEntry.h
Go to the documentation of this file.
1 // -*- C++ -*-
2 #ifndef Fireworks_Core_FWFileEntry_h
3 #define Fireworks_Core_FWFileEntry_h
4 //
5 // Package: Core
6 // Class : FWFileEntry
7 //
8 
9 // system include files
10 #include <string>
11 #include <sigc++/sigc++.h>
12 
13 #include "TTree.h"
14 
15 // user include files
16 // MT -- to get auxBranch
21 
22 // forward declarations
23 class FWEventItem;
24 class FWTEventList;
25 class FWTTreeCache;
26 class CSGAction;
27 class CmsShowMain;
28 class TFile;
29 class TGWindow;
31 
32 namespace edm {
33  class EventID;
34 }
35 
36 class FWFileEntry {
37 public:
38  struct Filter
39  {
41  FWEventSelector* m_selector; // owned by navigator
43 
44  Filter(FWEventSelector* s) : m_eventList(nullptr), m_selector(s), m_needsUpdate(true) {}
46  {
47  delete m_eventList;
48  }
49 
51  {
52  return m_eventList && m_eventList->GetN();
53  }
54  };
55 
56  FWFileEntry(const std::string& name, bool checkVersion);
57  virtual ~FWFileEntry();
58 
59  TFile* file() { return m_file; }
60  fwlite::Event* event() { return m_event; }
61  TTree* tree() { return m_eventTree; }
62  FWTEventList* globalSelection() { return m_globalEventList; }
63  FWTTreeCache* fwTreeCache();
64 
65  std::list<Filter*>& filters() { return m_filterEntries; }
66 
67  void openFile(bool);
68  void closeFile();
69 
70  bool isEventSelected(int event);
71 
72  bool hasSelectedEvents();
73 
74  bool hasActiveFilters();
75 
76  int firstSelectedEvent();
77  int lastSelectedEvent();
78 
79  int lastEvent() { return m_eventTree->GetEntries() -1; }
80 
81  int nextSelectedEvent(int event);
82  int previousSelectedEvent(int event);
83 
84  void needUpdate() { m_needUpdate = true; }
85  void updateFilters(const FWEventItemsManager* eiMng, bool isOR);
86 
87  // CallIns from FWEventItemsManager for tree-cache add/remove branch
88  void NewEventItemCallIn(const FWEventItem* it);
89  void RemovingEventItemCallIn(const FWEventItem* it);
90 
91 private:
92  FWFileEntry(const FWFileEntry&) = delete; // stop default
93  const FWFileEntry& operator=(const FWFileEntry&) = delete; // stop default
94 
95  void runFilter(Filter* fe, const FWEventItemsManager* eiMng);
96  bool filterEventsWithCustomParser(Filter* filter);
97 
98  std::string getBranchName(const FWEventItem *it) const;
99 
101  TFile* m_file;
102  TTree* m_eventTree;
104 
105  bool m_needUpdate; // To be set in navigator::filterChanged/Added, newFile
106 
107  std::list<Filter*> m_filterEntries;
109 };
110 #endif
TTree * tree()
Definition: FWFileEntry.h:61
Filter(FWEventSelector *s)
Definition: FWFileEntry.h:44
FWEventSelector * m_selector
Definition: FWFileEntry.h:41
FWTEventList * globalSelection()
Definition: FWFileEntry.h:62
bool hasSelectedEvents()
Definition: FWFileEntry.h:50
#define nullptr
FWTEventList * m_eventList
Definition: FWFileEntry.h:40
TFile * file()
Definition: FWFileEntry.h:59
std::list< Filter * > m_filterEntries
Definition: FWFileEntry.h:107
fwlite::Event * event()
Definition: FWFileEntry.h:60
std::list< Filter * > & filters()
Definition: FWFileEntry.h:65
TFile * m_file
Definition: FWFileEntry.h:101
bool m_needUpdate
Definition: FWFileEntry.h:105
TTree * m_eventTree
Definition: FWFileEntry.h:102
fwlite::Event * m_event
Definition: FWFileEntry.h:103
Definition: Filter.py:1
HLT enums.
FWTEventList * m_globalEventList
Definition: FWFileEntry.h:108
std::string m_name
Definition: FWFileEntry.h:100
Definition: event.py:1
int lastEvent()
Definition: FWFileEntry.h:79
void needUpdate()
Definition: FWFileEntry.h:84