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 } // namespace edm
43 
44 namespace fwlite {
45 
46  class ChainEvent : public EventBase {
47  public:
48  ChainEvent(std::vector<std::string> const& iFileNames);
49  ~ChainEvent() override;
50 
51  ChainEvent const& operator++() override;
52 
54  bool to(Long64_t iIndex);
55 
56  // If lumi is non-zero, go to event by Run, Lumi and Event number
57  // If lumi is 0, go to event by Run and Event number only.
58  bool to(const edm::EventID& id);
61 
62  // Go to the very first Event.
63  ChainEvent const& toBegin() override;
64 
65  // ---------- const member functions ---------------------
66  std::string const getBranchNameFor(std::type_info const&, char const*, char const*, char const*) const override;
67 
69 
70  // This function should only be called by fwlite::Handle<>
71  bool getByLabel(std::type_info const&, char const*, char const*, char const*, void*) const override;
72  //void getByBranchName(std::type_info const&, char const*, void*&) const;
73 
74  bool isValid() const;
75  operator bool() const;
76  bool atEnd() const override;
77 
78  Long64_t size() const;
79 
80  edm::EventAuxiliary const& eventAuxiliary() const override;
81 
82  std::vector<edm::BranchDescription> const& getBranchDescriptions() const;
83  std::vector<std::string> const& getProcessHistory() const;
84  edm::ProcessHistory const& processHistory() const override;
85  TFile* getTFile() const { return event_->getTFile(); }
86 
87  // These functions return the index of the file that the current event
88  // resides in. Note that the file index is based on the vector of files
89  // which were actually opened, not the vector of input files in the
90  // constructor. These two may differ in the case some input files contain
91  // 0 events. To get the path of the file where the current event resides
92  // in, fwlite::ChainEvent::getTFile()->GetPath() is preferred.
93  Long64_t eventIndex() const { return eventIndex_; }
94  Long64_t fileIndex() const override { return eventIndex_; }
95 
96  void setGetter(std::shared_ptr<edm::EDProductGetter const> getter) { event_->setGetter(getter); }
97 
98  Event const* event() const { return &*event_; }
99 
101  void fillParameterSetRegistry() const;
103 
104  edm::ParameterSet const* parameterSet(edm::ParameterSetID const& psID) const override;
105 
106  // ---------- static member functions --------------------
107  static void throwProductNotFoundException(std::type_info const&, char const*, char const*, char const*);
108 
109  // ---------- member functions ---------------------------
110 
111  edm::WrapperBase const* getByProductID(edm::ProductID const&) const override;
112  edm::WrapperBase const* getThinnedProduct(edm::ProductID const& pid, unsigned int& key) const;
113 
114  void getThinnedProducts(edm::ProductID const& pid,
115  std::vector<edm::WrapperBase const*>& foundContainers,
116  std::vector<unsigned int>& keys) const;
117 
119  fwlite::Run const& getRun();
120 
121  private:
122  friend class MultiChainEvent;
123 
124  ChainEvent(Event const&); // stop default
125 
126  ChainEvent const& operator=(Event const&); // stop default
127 
128  void findSizes();
129  void switchToFile(Long64_t);
130  // ---------- member data --------------------------------
131  std::vector<std::string> fileNames_;
134  Long64_t eventIndex_;
135  std::vector<Long64_t> accumulatedSize_;
137  };
138 
139 } // namespace fwlite
140 #endif
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
electrons_cff.bool
bool
Definition: electrons_cff.py:372
TriggerResultsByName
fwlite::ChainEvent::triggerResultsByName
edm::TriggerResultsByName triggerResultsByName(edm::TriggerResults const &triggerResults) const override
Definition: ChainEvent.cc:255
fwlite::ChainEvent::eventAuxiliary
edm::EventAuxiliary const & eventAuxiliary() const override
Definition: ChainEvent.cc:203
fwlite::ChainEvent::getByProductID
edm::WrapperBase const * getByProductID(edm::ProductID const &) const override
Definition: ChainEvent.cc:217
fwlite::ChainEvent::event
Event const * event() const
Definition: ChainEvent.h:98
fwlite::ChainEvent::operator=
ChainEvent const & operator=(Event const &)
fwlite
Definition: TFileDirectory.h:16
fwlite::ChainEvent::getThinnedProducts
void getThinnedProducts(edm::ProductID const &pid, std::vector< edm::WrapperBase const * > &foundContainers, std::vector< unsigned int > &keys) const
Definition: ChainEvent.cc:225
propagate_const.h
fwlite::ChainEvent::getByLabel
bool getByLabel(std::type_info const &, char const *, char const *, char const *, void *) const override
Definition: ChainEvent.cc:209
ProducerES_cfi.ProcessHistory
ProcessHistory
Definition: ProducerES_cfi.py:14
edm
HLT enums.
Definition: AlignableModifier.h:19
triggerResults
static const std::string triggerResults
Definition: EdmProvDump.cc:45
fwlite::ChainEvent::fileIndex
Long64_t fileIndex() const override
Definition: ChainEvent.h:94
fwlite::ChainEvent::throwProductNotFoundException
static void throwProductNotFoundException(std::type_info const &, char const *, char const *, char const *)
Definition: ChainEvent.cc:262
relativeConstraints.keys
keys
Definition: relativeConstraints.py:89
fwlite::MultiChainEvent
Definition: MultiChainEvent.h:50
fwlite::ChainEvent::switchToFile
void switchToFile(Long64_t)
Definition: ChainEvent.cc:177
fwlite::ChainEvent::ChainEvent
ChainEvent(std::vector< std::string > const &iFileNames)
Definition: ChainEvent.cc:35
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
fwlite::ChainEvent::isValid
bool isValid() const
Definition: ChainEvent.cc:231
edm::propagate_const
Definition: propagate_const.h:32
EventBase.h
fwlite::ChainEvent::event_
edm::propagate_const< std::shared_ptr< Event > > event_
Definition: ChainEvent.h:133
fwlite::ChainEvent::fileNames_
std::vector< std::string > fileNames_
Definition: ChainEvent.h:131
fwlite::ChainEvent::accumulatedSize_
std::vector< Long64_t > accumulatedSize_
Definition: ChainEvent.h:135
edm::Hash< ParameterSetType >
fwlite::EventBase::getByLabel
virtual bool getByLabel(std::type_info const &, char const *, char const *, char const *, void *) const =0
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
fwlite::ChainEvent::triggerNames
edm::TriggerNames const & triggerNames(edm::TriggerResults const &triggerResults) const override
Definition: ChainEvent.cc:245
edm::EventAuxiliary
Definition: EventAuxiliary.h:14
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
fwlite::ChainEvent::processHistory
edm::ProcessHistory const & processHistory() const override
Definition: ChainEvent.cc:201
fwlite::ChainEvent::file_
edm::propagate_const< std::shared_ptr< TFile > > file_
Definition: ChainEvent.h:132
edm::ParameterSet
Definition: ParameterSet.h:36
EDProductGetter
fwlite::ChainEvent::toBegin
ChainEvent const & toBegin() override
Definition: ChainEvent.cc:167
fwlite::ChainEvent::getBranchDescriptions
std::vector< edm::BranchDescription > const & getBranchDescriptions() const
Definition: ChainEvent.cc:195
fwlite::ChainEvent::operator++
ChainEvent const & operator++() override
Definition: ChainEvent.cc:88
fwlite::ChainEvent::to
bool to(Long64_t iIndex)
Go to the event at index iIndex.
Definition: ChainEvent.cc:103
fwlite::ChainEvent::getRun
fwlite::Run const & getRun()
Definition: ChainEvent.cc:207
edm::TriggerResultsByName
Definition: TriggerResultsByName.h:48
fwlite::Run
Definition: Run.h:54
edm::WrapperBase
Definition: WrapperBase.h:23
fwlite::ChainEvent::getProcessHistory
std::vector< std::string > const & getProcessHistory() const
Definition: ChainEvent.cc:199
fwlite::ChainEvent::eventIndex_
Long64_t eventIndex_
Definition: ChainEvent.h:134
fwlite::EventBase
Definition: EventBase.h:36
fwlite::ChainEvent::setGetter
void setGetter(std::shared_ptr< edm::EDProductGetter const > getter)
Definition: ChainEvent.h:96
fwlite::ChainEvent::getBranchNameFor
const std::string getBranchNameFor(std::type_info const &, char const *, char const *, char const *) const override
Definition: ChainEvent.cc:188
writedatasetfile.run
run
Definition: writedatasetfile.py:27
fwlite::Event
Definition: Event.h:87
fwlite::ChainEvent::getThinnedProduct
edm::WrapperBase const * getThinnedProduct(edm::ProductID const &pid, unsigned int &key) const
Definition: ChainEvent.cc:221
Event.h
fwlite::ChainEvent::findSizes
void findSizes()
edm::TriggerNames
Definition: TriggerNames.h:55
fwlite::ChainEvent::eventIndex
Long64_t eventIndex() const
Definition: ChainEvent.h:93
fwlite::ChainEvent::atEnd
bool atEnd() const override
Definition: ChainEvent.cc:234
fwlite::ChainEvent::parameterSet
edm::ParameterSet const * parameterSet(edm::ParameterSetID const &psID) const override
Definition: ChainEvent.cc:249
fwlite::ChainEvent::~ChainEvent
~ChainEvent() override
Definition: ChainEvent.cc:70
edm::ProcessHistory
Definition: ProcessHistory.h:13
fwlite::ChainEvent
Definition: ChainEvent.h:46
fwlite::ChainEvent::size
Long64_t size() const
Definition: ChainEvent.cc:243
fwlite::ChainEvent::fillParameterSetRegistry
void fillParameterSetRegistry() const
Definition: ChainEvent.cc:253
fwlite::LuminosityBlock
Definition: LuminosityBlock.h:57
event
Definition: event.py:1
edm::EventID
Definition: EventID.h:31
HLTObjectsMonitor_cfi.TriggerResults
TriggerResults
Definition: HLTObjectsMonitor_cfi.py:9
fwlite::ChainEvent::getter_
edm::propagate_const< std::shared_ptr< edm::EDProductGetter > > getter_
Definition: ChainEvent.h:136
crabWrapper.key
key
Definition: crabWrapper.py:19
lumi
Definition: LumiSectionData.h:20
fwlite::ChainEvent::getLuminosityBlock
fwlite::LuminosityBlock const & getLuminosityBlock()
Definition: ChainEvent.cc:205
edm::TriggerResults
Definition: TriggerResults.h:35
edm::ProductID
Definition: ProductID.h:27
fwlite::ChainEvent::getTFile
TFile * getTFile() const
Definition: ChainEvent.h:85