Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-07 22:33:00

0001 #ifndef PresampleTask_H
0002 #define PresampleTask_H
0003 
0004 #include "DQWorkerTask.h"
0005 
0006 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0007 #include "DataFormats/EcalDigi/interface/EcalDataFrame.h"
0008 #include "FWCore/Framework/interface/ESHandle.h"
0009 #include "CondFormats/EcalObjects/interface/EcalPedestals.h"
0010 #include "CondFormats/DataRecord/interface/EcalPedestalsRcd.h"
0011 #include "FWCore/Framework/interface/ConsumesCollector.h"
0012 
0013 namespace ecaldqm {
0014   class PresampleTask : public DQWorkerTask {
0015   public:
0016     PresampleTask();
0017     ~PresampleTask() override {}
0018 
0019     bool filterRunType(short const*) override;
0020 
0021     void beginRun(edm::Run const&, edm::EventSetup const&) override;
0022     void beginEvent(edm::Event const&, edm::EventSetup const&, bool const&, bool&) override;
0023     bool analyze(void const*, Collections) override;
0024 
0025     template <typename DigiCollection>
0026     void runOnDigis(DigiCollection const&);
0027     void setTokens(edm::ConsumesCollector&) override;
0028 
0029   private:
0030     void setParams(edm::ParameterSet const&) override;
0031     edm::ESGetToken<EcalPedestals, EcalPedestalsRcd> Pedtoken_;
0032     bool doPulseMaxCheck_;
0033     int pulseMaxPosition_;
0034     int nSamples_;
0035     MESet* mePedestalByLS;
0036     bool FillPedestal = false;
0037   };
0038 
0039   inline bool PresampleTask::analyze(void const* _p, Collections _collection) {
0040     switch (_collection) {
0041       case kEBDigi:
0042         if (_p)
0043           runOnDigis(*static_cast<EBDigiCollection const*>(_p));
0044         return true;
0045       case kEEDigi:
0046         if (_p)
0047           runOnDigis(*static_cast<EEDigiCollection const*>(_p));
0048         return true;
0049         break;
0050       default:
0051         break;
0052     }
0053 
0054     return false;
0055   }
0056 }  // namespace ecaldqm
0057 
0058 #endif