Belle II Software development
RelationFilter.dcl.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/Filter.dcl.h>
11
12#include <tracking/trackFindingCDC/numerics/Weight.h>
13
14#include <tracking/trackFindingCDC/utilities/Relation.h>
15
16#include <vector>
17
18#include <cmath>
19
20namespace Belle2 {
25 namespace TrackFindingCDC {
26
28 template <class AObject>
29 class RelationFilter : public Filter<Relation<AObject> > {
30
31 public:
34
36 virtual ~RelationFilter();
37
39 virtual std::vector<AObject*> getPossibleTos(AObject* from,
40 const std::vector<AObject*>& objects) const;
41
46 virtual Weight operator()(const AObject& from, const AObject& to);
47
51 virtual std::vector<float> operator()(const std::vector <Relation<AObject>*>& objs) override
52 {
53 std::vector<float> out(objs.size());
54 for (size_t iObj = 0; iObj < objs.size(); iObj += 1) {
55 if (objs[iObj]) {
56 out[iObj] = operator()(*objs[iObj]);
57 } else {
58 out[iObj] = NAN;
59 }
60 }
61 return out;
62 }
63
69 Weight operator()(const Relation<AObject>& relation) override;
70 };
71 }
73}
Base class for filters on a generic object type.
Definition: Filter.dcl.h:31
Base class for filtering the neighborhood of objects.
virtual Weight operator()(const AObject &from, const AObject &to)
Main filter method returning the weight of the neighborhood relation.
virtual std::vector< float > operator()(const std::vector< Relation< AObject > * > &objs) override
Filter over a vector of relations.
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
Abstract base class for different kinds of events.