Belle II Software development
SearchDirection.h
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#pragma once
9
10#include <tracking/trackFindingCDC/numerics/EForwardBackward.h>
11#include <framework/logging/Logger.h>
12
13#include <string>
14
15namespace Belle2 {
30 constexpr inline bool arcLengthInRightDirection(double arcLength2D, TrackFindingCDC::EForwardBackward forwardBackward)
31 {
32 return static_cast<double>(forwardBackward) * arcLength2D >= 0;
33 }
34
36 inline TrackFindingCDC::EForwardBackward fromString(const std::string& directionString)
37 {
38 if (directionString == "forward" or directionString == "above" or directionString == "after") {
39 return TrackFindingCDC::EForwardBackward::c_Forward;
40 } else if (directionString == "backward" or directionString == "below" or directionString == "before") {
41 return TrackFindingCDC::EForwardBackward::c_Backward;
42 } else if (directionString == "both" or directionString == "unknown") {
43 return TrackFindingCDC::EForwardBackward::c_Unknown;
44 } else if (directionString == "none" or directionString == "invalid") {
45 return TrackFindingCDC::EForwardBackward::c_Invalid;
46 } else {
47 B2FATAL("Do not understand direction " << directionString << ". Valid names are " <<
48 "forward/above/after, backward/below/before, both/unknown, none/invalid");
49 }
50 }
52}
TrackFindingCDC::EForwardBackward fromString(const std::string &directionString)
Helper function to turn a direction string into a valid forward backward information.
constexpr bool arcLengthInRightDirection(double arcLength2D, TrackFindingCDC::EForwardBackward forwardBackward)
Given the calculated arc length between a start point and an end point, checks if the travelled path ...
EForwardBackward
Enumeration to represent the distinct possibilities of the right left passage information.
Abstract base class for different kinds of events.