8 #include <tracking/trackFindingVXD/analyzingTools/RootParameterTracker.h>
15 void RootParameterTracker::collectData4DoubleAlgorithms(std::string tcTypeName,
const AnalizerTCInfo& aTC)
17 auto* foundTCTypeData = m_algoDataDouble.find(tcTypeName);
20 if (foundTCTypeData ==
nullptr) {
return; }
23 for (
auto& entry : *foundTCTypeData) {
25 auto* anAlgorithm = entry.second.first;
26 auto* dataVector = entry.second.second;
28 string algoName = anAlgorithm->getIDName();
29 if (entry.first != algoName) {
30 B2ERROR(
"RootParameterTracker::collectData4DoubleAlgorithms() key (" << entry.first <<
31 ") of container does not match to its content (" << algoName <<
32 ") - skipping entry! ");
35 B2DEBUG(50,
"RootParameterTracker::collectData4DoubleAlgorithms(), executing algorithm of type: " << algoName <<
36 " with collected data-entries of " << dataVector->size());
39 double calcVal = anAlgorithm->calcData(aTC);
40 dataVector->push_back(calcVal);
41 B2DEBUG(20,
"RootParameterTracker::collectData4DoubleAlgorithms(), tc with type " << tcTypeName <<
42 " and applied algorithm " << algoName <<
43 " and got " << calcVal <<
" as a result!");
45 B2WARNING(
"RootParameterTracker::collectData4DoubleAlgorithms(), Exception caught for tc with type " << tcTypeName <<
46 " and applied algorithm " << algoName <<
47 ". Failed with exception: " << anException.what() <<
58 void RootParameterTracker::collectData4IntAlgorithms(std::string tcTypeName,
const AnalizerTCInfo& aTC)
60 auto* foundTCTypeData = m_algoDataInt.find(tcTypeName);
63 if (foundTCTypeData ==
nullptr) {
return; }
66 for (
auto& entry : *foundTCTypeData) {
68 auto* anAlgorithm = entry.second.first;
69 auto* dataVector = entry.second.second;
71 string algoName = anAlgorithm->getIDName();
72 if (entry.first != algoName) {
73 B2ERROR(
"RootParameterTracker::collectData4DoubleAlgorithms() key (" << entry.first <<
74 ") of container does not match to its content (" << algoName <<
75 ") - skipping entry! ");
78 B2DEBUG(50,
"RootParameterTracker::collectData4DoubleAlgorithms(), executing algorithm of type: " << algoName <<
79 " with collected data-entries of " << dataVector->size());
82 int calcVal = anAlgorithm->calcData(aTC);
83 dataVector->push_back(calcVal);
84 B2DEBUG(20,
"RootParameterTracker::collectData4DoubleAlgorithms(), tc with type " << tcTypeName <<
85 " and applied algorithm " << algoName <<
86 " and got " << calcVal <<
" as a result!");
88 B2WARNING(
"RootParameterTracker::collectData4DoubleAlgorithms(), Exception caught for tc with type " << tcTypeName <<
89 " and applied algorithm " << algoName <<
90 ". Failed with exception: " << anException.what() <<
101 void RootParameterTracker::collectData4VecDoubleAlgorithms(std::string tcTypeName,
const AnalizerTCInfo& aTC)
103 auto* foundTCTypeData = m_algoDataVecDouble.find(
107 if (foundTCTypeData ==
nullptr) {
return; }
110 for (
auto& entry : *foundTCTypeData) {
112 auto* anAlgorithm = entry.second.first;
113 auto* dataVector = entry.second.second;
115 string algoName = anAlgorithm->getIDName();
116 if (entry.first != algoName) {
117 B2ERROR(
"RootParameterTracker::collectData4VecDoubleAlgorithms() key (" << entry.first <<
118 ") of container does not match to its content (" << algoName <<
119 ") - skipping entry! ");
122 B2DEBUG(50,
"RootParameterTracker::collectData4VecDoubleAlgorithms(), executing algorithm of type: " << algoName <<
123 " with collected data-entries of " << dataVector->size());
126 vector<double> calcVal = anAlgorithm->calcData(aTC);
127 dataVector->push_back(calcVal);
128 auto printVec = [&]() ->
string {
130 for (
double val : calcVal)
132 out += (
" " + to_string(val));
134 return (out +=
"\n");
136 B2DEBUG(20,
"RootParameterTracker::collectData4VecDoubleAlgorithms(), tc with type " << tcTypeName <<
137 " and applied algorithm " << algoName <<
138 " and got: " << printVec() <<
141 B2WARNING(
"RootParameterTracker::collectData4VecDoubleAlgorithms(), Exception caught for tc with type " << tcTypeName <<
142 " and applied algorithm " << algoName <<
143 ". Failed with exception: " << anException.what() <<
156 void RootParameterTracker::addParameters4DoubleAlgorithms(std::string tcTypeName, std::string algorithmName)
179 B2DEBUG(5,
"RootParameterTracker::addParameters4DoubleAlgorithms(), given parameters are tcTypeName/algorithmName: " << tcTypeName
183 TTree* tree4tcType = prepareTTree(tcTypeName);
186 auto* algorithms4tcType = m_algoDataDouble.find(tcTypeName);
187 if (algorithms4tcType ==
nullptr) {
188 B2DEBUG(5,
"RootParameterTracker::addParameters4DoubleAlgorithms(), tcType " << tcTypeName <<
189 " not yet added to m_algoDataDouble, doing it now...");
190 m_algoDataDouble.push_back({
194 algorithms4tcType = m_algoDataDouble.find(tcTypeName);
196 B2DEBUG(5,
"RootParameterTracker::addParameters4DoubleAlgorithms(), m_algoDataDouble has " << m_algoDataDouble.size() <<
200 auto* data4AlgorithmOftcType = algorithms4tcType->find(algorithmName);
201 if (data4AlgorithmOftcType ==
nullptr) {
202 B2DEBUG(5,
"RootParameterTracker::addParameters4DoubleAlgorithms(), algorithm " << algorithmName <<
203 " not yet added to m_algoDataDouble[tcType], doing it now...");
205 (AlgoritmType::getTypeEnum(algorithmName));
206 algorithms4tcType->push_back({
213 data4AlgorithmOftcType = algorithms4tcType->find(algorithmName);
216 auto* newBranch = tree4tcType->Branch(algorithmName.c_str(), data4AlgorithmOftcType->second);
217 if (newBranch ==
nullptr) B2ERROR(
"Could not create Branch " << algorithmName);
220 B2WARNING(
"RootParameterTracker::addParameters4DoubleAlgorithms() given tcTypeName/algorithmName: " << tcTypeName <<
221 "/" << algorithmName <<
222 " was already added and will not be added again. This is a sign for unintended behavior - nothing will be added!");
224 B2DEBUG(5,
"RootParameterTracker::addParameters4DoubleAlgorithms(), m_algoDataDouble[tcType] has " << algorithms4tcType->size() <<
225 " algorithms stored");
235 void RootParameterTracker::addParameters4IntAlgorithms(std::string tcTypeName, std::string algorithmName)
237 B2DEBUG(5,
"RootParameterTracker::addParameters4IntAlgorithms(), given parameters are tcTypeName/algorithmName: " << tcTypeName <<
241 TTree* tree4tcType = prepareTTree(tcTypeName);
244 auto* algorithms4tcType = m_algoDataInt.find(tcTypeName);
245 if (algorithms4tcType ==
nullptr) {
246 B2DEBUG(5,
"RootParameterTracker::addParameters4IntAlgorithms(), tcType " << tcTypeName <<
247 " not yet added to m_algoDataInt, doing it now...");
248 m_algoDataInt.push_back({
252 algorithms4tcType = m_algoDataInt.find(tcTypeName);
254 B2DEBUG(5,
"RootParameterTracker::addParameters4IntAlgorithms(), m_algoDataInt has " << m_algoDataInt.size() <<
" tcTypes stored");
257 auto* data4AlgorithmOftcType = algorithms4tcType->find(algorithmName);
258 if (data4AlgorithmOftcType ==
nullptr) {
259 B2DEBUG(5,
"RootParameterTracker::addParameters4IntAlgorithms(), algorithm " << algorithmName <<
260 " not yet added to m_algoDataInt[tcType], doing it now...");
261 AnalyzingAlgorithm<int>* newAlgorithm = AnalyzingAlgorithmFactoryInt<int, AnalizerTCInfo, TVector3>(AlgoritmType::getTypeEnum(
263 algorithms4tcType->push_back({
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");
292 void RootParameterTracker::addParameters4VecDoubleAlgorithms(std::string tcTypeName, std::string algorithmName)
294 B2DEBUG(5,
"RootParameterTracker::addParameters4VecDoubleAlgorithms(), given parameters are tcTypeName/algorithmName: " <<
298 TTree* tree4tcType = prepareTTree(tcTypeName);
301 auto* algorithms4tcType = m_algoDataVecDouble.find(tcTypeName);
302 if (algorithms4tcType ==
nullptr) {
303 B2DEBUG(5,
"RootParameterTracker::addParameters4VecDoubleAlgorithms(), tcType " << tcTypeName <<
304 " not yet added to m_algoDataVecDouble, doing it now...");
305 m_algoDataVecDouble.push_back({
309 algorithms4tcType = m_algoDataVecDouble.find(tcTypeName);
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 (AlgoritmType::getTypeEnum(algorithmName));
321 algorithms4tcType->push_back({
325 new vector<vector<double>>()
328 data4AlgorithmOftcType = algorithms4tcType->find(algorithmName);
331 auto* newBranch = tree4tcType->Branch(algorithmName.c_str(), data4AlgorithmOftcType->second);
332 if (newBranch ==
nullptr) B2ERROR(
"Could not create Branch " << algorithmName);
335 B2WARNING(
"RootParameterTracker::addParameters4VecDoubleAlgorithms() given tcTypeName/algorithmName: " << tcTypeName <<
336 "/" << algorithmName <<
337 " was already added and will not be added again. This is a sign for unintended behavior - nothing will be added!");
339 B2DEBUG(5,
"RootParameterTracker::addParameters4VecDoubleAlgorithms(), m_algoDataVecDouble[tcType] has " <<
340 algorithms4tcType->size() <<
" algorithms stored");
simple class storing infos relevant for a TC for analizing it.
Base class for storing an algorithm determining the data one wants to have.
Minimal container storing a pair of < KeyType, ValueType>
Abstract base class for different kinds of events.