10#include <tracking/trackFindingCDC/utilities/WeightedRelation.h>
11#include <tracking/trackFindingCDC/utilities/Relation.h>
12#include <tracking/trackFindingCDC/numerics/Weight.h>
14#include <framework/datastore/StoreObjPtr.h>
15#include <mdst/dataobjects/EventLevelTrackingInfo.h>
17#include <tracking/ckf/pxd/entities/CKFToPXDState.h>
18#include <tracking/ckf/svd/entities/CKFToSVDState.h>
20#include <tracking/vxdHoughTracking/entities/VXDHoughState.h>
22#include <framework/logging/Logger.h>
33 namespace TrackFindingCDC {
62 template <
class AObject,
class ARelationFilter>
64 const std::vector<AObject*>& froms,
65 const std::vector<AObject*>& tos,
67 unsigned int maximumNumberOfRelations = std::numeric_limits<unsigned int>::max())
69 for (AObject* from : froms) {
72 std::vector<AObject*> possibleTos = relationFilter.getPossibleTos(from, tos);
74 for (AObject* to : possibleTos) {
75 if (from == to)
continue;
77 Weight weight = relationFilter(relation);
78 if (std::isnan(weight))
continue;
79 weightedRelations.emplace_back(from, weight, to);
81 if (weightedRelations.size() == maximumNumberOfRelations) {
82 B2WARNING(
"Relations Creator reached maximal number of items: skipping the event.");
83 if (m_eventLevelTrackingInfo.
isValid()) {
84 if (std::is_base_of<AObject, CKFToPXDState>::value) {
85 m_eventLevelTrackingInfo->setPXDCKFAbortionFlag();
86 }
else if (std::is_base_of<AObject, CKFToSVDState>::value) {
87 m_eventLevelTrackingInfo->setSVDCKFAbortionFlag();
88 }
else if (std::is_base_of<AObject, vxdHoughTracking::VXDHoughState>::value) {
89 B2INFO(
"Skipping processing VXDHoughTracking track candidate, not setting AbortionFlag.");
91 B2WARNING(
"Undefined class used for CKFStates. Could not set AbortionFlag.");
95 weightedRelations.clear();
101 std::sort(std::begin(weightedRelations), std::end(weightedRelations));
106 template <
class AObject,
class ARelationFilter>
108 const std::vector<AObject*>& objects,
111 appendUsing(relationFilter, objects, objects, weightedRelations);
Type-safe access to single objects in the data store.
bool isValid() const
Check whether the object was created.
Type for two related objects.
Type for two related objects with a weight.
Abstract base class for different kinds of events.
name Structured creation of neighborhoods
static void appendUsing(ARelationFilter &relationFilter, const std::vector< AObject * > &froms, const std::vector< AObject * > &tos, std::vector< WeightedRelation< AObject > > &weightedRelations, unsigned int maximumNumberOfRelations=std::numeric_limits< unsigned int >::max())
Appends relations between elements in the given AItems using the ARelationFilter.
static void appendUsing(ARelationFilter &relationFilter, const std::vector< AObject * > &objects, std::vector< WeightedRelation< AObject > > &weightedRelations)
Shortcut for applying appendUsing with froms=tos.