File indexing completed on 2024-04-06 12:10:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020 #include <memory>
0021
0022
0023 #include "FWCore/Framework/interface/Frameworkfwd.h"
0024 #include "FWCore/Framework/interface/global/EDProducer.h"
0025
0026 #include "FWCore/Framework/interface/Event.h"
0027 #include "FWCore/Framework/interface/MakerMacros.h"
0028
0029 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0030
0031
0032 #include "DataFormats/FEDRawData/interface/FEDRawData.h"
0033 #include "DataFormats/FEDRawData/interface/FEDNumbering.h"
0034 #include "DataFormats/FEDRawData/interface/FEDRawDataCollection.h"
0035
0036 #include "DataFormats/LTCDigi/interface/LTCDigi.h"
0037
0038
0039
0040
0041 class LTCRawToDigi : public edm::global::EDProducer<> {
0042 public:
0043 explicit LTCRawToDigi(const edm::ParameterSet&);
0044
0045 void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
0046
0047 private:
0048
0049 };
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059
0060
0061
0062 LTCRawToDigi::LTCRawToDigi(const edm::ParameterSet& iConfig) {
0063
0064 produces<LTCDigiCollection>();
0065 }
0066
0067
0068
0069
0070
0071
0072 void LTCRawToDigi::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0073 using namespace edm;
0074 const int LTCFedIDLo = 815;
0075 const int LTCFedIDHi = 823;
0076
0077
0078 edm::Handle<FEDRawDataCollection> rawdata;
0079 iEvent.getByLabel("source", rawdata);
0080
0081
0082 auto pOut = std::make_unique<LTCDigiCollection>();
0083
0084
0085 for (int id = LTCFedIDLo; id <= LTCFedIDHi; ++id) {
0086
0087 const FEDRawData& fedData = rawdata->FEDData(id);
0088 unsigned short int length = fedData.size();
0089 if (!length)
0090 continue;
0091 LTCDigi ltcDigi(fedData.data());
0092 pOut->push_back(ltcDigi);
0093 }
0094 iEvent.put(std::move(pOut));
0095 }
0096
0097
0098 DEFINE_FWK_MODULE(LTCRawToDigi);