GCC Code Coverage Report


Directory: ./
File: src/iguana/algorithms/Validator.h
Date: 2025-11-25 17:57:04
Coverage Exec Excl Total
Lines: 63.6% 7 0 11
Functions: 40.0% 2 0 5
Branches: 40.0% 4 0 10

Line Branch Exec Source
1 #pragma once
2
3 #include <mutex>
4 #include <optional>
5
6 #include <hipo4/bank.h>
7
8 #include "iguana/algorithms/Algorithm.h"
9 #include "iguana/algorithms/AlgorithmSequence.h"
10
11 #ifdef IGUANA_ROOT_FOUND
12 #include <TStyle.h>
13 #endif
14
15 namespace iguana {
16
17 /// @brief Base class for all algorithm validators to inherit from
18 ///
19 /// Similar to `iguana::Algorithm`, derived classes should override the methods
20 /// `Validator::Start`, `Validator::Run` and `Validator::Stop`
21 class Validator : public Algorithm
22 {
23
24 public:
25
26 /// @param name the unique name for a derived class instance
27 10 Validator(std::string_view name = "validator")
28 10 : Algorithm(name)
29
1/4
✓ Branch 3 → 4 taken 10 times.
✗ Branch 3 → 13 not taken.
✗ Branch 13 → 14 not taken.
✗ Branch 13 → 16 not taken.
10 , m_output_dir("")
30 {
31 #ifdef IGUANA_ROOT_FOUND
32 // set styles for all validators' ROOT plots
33
1/2
✓ Branch 4 → 5 taken 10 times.
✗ Branch 4 → 7 not taken.
10 gStyle->SetOptStat(0);
34
1/2
✓ Branch 5 → 6 taken 10 times.
✗ Branch 5 → 7 not taken.
10 gStyle->SetPalette(55);
35 #endif
36 10 }
37
1/2
✗ Branch 2 → 3 not taken.
✓ Branch 2 → 5 taken 10 times.
20 virtual ~Validator() {}
38
39 void Start(hipo::banklist& banks) override {}
40 bool Run(hipo::banklist& banks) const override { return true; }
41 void Stop() override {}
42
43 /// Set this validator's output directory
44 /// @param output_dir the output directory
45 void SetOutputDirectory(std::string_view output_dir);
46
47 /// Get this validator's output directory
48 /// @returns an `optional`, which is set if the output directory is defined
49 std::optional<std::string> GetOutputDirectory();
50
51 protected:
52
53 /// An `iguana::AlgorithmSequence` to be used for this validator
54 std::unique_ptr<AlgorithmSequence> m_algo_seq;
55
56 /// Mutex for locking procedures such as histogram filling in `Validator::Run`
57 mutable std::mutex m_mutex;
58
59 private:
60
61 /// output directory
62 std::string m_output_dir;
63 };
64 }
65