8#include <tracking/trackFindingVXD/analyzingTools/RootParameterTracker.h>
19 if (foundTCTypeData ==
nullptr) {
return; }
22 for (
auto& entry : *foundTCTypeData) {
24 auto* anAlgorithm = entry.second.first;
25 auto* dataVector = entry.second.second;
27 std::string algoName = anAlgorithm->getIDName();
28 if (entry.first != algoName) {
29 B2ERROR(
"RootParameterTracker::collectData4DoubleAlgorithms() key (" << entry.first <<
30 ") of container does not match to its content (" << algoName <<
31 ") - skipping entry! ");
34 B2DEBUG(21,
"RootParameterTracker::collectData4DoubleAlgorithms(), executing algorithm of type: " << algoName <<
35 " with collected data-entries of " << dataVector->size());
38 double calcVal = anAlgorithm->calcData(aTC);
39 dataVector->push_back(calcVal);
40 B2DEBUG(20,
"RootParameterTracker::collectData4DoubleAlgorithms(), tc with type " << tcTypeName <<
41 " and applied algorithm " << algoName <<
42 " and got " << calcVal <<
" as a result!");
44 B2WARNING(
"RootParameterTracker::collectData4DoubleAlgorithms(), Exception caught for tc with type " << tcTypeName <<
45 " and applied algorithm " << algoName <<
46 ". Failed with exception: " << anException.what() <<
62 if (foundTCTypeData ==
nullptr) {
return; }
65 for (
auto& entry : *foundTCTypeData) {
67 auto* anAlgorithm = entry.second.first;
68 auto* dataVector = entry.second.second;
70 std::string algoName = anAlgorithm->getIDName();
71 if (entry.first != algoName) {
72 B2ERROR(
"RootParameterTracker::collectData4DoubleAlgorithms() key (" << entry.first <<
73 ") of container does not match to its content (" << algoName <<
74 ") - skipping entry! ");
77 B2DEBUG(50,
"RootParameterTracker::collectData4DoubleAlgorithms(), executing algorithm of type: " << algoName <<
78 " with collected data-entries of " << dataVector->size());
81 int calcVal = anAlgorithm->calcData(aTC);
82 dataVector->push_back(calcVal);
83 B2DEBUG(20,
"RootParameterTracker::collectData4DoubleAlgorithms(), tc with type " << tcTypeName <<
84 " and applied algorithm " << algoName <<
85 " and got " << calcVal <<
" as a result!");
87 B2WARNING(
"RootParameterTracker::collectData4DoubleAlgorithms(), Exception caught for tc with type " << tcTypeName <<
88 " and applied algorithm " << algoName <<
89 ". Failed with exception: " << anException.what() <<
106 if (foundTCTypeData ==
nullptr) {
return; }
109 for (
auto& entry : *foundTCTypeData) {
111 auto* anAlgorithm = entry.second.first;
112 auto* dataVector = entry.second.second;
114 std::string algoName = anAlgorithm->getIDName();
115 if (entry.first != algoName) {
116 B2ERROR(
"RootParameterTracker::collectData4VecDoubleAlgorithms() key (" << entry.first <<
117 ") of container does not match to its content (" << algoName <<
118 ") - skipping entry! ");
121 B2DEBUG(50,
"RootParameterTracker::collectData4VecDoubleAlgorithms(), executing algorithm of type: " << algoName <<
122 " with collected data-entries of " << dataVector->size());
125 std::vector<double> calcVal = anAlgorithm->calcData(aTC);
126 dataVector->push_back(calcVal);
127 auto printVec = [&]() -> std::string {
129 for (
double val : calcVal)
131 out += (
" " + std::to_string(val));
133 return (out +=
"\n");
135 B2DEBUG(20,
"RootParameterTracker::collectData4VecDoubleAlgorithms(), tc with type " << tcTypeName <<
136 " and applied algorithm " << algoName <<
137 " and got: " << printVec() <<
140 B2WARNING(
"RootParameterTracker::collectData4VecDoubleAlgorithms(), Exception caught for tc with type " << tcTypeName <<
141 " and applied algorithm " << algoName <<
142 ". Failed with exception: " << anException.what() <<
178 B2DEBUG(5,
"RootParameterTracker::addParameters4DoubleAlgorithms(), given parameters are tcTypeName/algorithmName: " << tcTypeName
186 if (algorithms4tcType ==
nullptr) {
187 B2DEBUG(5,
"RootParameterTracker::addParameters4DoubleAlgorithms(), tcType " << tcTypeName <<
188 " not yet added to m_algoDataDouble, doing it now...");
195 B2DEBUG(5,
"RootParameterTracker::addParameters4DoubleAlgorithms(), m_algoDataDouble has " <<
m_algoDataDouble.size() <<
199 auto* data4AlgorithmOftcType = algorithms4tcType->find(algorithmName);
200 if (data4AlgorithmOftcType ==
nullptr) {
201 B2DEBUG(5,
"RootParameterTracker::addParameters4DoubleAlgorithms(), algorithm " << algorithmName <<
202 " not yet added to m_algoDataDouble[tcType], doing it now...");
205 algorithms4tcType->push_back({
209 new std::vector<double>()
212 data4AlgorithmOftcType = algorithms4tcType->find(algorithmName);
215 auto* newBranch = tree4tcType->Branch(algorithmName.c_str(), data4AlgorithmOftcType->second);
216 if (newBranch ==
nullptr) B2ERROR(
"Could not create Branch " << algorithmName);
219 B2WARNING(
"RootParameterTracker::addParameters4DoubleAlgorithms() given tcTypeName/algorithmName: " << tcTypeName <<
220 "/" << algorithmName <<
221 " was already added and will not be added again. This is a sign for unintended behavior - nothing will be added!");
223 B2DEBUG(5,
"RootParameterTracker::addParameters4DoubleAlgorithms(), m_algoDataDouble[tcType] has " << algorithms4tcType->size() <<
224 " algorithms stored");
236 B2DEBUG(5,
"RootParameterTracker::addParameters4IntAlgorithms(), given parameters are tcTypeName/algorithmName: " << tcTypeName <<
244 if (algorithms4tcType ==
nullptr) {
245 B2DEBUG(5,
"RootParameterTracker::addParameters4IntAlgorithms(), tcType " << tcTypeName <<
246 " not yet added to m_algoDataInt, doing it now...");
253 B2DEBUG(5,
"RootParameterTracker::addParameters4IntAlgorithms(), m_algoDataInt has " <<
m_algoDataInt.size() <<
" tcTypes stored");
256 auto* data4AlgorithmOftcType = algorithms4tcType->find(algorithmName);
257 if (data4AlgorithmOftcType ==
nullptr) {
258 B2DEBUG(5,
"RootParameterTracker::addParameters4IntAlgorithms(), algorithm " << algorithmName <<
259 " not yet added to m_algoDataInt[tcType], doing it now...");
263 algorithms4tcType->push_back({
267 new std::vector<int>()
270 data4AlgorithmOftcType = algorithms4tcType->find(algorithmName);
273 auto* newBranch = tree4tcType->Branch(algorithmName.c_str(), data4AlgorithmOftcType->second);
274 if (newBranch ==
nullptr) B2ERROR(
"Could not create Branch " << algorithmName);
277 B2WARNING(
"RootParameterTracker::addParameters4DoubleAlgorithms() given tcTypeName/algorithmName: " << tcTypeName <<
278 "/" << algorithmName <<
279 " was already added and will not be added again. This is a sign for unintended behavior - nothing will be added!");
281 B2DEBUG(5,
"RootParameterTracker::addParameters4DoubleAlgorithms(), m_algoDataInt[tcType] has " << algorithms4tcType->size() <<
282 " algorithms stored");
294 B2DEBUG(5,
"RootParameterTracker::addParameters4VecDoubleAlgorithms(), given parameters are tcTypeName/algorithmName: " <<
302 if (algorithms4tcType ==
nullptr) {
303 B2DEBUG(5,
"RootParameterTracker::addParameters4VecDoubleAlgorithms(), tcType " << tcTypeName <<
304 " not yet added to m_algoDataVecDouble, doing it now...");
311 B2DEBUG(5,
"RootParameterTracker::addParameters4VecDoubleAlgorithms(), m_algoDataVecDouble has " <<
m_algoDataVecDouble.size() <<
315 auto* data4AlgorithmOftcType = algorithms4tcType->find(algorithmName);
316 if (data4AlgorithmOftcType ==
nullptr) {
317 B2DEBUG(5,
"RootParameterTracker::addParameters4VecDoubleAlgorithms(), algorithm " << algorithmName <<
318 " not yet added to m_algoDataVecDouble[tcType], doing it now...");
320 AnalyzingAlgorithmFactoryVecDouble<std::vector<double>,
AnalizerTCInfo, ROOT::Math::XYZVector>
322 algorithms4tcType->push_back({
326 new std::vector<std::vector<double>>()
329 data4AlgorithmOftcType = algorithms4tcType->find(algorithmName);
332 auto* newBranch = tree4tcType->Branch(algorithmName.c_str(), data4AlgorithmOftcType->second);
333 if (newBranch ==
nullptr) B2ERROR(
"Could not create Branch " << algorithmName);
336 B2WARNING(
"RootParameterTracker::addParameters4VecDoubleAlgorithms() given tcTypeName/algorithmName: " << tcTypeName <<
337 "/" << algorithmName <<
338 " was already added and will not be added again. This is a sign for unintended behavior - nothing will be added!");
340 B2DEBUG(5,
"RootParameterTracker::addParameters4VecDoubleAlgorithms(), m_algoDataVecDouble[tcType] has " <<
341 algorithms4tcType->size() <<
" algorithms stored");
static AlgoritmType::Type getTypeEnum(std::string type)
for given string name of a AlgoritmType the corresponding AlgoritmType will be returned.
simple class storing infos relevant for a TC for analyzing it.
Base class for storing an algorithm determining the data one wants to have.
Minimal container storing a pair of < KeyType, ValueType>
AlgoDataBox< int > m_algoDataInt
contains all algorithms and its data storing one int per TC
void addParameters4DoubleAlgorithms(std::string tcTypeName, std::string algorithmName)
relevant for all algorithms storing one double per TC:
void addParameters4VecDoubleAlgorithms(std::string tcTypeName, std::string algorithmName)
relevant for all algorithms storing one vector of double per TC:
void collectData4DoubleAlgorithms(std::string tcTypeName, const AnalizerTCInfo &aTC)
takes aTC with tcTypeName and applies the algorithms for it
void collectData4IntAlgorithms(std::string tcTypeName, const AnalizerTCInfo &aTC)
takes aTC with tcTypeName and applies the algorithms for it
void addParameters4IntAlgorithms(std::string tcTypeName, std::string algorithmName)
relevant for all algorithms storing one int per TC:
TTree * prepareTTree(std::string tcTypeName)
checks if ttree for given tcTypeName exists and creates it if not.
void collectData4VecDoubleAlgorithms(std::string tcTypeName, const AnalizerTCInfo &aTC)
takes aTC with tcTypeName and applies the algorithms for it
AlgoDataBox< std::vector< double > > m_algoDataVecDouble
contains all algorithms and its data storing one vector of double per TC
AlgoDataBox< double > m_algoDataDouble
contains all algorithms and its data storing one double per TC
Abstract base class for different kinds of events.