Belle II Software development
RelationFilter.icc.h
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#pragma once
9
10#include <tracking/trackFindingCDC/filters/base/RelationFilter.dcl.h>
11
12#include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
13
14namespace Belle2 {
19 namespace TrackFindingCDC {
20 template<class AObject>
22
23 template<class AObject>
25
26 template<class AObject>
28 AObject* from __attribute__((unused)),
29 const std::vector<AObject*>& objects) const
30 {
31 return objects;
32 }
33
34 template<class AObject>
35 Weight RelationFilter<AObject>::operator()(const AObject& from __attribute__((unused)),
36 const AObject& to __attribute__((unused)))
37 {
38 return 1;
39 }
40
41 template<class AObject>
43 {
44 const AObject* from = relation.getFrom();
45 const AObject* to = relation.getTo();
47 if (from == to) return NAN; // Prevent relation to same.
48 if ((from == nullptr) or (to == nullptr)) return NAN;
49 return operator()(*from, *to);
50 }
51 }
53}
virtual Weight operator()(const AObject &from, const AObject &to)
Main filter method returning the weight of the neighborhood relation.
virtual ~RelationFilter()
Default destructor.
virtual std::vector< AObject * > getPossibleTos(AObject *from, const std::vector< AObject * > &objects) const
Selects the objects possibly related to the given one from the given pool of objects.
Type for two related objects.
Definition: Relation.h:21
From * getFrom() const
Getter for the pointer to the from side object.
Definition: Relation.h:59
To * getTo() const
Getter for the pointer to the to side object.
Definition: Relation.h:65
Abstract base class for different kinds of events.