Belle II Software development
AlgoritmType.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// framework:
11#include <framework/logging/Logger.h>
12
13// stl:
14#include <string>
15#include <map>
16
17
18
19namespace Belle2 {
26 public:
27
29 enum Type {
30 UnknownType, // defines unknown types
35 AnalyzingAlgorithmValuePY,
36 AnalyzingAlgorithmValuePZ,
37 AnalyzingAlgorithmValuePT,
38 AnalyzingAlgorithmValueP,
39 AnalyzingAlgorithmValuePTheta,
40 AnalyzingAlgorithmValuePPhi,
41 AnalyzingAlgorithmValueDistSeed2IP,
42 AnalyzingAlgorithmValueDistSeed2IPZ,
43 AnalyzingAlgorithmValueDistSeed2IPXY,
44 AnalyzingAlgorithmValueQI,
47 AnalyzingAlgorithmResidualPY,
48 AnalyzingAlgorithmResidualPZ,
49 AnalyzingAlgorithmResidualPT,
50 AnalyzingAlgorithmResidualP,
51 AnalyzingAlgorithmResidualPTheta,
52 AnalyzingAlgorithmResidualPPhi,
53 AnalyzingAlgorithmResidualPAngle,
54 AnalyzingAlgorithmResidualPTAngle,
55 AnalyzingAlgorithmResidualPosition,
56 AnalyzingAlgorithmResidualPositionXY,
59 AnalyzingAlgorithmLostVClusters,
60 AnalyzingAlgorithmTotalUClusters,
61 AnalyzingAlgorithmTotalVClusters,
64 AnalyzingAlgorithmLostVEDep,
65 AnalyzingAlgorithmTotalUEDep,
66 AnalyzingAlgorithmTotalVEDep,
67 NTypes // number of analyzingAlgorithmTypes available
68 };
69
70
73 {
74 return ((AlgoritmType::s_fromTypeToString.find(type) == AlgoritmType::s_fromTypeToString.end()) ? false : true);
75 }
76
77
79 static bool isValidName(std::string type)
80 {
81 return ((AlgoritmType::s_fromStringToType.find(type) == AlgoritmType::s_fromStringToType.end()) ? false : true);
82 }
83
84
86 static std::string getTypeName(AlgoritmType::Type type)
87 {
88 auto pos = AlgoritmType::s_fromTypeToString.find(type);
89 if (pos == AlgoritmType::s_fromTypeToString.end()) {
90 B2ERROR("AlgoritmType::getTypeName(): given iD " << type << " is not a valid AlgoritmType, return AlgoritmType::UnknownType!");
91 return AlgoritmType::s_fromTypeToString[UnknownType];
92 }
93 return pos->second;
94 }
95
96
98 static AlgoritmType::Type getTypeEnum(std::string type)
99 {
100 auto pos = AlgoritmType::s_fromStringToType.find(type);
101 if (pos == AlgoritmType::s_fromStringToType.end()) {
102 B2ERROR("AlgoritmType::getTypeName(): given iD " << type << " is not a valid AlgoritmType, return AlgoritmType::UnknownType!");
103 return AlgoritmType::s_fromStringToType[std::string("UnknownType")];
104 }
105 return pos->second;
106 }
107
108
111 { return aType < AlgoritmType::AnalyzingAlgorithmResidualPX and aType > AlgoritmType::AnalyzingAlgorithmBase; }
112
115 { return aType < AlgoritmType::AnalyzingAlgorithmLostUClusters and aType > AlgoritmType::AnalyzingAlgorithmValueQI; }
116
119 { return aType > AlgoritmType::AnalyzingAlgorithmResidualPositionXY and aType < AlgoritmType::AnalyzingAlgorithmLostUEDep; }
120
123 { return aType > AlgoritmType::AnalyzingAlgorithmTotalVClusters and aType < AlgoritmType::NTypes; }
124
125 protected:
127 static std::map<Type, std::string> s_fromTypeToString;
128
130 static std::map<std::string, Type> s_fromStringToType;
131 };
132
133
134
136
137}
Small class for classifying types of analyzing algorithms.
static std::map< std::string, Type > s_fromStringToType
static map allowing translation from a given name stored as a string to its type
static bool isValidName(std::string type)
checks if the name given is a valid name for an AlgoritmType
static bool isHitValueIntType(AlgoritmType::Type aType)
returns true if given AlgoritmType is a an algorithm which calculates a value in int based on hits of...
Type
allows classifying Analyzing algorithms
@ AnalyzingAlgorithmResidualPX
residual type, stores double. defined in ..tracking/trackFindingVXD/analyzingTools/algorithms/Analyzi...
@ AnalyzingAlgorithmBase
base type, template for all the other analyzing algorithms, contains essential functions for all algo...
@ AnalyzingAlgorithmLostUEDep
value type hit (with access to clusters via relations), stores vector< double >. defined in ....
@ AnalyzingAlgorithmLostUClusters
value type hit (with access to clusters via relations), stores int. defined in ..tracking/trackFindin...
@ AnalyzingAlgorithmValuePX
value type, stores double. defined in ..tracking/trackFindingVXD/analyzingTools/algorithms/AnalyzingA...
static bool isValueDoubleType(AlgoritmType::Type aType)
returns true if given AlgoritmType is a an algorithm which calculates a value in double for each TC p...
static bool isResidualDoubleType(AlgoritmType::Type aType)
returns true if given AlgoritmType is a an algorithm which calculates a residual in double for each T...
static std::map< Type, std::string > s_fromTypeToString
static map allowing translation from a given type to its name stored as a string
static bool isHitValueVecDoubleType(AlgoritmType::Type aType)
returns true if given AlgoritmType is a an algorithm which calculates a value in vector< double> base...
static std::string getTypeName(AlgoritmType::Type type)
for given AlgoritmType the corresponding string-name will be returned.
static AlgoritmType::Type getTypeEnum(std::string type)
for given string name of a AlgoritmType the corresponding AlgoritmType will be returned.
static bool isValidType(AlgoritmType::Type type)
checks if a type given is a valid type for an AlgoritmType
Abstract base class for different kinds of events.