BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
TofHitStatus.cxx
Go to the documentation of this file.
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 m_mrpc = false;
20}
21
22
24 m_status = 0;
25 m_raw = false;
26 m_readout = false;
27 m_counter = false;
28 m_cluster = false;
29 m_barrel = false;
30 m_east = false;
31 m_layer = 0;
32 m_overflow = false;
33 m_multihit = false;
34 m_ncounter = 0;
35 m_neast = 0;
36 m_nwest = 0;
37 m_mrpc = false;
38}
39
40
43 m_status = source.status();
44 m_raw = ((m_status & Raw_Mask) >> Raw_Index ) ? true : false;
45 m_readout = ((m_status & Readout_Mask) >> Readout_Index ) ? true : false;
46 m_counter = ((m_status & Counter_Mask) >> Counter_Index ) ? true : false;
47 m_cluster = ((m_status & Cluster_Mask) >> Cluster_Index ) ? true : false;
48 m_barrel = ((m_status & Barrel_Mask) >> Barrel_Index ) ? true : false;
49 m_east = ((m_status & East_Mask) >> East_Index ) ? true : false;
50 m_layer = (m_status & Layer_Mask) >> Layer_Index;
51 m_overflow = ((m_status & Overflow_Mask) >> Overflow_Index ) ? true : false;
52 m_multihit = ((m_status & Multihit_Mask) >> Multihit_Index ) ? true : false;
53 m_ncounter = (m_status >> Ncounter_Index ) & N_Mask;
54 m_neast = (m_status >> Neast_Index ) & N_Mask;
55 m_nwest = (m_status >> Nwest_Index ) & N_Mask;
56 m_mrpc = ((m_status & MRPC_Mask) >> MRPC_Index ) ? true : false;
57
58 return *this;
59}
60
61
64 m_status = source.m_status;
65 return *this;
66}
67
68
69bool TofHitStatus::is_raw( unsigned int status ) {
70 return ((status & Raw_Mask) >> Raw_Index ) ? true : false;
71}
72
73
74bool TofHitStatus::is_readout( unsigned int status ) {
75 return ((status & Readout_Mask) >> Readout_Index ) ? true : false;
76}
77
78
79bool TofHitStatus::is_counter( unsigned int status ) {
80 return ((status & Counter_Mask) >> Counter_Index ) ? true : false;
81}
82
83
84bool TofHitStatus::is_cluster( unsigned int status ) {
85 return ((status & Cluster_Mask) >> Cluster_Index ) ? true : false;
86}
87
88
89bool TofHitStatus::is_barrel( unsigned int status ) {
90 return ((status & Barrel_Mask) >> Barrel_Index ) ? true : false;
91}
92
93
94bool TofHitStatus::is_east( unsigned int status ) {
95 return ((status & East_Mask) >> East_Index ) ? true : false;
96}
97
98
99unsigned int TofHitStatus::layer( unsigned int status ) {
100 return (status & Layer_Mask) >> Layer_Index;
101}
102
103
104bool TofHitStatus::is_overflow( unsigned int status ) {
105 return ((status & Overflow_Mask) >> Overflow_Index ) ? true : false;
106}
107
108
109bool TofHitStatus::is_multihit( unsigned int status ) {
110 return ((status & Multihit_Mask) >> Multihit_Index ) ? true : false;
111}
112
113
114unsigned int TofHitStatus::ncounter( unsigned int status ) {
115 return (status >> Ncounter_Index ) & N_Mask;
116}
117
118
119unsigned int TofHitStatus::neast( unsigned int status ) {
120 return (status >> Neast_Index ) & N_Mask;
121}
122
123
124unsigned int TofHitStatus::nwest( unsigned int status ) {
125 return (status >> Nwest_Index ) & N_Mask;
126}
127
128
129bool TofHitStatus::is_mrpc( unsigned int status ) {
130 return ((status & MRPC_Mask) >> MRPC_Index ) ? true : false;
131}
132
133
134void TofHitStatus::setStatus( unsigned int status ) {
135 m_status = status;
136 m_raw = ((m_status & Raw_Mask) >> Raw_Index ) ? true : false;
137 m_readout = ((m_status & Readout_Mask) >> Readout_Index ) ? true : false;
138 m_counter = ((m_status & Counter_Mask) >> Counter_Index ) ? true : false;
139 m_cluster = ((m_status & Cluster_Mask) >> Cluster_Index ) ? true : false;
140 m_barrel = ((m_status & Barrel_Mask) >> Barrel_Index ) ? true : false;
141 m_east = ((m_status & East_Mask) >> East_Index ) ? true : false;
142 m_layer = (m_status & Layer_Mask) >> Layer_Index;
143 m_overflow = ((m_status & Overflow_Mask) >> Overflow_Index ) ? true : false;
144 m_multihit = ((m_status & Multihit_Mask) >> Multihit_Index ) ? true : false;
145 m_ncounter = (m_status >> Ncounter_Index ) & N_Mask;
146 m_neast = (m_status >> Neast_Index ) & N_Mask;
147 m_nwest = (m_status >> Nwest_Index ) & N_Mask;
148 m_mrpc = ((m_status & MRPC_Mask) >> MRPC_Index ) ? true : false;
149}
150
151
152void TofHitStatus::setRaw( bool raw ) {
153 m_raw = raw;
154 if( raw ) { m_status |= Raw_Mask; }
155 else { m_status &= (~Raw_Mask); }
156}
157
158
159void TofHitStatus::setReadout( bool readout ) {
160 m_readout = readout;
161 if( readout ) { m_status |= Readout_Mask; }
162 else { m_status &= (~Readout_Mask); }
163}
164
165
166void TofHitStatus::setCounter( bool counter ) {
167 m_counter = counter;
168 if( counter ) { m_status |= Counter_Mask; }
169 else { m_status &= (~Counter_Mask); }
170}
171
172
173void TofHitStatus::setCluster( bool cluster ) {
174 m_cluster = cluster;
175 if( cluster ) { m_status |= Cluster_Mask; }
176 else { m_status &= (~Cluster_Mask); }
177}
178
179
180void TofHitStatus::setBarrel( bool barrel ) {
181 m_barrel = barrel;
182 if( barrel ) { m_status |= Barrel_Mask; }
183 else { m_status &= (~Barrel_Mask); }
184}
185
186
187void TofHitStatus::setEast( bool east ) {
188 m_east = east;
189 if( east ) { m_status |= East_Mask; }
190 else { m_status &= (~East_Mask); }
191}
192
193
194void TofHitStatus::setLayer( unsigned int layer ) {
195 assert(layer<=3);
196 m_layer = layer;
197 m_status |= (layer << Layer_Index);
198}
199
200
201void TofHitStatus::setOverflow( bool overflow ) {
202 m_overflow = overflow;
203 if( overflow ) { m_status |= Overflow_Mask; }
204 else { m_status &= (~Overflow_Mask); }
205}
206
207
208void TofHitStatus::setMultihit( bool multihit ) {
209 m_multihit = multihit;
210 if( multihit ) { m_status |= Multihit_Mask; }
211 else { m_status &= (~Multihit_Mask); }
212}
213
214
215void TofHitStatus::setNCounter( unsigned int ncounter ) {
216 if( m_barrel ) assert(ncounter<=176);
217 else assert(ncounter<=96);
218 m_ncounter = ncounter;
219 m_status |= (ncounter << Ncounter_Index);
220}
221
222
223void TofHitStatus::setNEast( unsigned int neast ) {
224 if( m_barrel ) assert(neast<=176);
225 else assert(neast<=96);
226 m_neast = neast;
227 m_status |= (neast << Neast_Index);
228}
229
230
231void TofHitStatus::setNWest( unsigned int nwest ) {
232 if( m_barrel ) assert(nwest<=176);
233 else assert(nwest<=96);
234 m_nwest = nwest;
235 m_status |= (nwest << Nwest_Index);
236}
237
238
239void TofHitStatus::setMRPC( bool mrpc ) {
240 m_mrpc = mrpc;
241 if( mrpc ) { m_status |= MRPC_Mask; }
242 else { m_status &= (~MRPC_Mask); }
243}
244
245
246void TofHitStatus::setBarrelCluster( unsigned int layer ) {
247 TofHitStatus::setRaw( false );
252
253 if( layer == 3 ) {
256 TofHitStatus::setEast( false );
261 }
262 else if( layer == 1 || layer == 2 ) {
265 TofHitStatus::setEast( false );
270 }
271 else if( layer == 11 || layer == 12 || layer == 21 || layer == 22 ) {
275 if( layer%10 == 1 ) {
276 TofHitStatus::setEast( true );
279 }
280 else {
281 TofHitStatus::setEast( false );
284 }
285 if( static_cast<int>(layer/10) == 1 ) {
287 }
288 else {
290 }
291 }
292 else{
293 cout << "TofRec TofHitStatus::setBarrelCounter layer = " << layer << endl;
294 return;
295 }
296 TofHitStatus::setMRPC( false );
297
298 return;
299}
300
301
302void TofHitStatus::setBarrelCounter( unsigned int layer ) {
303
304 TofHitStatus::setRaw( false );
310
311 if( layer == 1 || layer == 2 ) {
313 TofHitStatus::setEast( false );
318 }
319 if( layer == 11 || layer == 12 || layer == 21 || layer == 22 ) {
322 if( layer%10 == 1 ) {
323 TofHitStatus::setEast( true );
326 }
327 else {
328 TofHitStatus::setEast( false );
331 }
332 if( static_cast<int>(layer/10) == 1 ) {
334 }
335 else {
337 }
338 }
339 TofHitStatus::setMRPC( false );
340
341 return;
342}
343
344
345void TofHitStatus::setBarrelReadout( unsigned int layer, bool east ) {
346 TofHitStatus::setRaw( false );
351 TofHitStatus::setEast( east );
356 if( east ){
359 }
360 else{
363 }
364 TofHitStatus::setMRPC( false );
365 return;
366}
367
368
369void TofHitStatus::setBarrelRaw( unsigned int layer, bool east ) {
370 TofHitStatus::setRaw( true );
375 TofHitStatus::setEast( east );
380 if( east ){
383 }
384 else{
387 }
388 TofHitStatus::setMRPC( false );
389 return;
390}
391
392
394 TofHitStatus::setRaw( false );
399 TofHitStatus::setEast( east );
406 TofHitStatus::setMRPC( false );
407 return;
408}
409
410
411void TofHitStatus::setEndcapRaw( bool east ) {
412 TofHitStatus::setRaw( true );
417 TofHitStatus::setEast( east );
424 TofHitStatus::setMRPC( false );
425 return;
426}
427
428
430 TofHitStatus::setRaw( false );
435 TofHitStatus::setEast( east );
440 if( east ) {
443 }
444 else {
447 }
448 TofHitStatus::setMRPC( true );
449 return;
450}
451
452
453void TofHitStatus::setMRPCCluster( bool cluster, bool east ) {
454 TofHitStatus::setRaw( false );
455 if( cluster ) {
457 }
458 else {
460 }
464 TofHitStatus::setEast( east );
468 if( cluster ) {
472 }
473 else {
475 if( east ) {
478 }
479 else {
482 }
483 }
484 TofHitStatus::setMRPC( true );
485 return;
486}
487
488
490 TofHitStatus::setRaw( true );
495 TofHitStatus::setEast( false );
502 TofHitStatus::setMRPC( false );
503 return;
504}
unsigned int status() const
Definition: DstTofTrack.h:45
bool is_barrel() const
Definition: TofHitStatus.h:26
void setMRPCReadout(bool east)
unsigned int ncounter() const
Definition: TofHitStatus.h:31
void setMRPC(bool mrpc)
unsigned int layer() const
Definition: TofHitStatus.h:28
void setMRPCCluster(bool cluster, bool east)
bool is_cluster() const
Definition: TofHitStatus.h:25
void setBarrelReadout(unsigned int layer, bool east)
void setStatus(unsigned int status)
void setNWest(unsigned int nwest)
bool is_multihit() const
Definition: TofHitStatus.h:30
bool is_overflow() const
Definition: TofHitStatus.h:29
void setLayer(unsigned int layer)
void setCounter(bool counter)
void setMultihit(bool multihit)
void setBarrel(bool barrel)
unsigned int nwest() const
Definition: TofHitStatus.h:33
bool is_mrpc() const
Definition: TofHitStatus.h:34
void setBarrelRaw(unsigned int layer, bool east)
bool is_counter() const
Definition: TofHitStatus.h:24
void setCluster(bool cluster)
void setEast(bool east)
void setOverflow(bool overflow)
bool is_east() const
Definition: TofHitStatus.h:27
bool is_readout() const
Definition: TofHitStatus.h:23
unsigned int neast() const
Definition: TofHitStatus.h:32
void setNCounter(unsigned int ncounter)
void setEndcapRaw(bool east)
void setEndcapCluster(bool east)
bool is_raw() const
Definition: TofHitStatus.h:22
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)