CMS 3D CMS Logo

CompactEventAuxiliaryVector.h
Go to the documentation of this file.
1 #ifndef DataFormats_Provenance_CompactEventAuxiliaryVector_h
2 #define DataFormats_Provenance_CompactEventAuxiliaryVector_h
3 
4 #include <vector>
5 #include <unordered_set>
6 
9 
10 namespace edm {
12  public:
16 
17  // These components of EventAuxiliary change infrequently, so
18  // they are stored in a std::unordered_set with a reference in
19  // CompactEventAuxiliary
21  public:
22  CompactEventAuxiliaryExtra(bool isReal, ExperimentType eType, int storeNum)
23  : processHistoryID_(), isRealData_(isReal), experimentType_(eType), storeNumber_(storeNum) {}
25  : processHistoryID_(ea.processHistoryID()),
26  isRealData_(ea.isRealData()),
27  experimentType_(ea.experimentType()),
28  storeNumber_(ea.storeNumber()) {}
29 
30  bool operator==(const CompactEventAuxiliaryExtra& extra) const {
31  return processHistoryID_ == extra.processHistoryID_ && isRealData_ == extra.isRealData_ &&
33  }
34  void write(std::ostream& os) const;
35 
36  // Process history ID of the full process history (not the reduced process history)
38  // Is this real data (i.e. not simulated)
40  // Something descriptive of the source of the data
42  // The LHC store number
44  };
45 
46  struct ExtraHash {
47  std::size_t operator()(CompactEventAuxiliaryExtra const& extra) const noexcept {
48  return hash_value(
49  extra.processHistoryID_.compactForm(), extra.isRealData_, extra.experimentType_, extra.storeNumber_);
50  }
51  };
52 
53  using GUIDmemo = std::unordered_set<std::string>;
54  using extraMemo = std::unordered_set<CompactEventAuxiliaryExtra, ExtraHash>;
55 
57  public:
59  std::string const& processGUID,
60  Timestamp const& theTime,
61  int bunchXing,
62  int orbitNum,
63  CompactEventAuxiliaryExtra const& extra,
64  GUIDmemo& guidmemo,
65  extraMemo& extramemo)
66  : id_(theId),
67  processGUID_(memoize(processGUID, guidmemo)),
68  time_(theTime),
69  bunchCrossing_(bunchXing),
70  orbitNumber_(orbitNum),
71  extra_(memoize(extra, extramemo)) {}
72  CompactEventAuxiliary(const EventAuxiliary& ea, GUIDmemo& guidmemo, extraMemo& extramemo)
73  : id_(ea.id()),
74  processGUID_(memoize(ea.processGUID(), guidmemo)),
75  time_(ea.time()),
78  extra_(memoize(CompactEventAuxiliaryExtra(ea), extramemo)) {}
79 
80  void write(std::ostream& os) const;
81 
83  EventID const& id() const { return id_; }
84  std::string const& processGUID() const { return processGUID_; }
85  Timestamp const& time() const { return time_; }
87  EventNumber_t event() const { return id_.event(); }
88  RunNumber_t run() const { return id_.run(); }
89  bool isRealData() const { return extra_.isRealData_; }
91  int bunchCrossing() const { return bunchCrossing_; }
92  int orbitNumber() const { return orbitNumber_; }
93  int storeNumber() const { return extra_.storeNumber_; }
94 
96  auto ea{EventAuxiliary(id_,
98  time_,
103  orbitNumber_)};
105  return ea;
106  }
107 
108  private:
109  template <typename T, typename C>
110  const T& memoize(const T& item, C& memopad) const {
111  auto it = memopad.insert(item);
112  return *it.first;
113  }
114 
115  // Event ID
117  // Globally unique process ID of process that created event.
119  // Time from DAQ
121  // The bunch crossing number
123  // The orbit number
125  // the stuff that changes slowly
127  };
128 
130  using iterator = std::vector<value_type>::iterator;
132  using const_iterator = std::vector<value_type>::const_iterator;
133 
134  size_type size() const { return compactAuxiliaries_.size(); }
135  void reserve(std::size_t size) { compactAuxiliaries_.reserve(size); }
136  const_iterator begin() const { return compactAuxiliaries_.begin(); }
137  const_iterator end() const { return compactAuxiliaries_.end(); }
138  const_iterator cbegin() const { return compactAuxiliaries_.cbegin(); }
139  const_iterator cend() const { return compactAuxiliaries_.cend(); }
140 
141  size_type extrasSize() const { return extras_.size(); }
142  size_type guidsSize() const { return processGUIDs_.size(); }
143 
144  void push_back(const EventAuxiliary& ea) { compactAuxiliaries_.emplace_back(ea, processGUIDs_, extras_); }
145 
146  private:
147  // Items that change every event
148  std::vector<CompactEventAuxiliary> compactAuxiliaries_;
149  // Items that change relatively infrequently
151  // Globally unique process IDs of processes that created events.
153  };
154 
155  inline std::ostream& operator<<(std::ostream& os, const CompactEventAuxiliaryVector::CompactEventAuxiliary& p) {
156  p.write(os);
157  return os;
158  }
159 
160  inline std::ostream& operator<<(std::ostream& os, const CompactEventAuxiliaryVector::CompactEventAuxiliaryExtra& p) {
161  p.write(os);
162  return os;
163  }
164 } // namespace edm
165 
166 #endif
edm::hash_value
std::size_t hash_value(const Types &... args)
Definition: hash_combine.h:36
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::isRealData
bool isRealData() const
Definition: CompactEventAuxiliaryVector.h:89
edm::CompactEventAuxiliaryVector::begin
const_iterator begin() const
Definition: CompactEventAuxiliaryVector.h:136
edm::RunNumber_t
unsigned int RunNumber_t
Definition: RunLumiEventNumber.h:14
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::extra_
const CompactEventAuxiliaryExtra & extra_
Definition: CompactEventAuxiliaryVector.h:126
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::processHistoryID
ProcessHistoryID const & processHistoryID() const
Definition: CompactEventAuxiliaryVector.h:82
edm::CompactEventAuxiliaryVector::extras_
extraMemo extras_
Definition: CompactEventAuxiliaryVector.h:150
edm::CompactEventAuxiliaryVector::CompactEventAuxiliaryExtra::CompactEventAuxiliaryExtra
CompactEventAuxiliaryExtra(bool isReal, ExperimentType eType, int storeNum)
Definition: CompactEventAuxiliaryVector.h:22
edm::EventAuxiliary::invalidStoreNumber
static const int invalidStoreNumber
Definition: EventAuxiliary.h:29
edm::CompactEventAuxiliaryVector::CompactEventAuxiliaryExtra
Definition: CompactEventAuxiliaryVector.h:20
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::storeNumber
int storeNumber() const
Definition: CompactEventAuxiliaryVector.h:93
edm
HLT enums.
Definition: AlignableModifier.h:19
edm::CompactEventAuxiliaryVector::processGUIDs_
GUIDmemo processGUIDs_
Definition: CompactEventAuxiliaryVector.h:152
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
edm::CompactEventAuxiliaryVector::CompactEventAuxiliaryExtra::write
void write(std::ostream &os) const
Definition: CompactEventAuxiliaryVector.cc:11
edm::EventID::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: EventID.h:39
edm::LuminosityBlockNumber_t
unsigned int LuminosityBlockNumber_t
Definition: RunLumiEventNumber.h:13
edm::CompactEventAuxiliaryVector::CompactEventAuxiliaryExtra::storeNumber_
int storeNumber_
Definition: CompactEventAuxiliaryVector.h:43
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::run
RunNumber_t run() const
Definition: CompactEventAuxiliaryVector.h:88
edm::CompactEventAuxiliaryVector
Definition: CompactEventAuxiliaryVector.h:11
edm::operator<<
std::ostream & operator<<(std::ostream &ost, const HLTGlobalStatus &hlt)
Formatted printout of trigger tbale.
Definition: HLTGlobalStatus.h:106
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::CompactEventAuxiliary
CompactEventAuxiliary(EventID const &theId, std::string const &processGUID, Timestamp const &theTime, int bunchXing, int orbitNum, CompactEventAuxiliaryExtra const &extra, GUIDmemo &guidmemo, extraMemo &extramemo)
Definition: CompactEventAuxiliaryVector.h:58
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::memoize
const T & memoize(const T &item, C &memopad) const
Definition: CompactEventAuxiliaryVector.h:110
edm::CompactEventAuxiliaryVector::CompactEventAuxiliaryExtra::CompactEventAuxiliaryExtra
CompactEventAuxiliaryExtra(const EventAuxiliary &ea)
Definition: CompactEventAuxiliaryVector.h:24
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
edm::CompactEventAuxiliaryVector::CompactEventAuxiliaryExtra::experimentType_
ExperimentType experimentType_
Definition: CompactEventAuxiliaryVector.h:41
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::eventAuxiliary
EventAuxiliary eventAuxiliary() const
Definition: CompactEventAuxiliaryVector.h:95
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::write
void write(std::ostream &os) const
Definition: CompactEventAuxiliaryVector.cc:5
edm::Hash< ProcessHistoryType >
edm::EventNumber_t
unsigned long long EventNumber_t
Definition: RunLumiEventNumber.h:12
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: CompactEventAuxiliaryVector.h:86
edm::CompactEventAuxiliaryVector::guidsSize
size_type guidsSize() const
Definition: CompactEventAuxiliaryVector.h:142
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::id
EventID const & id() const
Definition: CompactEventAuxiliaryVector.h:83
edm::CompactEventAuxiliaryVector::compactAuxiliaries_
std::vector< CompactEventAuxiliary > compactAuxiliaries_
Definition: CompactEventAuxiliaryVector.h:148
edm::EventID::run
RunNumber_t run() const
Definition: EventID.h:38
edm::CompactEventAuxiliaryVector::CompactEventAuxiliaryExtra::isRealData_
bool isRealData_
Definition: CompactEventAuxiliaryVector.h:39
edm::CompactEventAuxiliaryVector::GUIDmemo
std::unordered_set< std::string > GUIDmemo
Definition: CompactEventAuxiliaryVector.h:53
edm::EventAuxiliary
Definition: EventAuxiliary.h:14
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::CompactEventAuxiliary
CompactEventAuxiliary(const EventAuxiliary &ea, GUIDmemo &guidmemo, extraMemo &extramemo)
Definition: CompactEventAuxiliaryVector.h:72
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::event
EventNumber_t event() const
Definition: CompactEventAuxiliaryVector.h:87
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::CompactEventAuxiliaryVector::cend
const_iterator cend() const
Definition: CompactEventAuxiliaryVector.h:139
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::experimentType
ExperimentType experimentType() const
Definition: CompactEventAuxiliaryVector.h:90
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::orbitNumber_
int orbitNumber_
Definition: CompactEventAuxiliaryVector.h:124
edm::CompactEventAuxiliaryVector::end
const_iterator end() const
Definition: CompactEventAuxiliaryVector.h:137
edm::CompactEventAuxiliaryVector::extrasSize
size_type extrasSize() const
Definition: CompactEventAuxiliaryVector.h:141
edm::CompactEventAuxiliaryVector::iterator
std::vector< value_type >::iterator iterator
Definition: CompactEventAuxiliaryVector.h:130
edm::CompactEventAuxiliaryVector::push_back
void push_back(const EventAuxiliary &ea)
Definition: CompactEventAuxiliaryVector.h:144
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::orbitNumber
int orbitNumber() const
Definition: CompactEventAuxiliaryVector.h:92
edm::EventID::event
EventNumber_t event() const
Definition: EventID.h:40
edm::CompactEventAuxiliaryVector::cbegin
const_iterator cbegin() const
Definition: CompactEventAuxiliaryVector.h:138
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::time_
Timestamp time_
Definition: CompactEventAuxiliaryVector.h:120
edm::CompactEventAuxiliaryVector::size_type
std::vector< value_type >::size_type size_type
Definition: CompactEventAuxiliaryVector.h:131
edm::CompactEventAuxiliaryVector::ExtraHash
Definition: CompactEventAuxiliaryVector.h:46
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
edm::CompactEventAuxiliaryVector::invalidBunchXing
static const int invalidBunchXing
Definition: CompactEventAuxiliaryVector.h:14
edm::CompactEventAuxiliaryVector::CompactEventAuxiliaryExtra::processHistoryID_
ProcessHistoryID processHistoryID_
Definition: CompactEventAuxiliaryVector.h:37
edm::CompactEventAuxiliaryVector::reserve
void reserve(std::size_t size)
Definition: CompactEventAuxiliaryVector.h:135
edm::CompactEventAuxiliaryVector::CompactEventAuxiliaryExtra::operator==
bool operator==(const CompactEventAuxiliaryExtra &extra) const
Definition: CompactEventAuxiliaryVector.h:30
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::id_
EventID id_
Definition: CompactEventAuxiliaryVector.h:116
gen::C
C
Definition: PomwigHadronizer.cc:78
T
long double T
Definition: Basic3DVectorLD.h:48
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::processGUID_
const std::string & processGUID_
Definition: CompactEventAuxiliaryVector.h:118
edm::CompactEventAuxiliaryVector::const_iterator
std::vector< value_type >::const_iterator const_iterator
Definition: CompactEventAuxiliaryVector.h:132
edm::EventAuxiliary::ExperimentType
ExperimentType
Definition: EventAuxiliary.h:18
EventAuxiliary.h
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::processGUID
std::string const & processGUID() const
Definition: CompactEventAuxiliaryVector.h:84
edm::CompactEventAuxiliaryVector::extraMemo
std::unordered_set< CompactEventAuxiliaryExtra, ExtraHash > extraMemo
Definition: CompactEventAuxiliaryVector.h:54
edm::CompactEventAuxiliaryVector::size
size_type size() const
Definition: CompactEventAuxiliaryVector.h:134
edm::EventAuxiliary::invalidBunchXing
static const int invalidBunchXing
Definition: EventAuxiliary.h:28
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::bunchCrossing
int bunchCrossing() const
Definition: CompactEventAuxiliaryVector.h:91
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary
Definition: CompactEventAuxiliaryVector.h:56
edm::EventID
Definition: EventID.h:31
edm::EventAuxiliary::setProcessHistoryID
void setProcessHistoryID(ProcessHistoryID const &phid)
Definition: EventAuxiliary.h:62
hash_combine.h
edm::CompactEventAuxiliaryVector::ExtraHash::operator()
std::size_t operator()(CompactEventAuxiliaryExtra const &extra) const noexcept
Definition: CompactEventAuxiliaryVector.h:47
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::time
Timestamp const & time() const
Definition: CompactEventAuxiliaryVector.h:85
edm::CompactEventAuxiliaryVector::invalidStoreNumber
static const int invalidStoreNumber
Definition: CompactEventAuxiliaryVector.h:15
edm::CompactEventAuxiliaryVector::CompactEventAuxiliary::bunchCrossing_
int bunchCrossing_
Definition: CompactEventAuxiliaryVector.h:122
edm::Timestamp
Definition: Timestamp.h:30