34 : layer_clusters_token_(consumes<std::
vector<
reco::CaloCluster>>(ps.getParameter<edm::
InputTag>(
"LayerClusters"))),
35 tracksters_token_(consumes<std::
vector<ticl::Trackster>>(ps.getParameter<edm::
InputTag>(
"Tracksters"))) {
36 produces<std::vector<reco::HGCalMultiCluster>>();
45 descriptions.
add(
"multiClustersFromTrackstersProducer", desc);
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.
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void addHitAndFraction(DetId id, float fraction)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
void push_back(Ptr< T > const &iPtr)
void setPosition(const math::XYZPoint &p)
void setTime(float time, float timeError=0)
void setEnergy(double energy)
MultiClustersFromTrackstersProducer(const edm::ParameterSet &)
edm::EDGetTokenT< std::vector< ticl::Trackster > > tracksters_token_
~MultiClustersFromTrackstersProducer() override
void setCorrectedEnergy(double cenergy)
void push_back(const edm::Ptr< reco::BasicCluster > &b)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
XYZPointD XYZPoint
point in space with cartesian internal representation
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void setAlgoId(const AlgoId &id)
static std::atomic< unsigned int > counter
edm::EDGetTokenT< std::vector< reco::CaloCluster > > layer_clusters_token_
void produce(edm::Event &, const edm::EventSetup &) override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)