CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/DataFormats/FWLite/interface/Event.h

Go to the documentation of this file.
00001 #ifndef DataFormats_FWLite_Event_h
00002 #define DataFormats_FWLite_Event_h
00003 // -*- C++ -*-
00004 //
00005 // Package:     FWLite
00006 // Class  :     Event
00007 //
00040 //
00041 // Original Author:  Chris Jones
00042 //         Created:  Tue May  8 15:01:20 EDT 2007
00043 //
00044 #if !defined(__CINT__) && !defined(__MAKECINT__)
00045 // system include files
00046 #include <typeinfo>
00047 #include <map>
00048 #include <vector>
00049 #include <memory>
00050 #include <cstring>
00051 #include <string>
00052 #include "boost/shared_ptr.hpp"
00053 
00054 #include "Rtypes.h"
00055 
00056 // user include files
00057 #include "DataFormats/FWLite/interface/EventBase.h"
00058 #include "DataFormats/FWLite/interface/EntryFinder.h"
00059 #include "DataFormats/FWLite/interface/LuminosityBlock.h"
00060 #include "DataFormats/FWLite/interface/Run.h"
00061 #include "DataFormats/FWLite/interface/InternalDataKey.h"
00062 #include "DataFormats/Provenance/interface/ProcessHistoryRegistry.h"
00063 #include "DataFormats/Provenance/interface/EventProcessHistoryID.h"
00064 #include "DataFormats/Provenance/interface/EventAuxiliary.h"
00065 #include "DataFormats/Provenance/interface/EventID.h"
00066 
00067 // forward declarations
00068 namespace edm {
00069    class EDProduct;
00070    class ProductRegistry;
00071    class BranchDescription;
00072    class EDProductGetter;
00073    class EventAux;
00074    class Timestamp;
00075    class TriggerResults;
00076    class TriggerNames;
00077    class TriggerResultsByName;
00078 }
00079 class TCut;
00080 
00081 namespace fwlite {
00082    class BranchMapReader;
00083    class HistoryGetterBase;
00084    class DataGetterHelper;
00085    class RunFactory;
00086    class Event : public EventBase
00087    {
00088 
00089       public:
00090          // NOTE: Does NOT take ownership so iFile must remain around
00091          // at least as long as Event
00092          Event(TFile* iFile);
00093          virtual ~Event();
00094 
00096          const Event& operator++();
00097 
00099          Long64_t indexFromEventId(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event);
00100 
00102          bool to (Long64_t iIndex);
00103 
00105          bool to(const edm::EventID &id);
00106          bool to(edm::RunNumber_t run, edm::EventNumber_t event);
00107          bool to(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event);
00108 
00110          const Event& toBegin();
00111       
00112          // ---------- const member functions ---------------------
00114          virtual const std::string getBranchNameFor(const std::type_info&,
00115                                                     const char* iModuleLabel,
00116                                                     const char* iProductInstanceLabel,
00117                                                     const char* iProcessName) const;
00118 
00119          using fwlite::EventBase::getByLabel;
00121          virtual bool getByLabel(const std::type_info&, const char*, const char*, const char*, void*) const;
00122          //void getByBranchName(const std::type_info&, const char*, void*&) const;
00123 
00125          void       draw(Option_t* opt);
00126          Long64_t   draw(const char* varexp, const TCut& selection, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0);
00127          Long64_t   draw(const char* varexp, const char* selection, Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0); 
00128          Long64_t   scan(const char* varexp = "", const char* selection = "", Option_t* option = "", Long64_t nentries = 1000000000, Long64_t firstentry = 0);
00129 
00130          bool isValid() const;
00131          operator bool () const;
00132          virtual bool atEnd() const;
00133 
00135          Long64_t size() const;
00136 
00137          virtual edm::EventAuxiliary const& eventAuxiliary() const;
00138 
00139          const std::vector<edm::BranchDescription>& getBranchDescriptions() const {
00140             return branchMap_.getBranchDescriptions();
00141          }
00142          const std::vector<std::string>& getProcessHistory() const;
00143          TFile* getTFile() const {
00144             return branchMap_.getFile();
00145          }
00146 
00147          edm::EDProduct const* getByProductID(edm::ProductID const&) const;
00148 
00149          virtual edm::TriggerNames const& triggerNames(edm::TriggerResults const& triggerResults) const;
00150 
00151          virtual edm::TriggerResultsByName triggerResultsByName(std::string const& process) const;
00152 
00153          edm::ProcessHistory const& processHistory() const {return history();}
00154 
00155          fwlite::LuminosityBlock const& getLuminosityBlock() const;
00156          fwlite::Run             const& getRun() const;
00157 
00158          // ---------- static member functions --------------------
00159          static void throwProductNotFoundException(const std::type_info&, const char*, const char*, const char*);
00160 
00161 
00162       private:
00163          friend class internal::ProductGetter;
00164          friend class ChainEvent;
00165          friend class EventHistoryGetter;
00166 
00167          Event(const Event&); // stop default
00168 
00169          const Event& operator=(const Event&); // stop default
00170 
00171          const edm::ProcessHistory& history() const;
00172          void updateAux(Long_t eventIndex) const;
00173          void fillParameterSetRegistry() const;
00174          void setGetter( boost::shared_ptr<edm::EDProductGetter> getter ) { return dataHelper_.setGetter(getter);}
00175 
00176          // ---------- member data --------------------------------
00177          TFile* file_;
00178          // TTree* eventTree_;
00179          TTree* eventHistoryTree_;
00180          // Long64_t eventIndex_;
00181          mutable boost::shared_ptr<fwlite::LuminosityBlock>  lumi_;
00182          mutable boost::shared_ptr<fwlite::Run>  run_;
00183          mutable fwlite::BranchMapReader branchMap_;
00184 
00185          //takes ownership of the strings used by the DataKey keys in data_
00186          mutable std::vector<const char*> labels_;
00187          mutable edm::ProcessHistoryMap historyMap_;
00188          mutable std::vector<edm::EventProcessHistoryID> eventProcessHistoryIDs_;
00189          mutable std::vector<std::string> procHistoryNames_;
00190          mutable edm::EventAuxiliary aux_;
00191          mutable EntryFinder entryFinder_;
00192          edm::EventAuxiliary* pAux_;
00193          edm::EventAux* pOldAux_;
00194          TBranch* auxBranch_;
00195          int fileVersion_;
00196          mutable bool parameterSetRegistryFilled_;
00197 
00198          fwlite::DataGetterHelper dataHelper_;
00199          mutable boost::shared_ptr<RunFactory> runFactory_;
00200    };
00201 
00202 }
00203 #endif /*__CINT__ */
00204 #endif