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);
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
void push_back(Ptr< T > const &iPtr)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MultiClustersFromTrackstersProducer(const edm::ParameterSet &)
edm::EDGetTokenT< std::vector< ticl::Trackster > > tracksters_token_
~MultiClustersFromTrackstersProducer() override
#define DEFINE_FWK_MODULE(type)
XYZPointD XYZPoint
point in space with cartesian internal representation
void add(std::string const &label, ParameterSetDescription const &psetDescription)
edm::EDGetTokenT< std::vector< reco::CaloCluster > > layer_clusters_token_
void produce(edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)