Belle II Software  release-08-01-10
SimpleFacetRelationFilter.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/facetRelation/SimpleFacetRelationFilter.h>
9 
10 #include <tracking/trackFindingCDC/eventdata/hits/CDCFacet.h>
11 #include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
12 
13 #include <tracking/trackFindingCDC/utilities/StringManipulation.h>
14 
15 #include <framework/core/ModuleParamList.templateDetails.h>
16 
17 using namespace Belle2;
18 using namespace TrackFindingCDC;
19 
21  : m_param_deviationCosCut(cos(0.4))
22 {
23 }
24 
26  : m_param_deviationCosCut(deviationCosCut)
27 {
28 }
29 
31  const std::string& prefix)
32 {
33  Super::exposeParameters(moduleParamList, prefix);
34  moduleParamList->addParameter(prefixed(prefix, "deviationCosCut"),
36  "Acceptable deviation cosine in the angle of adjacent tangents "
37  "to the drift circles.",
39 }
40 
42  const CDCFacet& toFacet)
43 {
44  if (fromFacet.getStartWireHit().isOnWire(toFacet.getEndWire())) return NAN;
45 
46  // the compatibility of the short legs or all?
47  // start end to continuation middle end
48  // start middle to continuation start end
49 
50  const ParameterLine2D& fromStartToMiddle = fromFacet.getStartToMiddleLine();
51  const ParameterLine2D& fromStartToEnd = fromFacet.getStartToEndLine();
52 
53  const ParameterLine2D& toStartToEnd = toFacet.getStartToEndLine();
54  const ParameterLine2D& toMiddleToEnd = toFacet.getMiddleToEndLine();
55 
56  const double fromMiddleCos = fromStartToMiddle.tangential().cosWith(toStartToEnd.tangential());
57  const double toMiddleCos = fromStartToEnd.tangential().cosWith(toMiddleToEnd.tangential());
58 
59  // check both
60  if (fromMiddleCos > m_param_deviationCosCut and toMiddleCos > m_param_deviationCosCut) {
61  // the weight must be -2 because the overlap of the facets is two points
62  // so the amount of two facets is 4 points hence the cellular automat
63  // must calculate 3 + (-2) + 3 = 4 as cellstate
64  // this can of course be adjusted for a more realistic information measure
65  // ( together with the facet creator filter)
66  return -2;
67  } else {
68  return NAN;
69  }
70 }
The Module parameter list class.
Class representing a triple of neighboring oriented wire with additional trajectory information.
Definition: CDCFacet.h:32
ParameterLine2D getStartToEndLine() const
Getter for the tangential line from the first to the third hit.
Definition: CDCFacet.cc:94
ParameterLine2D getStartToMiddleLine() const
Getter for the tangential line from the first to the second hit.
Definition: CDCFacet.cc:86
ParameterLine2D getMiddleToEndLine() const
Getter for the tangential line from the second to the third hit.
Definition: CDCFacet.cc:102
const CDCWire & getEndWire() const
Getter for the wire the third oriented wire hit is based on.
const CDCWireHit & getStartWireHit() const
Getter for the hit wire of the first oriented wire hit.
bool isOnWire(const CDCWire &wire) const
Checks if the wire hit is based on the given wire.
Definition: CDCWireHit.h:242
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:40
A line with a support point and tangential vector.
const Vector2D & tangential() const
Gives the tangential vector of the line.
SimpleFacetRelationFilter()
Constructor using default direction of flight deviation cut off.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the set of parameters of the filter to the module parameter list.
Weight operator()(const CDCFacet &fromFacet, const CDCFacet &toFacet) final
Main filter method returning the weight of the neighborhood relation.
double m_param_deviationCosCut
Memory for the used direction of flight deviation.
double cosWith(const Vector2D &rhs) const
Definition: Vector2D.h:199
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.