Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:07:27

0001 #ifndef DQTask_h
0002 #define DQTask_h
0003 
0004 /*
0005  *  file:       DQTask.h
0006  *  Author:     VK
0007  *  Date:       13.10.2015
0008  */
0009 
0010 #include "CalibFormats/HcalObjects/interface/HcalDbService.h"
0011 #include "CalibFormats/HcalObjects/interface/HcalDbRecord.h"
0012 #include "CondFormats/HcalObjects/interface/HcalChannelQuality.h"
0013 #include "CondFormats/DataRecord/interface/HcalChannelQualityRcd.h"
0014 #include "CondFormats/RunInfo/interface/RunInfo.h"
0015 #include "CondFormats/DataRecord/interface/RunSummaryRcd.h"
0016 
0017 #include "DQM/HcalCommon/interface/ContainerI.h"
0018 #include "DQM/HcalCommon/interface/ContainerS.h"
0019 #include "DQM/HcalCommon/interface/ContainerXXX.h"
0020 #include "DQM/HcalCommon/interface/DQModule.h"
0021 #include "FWCore/Framework/interface/ESHandle.h"
0022 #include "FWCore/Utilities/interface/ESGetToken.h"
0023 
0024 namespace hcaldqm {
0025 
0026   struct Cache {
0027     int EvtCntLS;
0028     int currentLS;
0029     ContainerXXX<uint32_t> xQuality;
0030   };
0031 
0032   enum UpdateFreq { fEvent = 0, f1LS = 1, f10LS = 2, f50LS = 3, f100LS = 4, nUpdateFreq = 5 };
0033   class DQTask : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<hcaldqm::Cache>>, public DQModule {
0034   public:
0035     //  constructor
0036     DQTask(edm::ParameterSet const &);
0037     ~DQTask() override {}
0038 
0039     //  base inheritance to override from DQMEDAnalyzer
0040     void analyze(edm::Event const &, edm::EventSetup const &) override;
0041     void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override;
0042     void dqmBeginRun(edm::Run const &, edm::EventSetup const &) override;
0043     std::shared_ptr<hcaldqm::Cache> globalBeginLuminosityBlock(edm::LuminosityBlock const &,
0044                                                                edm::EventSetup const &) const override;
0045     void globalEndLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) override;
0046     static void fillPSetDescription(edm::ParameterSetDescription &des);
0047 
0048   protected:
0049     // protected funcs
0050     virtual void _resetMonitors(UpdateFreq);
0051     virtual void _process(edm::Event const &, edm::EventSetup const &) = 0;
0052     virtual bool _isApplicable(edm::Event const &) { return true; }
0053     virtual int _getCalibType(edm::Event const &);
0054 
0055     //  protected vars
0056     ContainerI _cEvsTotal;
0057     ContainerI _cEvsPerLS;
0058     ContainerI _cRunKeyVal;
0059     ContainerS _cRunKeyName;
0060     ContainerS _cProcessingTypeName;
0061 
0062     //  counters
0063     int _procLSs;
0064 
0065     //  container of quality masks from conddb
0066     ContainerXXX<uint32_t> _xQuality;
0067     //  vector of Electronics raw Ids of HCAL FEDs
0068     //  registered at cDAQ for the Run
0069     std::vector<uint32_t> _vcdaqEids;
0070 
0071     //  Tags and corresponding Tokens
0072     edm::InputTag _tagRaw;
0073     edm::EDGetTokenT<FEDRawDataCollection> _tokRaw;
0074 
0075     // Conditions and emap
0076     edm::ESGetToken<HcalDbService, HcalDbRecord> hcalDbServiceToken_;
0077     edm::ESGetToken<RunInfo, RunInfoRcd> runInfoToken_;
0078     edm::ESGetToken<HcalChannelQuality, HcalChannelQualityRcd> hcalChannelQualityToken_;
0079 
0080     edm::ESHandle<HcalDbService> _dbService;
0081     HcalElectronicsMap const *_emap = nullptr;
0082   };
0083 }  // namespace hcaldqm
0084 
0085 #endif