CMS 3D CMS Logo

SiStripFEDDump.cc
Go to the documentation of this file.
1 #include <sstream>
2 
10 
15 
17 
18 //
19 // Class declaration
20 //
21 
23 public:
24  explicit SiStripFEDDumpPlugin(const edm::ParameterSet&);
25  ~SiStripFEDDumpPlugin() override;
26 
27 private:
28  void analyze(const edm::Event&, const edm::EventSetup&) override;
29  void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
30 
31  //tag of FEDRawData collection
34  //FED ID to dump
35  unsigned int fedIdToDump_;
36 };
37 
38 //
39 // Constructors and destructor
40 //
41 
43  : rawDataTag_(iConfig.getUntrackedParameter<edm::InputTag>("RawDataTag", edm::InputTag("source", ""))),
44  fedIdToDump_(iConfig.getUntrackedParameter<unsigned int>("FEDID", 50)) {
45  rawDataToken_ = consumes<FEDRawDataCollection>(rawDataTag_);
47  edm::LogError("SiStripFEDDump") << "FED ID " << fedIdToDump_ << " is not valid. "
48  << "SiStrip FED IDs are " << uint16_t(FEDNumbering::MINSiStripFEDID) << "-"
49  << uint16_t(FEDNumbering::MAXSiStripFEDID);
50 }
51 
53 
54 //
55 // Member functions
56 //
57 
58 // ------------ method called to for each event ------------
60  //get raw data
61  edm::Handle<FEDRawDataCollection> rawDataCollectionHandle;
62  iEvent.getByToken(rawDataToken_, rawDataCollectionHandle);
63  const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle;
64 
65  const FEDRawData& rawData = rawDataCollection.FEDData(fedIdToDump_);
66  const auto st_buffer = sistrip::preconstructCheckFEDBufferBase(rawData, false);
67  if (sistrip::FEDBufferStatusCode::SUCCESS != st_buffer) {
68  throw cms::Exception("FEDBuffer") << st_buffer;
69  }
71  std::ostringstream os;
72  os << buffer << std::endl;
73  buffer.dump(os);
74  edm::LogVerbatim("SiStripFEDDump") << os.str();
75 }
76 
78  const edm::Run& run,
79  const edm::EventSetup& eSetup) {}
80 
81 //
82 // Define as a plug-in
83 //
84 
Log< level::Info, true > LogVerbatim
Log< level::Error, false > LogError
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:224
unsigned int fedIdToDump_
edm::EDGetTokenT< FEDRawDataCollection > rawDataToken_
edm::InputTag rawDataTag_
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
const FEDRawData & FEDData(int fedid) const
retrieve data for fed
~SiStripFEDDumpPlugin() override
SiStripFEDDumpPlugin(const edm::ParameterSet &)
HLT enums.
void analyze(const edm::Event &, const edm::EventSetup &) override
FEDBufferStatusCode preconstructCheckFEDBufferBase(const FEDRawData &fedBuffer, bool checkRecognizedFormat=true)
Definition: Run.h:45