CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 #if !defined(__CINT__) && !defined(__MAKECINT__)
21 // system include files
22 #include <string>
23 #include <typeinfo>
24 #include <vector>
25 #include "boost/shared_ptr.hpp"
26 
27 // user include files
30 
31 // forward declarations
32 namespace edm {
33  class WrapperHolder;
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 
74  // This function should only be called by fwlite::Handle<>
75  virtual bool getByLabel(std::type_info const&, char const*, char const*, char const*, void*) const;
76  virtual bool getByLabel(std::type_info const&, char const*, char const*, char const*, edm::WrapperHolder&) const;
77  //void getByBranchName(std::type_info const&, char const*, void*&) const;
78 
79  bool isValid() const;
80  operator bool() const;
81  virtual bool atEnd() const;
82 
83  Long64_t size() const;
84 
85  virtual edm::EventAuxiliary const& eventAuxiliary() const;
86 
87  std::vector<edm::BranchDescription> const& getBranchDescriptions() const;
88  std::vector<std::string> const& getProcessHistory() const;
89  virtual edm::ProcessHistory const& processHistory() const;
90  TFile* getTFile() const {
91  return event_->getTFile();
92  }
93 
94  // These functions return the index of the file that the current event
95  // resides in. Note that the file index is based on the vector of files
96  // which were actually opened, not the vector of input files in the
97  // constructor. These two may differ in the case some input files contain
98  // 0 events. To get the path of the file where the current event resides
99  // in, fwlite::ChainEvent::getTFile()->GetPath() is preferred.
100  Long64_t eventIndex() const { return eventIndex_; }
101  virtual Long64_t fileIndex() const { return eventIndex_; }
102 
103  void setGetter(boost::shared_ptr<edm::EDProductGetter> getter){
104  event_->setGetter(getter);
105  }
106 
107  Event const* event() const { return &*event_; }
108 
110  void fillParameterSetRegistry() const;
112 
113  // ---------- static member functions --------------------
114  static void throwProductNotFoundException(std::type_info const&, char const*, char const*, char const*);
115 
116  // ---------- member functions ---------------------------
117 
120  fwlite::Run const& getRun();
121 
122  private:
123 
124  friend class MultiChainEvent;
125 
126  ChainEvent(Event const&); // stop default
127 
128  ChainEvent const& operator=(Event const&); // stop default
129 
130  void findSizes();
131  void switchToFile(Long64_t);
132  // ---------- member data --------------------------------
133  std::vector<std::string> fileNames_;
134  boost::shared_ptr<TFile> file_;
135  boost::shared_ptr<Event> event_;
136  Long64_t eventIndex_;
137  std::vector<Long64_t> accumulatedSize_;
138  boost::shared_ptr<edm::EDProductGetter> getter_;
139 
140 };
141 
142 }
143 #endif /*__CINT__ */
144 #endif
virtual edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const
Definition: ChainEvent.cc:317
virtual edm::TriggerResultsByName triggerResultsByName(std::string const &process) const
Definition: ChainEvent.cc:329
Long64_t size() const
Definition: ChainEvent.cc:311
unsigned int EventNumber_t
Definition: EventID.h:30
virtual edm::EventAuxiliary const & eventAuxiliary() const
Definition: ChainEvent.cc:251
void switchToFile(Long64_t)
Definition: ChainEvent.cc:211
tuple lumi
Definition: fjr2json.py:35
edm::WrapperHolder getByProductID(edm::ProductID const &) const
Definition: ChainEvent.cc:286
virtual bool getByLabel(std::type_info const &, char const *, char const *, char const *, void *) const
Definition: ChainEvent.cc:267
TFile * getTFile() const
Definition: ChainEvent.h:90
Long64_t eventIndex_
Definition: ChainEvent.h:136
virtual ~ChainEvent()
Definition: ChainEvent.cc:76
unsigned int LuminosityBlockNumber_t
Definition: EventID.h:31
static void throwProductNotFoundException(std::type_info const &, char const *, char const *, char const *)
Definition: ChainEvent.cc:337
virtual std::string const getBranchNameFor(std::type_info const &, char const *, char const *, char const *) const
Definition: ChainEvent.cc:224
fwlite::LuminosityBlock const & getLuminosityBlock()
Definition: ChainEvent.cc:256
void setGetter(boost::shared_ptr< edm::EDProductGetter > getter)
Definition: ChainEvent.h:103
void fillParameterSetRegistry() const
Definition: ChainEvent.cc:323
std::vector< std::string > const & getProcessHistory() const
Definition: ChainEvent.cc:239
boost::shared_ptr< Event > event_
Definition: ChainEvent.h:135
static std::string const triggerResults
Definition: EdmProvDump.cc:41
fwlite::Run const & getRun()
Definition: ChainEvent.cc:261
bool to(Long64_t iIndex)
Go to the event at index iIndex.
Definition: ChainEvent.cc:115
virtual bool atEnd() const
Definition: ChainEvent.cc:302
std::vector< Long64_t > accumulatedSize_
Definition: ChainEvent.h:137
std::vector< edm::BranchDescription > const & getBranchDescriptions() const
Definition: ChainEvent.cc:233
boost::shared_ptr< edm::EDProductGetter > getter_
Definition: ChainEvent.h:138
ChainEvent const & toBegin()
Definition: ChainEvent.cc:200
ChainEvent const & operator++()
Definition: ChainEvent.cc:97
unsigned int RunNumber_t
Definition: EventRange.h:32
Long64_t eventIndex() const
Definition: ChainEvent.h:100
virtual edm::ProcessHistory const & processHistory() const
Definition: ChainEvent.cc:245
tuple process
Definition: LaserDQM_cfg.py:3
Event const * event() const
Definition: ChainEvent.h:107
bool isValid() const
Definition: ChainEvent.cc:292
virtual Long64_t fileIndex() const
Definition: ChainEvent.h:101
boost::shared_ptr< TFile > file_
Definition: ChainEvent.h:134
std::vector< std::string > fileNames_
Definition: ChainEvent.h:133
ChainEvent const & operator=(Event const &)
ChainEvent(std::vector< std::string > const &iFileNames)
Definition: ChainEvent.cc:35