CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 {
40  FWEventSelector* m_selector; // owned by navigator
42 
44  ~Filter() { delete m_eventList; }
45 
46  bool hasSelectedEvents() { return m_eventList && m_eventList->GetN(); }
47  };
48 
49  FWFileEntry(const std::string& name, bool checkVersion, bool checkGlobalTag);
50  virtual ~FWFileEntry();
51 
52  TFile* file() { return m_file; }
53  fwlite::Event* event() { return m_event; }
54  TTree* tree() { return m_eventTree; }
57 
58  std::list<Filter*>& filters() { return m_filterEntries; }
59 
60  const std::string& getGlobalTag() const { return m_globalTag; }
61 
62  void openFile(bool, bool);
63  void closeFile();
64 
65  bool isEventSelected(int event);
66 
67  bool hasSelectedEvents();
68 
69  bool hasActiveFilters();
70 
71  int firstSelectedEvent();
72  int lastSelectedEvent();
73 
74  int lastEvent() { return m_eventTree->GetEntries() - 1; }
75 
76  int nextSelectedEvent(int event);
78 
79  void needUpdate() { m_needUpdate = true; }
80  void updateFilters(const FWEventItemsManager* eiMng, bool isOR);
81 
82  // CallIns from FWEventItemsManager for tree-cache add/remove branch
83  void NewEventItemCallIn(const FWEventItem* it);
84  void RemovingEventItemCallIn(const FWEventItem* it);
85 
86  FWFileEntry(const FWFileEntry&) = delete; // stop default
87  const FWFileEntry& operator=(const FWFileEntry&) = delete; // stop default
88 
89 private:
90  void runFilter(Filter* fe, const FWEventItemsManager* eiMng);
92 
93  std::string getBranchName(const FWEventItem* it) const;
94 
96  TFile* m_file;
97  TTree* m_eventTree;
99 
100  bool m_needUpdate; // To be set in navigator::filterChanged/Added, newFile
102 
103  std::list<Filter*> m_filterEntries;
105 };
106 #endif
TTree * tree()
Definition: FWFileEntry.h:54
void closeFile()
Definition: FWFileEntry.cc:214
Filter(FWEventSelector *s)
Definition: FWFileEntry.h:43
FWEventSelector * m_selector
Definition: FWFileEntry.h:40
FWFileEntry(const std::string &name, bool checkVersion, bool checkGlobalTag)
Definition: FWFileEntry.cc:35
int lastSelectedEvent()
Definition: FWFileEntry.cc:243
FWTEventList * globalSelection()
Definition: FWFileEntry.h:55
void RemovingEventItemCallIn(const FWEventItem *it)
Definition: FWFileEntry.cc:569
bool hasSelectedEvents()
Definition: FWFileEntry.h:46
bool hasSelectedEvents()
Definition: FWFileEntry.cc:233
const FWFileEntry & operator=(const FWFileEntry &)=delete
std::string getBranchName(const FWEventItem *it) const
Definition: FWFileEntry.cc:553
FWTEventList * m_eventList
Definition: FWFileEntry.h:39
const std::string & getGlobalTag() const
Definition: FWFileEntry.h:60
TFile * file()
Definition: FWFileEntry.h:52
bool isEventSelected(int event)
Definition: FWFileEntry.cc:228
std::list< Filter * > m_filterEntries
Definition: FWFileEntry.h:103
fwlite::Event * event()
Definition: FWFileEntry.h:53
bool filterEventsWithCustomParser(Filter *filter)
Definition: FWFileEntry.cc:456
std::list< Filter * > & filters()
Definition: FWFileEntry.h:58
TFile * m_file
Definition: FWFileEntry.h:96
virtual ~FWFileEntry()
Definition: FWFileEntry.cc:46
void openFile(bool, bool)
Definition: FWFileEntry.cc:53
bool m_needUpdate
Definition: FWFileEntry.h:100
TTree * m_eventTree
Definition: FWFileEntry.h:97
fwlite::Event * m_event
Definition: FWFileEntry.h:98
int firstSelectedEvent()
Definition: FWFileEntry.cc:235
void runFilter(Filter *fe, const FWEventItemsManager *eiMng)
Definition: FWFileEntry.cc:327
int nextSelectedEvent(int event)
Definition: FWFileEntry.cc:250
void updateFilters(const FWEventItemsManager *eiMng, bool isOR)
Definition: FWFileEntry.cc:291
FWTTreeCache * fwTreeCache()
Definition: FWFileEntry.cc:547
FWTEventList * m_globalEventList
Definition: FWFileEntry.h:104
bool hasActiveFilters()
Definition: FWFileEntry.cc:281
std::string m_name
Definition: FWFileEntry.h:95
std::string m_globalTag
Definition: FWFileEntry.h:101
int previousSelectedEvent(int event)
Definition: FWFileEntry.cc:264
void NewEventItemCallIn(const FWEventItem *it)
Definition: FWFileEntry.cc:560
int lastEvent()
Definition: FWFileEntry.h:74
void needUpdate()
Definition: FWFileEntry.h:79