Belle II Software  release-08-01-10
OnHitApplier.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/vxdHoughTracking/findlets/OnHitApplier.dcl.h>
11 #include <tracking/trackFindingCDC/numerics/WeightComperator.h>
12 #include <tracking/trackFindingCDC/utilities/Algorithms.h>
13 
14 namespace Belle2 {
19  namespace vxdHoughTracking {
20 
21  template <class AHit>
23  std::vector<TrackFindingCDC::WithWeight<AHit*>>& childHits)
24  {
25  if (childHits.empty()) {
26  return;
27  }
28 
29  for (TrackFindingCDC::WithWeight<AHit*>& hitWithWeight : childHits) {
30  AHit& hit = *hitWithWeight;
31  const TrackFindingCDC::Weight& weight = this->operator()({currentPath, &hit});
32  hitWithWeight.setWeight(weight);
33  }
34 
35  TrackFindingCDC::erase_remove_if(childHits, TrackFindingCDC::HasNaNWeight());
36  };
37 
38  template <class AHit>
39  TrackFindingCDC::Weight OnHitApplier<AHit>::operator()(const Object& object __attribute__((unused)))
40  {
41  return NAN;
42  };
43 
44  }
46 }
A mixin class to attach a weight to an object.
Definition: WithWeight.h:24
void apply(const std::vector< TrackFindingCDC::WithWeight< const AHit * >> &currentPath, std::vector< TrackFindingCDC::WithWeight< AHit * >> &childHits) override
Apply the () operator to all pairs of hit and current path.
virtual TrackFindingCDC::Weight operator()(const Object &object)
The filter operator for this class.
std::pair< const std::vector< TrackFindingCDC::WithWeight< const AHit * > >, AHit * > Object
The object this filter refers to.
Abstract base class for different kinds of events.
Functor factory from the functional composition of two functors.
Definition: Functional.h:87