45 template <
typename TrackerTraits>
73 std::unique_ptr<SiPixelFedCablingTree>
cabling_;
76 std::unique_ptr<PixelUnpackingRegions>
regions_;
87 template <
typename TrackerTraits>
96 includeErrors_(iConfig.getParameter<
bool>(
"IncludeErrors")),
97 useQuality_(iConfig.getParameter<
bool>(
"UseQualityInfo")),
98 clusterThresholds_{iConfig.
getParameter<int32_t>(
"clusterThreshold_layer1"),
99 iConfig.
getParameter<int32_t>(
"clusterThreshold_otherLayers"),
100 static_cast<float>(iConfig.
getParameter<
double>(
"VCaltoElectronGain")),
101 static_cast<float>(iConfig.
getParameter<
double>(
"VCaltoElectronGain_L1")),
102 static_cast<float>(iConfig.
getParameter<
double>(
"VCaltoElectronOffset")),
103 static_cast<float>(iConfig.
getParameter<
double>(
"VCaltoElectronOffset_L1"))} {
104 if (includeErrors_) {
105 digiErrorPutToken_ = produces<cms::cuda::Product<SiPixelDigiErrorsCUDA>>();
110 regions_ = std::make_unique<PixelUnpackingRegions>(iConfig, consumesCollector());
114 template <
typename TrackerTraits>
117 desc.add<
bool>(
"IncludeErrors",
true);
118 desc.add<
bool>(
"UseQualityInfo",
false);
122 ->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);
133 psd0.
addOptional<std::vector<edm::InputTag>>(
"inputs");
138 ->setComment(
"## Empty Regions PSet means complete unpacking");
140 desc.add<
std::string>(
"CablingMapLabel",
"")->setComment(
"CablingMap label");
144 template <
typename TrackerTraits>
150 auto hgpuMap = iSetup.
getHandle(gpuMapToken_);
151 if (hgpuMap->hasQuality() != useQuality_) {
153 <<
"UseQuality of the module (" << useQuality_
154 <<
") differs the one from SiPixelROCsStatusAndMappingWrapper. Please fix your configuration.";
157 const auto* gpuMap = hgpuMap->getGPUProductAsync(ctx.stream());
159 auto hgains = iSetup.
getHandle(gainsToken_);
161 const auto* gpuGains = hgains->getGPUProductAsync(ctx.stream());
164 const unsigned char* gpuModulesToUnpack;
167 regions_->run(
iEvent, iSetup);
168 LogDebug(
"SiPixelRawToCluster") <<
"region2unpack #feds: " << regions_->nFEDs();
169 LogDebug(
"SiPixelRawToCluster") <<
"region2unpack #modules (BPIX,EPIX,total): " << regions_->nBarrelModules() <<
" " 170 << regions_->nForwardModules() <<
" " << regions_->nModules();
171 modulesToUnpackRegional = hgpuMap->getModToUnpRegionalAsync(*(regions_->modulesToUnpack()), ctx.stream());
172 gpuModulesToUnpack = modulesToUnpackRegional.get();
174 gpuModulesToUnpack = hgpuMap->getModToUnpAllAsync(ctx.stream());
178 if (recordWatcher_.check(iSetup)) {
181 cablingMap_ = cablingMap.product();
182 fedIds_ = cablingMap->fedIds();
183 cabling_ = cablingMap->cablingTree();
184 LogDebug(
"map version:") << cabling_->version();
187 const auto& buffers =
iEvent.get(rawGetToken_);
192 unsigned int wordCounter = 0;
193 unsigned int fedCounter = 0;
194 bool errorsInEvent =
false;
196 std::vector<unsigned int>
index(fedIds_.size(), 0);
197 std::vector<cms_uint32_t const*>
start(fedIds_.size(),
nullptr);
198 std::vector<ptrdiff_t> words(fedIds_.size(), 0);
202 for (uint32_t
i = 0;
i < fedIds_.size(); ++
i) {
203 const int fedId = fedIds_[
i];
204 if (regions_ && !regions_->mayUnpackFED(
fedId))
224 if (not errorcheck.checkCRC(errorsInEvent,
fedId, trailer, errors_)) {
231 bool moreHeaders =
true;
232 while (moreHeaders) {
234 bool headerStatus = errorcheck.checkHeader(errorsInEvent,
fedId,
header, errors_);
235 moreHeaders = headerStatus;
239 bool moreTrailers =
true;
241 while (moreTrailers) {
243 bool trailerStatus = errorcheck.checkTrailer(errorsInEvent,
fedId,
nWords, trailer, errors_);
244 moreTrailers = trailerStatus;
250 assert(0 == (ew - bw) % 2);
253 words[
i] = (ew - bw);
254 wordCounter += (ew - bw);
258 nDigis_ = wordCounter;
265 for (uint32_t
i = 0;
i < fedIds_.size(); ++
i) {
269 gpuAlgo_.makePhase1ClustersAsync(clusterThresholds_,
283 template <
typename TrackerTraits>
297 if (includeErrors_) {
303 auto tmp = gpuAlgo_.getResults();
306 if (includeErrors_) {
307 ctx.emplace(
iEvent, digiErrorPutToken_, gpuAlgo_.getErrors());
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
PixelDataFormatter::Errors errors_
SiPixelRawToClusterCUDAT(const edm::ParameterSet &iConfig)
T getParameter(std::string const &) const
ParameterDescriptionBase * addOptional(U const &iLabel, T const &value)
void acquire(const edm::Event &iEvent, const edm::EventSetup &iSetup, edm::WaitingTaskWithArenaHolder waitingTaskHolder) override
edm::ESGetToken< SiPixelROCsStatusAndMappingWrapper, CkfComponentsRecord > gpuMapToken_
edm::EDPutTokenT< cms::cuda::Product< SiPixelDigiErrorsCUDA > > digiErrorPutToken_
std::vector< unsigned int > fedIds_
static MessageDrop * instance()
void initializeWordFed(int fedId, unsigned int index, cms_uint32_t const *src, unsigned int length)
std::unique_ptr< T, impl::DeviceDeleter > unique_ptr
~SiPixelRawToClusterCUDAT() override=default
void produce(edm::Event &iEvent, const edm::EventSetup &iSetup) override
constexpr uint16_t clusterThresholdOtherLayers
const SiPixelClusterThresholds clusterThresholds_
edm::ESGetToken< SiPixelFedCablingMap, SiPixelFedCablingMapRcd > cablingMapToken_
#define DEFINE_FWK_MODULE(type)
const SiPixelFedCablingMap * cablingMap_
edm::ESGetToken< SiPixelGainCalibrationForHLTGPU, SiPixelGainCalibrationForHLTGPURcd > gainsToken_
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
cms::cuda::ContextState ctxState_
unsigned int cms_uint32_t
constexpr uint16_t clusterThresholdLayerOne
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
Namespace of DDCMS conversion namespace.
std::unique_ptr< PixelUnpackingRegions > regions_
edm::EDGetTokenT< FEDRawDataCollection > rawGetToken_
ESTransientHandle< T > getTransientHandle(const ESGetToken< T, R > &iToken) const
const bool includeErrors_
edm::EDPutTokenT< cms::cuda::Product< SiPixelDigisCUDA > > digiPutToken_
unsigned long long cms_uint64_t
edm::ESWatcher< SiPixelFedCablingMapRcd > recordWatcher_
edm::EDPutTokenT< cms::cuda::Product< SiPixelClustersCUDA > > clusterPutToken_
std::vector< std::string > getParameterNames() const
std::unique_ptr< SiPixelFedCablingTree > cabling_
static constexpr uint16_t numberOfModules