Belle II Software  release-05-01-25
SearchDirection.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2017 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Nils Braun *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 #include <tracking/trackFindingCDC/numerics/EForwardBackward.h>
13 #include <framework/logging/Logger.h>
14 
15 #include <string>
16 
17 namespace Belle2 {
32  constexpr inline bool arcLengthInRightDirection(double arcLength2D, TrackFindingCDC::EForwardBackward forwardBackward)
33  {
34  return forwardBackward * arcLength2D >= 0;
35  }
36 
38  inline TrackFindingCDC::EForwardBackward fromString(const std::string& directionString)
39  {
40  if (directionString == "forward" or directionString == "above" or directionString == "after") {
41  return TrackFindingCDC::EForwardBackward::c_Forward;
42  } else if (directionString == "backward" or directionString == "below" or directionString == "before") {
43  return TrackFindingCDC::EForwardBackward::c_Backward;
44  } else if (directionString == "both" or directionString == "unknown") {
45  return TrackFindingCDC::EForwardBackward::c_Unknown;
46  } else if (directionString == "none" or directionString == "invalid") {
47  return TrackFindingCDC::EForwardBackward::c_Invalid;
48  } else {
49  B2FATAL("Do not understand direction " << directionString << ". Valid names are " <<
50  "forward/above/after, backward/below/before, both/unknown, none/invalid");
51  }
52  }
54 }
Belle2::fromString
TrackFindingCDC::EForwardBackward fromString(const std::string &directionString)
Helper function to turn a direction string into a valid forward backward information.
Definition: SearchDirection.h:46
Belle2::arcLengthInRightDirection
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 ...
Definition: SearchDirection.h:40
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19