Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:10:14

0001 #ifndef DQMServices_StreamerIO_DQMStreamerReader_h
0002 #define DQMServices_StreamerIO_DQMStreamerReader_h
0003 
0004 #include "FWCore/ServiceRegistry/interface/Service.h"
0005 #include "IOPool/Streamer/interface/StreamerInputSource.h"
0006 #include "IOPool/Streamer/interface/StreamerInputFile.h"
0007 #include "IOPool/Streamer/interface/MsgTools.h"
0008 
0009 #include "DQMFileIterator.h"
0010 #include "DQMMonitoringService.h"
0011 #include "TriggerSelector.h"
0012 
0013 #include <memory>
0014 #include <string>
0015 #include <vector>
0016 
0017 namespace dqmservices {
0018 
0019   class DQMStreamerReader : public edm::StreamerInputSource {
0020   public:
0021     DQMStreamerReader(edm::ParameterSet const& pset, edm::InputSourceDescription const& desc);
0022     ~DQMStreamerReader() override;
0023 
0024     static void fillDescriptions(edm::ConfigurationDescriptions& descriptions);
0025 
0026     bool newHeader();
0027 
0028   protected:
0029     Next checkNext() override;      /* from raw input source */
0030     void skip(int toSkip) override; /* from raw input source */
0031     void genuineReadFile() override;
0032     void genuineCloseFile() override;
0033 
0034   private:
0035     // our own, but we do inherit reset(),
0036     // which will break things if called
0037     void reset_() override;
0038 
0039     void openFileImp_(const DQMFileIterator::LumiEntry& entry);
0040     void closeFileImp_(const std::string& reason);
0041 
0042     bool openNextFileImp_();
0043 
0044     InitMsgView const* getHeaderMsg();
0045     EventMsgView const* getEventMsg();
0046 
0047     EventMsgView const* prepareNextEvent();
0048 
0049     bool isFirstFile_ = true;
0050     bool prepareNextFile();
0051     bool acceptEvent(const EventMsgView*);
0052 
0053     DQMFileIterator fiterator_;
0054     unsigned int processedEventPerLs_ = 0;
0055 
0056     unsigned int const minEventsPerLs_;
0057     bool const flagSkipFirstLumis_;
0058     bool const flagEndOfRunKills_;
0059     bool const flagDeleteDatFiles_;
0060     std::vector<std::string> const hltSel_;
0061 
0062     bool acceptAllEvt_ = false;
0063     bool setAcceptAllEvt();
0064 
0065     bool matchTriggerSel_ = false;
0066     bool setMatchTriggerSel(std::vector<std::string> const& tnames);
0067 
0068     struct OpenFile {
0069       std::unique_ptr<edm::StreamerInputFile> streamFile_;
0070       DQMFileIterator::LumiEntry lumi_;
0071 
0072       bool open() { return (streamFile_.get() != nullptr); }
0073 
0074     } file_;
0075 
0076     std::shared_ptr<edm::EventSkipperByID> eventSkipperByID_;
0077     std::shared_ptr<TriggerSelector> triggerSelector_;
0078 
0079     /* this is for monitoring */
0080     edm::Service<DQMMonitoringService> mon_;
0081   };
0082 
0083 }  // namespace dqmservices
0084 
0085 #endif  // DQMServices_StreamerIO_DQMStreamerReader_h