42 template <
typename TrackerTraits>
66 std::unique_ptr<SiPixelFedCablingTree>
cabling_;
69 std::unique_ptr<PixelUnpackingRegions>
regions_;
80 template <
typename TrackerTraits>
82 : rawGetToken_(consumes(iConfig.getParameter<
edm::
InputTag>(
"InputLabel"))),
83 digiPutToken_(produces()),
84 clusterPutToken_(produces()),
89 includeErrors_(iConfig.getParameter<
bool>(
"IncludeErrors")),
90 useQuality_(iConfig.getParameter<
bool>(
"UseQualityInfo")),
91 clusterThresholds_{iConfig.
getParameter<int32_t>(
"clusterThreshold_layer1"),
92 iConfig.
getParameter<int32_t>(
"clusterThreshold_otherLayers"),
93 static_cast<float>(iConfig.
getParameter<
double>(
"VCaltoElectronGain")),
94 static_cast<float>(iConfig.
getParameter<
double>(
"VCaltoElectronGain_L1")),
95 static_cast<float>(iConfig.
getParameter<
double>(
"VCaltoElectronOffset")),
96 static_cast<float>(iConfig.
getParameter<
double>(
"VCaltoElectronOffset_L1"))} {
98 #ifdef ALPAKA_ACC_CPU_B_SEQ_T_SEQ_ENABLED 99 producesTemporarily(
"edm::DeviceProduct<alpaka_cuda_async::SiPixelDigisSoACollection>");
100 producesTemporarily(
"edm::DeviceProduct<alpaka_cuda_async::SiPixelDigiErrorsSoACollection>");
101 producesTemporarily(
"edm::DeviceProduct<alpaka_cuda_async::SiPixelClustersSoACollection>");
104 if (includeErrors_) {
105 digiErrorPutToken_ = produces();
106 fmtErrorToken_ = produces();
111 regions_ = std::make_unique<PixelUnpackingRegions>(iConfig, consumesCollector());
115 template <
typename TrackerTraits>
118 desc.add<
bool>(
"IncludeErrors",
true);
119 desc.add<
bool>(
"UseQualityInfo",
false);
123 ->setComment(
"This parameter is obsolete and will be ignored.");
126 desc.add<
double>(
"VCaltoElectronGain", 47.f);
127 desc.add<
double>(
"VCaltoElectronGain_L1", 50.f);
128 desc.add<
double>(
"VCaltoElectronOffset", -60.f);
129 desc.add<
double>(
"VCaltoElectronOffset_L1", -670.f);
134 psd0.
addOptional<std::vector<edm::InputTag>>(
"inputs");
139 ->setComment(
"## Empty Regions PSet means complete unpacking");
141 desc.add<
std::string>(
"CablingMapLabel",
"")->setComment(
"CablingMap label");
145 template <
typename TrackerTraits>
147 auto const& hMap = iSetup.
getData(mapToken_);
148 auto const& dGains = iSetup.
getData(gainsToken_);
151 if (recordWatcher_.check(iSetup)) {
153 cablingMap_ = &iSetup.
getData(cablingMapToken_);
154 fedIds_ = cablingMap_->fedIds();
155 cabling_ = cablingMap_->cablingTree();
156 LogDebug(
"map version:") << cablingMap_->version();
160 std::optional<cms::alpakatools::device_buffer<Device, unsigned char[]>> modulesToUnpackRegional;
161 const unsigned char* modulesToUnpack;
163 regions_->run(
iEvent, iSetup);
164 LogDebug(
"SiPixelRawToCluster") <<
"region2unpack #feds: " << regions_->nFEDs();
165 LogDebug(
"SiPixelRawToCluster") <<
"region2unpack #modules (BPIX,EPIX,total): " << regions_->nBarrelModules()
166 <<
" " << regions_->nForwardModules() <<
" " << regions_->nModules();
169 *(regions_->modulesToUnpack()), cabling_.get(), fedIds_,
iEvent.queue());
170 modulesToUnpack = modulesToUnpackRegional->data();
172 modulesToUnpack = hMap->modToUnpDefault();
175 const auto& buffers =
iEvent.get(rawGetToken_);
180 unsigned int wordCounter = 0;
181 unsigned int fedCounter = 0;
182 bool errorsInEvent =
false;
183 std::vector<unsigned int>
index(fedIds_.size(), 0);
184 std::vector<cms_uint32_t const*>
start(fedIds_.size(),
nullptr);
185 std::vector<ptrdiff_t> words(fedIds_.size(), 0);
188 for (uint32_t
i = 0;
i < fedIds_.size(); ++
i) {
189 const int fedId = fedIds_[
i];
190 if (regions_ && !regions_->mayUnpackFED(
fedId))
209 if (not errorcheck.checkCRC(errorsInEvent,
fedId, trailer, errors_)) {
215 bool moreHeaders =
true;
216 while (moreHeaders) {
218 bool headerStatus = errorcheck.checkHeader(errorsInEvent,
fedId,
header, errors_);
219 moreHeaders = headerStatus;
223 bool moreTrailers =
true;
225 while (moreTrailers) {
227 bool trailerStatus = errorcheck.checkTrailer(errorsInEvent,
fedId,
nWords, trailer, errors_);
228 moreTrailers = trailerStatus;
234 assert(0 == (ew - bw) % 2);
237 words[
i] = (ew - bw);
238 wordCounter += (ew - bw);
241 nDigis_ = wordCounter;
247 for (uint32_t
i = 0;
i < fedIds_.size(); ++
i) {
250 Algo_.makePhase1ClustersAsync(
iEvent.queue(),
263 template <
typename TrackerTraits>
274 if (includeErrors_) {
275 iEvent.emplace(digiErrorPutToken_);
276 iEvent.emplace(fmtErrorToken_);
281 iEvent.emplace(digiPutToken_, Algo_.getDigis());
282 iEvent.emplace(clusterPutToken_, Algo_.getClusters());
283 if (includeErrors_) {
284 iEvent.emplace(digiErrorPutToken_, Algo_.getErrors());
const bool includeErrors_
constexpr uint16_t clusterThresholdOtherLayers
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
SiPixelRawToCluster< pixelTopology::Phase1 > SiPixelRawToClusterPhase1
const SiPixelFedCablingMap * cablingMap_
edm::ESWatcher< SiPixelFedCablingMapRcd > recordWatcher_
const edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cablingMapToken_
static MessageDrop * instance()
device::EDPutToken< SiPixelDigisSoACollection > digiPutToken_
edm::EDPutTokenT< SiPixelFormatterErrors > fmtErrorToken_
const SiPixelClusterThresholds clusterThresholds_
const device::ESGetToken< SiPixelMappingDevice, SiPixelMappingSoARecord > mapToken_
void acquire(device::Event const &iEvent, device::EventSetup const &iSetup) override
constexpr uint16_t clusterThresholdLayerOne
void produce(device::Event &iEvent, device::EventSetup const &iSetup) override
unsigned int cms_uint32_t
~SiPixelRawToCluster() override=default
SiPixelRawToCluster< pixelTopology::HIonPhase1 > SiPixelRawToClusterHIonPhase1
T const & getData(edm::ESGetToken< T, R > const &iToken) const
device::EDPutToken< SiPixelClustersSoACollection > clusterPutToken_
std::vector< unsigned int > fedIds_
PixelDataFormatter::Errors errors_
edm::EDGetTokenT< FEDRawDataCollection > rawGetToken_
std::unique_ptr< SiPixelFedCablingTree > cabling_
#define DEFINE_FWK_ALPAKA_MODULE(name)
SiPixelRawToCluster(const edm::ParameterSet &iConfig)
void initializeWordFed(int fedId, unsigned int wordCounterGPU, const uint32_t *src, unsigned int length)
const device::ESGetToken< SiPixelGainCalibrationForHLTDevice, SiPixelGainCalibrationForHLTSoARcd > gainsToken_
unsigned long long cms_uint64_t
device::EDPutToken< SiPixelDigiErrorsSoACollection > digiErrorPutToken_
ALPAKA_FN_HOST_ACC ALPAKA_FN_ACC static ALPAKA_FN_INLINE cms::alpakatools::device_buffer< Device, unsigned char[]> getModToUnpRegionalAsync(std::set< unsigned int > const &modules, const SiPixelFedCablingTree *cabling, std::vector< unsigned int > const &fedIds, Queue &queue)
std::vector< std::string > getParameterNames() const
std::unique_ptr< PixelUnpackingRegions > regions_
static constexpr uint16_t numberOfModules
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)