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
FEDNumbering.h
EDProducer.h
edm
HLT enums.
Definition: AlignableModifier.h:19
FEDRawData.h
edm::Handle
Definition: AssociativeIterator.h:50
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
LTCDigi.h
MakerMacros.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
LTCRawToDigi
Definition: LTCRawToDigi.cc:41
LTCDigi
Definition: LTCDigi.h:15
FEDRawDataCollection::FEDData
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
Definition: FEDRawDataCollection.cc:19
edm::ParameterSet
Definition: ParameterSet.h:36
Event.h
LTCRawToDigi::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: LTCRawToDigi.cc:78
iEvent
int iEvent
Definition: GenABIO.cc:224
FEDRawDataCollection.h
edm::EventSetup
Definition: EventSetup.h:57
LTCRawToDigi::~LTCRawToDigi
~LTCRawToDigi() override
Definition: LTCRawToDigi.cc:68
FEDRawData::size
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:45
eostools.move
def move(src, dest)
Definition: eostools.py:511
LTCRawToDigi::LTCRawToDigi
LTCRawToDigi(const edm::ParameterSet &)
Definition: LTCRawToDigi.cc:63
Frameworkfwd.h
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
edm::EDProducer
Definition: EDProducer.h:36
ParameterSet.h
edm::Event
Definition: Event.h:73