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