64 : min_particle_prob_(ps.getParameter<double>(
"minParticleProbability")) {
67 [
this](
edm::InputTag const&
tag) { return consumes<std::vector<Trackster>>(tag); });
68 produces<std::vector<TICLCandidate>>();
71 pset_momentum.getParameter<
std::string>(
"plugin"), pset_momentum, consumesCollector());
75 pset_track.getParameter<
std::string>(
"plugin"), pset_track, consumesCollector());
81 std::vector<edm::InputTag> source_vector{
edm::InputTag(
"trackstersTrk"),
85 desc.add<std::vector<edm::InputTag>>(
"tracksterCollections", source_vector);
86 desc.add<
double>(
"minParticleProbability", 0.);
89 desc_momentum.
add<
std::string>(
"plugin",
"TracksterP4FromEnergySum");
90 desc_momentum.
add<
bool>(
"energyFromRegression",
false);
100 descriptions.
add(
"ticlCandidateFromTrackstersProducer",
desc);
104 auto result = std::make_unique<std::vector<TICLCandidate>>();
106 std::vector<const Trackster*> trackster_ptrs;
112 for (
size_t i_trackster = 0; i_trackster < trackster_h->size(); ++i_trackster) {
113 auto const& trackster = trackster_h->at(i_trackster);
114 auto id_prob_begin = std::begin(trackster.id_probabilities());
115 auto max_id_prob_it = std::max_element(id_prob_begin,
std::end(trackster.id_probabilities()));
116 float max_id_prob = *max_id_prob_it;
120 trackster_ptrs.push_back(&trackster);
123 auto pdg_id = pdg_id_from_particle_type(static_cast<ticl::Trackster::ParticleType>(
max_index));
124 ticl_cand.setPdgId(
pdg_id);
132 for (
size_t i = 0;
i <
result->size(); ++
i) {
133 auto& ticl_cand =
result->at(
i);
134 auto pdg_id = ticl_cand.pdgId();
136 if (ticl_cand.trackPtr().isNonnull()) {
137 auto charge = ticl_cand.trackPtr()->charge();
138 ticl_cand.setCharge(
charge);
144 if (ticl_cand.rawEnergy() == 0.) {
145 auto const& three_mom = ticl_cand.trackPtr()->momentum();
146 constexpr
double mpion2 = 0.13957 * 0.13957;
149 ticl_cand.setP4(trk_p4);
150 ticl_cand.setRawEnergy(
energy);
154 ticl_cand.setCharge(0);
156 ticl_cand.setPdgId(22);
158 ticl_cand.setPdgId(130);
T getParameter(std::string const &) const
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::unique_ptr< TracksterTrackPluginBase > track_algo_
#define DEFINE_FWK_MODULE(type)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
ParameterDescriptionBase * add(U const &iLabel, T const &value)
TICLCandidateFromTrackstersProducer(const edm::ParameterSet &)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
std::unique_ptr< TracksterMomentumPluginBase > momentum_algo_
void produce(edm::Event &, const edm::EventSetup &) override
std::vector< edm::EDGetTokenT< std::vector< Trackster > > > trackster_tokens_
size_t max_index(const std::vector< T > &v)
~TICLCandidateFromTrackstersProducer() override