CGEM BOSS 6.6.5.h
BESIII Offline Software System
Loading...
Searching...
No Matches
CgemID.cxx
Go to the documentation of this file.
1/* Header file: BOSS */
2#include "Identifier/CgemID.h"
3
4/* Header file: C++ */
5#include <assert.h>
6#include <iostream>
7
8//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
9const unsigned int CgemID::XSTRIP_MAX[3] = {856 , 630 , 832 };
10const unsigned int CgemID::VSTRIP_MAX[3] = {1173 , 1077 , 1395 };
11
12//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
14{
15}
16
17//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
19{
20}
21
22//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
23bool CgemID::values_ok(const unsigned int f_layer,
24 const unsigned int f_sheet,
25 const unsigned int f_strip_type,
26 const unsigned int f_strip)
27{
28 /* Check over strip type */
29 if ((f_strip_type != XSTRIP_TYPE) && (f_strip_type != VSTRIP_TYPE))
30 {
31 return false;
32 }
33
34 /* Check over layer sheet strip */
35 if ((f_layer < LAYER_MAX) && (f_sheet < SHEET_MAX))
36 {
37 if (f_strip_type == XSTRIP_TYPE)
38 {
39 if (f_strip < XSTRIP_MAX[f_layer])
40 {
41 return true;
42 }
43 }
44
45 if (f_strip_type == VSTRIP_TYPE)
46 {
47 if (f_strip < VSTRIP_MAX[f_layer])
48 {
49 return true;
50 }
51 }
52 }
53
54 std::cout << " INFO : Identifier::CgemID, values_ok(): " << std::endl;
55 std::cout << " layer = " << f_layer
56 << " sheet = " << f_sheet
57 << " stripType = " << f_strip_type
58 << " strip = " << f_strip << std::endl;
59
60 return false;
61}
62
63//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
65{
66 unsigned int type = (id.get_value() & CgemID::STRIP_TYPE_MASK) >> CgemID::STRIP_TYPE_INDEX;
67 return (type == XSTRIP_TYPE) ? true : false;
68}
69
70//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
72{
73 return (id.get_value() & CgemID::LAYER_MASK) >> CgemID::LAYER_INDEX;
74}
75
76//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
78{
79 return (id.get_value() & CgemID::SHEET_MASK) >> CgemID::SHEET_INDEX;
80}
81
82//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
84{
85 return (id.get_value() & CgemID::STRIP_MASK) >> CgemID::STRIP_INDEX;
86}
87
88//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
89Identifier CgemID::strip_id(int f_layer, int f_sheet, int f_strip_type, int f_strip)
90{
91 /* Check over input parameters */
92 assert(values_ok(f_layer, f_sheet, f_strip_type, f_strip));
93
94 unsigned int value = ( BesDetectorID::CGEM_ID << CGEM_INDEX )
95 | ( f_layer << LAYER_INDEX )
96 | ( f_sheet << SHEET_INDEX )
97 | ( f_strip_type << STRIP_TYPE_INDEX )
98 | ( f_strip << STRIP_INDEX );
99
100 return Identifier(value);
101}
102
103//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
104unsigned int CgemID::getIntID(unsigned int f_layer,
105 unsigned int f_sheet,
106 unsigned int f_strip_type,
107 unsigned int f_strip)
108{
109 unsigned int value = ((BesDetectorID::CGEM_ID << CGEM_INDEX) & CGEM_MASK)
110 |((f_layer << LAYER_INDEX) & LAYER_MASK)
111 |((f_sheet << SHEET_INDEX) & SHEET_MASK)
112 |((f_strip_type << STRIP_TYPE_INDEX) & STRIP_TYPE_MASK)
113 |((f_strip << STRIP_INDEX) & STRIP_MASK);//change from STRIP_INDEX to STRIP_MASK by sunxh on 2015.06.25
114 return value;
115}
116
117//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
119{
120 return LAYER_MAX;
121}
122
123//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
125{
126 return SHEET_MAX;
127}
128
129//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
130unsigned int CgemID::getXSTRIP_MAX(unsigned int f_layer)
131{
132 return XSTRIP_MAX[f_layer];
133}
134
135//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
136unsigned int CgemID::getVSTRIP_MAX(unsigned int f_layer)
137{
138 return VSTRIP_MAX[f_layer];
139}
140
141//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
143{
144 return XSTRIP_TYPE;
145}
146
147//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
149{
150 return VSTRIP_TYPE;
151}
152//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
static const unsigned int CGEM_ID
static const unsigned int CGEM_MASK
static const unsigned int CGEM_INDEX
static int strip(const Identifier &id)
Definition CgemID.cxx:83
static int sheet(const Identifier &id)
Definition CgemID.cxx:77
static value_type getXSTRIP_MAX(unsigned int f_layer)
Definition CgemID.cxx:130
static value_type getVSTRIP_TYPE()
Definition CgemID.cxx:148
static value_type getXSTRIP_TYPE()
Definition CgemID.cxx:142
static int layer(const Identifier &id)
Definition CgemID.cxx:71
static value_type getVSTRIP_MAX(unsigned int f_layer)
Definition CgemID.cxx:136
CgemID()
Definition CgemID.cxx:13
static value_type getLAYER_MAX()
Definition CgemID.cxx:118
static value_type getSHEET_MAX()
Definition CgemID.cxx:124
static bool is_xstrip(const Identifier &id)
Definition CgemID.cxx:64
~CgemID()
Definition CgemID.cxx:18
static bool values_ok(const unsigned int f_layer, const unsigned int f_sheet, const unsigned int f_strip_type, const unsigned int f_strip)
Definition CgemID.cxx:23
static value_type getIntID(unsigned int f_layer, unsigned int f_sheet, unsigned int f_strip_type, unsigned int f_strip)
Definition CgemID.cxx:104
static Identifier strip_id(int f_layer, int f_sheet, int f_strip_type, int f_strip)
Definition CgemID.cxx:89