/
base_hit.hpp
85 lines (62 loc) · 2.07 KB
/
base_hit.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
//! \file fecom/base_hit.hpp
//
// Copyright (c) 2016 by François Mauger <mauger@lpccaen.in2p3.fr>
#ifndef FECOM_BASE_HIT_HPP
#define FECOM_BASE_HIT_HPP
// Standard library:
#include <iostream>
#include <string>
// - Bayeux:
// - Bayeux/datatools:
#include <bayeux/datatools/i_serializable.h>
#include <bayeux/datatools/utils.h>
// - Bayeux/geomtools:
#include <bayeux/geomtools/geom_id.h>
// This project:
#include <fecom/utils.hpp>
namespace fecom {
//! \brief Commissioning base hit
struct base_hit : public datatools::i_serializable {
enum hitmode_type { SIG_INVALID = 0, SIG_CALORIMETER = 1, SIG_TRACKER = 2 };
/// Compare two base hits by hit id
struct compare {
bool operator()(const base_hit& a, const base_hit& b) const;
};
/// Compare two base hits by timestamp
struct compare_by_timestamp {
static bool comparetimestamp(const base_hit& a, const base_hit& b);
bool operator()(const base_hit& a, const base_hit& b) { return comparetimestamp(a, b); }
};
/// Default constructor
base_hit();
/// Other constructor
explicit base_hit(const hitmode_type);
/// Destructor
virtual ~base_hit();
/// Check if the base hit has geom_id
bool has_geom_id() const;
/// Check if the base hit is valid
virtual bool is_valid() const;
///
virtual double get_timestamp() const = 0;
/// Reset
virtual void reset();
/// Smart print
virtual void tree_dump(std::ostream& out_, const std::string& title_ = "",
const std::string& indent_ = "", bool inherit_ = false) const;
/// Convert hitmode into string label
static std::string hitmode_to_label(const hitmode_type);
public:
uint64_t hit_id; ///< The hit ID
hitmode_type hitmode; ///< The hitmode (CALO or TRACKER ftm)
geomtools::geom_id electronic_id; ///< The electronic channel ID
uint64_t trigger_id; ///< Hit trigger ID
DATATOOLS_SERIALIZATION_DECLARATION()
};
} // namespace fecom
#endif // FECOM_BASE_HIT_HPP
// Local Variables: --
// Mode: c++ --
// c-file-style: "gnu" --
// tab-width: 2 --
// End: --