49 auto multiclusters = std::make_unique<std::vector<reco::HGCalMultiCluster>>();
56 auto const& tracksters = *tracksterHandle;
57 auto const& layerClusters = *layer_clustersHandle;
60 for (
unsigned i = 0;
i < layerClusters.size(); ++
i) {
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) {
76 auto fraction = 1.f / trackster.vertex_multiplicity(counter++);
77 for (
auto const& cell : clusterPtrs[idx]->hitsAndFractions()) {
82 baricenter[0] += clusterPtrs[idx]->x() *
weight;
83 baricenter[1] += clusterPtrs[idx]->y() *
weight;
84 baricenter[2] += clusterPtrs[idx]->z() *
weight;
88 return val / total_weight;
95 temp.
setTime(trackster.time(), trackster.timeError());
96 multiclusters->push_back(temp);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void addHitAndFraction(DetId id, float fraction)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void push_back(Ptr< T > const &iPtr)
void setPosition(const math::XYZPoint &p)
void setTime(float time, float timeError=0)
void setEnergy(double energy)
edm::EDGetTokenT< std::vector< ticl::Trackster > > tracksters_token_
void setCorrectedEnergy(double cenergy)
void push_back(const edm::Ptr< reco::BasicCluster > &b)
XYZPointD XYZPoint
point in space with cartesian internal representation
void setAlgoId(const AlgoId &id)
static std::atomic< unsigned int > counter
edm::EDGetTokenT< std::vector< reco::CaloCluster > > layer_clusters_token_