Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Streamer output modules ported to one::OutputModule (75X) #11116

Merged
merged 5 commits into from
Sep 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions DQMServices/StreamerIO/test/DQMStreamerOutputModule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ class DQMStreamerOutputModule : public edm::StreamerOutputModuleBase {
virtual void doOutputEvent(EventMsgBuilder const& msg) const;

virtual void beginLuminosityBlock(edm::LuminosityBlockPrincipal const&,
edm::ModuleCallingContext const*);
edm::ModuleCallingContext const*) override;

virtual void endLuminosityBlock(edm::LuminosityBlockPrincipal const&,
edm::ModuleCallingContext const*);
edm::ModuleCallingContext const*) override;

private:
std::string streamLabel_;
Expand All @@ -56,7 +56,8 @@ class DQMStreamerOutputModule : public edm::StreamerOutputModuleBase {
}; //end-of-class-def

DQMStreamerOutputModule::DQMStreamerOutputModule(edm::ParameterSet const& ps)
: edm::StreamerOutputModuleBase(ps),
: edm::one::OutputModuleBase::OutputModuleBase(ps),
edm::StreamerOutputModuleBase(ps),
streamLabel_(ps.getUntrackedParameter<std::string>("streamLabel")),
runInputDir_(ps.getUntrackedParameter<std::string>("runInputDir", "")),
processed_(0),
Expand Down
7 changes: 4 additions & 3 deletions EventFilter/Utilities/plugins/RecoEventOutputModuleForFU.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ namespace evf {
virtual void doOutputHeader(InitMsgBuilder const& init_message) const;
virtual void doOutputEvent(EventMsgBuilder const& msg) const;
//virtual void beginRun(edm::RunPrincipal const&, edm::ModuleCallingContext const*);
virtual void beginJob();
virtual void beginLuminosityBlock(edm::LuminosityBlockPrincipal const&, edm::ModuleCallingContext const*);
virtual void endLuminosityBlock(edm::LuminosityBlockPrincipal const&, edm::ModuleCallingContext const*);
virtual void beginJob() override;
virtual void beginLuminosityBlock(edm::LuminosityBlockPrincipal const&, edm::ModuleCallingContext const*) override;
virtual void endLuminosityBlock(edm::LuminosityBlockPrincipal const&, edm::ModuleCallingContext const*) override;

private:
std::auto_ptr<Consumer> c_;
Expand All @@ -72,6 +72,7 @@ namespace evf {

template<typename Consumer>
RecoEventOutputModuleForFU<Consumer>::RecoEventOutputModuleForFU(edm::ParameterSet const& ps) :
edm::one::OutputModuleBase::OutputModuleBase(ps),
edm::StreamerOutputModuleBase(ps),
c_(new Consumer(ps)),
stream_label_(ps.getParameter<std::string>("@module_label")),
Expand Down
14 changes: 13 additions & 1 deletion IOPool/Streamer/interface/StreamerOutputModule.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,19 @@ namespace edm {
virtual void stop() const;
virtual void doOutputHeader(InitMsgBuilder const& init_message) const;
virtual void doOutputEvent(EventMsgBuilder const& msg) const;
virtual void beginLuminosityBlock(edm::LuminosityBlockPrincipal const&, edm::ModuleCallingContext const*) override;
virtual void endLuminosityBlock(edm::LuminosityBlockPrincipal const&, edm::ModuleCallingContext const*) override;

private:
std::auto_ptr<Consumer> c_;
}; //end-of-class-def

template<typename Consumer>
StreamerOutputModule<Consumer>::StreamerOutputModule(ParameterSet const& ps) :
edm::one::OutputModuleBase::OutputModuleBase(ps),
StreamerOutputModuleBase(ps),
c_(new Consumer(ps)) {
c_(new Consumer(ps))
{
}

template<typename Consumer>
Expand Down Expand Up @@ -65,6 +69,14 @@ namespace edm {
c_->doOutputEvent(msg); // You can't use msg in StreamerOutputModule after this point
}

template<typename Consumer>
void
StreamerOutputModule<Consumer>::beginLuminosityBlock(edm::LuminosityBlockPrincipal const&, edm::ModuleCallingContext const*) {}

template<typename Consumer>
void
StreamerOutputModule<Consumer>::endLuminosityBlock(edm::LuminosityBlockPrincipal const&, edm::ModuleCallingContext const*) {}

template<typename Consumer>
void
StreamerOutputModule<Consumer>::fillDescriptions(ConfigurationDescriptions& descriptions) {
Expand Down
9 changes: 6 additions & 3 deletions IOPool/Streamer/interface/StreamerOutputModuleBase.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef IOPool_Streamer_StreamerOutputModuleBase_h
#define IOPool_Streamer_StreamerOutputModuleBase_h

#include "FWCore/Framework/interface/OutputModule.h"
#include "FWCore/Framework/interface/one/OutputModule.h"
#include "FWCore/Utilities/interface/EDGetToken.h"
#include "IOPool/Streamer/interface/MsgTools.h"
#include "IOPool/Streamer/interface/StreamSerializer.h"
Expand All @@ -14,9 +14,11 @@ namespace edm {
class ModuleCallingContext;
class ParameterSetDescription;

class StreamerOutputModuleBase : public OutputModule {
typedef detail::TriggerResultsBasedEventSelector::handle_t Trig;

class StreamerOutputModuleBase : public one::OutputModule<one::WatchRuns, one::WatchLuminosityBlocks> {
public:
explicit StreamerOutputModuleBase(ParameterSet const& ps);
explicit StreamerOutputModuleBase(ParameterSet const& ps);
virtual ~StreamerOutputModuleBase();
static void fillDescription(ParameterSetDescription & desc);

Expand All @@ -36,6 +38,7 @@ namespace edm {

std::auto_ptr<InitMsgBuilder> serializeRegistry();
std::auto_ptr<EventMsgBuilder> serializeEvent(EventPrincipal const& e, ModuleCallingContext const* mcc);
Trig getTriggerResults(EDGetTokenT<TriggerResults> const& token, EventPrincipal const& ep, ModuleCallingContext const*) const;
void setHltMask(EventPrincipal const& e, ModuleCallingContext const*);
void setLumiSection();

Expand Down
17 changes: 15 additions & 2 deletions IOPool/Streamer/src/StreamerOutputModuleBase.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/ParameterSet/interface/ParameterSetDescription.h"
#include "FWCore/Utilities/interface/DebugMacros.h"
#include "FWCore/Framework/interface/PrincipalGetAdapter.h"
//#include "FWCore/Utilities/interface/Digest.h"
#include "FWCore/Version/interface/GetReleaseVersion.h"
#include "DataFormats/Common/interface/TriggerResults.h"
Expand Down Expand Up @@ -55,7 +56,8 @@ namespace {

namespace edm {
StreamerOutputModuleBase::StreamerOutputModuleBase(ParameterSet const& ps) :
OutputModule(ps),
one::OutputModuleBase::OutputModuleBase(ps),
one::OutputModule<one::WatchRuns, one::WatchLuminosityBlocks>(ps),
selections_(&keptProducts()[InEvent]),
maxEventSize_(ps.getUntrackedParameter<int>("max_event_size")),
useCompression_(ps.getUntrackedParameter<bool>("use_compression")),
Expand Down Expand Up @@ -194,12 +196,23 @@ namespace edm {
return init_message;
}

Trig
StreamerOutputModuleBase::getTriggerResults(EDGetTokenT<TriggerResults> const& token, EventPrincipal const& ep, ModuleCallingContext const* mcc) const {
//This cast is safe since we only call const functions of the EventPrincipal after this point
PrincipalGetAdapter adapter(const_cast<EventPrincipal&>(ep), moduleDescription());
adapter.setConsumer(this);
Trig result;
auto bh = adapter.getByToken_(TypeID(typeid(TriggerResults)),PRODUCT_TYPE, token, mcc);
convert_handle(std::move(bh), result);
return result;
}

void
StreamerOutputModuleBase::setHltMask(EventPrincipal const& e, ModuleCallingContext const* mcc) {

hltbits_.clear(); // If there was something left over from last event

Handle<TriggerResults> const& prod = getTriggerResults(trToken_,e, mcc);
Handle<TriggerResults> const& prod = getTriggerResults(trToken_, e, mcc);
//Trig const& prod = getTrigMask(e);
std::vector<unsigned char> vHltState;

Expand Down