File indexing completed on 2024-04-06 12:11:06
0001 #include <memory>
0002
0003 #include "EvFFEDSelector.h"
0004
0005 #include <FWCore/ParameterSet/interface/ConfigurationDescriptions.h>
0006 #include <FWCore/ParameterSet/interface/ParameterSetDescription.h>
0007
0008 namespace evf {
0009
0010 EvFFEDSelector::EvFFEDSelector(edm::ParameterSet const& config)
0011 : token_(consumes<FEDRawDataCollection>(config.getParameter<edm::InputTag>("inputTag"))),
0012 fedlist_(config.getParameter<std::vector<unsigned int> >("fedList")) {
0013 produces<FEDRawDataCollection>();
0014 }
0015
0016 void EvFFEDSelector::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0017 edm::ParameterSetDescription desc;
0018 desc.add<edm::InputTag>("inputTag", edm::InputTag("source"));
0019 {
0020 std::vector<unsigned int> temp1;
0021 temp1.reserve(2);
0022 temp1.push_back(812);
0023 temp1.push_back(1023);
0024 desc.add<std::vector<unsigned int> >("fedList", temp1);
0025 }
0026 descriptions.add("EvFFEDSelector", desc);
0027 }
0028
0029 void EvFFEDSelector::produce(edm::StreamID sid, edm::Event& event, edm::EventSetup const& setup) const {
0030 edm::Handle<FEDRawDataCollection> rawdata;
0031 event.getByToken(token_, rawdata);
0032
0033 std::unique_ptr<FEDRawDataCollection> fedcoll(new FEDRawDataCollection());
0034
0035 for (unsigned int i : fedlist_)
0036 if (rawdata->FEDData(i).size() > 0)
0037 fedcoll->FEDData(i) = rawdata->FEDData(i);
0038
0039 event.put(std::move(fedcoll));
0040 }
0041
0042 }