Belle II Software  release-05-02-19
AnalyzingAlgorithmFactory.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2015 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Jakob Lettenbichler *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #pragma once
11 
12 // fw:
13 #include <framework/logging/Logger.h>
14 
15 // tracking:
16 #include<tracking/trackFindingVXD/analyzingTools/AlgoritmType.h>
17 #include <tracking/trackFindingVXD/analyzingTools/algorithms/AnalyzingAlgorithmBase.h>
18 #include <tracking/trackFindingVXD/analyzingTools/algorithms/AnalyzingAlgorithmResiduals.h>
19 #include <tracking/trackFindingVXD/analyzingTools/algorithms/AnalyzingAlgorithmValues.h>
20 #include <tracking/trackFindingVXD/analyzingTools/algorithms/AnalyzingAlgorithmClusterBased.h>
21 
22 
23 
24 namespace Belle2 {
35  template <class DataType, class TCInfoType, class VectorType>
36  AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>* AnalyzingAlgorithmFactoryDouble(AlgoritmType::Type algorithmID)
37  {
39  if (algorithmID == AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>())
40  { return new AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>(); }
41 
42  if (algorithmID == AnalyzingAlgorithmResidualPX<DataType, TCInfoType, VectorType>())
43  { return new AnalyzingAlgorithmResidualPX<DataType, TCInfoType, VectorType>(); }
44 
47 
48  if (algorithmID == AnalyzingAlgorithmResidualPZ<DataType, TCInfoType, VectorType>())
49  { return new AnalyzingAlgorithmResidualPZ<DataType, TCInfoType, VectorType>(); }
50 
51  if (algorithmID == AnalyzingAlgorithmResidualPT<DataType, TCInfoType, VectorType>())
52  { return new AnalyzingAlgorithmResidualPT<DataType, TCInfoType, VectorType>(); }
53 
54  if (algorithmID == AnalyzingAlgorithmResidualP<DataType, TCInfoType, VectorType>())
55  { return new AnalyzingAlgorithmResidualP<DataType, TCInfoType, VectorType>(); }
56 
57  if (algorithmID == AnalyzingAlgorithmResidualPTheta<DataType, TCInfoType, VectorType>())
58  { return new AnalyzingAlgorithmResidualPTheta<DataType, TCInfoType, VectorType>(); }
59 
60  if (algorithmID == AnalyzingAlgorithmResidualPPhi<DataType, TCInfoType, VectorType>())
61  { return new AnalyzingAlgorithmResidualPPhi<DataType, TCInfoType, VectorType>(); }
62 
63  if (algorithmID == AnalyzingAlgorithmResidualPAngle<DataType, TCInfoType, VectorType>())
64  { return new AnalyzingAlgorithmResidualPAngle<DataType, TCInfoType, VectorType>(); }
65 
66  if (algorithmID == AnalyzingAlgorithmResidualPTAngle<DataType, TCInfoType, VectorType>())
67  { return new AnalyzingAlgorithmResidualPTAngle<DataType, TCInfoType, VectorType>(); }
68 
69  if (algorithmID == AnalyzingAlgorithmResidualPosition<DataType, TCInfoType, VectorType>())
70  { return new AnalyzingAlgorithmResidualPosition<DataType, TCInfoType, VectorType>(); }
71 
72  if (algorithmID == AnalyzingAlgorithmResidualPositionXY<DataType, TCInfoType, VectorType>())
73  { return new AnalyzingAlgorithmResidualPositionXY<DataType, TCInfoType, VectorType>(); }
74 
75 
77  if (algorithmID == AnalyzingAlgorithmValuePX<DataType, TCInfoType, VectorType>())
78  { return new AnalyzingAlgorithmValuePX<DataType, TCInfoType, VectorType>(); }
79 
80  if (algorithmID == AnalyzingAlgorithmValuePY<DataType, TCInfoType, VectorType>())
81  { return new AnalyzingAlgorithmValuePY<DataType, TCInfoType, VectorType>(); }
82 
83  if (algorithmID == AnalyzingAlgorithmValuePZ<DataType, TCInfoType, VectorType>())
84  { return new AnalyzingAlgorithmValuePZ<DataType, TCInfoType, VectorType>(); }
85 
86  if (algorithmID == AnalyzingAlgorithmValuePT<DataType, TCInfoType, VectorType>())
87  { return new AnalyzingAlgorithmValuePT<DataType, TCInfoType, VectorType>(); }
88 
89  if (algorithmID == AnalyzingAlgorithmValueP<DataType, TCInfoType, VectorType>())
90  { return new AnalyzingAlgorithmValueP<DataType, TCInfoType, VectorType>(); }
91 
92  if (algorithmID == AnalyzingAlgorithmValuePTheta<DataType, TCInfoType, VectorType>())
93  { return new AnalyzingAlgorithmValuePTheta<DataType, TCInfoType, VectorType>(); }
94 
95  if (algorithmID == AnalyzingAlgorithmValuePPhi<DataType, TCInfoType, VectorType>())
96  { return new AnalyzingAlgorithmValuePPhi<DataType, TCInfoType, VectorType>(); }
97 
98  if (algorithmID == AnalyzingAlgorithmValueDistSeed2IP<DataType, TCInfoType, VectorType>())
99  { return new AnalyzingAlgorithmValueDistSeed2IP<DataType, TCInfoType, VectorType>(); }
100 
101  if (algorithmID == AnalyzingAlgorithmValueDistSeed2IPXY<DataType, TCInfoType, VectorType>())
102  { return new AnalyzingAlgorithmValueDistSeed2IPXY<DataType, TCInfoType, VectorType>(); }
103 
104  if (algorithmID == AnalyzingAlgorithmValueDistSeed2IPZ<DataType, TCInfoType, VectorType>())
105  { return new AnalyzingAlgorithmValueDistSeed2IPZ<DataType, TCInfoType, VectorType>(); }
106 
107  if (algorithmID == AnalyzingAlgorithmValueQI<DataType, TCInfoType, VectorType>())
108  { return new AnalyzingAlgorithmValueQI<DataType, TCInfoType, VectorType>(); }
109 
110  if (!AlgoritmType::isValueDoubleType(algorithmID)
111  and !AlgoritmType::isResidualDoubleType(algorithmID)
112  and (AlgoritmType::isHitValueVecDoubleType(algorithmID)
113  or AlgoritmType::isHitValueIntType(algorithmID))) {
114  B2WARNING(" AnalyzingAlgorithmFactoryDouble: given algorithmID " << AlgoritmType::getTypeName(algorithmID) <<
115  " is no algorithm of double type but of another (valid) category. Please use the correct factory for your purpose. Returning non-functioning base-class instead!");
116  } else {
117  B2ERROR(" AnalyzingAlgorithmFactoryDouble: given algorithmID " << AlgoritmType::getTypeName(algorithmID) <<
118  " is not known, returning non-functioning base-class instead!");
119  }
120 
121  return new AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>();
122  }
123 
124 
125 
130  template <class DataType, class TCInfoType, class VectorType>
131  AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>* AnalyzingAlgorithmFactoryInt(AlgoritmType::Type algorithmID)
132  {
134  if (algorithmID == AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>())
135  { return new AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>(); }
136 
137  if (algorithmID == AnalyzingAlgorithmLostUClusters<DataType, TCInfoType, VectorType>())
138  { return new AnalyzingAlgorithmLostUClusters<DataType, TCInfoType, VectorType>(); }
139 
142 
143  if (algorithmID == AnalyzingAlgorithmTotalUClusters<DataType, TCInfoType, VectorType>())
144  { return new AnalyzingAlgorithmTotalUClusters<DataType, TCInfoType, VectorType>(); }
145 
146  if (algorithmID == AnalyzingAlgorithmTotalVClusters<DataType, TCInfoType, VectorType>())
147  { return new AnalyzingAlgorithmTotalVClusters<DataType, TCInfoType, VectorType>(); }
148 
149  if (!AlgoritmType::isHitValueIntType(algorithmID)
150  and (AlgoritmType::isValueDoubleType(algorithmID)
151  or AlgoritmType::isResidualDoubleType(algorithmID)
152  or AlgoritmType::isHitValueVecDoubleType(algorithmID))) {
153  B2WARNING(" AnalyzingAlgorithmInt: given algorithmID " << AlgoritmType::getTypeName(algorithmID) <<
154  " is no algorithm of int type but of another (valid) category. Please use the correct factory for your purpose. Returning non-functioning base-class instead!");
155  } else {
156  B2ERROR(" AnalyzingAlgorithmInt: given algorithmID " << AlgoritmType::getTypeName(algorithmID) <<
157  " is not known, returning non-functioning base-class instead!");
158  }
159 
160  return new AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>();
161  }
162 
163 
164 
169  template <class DataType, class TCInfoType, class VectorType>
170  AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>* AnalyzingAlgorithmFactoryVecDouble(AlgoritmType::Type algorithmID)
171  {
173  if (algorithmID == AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>())
174  { return new AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>(); }
175 
176  if (algorithmID == AnalyzingAlgorithmLostUEDep<DataType, TCInfoType, VectorType>())
177  { return new AnalyzingAlgorithmLostUEDep<DataType, TCInfoType, VectorType>(); }
178 
181 
182  if (algorithmID == AnalyzingAlgorithmTotalUEDep<DataType, TCInfoType, VectorType>())
183  { return new AnalyzingAlgorithmTotalUEDep<DataType, TCInfoType, VectorType>(); }
184 
185  if (algorithmID == AnalyzingAlgorithmTotalVEDep<DataType, TCInfoType, VectorType>())
186  { return new AnalyzingAlgorithmTotalVEDep<DataType, TCInfoType, VectorType>(); }
187 
188 
189  if (!AlgoritmType::isHitValueVecDoubleType(algorithmID)
190  and (AlgoritmType::isValueDoubleType(algorithmID)
191  or AlgoritmType::isResidualDoubleType(algorithmID)
192  or AlgoritmType::isHitValueIntType(algorithmID))) {
193  B2WARNING(" AnalyzingAlgorithmVecDouble: given algorithmID " << AlgoritmType::getTypeName(algorithmID) <<
194  " is no algorithm of vector<double> type but of another (valid) category. Please use the correct factory for your purpose. Returning non-functioning base-class instead!");
195  } else {
196  B2ERROR(" AnalyzingAlgorithmVecDouble: given algorithmID " << AlgoritmType::getTypeName(algorithmID) <<
197  " is not known, returning non-functioning base-class instead!");
198  }
199 
200  return new AnalyzingAlgorithmBase<DataType, TCInfoType, VectorType>();
201  }
202 
204 }
Belle2::AnalyzingAlgorithmLostVEDep
Class for storing an algorithm to find out the energy deposit of v-type-clusters the testTC lost comp...
Definition: AnalyzingAlgorithmClusterBased.h:162
Belle2::AnalyzingAlgorithmFactoryDouble
AnalyzingAlgorithmBase< DataType, TCInfoType, VectorType > * AnalyzingAlgorithmFactoryDouble(AlgoritmType::Type algorithmID)
the analyzingAlgorithm factory for algorithms returning one double for each TC passed:
Definition: AnalyzingAlgorithmFactory.h:44
Belle2::AlgoritmType::isValueDoubleType
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...
Definition: AlgoritmType.h:120
Belle2::AlgoritmType::getTypeName
static std::string getTypeName(AlgoritmType::Type type)
for given AlgoritmType the corresponding string-name will be returned.
Definition: AlgoritmType.h:96
Belle2::AnalyzingAlgorithmResidualPY
Class for storing an algorithm determining the residual (ref-test) of momentum in Y.
Definition: AnalyzingAlgorithmResiduals.h:55
Belle2::AnalyzingAlgorithmFactoryVecDouble
AnalyzingAlgorithmBase< DataType, TCInfoType, VectorType > * AnalyzingAlgorithmFactoryVecDouble(AlgoritmType::Type algorithmID)
the analyzingAlgorithm factory for algorithms returning one vector< double> for each TC passed:
Definition: AnalyzingAlgorithmFactory.h:178
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::AlgoritmType::isHitValueVecDoubleType
static bool isHitValueVecDoubleType(AlgoritmType::Type aType)
returns true if given AlgoritmType is a an algorithm which calculates a value in vector< double> base...
Definition: AlgoritmType.h:132
Belle2::AlgoritmType::isResidualDoubleType
static bool isResidualDoubleType(AlgoritmType::Type aType)
returns true if given AlgoritmType is a an algorithm which calculates a residual in double for each T...
Definition: AlgoritmType.h:124
Belle2::AnalyzingAlgorithmFactoryInt
AnalyzingAlgorithmBase< DataType, TCInfoType, VectorType > * AnalyzingAlgorithmFactoryInt(AlgoritmType::Type algorithmID)
the analyzingAlgorithm factory for algorithms returning one int for each TC passed:
Definition: AnalyzingAlgorithmFactory.h:139
Belle2::AnalyzingAlgorithmLostVClusters
Class for storing an algorithm to find out how many v-type-clusters the testTC lost compared to the r...
Definition: AnalyzingAlgorithmClusterBased.h:114
Belle2::AlgoritmType::isHitValueIntType
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...
Definition: AlgoritmType.h:128
Belle2::AlgoritmType::Type
Type
allows classifying Analyzing algorithms
Definition: AlgoritmType.h:39