CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripFEDDump.cc
Go to the documentation of this file.
1 #include <sstream>
2 
10 
15 
16 //
17 // Class declaration
18 //
19 
21 {
22  public:
23  explicit SiStripFEDDumpPlugin(const edm::ParameterSet&);
25  private:
26  virtual void beginJob();
27  virtual void analyze(const edm::Event&, const edm::EventSetup&);
28  virtual void endJob();
29 
30  //tag of FEDRawData collection
32  //FED ID to dump
33  unsigned int fedIdToDump_;
34 };
35 
36 
37 //
38 // Constructors and destructor
39 //
40 
42  : rawDataTag_(iConfig.getUntrackedParameter<edm::InputTag>("RawDataTag",edm::InputTag("source",""))),
43  fedIdToDump_(iConfig.getUntrackedParameter<unsigned int>("FEDID",50))
44 {
46  edm::LogError("SiStripFEDDump") << "FED ID " << fedIdToDump_ << " is not valid. "
47  << "SiStrip FED IDs are " << uint16_t(FEDNumbering::MINSiStripFEDID) << "-" << uint16_t(FEDNumbering::MAXSiStripFEDID);
48 }
49 
51 {
52 }
53 
54 
55 //
56 // Member functions
57 //
58 
59 // ------------ method called to for each event ------------
60 void
62 {
63  //get raw data
64  edm::Handle<FEDRawDataCollection> rawDataCollectionHandle;
65  iEvent.getByLabel(rawDataTag_,rawDataCollectionHandle);
66  const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle;
67 
68  const FEDRawData& rawData = rawDataCollection.FEDData(fedIdToDump_);
69  const sistrip::FEDBufferBase buffer(rawData.data(),rawData.size(),true);
70  std::ostringstream os;
71  os << buffer << std::endl;
72  buffer.dump(os);
73  edm::LogVerbatim("SiStripFEDDump") << os.str();
74 }
75 
76 // ------------ method called once each job just before starting event loop ------------
77 void
79 {
80 }
81 
82 // ------------ method called once each job just after ending the event loop ------------
83 void
85 {
86 }
87 
88 //
89 // Define as a plug-in
90 //
91 
virtual void endJob()
virtual void beginJob()
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:49
int iEvent
Definition: GenABIO.cc:243
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
unsigned int fedIdToDump_
virtual void analyze(const edm::Event &, const edm::EventSetup &)
edm::InputTag rawDataTag_
void dump(std::ostream &os) const
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
SiStripFEDDumpPlugin(const edm::ParameterSet &)
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:29