File indexing completed on 2024-04-06 12:07:21
0001 #include "DQM/EcalMonitorTasks/interface/GpuTask.h"
0002
0003 #include "DQM/EcalCommon/interface/EcalDQMCommonUtils.h"
0004 #include "DQM/EcalCommon/interface/MESetMulti.h"
0005
0006 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0007 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0008
0009 #include "DataFormats/EcalRawData/interface/EcalDCCHeaderBlock.h"
0010 #include "DataFormats/EcalDigi/interface/EcalConstants.h"
0011
0012 namespace ecaldqm {
0013 GpuTask::GpuTask()
0014 : DQWorkerTask(),
0015 runGpuTask_(false),
0016 enableDigi_(false),
0017 enableUncalib_(false),
0018 enableRecHit_(false),
0019 digi1D_(false),
0020 digi2D_(false),
0021 uncalib1D_(false),
0022 uncalib2D_(false),
0023 rechit1D_(false),
0024 rechit2D_(false),
0025 EBCpuDigis_(nullptr),
0026 EECpuDigis_(nullptr),
0027 EBCpuUncalibRecHits_(nullptr),
0028 EECpuUncalibRecHits_(nullptr),
0029 EBCpuRecHits_(nullptr),
0030 EECpuRecHits_(nullptr) {}
0031
0032 void GpuTask::addDependencies(DependencySet& dependencies) {
0033
0034 if (enableDigi_) {
0035 dependencies.push_back(Dependency(kEBGpuDigi, kEBCpuDigi));
0036 dependencies.push_back(Dependency(kEEGpuDigi, kEECpuDigi));
0037 }
0038
0039 if (enableUncalib_) {
0040 dependencies.push_back(Dependency(kEBGpuUncalibRecHit, kEBCpuUncalibRecHit));
0041 dependencies.push_back(Dependency(kEEGpuUncalibRecHit, kEECpuUncalibRecHit));
0042 }
0043
0044 if (enableRecHit_) {
0045 dependencies.push_back(Dependency(kEBGpuRecHit, kEBCpuRecHit));
0046 dependencies.push_back(Dependency(kEEGpuRecHit, kEECpuRecHit));
0047 }
0048 }
0049
0050 void GpuTask::setParams(edm::ParameterSet const& params) {
0051 runGpuTask_ = params.getUntrackedParameter<bool>("runGpuTask");
0052
0053
0054 enableDigi_ = runGpuTask_ && params.getUntrackedParameter<bool>("enableDigi");
0055 enableUncalib_ = runGpuTask_ && params.getUntrackedParameter<bool>("enableUncalib");
0056 enableRecHit_ = runGpuTask_ && params.getUntrackedParameter<bool>("enableRecHit");
0057
0058
0059 digi1D_ = enableDigi_ && params.getUntrackedParameter<bool>("digi1D");
0060 digi2D_ = enableDigi_ && params.getUntrackedParameter<bool>("digi2D");
0061 uncalib1D_ = enableUncalib_ && params.getUntrackedParameter<bool>("uncalib1D");
0062 uncalib2D_ = enableUncalib_ && params.getUntrackedParameter<bool>("uncalib2D");
0063 rechit1D_ = enableRecHit_ && params.getUntrackedParameter<bool>("rechit1D");
0064 rechit2D_ = enableRecHit_ && params.getUntrackedParameter<bool>("rechit2D");
0065
0066 uncalibOOTAmps_ = params.getUntrackedParameter<std::vector<int> >("uncalibOOTAmps");
0067
0068 if (!enableDigi_) {
0069 MEs_.erase(std::string("DigiCpu"));
0070 MEs_.erase(std::string("DigiCpuAmplitude"));
0071 MEs_.erase(std::string("DigiGpuCpu"));
0072 MEs_.erase(std::string("DigiGpuCpuAmplitude"));
0073 }
0074 if (!enableUncalib_) {
0075 MEs_.erase(std::string("UncalibCpu"));
0076 MEs_.erase(std::string("UncalibCpuAmp"));
0077 MEs_.erase(std::string("UncalibCpuAmpError"));
0078 MEs_.erase(std::string("UncalibCpuPedestal"));
0079 MEs_.erase(std::string("UncalibCpuJitter"));
0080 MEs_.erase(std::string("UncalibCpuJitterError"));
0081 MEs_.erase(std::string("UncalibCpuChi2"));
0082 MEs_.erase(std::string("UncalibCpuOOTAmp"));
0083 MEs_.erase(std::string("UncalibCpuFlags"));
0084 MEs_.erase(std::string("UncalibGpuCpu"));
0085 MEs_.erase(std::string("UncalibGpuCpuAmp"));
0086 MEs_.erase(std::string("UncalibGpuCpuAmpError"));
0087 MEs_.erase(std::string("UncalibGpuCpuPedestal"));
0088 MEs_.erase(std::string("UncalibGpuCpuJitter"));
0089 MEs_.erase(std::string("UncalibGpuCpuJitterError"));
0090 MEs_.erase(std::string("UncalibGpuCpuChi2"));
0091 MEs_.erase(std::string("UncalibGpuCpuOOTAmp"));
0092 MEs_.erase(std::string("UncalibGpuCpuFlags"));
0093 }
0094 if (!enableRecHit_) {
0095 MEs_.erase(std::string("RecHitCpu"));
0096 MEs_.erase(std::string("RecHitCpuEnergy"));
0097 MEs_.erase(std::string("RecHitCpuTime"));
0098 MEs_.erase(std::string("RecHitCpuFlags"));
0099 MEs_.erase(std::string("RecHitGpuCpu"));
0100 MEs_.erase(std::string("RecHitGpuCpuEnergy"));
0101 MEs_.erase(std::string("RecHitGpuCpuTime"));
0102 MEs_.erase(std::string("RecHitGpuCpuFlags"));
0103 }
0104 if (!digi1D_) {
0105 MEs_.erase(std::string("DigiGpu"));
0106 MEs_.erase(std::string("DigiGpuAmplitude"));
0107 }
0108 if (!uncalib1D_) {
0109 MEs_.erase(std::string("UncalibGpu"));
0110 MEs_.erase(std::string("UncalibGpuAmp"));
0111 MEs_.erase(std::string("UncalibGpuAmpError"));
0112 MEs_.erase(std::string("UncalibGpuPedestal"));
0113 MEs_.erase(std::string("UncalibGpuJitter"));
0114 MEs_.erase(std::string("UncalibGpuJitterError"));
0115 MEs_.erase(std::string("UncalibGpuChi2"));
0116 MEs_.erase(std::string("UncalibGpuOOTAmp"));
0117 MEs_.erase(std::string("UncalibGpuFlags"));
0118 }
0119 if (!rechit1D_) {
0120 MEs_.erase(std::string("RecHitGpu"));
0121 MEs_.erase(std::string("RecHitGpuEnergy"));
0122 MEs_.erase(std::string("RecHitGpuTime"));
0123 MEs_.erase(std::string("RecHitGpuFlags"));
0124 }
0125 if (!digi2D_) {
0126 MEs_.erase(std::string("Digi2D"));
0127 MEs_.erase(std::string("Digi2DAmplitude"));
0128 }
0129 if (!uncalib2D_) {
0130 MEs_.erase(std::string("Uncalib2D"));
0131 MEs_.erase(std::string("Uncalib2DAmp"));
0132 MEs_.erase(std::string("Uncalib2DAmpError"));
0133 MEs_.erase(std::string("Uncalib2DPedestal"));
0134 MEs_.erase(std::string("Uncalib2DJitter"));
0135 MEs_.erase(std::string("Uncalib2DJitterError"));
0136 MEs_.erase(std::string("Uncalib2DChi2"));
0137 MEs_.erase(std::string("Uncalib2DOOTAmp"));
0138 MEs_.erase(std::string("Uncalib2DFlags"));
0139 }
0140 if (!rechit2D_) {
0141 MEs_.erase(std::string("RecHit2D"));
0142 MEs_.erase(std::string("RecHit2DEnergy"));
0143 MEs_.erase(std::string("RecHit2DTime"));
0144 MEs_.erase(std::string("RecHit2DFlags"));
0145 }
0146 }
0147
0148 bool GpuTask::filterRunType(short const* runType) {
0149 for (unsigned iFED(0); iFED != ecaldqm::nDCC; iFED++) {
0150 if (runType[iFED] == EcalDCCHeaderBlock::COSMIC || runType[iFED] == EcalDCCHeaderBlock::MTCC ||
0151 runType[iFED] == EcalDCCHeaderBlock::COSMICS_GLOBAL || runType[iFED] == EcalDCCHeaderBlock::PHYSICS_GLOBAL ||
0152 runType[iFED] == EcalDCCHeaderBlock::COSMICS_LOCAL || runType[iFED] == EcalDCCHeaderBlock::PHYSICS_LOCAL)
0153 return true;
0154 }
0155
0156 return false;
0157 }
0158
0159 void GpuTask::beginEvent(edm::Event const&, edm::EventSetup const&, bool const&, bool&) {
0160 EBCpuDigis_ = nullptr;
0161 EECpuDigis_ = nullptr;
0162 EBCpuUncalibRecHits_ = nullptr;
0163 EECpuUncalibRecHits_ = nullptr;
0164 EBCpuRecHits_ = nullptr;
0165 EECpuRecHits_ = nullptr;
0166 }
0167
0168 template <typename DigiCollection>
0169 void GpuTask::runOnCpuDigis(DigiCollection const& cpuDigis, Collections collection) {
0170 MESet& meDigiCpu(MEs_.at("DigiCpu"));
0171 MESet& meDigiCpuAmplitude(MEs_.at("DigiCpuAmplitude"));
0172
0173 int iSubdet(collection == kEBCpuDigi ? EcalBarrel : EcalEndcap);
0174
0175
0176
0177 if constexpr (std::is_same_v<DigiCollection, EBDigiCollection>) {
0178 assert(iSubdet == EcalBarrel);
0179 EBCpuDigis_ = &cpuDigis;
0180 } else {
0181 assert(iSubdet == EcalEndcap);
0182 EECpuDigis_ = &cpuDigis;
0183 }
0184
0185 unsigned nCpuDigis(cpuDigis.size());
0186 meDigiCpu.fill(getEcalDQMSetupObjects(), iSubdet, nCpuDigis);
0187
0188 for (auto const& cpuDigi : cpuDigis) {
0189
0190 EcalDataFrame cpuDataFrame(cpuDigi);
0191
0192 for (unsigned iSample = 0; iSample < ecalPh1::sampleSize; iSample++) {
0193 static_cast<MESetMulti&>(meDigiCpuAmplitude).use(iSample);
0194
0195 int cpuAmp(cpuDataFrame.sample(iSample).adc());
0196 meDigiCpuAmplitude.fill(getEcalDQMSetupObjects(), iSubdet, cpuAmp);
0197 }
0198 }
0199 }
0200
0201 template <typename DigiCollection>
0202 void GpuTask::runOnGpuDigis(DigiCollection const& gpuDigis, Collections collection) {
0203 MESet& meDigiGpuCpu(MEs_.at("DigiGpuCpu"));
0204 MESet& meDigiGpuCpuAmplitude(MEs_.at("DigiGpuCpuAmplitude"));
0205
0206 int iSubdet(collection == kEBGpuDigi ? EcalBarrel : EcalEndcap);
0207
0208
0209
0210
0211 DigiCollection const* cpuDigis;
0212 if constexpr (std::is_same_v<DigiCollection, EBDigiCollection>) {
0213 assert(iSubdet == EcalBarrel);
0214 cpuDigis = EBCpuDigis_;
0215 } else {
0216 assert(iSubdet == EcalEndcap);
0217 cpuDigis = EECpuDigis_;
0218 }
0219
0220 if (!cpuDigis) {
0221 edm::LogWarning("EcalDQM") << "GpuTask: Did not find " << ((iSubdet == EcalBarrel) ? "EB" : "EE")
0222 << "CpuDigis Collection. Aborting runOnGpuDigis\n";
0223 return;
0224 }
0225
0226 unsigned nGpuDigis(gpuDigis.size());
0227 unsigned nCpuDigis(cpuDigis->size());
0228
0229 meDigiGpuCpu.fill(getEcalDQMSetupObjects(), iSubdet, nGpuDigis - nCpuDigis);
0230
0231 if (digi1D_) {
0232 MESet& meDigiGpu(MEs_.at("DigiGpu"));
0233 meDigiGpu.fill(getEcalDQMSetupObjects(), iSubdet, nGpuDigis);
0234 }
0235
0236 if (digi2D_) {
0237 MESet& meDigi2D(MEs_.at("Digi2D"));
0238 meDigi2D.fill(getEcalDQMSetupObjects(), iSubdet, nCpuDigis, nGpuDigis);
0239 }
0240
0241 for (auto const& gpuDigi : gpuDigis) {
0242
0243 DetId gpuId(gpuDigi.id());
0244 typename DigiCollection::const_iterator cpuItr(cpuDigis->find(gpuId));
0245 if (cpuItr == cpuDigis->end()) {
0246 edm::LogWarning("EcalDQM") << "GpuTask: Did not find CpuDigi DetId " << gpuId.rawId() << " in CPU collection\n";
0247 continue;
0248 }
0249
0250
0251 EcalDataFrame gpuDataFrame(gpuDigi);
0252 EcalDataFrame cpuDataFrame(*cpuItr);
0253
0254 for (unsigned iSample = 0; iSample < ecalPh1::sampleSize; iSample++) {
0255 static_cast<MESetMulti&>(meDigiGpuCpuAmplitude).use(iSample);
0256
0257 int gpuAmp(gpuDataFrame.sample(iSample).adc());
0258 int cpuAmp(cpuDataFrame.sample(iSample).adc());
0259
0260 meDigiGpuCpuAmplitude.fill(getEcalDQMSetupObjects(), iSubdet, gpuAmp - cpuAmp);
0261
0262 if (digi1D_) {
0263 MESet& meDigiGpuAmplitude(MEs_.at("DigiGpuAmplitude"));
0264 static_cast<MESetMulti&>(meDigiGpuAmplitude).use(iSample);
0265 meDigiGpuAmplitude.fill(getEcalDQMSetupObjects(), iSubdet, gpuAmp);
0266 }
0267
0268 if (digi2D_) {
0269 MESet& meDigi2DAmplitude(MEs_.at("Digi2DAmplitude"));
0270 static_cast<MESetMulti&>(meDigi2DAmplitude).use(iSample);
0271 meDigi2DAmplitude.fill(getEcalDQMSetupObjects(), iSubdet, cpuAmp, gpuAmp);
0272 }
0273 }
0274 }
0275 }
0276
0277 void GpuTask::runOnCpuUncalibRecHits(EcalUncalibratedRecHitCollection const& cpuHits, Collections collection) {
0278 MESet& meUncalibCpu(MEs_.at("UncalibCpu"));
0279 MESet& meUncalibCpuAmp(MEs_.at("UncalibCpuAmp"));
0280 MESet& meUncalibCpuAmpError(MEs_.at("UncalibCpuAmpError"));
0281 MESet& meUncalibCpuPedestal(MEs_.at("UncalibCpuPedestal"));
0282 MESet& meUncalibCpuJitter(MEs_.at("UncalibCpuJitter"));
0283 MESet& meUncalibCpuJitterError(MEs_.at("UncalibCpuJitterError"));
0284 MESet& meUncalibCpuChi2(MEs_.at("UncalibCpuChi2"));
0285 MESet& meUncalibCpuOOTAmp(MEs_.at("UncalibCpuOOTAmp"));
0286 MESet& meUncalibCpuFlags(MEs_.at("UncalibCpuFlags"));
0287
0288 int iSubdet(collection == kEBCpuUncalibRecHit ? EcalBarrel : EcalEndcap);
0289
0290
0291 if (iSubdet == EcalBarrel)
0292 EBCpuUncalibRecHits_ = &cpuHits;
0293 else
0294 EECpuUncalibRecHits_ = &cpuHits;
0295
0296 unsigned nCpuHits(cpuHits.size());
0297 meUncalibCpu.fill(getEcalDQMSetupObjects(), iSubdet, nCpuHits);
0298
0299 for (auto const& cpuHit : cpuHits) {
0300 float cpuAmp(cpuHit.amplitude());
0301 float cpuAmpError(cpuHit.amplitudeError());
0302 float cpuPedestal(cpuHit.pedestal());
0303 float cpuJitter(cpuHit.jitter());
0304 float cpuJitterError(cpuHit.jitterError());
0305 float cpuChi2(cpuHit.chi2());
0306 uint32_t cpuFlags(cpuHit.flags());
0307
0308 if (cpuJitterError == 10000)
0309 cpuJitterError = 0.249999;
0310
0311 meUncalibCpuAmp.fill(getEcalDQMSetupObjects(), iSubdet, cpuAmp);
0312 meUncalibCpuAmpError.fill(getEcalDQMSetupObjects(), iSubdet, cpuAmpError);
0313 meUncalibCpuPedestal.fill(getEcalDQMSetupObjects(), iSubdet, cpuPedestal);
0314 meUncalibCpuJitter.fill(getEcalDQMSetupObjects(), iSubdet, cpuJitter);
0315 meUncalibCpuJitterError.fill(getEcalDQMSetupObjects(), iSubdet, cpuJitterError);
0316 meUncalibCpuChi2.fill(getEcalDQMSetupObjects(), iSubdet, cpuChi2);
0317 meUncalibCpuFlags.fill(getEcalDQMSetupObjects(), iSubdet, cpuFlags);
0318
0319 for (unsigned iAmp = 0; iAmp < uncalibOOTAmps_.size(); iAmp++) {
0320 static_cast<MESetMulti&>(meUncalibCpuOOTAmp).use(iAmp);
0321
0322
0323 int cpuOOTAmp(cpuHit.outOfTimeAmplitude(uncalibOOTAmps_[iAmp]));
0324 meUncalibCpuOOTAmp.fill(getEcalDQMSetupObjects(), iSubdet, cpuOOTAmp);
0325 }
0326 }
0327 }
0328
0329 void GpuTask::runOnGpuUncalibRecHits(EcalUncalibratedRecHitCollection const& gpuHits, Collections collection) {
0330 MESet& meUncalibGpuCpu(MEs_.at("UncalibGpuCpu"));
0331 MESet& meUncalibGpuCpuAmp(MEs_.at("UncalibGpuCpuAmp"));
0332 MESet& meUncalibGpuCpuAmpError(MEs_.at("UncalibGpuCpuAmpError"));
0333 MESet& meUncalibGpuCpuPedestal(MEs_.at("UncalibGpuCpuPedestal"));
0334 MESet& meUncalibGpuCpuJitter(MEs_.at("UncalibGpuCpuJitter"));
0335 MESet& meUncalibGpuCpuJitterError(MEs_.at("UncalibGpuCpuJitterError"));
0336 MESet& meUncalibGpuCpuChi2(MEs_.at("UncalibGpuCpuChi2"));
0337 MESet& meUncalibGpuCpuOOTAmp(MEs_.at("UncalibGpuCpuOOTAmp"));
0338 MESet& meUncalibGpuCpuFlags(MEs_.at("UncalibGpuCpuFlags"));
0339
0340 int iSubdet(collection == kEBGpuUncalibRecHit ? EcalBarrel : EcalEndcap);
0341
0342
0343
0344 EcalUncalibratedRecHitCollection const* cpuHits =
0345 (iSubdet == EcalBarrel) ? EBCpuUncalibRecHits_ : EECpuUncalibRecHits_;
0346 if (!cpuHits) {
0347 edm::LogWarning("EcalDQM") << "GpuTask: Did not find " << ((iSubdet == EcalBarrel) ? "EB" : "EE")
0348 << "CpuUncalibRecHits Collection. Aborting runOnGpuUncalibRecHits\n";
0349 return;
0350 }
0351
0352 unsigned nGpuHits(gpuHits.size());
0353 unsigned nCpuHits(cpuHits->size());
0354
0355 meUncalibGpuCpu.fill(getEcalDQMSetupObjects(), iSubdet, nGpuHits - nCpuHits);
0356
0357 if (uncalib1D_) {
0358 MESet& meUncalibGpu(MEs_.at("UncalibGpu"));
0359 meUncalibGpu.fill(getEcalDQMSetupObjects(), iSubdet, nGpuHits);
0360 }
0361
0362 if (uncalib2D_) {
0363 MESet& meUncalib2D(MEs_.at("Uncalib2D"));
0364 meUncalib2D.fill(getEcalDQMSetupObjects(), iSubdet, nCpuHits, nGpuHits);
0365 }
0366
0367 for (auto const& gpuHit : gpuHits) {
0368
0369 DetId gpuId(gpuHit.id());
0370 EcalUncalibratedRecHitCollection::const_iterator cpuItr(cpuHits->find(gpuId));
0371 if (cpuItr == cpuHits->end()) {
0372 edm::LogWarning("EcalDQM") << "GpuTask: Did not find GpuUncalibRecHit DetId " << gpuId.rawId()
0373 << " in CPU collection\n";
0374 continue;
0375 }
0376
0377 float gpuAmp(gpuHit.amplitude());
0378 float gpuAmpError(gpuHit.amplitudeError());
0379 float gpuPedestal(gpuHit.pedestal());
0380 float gpuJitter(gpuHit.jitter());
0381 float gpuJitterError(gpuHit.jitterError());
0382 float gpuChi2(gpuHit.chi2());
0383 uint32_t gpuFlags(gpuHit.flags());
0384
0385 if (gpuJitterError == 10000)
0386 gpuJitterError = 0.249999;
0387
0388 float cpuAmp(cpuItr->amplitude());
0389 float cpuAmpError(cpuItr->amplitudeError());
0390 float cpuPedestal(cpuItr->pedestal());
0391 float cpuJitter(cpuItr->jitter());
0392 float cpuJitterError(cpuItr->jitterError());
0393 float cpuChi2(cpuItr->chi2());
0394 uint32_t cpuFlags(cpuItr->flags());
0395
0396 if (cpuJitterError == 10000)
0397 cpuJitterError = 0.249999;
0398
0399 meUncalibGpuCpuAmp.fill(getEcalDQMSetupObjects(), iSubdet, gpuAmp - cpuAmp);
0400 meUncalibGpuCpuAmpError.fill(getEcalDQMSetupObjects(), iSubdet, gpuAmpError - cpuAmpError);
0401 meUncalibGpuCpuPedestal.fill(getEcalDQMSetupObjects(), iSubdet, gpuPedestal - cpuPedestal);
0402 meUncalibGpuCpuJitter.fill(getEcalDQMSetupObjects(), iSubdet, gpuJitter - cpuJitter);
0403 meUncalibGpuCpuJitterError.fill(getEcalDQMSetupObjects(), iSubdet, gpuJitterError - cpuJitterError);
0404 meUncalibGpuCpuChi2.fill(getEcalDQMSetupObjects(), iSubdet, gpuChi2 - cpuChi2);
0405 meUncalibGpuCpuFlags.fill(getEcalDQMSetupObjects(), iSubdet, gpuFlags - cpuFlags);
0406
0407 if (uncalib1D_) {
0408 MESet& meUncalibGpuAmp(MEs_.at("UncalibGpuAmp"));
0409 MESet& meUncalibGpuAmpError(MEs_.at("UncalibGpuAmpError"));
0410 MESet& meUncalibGpuPedestal(MEs_.at("UncalibGpuPedestal"));
0411 MESet& meUncalibGpuJitter(MEs_.at("UncalibGpuJitter"));
0412 MESet& meUncalibGpuJitterError(MEs_.at("UncalibGpuJitterError"));
0413 MESet& meUncalibGpuChi2(MEs_.at("UncalibGpuChi2"));
0414 MESet& meUncalibGpuFlags(MEs_.at("UncalibGpuFlags"));
0415
0416 meUncalibGpuAmp.fill(getEcalDQMSetupObjects(), iSubdet, gpuAmp);
0417 meUncalibGpuAmpError.fill(getEcalDQMSetupObjects(), iSubdet, gpuAmpError);
0418 meUncalibGpuPedestal.fill(getEcalDQMSetupObjects(), iSubdet, gpuPedestal);
0419 meUncalibGpuJitter.fill(getEcalDQMSetupObjects(), iSubdet, gpuJitter);
0420 meUncalibGpuJitterError.fill(getEcalDQMSetupObjects(), iSubdet, gpuJitterError);
0421 meUncalibGpuChi2.fill(getEcalDQMSetupObjects(), iSubdet, gpuChi2);
0422 meUncalibGpuFlags.fill(getEcalDQMSetupObjects(), iSubdet, gpuFlags);
0423 }
0424
0425 if (uncalib2D_) {
0426 MESet& meUncalib2DAmp(MEs_.at("Uncalib2DAmp"));
0427 MESet& meUncalib2DAmpError(MEs_.at("Uncalib2DAmpError"));
0428 MESet& meUncalib2DPedestal(MEs_.at("Uncalib2DPedestal"));
0429 MESet& meUncalib2DJitter(MEs_.at("Uncalib2DJitter"));
0430 MESet& meUncalib2DJitterError(MEs_.at("Uncalib2DJitterError"));
0431 MESet& meUncalib2DChi2(MEs_.at("Uncalib2DChi2"));
0432 MESet& meUncalib2DFlags(MEs_.at("Uncalib2DFlags"));
0433
0434 meUncalib2DAmp.fill(getEcalDQMSetupObjects(), iSubdet, cpuAmp, gpuAmp);
0435 meUncalib2DAmpError.fill(getEcalDQMSetupObjects(), iSubdet, cpuAmpError, gpuAmpError);
0436 meUncalib2DPedestal.fill(getEcalDQMSetupObjects(), iSubdet, cpuPedestal, gpuPedestal);
0437 meUncalib2DJitter.fill(getEcalDQMSetupObjects(), iSubdet, cpuJitter, gpuJitter);
0438 meUncalib2DJitterError.fill(getEcalDQMSetupObjects(), iSubdet, cpuJitterError, gpuJitterError);
0439 meUncalib2DChi2.fill(getEcalDQMSetupObjects(), iSubdet, cpuChi2, gpuChi2);
0440 meUncalib2DFlags.fill(getEcalDQMSetupObjects(), iSubdet, cpuFlags, gpuFlags);
0441 }
0442
0443 for (unsigned iAmp = 0; iAmp < uncalibOOTAmps_.size(); iAmp++) {
0444 static_cast<MESetMulti&>(meUncalibGpuCpuOOTAmp).use(iAmp);
0445
0446
0447 int gpuOOTAmp(gpuHit.outOfTimeAmplitude(uncalibOOTAmps_[iAmp]));
0448 int cpuOOTAmp(cpuItr->outOfTimeAmplitude(uncalibOOTAmps_[iAmp]));
0449
0450 meUncalibGpuCpuOOTAmp.fill(getEcalDQMSetupObjects(), iSubdet, gpuOOTAmp - cpuOOTAmp);
0451
0452 if (uncalib1D_) {
0453 MESet& meUncalibGpuOOTAmp(MEs_.at("UncalibGpuOOTAmp"));
0454 static_cast<MESetMulti&>(meUncalibGpuOOTAmp).use(iAmp);
0455 meUncalibGpuOOTAmp.fill(getEcalDQMSetupObjects(), iSubdet, gpuOOTAmp);
0456 }
0457
0458 if (uncalib2D_) {
0459 MESet& meUncalib2DOOTAmp(MEs_.at("Uncalib2DOOTAmp"));
0460 static_cast<MESetMulti&>(meUncalib2DOOTAmp).use(iAmp);
0461 meUncalib2DOOTAmp.fill(getEcalDQMSetupObjects(), iSubdet, cpuOOTAmp, gpuOOTAmp);
0462 }
0463 }
0464 }
0465 }
0466
0467 void GpuTask::runOnCpuRecHits(EcalRecHitCollection const& cpuHits, Collections collection) {
0468 MESet& meRecHitCpu(MEs_.at("RecHitCpu"));
0469 MESet& meRecHitCpuEnergy(MEs_.at("RecHitCpuEnergy"));
0470 MESet& meRecHitCpuTime(MEs_.at("RecHitCpuTime"));
0471 MESet& meRecHitCpuFlags(MEs_.at("RecHitCpuFlags"));
0472
0473 int iSubdet(collection == kEBCpuRecHit ? EcalBarrel : EcalEndcap);
0474
0475
0476 if (iSubdet == EcalBarrel)
0477 EBCpuRecHits_ = &cpuHits;
0478 else
0479 EECpuRecHits_ = &cpuHits;
0480
0481 unsigned nCpuHits(cpuHits.size());
0482 meRecHitCpu.fill(getEcalDQMSetupObjects(), iSubdet, nCpuHits);
0483
0484 for (auto const& cpuHit : cpuHits) {
0485 float cpuEnergy(cpuHit.energy());
0486 float cpuTime(cpuHit.time());
0487 uint32_t cpuFlags(cpuHit.flagsBits());
0488
0489 meRecHitCpuEnergy.fill(getEcalDQMSetupObjects(), iSubdet, cpuEnergy);
0490 meRecHitCpuTime.fill(getEcalDQMSetupObjects(), iSubdet, cpuTime);
0491 meRecHitCpuFlags.fill(getEcalDQMSetupObjects(), iSubdet, cpuFlags);
0492 }
0493 }
0494
0495 void GpuTask::runOnGpuRecHits(EcalRecHitCollection const& gpuHits, Collections collection) {
0496 MESet& meRecHitGpuCpu(MEs_.at("RecHitGpuCpu"));
0497 MESet& meRecHitGpuCpuEnergy(MEs_.at("RecHitGpuCpuEnergy"));
0498 MESet& meRecHitGpuCpuTime(MEs_.at("RecHitGpuCpuTime"));
0499 MESet& meRecHitGpuCpuFlags(MEs_.at("RecHitGpuCpuFlags"));
0500
0501 int iSubdet(collection == kEBGpuRecHit ? EcalBarrel : EcalEndcap);
0502
0503
0504
0505 EcalRecHitCollection const* cpuHits = (iSubdet == EcalBarrel) ? EBCpuRecHits_ : EECpuRecHits_;
0506 if (!cpuHits) {
0507 edm::LogWarning("EcalDQM") << "GpuTask: Did not find " << ((iSubdet == EcalBarrel) ? "EB" : "EE")
0508 << "CpuRecHits Collection. Aborting runOnGpuRecHits\n";
0509 return;
0510 }
0511
0512 unsigned nGpuHits(gpuHits.size());
0513 unsigned nCpuHits(cpuHits->size());
0514
0515 meRecHitGpuCpu.fill(getEcalDQMSetupObjects(), iSubdet, nGpuHits - nCpuHits);
0516
0517 if (rechit1D_) {
0518 MESet& meRecHitGpu(MEs_.at("RecHitGpu"));
0519 meRecHitGpu.fill(getEcalDQMSetupObjects(), iSubdet, nGpuHits);
0520 }
0521 if (rechit2D_) {
0522 MESet& meRecHit2D(MEs_.at("RecHit2D"));
0523 meRecHit2D.fill(getEcalDQMSetupObjects(), iSubdet, nCpuHits, nGpuHits);
0524 }
0525
0526 for (auto const& gpuHit : gpuHits) {
0527
0528 DetId gpuId(gpuHit.detid());
0529 EcalRecHitCollection::const_iterator cpuItr(cpuHits->find(gpuId));
0530 if (cpuItr == cpuHits->end()) {
0531 edm::LogWarning("EcalDQM") << "GpuTask: Did not find GpuRecHit DetId " << gpuId.rawId()
0532 << " in CPU collection\n";
0533 continue;
0534 }
0535
0536 float gpuEnergy(gpuHit.energy());
0537 float gpuTime(gpuHit.time());
0538 uint32_t gpuFlags(gpuHit.flagsBits());
0539
0540 float cpuEnergy(cpuItr->energy());
0541 float cpuTime(cpuItr->time());
0542 uint32_t cpuFlags(cpuItr->flagsBits());
0543
0544 meRecHitGpuCpuEnergy.fill(getEcalDQMSetupObjects(), iSubdet, gpuEnergy - cpuEnergy);
0545 meRecHitGpuCpuTime.fill(getEcalDQMSetupObjects(), iSubdet, gpuTime - cpuTime);
0546 meRecHitGpuCpuFlags.fill(getEcalDQMSetupObjects(), iSubdet, gpuFlags - cpuFlags);
0547
0548 if (rechit1D_) {
0549 MESet& meRecHitGpuEnergy(MEs_.at("RecHitGpuEnergy"));
0550 MESet& meRecHitGpuTime(MEs_.at("RecHitGpuTime"));
0551 MESet& meRecHitGpuFlags(MEs_.at("RecHitGpuFlags"));
0552
0553 meRecHitGpuEnergy.fill(getEcalDQMSetupObjects(), iSubdet, gpuEnergy);
0554 meRecHitGpuTime.fill(getEcalDQMSetupObjects(), iSubdet, gpuTime);
0555 meRecHitGpuFlags.fill(getEcalDQMSetupObjects(), iSubdet, gpuFlags);
0556 }
0557
0558 if (rechit2D_) {
0559 MESet& meRecHit2DEnergy(MEs_.at("RecHit2DEnergy"));
0560 MESet& meRecHit2DTime(MEs_.at("RecHit2DTime"));
0561 MESet& meRecHit2DFlags(MEs_.at("RecHit2DFlags"));
0562
0563 meRecHit2DEnergy.fill(getEcalDQMSetupObjects(), iSubdet, cpuEnergy, gpuEnergy);
0564 meRecHit2DTime.fill(getEcalDQMSetupObjects(), iSubdet, cpuTime, gpuTime);
0565 meRecHit2DFlags.fill(getEcalDQMSetupObjects(), iSubdet, cpuFlags, gpuFlags);
0566 }
0567 }
0568 }
0569
0570 DEFINE_ECALDQM_WORKER(GpuTask);
0571 }