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 return isFeasible(rlWireHitTriple.getShape(),
51 rlWireHitTriple.getStartRLInfo(),
52 rlWireHitTriple.getMiddleRLInfo(),
53 rlWireHitTriple.getEndRLInfo());
54}
55
57 const ERightLeft startRLInfo,
58 const ERightLeft middleRLInfo,
59 const ERightLeft endRLInfo) const
60{
61 const short oClockDelta = shape.getOClockDelta();
62 const short absOClockDelta = std::abs(oClockDelta);
63 const short cellExtend = shape.getCellExtend();
64
65 if (cellExtend + absOClockDelta > 6) {
66 // funny formula, but basically checks the triple to be a progressing forward and not turning back in itself.
67 return false;
68 }
69
70 const short stableTwist = -sign(shape.getOClockDelta()) * middleRLInfo;
71 const bool startToMiddleIsCrossing = startRLInfo != middleRLInfo;
72 const bool middleToEndIsCrossing = middleRLInfo != endRLInfo;
73
74 const bool bothAreCrossing = startToMiddleIsCrossing and middleToEndIsCrossing;
75
76 const bool startToMiddleIsLong = shape.getStartToMiddleCellDistance() > shape.getMiddleToEndCellDistance();
77 const bool shortArmIsCrossing = startToMiddleIsLong ? middleToEndIsCrossing : startToMiddleIsCrossing;
78
79 const bool onlyOneShortArm = isOdd(cellExtend);
80 const bool shortArmsAreCrossing = bothAreCrossing or (onlyOneShortArm and shortArmIsCrossing);
81 const bool noneAreCrossing = not startToMiddleIsCrossing and not middleToEndIsCrossing;
82
83 const bool orthoHard = stableTwist > 0 and shortArmsAreCrossing;
84 const bool ortho = stableTwist > 0 and not noneAreCrossing;
85 const bool meta = stableTwist > 0 or noneAreCrossing;
86 const bool para = not bothAreCrossing;
87
88 // Redundant check saves a bit of computation time.
89 if (oClockDelta == 0) {
90 return para;
91 }
92
93 switch (cellExtend) {
94 case 2:
95 switch (absOClockDelta) {
96 case 0:
97 return para;
98 break;
99
100 case 2:
101 return ortho or (not m_param_hardRLCut and meta);
102 break;
103
104 case 4:
105 return orthoHard or (not m_param_hardRLCut and ortho);
106 break;
107 }
108 break;
109
110 case 3:
111 switch (absOClockDelta) {
112 case 0:
113 return para;
114 break;
115
116 case 1:
117 return meta;
118 break;
119
120 case 2:
121 return orthoHard or (not m_param_hardRLCut and ortho);
122 break;
123
124 case 3:
125 return orthoHard;
126 break;
127 }
128 break;
129
130 case 4:
131 switch (absOClockDelta) {
132 case 0:
133 return para;
134 break;
135
136 case 1:
137 return ortho or (not m_param_hardRLCut and meta);
138 break;
139
140 case 2:
141 return orthoHard;
142 break;
143 }
144 break;
145 }
146 return false;
147}
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::Shape &shape, TrackingUtilities::ERightLeft startRLInfo, TrackingUtilities::ERightLeft middleRLInfo, TrackingUtilities::ERightLeft endRLInfo) const
Check if the given shape and right left passage information is a feasible combination.
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:33
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.