CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
TofHitStatus.cxx
Go to the documentation of this file.
1#include "DstEvent/TofHitStatus.h"
2#include "DstEvent/DstTofTrack.h"
3#include <assert.h>
4
6 m_status = 0;
7 m_raw = false;
8 m_readout = false;
9 m_counter = false;
10 m_cluster = false;
11 m_barrel = false;
12 m_east = false;
13 m_layer = 0;
14 m_overflow = false;
15 m_multihit = false;
16 m_ncounter = 0;
17 m_neast = 0;
18 m_nwest = 0;
19}
20
21
23 m_status = 0;
24 m_raw = false;
25 m_readout = false;
26 m_counter = false;
27 m_cluster = false;
28 m_barrel = false;
29 m_east = false;
30 m_layer = 0;
31 m_overflow = false;
32 m_multihit = false;
33 m_ncounter = 0;
34 m_neast = 0;
35 m_nwest = 0;
36}
37
38
41 m_status = source.status();
42 m_raw = ((m_status & Raw_Mask) >> Raw_Index ) ? true : false;
43 m_readout = ((m_status & Readout_Mask) >> Readout_Index ) ? true : false;
44 m_counter = ((m_status & Counter_Mask) >> Counter_Index ) ? true : false;
45 m_cluster = ((m_status & Cluster_Mask) >> Cluster_Index ) ? true : false;
46 m_barrel = ((m_status & Barrel_Mask) >> Barrel_Index ) ? true : false;
47 m_east = ((m_status & East_Mask) >> East_Index ) ? true : false;
48 m_layer = (m_status & Layer_Mask) >> Layer_Index;
49 m_overflow = ((m_status & Overflow_Mask) >> Overflow_Index ) ? true : false;
50 m_multihit = ((m_status & Multihit_Mask) >> Multihit_Index ) ? true : false;
51 m_ncounter = (m_status >> Ncounter_Index ) & N_Mask;
52 m_neast = (m_status >> Neast_Index ) & N_Mask;
53 m_nwest = (m_status >> Nwest_Index ) & N_Mask;
54
55 return *this;
56}
57
58
61 m_status = source.m_status;
62 return *this;
63}
64
65
66bool TofHitStatus::is_raw( unsigned int status ) {
67 return ((status & Raw_Mask) >> Raw_Index ) ? true : false;
68}
69
70
71bool TofHitStatus::is_readout( unsigned int status ) {
72 return ((status & Readout_Mask) >> Readout_Index ) ? true : false;
73}
74
75
76bool TofHitStatus::is_counter( unsigned int status ) {
77 return ((status & Counter_Mask) >> Counter_Index ) ? true : false;
78}
79
80
81bool TofHitStatus::is_cluster( unsigned int status ) {
82 return ((status & Cluster_Mask) >> Cluster_Index ) ? true : false;
83}
84
85
86bool TofHitStatus::is_barrel( unsigned int status ) {
87 return ((status & Barrel_Mask) >> Barrel_Index ) ? true : false;
88}
89
90
91bool TofHitStatus::is_east( unsigned int status ) {
92 return ((status & East_Mask) >> East_Index ) ? true : false;
93}
94
95
96unsigned int TofHitStatus::layer( unsigned int status ) {
97 return (status & Layer_Mask) >> Layer_Index;
98}
99
100
101bool TofHitStatus::is_overflow( unsigned int status ) {
102 return ((status & Overflow_Mask) >> Overflow_Index ) ? true : false;
103}
104
105
106bool TofHitStatus::is_multihit( unsigned int status ) {
107 return ((status & Multihit_Mask) >> Multihit_Index ) ? true : false;
108}
109
110
111unsigned int TofHitStatus::ncounter( unsigned int status ) {
112 return (status >> Ncounter_Index ) & N_Mask;
113}
114
115
116unsigned int TofHitStatus::neast( unsigned int status ) {
117 return (status >> Neast_Index ) & N_Mask;
118}
119
120
121unsigned int TofHitStatus::nwest( unsigned int status ) {
122 return (status >> Nwest_Index ) & N_Mask;
123}
124
125
126void TofHitStatus::setStatus( unsigned int status ) {
127 m_status = status;
128 m_raw = ((m_status & Raw_Mask) >> Raw_Index ) ? true : false;
129 m_readout = ((m_status & Readout_Mask) >> Readout_Index ) ? true : false;
130 m_counter = ((m_status & Counter_Mask) >> Counter_Index ) ? true : false;
131 m_cluster = ((m_status & Cluster_Mask) >> Cluster_Index ) ? true : false;
132 m_barrel = ((m_status & Barrel_Mask) >> Barrel_Index ) ? true : false;
133 m_east = ((m_status & East_Mask) >> East_Index ) ? true : false;
134 m_layer = (m_status & Layer_Mask) >> Layer_Index;
135 m_overflow = ((m_status & Overflow_Mask) >> Overflow_Index ) ? true : false;
136 m_multihit = ((m_status & Multihit_Mask) >> Multihit_Index ) ? true : false;
137 m_ncounter = (m_status >> Ncounter_Index ) & N_Mask;
138 m_neast = (m_status >> Neast_Index ) & N_Mask;
139 m_nwest = (m_status >> Nwest_Index ) & N_Mask;
140}
141
142
143void TofHitStatus::setRaw( bool raw ) {
144 m_raw = raw;
145 if( raw ) { m_status |= Raw_Mask; }
146 else { m_status &= (~Raw_Mask); }
147}
148
149
150void TofHitStatus::setReadout( bool readout ) {
151 m_readout = readout;
152 if( readout ) { m_status |= Readout_Mask; }
153 else { m_status &= (~Readout_Mask); }
154}
155
156
157void TofHitStatus::setCounter( bool counter ) {
158 m_counter = counter;
159 if( counter ) { m_status |= Counter_Mask; }
160 else { m_status &= (~Counter_Mask); }
161}
162
163
164void TofHitStatus::setCluster( bool cluster ) {
165 m_cluster = cluster;
166 if( cluster ) { m_status |= Cluster_Mask; }
167 else { m_status &= (~Cluster_Mask); }
168}
169
170
171void TofHitStatus::setBarrel( bool barrel ) {
172 m_barrel = barrel;
173 if( barrel ) { m_status |= Barrel_Mask; }
174 else { m_status &= (~Barrel_Mask); }
175}
176
177
178void TofHitStatus::setEast( bool east ) {
179 m_east = east;
180 if( east ) { m_status |= East_Mask; }
181 else { m_status &= (~East_Mask); }
182}
183
184
185void TofHitStatus::setLayer( unsigned int layer ) {
186 assert(layer<=3);
187 m_layer = layer;
188 m_status |= (layer << Layer_Index);
189}
190
191
192void TofHitStatus::setOverflow( bool overflow ) {
193 m_overflow = overflow;
194 if( overflow ) { m_status |= Overflow_Mask; }
195 else { m_status &= (~Overflow_Mask); }
196}
197
198
199void TofHitStatus::setMultihit( bool multihit ) {
200 m_multihit = multihit;
201 if( multihit ) { m_status |= Multihit_Mask; }
202 else { m_status &= (~Multihit_Mask); }
203}
204
205
206void TofHitStatus::setNCounter( unsigned int ncounter ) {
207 if( m_barrel ) assert(ncounter<=176);
208 else assert(ncounter<=96);
209 m_ncounter = ncounter;
210 m_status |= (ncounter << Ncounter_Index);
211}
212
213
214void TofHitStatus::setNEast( unsigned int neast ) {
215 if( m_barrel ) assert(neast<=176);
216 else assert(neast<=96);
217 m_neast = neast;
218 m_status |= (neast << Neast_Index);
219}
220
221
222void TofHitStatus::setNWest( unsigned int nwest ) {
223 if( m_barrel ) assert(nwest<=176);
224 else assert(nwest<=96);
225 m_nwest = nwest;
226 m_status |= (nwest << Nwest_Index);
227}
228
229
230void TofHitStatus::setBarrelCluster( unsigned int layer ) {
231 TofHitStatus::setRaw( false );
236
237 if( layer == 3 ) {
240 TofHitStatus::setEast( false );
245 }
246 else if( layer == 1 || layer == 2 ) {
249 TofHitStatus::setEast( false );
254 }
255 else if( layer == 11 || layer == 12 || layer == 21 || layer == 22 ) {
259 if( layer%10 == 1 ) {
260 TofHitStatus::setEast( true );
263 }
264 else {
265 TofHitStatus::setEast( false );
268 }
269 if( static_cast<int>(layer/10) == 1 ) {
271 }
272 else {
274 }
275 }
276 else{
277 cout << "TofRec TofHitStatus::setBarrelCounter layer = " << layer << endl;
278 return;
279 }
280
281 return;
282}
283
284
285void TofHitStatus::setBarrelCounter( unsigned int layer ) {
286
287 TofHitStatus::setRaw( false );
293
294 if( layer == 1 || layer == 2 ) {
296 TofHitStatus::setEast( false );
301 }
302 if( layer == 11 || layer == 12 || layer == 21 || layer == 22 ) {
305 if( layer%10 == 1 ) {
306 TofHitStatus::setEast( true );
309 }
310 else {
311 TofHitStatus::setEast( false );
314 }
315 if( static_cast<int>(layer/10) == 1 ) {
317 }
318 else {
320 }
321 }
322
323 return;
324}
325
326
327void TofHitStatus::setBarrelReadout( unsigned int layer, bool east ) {
328 TofHitStatus::setRaw( false );
333 TofHitStatus::setEast( east );
338 if( east ){
341 }
342 else{
345 }
346 return;
347}
348
349
350void TofHitStatus::setBarrelRaw( unsigned int layer, bool east ) {
351 TofHitStatus::setRaw( true );
356 TofHitStatus::setEast( east );
361 if( east ){
364 }
365 else{
368 }
369 return;
370}
371
372
374 TofHitStatus::setRaw( false );
379 TofHitStatus::setEast( east );
386 return;
387}
388
389
390void TofHitStatus::setEndcapRaw( bool east ) {
391 TofHitStatus::setRaw( true );
396 TofHitStatus::setEast( east );
403 return;
404}
405
406
408 TofHitStatus::setRaw( true );
413 TofHitStatus::setEast( false );
420 return;
421}
void setBarrelReadout(unsigned int layer, bool east)
void setStatus(unsigned int status)
void setNWest(unsigned int nwest)
void setLayer(unsigned int layer)
void setCounter(bool counter)
void setMultihit(bool multihit)
void setBarrel(bool barrel)
void setBarrelRaw(unsigned int layer, bool east)
void setCluster(bool cluster)
void setEast(bool east)
void setOverflow(bool overflow)
void setNCounter(unsigned int ncounter)
void setEndcapRaw(bool east)
void setEndcapCluster(bool east)
void setNEast(unsigned int neast)
void setBarrelCounter(unsigned int layer)
TofHitStatus & operator=(const DstTofTrack &source)
void setBarrelCluster(unsigned int layer)
void setReadout(bool readout)
void setRaw(bool raw)