GCC Code Coverage Report


Directory: ./
File: src/iguana/algorithms/Validator.h
Date: 2025-06-06 22:09:53
Exec Total Coverage
Lines: 7 10 70.0%
Functions: 2 6 33.3%
Branches: 4 10 40.0%

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 9 Validator(std::string_view name = "validator")
28 9 : Algorithm(name)
29
1/4
✓ Branch 0 (3→4) taken 9 times.
✗ Branch 1 (3→13) not taken.
✗ Branch 2 (13→14) not taken.
✗ Branch 3 (13→16) not taken.
9 , m_output_dir("")
30 {
31 #ifdef IGUANA_ROOT_FOUND
32 // set styles for all validators' ROOT plots
33
1/2
✓ Branch 0 (4→5) taken 9 times.
✗ Branch 1 (4→7) not taken.
9 gStyle->SetOptStat(0);
34
1/2
✓ Branch 0 (5→6) taken 9 times.
✗ Branch 1 (5→7) not taken.
9 gStyle->SetPalette(55);
35 #endif
36 9 }
37
1/2
✗ Branch 0 (2→3) not taken.
✓ Branch 1 (2→5) taken 9 times.
18 virtual ~Validator() {}
38
39 void Start(hipo::banklist& banks) override{};
40 void Run(hipo::banklist& banks) const override{};
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