BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
Event/eformat/include/eformat/SourceIdentifier.h
Go to the documentation of this file.
1// Dear emacs, this is -*- c++ -*-
2
3/**
4 * @file eformat/SourceIdentifier.h
5 * @author <a href="mailto:Andre.dos.Anjos@cern.ch>André dos ANJOS</a>
6 * $Author: zhangy $
7 * $Revision: 1.1.1.1 $
8 * $Date: 2009/06/19 07:35:41 $
9 *
10 * @brief Declares a type that can perform the conversion between source
11 * identifier components and the its 32-bit version.
12 */
13
14#ifndef EFORMAT_HELPER_SOURCEIDENTIFIER_H
15#define EFORMAT_HELPER_SOURCEIDENTIFIER_H
16
17#include <stdint.h>
18#include <string>
19
20namespace eformat {
21
22 /**
23 * Sub-detector ID
24 */
71 TDAQ_CTP = 0x77,
72 TDAQ_L2SV = 0x78,
73 TDAQ_SFI = 0x79,
74 TDAQ_SFO = 0x7a,
75 TDAQ_LVL2 = 0x7b,
77 OTHER = 0x81,
78 BESIII_MDC = 0xa1,
79 BESIII_TOF = 0xa2,
80 BESIII_EMC = 0xa3,
81 BESIII_MUC = 0xa4,
83 };
84
85 /**
86 * An alias
87 */
89
90 namespace helper {
91
92 /**
93 * Defines converters between source identifiers and its components.
94 */
96
97 public:
98 /**
99 * Constructor. Takes the components to form a source identifier.
100 *
101 * @param subdet The subdetector for this source
102 * @param id The module identifier
103 */
104 SourceIdentifier( eformat::SubDetector subdet, uint16_t id );
105
106 /**
107 * Constructor. Takes the source identifier to understand the components
108 * from.
109 *
110 * @param sid The source identifier, fully built.
111 * @warning This source identifier <b>has</b> to conform to the current
112 * version of the library or unpredictable results might occur.
113 */
114 SourceIdentifier( uint32_t sid );
115
116 /**
117 * Extracts the SubDetector component of the identifier.
118 */
119 inline eformat::SubDetector subdetector_id( void ) const { return m_sd; }
120
121 /**
122 * Extracts the Module identifier from the source identifier.
123 */
124 inline uint16_t module_id( void ) const { return m_id; }
125
126 /**
127 * Gets the full 32-bit number made by assembling the 3 numbers
128 * above.
129 */
130 uint32_t code( void ) const;
131
132 /**
133 * Returns a string that represents the source identifier in a human
134 * readable format
135 */
136 std::string human( void ) const;
137
138 /**
139 * Returns a string that represents the subdetector identifier in a human
140 * readable format
141 */
142 std::string human_detector( void ) const;
143
144 private: // representation
145 eformat::SubDetector m_sd; ///< The subdetector component
146 uint16_t m_id; ///< The module identifier
147 };
148
149 } // namespace helper
150
151} // namespace eformat
152
153#endif // EVENTFORMAT_HELPER_SOURCEID_H
SourceIdentifier(eformat::SubDetector subdet, uint16_t id)
std::string human_detector(void) const