60 if (
input.regions.empty())
70 LogDebug(
"HGCPatternRecoByCA") <<
"Making Tracksters with CA" << std::endl;
77 bool isRegionalIter = (
input.regions[0].index != -1);
79 std::vector<int> seedIndices;
80 std::vector<uint8_t> layer_cluster_usage(
input.layerClusters.size(), 0);
87 input.layerClustersTime,
104 int tracksterId = -1;
107 std::vector<Trackster> tmpTracksters;
113 std::set<unsigned int> effective_cluster_idx;
115 for (
auto const &doublet :
ntuplet) {
116 auto innerCluster =
doublets[doublet].innerClusterId();
117 auto outerCluster =
doublets[doublet].outerClusterId();
119 effective_cluster_idx.insert(innerCluster);
120 effective_cluster_idx.insert(outerCluster);
123 LogDebug(
"HGCPatternRecoByCA") <<
" New doublet " << doublet <<
" for trackster: " <<
result.size()
124 <<
" InnerCl " << innerCluster <<
" " <<
input.layerClusters[innerCluster].x()
125 <<
" " <<
input.layerClusters[innerCluster].y() <<
" " 126 <<
input.layerClusters[innerCluster].z() <<
" OuterCl " << outerCluster <<
" " 127 <<
input.layerClusters[outerCluster].x() <<
" " 128 <<
input.layerClusters[outerCluster].y() <<
" " 129 <<
input.layerClusters[outerCluster].z() <<
" " << tracksterId << std::endl;
132 unsigned showerMinLayerId = 99999;
133 std::vector<unsigned int> uniqueLayerIds;
134 uniqueLayerIds.reserve(effective_cluster_idx.size());
135 std::vector<std::pair<unsigned int, unsigned int>> lcIdAndLayer;
136 lcIdAndLayer.reserve(effective_cluster_idx.size());
137 for (
auto const i : effective_cluster_idx) {
138 auto const &haf =
input.layerClusters[
i].hitsAndFractions();
140 showerMinLayerId =
std::min(layerId, showerMinLayerId);
141 uniqueLayerIds.push_back(layerId);
142 lcIdAndLayer.emplace_back(
i, layerId);
144 std::sort(uniqueLayerIds.begin(), uniqueLayerIds.end());
145 uniqueLayerIds.erase(
std::unique(uniqueLayerIds.begin(), uniqueLayerIds.end()), uniqueLayerIds.end());
146 unsigned int numberOfLayersInTrackster = uniqueLayerIds.size();
148 int numberOfMissingLayers = 0;
149 unsigned int j = showerMinLayerId;
150 unsigned int indexInVec = 0;
151 for (
const auto &
layer : uniqueLayerIds) {
153 numberOfMissingLayers++;
156 numberOfLayersInTrackster = indexInVec;
157 for (
auto &llpair : lcIdAndLayer) {
158 if (llpair.second >=
layer) {
159 effective_cluster_idx.erase(llpair.first);
172 tmp.vertices().reserve(effective_cluster_idx.size());
173 tmp.vertex_multiplicity().resize(effective_cluster_idx.size(), 1);
176 tmp.setSeed(
input.regions[0].collectionID, seedIndices[tracksterId]);
178 std::copy(std::begin(effective_cluster_idx),
std::end(effective_cluster_idx), std::back_inserter(
tmp.vertices()));
179 tmpTracksters.push_back(
tmp);
184 input.layerClustersTime,
195 auto filter_on_pids = [&](
Trackster &
t) ->
bool {
196 auto cumulative_prob = 0.;
198 cumulative_prob +=
t.id_probabilities(
index);
204 std::vector<unsigned int> selectedTrackstersIds;
205 for (
unsigned i = 0;
i < tmpTracksters.size(); ++
i) {
207 selectedTrackstersIds.push_back(
i);
211 result.reserve(selectedTrackstersIds.size());
213 for (
unsigned i = 0;
i < selectedTrackstersIds.size(); ++
i) {
214 const auto &
t = tmpTracksters[selectedTrackstersIds[
i]];
215 for (
auto const lcId :
t.vertices()) {
216 layer_cluster_usage[lcId]++;
218 LogDebug(
"HGCPatternRecoByCA") <<
"LayerID: " << lcId <<
" count: " << (
int)layer_cluster_usage[lcId]
221 if (isRegionalIter) {
222 seedToTracksterAssociation[
t.seedIndex()].push_back(
i);
227 for (
auto &trackster :
result) {
228 assert(trackster.vertices().size() <= trackster.vertex_multiplicity().size());
229 for (
size_t i = 0;
i < trackster.vertices().size(); ++
i) {
230 trackster.vertex_multiplicity()[
i] = layer_cluster_usage[trackster.vertices(
i)];
232 LogDebug(
"HGCPatternRecoByCA") <<
"LayerID: " << trackster.vertices(
i)
233 <<
" count: " << (
int)trackster.vertex_multiplicity(
i) << std::endl;
238 std::vector<Trackster>
tmp;
245 input.layerClustersTime,
258 for (
auto &trackster :
result) {
259 LogDebug(
"HGCPatternRecoByCA") <<
"Trackster characteristics: " << std::endl;
260 LogDebug(
"HGCPatternRecoByCA") <<
"Size: " << trackster.vertices().size() << std::endl;
262 for (
auto const &
p : trackster.id_probabilities()) {
const bool oneTracksterPerTrackSeed_
const std::unique_ptr< HGCGraphT< TILES > > theGraph_
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
const std::vector< double > siblings_maxRSquared_
const double max_longitudinal_sigmaPCA_
constexpr std::array< uint8_t, layerIndexSize > layer
static std::string const input
const int min_clusters_per_ntuplet_
const float etaLimitIncreaseWindow_
void assignPCAtoTracksters(std::vector< Trackster > &, const std::vector< reco::CaloCluster > &, const edm::ValueMap< std::pair< float, float >> &, double, bool energyWeight=true)
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_
bool getData(T &iHolder) const
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)
const float min_cos_theta_
const unsigned int shower_start_max_layer_
const double energy_em_over_total_threshold_
const float root_doublet_max_distance_from_seed_squared_
auto const & foundNtuplets
const bool promoteEmptyRegionToTrackster_