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 
26 //
27 // Constructors
28 //
29 public:
30  /** Virtual destructor */
31  virtual ~ValidationTool() {};
32 
33 //
34 // Abstract functions
35 //
36 public:
37  /** @brief Get information if this tool modifies the event
38  *
39  * Tools that do not modify event will be ignored during event printing
40  * and momentum conservation checks
41  */
42  virtual bool tool_modifies_event() = 0;
43 
44  /** @brief Get name of the tool */
45  virtual const std::string name() = 0;
46 
47  virtual void initialize() = 0; //!< Initialize
48  virtual int process(GenEvent &hepmc) = 0; //!< Process event
49  virtual void finalize() = 0; //!< Finalize
50 
51 //
52 // Virtual functions
53 //
54 public:
55  /** @brief Get long name of the tool */
56  virtual const std::string long_name() { return name(); }
57 
58  /** @brief Get timer for this tool (if this tool is being timed)
59  *
60  * Note that normally the tool itself should not use the timer it provides
61  * However, if one want to exclude some part of initialization
62  * timer()->start() can be used to restart the timer per each event
63  */
64  virtual class Timer* timer() { return NULL; }
65 };
66 
67 #endif
HepMC3 main namespace.
Definition: WriterDOT.h:19
virtual ~ValidationTool()
virtual class Timer * timer()
Get timer for this tool (if this tool is being timed)
Stores event-related information.
Definition: GenEvent.h:42
virtual const std::string long_name()
Get long name of the tool.
Definition: Timer.h:29