Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-06-29 02:25:41

0001 #ifndef EcalMonitorPrescaler_H
0002 #define EcalMonitorPrescaler_H
0003 
0004 #include "DataFormats/EcalRawData/interface/EcalRawDataCollections.h"
0005 #include "FWCore/Framework/interface/global/EDFilter.h"
0006 
0007 #include <utility>
0008 #include <atomic>
0009 
0010 namespace ecaldqm {
0011   enum Prescalers { kPhysics, kCosmics, kCalibration, kLaser, kLed, kTestPulse, kPedestal, nPrescalers };
0012 
0013   struct PrescaleCounter {
0014     PrescaleCounter() {
0015       for (unsigned iP(0); iP != nPrescalers; ++iP)
0016         counters_[iP] = 0;
0017     }
0018     mutable std::atomic<unsigned> counters_[nPrescalers];
0019   };
0020 }  // namespace ecaldqm
0021 
0022 class EcalMonitorPrescaler : public edm::global::EDFilter<edm::RunCache<ecaldqm::PrescaleCounter>> {
0023 public:
0024   EcalMonitorPrescaler(edm::ParameterSet const &);
0025   ~EcalMonitorPrescaler() override;
0026 
0027   std::shared_ptr<ecaldqm::PrescaleCounter> globalBeginRun(edm::Run const &, edm::EventSetup const &) const override;
0028   bool filter(edm::StreamID, edm::Event &, edm::EventSetup const &) const override;
0029   void globalEndRun(edm::Run const &, edm::EventSetup const &) const override;
0030 
0031 private:
0032   static const uint32_t filterBits_[ecaldqm::nPrescalers];
0033 
0034   edm::EDGetTokenT<EcalRawDataCollection> EcalRawDataCollection_;
0035 
0036   unsigned prescalers_[ecaldqm::nPrescalers];
0037 };
0038 
0039 #endif  // EcalMonitorPrescaler_H