Belle II Software  release-05-02-19
RelationFilter.icc.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Oliver Frost *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/filters/base/RelationFilter.dcl.h>
13 
14 #include <tracking/trackFindingCDC/filters/base/Filter.icc.h>
15 
16 namespace Belle2 {
21  namespace TrackFindingCDC {
22  template<class AObject>
24 
25  template<class AObject>
27 
28  template<class AObject>
29  std::vector<AObject*> RelationFilter<AObject>::getPossibleTos(
30  AObject* from __attribute__((unused)),
31  const std::vector<AObject*>& objects) const
32  {
33  return objects;
34  }
35 
36  template<class AObject>
37  Weight RelationFilter<AObject>::operator()(const AObject& from __attribute__((unused)),
38  const AObject& to __attribute__((unused)))
39  {
40  return 1;
41  }
42 
43  template<class AObject>
45  {
46  const AObject* from = relation.getFrom();
47  const AObject* to = relation.getTo();
48 
49  if (from == to) return NAN; // Prevent relation to same.
50  if ((from == nullptr) or (to == nullptr)) return NAN;
51  return operator()(*from, *to);
52  }
53  }
55 }
Belle2::TrackFindingCDC::Relation::getFrom
From * getFrom() const
Getter for the pointer to the from side object.
Definition: Relation.h:69
Belle2::TrackFindingCDC::Relation
Type for two related objects.
Definition: CDCSegment2D.h:37
Belle2::TrackFindingCDC::RelationFilter::operator()
virtual Weight operator()(const AObject &from, const AObject &to)
Main filter method returning the weight of the neighborhood relation.
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::RelationFilter::getPossibleTos
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.
Definition: RelationFilter.icc.h:37
Belle2::TrackFindingCDC::RelationFilter::~RelationFilter
virtual ~RelationFilter()
Default destructor.
Belle2::TrackFindingCDC::Relation::getTo
To * getTo() const
Getter for the pointer to the to side object.
Definition: Relation.h:75
Belle2::TrackFindingCDC::RelationFilter::RelationFilter
RelationFilter()
Default constructor.