Belle II Software development
FeasibleRLFacetFilter.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/facet/FeasibleRLFacetFilter.h>
9
10#include <tracking/trackingUtilities/eventdata/hits/CDCFacet.h>
11#include <tracking/trackingUtilities/eventdata/hits/CDCRLWireHitTriple.h>
12
13#include <tracking/trackingUtilities/numerics/Modulo.h>
14
15#include <tracking/trackingUtilities/utilities/StringManipulation.h>
16
17#include <framework/core/ModuleParamList.templateDetails.h>
18
19using namespace Belle2;
20using namespace TrackFindingCDC;
21using namespace TrackingUtilities;
22
27
29 const std::string& prefix)
30{
31 Super::exposeParameters(moduleParamList, prefix);
32 moduleParamList->addParameter(prefixed(prefix, "hardRLCut"),
34 "Switch to disallow the boarderline possible hit and "
35 "right left passage information.",
37}
38
40{
41 if (this->isFeasible(facet)) {
42 return 3;
43 } else {
44 return NAN;
45 }
46}
47
48bool FeasibleRLFacetFilter::isFeasible(const CDCRLWireHitTriple& rlWireHitTriple) const
49{
50 const CDCRLWireHitTriple::Shape shape = rlWireHitTriple.getShape();
51 const short oClockDelta = shape.getOClockDelta();
52 const short absOClockDelta = std::abs(oClockDelta);
53 const short cellExtend = shape.getCellExtend();
54
55 if (cellExtend + absOClockDelta > 6) {
56 // funny formula, but basically checks the triple to be a progressing forward and not turning back in itself.
57 return false;
58 }
59
60 const ERightLeft startRLInfo = rlWireHitTriple.getStartRLInfo();
61 const ERightLeft middleRLInfo = rlWireHitTriple.getMiddleRLInfo();
62 const ERightLeft endRLInfo = rlWireHitTriple.getEndRLInfo();
63
64 const short stableTwist = -sign(shape.getOClockDelta()) * middleRLInfo;
65 const bool startToMiddleIsCrossing = startRLInfo != middleRLInfo;
66 const bool middleToEndIsCrossing = middleRLInfo != endRLInfo;
67
68 const bool bothAreCrossing = startToMiddleIsCrossing and middleToEndIsCrossing;
69
70 const bool startToMiddleIsLong = shape.getStartToMiddleCellDistance() > shape.getMiddleToEndCellDistance();
71 const bool shortArmIsCrossing = startToMiddleIsLong ? middleToEndIsCrossing : startToMiddleIsCrossing;
72
73 const bool onlyOneShortArm = isOdd(cellExtend);
74 const bool shortArmsAreCrossing = bothAreCrossing or (onlyOneShortArm and shortArmIsCrossing);
75 const bool noneAreCrossing = not startToMiddleIsCrossing and not middleToEndIsCrossing;
76
77 const bool orthoHard = stableTwist > 0 and shortArmsAreCrossing;
78 const bool ortho = stableTwist > 0 and not noneAreCrossing;
79 const bool meta = stableTwist > 0 or noneAreCrossing;
80 const bool para = not bothAreCrossing;
81
82 // Redundant check saves a bit of computation time.
83 if (oClockDelta == 0) {
84 return para;
85 }
86
87 switch (cellExtend) {
88 case 2:
89 switch (absOClockDelta) {
90 case 0:
91 return para;
92 break;
93
94 case 2:
95 return ortho or (not m_param_hardRLCut and meta);
96 break;
97
98 case 4:
99 return orthoHard or (not m_param_hardRLCut and ortho);
100 break;
101 }
102 break;
103
104 case 3:
105 switch (absOClockDelta) {
106 case 0:
107 return para;
108 break;
109
110 case 1:
111 return meta;
112 break;
113
114 case 2:
115 return orthoHard or (not m_param_hardRLCut and ortho);
116 break;
117
118 case 3:
119 return orthoHard;
120 break;
121 }
122 break;
123
124 case 4:
125 switch (absOClockDelta) {
126 case 0:
127 return para;
128 break;
129
130 case 1:
131 return ortho or (not m_param_hardRLCut and meta);
132 break;
133
134 case 2:
135 return orthoHard;
136 break;
137 }
138 break;
139 }
140 return false;
141}
The Module parameter list class.
FeasibleRLFacetFilter(bool hardRLCut=true)
Constructor taking a flag if borderline feasible cases should be excluded.
bool isFeasible(const TrackingUtilities::CDCRLWireHitTriple &rlWireHitTriple) const
Check if the hit triplet is a feasible combination for shape and rl passage information.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) final
Expose the set of parameters of the filter to the module parameter list.
TrackingUtilities::Weight operator()(const TrackingUtilities::CDCFacet &facet) final
Main filter method returning the weight of the facet.
Class representing a triple of neighboring oriented wire with additional trajectory information.
Definition CDCFacet.h:32
Type for the different shapes of a triple of neighboring wire hits.
short getMiddleToEndCellDistance() const
Getter for the middle to end cell distance.
short getCellExtend() const
Getter for the sum of cell distances from start to middle and middle to end.
short getOClockDelta() const
Getter for the o'clock direction difference from start to middle compared to middle to end.
short getStartToMiddleCellDistance() const
Getter for the start to middle cell distance.
Class representing a triple of neighboring wire hits.
ERightLeft getMiddleRLInfo() const
Getter for the right left passage information of the second oriented wire hit.
ERightLeft getStartRLInfo() const
Getter for the right left passage information of the first oriented wire hit.
ERightLeft getEndRLInfo() const
Getter for the right left passage information of the third oriented wire hit.
Shape getShape() const
Getter for the shape of this triple if all three oriented wire hits are neighbors....
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
void addParameter(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
Abstract base class for different kinds of events.