323 const auto &tracksters =
input.tracksters;
327 std::vector<unsigned int> sortedTracksters(tracksters.size());
328 std::iota(sortedTracksters.begin(), sortedTracksters.end(), 0);
329 std::sort(sortedTracksters.begin(), sortedTracksters.end(), [&tracksters](
unsigned int i,
unsigned int j) {
330 return tracksters[
i].raw_energy() > tracksters[
j].raw_energy();
335 std::array<TICLLayerTile, 2> tracksterTile;
338 std::vector<std::array<ticl::Vector, 3>> skeletons(tracksters.size());
339 for (
auto const t_idx : sortedTracksters) {
340 const auto &trackster = tracksters[t_idx];
342 tracksterTile[trackster.barycenter().eta() > 0.f].fill(
343 trackster.barycenter().eta(), trackster.barycenter().phi(), t_idx);
345 std::vector<int> maskReceivedLink(tracksters.size(), 1);
346 std::vector<int> isRootTracksters(tracksters.size(), 1);
348 std::vector<Node> allNodes;
349 for (
size_t it = 0;
it < tracksters.size(); ++
it) {
350 allNodes.emplace_back(
it);
354 for (
auto const &t_idx : sortedTracksters) {
355 auto const &trackster = tracksters[t_idx];
356 auto const &
skeleton = skeletons[t_idx];
358 auto const bary = trackster.barycenter();
362 const auto &tiles = tracksterTile[
tileIndex];
363 std::array<int, 4> search_box = tiles.searchBoxEtaPhi(
eta_min,
eta_max, bary.phi() -
del_, bary.phi() +
del_);
364 if (search_box[2] > search_box[3]) {
368 for (
int eta_i = search_box[0]; eta_i <= search_box[1]; ++eta_i) {
369 for (
int phi_i = search_box[2]; phi_i <= search_box[3]; ++phi_i) {
371 for (
auto n : neighbours) {
374 if (maskReceivedLink[
n] == 0
or allNodes[t_idx].isInnerNeighbour(
n))
377 LogDebug(
"TracksterLinkingbySkeletons")
378 <<
"Trying to Link Trackster " << t_idx <<
" With Trackster " <<
n << std::endl;
380 LogDebug(
"TracksterLinkingbySkeletons")
381 <<
"\t==== LINK: Trackster " << t_idx <<
" Linked with Trackster " <<
n << std::endl;
382 maskReceivedLink[
n] = 0;
383 allNodes[t_idx].addOuterNeighbour(
n);
384 allNodes[
n].addInnerNeighbour(t_idx);
385 isRootTracksters[
n] = 0;
393 LogDebug(
"TracksterLinkingbySkeletons") <<
"**************** FINAL GRAPH **********************" << std::endl;
394 for (
auto const &node : allNodes) {
395 if (isRootTracksters[node.getId()]) {
396 LogDebug(
"TracksterLinkingbySkeletons")
398 <<
" Node " << node.getId() <<
" position " << tracksters[node.getId()].barycenter() <<
" energy " 399 << tracksters[node.getId()].raw_energy() << std::endl;
401 LogDebug(
"TracksterLinkingbySkeletons")
402 <<
"Node " << node.getId() <<
" position " << tracksters[node.getId()].barycenter() <<
" energy " 403 << tracksters[node.getId()].raw_energy() << std::endl;
406 LogDebug(
"TracksterLinkingbySkeletons") <<
"********************************************************" << std::endl;
408 TICLGraph graph(allNodes, isRootTracksters);
411 auto const &
components = graph.findSubComponents();
412 linkedTracksterIdToInputTracksterId.resize(
components.size());
414 LogDebug(
"TracksterLinkingbySkeletons") <<
"Component " << ic <<
" Node: ";
415 std::vector<unsigned int> linkedTracksters;
417 if (
comp.size() == 1) {
418 if (
input.tracksters[
comp[0]].vertices().size() <= 3) {
422 for (
auto const &node :
comp) {
423 LogDebug(
"TracksterLinkingbySkeletons") << node <<
" ";
424 linkedTracksterIdToInputTracksterId[ic].push_back(node);
427 linkedTracksters.push_back(resultTracksters.size());
428 resultTracksters.push_back(outTrackster);
429 linkedResultTracksters.push_back(linkedTracksters);
430 LogDebug(
"TracksterLinkingbySkeletons") <<
"\n";
static constexpr int nPhiBins
static constexpr float maxEta
bool areCompatible(const ticl::Trackster &myTrackster, const ticl::Trackster &otherTrackster, const std::array< ticl::Vector, 3 > &mySkeleton, const std::array< ticl::Vector, 3 > &otherSkeleton)
static std::string const input
int32_t tileIndex(int32_t layer, int32_t ring, int32_t phi)
void mergeTracksters(const Trackster &other)
std::array< ticl::Vector, 3 > findSkeletonNodes(const ticl::Trackster &trackster, float lower_percentage, float upper_percentage, const std::vector< reco::CaloCluster > &layerClusters, const hgcal::RecHitTools &rhtools)
hgcal::RecHitTools rhtools_
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Abs< T >::type abs(const T &t)
static constexpr float minEta
float min_trackster_energy_
unsigned int min_num_lcs_