CMS 3D CMS Logo

TcdsRawToDigi.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: ProdTutorial/TcdsRawToDigi
4 // Class: TcdsRawToDigi
5 //
11 //
12 // Original Author: Chris Palmer
13 // Improved by : Salvatore Di Guida and Remi Mommsen
14 // Created: Thu, 28 May 2015 19:54:56 GMT
15 //
16 //
17 
18 // system include files
19 #include <memory>
20 #include <iostream>
21 
22 // user include files
25 
28 
30 
33 
35 
36 //
37 // class declaration
38 //
39 
41 public:
42  explicit TcdsRawToDigi(const edm::ParameterSet&);
43  ~TcdsRawToDigi() override;
44 
45  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
46 
47 private:
48  void produce(edm::Event&, const edm::EventSetup&) override;
49 
51 };
52 
54  edm::InputTag dataLabel = iConfig.getParameter<edm::InputTag>("InputLabel");
55  dataToken_ = consumes<FEDRawDataCollection>(dataLabel);
56  produces<TCDSRecord>("tcdsRecord").setBranchAlias("tcdsRecord");
57 }
58 
60 
61 //
62 // member functions
63 //
64 
65 // ------------ method called to produce the data ------------
67  using namespace edm;
68 
70  iEvent.getByToken(dataToken_, rawdata);
71 
72  TCDSRecord tcdsRecord;
73  if (rawdata.isValid()) {
74  uint16_t selectedId = 0;
76  const FEDRawData& tcdsData = rawdata->FEDData(fedId);
77  if (tcdsData.size() > 0) {
78  if (selectedId)
79  throw cms::Exception("TcdsRawToDigi::produce")
80  << "Second TCDS FED ID " << fedId << " found. First ID: " << selectedId;
81  tcdsRecord = TCDSRecord(tcdsData.data());
82  selectedId = fedId;
83  }
84  }
85  }
86  iEvent.put(std::make_unique<TCDSRecord>(tcdsRecord), "tcdsRecord");
87 }
88 
89 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
91  //The following says we do not know what parameters are allowed so do no validation
92  // Please change this to state exactly what you do use, even if it is no parameters
94  desc.add<edm::InputTag>("InputLabel", edm::InputTag("rawDataCollector"));
95  descriptions.add("tcdsRawToDigi", desc);
96 }
97 
98 //define this as a plug-in
FEDNumbering.h
FEDNumbering::MAXTCDSuTCAFEDID
Definition: FEDNumbering.h:102
edm::EDGetTokenT< FEDRawDataCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
HLT_FULL_cff.InputTag
InputTag
Definition: HLT_FULL_cff.py:89285
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
EDProducer.h
FEDNumbering::MINTCDSuTCAFEDID
Definition: FEDNumbering.h:101
edm::Handle< FEDRawDataCollection >
FEDRawData::data
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
FEDRawData
Definition: FEDRawData.h:19
TcdsRawToDigi::dataToken_
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
Definition: TcdsRawToDigi.cc:50
MakerMacros.h
TcdsRawToDigi::TcdsRawToDigi
TcdsRawToDigi(const edm::ParameterSet &)
Definition: TcdsRawToDigi.cc:53
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
TCDSRecord.h
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
TcdsRawToDigi::~TcdsRawToDigi
~TcdsRawToDigi() override
Definition: TcdsRawToDigi.cc:59
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
edm::ConfigurationDescriptions
Definition: ConfigurationDescriptions.h:28
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
iEvent
int iEvent
Definition: GenABIO.cc:224
FEDRawDataCollection.h
edm::stream::EDProducer
Definition: EDProducer.h:38
edm::EventSetup
Definition: EventSetup.h:58
l1tstage2_dqm_sourceclient-live_cfg.fedId
fedId
Definition: l1tstage2_dqm_sourceclient-live_cfg.py:88
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
submitPVResolutionJobs.desc
string desc
Definition: submitPVResolutionJobs.py:251
Frameworkfwd.h
TCDSRecord
Class to contain information from TCDS FED.
Definition: TCDSRecord.h:19
TcdsRawToDigi::fillDescriptions
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Definition: TcdsRawToDigi.cc:90
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
ParameterSet.h
TcdsRawToDigi
Definition: TcdsRawToDigi.cc:40
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::Event
Definition: Event.h:73
edm::InputTag
Definition: InputTag.h:15
TcdsRawToDigi::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: TcdsRawToDigi.cc:66