Go to the documentation of this file.00001 #ifndef DataFormats_FWLite_ChainEvent_h
00002 #define DataFormats_FWLite_ChainEvent_h
00003
00004
00005
00006
00007
00016
00017
00018
00019
00020 #if !defined(__CINT__) && !defined(__MAKECINT__)
00021
00022 #include <string>
00023 #include <typeinfo>
00024 #include <vector>
00025 #include "boost/shared_ptr.hpp"
00026
00027
00028 #include "DataFormats/FWLite/interface/Event.h"
00029 #include "DataFormats/FWLite/interface/EventBase.h"
00030
00031
00032 namespace edm {
00033 class WrapperHolder;
00034 class ProductRegistry;
00035 class ProcessHistory;
00036 class BranchDescription;
00037 class EDProductGetter;
00038 class EventAux;
00039 class TriggerResults;
00040 class TriggerNames;
00041 class TriggerResultsByName;
00042 }
00043
00044 namespace fwlite {
00045
00046 class ChainEvent : public EventBase
00047 {
00048
00049 public:
00050
00051 ChainEvent(std::vector<std::string> const& iFileNames);
00052 virtual ~ChainEvent();
00053
00054 ChainEvent const& operator++();
00055
00057 bool to(Long64_t iIndex);
00058
00059
00060
00061 bool to(const edm::EventID &id);
00062 bool to(edm::RunNumber_t run, edm::EventNumber_t event);
00063 bool to(edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event);
00064
00065
00066 ChainEvent const& toBegin();
00067
00068
00069 virtual std::string const getBranchNameFor(std::type_info const&,
00070 char const*,
00071 char const*,
00072 char const*) const;
00073
00074
00075 virtual bool getByLabel(std::type_info const&, char const*, char const*, char const*, void*) const;
00076 virtual bool getByLabel(std::type_info const&, char const*, char const*, char const*, edm::WrapperHolder&) const;
00077
00078
00079 bool isValid() const;
00080 operator bool() const;
00081 virtual bool atEnd() const;
00082
00083 Long64_t size() const;
00084
00085 virtual edm::EventAuxiliary const& eventAuxiliary() const;
00086
00087 std::vector<edm::BranchDescription> const& getBranchDescriptions() const;
00088 std::vector<std::string> const& getProcessHistory() const;
00089 virtual edm::ProcessHistory const& processHistory() const;
00090 TFile* getTFile() const {
00091 return event_->getTFile();
00092 }
00093
00094 Long64_t eventIndex() const { return eventIndex_; }
00095 virtual Long64_t fileIndex() const { return eventIndex_; }
00096
00097 void setGetter(boost::shared_ptr<edm::EDProductGetter> getter){
00098 event_->setGetter(getter);
00099 }
00100
00101 Event const* event() const { return &*event_; }
00102
00103 virtual edm::TriggerNames const& triggerNames(edm::TriggerResults const& triggerResults) const;
00104 void fillParameterSetRegistry() const;
00105 virtual edm::TriggerResultsByName triggerResultsByName(std::string const& process) const;
00106
00107
00108 static void throwProductNotFoundException(std::type_info const&, char const*, char const*, char const*);
00109
00110
00111
00112 edm::WrapperHolder getByProductID(edm::ProductID const&) const;
00113 fwlite::LuminosityBlock const& getLuminosityBlock();
00114 fwlite::Run const& getRun();
00115
00116 private:
00117
00118 friend class MultiChainEvent;
00119
00120 ChainEvent(Event const&);
00121
00122 ChainEvent const& operator=(Event const&);
00123
00124 void findSizes();
00125 void switchToFile(Long64_t);
00126
00127 std::vector<std::string> fileNames_;
00128 boost::shared_ptr<TFile> file_;
00129 boost::shared_ptr<Event> event_;
00130 Long64_t eventIndex_;
00131 std::vector<Long64_t> accumulatedSize_;
00132 boost::shared_ptr<edm::EDProductGetter> getter_;
00133
00134 };
00135
00136 }
00137 #endif
00138 #endif