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 
19 // system include files
20 #include <memory>
21 #include <iostream>
22 
23 // user include files
26 
29 
31 
34 
36 
37 
38 //
39 // class declaration
40 //
41 
42 
44  public:
45  explicit TcdsRawToDigi(const edm::ParameterSet&);
46  ~TcdsRawToDigi() override;
47 
48  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
49 
50  private:
51  void produce(edm::Event&, const edm::EventSetup&) override;
52 
54 
55 };
56 
58 {
59  edm::InputTag dataLabel = iConfig.getParameter<edm::InputTag>("InputLabel");
60  dataToken_=consumes<FEDRawDataCollection>(dataLabel);
61  produces<TCDSRecord>( "tcdsRecord" ).setBranchAlias( "tcdsRecord" );
62 }
63 
64 
66 {
67 }
68 
69 
70 //
71 // member functions
72 //
73 
74 // ------------ method called to produce the data ------------
76 {
77  using namespace edm;
78 
80  iEvent.getByToken(dataToken_,rawdata);
81 
82  TCDSRecord tcdsRecord;
83  if( rawdata.isValid() ) {
84  const FEDRawData& tcdsData = rawdata->FEDData(FEDNumbering::MINTCDSuTCAFEDID);
85  if(tcdsData.size()>0){
86  tcdsRecord = TCDSRecord(tcdsData.data());
87  }
88  }
89  iEvent.put(std::make_unique<TCDSRecord>(tcdsRecord), "tcdsRecord");
90 }
91 
92 
93 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
94 void
96  //The following says we do not know what parameters are allowed so do no validation
97  // Please change this to state exactly what you do use, even if it is no parameters
99  desc.add<edm::InputTag>("InputLabel",edm::InputTag("rawDataCollector"));
100  descriptions.add("tcdsRawToDigi", desc);
101 }
102 
103 //define this as a plug-in
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
void produce(edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
~TcdsRawToDigi() override
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
Class to contain information from TCDS FED.
Definition: TCDSRecord.h:21
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:230
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
ParameterDescriptionBase * add(U const &iLabel, T const &value)
bool isValid() const
Definition: HandleBase.h:74
TcdsRawToDigi(const edm::ParameterSet &)
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
void add(std::string const &label, ParameterSetDescription const &psetDescription)
HLT enums.
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28