CMS 3D CMS Logo

StreamerOutputModuleBase.cc
Go to the documentation of this file.
1 
3 
12 
13 #include "zlib.h"
14 
15 namespace edm {
18  one::OutputModule<one::WatchRuns, one::WatchLuminosityBlocks>(ps),
19  StreamerOutputModuleCommon(ps, &keptProducts()[InEvent], description().moduleLabel()),
20  trToken_(consumes<edm::TriggerResults>(edm::InputTag("TriggerResults"))),
21  psetToken_(
22  consumes<SendJobHeader::ParameterSetMap, edm::InRun>(ps.getUntrackedParameter<edm::InputTag>("psetMap"))) {}
23 
25 
27  start();
28 
29  auto psetMapHandle = iRun.getHandle(psetToken_);
30 
31  std::unique_ptr<InitMsgBuilder> init_message =
33  *branchIDLists(),
37  moduleDescription().mainParameterSetID(),
38  psetMapHandle.isValid() ? psetMapHandle.product() : nullptr);
39 
40  doOutputHeader(*init_message);
41  serializerBuffer_->clearHeaderBuffer();
42  }
43 
45 
47 
49 
51 
53 
56 
57  std::unique_ptr<EventMsgBuilder> msg = serializeEvent(*getSerializerBuffer(), e, triggerResults, selectorConfig());
58  doOutputEvent(*msg); // You can't use msg in StreamerOutputModuleBase after this point
59  }
60 
62  EventForOutput const& e) const {
63  Trig result;
64  e.getByToken<TriggerResults>(token, result);
65  return result;
66  }
67 
70  OutputModule::fillDescription(desc);
71  desc.addUntracked<edm::InputTag>("psetMap", {"hltPSetMap"})
72  ->setComment("Optionally allow the map of ParameterSets to be calculated externally.");
73  }
74 } // namespace edm
static void fillDescription(ParameterSetDescription &desc)
std::unique_ptr< EventMsgBuilder > serializeEvent(SerializeDataBuffer &sbuf, EventForOutput const &e, Handle< TriggerResults > const &triggerResults, ParameterSetID const &selectorCfg)
virtual void doOutputHeader(InitMsgBuilder const &init_message)=0
void endRun(RunForOutput const &) override
void write(EventForOutput const &e) override
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
ModuleDescription const & description() const
ThinnedAssociationsHelper const * thinnedAssociationsHelper() const
std::unique_ptr< SerializeDataBuffer > serializerBuffer_
BranchIDLists const * branchIDLists() const
static void fillDescription(ParameterSetDescription &desc)
void beginRun(RunForOutput const &) override
void writeLuminosityBlock(LuminosityBlockForOutput const &) override
Trig getTriggerResults(EDGetTokenT< TriggerResults > const &token, EventForOutput const &e) const
virtual void doOutputEvent(EventMsgBuilder const &msg)=0
StreamerOutputModuleBase(ParameterSet const &ps)
ParameterSetID selectorConfig() const
std::unique_ptr< InitMsgBuilder > serializeRegistry(SerializeDataBuffer &sbuf, BranchIDLists const &branchLists, ThinnedAssociationsHelper const &helper, std::string const &processName, std::string const &moduleLabel, ParameterSetID const &toplevel, SendJobHeader::ParameterSetMap const *psetMap)
static std::string const triggerResults("TriggerResults")
edm::EDGetTokenT< edm::TriggerResults > trToken_
tuple msg
Definition: mps_check.py:286
void writeRun(RunForOutput const &) override
std::map< ParameterSetID, ParameterSetBlob > ParameterSetMap
HLT enums.
edm::EDGetTokenT< SendJobHeader::ParameterSetMap > psetToken_
const ModuleDescription & moduleDescription() const