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 digiErrorPutToken_ = produces();
99 fmtErrorToken_ = produces();
104 regions_ = std::make_unique<PixelUnpackingRegions>(iConfig, consumesCollector());
108 template <
typename TrackerTraits>
111 desc.add<
bool>(
"IncludeErrors",
true);
112 desc.add<
bool>(
"UseQualityInfo",
false);
116 ->setComment(
"This parameter is obsolete and will be ignored.");
119 desc.add<
double>(
"VCaltoElectronGain", 47.f);
120 desc.add<
double>(
"VCaltoElectronGain_L1", 50.f);
121 desc.add<
double>(
"VCaltoElectronOffset", -60.f);
122 desc.add<
double>(
"VCaltoElectronOffset_L1", -670.f);
127 psd0.
addOptional<std::vector<edm::InputTag>>(
"inputs");
132 ->setComment(
"## Empty Regions PSet means complete unpacking");
134 desc.add<
std::string>(
"CablingMapLabel",
"")->setComment(
"CablingMap label");
138 template <
typename TrackerTraits>
140 auto const& hMap = iSetup.
getData(mapToken_);
141 auto const& dGains = iSetup.
getData(gainsToken_);
144 if (recordWatcher_.check(iSetup)) {
146 cablingMap_ = &iSetup.
getData(cablingMapToken_);
147 fedIds_ = cablingMap_->fedIds();
148 cabling_ = cablingMap_->cablingTree();
149 LogDebug(
"map version:") << cablingMap_->version();
153 std::optional<cms::alpakatools::device_buffer<Device, unsigned char[]>> modulesToUnpackRegional;
154 const unsigned char* modulesToUnpack;
156 regions_->run(
iEvent, iSetup);
157 LogDebug(
"SiPixelRawToCluster") <<
"region2unpack #feds: " << regions_->nFEDs();
158 LogDebug(
"SiPixelRawToCluster") <<
"region2unpack #modules (BPIX,EPIX,total): " << regions_->nBarrelModules()
159 <<
" " << regions_->nForwardModules() <<
" " << regions_->nModules();
162 *(regions_->modulesToUnpack()), cabling_.get(), fedIds_,
iEvent.queue());
163 modulesToUnpack = modulesToUnpackRegional->data();
165 modulesToUnpack = hMap->modToUnpDefault();
168 const auto& buffers =
iEvent.get(rawGetToken_);
173 unsigned int wordCounter = 0;
174 unsigned int fedCounter = 0;
175 bool errorsInEvent =
false;
176 std::vector<unsigned int>
index(fedIds_.size(), 0);
177 std::vector<cms_uint32_t const*>
start(fedIds_.size(),
nullptr);
178 std::vector<ptrdiff_t> words(fedIds_.size(), 0);
181 for (uint32_t
i = 0;
i < fedIds_.size(); ++
i) {
182 const int fedId = fedIds_[
i];
183 if (regions_ && !regions_->mayUnpackFED(
fedId))
202 if (not errorcheck.checkCRC(errorsInEvent,
fedId, trailer, errors_)) {
208 bool moreHeaders =
true;
209 while (moreHeaders) {
211 bool headerStatus = errorcheck.checkHeader(errorsInEvent,
fedId,
header, errors_);
212 moreHeaders = headerStatus;
216 bool moreTrailers =
true;
218 while (moreTrailers) {
220 bool trailerStatus = errorcheck.checkTrailer(errorsInEvent,
fedId,
nWords, trailer, errors_);
221 moreTrailers = trailerStatus;
227 assert(0 == (ew - bw) % 2);
230 words[
i] = (ew - bw);
231 wordCounter += (ew - bw);
234 nDigis_ = wordCounter;
240 for (uint32_t
i = 0;
i < fedIds_.size(); ++
i) {
243 Algo_.makePhase1ClustersAsync(
iEvent.queue(),
256 template <
typename TrackerTraits>
267 if (includeErrors_) {
268 iEvent.emplace(digiErrorPutToken_);
269 iEvent.emplace(fmtErrorToken_);
274 iEvent.emplace(digiPutToken_, Algo_.getDigis());
275 iEvent.emplace(clusterPutToken_, Algo_.getClusters());
276 if (includeErrors_) {
277 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)