CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
SiStripFEDDump.cc
Go to the documentation of this file.
1 #include <sstream>
2 
11 
16 
18 
19 //
20 // Class declaration
21 //
22 
24 public:
25  explicit SiStripFEDDumpPlugin(const edm::ParameterSet&);
26  ~SiStripFEDDumpPlugin() override;
27 
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 // Constructors and destructor
41 //
42 
44  : rawDataTag_(iConfig.getUntrackedParameter<edm::InputTag>("RawDataTag", edm::InputTag("source", ""))),
45  fedIdToDump_(iConfig.getUntrackedParameter<unsigned int>("FEDID", 50)) {
46  rawDataToken_ = consumes<FEDRawDataCollection>(rawDataTag_);
48  edm::LogError("SiStripFEDDump") << "FED ID " << fedIdToDump_ << " is not valid. "
49  << "SiStrip FED IDs are " << uint16_t(FEDNumbering::MINSiStripFEDID) << "-"
50  << uint16_t(FEDNumbering::MAXSiStripFEDID);
51 }
52 
54 
55 //
56 // Member functions
57 //
58 
59 // ------------ method called to for each event ------------
61  //get raw data
62  edm::Handle<FEDRawDataCollection> rawDataCollectionHandle;
63  iEvent.getByToken(rawDataToken_, rawDataCollectionHandle);
64  const FEDRawDataCollection& rawDataCollection = *rawDataCollectionHandle;
65 
66  const FEDRawData& rawData = rawDataCollection.FEDData(fedIdToDump_);
67  const auto st_buffer = sistrip::preconstructCheckFEDBufferBase(rawData, false);
68  if (sistrip::FEDBufferStatusCode::SUCCESS != st_buffer) {
69  throw cms::Exception("FEDBuffer") << st_buffer;
70  }
71  const sistrip::FEDBufferBase buffer{rawData};
72  std::ostringstream os;
73  os << buffer << std::endl;
74  buffer.dump(os);
75  edm::LogVerbatim("SiStripFEDDump") << os.str();
76 }
77 
79  const edm::Run& run,
80  const edm::EventSetup& eSetup) {}
81 
82 //
83 // Define as a plug-in
84 //
85 
Log< level::Info, true > LogVerbatim
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
Log< level::Error, false > LogError
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
int iEvent
Definition: GenABIO.cc:224
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 &)
void analyze(const edm::Event &, const edm::EventSetup &) override
FEDBufferStatusCode preconstructCheckFEDBufferBase(const FEDRawData &fedBuffer, bool checkRecognizedFormat=true)
Definition: Run.h:45