1 #ifndef __RecoLocalCalo_HGCRecProducers_HGCalLayerClusterProducer_H__
2 #define __RecoLocalCalo_HGCRecProducers_HGCalLayerClusterProducer_H__
51 std::unique_ptr<HGCalClusteringAlgoBase>
algo;
67 timeOffset(ps.getParameter<double>(
"timeOffset")),
94 pluginPSet.getParameter<
std::string>(
"type"), pluginPSet, consumesCollector());
98 produces<std::vector<float>>(
"InitialLayerClustersMask");
99 produces<std::vector<reco::BasicCluster>>();
100 produces<std::vector<reco::BasicCluster>>(
"sharing");
104 produces<edm::ValueMap<std::pair<float, float>>>(
timeClname);
115 ->setComment(
"all (does not include HFNose); other options: EE, FH, HFNose; other value defaults to BH");
116 desc.add<
bool>(
"doSharing",
false);
122 desc.add<
double>(
"timeOffset", 0.0);
123 desc.add<
unsigned int>(
"nHitsTime", 3);
124 descriptions.
add(
"hgcalLayerClusters",
desc);
133 std::unique_ptr<std::vector<reco::BasicCluster>>
clusters(
new std::vector<reco::BasicCluster>),
134 clusters_sharing(
new std::vector<reco::BasicCluster>);
135 auto density = std::make_unique<Density>();
137 algo->getEventSetup(es);
142 std::unordered_map<uint32_t, const HGCRecHit*> hitmap;
147 algo->populate(*hfnose_hits);
148 for (
auto const& it : *hfnose_hits)
149 hitmap[it.detid().rawId()] = &(it);
153 algo->populate(*ee_hits);
154 for (
auto const& it : *ee_hits)
155 hitmap[it.detid().rawId()] = &(it);
161 algo->populate(*fh_hits);
162 for (
auto const& it : *fh_hits)
163 hitmap[it.detid().rawId()] = &(it);
164 }
else if (bh_hits.
isValid()) {
165 algo->populate(*bh_hits);
170 algo->populate(*ee_hits);
171 for (
auto const& it : *ee_hits) {
172 hitmap[it.detid().rawId()] = &(it);
175 algo->populate(*fh_hits);
176 for (
auto const& it : *fh_hits) {
177 hitmap[it.detid().rawId()] = &(it);
180 algo->populate(*bh_hits);
185 algo->makeClusters();
188 *clusters_sharing =
algo->getClusters(
true);
191 auto clusterHandleSharing = evt.
put(
std::move(clusters_sharing),
"sharing");
199 std::vector<std::pair<float, float>> times;
200 times.
reserve(clusterHandle->size());
202 for (
unsigned i = 0;
i < clusterHandle->size(); ++
i) {
206 std::pair<float, float> timeCl(-99., -1.);
210 std::vector<float> timeClhits;
211 std::vector<float> timeErrorClhits;
215 if (
finder == hitmap.end())
225 timeErrorClhits.push_back(1. / (rhTimeE * rhTimeE));
230 times.push_back(timeCl);
232 std::unique_ptr<std::vector<float>> layerClustersMask(
new std::vector<float>);
233 layerClustersMask->resize(clusterHandle->size(), 1.0);
234 evt.
put(
std::move(layerClustersMask),
"InitialLayerClustersMask");
236 auto timeCl = std::make_unique<edm::ValueMap<std::pair<float, float>>>();
238 filler.insert(clusterHandle, times.begin(), times.end());
243 for (
unsigned i = 0;
i < clusterHandleSharing->size(); ++
i) {
251 #endif //__RecoLocalCalo_HGCRecProducers_HGCalLayerClusterProducer_H__