Belle II Software development
MCSegmentPairRelationFilter.cc
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#include <tracking/trackFindingCDC/filters/segmentPairRelation/MCSegmentPairRelationFilter.h>
9
10#include <tracking/trackFindingCDC/eventdata/tracks/CDCSegmentPair.h>
11#include <tracking/trackFindingCDC/eventdata/segments/CDCSegment2D.h>
12
13#include <tracking/trackFindingCDC/filters/base/MCSymmetricFilter.icc.h>
14
15using namespace Belle2;
16using namespace TrackFindingCDC;
17
19
21 : Super(allowReverse)
22 , m_mcSegmentPairFilter(allowReverse)
23{
25}
26
28 const std::string& prefix)
29{
30 m_mcSegmentPairFilter.exposeParameters(moduleParamList, prefix);
31}
32
34{
37}
38
40 const CDCSegmentPair& toSegmentPair)
41{
42 Weight mcFromPairWeight = m_mcSegmentPairFilter(fromSegmentPair);
43 Weight mcToPairWeight = m_mcSegmentPairFilter(toSegmentPair);
44
45 ESign fromFBInfo = sign(mcFromPairWeight);
46 ESign toFBInfo = sign(mcToPairWeight);
47
48 if (isValid(fromFBInfo) and isValid(toFBInfo) and fromFBInfo == toFBInfo) {
49 ESign commonFBInfo = fromFBInfo;
50
51 size_t fromOverlapSize = fromSegmentPair.getToSegment()->size();
52 size_t fromSize = fromOverlapSize + fromSegmentPair.getFromSegment()->size();
53 Weight fromWeight = fromSegmentPair.getAutomatonCell().getCellWeight();
54
55 size_t toOverlapSize = toSegmentPair.getFromSegment()->size();
56 size_t toSize = toOverlapSize + toSegmentPair.getToSegment()->size();
57 Weight toWeight = toSegmentPair.getAutomatonCell().getCellWeight();
58 double overlapWeight =
59 (fromWeight * fromOverlapSize / fromSize + toWeight * toOverlapSize / toSize) / 2.0;
60
61 if (commonFBInfo < 0 and Super::getAllowReverse()) {
62 return -std::fabs(overlapWeight);
63 } else if (commonFBInfo > 0) {
64 return std::fabs(overlapWeight);
65 } else {
66 return NAN;
67 }
68 } else {
69 return NAN;
70 }
71}
The Module parameter list class.
Weight getCellWeight() const
Getter for the cell weight.
Class representing a pair of one reconstructed axial segement and one stereo segment in adjacent supe...
const CDCSegment2D * getToSegment() const
Getter for the to segment.
AutomatonCell & getAutomatonCell() const
Mutable getter for the automaton cell.
const CDCSegment2D * getFromSegment() const
Getter for the from segment.
void addProcessingSignalListener(ProcessingSignalListener *psl)
Register a processing signal listener to be notified.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
void setAllowReverse(bool allowReverse) final
Setter for the allow reverse parameter.
void initialize() final
Initialize the before event processing.
Weight operator()(const CDCSegmentPair &fromSegmentPair, const CDCSegmentPair &toSegmentPair) final
Main filter method returning the weight of the neighborhood relation.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the parameters to a module.
MCSegmentPairRelationFilter(bool allowReverse=true)
Constructor setting to default reversal symmetry.
MCSegmentPairFilter m_mcSegmentPairFilter
Instance of the Monte Carlo axial stereo segment filter for rejection of false cells.
Mixin for filters that use Monte Carlo information.
void initialize() override
Initialize the before event processing.
bool getAllowReverse() const
Getter for the allow reverse parameter.
ESign
Enumeration for the distinct sign values of floating point variables.
Definition: ESign.h:27
Abstract base class for different kinds of events.