CMS 3D CMS Logo

LTCRawToDigi.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: LTCRawToDigi
4 // Class: LTCRawToDigi
5 //
13 //
14 // Original Author: Peter Wittich
15 // Created: Tue May 9 07:47:59 CDT 2006
16 //
17 //
18 
19 // system include files
20 #include <memory>
21 
22 // user include files
25 
28 
30 
31 //FEDRawData
35 // LTC class
37 //
38 // class declaration
39 //
40 
42 public:
43  explicit LTCRawToDigi(const edm::ParameterSet&);
44 
45  void produce(edm::StreamID, edm::Event&, const edm::EventSetup&) const override;
46 
47 private:
48  // ----------member data ---------------------------
49 };
50 
51 //
52 // constants, enums and typedefs
53 //
54 
55 //
56 // static data member definitions
57 //
58 
59 //
60 // constructors and destructor
61 //
63  //register your products
64  produces<LTCDigiCollection>();
65 }
66 
67 //
68 // member functions
69 //
70 
71 // ------------ method called to produce the data ------------
73  using namespace edm;
74  const int LTCFedIDLo = 815;
75  const int LTCFedIDHi = 823;
76 
77  // Get a handle to the FED data collection
79  iEvent.getByLabel("source", rawdata);
80 
81  // create collection we'll save in the event record
82  auto pOut = std::make_unique<LTCDigiCollection>();
83 
84  // Loop over all possible FED's with the appropriate FED ID
85  for (int id = LTCFedIDLo; id <= LTCFedIDHi; ++id) {
87  const FEDRawData& fedData = rawdata->FEDData(id);
88  unsigned short int length = fedData.size();
89  if (!length)
90  continue; // bank does not exist
91  LTCDigi ltcDigi(fedData.data());
92  pOut->push_back(ltcDigi);
93  }
94  iEvent.put(std::move(pOut));
95 }
96 
97 //define this as a plug-in
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Definition: LTCRawToDigi.cc:72
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
LTCRawToDigi(const edm::ParameterSet &)
Definition: LTCRawToDigi.cc:62
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
HLT enums.
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:24
def move(src, dest)
Definition: eostools.py:511