CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/Fireworks/Core/interface/FWFileEntry.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 #ifndef Fireworks_Core_FWFileEntry_h
00003 #define Fireworks_Core_FWFileEntryr_h
00004 //
00005 // Package:     Core
00006 // Class  :     FWFileEntry
00007 // $Id: FWFileEntry.h,v 1.13 2011/06/03 23:30:50 amraktad Exp $
00008 //
00009 
00010 // system include files
00011 #include <string>
00012 #include <sigc++/sigc++.h>
00013 
00014 #include "TTree.h"
00015 
00016 // user include files
00017 // MT -- to get auxBranch
00018 #define private public
00019 #include "DataFormats/FWLite/interface/Event.h"
00020 #undef private
00021 #include "Fireworks/Core/interface/FWEventSelector.h"
00022 #include "Fireworks/Core/interface/FWTEventList.h"
00023 #include "Fireworks/Core/interface/FWConfigurable.h"
00024 
00025 // forward declarations
00026 class FWTEventList;
00027 class CSGAction;
00028 class CmsShowMain;
00029 class TFile;
00030 class TGWindow;
00031 class FWEventItemsManager;
00032 
00033 namespace edm {
00034    class EventID;
00035 }
00036 
00037 class FWFileEntry {
00038 public:
00039    struct Filter
00040    {
00041       FWTEventList*      m_eventList;
00042       FWEventSelector*   m_selector;  // owned by navigator
00043       bool               m_needsUpdate;
00044       
00045       Filter(FWEventSelector* s) : m_eventList(0), m_selector(s), m_needsUpdate(true) {}
00046       ~Filter()
00047       {
00048          delete m_eventList;
00049       }
00050 
00051       bool hasSelectedEvents()
00052       {
00053          return m_eventList && m_eventList->GetN();
00054       }
00055    };
00056    
00057    FWFileEntry(const std::string& name, bool checkVersion);
00058    virtual ~FWFileEntry();
00059       
00060    TFile*         file()  { return m_file; }
00061    fwlite::Event* event() { return m_event; }
00062    TTree*         tree()  { return m_eventTree; }
00063    FWTEventList*    globalSelection() { return m_globalEventList; }
00064    
00065    std::list<Filter*>& filters() { return m_filterEntries; }
00066    
00067    void openFile(bool);
00068    void closeFile();
00069 
00070    bool isEventSelected(int event);
00071 
00072    bool hasSelectedEvents();
00073 
00074    bool hasActiveFilters();
00075 
00076    int  firstSelectedEvent();
00077    int  lastSelectedEvent();
00078 
00079    int  lastEvent() { return m_eventTree->GetEntries() -1; }
00080 
00081    int  nextSelectedEvent(int event);
00082    int  previousSelectedEvent(int event);
00083 
00084    void needUpdate() { m_needUpdate = true; }
00085    void updateFilters(const FWEventItemsManager* eiMng, bool isOR);
00086 
00087 private:
00088    FWFileEntry(const FWFileEntry&);    // stop default
00089    const FWFileEntry& operator=(const FWFileEntry&);    // stop default
00090    
00091    void runFilter(Filter* fe, const FWEventItemsManager* eiMng);
00092    bool filterEventsWithCustomParser(Filter* filter);
00093 
00094    std::string            m_name;
00095    TFile*                 m_file;
00096    TTree*                 m_eventTree;
00097    fwlite::Event*         m_event;
00098    
00099    bool                   m_needUpdate; // To be set in navigator::filterChanged/Added, newFile
00100    
00101    std::list<Filter*>     m_filterEntries;
00102    FWTEventList*          m_globalEventList;
00103 };
00104 #endif