36 produces<std::vector<reco::HGCalMultiCluster>>();
44 desc.addUntracked<
unsigned int>(
"verbosity", 3);
45 descriptions.
add(
"multiClustersFromTrackstersProducer",
desc);
49 auto multiclusters = std::make_unique<std::vector<reco::HGCalMultiCluster>>();
56 auto const& tracksters = *tracksterHandle;
65 std::for_each(std::begin(tracksters),
std::end(tracksters), [&](
auto const& trackster) {
69 std::array<double, 3> baricenter{{0., 0., 0.}};
70 double total_weight = 0.;
73 if (!trackster.vertices().empty()) {
74 std::for_each(std::begin(trackster.vertices()),
std::end(trackster.vertices()), [&](
unsigned int idx) {
75 temp.push_back(clusterPtrs[
idx]);
77 for (
auto const& cell : clusterPtrs[
idx]->hitsAndFractions()) {
78 temp.addHitAndFraction(cell.first, cell.second *
fraction);
82 baricenter[0] += clusterPtrs[
idx]->x() *
weight;
83 baricenter[1] += clusterPtrs[
idx]->y() *
weight;
84 baricenter[2] += clusterPtrs[
idx]->z() *
weight;
87 std::begin(baricenter),
std::end(baricenter), std::begin(baricenter), [&total_weight](
double val) ->
double {
88 return val / total_weight;
91 temp.setEnergy(total_weight);
92 temp.setCorrectedEnergy(total_weight);
95 temp.setTime(trackster.time(), trackster.timeError());
96 multiclusters->push_back(
temp);