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 [[maybe_unused]]
auto const& hMap = iSetup.
getData(mapToken_);
141 auto const& dGains = iSetup.
getData(gainsToken_);
143 auto modulesToUnpackRegional =
145 const unsigned char* modulesToUnpack;
147 if (recordWatcher_.check(iSetup)) {
149 cablingMap_ = &iSetup.
getData(cablingMapToken_);
150 fedIds_ = cablingMap_->fedIds();
151 cabling_ = cablingMap_->cablingTree();
152 LogDebug(
"map version:") << cablingMap_->version();
155 regions_->run(
iEvent, iSetup);
156 LogDebug(
"SiPixelRawToCluster") <<
"region2unpack #feds: " << regions_->nFEDs();
157 LogDebug(
"SiPixelRawToCluster") <<
"region2unpack #modules (BPIX,EPIX,total): " << regions_->nBarrelModules()
158 <<
" " << regions_->nForwardModules() <<
" " << regions_->nModules();
161 *(regions_->modulesToUnpack()), cabling_.get(), fedIds_,
iEvent.queue());
162 modulesToUnpack = modulesToUnpackRegional.data();
164 modulesToUnpack = hMap->modToUnpDefault();
167 const auto& buffers =
iEvent.get(rawGetToken_);
172 unsigned int wordCounter = 0;
173 unsigned int fedCounter = 0;
174 bool errorsInEvent =
false;
175 std::vector<unsigned int>
index(fedIds_.size(), 0);
176 std::vector<cms_uint32_t const*>
start(fedIds_.size(),
nullptr);
177 std::vector<ptrdiff_t> words(fedIds_.size(), 0);
180 for (uint32_t
i = 0;
i < fedIds_.size(); ++
i) {
181 const int fedId = fedIds_[
i];
182 if (regions_ && !regions_->mayUnpackFED(
fedId))
201 if (not errorcheck.checkCRC(errorsInEvent,
fedId, trailer, errors_)) {
207 bool moreHeaders =
true;
208 while (moreHeaders) {
210 bool headerStatus = errorcheck.checkHeader(errorsInEvent,
fedId,
header, errors_);
211 moreHeaders = headerStatus;
215 bool moreTrailers =
true;
217 while (moreTrailers) {
219 bool trailerStatus = errorcheck.checkTrailer(errorsInEvent,
fedId,
nWords, trailer, errors_);
220 moreTrailers = trailerStatus;
226 assert(0 == (ew - bw) % 2);
229 words[
i] = (ew - bw);
230 wordCounter += (ew - bw);
233 nDigis_ = wordCounter;
239 for (uint32_t
i = 0;
i < fedIds_.size(); ++
i) {
242 Algo_.makePhase1ClustersAsync(
iEvent.queue(),
255 template <
typename TrackerTraits>
266 if (includeErrors_) {
267 iEvent.emplace(digiErrorPutToken_);
268 iEvent.emplace(fmtErrorToken_);
273 iEvent.emplace(digiPutToken_, Algo_.getDigis());
274 iEvent.emplace(clusterPutToken_, Algo_.getClusters());
275 if (includeErrors_) {
276 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
PortableCollection< SiPixelGainCalibrationForHLTSoA > SiPixelGainCalibrationForHLTDevice
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
constexpr float gains[NGAINS]
device::EDPutToken< SiPixelClustersSoACollection > clusterPutToken_
std::vector< unsigned int > fedIds_
PixelDataFormatter::Errors errors_
edm::EDGetTokenT< FEDRawDataCollection > rawGetToken_
std::unique_ptr< SiPixelFedCablingTree > cabling_
constexpr unsigned int MAX_SIZE
#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)