CMS 3D CMS Logo

SiStripFEDDump.cc
Go to the documentation of this file.
1 #include <sstream>
2 
11 
16 
18 
19 //
20 // Class declaration
21 //
22 
24 {
25  public:
26  explicit SiStripFEDDumpPlugin(const edm::ParameterSet&);
27  ~SiStripFEDDumpPlugin() override;
28  private:
29  void analyze(const edm::Event&, const edm::EventSetup&) override;
30  void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
31 
32  //tag of FEDRawData collection
35  //FED ID to dump
36  unsigned int fedIdToDump_;
37 };
38 
39 
40 //
41 // Constructors and destructor
42 //
43 
45  : rawDataTag_(iConfig.getUntrackedParameter<edm::InputTag>("RawDataTag",edm::InputTag("source",""))),
46  fedIdToDump_(iConfig.getUntrackedParameter<unsigned int>("FEDID",50))
47 {
48  rawDataToken_ = consumes<FEDRawDataCollection>(rawDataTag_);
50  edm::LogError("SiStripFEDDump") << "FED ID " << fedIdToDump_ << " is not valid. "
51  << "SiStrip FED IDs are " << uint16_t(FEDNumbering::MINSiStripFEDID) << "-" << uint16_t(FEDNumbering::MAXSiStripFEDID);
52 }
53 
55 {
56 }
57 
58 
59 //
60 // Member functions
61 //
62 
63 // ------------ method called to for each event ------------
64 void
66 {
67  //get raw data
68  edm::Handle<FEDRawDataCollection> rawDataCollectionHandle;
69  iEvent.getByToken(rawDataToken_,rawDataCollectionHandle);
70  const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle;
71 
72  const FEDRawData& rawData = rawDataCollection.FEDData(fedIdToDump_);
73  const sistrip::FEDBufferBase buffer(rawData.data(),rawData.size(),true);
74  std::ostringstream os;
75  os << buffer << std::endl;
76  buffer.dump(os);
77  edm::LogVerbatim("SiStripFEDDump") << os.str();
78 }
79 
81 {
82 }
83 
84 //
85 // Define as a plug-in
86 //
87 
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
size_t size() const
Lenght of the data buffer in bytes.
Definition: FEDRawData.h:47
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:230
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
unsigned int fedIdToDump_
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
edm::InputTag rawDataTag_
~SiStripFEDDumpPlugin() override
SiStripFEDDumpPlugin(const edm::ParameterSet &)
HLT enums.
void analyze(const edm::Event &, const edm::EventSetup &) override
const unsigned char * data() const
Return a const pointer to the beginning of the data buffer.
Definition: FEDRawData.cc:28
Definition: Run.h:44