1 #ifndef __RecoLocalCalo_HGCRecProducers_HGCalLayerClusterProducer_H__
2 #define __RecoLocalCalo_HGCRecProducers_HGCalLayerClusterProducer_H__
51 std::unique_ptr<HGCalClusteringAlgoBase>
algo;
64 doSharing(ps.getParameter<
bool>(
"doSharing")),
66 timeClname(ps.getParameter<
std::
string>(
"timeClname")),
67 timeOffset(ps.getParameter<double>(
"timeOffset")),
97 produces<std::vector<float>>(
"InitialLayerClustersMask");
98 produces<std::vector<reco::BasicCluster>>();
99 produces<std::vector<reco::BasicCluster>>(
"sharing");
103 produces<edm::ValueMap<std::pair<float, float>>>(
timeClname);
114 ->setComment(
"all (does not include HFNose); other options: EE, FH, HFNose; other value defaults to BH");
115 desc.
add<
bool>(
"doSharing",
false);
121 desc.
add<
double>(
"timeOffset", 0.0);
122 desc.
add<
unsigned int>(
"nHitsTime", 3);
123 descriptions.
add(
"hgcalLayerClusters", desc);
132 std::unique_ptr<std::vector<reco::BasicCluster>>
clusters(
new std::vector<reco::BasicCluster>),
133 clusters_sharing(
new std::vector<reco::BasicCluster>);
134 auto density = std::make_unique<Density>();
138 algo->getEventSetup(es);
143 std::unordered_map<uint32_t, const HGCRecHit*> hitmap;
148 algo->populate(*hfnose_hits);
149 for (
auto const& it : *hfnose_hits)
150 hitmap[it.detid().rawId()] = &(it);
154 algo->populate(*ee_hits);
155 for (
auto const& it : *ee_hits)
156 hitmap[it.detid().rawId()] = &(it);
162 algo->populate(*fh_hits);
163 for (
auto const& it : *fh_hits)
164 hitmap[it.detid().rawId()] = &(it);
165 }
else if (bh_hits.
isValid()) {
166 algo->populate(*bh_hits);
171 algo->populate(*ee_hits);
172 for (
auto const& it : *ee_hits) {
173 hitmap[it.detid().rawId()] = &(it);
176 algo->populate(*fh_hits);
177 for (
auto const& it : *fh_hits) {
178 hitmap[it.detid().rawId()] = &(it);
181 algo->populate(*bh_hits);
186 algo->makeClusters();
189 *clusters_sharing =
algo->getClusters(
true);
192 auto clusterHandleSharing = evt.
put(
std::move(clusters_sharing),
"sharing");
200 std::vector<std::pair<float, float>> times;
201 times.
reserve(clusterHandle->size());
203 for (
unsigned i = 0;
i < clusterHandle->size(); ++
i) {
207 std::pair<float, float> timeCl(-99., -1.);
211 std::vector<float> timeClhits;
212 std::vector<float> timeErrorClhits;
216 if (
finder == hitmap.end())
226 timeErrorClhits.push_back(1. / (rhTimeE * rhTimeE));
231 times.push_back(timeCl);
233 std::unique_ptr<std::vector<float>> layerClustersMask(
new std::vector<float>);
234 layerClustersMask->resize(clusterHandle->size(), 1.0);
235 evt.
put(
std::move(layerClustersMask),
"InitialLayerClustersMask");
237 auto timeCl = std::make_unique<edm::ValueMap<std::pair<float, float>>>();
239 filler.insert(clusterHandle, times.begin(), times.end());
244 for (
unsigned i = 0;
i < clusterHandleSharing->size(); ++
i) {