61 if (
input.regions.empty())
71 LogDebug(
"HGCPatternRecoByCA") <<
"Making Tracksters with CA" << std::endl;
78 bool isRegionalIter = (
input.regions[0].index != -1);
80 std::vector<int> seedIndices;
81 std::vector<uint8_t> layer_cluster_usage(
input.layerClusters.size(), 0);
88 input.layerClustersTime,
105 int tracksterId = -1;
108 std::vector<Trackster> tmpTracksters;
114 std::set<unsigned int> effective_cluster_idx;
116 for (
auto const &doublet :
ntuplet) {
117 auto innerCluster =
doublets[doublet].innerClusterId();
118 auto outerCluster =
doublets[doublet].outerClusterId();
120 effective_cluster_idx.insert(innerCluster);
121 effective_cluster_idx.insert(outerCluster);
124 LogDebug(
"HGCPatternRecoByCA") <<
" New doublet " << doublet <<
" for trackster: " <<
result.size()
125 <<
" InnerCl " << innerCluster <<
" " <<
input.layerClusters[innerCluster].x()
126 <<
" " <<
input.layerClusters[innerCluster].y() <<
" " 127 <<
input.layerClusters[innerCluster].z() <<
" OuterCl " << outerCluster <<
" " 128 <<
input.layerClusters[outerCluster].x() <<
" " 129 <<
input.layerClusters[outerCluster].y() <<
" " 130 <<
input.layerClusters[outerCluster].z() <<
" " << tracksterId << std::endl;
133 unsigned showerMinLayerId = 99999;
134 std::vector<unsigned int> uniqueLayerIds;
135 uniqueLayerIds.reserve(effective_cluster_idx.size());
136 std::vector<std::pair<unsigned int, unsigned int>> lcIdAndLayer;
137 lcIdAndLayer.reserve(effective_cluster_idx.size());
138 for (
auto const i : effective_cluster_idx) {
139 auto const &haf =
input.layerClusters[
i].hitsAndFractions();
141 showerMinLayerId =
std::min(layerId, showerMinLayerId);
142 uniqueLayerIds.push_back(layerId);
143 lcIdAndLayer.emplace_back(
i, layerId);
145 std::sort(uniqueLayerIds.begin(), uniqueLayerIds.end());
146 uniqueLayerIds.erase(
std::unique(uniqueLayerIds.begin(), uniqueLayerIds.end()), uniqueLayerIds.end());
147 unsigned int numberOfLayersInTrackster = uniqueLayerIds.size();
149 int numberOfMissingLayers = 0;
150 unsigned int j = showerMinLayerId;
151 unsigned int indexInVec = 0;
152 for (
const auto &
layer : uniqueLayerIds) {
154 numberOfMissingLayers++;
157 numberOfLayersInTrackster = indexInVec;
158 for (
auto &llpair : lcIdAndLayer) {
159 if (llpair.second >=
layer) {
160 effective_cluster_idx.erase(llpair.first);
173 tmp.vertices().reserve(effective_cluster_idx.size());
174 tmp.vertex_multiplicity().resize(effective_cluster_idx.size(), 1);
177 tmp.setSeed(
input.regions[0].collectionID, seedIndices[tracksterId]);
179 std::copy(std::begin(effective_cluster_idx), std::end(effective_cluster_idx), std::back_inserter(
tmp.vertices()));
180 tmpTracksters.push_back(
tmp);
185 input.layerClustersTime,
198 auto filter_on_pids = [&](
Trackster &
t) ->
bool {
199 auto cumulative_prob = 0.;
201 cumulative_prob +=
t.id_probabilities(
index);
207 std::vector<unsigned int> selectedTrackstersIds;
208 for (
unsigned i = 0;
i < tmpTracksters.size(); ++
i) {
210 selectedTrackstersIds.push_back(
i);
214 result.reserve(selectedTrackstersIds.size());
216 for (
unsigned i = 0;
i < selectedTrackstersIds.size(); ++
i) {
217 const auto &
t = tmpTracksters[selectedTrackstersIds[
i]];
218 for (
auto const lcId :
t.vertices()) {
219 layer_cluster_usage[lcId]++;
221 LogDebug(
"HGCPatternRecoByCA") <<
"LayerID: " << lcId <<
" count: " << (
int)layer_cluster_usage[lcId]
224 if (isRegionalIter) {
225 seedToTracksterAssociation[
t.seedIndex()].push_back(
i);
230 for (
auto &trackster :
result) {
231 assert(trackster.vertices().size() <= trackster.vertex_multiplicity().size());
232 for (
size_t i = 0;
i < trackster.vertices().size(); ++
i) {
233 trackster.vertex_multiplicity()[
i] = layer_cluster_usage[trackster.vertices(
i)];
235 LogDebug(
"HGCPatternRecoByCA") <<
"LayerID: " << trackster.vertices(
i)
236 <<
" count: " << (
int)trackster.vertex_multiplicity(
i) << std::endl;
241 std::vector<Trackster>
tmp;
248 input.layerClustersTime,
263 for (
auto &trackster :
result) {
264 LogDebug(
"HGCPatternRecoByCA") <<
"Trackster characteristics: " << std::endl;
265 LogDebug(
"HGCPatternRecoByCA") <<
"Size: " << trackster.vertices().size() << std::endl;
267 for (
auto const &
p : trackster.id_probabilities()) {
const bool oneTracksterPerTrackSeed_
const std::unique_ptr< HGCGraphT< TILES > > theGraph_
const bool computeLocalTime_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
const float max_delta_time_
const unsigned int max_out_in_hops_
void mergeTrackstersTRK(const std::vector< Trackster > &, const std::vector< reco::CaloCluster > &, std::vector< Trackster > &, std::unordered_map< int, std::vector< int >> &seedToTracksterAssociation) const
void emptyTrackstersFromSeedsTRK(std::vector< Trackster > &tracksters, std::unordered_map< int, std::vector< int >> &seedToTracksterAssociation, const edm::ProductID &collectionID) const
void assignPCAtoTracksters(std::vector< Trackster > &tracksters, const std::vector< reco::CaloCluster > &layerClusters, const edm::ValueMap< std::pair< float, float >> &layerClustersTime, double z_limit_em, hgcal::RecHitTools const &rhTools, bool computeLocalTime=false, bool energyWeight=true, bool clean=false, int minLayer=10, int maxLayer=10)
const std::vector< double > siblings_maxRSquared_
const double max_longitudinal_sigmaPCA_
static std::string const input
const int min_clusters_per_ntuplet_
const float etaLimitIncreaseWindow_
const std::vector< int > filter_on_categories_
const unsigned int min_layers_per_trackster_
def unique(seq, keepstr=True)
const float min_cos_pointing_
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeomToken_
bool check_missing_layers_
hgcal::RecHitTools rhtools_
const double pid_threshold_
const int max_missing_layers_in_trackster_
void energyRegressionAndID(const std::vector< reco::CaloCluster > &layerClusters, const tensorflow::Session *, std::vector< Trackster > &result)
auto const & foundNtuplets
const float min_cos_theta_
static constexpr int nPhiBins
const unsigned int shower_start_max_layer_
const double energy_em_over_total_threshold_
const float root_doublet_max_distance_from_seed_squared_
const bool promoteEmptyRegionToTrackster_