GCC Code Coverage Report


Directory: ./
Coverage: low: ≥ 0% medium: ≥ 75.0% high: ≥ 90.0%
Coverage Exec / Excl / Total
Lines: 66.7% 8 / 0 / 12
Functions: 50.0% 3 / 0 / 6
Branches: 40.0% 4 / 0 / 10

src/iguana/algorithms/Validator.h
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 /// Set this validator's output directory
40 /// @param output_dir the output directory
41 void SetOutputDirectory(std::string_view output_dir);
42
43 /// Get this validator's output directory
44 /// @returns an `optional`, which is set if the output directory is defined
45 std::optional<std::string> GetOutputDirectory();
46
47 protected:
48
49 /// An `iguana::AlgorithmSequence` to be used for this validator
50 std::unique_ptr<AlgorithmSequence> m_algo_seq;
51
52 /// Mutex for locking procedures such as histogram filling in `Validator::Run`
53 mutable std::mutex m_mutex;
54
55 private:
56
57 // hooks are no-ops, since subclasses will implement
58 10 virtual void ConfigHook() {}
59 virtual void StartHook(hipo::banklist& banks) {}
60 virtual bool RunHook(hipo::banklist& banks) const { return true; }
61 virtual void StopHook() {}
62
63 /// output directory
64 std::string m_output_dir;
65 };
66 }
67