Falaise  4.0.1
SuperNEMO Software Toolkit
event_header.h
Go to the documentation of this file.
1 // -*- mode: c++ ; -*-
2 /// \file falaise/snemo/datamodels/event_header.h
3 /* Author (s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
4  * Creation date: 2010-11-07
5  * Last modified: 2014-01-27
6  *
7  * License:
8  *
9  * Description:
10  *
11  * Event header
12  *
13  */
14 
15 #ifndef FALAISE_SNEMO_DATAMODEL_EVENT_HEADER_H
16 #define FALAISE_SNEMO_DATAMODEL_EVENT_HEADER_H 1
17 
18 // Third party:
19 // - Boost :
20 #include <boost/cstdint.hpp>
21 #include <boost/serialization/access.hpp>
22 // - Bayeux/datatools :
23 #include <datatools/event_id.h>
24 #include <datatools/i_clear.h>
26 #include <datatools/i_tree_dump.h>
27 #include <datatools/properties.h>
28 
29 // This project:
31 
32 namespace snemo {
33 
34 namespace datamodel {
35 
36 /// \brief A event header class to be embedded as a bank in a 'datatools::things' event record.
38  public datatools::i_clear,
40  public:
41  /// \brief Generation type of the event record
43  GENERATION_INVALID = -1, ///< Invalid generation type
44  GENERATION_REAL = 0, ///< Real event from the detector's DAQ
45  GENERATION_SIMULATED = 1 ///< Simulated event from the MC application
46  };
47 
48  /// Return the default label/name of a 'event header' bank
49  static const std::string &event_header_label();
50 
51  /// Return the event ID
52  const datatools::event_id &get_id() const;
53 
54  /// Return the mutable event ID
56 
57  /// Set the event ID
58  void set_id(const datatools::event_id &);
59 
60  /// Return the constant list of properties
62 
63  /// Return the mutable list of properties
65 
66  /// Set the list of properties
68 
69  /// Return the timestamp
71 
72  /// Return the mutable timestamp
74 
75  /// Set the timestamp
77 
78  /// Return the generation
80 
81  /// Set the generation
83 
84  /// Check if event record is real (collected by the experiment DAQ)
85  bool is_real() const;
86 
87  /// Check if event record is simulated
88  bool is_simulated() const;
89 
90  /// Constructor
91  event_header();
92 
93  /// Destructor
94  virtual ~event_header();
95 
96  /// Clear the event header internal data
97  virtual void clear();
98 
99  /// Smart print
100  virtual void tree_dump(std::ostream &out_ = std::clog, const std::string &title_ = "",
101  const std::string &indent_ = "", bool inherit_ = false) const;
102 
103  /// Basic print
104  void dump() const;
105 
106  private:
107  datatools::event_id _id_; //!< Run/Event ID
108  generation_type _generation_; //!< Generation flag
109  snemo::datamodel::timestamp _timestamp_; //!< Reference time of the event
110  datatools::properties _properties_; //!< Dictionary of properties
111 
113 };
114 
115 } // end of namespace datamodel
116 
117 } // end of namespace snemo
118 
119 #include <boost/serialization/export.hpp>
120 BOOST_CLASS_EXPORT_KEY2(snemo::datamodel::event_header, "snemo::datamodel::event_header")
121 
122 // Class version:
123 #include <boost/serialization/version.hpp>
124 BOOST_CLASS_VERSION(snemo::datamodel::event_header, 1)
125 
126 #endif // FALAISE_SNEMO_DATAMODEL_EVENT_HEADER_H
void set_generation(generation_type)
Set the generation.
datatools::properties & grab_properties()
Return the mutable list of properties.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
generation_type get_generation() const
Return the generation.
void dump() const
Basic print.
void set_id(const datatools::event_id &)
Set the event ID.
#define DATATOOLS_SERIALIZATION_DECLARATION()
A class to handle time stamp.
Definition: timestamp.h:32
Real event from the detector's DAQ.
Definition: event_header.h:44
bool is_simulated() const
Check if event record is simulated.
Simulated event from the MC application.
Definition: event_header.h:45
bool is_real() const
Check if event record is real (collected by the experiment DAQ)
const datatools::event_id & get_id() const
Return the event ID.
Definition: calo_tapered_scin_box_model.h:54
static const std::string & event_header_label()
Return the default label/name of a 'event header' bank.
void set_timestamp(const snemo::datamodel::timestamp &)
Set the timestamp.
A event header class to be embedded as a bank in a 'datatools::things' event record.
Definition: event_header.h:37
virtual ~event_header()
Destructor.
generation_type
Generation type of the event record.
Definition: event_header.h:42
const datatools::properties & get_properties() const
Return the constant list of properties.
Invalid generation type.
Definition: event_header.h:43
const snemo::datamodel::timestamp & get_timestamp() const
Return the timestamp.
virtual void clear()
Clear the event header internal data.
datatools::event_id & grab_id()
Return the mutable event ID.
void set_properties(const datatools::properties &)
Set the list of properties.
snemo::datamodel::timestamp & grab_timestamp()
Return the mutable timestamp.