67 if (
input.regions.empty())
78 LogDebug(
"HGCPatternRecoByCA") <<
"Making Tracksters with CA" << std::endl;
85 bool isRegionalIter = (
input.regions[0].index != -1);
86 std::vector<HGCDoublet::HGCntuplet> foundNtuplets;
87 std::vector<int> seedIndices;
88 std::vector<uint8_t> layer_cluster_usage(
input.layerClusters.size(), 0);
95 input.layerClustersTime,
109 int tracksterId = -1;
112 std::vector<Trackster> tmpTracksters;
113 tmpTracksters.reserve(foundNtuplets.size());
115 for (
auto const &ntuplet : foundNtuplets) {
118 std::set<unsigned int> effective_cluster_idx;
120 for (
auto const &doublet : ntuplet) {
121 auto innerCluster =
doublets[doublet].innerClusterId();
122 auto outerCluster =
doublets[doublet].outerClusterId();
124 effective_cluster_idx.insert(innerCluster);
125 effective_cluster_idx.insert(outerCluster);
128 LogDebug(
"HGCPatternRecoByCA") <<
" New doublet " << doublet <<
" for trackster: " <<
result.size()
129 <<
" InnerCl " << innerCluster <<
" " <<
input.layerClusters[innerCluster].x()
130 <<
" " <<
input.layerClusters[innerCluster].y() <<
" "
131 <<
input.layerClusters[innerCluster].z() <<
" OuterCl " << outerCluster <<
" "
132 <<
input.layerClusters[outerCluster].x() <<
" "
133 <<
input.layerClusters[outerCluster].y() <<
" "
134 <<
input.layerClusters[outerCluster].z() <<
" " << tracksterId << std::endl;
137 unsigned showerMinLayerId = 99999;
138 std::vector<unsigned int> uniqueLayerIds;
139 uniqueLayerIds.reserve(effective_cluster_idx.size());
140 std::vector<std::pair<unsigned int, unsigned int>> lcIdAndLayer;
141 lcIdAndLayer.reserve(effective_cluster_idx.size());
142 for (
auto const i : effective_cluster_idx) {
143 auto const &haf =
input.layerClusters[
i].hitsAndFractions();
145 showerMinLayerId =
std::min(layerId, showerMinLayerId);
146 uniqueLayerIds.push_back(layerId);
147 lcIdAndLayer.emplace_back(
i, layerId);
149 std::sort(uniqueLayerIds.begin(), uniqueLayerIds.end());
150 uniqueLayerIds.erase(
std::unique(uniqueLayerIds.begin(), uniqueLayerIds.end()), uniqueLayerIds.end());
151 unsigned int numberOfLayersInTrackster = uniqueLayerIds.size();
153 int numberOfMissingLayers = 0;
154 unsigned int j = showerMinLayerId;
155 unsigned int indexInVec = 0;
156 for (
const auto &layer : uniqueLayerIds) {
158 numberOfMissingLayers++;
161 numberOfLayersInTrackster = indexInVec;
162 for (
auto &llpair : lcIdAndLayer) {
163 if (llpair.second >= layer) {
164 effective_cluster_idx.erase(llpair.first);
178 tmp.vertices().reserve(effective_cluster_idx.size());
179 tmp.vertex_multiplicity().resize(effective_cluster_idx.size(), 1);
182 tmp.setSeed(
input.regions[0].collectionID, seedIndices[tracksterId]);
184 std::copy(std::begin(effective_cluster_idx),
std::end(effective_cluster_idx), std::back_inserter(
tmp.vertices()));
185 tmpTracksters.push_back(
tmp);
190 input.layerClustersTime,
201 auto filter_on_pids = [&](
Trackster &
t) ->
bool {
202 auto cumulative_prob = 0.;
204 cumulative_prob +=
t.id_probabilities(
index);
210 std::vector<unsigned int> selectedTrackstersIds;
211 for (
unsigned i = 0;
i < tmpTracksters.size(); ++
i) {
213 selectedTrackstersIds.push_back(
i);
217 result.reserve(selectedTrackstersIds.size());
219 for (
unsigned i = 0;
i < selectedTrackstersIds.size(); ++
i) {
220 const auto &
t = tmpTracksters[selectedTrackstersIds[
i]];
221 for (
auto const lcId :
t.vertices()) {
222 layer_cluster_usage[lcId]++;
224 LogDebug(
"HGCPatternRecoByCA") <<
"LayerID: " << lcId <<
" count: " << (
int)layer_cluster_usage[lcId]
227 if (isRegionalIter) {
228 seedToTracksterAssociation[
t.seedIndex()].push_back(
i);
233 for (
auto &trackster :
result) {
234 assert(trackster.vertices().size() <= trackster.vertex_multiplicity().size());
235 for (
size_t i = 0;
i < trackster.vertices().size(); ++
i) {
236 trackster.vertex_multiplicity()[
i] = layer_cluster_usage[trackster.vertices(
i)];
238 LogDebug(
"HGCPatternRecoByCA") <<
"LayerID: " << trackster.vertices(
i)
239 <<
" count: " << (
int)trackster.vertex_multiplicity(
i) << std::endl;
244 std::vector<Trackster>
tmp;
262 for (
auto &trackster :
result) {
263 LogDebug(
"HGCPatternRecoByCA") <<
"Trackster characteristics: " << std::endl;
264 LogDebug(
"HGCPatternRecoByCA") <<
"Size: " << trackster.vertices().size() << std::endl;
266 for (
auto const &
p : trackster.id_probabilities()) {