HepMC3 event record library
ValidationTool.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_TOOL_H
7 #define VALIDATION_TOOL_H
8 
9 #ifdef HEPMC2
10 
11 // Ignore HepMC3 code, use HepMC2 code
12 #define HEPMC2CODE( x ) x
13 #define HEPMC3CODE( x )
14 using namespace HepMC;
15 
16 #else
17 
18 // Ignore HepMC2 code, use HepMC3 code
19 #define HEPMC2CODE( x )
20 #define HEPMC3CODE( x ) x
21 using namespace HepMC3;
22 
23 #endif // ifdef HEPMC2
24 /// @class ValidationTool
25 /// @brief Virtual Interface to validation tools
27 //
28 // Constructors
29 //
30 public:
31  /** Virtual destructor */
32  virtual ~ValidationTool() {};
33 
34 //
35 // Abstract functions
36 //
37 public:
38  /** @brief Get information if this tool modifies the event
39  *
40  * Tools that do not modify event will be ignored during event printing
41  * and momentum conservation checks
42  */
43  virtual bool tool_modifies_event() = 0;
44 
45  /** @brief Get name of the tool */
46  virtual const std::string name() = 0;
47 
48  virtual void initialize() = 0; //!< Initialize
49  virtual int process(GenEvent &hepmc) = 0; //!< Process event
50  virtual void finalize() = 0; //!< Finalize
51 
52 //
53 // Virtual functions
54 //
55 public:
56  /** @brief Get long name of the tool */
57  virtual const std::string long_name() { return name(); }
58 
59  /** @brief Get timer for this tool (if this tool is being timed)
60  *
61  * Note that normally the tool itself should not use the timer it provides
62  * However, if one want to exclude some part of initialization
63  * timer()->start() can be used to restart the timer per each event
64  */
65  virtual class Timer* timer() { return NULL; }
66 };
67 
68 #endif
virtual ~ValidationTool()
virtual class Timer * timer()
Get timer for this tool (if this tool is being timed)
Stores event-related information.
Definition: GenEvent.h:41
Virtual Interface to validation tools.
virtual const std::string long_name()
Get long name of the tool.
Annotation for function names.
Definition: attr.h:36
Used to benchmark MC generators.
Definition: Timer.h:38