14 void setP4(
const std::vector<const Trackster*>& tracksters,
15 std::vector<TICLCandidate>& ticl_cands,
19 std::tuple<TracksterMomentumPluginBase::LorentzVector, float>
calcP4(
22 const std::vector<reco::CaloCluster>& calo_clusters)
const;
30 energy_from_regression_(ps.getParameter<
bool>(
"energyFromRegression")),
32 layer_clusters_token_(
36 std::vector<TICLCandidate>& ticl_cands,
41 auto vertex_coll = *vertex_h;
43 if (!vertex_coll.empty()) {
44 const auto&
vertex = vertex_coll[0];
53 auto size =
std::min(tracksters.size(), ticl_cands.size());
54 for (
size_t i = 0;
i < size; ++
i) {
55 const auto* trackster = tracksters[
i];
56 auto ret =
calcP4(*trackster, best_vertex, *layer_clusters_h);
58 auto& ticl_cand = ticl_cands[
i];
59 ticl_cand.setP4(std::get<0>(
ret));
60 ticl_cand.setRawEnergy(std::get<1>(
ret));
67 const std::vector<reco::CaloCluster>& calo_clusters)
const {
68 std::array<double, 3> barycentre{{0., 0., 0.}};
74 auto fraction = n_vertices ? 1.f / n_vertices : 1.f;
77 barycentre[0] += calo_clusters[
idx].x() *
weight;
78 barycentre[1] += calo_clusters[
idx].y() *
weight;
79 barycentre[2] += calo_clusters[
idx].z() *
weight;
82 std::begin(barycentre), std::end(barycentre), std::begin(barycentre), [&
energy](
double val) ->
double {
87 direction = direction.Unit();
const float regressed_energy() const
edm::EDGetTokenT< std::vector< reco::CaloCluster > > layer_clusters_token_
ret
prodAgent to be discontinued
void setP4(const std::vector< const Trackster *> &tracksters, std::vector< TICLCandidate > &ticl_cands, edm::Event &event) const override
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
TracksterP4FromEnergySum(const edm::ParameterSet &, edm::ConsumesCollector &&iC)
bool energy_from_regression_
std::tuple< TracksterMomentumPluginBase::LorentzVector, float > calcP4(const ticl::Trackster &trackster, const reco::Vertex &vertex, const std::vector< reco::CaloCluster > &calo_clusters) const
std::vector< unsigned int > & vertices()
XYZVectorD XYZVector
spatial vector with cartesian internal representation
std::vector< float > & vertex_multiplicity()
edm::EDGetTokenT< std::vector< reco::Vertex > > vertex_token_
#define DEFINE_EDM_PLUGIN(factory, type, name)
reco::Candidate::LorentzVector LorentzVector