22 seedThresholdPt_(ps.getParameter<double>(
"seedThresholdPt")),
23 candidateEnergyThreshold_(ps.getParameter<double>(
"candidateEnergyThreshold")),
24 filterByTracksterPID_(ps.getParameter<
bool>(
"filterByTracksterPID")),
25 tracksterPIDCategoriesToFilter_(ps.getParameter<
std::
vector<
int>>(
"tracksterPIDCategoriesToFilter")),
26 PIDThreshold_(ps.getParameter<double>(
"PIDThreshold")) {}
40 float probTotal = 0.0f;
57 std::vector<Trackster>& resultTracksters,
58 std::vector<std::vector<unsigned int>>& outputSuperclusters,
59 std::vector<std::vector<unsigned int>>& linkedTracksterIdToInputTracksterId) {
61 auto const& inputTracksters =
input.tracksters;
62 const unsigned int tracksterCount = inputTracksters.size();
68 std::vector<unsigned int> trackstersIndicesPt(inputTracksters.size());
69 std::iota(trackstersIndicesPt.begin(), trackstersIndicesPt.end(), 0);
71 trackstersIndicesPt.begin(), trackstersIndicesPt.end(), [&inputTracksters](
unsigned int i1,
unsigned int i2) {
72 return inputTracksters[
i1].raw_pt() > inputTracksters[
i2].raw_pt();
75 std::vector<bool> tracksterMask_pt(tracksterCount,
false);
77 for (
unsigned int ts_idx_pt = 0; ts_idx_pt < tracksterCount; ts_idx_pt++) {
81 for (
unsigned int ts_seed_idx_pt = 0; ts_seed_idx_pt < tracksterCount; ts_seed_idx_pt++) {
82 Trackster const& ts_seed = inputTracksters[trackstersIndicesPt[ts_seed_idx_pt]];
85 if (tracksterMask_pt[ts_seed_idx_pt])
88 outputSuperclusters.emplace_back(std::initializer_list<unsigned int>{trackstersIndicesPt[ts_seed_idx_pt]});
89 resultTracksters.emplace_back(inputTracksters[trackstersIndicesPt[ts_seed_idx_pt]]);
90 linkedTracksterIdToInputTracksterId.emplace_back(
91 std::initializer_list<unsigned int>{trackstersIndicesPt[ts_seed_idx_pt]});
93 for (
unsigned int ts_cand_idx_pt = ts_seed_idx_pt + 1; ts_cand_idx_pt < tracksterCount; ts_cand_idx_pt++) {
94 if (tracksterMask_pt[ts_cand_idx_pt])
97 Trackster const& ts_cand = inputTracksters[trackstersIndicesPt[ts_cand_idx_pt]];
115 outputSuperclusters.back().push_back(trackstersIndicesPt[ts_cand_idx_pt]);
116 resultTracksters.back().mergeTracksters(ts_cand);
117 linkedTracksterIdToInputTracksterId.back().push_back(trackstersIndicesPt[ts_cand_idx_pt]);
118 tracksterMask_pt[ts_cand_idx_pt] =
true;
126 desc.add<
double>(
"seedThresholdPt", 1.)
127 ->setComment(
"Minimum transverse energy of trackster to be considered as seed of a supercluster");
128 desc.add<
double>(
"candidateEnergyThreshold", 0.15)
129 ->setComment(
"Minimum energy of trackster to be considered as candidate for superclustering");
130 desc.add<
bool>(
"filterByTracksterPID",
true)->setComment(
"Filter tracksters before superclustering by PID score");
131 desc.add<std::vector<int>>(
132 "tracksterPIDCategoriesToFilter",
134 ->setComment(
"List of PID particle types (ticl::Trackster::ParticleType enum) to consider for PID filtering");
135 desc.add<
double>(
"PIDThreshold", 0.8)->setComment(
"PID score threshold");
edm::ESGetToken< EcalSCDynamicDPhiParameters, EcalSCDynamicDPhiParametersRcd > ecalSCDynamicDPhiParametersToken_
const float raw_pt() const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const EcalSCDynamicDPhiParameters * scDynamicDPhiParams_
const Vector & barycenter() const
bool inMustache(const EcalMustacheSCParameters *params, const float maxEta, const float maxPhi, const float ClustE, const float ClusEta, const float ClusPhi)
void linkTracksters(const Inputs &input, std::vector< Trackster > &resultTracksters, std::vector< std::vector< unsigned int >> &linkedResultTracksters, std::vector< std::vector< unsigned int >> &linkedTracksterIdToInputTracksterId) override
static std::string const input
edm::ESGetToken< EcalMustacheSCParameters, EcalMustacheSCParametersRcd > ecalMustacheSCParametersToken_
void initialize(const HGCalDDDConstants *hgcons, const hgcal::RecHitTools rhtools, const edm::ESHandle< MagneticField > bfieldH, const edm::ESHandle< Propagator > propH) override
TracksterLinkingbySuperClusteringMustache(const edm::ParameterSet &ps, edm::ConsumesCollector iC, cms::Ort::ONNXRuntime const *onnxRuntime=nullptr)
const EcalMustacheSCParameters * mustacheSCParams_
const float raw_energy() const
static void fillPSetDescription(edm::ParameterSetDescription &iDesc)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
bool filterByTracksterPID_
bool inDynamicDPhiWindow(const EcalSCDynamicDPhiParameters *params, const float seedEta, const float seedPhi, const float ClustE, const float ClusEta, const float clusPhi)
float candidateEnergyThreshold_
virtual void setEvent(edm::Event &iEvent, edm::EventSetup const &iEventSetup) override
bool trackstersPassesPIDCut(const Trackster &ts) const
const std::array< float, 8 > & id_probabilities() const
std::vector< int > tracksterPIDCategoriesToFilter_