CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 
20 // system include files
21 #include <memory>
22 
23 // user include files
26 
29 
31 
32 //FEDRawData
36 // LTC class
38 //
39 // class declaration
40 //
41 
42 class LTCRawToDigi : public edm::EDProducer {
43  public:
44  explicit LTCRawToDigi(const edm::ParameterSet&);
45  ~LTCRawToDigi();
46 
47 
48  virtual void produce(edm::Event&, const edm::EventSetup&) override;
49  private:
50  // ----------member data ---------------------------
51 };
52 
53 //
54 // constants, enums and typedefs
55 //
56 
57 //
58 // static data member definitions
59 //
60 
61 //
62 // constructors and destructor
63 //
65 {
66  //register your products
67  produces<LTCDigiCollection>();
68 }
69 
70 
72 {
73 
74  // do anything here that needs to be done at desctruction time
75  // (e.g. close files, deallocate resources etc.)
76 
77 }
78 
79 
80 //
81 // member functions
82 //
83 
84 // ------------ method called to produce the data ------------
85 void
87 {
88  using namespace edm;
89  const int LTCFedIDLo = 815;
90  const int LTCFedIDHi = 823;
91 
92  // Get a handle to the FED data collection
94  iEvent.getByLabel("source" , rawdata);
95 
96  // create collection we'll save in the event record
97  std::auto_ptr<LTCDigiCollection> pOut(new LTCDigiCollection());
98 
99  // Loop over all possible FED's with the appropriate FED ID
100  for ( int id = LTCFedIDLo; id <= LTCFedIDHi; ++id ) {
102  const FEDRawData & fedData = rawdata->FEDData(id);
103  unsigned short int length = fedData.size();
104  if ( ! length )
105  continue; // bank does not exist
106  LTCDigi ltcDigi(fedData.data());
107  pOut->push_back(ltcDigi);
108  }
109  iEvent.put(pOut);
110 }
111 
112 //define this as a plug-in
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual void produce(edm::Event &, const edm::EventSetup &) override
Definition: LTCRawToDigi.cc:86
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
LTCRawToDigi(const edm::ParameterSet &)
Definition: LTCRawToDigi.cc:64
int iEvent
Definition: GenABIO.cc:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:413
std::vector< LTCDigi > LTCDigiCollection
Definition: LTCDigi.h:106
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