CMS 3D CMS Logo

HcalUMNioTableProducer.cc
Go to the documentation of this file.
1 // system include files
2 #include <memory>
3 
4 // user include files
8 
11 
15 
18 
20 private:
23 
24 public:
25  explicit HcalUMNioTableProducer(const edm::ParameterSet& iConfig)
26  : tagUMNio_(iConfig.getUntrackedParameter<edm::InputTag>("tagUMNio", edm::InputTag("hcalDigis"))) {
27  tokenUMNio_ = consumes<HcalUMNioDigi>(tagUMNio_);
28 
29  produces<nanoaod::FlatTable>("uMNioTable");
30  }
31 
33 
34  /*
35  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
36  edm::ParameterSetDescription desc;
37  desc.add<edm::InputTag>("tagUMNio")->setComment("Input uMNio digi collection");
38  descriptions.add("HcalUMNioTable", desc);
39  }
40  */
41 
42 private:
43  void beginRun(edm::Run const&, edm::EventSetup const&) override;
44  void produce(edm::Event&, edm::EventSetup const&) override;
45 };
46 
47 void HcalUMNioTableProducer::beginRun(edm::Run const& iRun, edm::EventSetup const& iSetup) {}
48 
51  iEvent.getByToken(tokenUMNio_, uMNioDigi);
52  uint8_t eventType = uMNioDigi->eventType();
53 
54  auto uMNioNanoTable = std::make_unique<nanoaod::FlatTable>(1, "uMNio", true);
55  uMNioNanoTable->addColumnValue<uint8_t>("EventType", eventType, "EventType");
56  for (int iWord = 0; iWord < uMNioDigi->numberUserWords(); ++iWord) {
57  uint32_t thisWord = uMNioDigi->valueUserWord(iWord);
58  uMNioNanoTable->addColumnValue<uint32_t>(
59  "UserWord" + std::to_string(iWord), thisWord, "UserWord" + std::to_string(iWord));
60  }
61  iEvent.put(std::move(uMNioNanoTable), "uMNioTable");
62 }
63 
65 //define this as a plug-in
edm::EDGetTokenT< HcalUMNioDigi > tokenUMNio_
void produce(edm::Event &, edm::EventSetup const &) override
int numberUserWords() const
static std::string to_string(const XMLCh *ch)
uint32_t valueUserWord(int iword) const
int iEvent
Definition: GenABIO.cc:224
void beginRun(edm::Run const &, edm::EventSetup const &) override
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
uint8_t eventType() const
HLT enums.
HcalUMNioTableProducer(const edm::ParameterSet &iConfig)
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45