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