File indexing completed on 2024-04-06 12:23:39
0001 #include "FWCore/Framework/interface/EventForOutput.h"
0002 #include "EventStringOutputFields.h"
0003
0004 void EventStringOutputFields::registerToken(const edm::EDGetToken &token) { m_tokens.push_back(token); }
0005
0006 void EventStringOutputFields::createFields(RNTupleModel &model) {
0007 m_evstrings = RNTupleFieldPtr<std::vector<std::string>>("EventStrings", "", model);
0008 }
0009
0010 void EventStringOutputFields::fill(const edm::EventForOutput &iEvent) {
0011 std::vector<std::string> evstrings;
0012 if (m_lastLumi != iEvent.id().luminosityBlock()) {
0013 edm::Handle<std::string> handle;
0014 for (const auto &t : m_tokens) {
0015 iEvent.getByToken(t, handle);
0016 const std::string &evstr = *handle;
0017 if (!evstr.empty()) {
0018 evstrings.push_back(evstr);
0019 }
0020 }
0021 m_lastLumi = iEvent.id().luminosityBlock();
0022 }
0023 m_evstrings.fill(evstrings);
0024 }