CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 // Created: Thu, 28 May 2015 19:54:56 GMT
14 //
15 //
16 
17 
18 // system include files
19 #include <memory>
20 #include <iostream>
21 
22 // user include files
25 
28 
30 
31 
36 
39 
41 
42 
43 using namespace std;
44 
45 //
46 // class declaration
47 //
48 
49 
51  public:
52  explicit TcdsRawToDigi(const edm::ParameterSet&);
53  ~TcdsRawToDigi();
54 
55  static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
56 
57  private:
58  virtual void produce(edm::Event&, const edm::EventSetup&) override;
59 
61 
62 };
63 
65 {
66  edm::InputTag dataLabel = iConfig.getParameter<edm::InputTag>("InputLabel");
67  dataToken_=consumes<FEDRawDataCollection>(dataLabel);
68  produces<int>( "nibble" ).setBranchAlias( "nibble");
69 }
70 
71 
73 {
74 }
75 
76 
77 //
78 // member functions
79 //
80 
81 // ------------ method called to produce the data ------------
83 {
84  using namespace edm;
85 
87  iEvent.getByToken(dataToken_,rawdata);
88 
89  int nibble=-99;
90  if( rawdata.isValid() ) {
91  const FEDRawData& tcdsData = rawdata->FEDData(FEDNumbering::MINTCDSuTCAFEDID);
92  if(tcdsData.size()>0){
93  evf::evtn::TCDSRecord tcdsRecord(tcdsData.data());
94  nibble = (int)tcdsRecord.getHeader().getData().header.nibble;
95  } else {
96  nibble=-2;
97  }
98  } else {
99  nibble=-1;
100  }
101  //std::cout<<"nibble is "<<nibble<<std::endl;
102 
103  std::unique_ptr<int> pOut(new int(nibble));
104  iEvent.put( std::move(pOut), "nibble" );
105 }
106 
107 
108 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
109 void
111  //The following says we do not know what parameters are allowed so do no validation
112  // Please change this to state exactly what you do use, even if it is no parameters
114  desc.add<edm::InputTag>("InputLabel",edm::InputTag("rawDataCollector"));
115  descriptions.add("tcdsRawToDigi", desc);
116 }
117 
118 //define this as a plug-in
T getParameter(std::string const &) const
TCDSHeader & getHeader()
Definition: FED1024.h:150
virtual void produce(edm::Event &, const edm::EventSetup &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
int iEvent
Definition: GenABIO.cc:230
const tcdsheader & getData()
Definition: FED1024.h:84
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
ParameterDescriptionBase * add(U const &iLabel, T const &value)
TcdsRawToDigi(const edm::ParameterSet &)
edm::EDGetTokenT< FEDRawDataCollection > dataToken_
struct evf::evtn::TCDSHeader::tcdsheader::@317 header
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
dictionary rawdata
Definition: lumiPlot.py:393