Belle II Software  release-08-01-10
BasicFacetRelationVarSet.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/BasicFacetRelationVarSet.h>
9 
10 #include <tracking/trackFindingCDC/eventdata/hits/CDCFacet.h>
11 #include <tracking/trackFindingCDC/geometry/ParameterLine2D.h>
12 
13 using namespace Belle2;
14 using namespace TrackFindingCDC;
15 
17 {
18  if (not ptrFacetRelation) return false;
19 
20  const CDCFacet* ptrFromFacet(ptrFacetRelation->getFrom());
21  const CDCFacet* ptrToFacet(ptrFacetRelation->getTo());
22 
23  const CDCFacet& fromFacet = *ptrFromFacet;
24  const CDCFacet& toFacet = *ptrToFacet;
25 
26  const ParameterLine2D& fromStartToMiddle = fromFacet.getStartToMiddleLine();
27  const ParameterLine2D& fromStartToEnd = fromFacet.getStartToEndLine();
28 
29  const ParameterLine2D& toStartToEnd = toFacet.getStartToEndLine();
30  const ParameterLine2D& toMiddleToEnd = toFacet.getMiddleToEndLine();
31 
32  const double fromMiddleCos = fromStartToMiddle.tangential().cosWith(toStartToEnd.tangential());
33  const double toMiddleCos = fromStartToEnd.tangential().cosWith(toMiddleToEnd.tangential());
34 
35  const double fromMiddlePhi = acos(fromMiddleCos);
36  const double toMiddlePhi = acos(toMiddleCos);
37 
38  var<named("superlayer_id")>() = fromFacet.getISuperLayer();
39  var<named("from_middle_phi")>() = fromMiddlePhi;
40  var<named("to_middle_phi")>() = toMiddlePhi;
41 
42  return true;
43 }
bool extract(const Relation< const CDCFacet > *ptrFacetRelation) final
Generate and assign the contained variables.
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
ISuperLayer getISuperLayer() const
Getter for the common superlayer id of the pair.
A line with a support point and tangential vector.
const Vector2D & tangential() const
Gives the tangential vector of the line.
Type for two related objects.
Definition: Relation.h:21
To * getTo() const
Getter for the pointer to the to side object.
Definition: Relation.h:65
From * getFrom() const
Getter for the pointer to the from side object.
Definition: Relation.h:59
constexpr static int named(const char *name)
Getter for the index from the name.
Definition: VarSet.h:78
Float_t & var()
Reference getter for the value of the ith variable. Static version.
Definition: VarSet.h:93
double cosWith(const Vector2D &rhs) const
Definition: Vector2D.h:199
Abstract base class for different kinds of events.