CMS 3D CMS Logo

ChainEvent.h
Go to the documentation of this file.
1 #ifndef DataFormats_FWLite_ChainEvent_h
2 #define DataFormats_FWLite_ChainEvent_h
3 // -*- C++ -*-
4 //
5 // Package: FWLite
6 // Class : ChainEvent
7 //
16 //
17 // Original Author: Chris Jones
18 // Created: Tue May 8 15:01:20 EDT 2007
19 //
20 // system include files
21 #include <memory>
22 #include <string>
23 #include <typeinfo>
24 #include <vector>
25 
26 // user include files
30 
31 // forward declarations
32 namespace edm {
33  class WrapperBase;
34  class ProductRegistry;
35  class ProcessHistory;
36  class BranchDescription;
37  class EDProductGetter;
38  class EventAux;
39  class TriggerResults;
40  class TriggerNames;
42 }
43 
44 namespace fwlite {
45 
46  class ChainEvent : public EventBase
47 {
48 
49  public:
50 
51  ChainEvent(std::vector<std::string> const& iFileNames);
52  virtual ~ChainEvent();
53 
54  ChainEvent const& operator++();
55 
57  bool to(Long64_t iIndex);
58 
59  // If lumi is non-zero, go to event by Run, Lumi and Event number
60  // If lumi is 0, go to event by Run and Event number only.
61  bool to(const edm::EventID &id);
64 
65  // Go to the very first Event.
66  ChainEvent const& toBegin();
67 
68  // ---------- const member functions ---------------------
69  virtual std::string const getBranchNameFor(std::type_info const&,
70  char const*,
71  char const*,
72  char const*) const;
73 
75 
76  // This function should only be called by fwlite::Handle<>
77  virtual bool getByLabel(std::type_info const&, char const*, char const*, char const*, void*) const;
78  //void getByBranchName(std::type_info const&, char const*, void*&) const;
79 
80  bool isValid() const;
81  operator bool() const;
82  virtual bool atEnd() const;
83 
84  Long64_t size() const;
85 
86  virtual edm::EventAuxiliary const& eventAuxiliary() const;
87 
88  std::vector<edm::BranchDescription> const& getBranchDescriptions() const;
89  std::vector<std::string> const& getProcessHistory() const;
90  virtual edm::ProcessHistory const& processHistory() const;
91  TFile* getTFile() const {
92  return event_->getTFile();
93  }
94 
95  // These functions return the index of the file that the current event
96  // resides in. Note that the file index is based on the vector of files
97  // which were actually opened, not the vector of input files in the
98  // constructor. These two may differ in the case some input files contain
99  // 0 events. To get the path of the file where the current event resides
100  // in, fwlite::ChainEvent::getTFile()->GetPath() is preferred.
101  Long64_t eventIndex() const { return eventIndex_; }
102  virtual Long64_t fileIndex() const { return eventIndex_; }
103 
104  void setGetter(std::shared_ptr<edm::EDProductGetter const> getter){
105  event_->setGetter(getter);
106  }
107 
108  Event const* event() const { return &*event_; }
109 
110  virtual edm::TriggerNames const& triggerNames(edm::TriggerResults const& triggerResults) const;
111  void fillParameterSetRegistry() const;
112  virtual edm::TriggerResultsByName triggerResultsByName(edm::TriggerResults const& triggerResults) const;
113 
114  // ---------- static member functions --------------------
115  static void throwProductNotFoundException(std::type_info const&, char const*, char const*, char const*);
116 
117  // ---------- member functions ---------------------------
118 
119  virtual edm::WrapperBase const* getByProductID(edm::ProductID const&) const;
120  edm::WrapperBase const* getThinnedProduct(edm::ProductID const& pid, unsigned int& key) const;
121 
122  void getThinnedProducts(edm::ProductID const& pid,
123  std::vector<edm::WrapperBase const*>& foundContainers,
124  std::vector<unsigned int>& keys) const;
125 
126  fwlite::LuminosityBlock const& getLuminosityBlock();
127  fwlite::Run const& getRun();
128 
129  private:
130 
131  friend class MultiChainEvent;
132 
133  ChainEvent(Event const&); // stop default
134 
135  ChainEvent const& operator=(Event const&); // stop default
136 
137  void findSizes();
138  void switchToFile(Long64_t);
139  // ---------- member data --------------------------------
140  std::vector<std::string> fileNames_;
143  Long64_t eventIndex_;
144  std::vector<Long64_t> accumulatedSize_;
146 
147 };
148 
149 }
150 #endif
size
Write out results.
edm::propagate_const< std::shared_ptr< Event > > event_
Definition: ChainEvent.h:142
unsigned long long EventNumber_t
TFile * getTFile() const
Definition: ChainEvent.h:91
Long64_t eventIndex_
Definition: ChainEvent.h:143
unsigned int LuminosityBlockNumber_t
virtual bool getByLabel(std::type_info const &, char const *, char const *, char const *, void *) const =0
T const * getThinnedProduct(RefCore const &ref, unsigned int &thinnedKey, EDProductGetter const *prodGetter)
Definition: RefCoreGet.h:129
std::vector< Long64_t > accumulatedSize_
Definition: ChainEvent.h:144
static std::string const triggerResults("TriggerResults")
edm::propagate_const< std::shared_ptr< TFile > > file_
Definition: ChainEvent.h:141
edm::propagate_const< std::shared_ptr< edm::EDProductGetter > > getter_
Definition: ChainEvent.h:145
HLT enums.
void event_()
unsigned int RunNumber_t
Long64_t eventIndex() const
Definition: ChainEvent.h:101
static void throwProductNotFoundException(char const *where, errors::ErrorCodes error, BranchID const &bid)
Definition: Principal.cc:36
Event const * event() const
Definition: ChainEvent.h:108
virtual Long64_t fileIndex() const
Definition: ChainEvent.h:102
std::vector< std::string > fileNames_
Definition: ChainEvent.h:140
void setGetter(std::shared_ptr< edm::EDProductGetter const > getter)
Definition: ChainEvent.h:104
Definition: event.py:1