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 
41 class LTCRawToDigi : public edm::EDProducer {
42 public:
43  explicit LTCRawToDigi(const edm::ParameterSet&);
44  ~LTCRawToDigi() override;
45 
46  void produce(edm::Event&, const edm::EventSetup&) override;
47 
48 private:
49  // ----------member data ---------------------------
50 };
51 
52 //
53 // constants, enums and typedefs
54 //
55 
56 //
57 // static data member definitions
58 //
59 
60 //
61 // constructors and destructor
62 //
64  //register your products
65  produces<LTCDigiCollection>();
66 }
67 
69  // do anything here that needs to be done at desctruction time
70  // (e.g. close files, deallocate resources etc.)
71 }
72 
73 //
74 // member functions
75 //
76 
77 // ------------ method called to produce the data ------------
79  using namespace edm;
80  const int LTCFedIDLo = 815;
81  const int LTCFedIDHi = 823;
82 
83  // Get a handle to the FED data collection
85  iEvent.getByLabel("source", rawdata);
86 
87  // create collection we'll save in the event record
88  auto pOut = std::make_unique<LTCDigiCollection>();
89 
90  // Loop over all possible FED's with the appropriate FED ID
91  for (int id = LTCFedIDLo; id <= LTCFedIDHi; ++id) {
93  const FEDRawData& fedData = rawdata->FEDData(id);
94  unsigned short int length = fedData.size();
95  if (!length)
96  continue; // bank does not exist
97  LTCDigi ltcDigi(fedData.data());
98  pOut->push_back(ltcDigi);
99  }
100  iEvent.put(std::move(pOut));
101 }
102 
103 //define this as a plug-in
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
void produce(edm::Event &, const edm::EventSetup &) override
Definition: LTCRawToDigi.cc:78
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
LTCRawToDigi(const edm::ParameterSet &)
Definition: LTCRawToDigi.cc:63
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
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
~LTCRawToDigi() override
Definition: LTCRawToDigi.cc:68
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