70 if (
input.regions.empty())
80 LogDebug(
"HGCPatternRecoByCA") <<
"Making Tracksters with CA" << std::endl;
87 bool isRegionalIter = (
input.regions[0].index != -1);
89 std::vector<int> seedIndices;
90 std::vector<uint8_t> layer_cluster_usage(
input.layerClusters.size(), 0);
97 input.layerClustersTime,
111 int tracksterId = -1;
114 std::vector<Trackster> tmpTracksters;
120 std::set<unsigned int> effective_cluster_idx;
122 for (
auto const &doublet :
ntuplet) {
123 auto innerCluster =
doublets[doublet].innerClusterId();
124 auto outerCluster =
doublets[doublet].outerClusterId();
126 effective_cluster_idx.insert(innerCluster);
127 effective_cluster_idx.insert(outerCluster);
130 LogDebug(
"HGCPatternRecoByCA") <<
" New doublet " << doublet <<
" for trackster: " <<
result.size()
131 <<
" InnerCl " << innerCluster <<
" " <<
input.layerClusters[innerCluster].x()
132 <<
" " <<
input.layerClusters[innerCluster].y() <<
" "
133 <<
input.layerClusters[innerCluster].z() <<
" OuterCl " << outerCluster <<
" "
134 <<
input.layerClusters[outerCluster].x() <<
" "
135 <<
input.layerClusters[outerCluster].y() <<
" "
136 <<
input.layerClusters[outerCluster].z() <<
" " << tracksterId << std::endl;
139 unsigned showerMinLayerId = 99999;
140 std::vector<unsigned int> uniqueLayerIds;
141 uniqueLayerIds.reserve(effective_cluster_idx.size());
142 std::vector<std::pair<unsigned int, unsigned int>> lcIdAndLayer;
143 lcIdAndLayer.reserve(effective_cluster_idx.size());
144 for (
auto const i : effective_cluster_idx) {
145 auto const &haf =
input.layerClusters[
i].hitsAndFractions();
147 showerMinLayerId =
std::min(layerId, showerMinLayerId);
148 uniqueLayerIds.push_back(layerId);
149 lcIdAndLayer.emplace_back(
i, layerId);
151 std::sort(uniqueLayerIds.begin(), uniqueLayerIds.end());
152 uniqueLayerIds.erase(
std::unique(uniqueLayerIds.begin(), uniqueLayerIds.end()), uniqueLayerIds.end());
153 unsigned int numberOfLayersInTrackster = uniqueLayerIds.size();
155 int numberOfMissingLayers = 0;
156 unsigned int j = showerMinLayerId;
157 unsigned int indexInVec = 0;
158 for (
const auto &
layer : uniqueLayerIds) {
160 numberOfMissingLayers++;
163 numberOfLayersInTrackster = indexInVec;
164 for (
auto &llpair : lcIdAndLayer) {
165 if (llpair.second >=
layer) {
166 effective_cluster_idx.erase(llpair.first);
180 tmp.vertices().reserve(effective_cluster_idx.size());
181 tmp.vertex_multiplicity().resize(effective_cluster_idx.size(), 1);
184 tmp.setSeed(
input.regions[0].collectionID, seedIndices[tracksterId]);
186 std::copy(std::begin(effective_cluster_idx),
std::end(effective_cluster_idx), std::back_inserter(
tmp.vertices()));
187 tmpTracksters.push_back(
tmp);
192 input.layerClustersTime,
203 auto filter_on_pids = [&](
Trackster &
t) ->
bool {
204 auto cumulative_prob = 0.;
206 cumulative_prob +=
t.id_probabilities(
index);
212 std::vector<unsigned int> selectedTrackstersIds;
213 for (
unsigned i = 0;
i < tmpTracksters.size(); ++
i) {
215 selectedTrackstersIds.push_back(
i);
219 result.reserve(selectedTrackstersIds.size());
221 for (
unsigned i = 0;
i < selectedTrackstersIds.size(); ++
i) {
222 const auto &
t = tmpTracksters[selectedTrackstersIds[
i]];
223 for (
auto const lcId :
t.vertices()) {
224 layer_cluster_usage[lcId]++;
226 LogDebug(
"HGCPatternRecoByCA") <<
"LayerID: " << lcId <<
" count: " << (
int)layer_cluster_usage[lcId]
229 if (isRegionalIter) {
230 seedToTracksterAssociation[
t.seedIndex()].push_back(
i);
235 for (
auto &trackster :
result) {
236 assert(trackster.vertices().size() <= trackster.vertex_multiplicity().size());
237 for (
size_t i = 0;
i < trackster.vertices().size(); ++
i) {
238 trackster.vertex_multiplicity()[
i] = layer_cluster_usage[trackster.vertices(
i)];
240 LogDebug(
"HGCPatternRecoByCA") <<
"LayerID: " << trackster.vertices(
i)
241 <<
" count: " << (
int)trackster.vertex_multiplicity(
i) << std::endl;
246 std::vector<Trackster>
tmp;
253 input.layerClustersTime,
266 for (
auto &trackster :
result) {
267 LogDebug(
"HGCPatternRecoByCA") <<
"Trackster characteristics: " << std::endl;
268 LogDebug(
"HGCPatternRecoByCA") <<
"Size: " << trackster.vertices().size() << std::endl;
270 for (
auto const &
p : trackster.id_probabilities()) {