File indexing completed on 2024-04-06 12:19:12
0001
0002 #include "FWCore/Framework/interface/Event.h"
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004
0005 #if 1
0006 #include "DataFormats/TestObjects/interface/StreamTestThing.h"
0007 #include "DataFormats/TestObjects/interface/StreamTestTmpl.h"
0008 typedef edmtestprod::StreamTestThing WriteThis;
0009 #else
0010 #include "FWCore/Integration/interface/IntArray.h"
0011 typedef edmtestprod::IntArray WriteThis;
0012 #endif
0013
0014 #include "IOPool/Streamer/test/StreamThingProducer.h"
0015 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0016
0017 #include <sstream>
0018
0019 using namespace edmtestprod;
0020
0021 namespace edmtest_thing {
0022 typedef StreamTestTmpl<OSimple> TestDbl;
0023
0024 StreamThingProducer::StreamThingProducer(edm::ParameterSet const& ps)
0025 : size_(ps.getParameter<int>("array_size")),
0026 inst_count_(ps.getParameter<int>("instance_count")),
0027 start_count_(ps.getUntrackedParameter<int>("start_count", 0)),
0028 apply_bit_mask_(ps.getUntrackedParameter<bool>("apply_bit_mask", false)),
0029 bit_mask_(ps.getUntrackedParameter<uint32_t>("bit_mask", 0)) {
0030 for (int i = 0; i < inst_count_; ++i) {
0031 std::ostringstream ost;
0032 ost << (i + start_count_);
0033 names_.push_back(ost.str());
0034 produces<WriteThis>(ost.str());
0035 }
0036
0037
0038
0039
0040 }
0041
0042 StreamThingProducer::~StreamThingProducer() {}
0043
0044
0045 void StreamThingProducer::produce(edm::StreamID, edm::Event& e, edm::EventSetup const&) const {
0046 for (int i = 0; i < inst_count_; ++i) {
0047 auto result = std::make_unique<WriteThis>(size_);
0048
0049
0050
0051
0052
0053 if (apply_bit_mask_) {
0054 for (int j = 0; j < size_; ++j) {
0055 result->data_.at(j) &= bit_mask_;
0056 }
0057 }
0058
0059 e.put(std::move(result), names_[i]);
0060 }
0061
0062
0063
0064
0065 }
0066 }
0067
0068 using edmtest_thing::StreamThingProducer;
0069 DEFINE_FWK_MODULE(StreamThingProducer);