File indexing completed on 2024-04-06 12:07:19
0001 #ifndef DQM_EcalMonitorTasks_GpuTask_H
0002 #define DQM_EcalMonitorTasks_GpuTask_H
0003
0004 #include "DQWorkerTask.h"
0005
0006 #include "DataFormats/EcalRecHit/interface/EcalRecHitCollections.h"
0007 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0008
0009 namespace ecaldqm {
0010
0011 class GpuTask : public DQWorkerTask {
0012 public:
0013 GpuTask();
0014 ~GpuTask() override = default;
0015
0016 void addDependencies(DependencySet&) override;
0017
0018 bool filterRunType(short const*) override;
0019
0020 void beginEvent(edm::Event const&, edm::EventSetup const&, bool const&, bool&) override;
0021 bool analyze(void const*, Collections) override;
0022
0023 template <typename DigiCollection>
0024 void runOnCpuDigis(DigiCollection const&, Collections);
0025 template <typename DigiCollection>
0026 void runOnGpuDigis(DigiCollection const&, Collections);
0027 void runOnCpuUncalibRecHits(EcalUncalibratedRecHitCollection const&, Collections);
0028 void runOnGpuUncalibRecHits(EcalUncalibratedRecHitCollection const&, Collections);
0029 void runOnCpuRecHits(EcalRecHitCollection const&, Collections);
0030 void runOnGpuRecHits(EcalRecHitCollection const&, Collections);
0031
0032 private:
0033 void setParams(edm::ParameterSet const&) override;
0034
0035 bool runGpuTask_;
0036 bool enableDigi_;
0037 bool enableUncalib_;
0038 bool enableRecHit_;
0039
0040 bool digi1D_;
0041 bool digi2D_;
0042 bool uncalib1D_;
0043 bool uncalib2D_;
0044 bool rechit1D_;
0045 bool rechit2D_;
0046
0047 std::vector<int> uncalibOOTAmps_;
0048
0049 EBDigiCollection const* EBCpuDigis_;
0050 EEDigiCollection const* EECpuDigis_;
0051
0052 EcalUncalibratedRecHitCollection const* EBCpuUncalibRecHits_;
0053 EcalUncalibratedRecHitCollection const* EECpuUncalibRecHits_;
0054
0055 EcalRecHitCollection const* EBCpuRecHits_;
0056 EcalRecHitCollection const* EECpuRecHits_;
0057 };
0058
0059 inline bool GpuTask::analyze(void const* collection_data, Collections collection) {
0060 switch (collection) {
0061 case kEBCpuDigi:
0062 if (collection_data && runGpuTask_ && enableDigi_)
0063 runOnCpuDigis(*static_cast<EBDigiCollection const*>(collection_data), collection);
0064 return enableDigi_;
0065 break;
0066 case kEECpuDigi:
0067 if (collection_data && runGpuTask_ && enableDigi_)
0068 runOnCpuDigis(*static_cast<EEDigiCollection const*>(collection_data), collection);
0069 return enableDigi_;
0070 break;
0071 case kEBGpuDigi:
0072 if (collection_data && runGpuTask_ && enableDigi_)
0073 runOnGpuDigis(*static_cast<EBDigiCollection const*>(collection_data), collection);
0074 return enableDigi_;
0075 break;
0076 case kEEGpuDigi:
0077 if (collection_data && runGpuTask_ && enableDigi_)
0078 runOnGpuDigis(*static_cast<EEDigiCollection const*>(collection_data), collection);
0079 return enableDigi_;
0080 break;
0081 case kEBCpuUncalibRecHit:
0082 case kEECpuUncalibRecHit:
0083 if (collection_data && runGpuTask_ && enableUncalib_)
0084 runOnCpuUncalibRecHits(*static_cast<EcalUncalibratedRecHitCollection const*>(collection_data), collection);
0085 return enableUncalib_;
0086 break;
0087 case kEBGpuUncalibRecHit:
0088 case kEEGpuUncalibRecHit:
0089 if (collection_data && runGpuTask_ && enableUncalib_)
0090 runOnGpuUncalibRecHits(*static_cast<EcalUncalibratedRecHitCollection const*>(collection_data), collection);
0091 return enableUncalib_;
0092 break;
0093 case kEBCpuRecHit:
0094 case kEECpuRecHit:
0095 if (collection_data && runGpuTask_ && enableRecHit_)
0096 runOnCpuRecHits(*static_cast<EcalRecHitCollection const*>(collection_data), collection);
0097 return enableRecHit_;
0098 break;
0099 case kEBGpuRecHit:
0100 case kEEGpuRecHit:
0101 if (collection_data && runGpuTask_ && enableRecHit_)
0102 runOnGpuRecHits(*static_cast<EcalRecHitCollection const*>(collection_data), collection);
0103 return enableRecHit_;
0104 break;
0105 default:
0106 break;
0107 }
0108
0109 return false;
0110 }
0111
0112 }
0113
0114 #endif