00001 // 00002 // Original Author: Marco ZANETTI 00003 // Created: Mon Jan 28 18:22:13 CET 2008 00004 00005 00006 00007 #include <memory> 00008 #include <utility> 00009 00010 #include "FWCore/Framework/interface/Frameworkfwd.h" 00011 #include "FWCore/Framework/interface/EDProducer.h" 00012 #include "FWCore/Framework/interface/Event.h" 00013 #include "FWCore/Framework/interface/MakerMacros.h" 00014 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00015 00016 #include <DataFormats/FEDRawData/interface/FEDRawDataCollection.h> 00017 #include <DataFormats/FEDRawData/interface/FEDRawData.h> 00018 #include <DataFormats/FEDRawData/interface/FEDNumbering.h> 00019 00020 #include <EventFilter/RawDataCollector/interface/RawDataFEDSelector.h> 00021 00022 class RawDataSelector : public edm::EDProducer { 00023 00024 public: 00025 00026 explicit RawDataSelector(const edm::ParameterSet&); 00027 00028 ~RawDataSelector(); 00029 00030 private: 00031 00032 virtual void produce(edm::Event&, const edm::EventSetup&) override; 00033 00034 RawDataFEDSelector * selector; 00035 00036 edm::InputTag dataLabel; 00037 std::pair<int,int> fedRange; 00038 00039 }; 00040 00041 RawDataSelector::RawDataSelector(const edm::ParameterSet& pset) : 00042 dataLabel(pset.getUntrackedParameter<edm::InputTag>("InputLabel",edm::InputTag("source"))) { 00043 00044 fedRange = std::pair<int,int>(pset.getParameter<int>("lowerBound"), pset.getParameter<int>("upperBound")); 00045 00046 selector = new RawDataFEDSelector(); 00047 00048 produces<FEDRawDataCollection>(); 00049 00050 } 00051 00052 00053 RawDataSelector::~RawDataSelector() { 00054 delete selector; 00055 } 00056 00057 00058 void RawDataSelector::produce(edm::Event& iEvent, const edm::EventSetup& iSetup) { 00059 00060 using namespace edm; 00061 using namespace std; 00062 00063 Handle<FEDRawDataCollection> rawData; 00064 iEvent.getByLabel( dataLabel, rawData); 00065 00066 /* here eventually perform some operation to get the list of FED's 00067 to be written in the new collection. 00068 In this case we simply take the range from the ParameterSet */ 00069 00070 00071 // the filtered raw data collections 00072 auto_ptr<FEDRawDataCollection> selectedRawData = selector->select(rawData, fedRange); 00073 00074 00075 iEvent.put(selectedRawData); 00076 00077 } 00078 00079 00080 //define this as a plug-in 00081 DEFINE_FWK_MODULE(RawDataSelector);