CbmRoot
Loading...
Searching...
No Matches
QaReportGenerator.h
Go to the documentation of this file.
1/* Copyright (C) 2025 GSI/VECC, Darmstadt/Kolkata
2 SPDX-License-Identifier: GPL-3.0-only
3 Authors: Souvik Chattopadhyay[committer] */
4
5#pragma once
6
9
10#include <TDirectory.h>
11#include <TFile.h>
12
13#include <memory>
14#include <stdexcept>
15#include <string>
16#include <tuple>
17#include <vector>
18
19
22
30 public:
32 enum class EngineType
33 {
37 };
38
47 QaReportGenerator(const std::string& qaFile, const std::string& setup, const std::string& outDir,
48 EngineType engine = EngineType::kLatex, const std::string& figExt = "png", bool ignoreSame = false);
49
51 void Generate();
52
53 private:
54 void GetResults(TDirectory* dir, const std::string& currentPath, const std::string& taskName);
55 // Processing methods ------------------------------------------------
57 void Process(const std::string& yamlFile);
58 // @brief escape text for LaTeX output.
61 static std::string EscapeLatex(const std::string& text);
62
63 // Helpers -----------------------------------------------------------
64 /* @brief Get all canvas paths in a directory.
65 * @param dir Directory to search for canvases.
66 * @param prefix Optional prefix to filter canvas names.
67 * @return List of canvas paths matching the criteria.
68 *
69 * This method recursively searches the directory and its subdirectories
70 * for canvas objects (TCanvas) and returns their paths as strings.
71 */
72 static std::vector<std::string> GetCanvasPaths(TDirectory* dir, const std::string& prefix = "");
73
74 // Helper to convert comparison inference to string.
76
77
78 // Data members ------------------------------------------------------
79 std::unique_ptr<TFile> fFile;
80 std::unique_ptr<cbm::qa::report::Builder> fReport;
81 std::string fSetup;
82 std::string fOutDir;
84 std::vector<std::string> fObjlist;
85 std::vector<std::string> fVersionLabel;
86 // FIXME: Optimize the data container for fResults
87
88 std::unordered_map<std::string, std::vector<cbm::qa::checker::Result>> fResults;
89 bool fIgnoreSame = false;
90};
Base class for the report builder (implementation)
void Process(const std::string &yamlFile)
Process the YAML results file.
std::vector< std::string > fVersionLabel
version labels for comparison
std::string fOutDir
output directory
std::string fSetup
setup tag
std::unique_ptr< TFile > fFile
input ROOT file
bool fIgnoreSame
ignore "Same" results in comparison tables
static std::vector< std::string > GetCanvasPaths(TDirectory *dir, const std::string &prefix="")
static std::string CmpInferenceToString(cbm::qa::checker::ECmpInference inf)
EngineType fEngine
chosen engine
EngineType
Supported output engines.
static std::string EscapeLatex(const std::string &text)
std::unordered_map< std::string, std::vector< cbm::qa::checker::Result > > fResults
results map
std::unique_ptr< cbm::qa::report::Builder > fReport
report builder
QaReportGenerator(const std::string &qaFile, const std::string &setup, const std::string &outDir, EngineType engine=EngineType::kLatex, const std::string &figExt="png", bool ignoreSame=false)
void Generate()
Run the complete report generation pipeline.
void GetResults(TDirectory *dir, const std::string &currentPath, const std::string &taskName)
std::vector< std::string > fObjlist
list of objects in the file
A storable result of the QA-checker comparison routine.
ECmpInference
The object comparison inference.