22 #define DEBUG_CLUSTERS_ALPAKA 0 24 #if DEBUG_CLUSTERS_ALPAKA 37 #if DEBUG_CLUSTERS_ALPAKA 48 produces<std::vector<float>>(
"InitialLayerClustersMask");
49 produces<std::vector<reco::BasicCluster>>();
50 produces<edm::ValueMap<std::pair<float, float>>>(
timeClname_);
59 auto const soaRecHitsExtra_v = deviceSoARecHitsExtra.view();
62 auto const soaCells_v = deviceSoACells.view();
64 auto const deviceView = deviceData.view();
66 std::unique_ptr<std::vector<reco::BasicCluster>>
clusters(
new std::vector<reco::BasicCluster>);
67 clusters->reserve(deviceData->metadata().size());
69 for (
int i = 0;
i < deviceData->metadata().size(); ++
i) {
70 std::vector<std::pair<DetId, float>> thisCluster;
71 thisCluster.reserve(deviceView.cells(
i));
72 clusters->emplace_back(deviceView.energy(
i),
77 clusters->back().setSeed(deviceView.seed(
i));
90 std::vector<std::vector<float>> times(
clusters->size(), std::vector<float>(16, 0.0f));
91 std::vector<std::vector<float>> timeErrors(
clusters->size(), std::vector<float>(16, 0.0f));
92 for (int32_t
i = 0;
i < soaRecHitsExtra_v.metadata().size(); ++
i) {
93 if (soaRecHitsExtra_v[
i].clusterIndex() == -1) {
97 (*clusters)[soaRecHitsExtra_v[
i].clusterIndex()].addHitAndFraction(soaCells_v[
i].detid(), 1.
f);
98 if (soaCells_v[
i].timeError() < 0.
f) {
101 times[soaRecHitsExtra_v[
i].clusterIndex()].push_back(soaCells_v[
i].
time());
102 timeErrors[soaRecHitsExtra_v[
i].clusterIndex()].push_back(
103 1.
f / (soaCells_v[
i].timeError() * soaCells_v[
i].timeError()));
107 std::vector<std::pair<float, float>> cluster_times;
113 cluster_times.push_back(std::pair<float, float>(-99.
f, -1.
f));
117 #if DEBUG_CLUSTERS_ALPAKA 119 auto lumiNumber =
iEvent.eventAuxiliary().luminosityBlock();
120 auto evtNumber =
iEvent.eventAuxiliary().id().event();
123 dumperCellsSoA.
dumpInfos(deviceSoACells, moduleLabel_,
runNumber, lumiNumber, evtNumber);
129 dumperSoA.
dumpInfos(deviceSoARecHitsExtra, moduleLabel_,
runNumber, lumiNumber, evtNumber);
134 auto timeCl = std::make_unique<edm::ValueMap<std::pair<float, float>>>();
136 filler.insert(clusterHandle, cluster_times.begin(), cluster_times.end());
146 std::unique_ptr<std::vector<float>> layerClustersMask(
new std::vector<float>);
147 layerClustersMask->resize(clusterHandle->size(), 1.0);
157 desc.add<
unsigned int>(
"nHitsTime", 3);
160 "detector",
"EE",
true,
edm::Comment(
"the HGCAL component used to create clusters.")),
161 edm::allowedValues<std::string>(
"EE",
"FH"));
173 #if DEBUG_CLUSTERS_ALPAKA
edm::EDGetTokenT< HGCalSoARecHitsExtraHostCollection > const getTokenSoARecHitsExtra_
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
HGCalLayerClustersFromSoAProducer(edm::ParameterSet const &config)
void produce(edm::Event &iEvent, edm::EventSetup const &iSetup) override
void dumpInfos(const T &clusters, const std::string &moduleLabel, edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event, bool dumpCellsDetId=false) const
edm::EDGetTokenT< HGCalSoAClustersHostCollection > const getTokenSoAClusters_
std::pair< float, float > fixSizeHighestDensity(std::vector< float > &time, std::vector< float > weight=std::vector< float >(), unsigned int minNhits=3, float deltaT=0.210, float timeWidthBy=0.5)
edm::EDGetTokenT< HGCalSoARecHitsHostCollection > const getTokenSoACells_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
#define DEFINE_FWK_MODULE(type)
~HGCalLayerClustersFromSoAProducer() override=default
void dumpInfos(const T &cells, const std::string &moduleLabel, edm::RunNumber_t run, edm::LuminosityBlockNumber_t lumi, edm::EventNumber_t event) const
XYZPointD XYZPoint
point in space with cartesian internal representation
reco::CaloCluster::AlgoId algoId_