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