CMS 3D CMS Logo

HBHERecHitProducerPortable.cc
Go to the documentation of this file.
3 
11 
14 
22 
23 #include "Mahi.h"
25 
27 
29  public:
31  ~HBHERecHitProducerPortable() override = default;
33 
34  private:
35  void produce(device::Event&, device::EventSetup const&) override;
36 
39 
42 
45 
48 
54  //
55 
57  };
58 
60  : digisTokenF01HE_{consumes(ps.getParameter<edm::InputTag>("digisLabelF01HE"))},
61  digisTokenF5HB_{consumes(ps.getParameter<edm::InputTag>("digisLabelF5HB"))},
62  digisTokenF3HB_{consumes(ps.getParameter<edm::InputTag>("digisLabelF3HB"))},
63  rechitsM0Token_{produces()},
64  mahiConditionsToken_{esConsumes()},
65  sipmCharacteristicsToken_{esConsumes()},
66  recoParamsToken_{esConsumes()},
67  mahiPulseOffsetsToken_{esConsumes(ps.getParameter<edm::ESInputTag>("mahiPulseOffSets"))} {
68  configParameters_.maxTimeSamples = ps.getParameter<uint32_t>("maxTimeSamples");
69  configParameters_.kprep1dChannelsPerBlock = ps.getParameter<uint32_t>("kprep1dChannelsPerBlock");
70  configParameters_.sipmQTSShift = ps.getParameter<int>("sipmQTSShift");
71  configParameters_.sipmQNTStoSum = ps.getParameter<int>("sipmQNTStoSum");
72  configParameters_.firstSampleShift = ps.getParameter<int>("firstSampleShift");
73  //TODO: produce only pedestals_width or convertedPedestalWidths depending on this bool
74  configParameters_.useEffectivePedestals = ps.getParameter<bool>("useEffectivePedestals");
75 
76  configParameters_.meanTime = ps.getParameter<double>("meanTime");
77  configParameters_.timeSigmaSiPM = ps.getParameter<double>("timeSigmaSiPM");
78  configParameters_.timeSigmaHPD = ps.getParameter<double>("timeSigmaHPD");
79  configParameters_.ts4Thresh = ps.getParameter<double>("ts4Thresh");
80 
81  configParameters_.applyTimeSlew = ps.getParameter<bool>("applyTimeSlew");
82  auto const tzeroValues = ps.getParameter<std::vector<double>>("tzeroTimeSlewParameters");
83  auto const slopeValues = ps.getParameter<std::vector<double>>("slopeTimeSlewParameters");
84  auto const tmaxValues = ps.getParameter<std::vector<double>>("tmaxTimeSlewParameters");
85 
86  configParameters_.tzeroTimeSlew = tzeroValues[HcalTimeSlew::Medium];
87  configParameters_.slopeTimeSlew = slopeValues[HcalTimeSlew::Medium];
88  configParameters_.tmaxTimeSlew = tmaxValues[HcalTimeSlew::Medium];
89 
90  auto threadsMinimize = ps.getParameter<std::vector<uint32_t>>("kernelMinimizeThreads");
91  configParameters_.kernelMinimizeThreads[0] = threadsMinimize[0];
92  configParameters_.kernelMinimizeThreads[1] = threadsMinimize[1];
93  configParameters_.kernelMinimizeThreads[2] = threadsMinimize[2];
94  }
95 
98  desc.add<edm::ESInputTag>("mahiPulseOffSets", edm::ESInputTag(""));
99  desc.add<uint32_t>("maxTimeSamples", 10);
100  desc.add<uint32_t>("kprep1dChannelsPerBlock", 32);
101  desc.add<edm::InputTag>("digisLabelF01HE", edm::InputTag{"hcalRawToDigiGPU", "f01HEDigisGPU"});
102  desc.add<edm::InputTag>("digisLabelF5HB", edm::InputTag{"hcalRawToDigiGPU", "f5HBDigisGPU"});
103  desc.add<edm::InputTag>("digisLabelF3HB", edm::InputTag{"hcalRawToDigiGPU", "f3HBDigisGPU"});
104  desc.add<std::string>("recHitsLabelM0HBHE", "recHitsM0HBHE");
105  desc.add<int>("sipmQTSShift", 0);
106  desc.add<int>("sipmQNTStoSum", 3);
107  desc.add<int>("firstSampleShift", 0);
108  desc.add<bool>("useEffectivePedestals", true);
109 
110  desc.add<double>("meanTime", 0.f);
111  desc.add<double>("timeSigmaSiPM", 2.5f);
112  desc.add<double>("timeSigmaHPD", 5.0f);
113  desc.add<double>("ts4Thresh", 0.0);
114 
115  desc.add<bool>("applyTimeSlew", true);
116  desc.add<std::vector<double>>("tzeroTimeSlewParameters", {23.960177, 11.977461, 9.109694});
117  desc.add<std::vector<double>>("slopeTimeSlewParameters", {-3.178648, -1.5610227, -1.075824});
118  desc.add<std::vector<double>>("tmaxTimeSlewParameters", {16.00, 10.00, 6.25});
119  desc.add<std::vector<uint32_t>>("kernelMinimizeThreads", {16, 1, 1});
120 
121  cdesc.addWithDefaultLabel(desc);
122  }
123 
125  auto& queue = event.queue();
126 
127  // get device collections from event
128  auto const& f01HEDigisDev = event.get(digisTokenF01HE_);
129  auto const& f5HBDigisDev = event.get(digisTokenF5HB_);
130  auto const& f3HBDigisDev = event.get(digisTokenF3HB_);
131 
132  auto const f01DigisSize = f01HEDigisDev->metadata().size();
133  auto const f5DigisSize = f5HBDigisDev->metadata().size();
134  auto const f3DigisSize = f3HBDigisDev->metadata().size();
135 
136  auto const totalChannels = f01DigisSize + f5DigisSize + f3DigisSize;
137  OProductType outputGPU_{totalChannels, queue};
138 
139  if (totalChannels > 0) {
140  // conditions
141  auto const& mahiConditionsDev = setup.getData(mahiConditionsToken_);
142  auto const& sipmCharacteristicsDev = setup.getData(sipmCharacteristicsToken_);
143  auto const& recoParamsWithPulseShapeDev = setup.getData(recoParamsToken_);
144  auto const& mahiPulseOffsetsDev = setup.getData(mahiPulseOffsetsToken_);
145 
146  //
147  // schedule algorithms
148  //
150  f01HEDigisDev.const_view(),
151  f5HBDigisDev.const_view(),
152  f3HBDigisDev.const_view(),
153  outputGPU_.view(),
154  mahiConditionsDev.const_view(),
155  sipmCharacteristicsDev.const_view(),
156  recoParamsWithPulseShapeDev.const_view(),
157  mahiPulseOffsetsDev.const_view(),
159  }
160  //put into the event
161  event.emplace(rechitsM0Token_, std::move(outputGPU_));
162  }
163 
164 } // namespace ALPAKA_ACCELERATOR_NAMESPACE
165 
167 DEFINE_FWK_ALPAKA_MODULE(HBHERecHitProducerPortable);
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
PortableCollection< HcalPhase0DigiSoA > Phase0DigiDeviceCollection
const device::EDGetToken< IProductTypef5 > digisTokenF5HB_
void runMahiAsync(Queue &queue, IProductTypef01::ConstView const &f01HEDigis, IProductTypef5::ConstView const &f5HBDigis, IProductTypef3::ConstView const &f3HBDigis, OProductType::View outputGPU, HcalMahiConditionsPortableDevice::ConstView const &mahi, HcalSiPMCharacteristicsPortableDevice::ConstView const &sipmCharacteristics, HcalRecoParamWithPulseShapeDevice::ConstView const &recoParamsWithPS, HcalMahiPulseOffsetsPortableDevice::ConstView const &mahiPulseOffsets, ConfigParameters const &configParameters)
Definition: Mahi.dev.cc:1285
void produce(device::Event &, device::EventSetup const &) override
static void fillDescriptions(edm::ConfigurationDescriptions &)
const device::ESGetToken< hcal::HcalSiPMCharacteristicsPortableDevice, HcalSiPMCharacteristicsRcd > sipmCharacteristicsToken_
const device::EDGetToken< IProductTypef3 > digisTokenF3HB_
const device::EDGetToken< IProductTypef01 > digisTokenF01HE_
const device::ESGetToken< hcal::HcalRecoParamWithPulseShapeDevice, HcalRecoParamsRcd > recoParamsToken_
PortableCollection< HcalPhase1DigiSoA > Phase1DigiDeviceCollection
#define DEFINE_FWK_ALPAKA_MODULE(name)
Definition: MakerMacros.h:16
const device::ESGetToken< hcal::HcalMahiConditionsPortableDevice, HcalMahiConditionsRcd > mahiConditionsToken_
const device::ESGetToken< hcal::HcalMahiPulseOffsetsPortableDevice, JobConfigurationGPURecord > mahiPulseOffsetsToken_
def move(src, dest)
Definition: eostools.py:511
PortableCollection< HcalRecHitSoA > RecHitDeviceCollection
Definition: event.py:1