CGEM BOSS 6.6.5.i
BESIII Offline Software System
Loading...
Searching...
No Matches
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:[email protected]>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 */
70 TDAQ_CTP = 0x77,
71 TDAQ_L2SV = 0x78,
72 TDAQ_SFI = 0x79,
73 TDAQ_SFO = 0x7a,
74 TDAQ_LVL2 = 0x7b,
76 OTHER = 0x81,
77 BESIII_MDC = 0xa1,
78 BESIII_TOF = 0xa2,
79 BESIII_EMC = 0xa3,
80 BESIII_MUC = 0xa4,
81 BESIII_TRG = 0xa5
82 };
83
84 /**
85 * An alias
86 */
88
89 namespace helper {
90
91 /**
92 * Defines converters between source identifiers and its components.
93 */
95
96 public:
97 /**
98 * Constructor. Takes the components to form a source identifier.
99 *
100 * @param subdet The subdetector for this source
101 * @param id The module identifier
102 */
103 SourceIdentifier (eformat::SubDetector subdet, uint16_t id);
104
105 /**
106 * Constructor. Takes the source identifier to understand the components
107 * from.
108 *
109 * @param sid The source identifier, fully built.
110 * @warning This source identifier <b>has</b> to conform to the current
111 * version of the library or unpredictable results might occur.
112 */
113 SourceIdentifier (uint32_t sid);
114
115 /**
116 * Extracts the SubDetector component of the identifier.
117 */
118 inline eformat::SubDetector subdetector_id (void) const { return m_sd; }
119
120 /**
121 * Extracts the Module identifier from the source identifier.
122 */
123 inline uint16_t module_id (void) const { return m_id; }
124
125 /**
126 * Gets the full 32-bit number made by assembling the 3 numbers
127 * above.
128 */
129 uint32_t code (void) const;
130
131 /**
132 * Returns a string that represents the source identifier in a human
133 * readable format
134 */
135 std::string human (void) const;
136
137 /**
138 * Returns a string that represents the subdetector identifier in a human
139 * readable format
140 */
141 std::string human_detector (void) const;
142
143 private: //representation
144
145 eformat::SubDetector m_sd; ///< The subdetector component
146 uint16_t m_id; ///< The module identifier
147
148 };
149
150 }
151
152}
153
154#endif //EVENTFORMAT_HELPER_SOURCEID_H
SourceIdentifier(eformat::SubDetector subdet, uint16_t id)
eformat::SubDetector subdetector_id(void) const
std::string human_detector(void) const
@ TILECAL_BARREL_C_SIDE
@ MUON_CSC_ENDCAP_C_SIDE
@ MUON_TGC_ENDCAP_C_SIDE
@ MUON_CSC_ENDCAP_A_SIDE
@ TDAQ_MUON_CTP_INTERFACE
@ MUON_MDT_BARREL_A_SIDE
@ MUON_MDT_ENDCAP_C_SIDE
@ LAR_HAD_ENDCAP_C_SIDE
@ MUON_TGC_ENDCAP_A_SIDE
@ MUON_MDT_ENDCAP_A_SIDE
@ TDAQ_CALO_JET_PROC_ROI
@ LAR_HAD_ENDCAP_A_SIDE
@ TDAQ_CALO_CLUSTER_PROC_ROI
@ TDAQ_CALO_CLUSTER_PROC_DAQ
@ TDAQ_CALO_JET_PROC_DAQ
@ MUON_RPC_BARREL_C_SIDE
@ TILECAL_BARREL_A_SIDE
@ MUON_RPC_BARREL_A_SIDE
@ MUON_MDT_BARREL_C_SIDE