HepMC3 event record library
ValidationControl.h
1 // -*- C++ -*-
2 //
3 // This file is part of HepMC
4 // Copyright (C) 2014-2019 The HepMC collaboration (see AUTHORS for details)
5 //
6 #ifndef VALIDATION_CONTROL_H
7 #define VALIDATION_CONTROL_H
8 
9 #ifdef HEPMC2
10 #include "HepMC/GenEvent.h"
11 #else
12 #include "HepMC3/GenEvent.h"
13 #include "HepMC3/Print.h"
14 #endif // ifdef HEPMC2
15 
16 #include "ValidationTool.h"
17 #include "Timer.h"
18 
19 #include <vector>
20 #include <string.h>
21 /// @class ValidationControl
22 /// @brief Runs multiple validation tools
24 //
25 // Constructors
26 //
27 public:
28  /** @brief Constructor */
30  /** @brief Destructor */
32 
33 //
34 // Functions
35 //
36 public:
37  /** @brief Read file */
38  void read_file(const std::string &filename);
39  /** @brief New event */
40  bool new_event();
41  /** @brief Init function */
42  void initialize();
43  /** @brief Process event */
44  void process(GenEvent &hepmc);
45  /** @brief Finalize */
46  void finalize();
47 
48 //
49 // Accessors
50 //
51 public:
52  /** @brief Toolchain */
53  const std::vector<ValidationTool*>& toolchain() { return m_toolchain; }
54  /** @brief Event limit */
55  int event_limit() { return m_events; }
56  /** @brief Set event limit */
57  void set_event_limit(int events) { m_events = events; }
58  /** @brief N events to print*/
59  void print_events(int events) { m_print_events = events; }
60  /** @brief N events to check momentum*/
61  void check_momentum_for_events(int events) { m_momentum_check_events = events; }
62 
63 //
64 // Fields
65 //
66 private:
67  std::vector<ValidationTool*> m_toolchain; ///< Toolchain
68 
69  int m_events; ///< events
70  int m_events_print_step; ///< events print step
71  int m_momentum_check_events; ///< mom check events
72  double m_momentum_check_threshold; ///< mom check threshold
73  int m_print_events; ///< print events
74  int m_event_counter; ///< counter of events
75  int m_status; ///< status
76  Timer m_timer; ///< Times
77 
78  bool m_has_input_source; ///< Input source flag
79 
80  /** @brief parsing stutus */
82  PARSING_OK,
83  UNRECOGNIZED_COMMAND,
84  UNRECOGNIZED_OPTION,
85  UNRECOGNIZED_INPUT,
86  UNRECOGNIZED_TOOL,
87  UNAVAILABLE_TOOL,
88  ADDITIONAL_INPUT,
89  CANNOT_OPEN_FILE
90  };
91 };
92 
93 #endif
int m_events_print_step
events print step
void set_event_limit(int events)
Set event limit.
~ValidationControl()
Destructor.
int m_momentum_check_events
mom check events
void check_momentum_for_events(int events)
N events to check momentum.
void read_file(const std::string &filename)
Read file.
std::vector< ValidationTool * > m_toolchain
Toolchain.
const std::vector< ValidationTool * > & toolchain()
Toolchain.
int m_event_counter
counter of events
Timer m_timer
Times.
void initialize()
Init function.
void print_events(int events)
N events to print.
PARSING_STATUS
parsing stutus
int m_print_events
print events
Stores event-related information.
Definition: GenEvent.h:41
bool m_has_input_source
Input source flag.
double m_momentum_check_threshold
mom check threshold
void finalize()
Finalize.
int event_limit()
Event limit.
bool new_event()
New event.
Runs multiple validation tools.
Definition of class GenEvent.
ValidationControl()
Constructor.
void process(GenEvent &hepmc)
Process event.
Used to benchmark MC generators.
Definition: Timer.h:38