BOSS 8.0.0
BESIII Offline Software System
Loading...
Searching...
No Matches
MdcTSF Class Reference

#include <MdcTSF.h>

Public Member Functions

 MdcTSF ()
 ~MdcTSF ()
void setMdcDigi (std::vector< int > &vmdcHit)
void CountTS ()
void GetTS ()
void ReadLut ()
void Dump ()
int GetSL1TSF (int i)
int GetSL2TSF (int i)
int GetSL3TSF (int i)
int GetSL4TSF (int i)
int GetSL5TSF (int i)
int GetSL10TSF (int i)

Static Public Member Functions

static MdcTSFget_Mdc (void)

Detailed Description

Definition at line 6 of file MdcTSF.h.

Constructor & Destructor Documentation

◆ MdcTSF()

MdcTSF::MdcTSF ( )

Definition at line 33 of file MdcTSF.cxx.

33 {
34 ReadLut();
35 // Dump();
36}
void ReadLut()
Definition MdcTSF.cxx:281

Referenced by get_Mdc().

◆ ~MdcTSF()

MdcTSF::~MdcTSF ( )

Definition at line 37 of file MdcTSF.cxx.

37{}

Member Function Documentation

◆ CountTS()

void MdcTSF::CountTS ( )

Definition at line 83 of file MdcTSF.cxx.

83 {
84 //============================reset each array======================================
85 // super layer one
86 for ( int i = 0; i < 48; i++ )
87 {
88 SL1PivotCellHit[i] = 0;
89 SL1TSF[i] = 0;
90 for ( int j = 0; j < 8; j++ ) { SL1HitCount[i][j] = 0; }
91 }
92 // super layer two
93 for ( int i = 0; i < 80; i++ )
94 {
95 SL2PivotCellHit[i] = 0;
96 SL2TSF[i] = 0;
97 for ( int j = 0; j < 12; j++ ) { SL2HitCount[i][j] = 0; }
98 }
99 // super layer three
100 for ( int i = 0; i < 88; i++ )
101 {
102 SL3PivotCellHit[i] = 0;
103 SL3TSF[i] = 0;
104 for ( int j = 0; j < 16; j++ ) { SL3HitCount[i][j] = 0; }
105 }
106 // super layer four
107 for ( int i = 0; i < 112; i++ )
108 {
109 SL4PivotCellHit[i] = 0;
110 SL4TSF[i] = 0;
111 for ( int j = 0; j < 22; j++ ) { SL4HitCount[i][j] = 0; }
112 }
113 // super layer five
114 for ( int i = 0; i < 128; i++ )
115 {
116 SL5PivotCellHit[i] = 0;
117 SL5TSF[i] = 0;
118 for ( int j = 0; j < 31; j++ ) { SL5HitCount[i][j] = 0; }
119 }
120 // super layer ten
121 for ( int i = 0; i < 128; i++ )
122 {
123 SL10PivotCellHit[i] = 0;
124 SL10TSF[i] = 0;
125 for ( int j = 0; j < 81; j++ ) { SL10HitCount[i][j] = 0; }
126 }
127 //=================================== end reset value ===================================
128
129 //============ counting the hit number in each super layer for each combination ========
130 int layer, cell, superlayer, ln;
131
132 for ( std::vector<int>::iterator iter = digiId.begin(); iter != digiId.end(); iter += 2 )
133 {
134 layer = *iter;
135 cell = *( iter + 1 );
136 if ( layer <= 19 )
137 {
138 superlayer = (int)layer / 4 + 1;
139 ln = layer % 4;
140 if ( superlayer == 1 )
141 {
142 if ( ln == 2 ) SL1PivotCellHit[cell] = 1;
143 for ( unsigned int i = 0; i < SL1.size(); i++ )
144 {
145 for ( unsigned int j = 0; j < SL1[i].size() / 4; j++ )
146 {
147 if ( SL1[i][3 - ln + j * 4] == cell + 1 ) SL1HitCount[i][j] += 1;
148 }
149 }
150 } // end super layer1
151
152 if ( superlayer == 2 )
153 {
154 if ( ln == 2 ) SL2PivotCellHit[cell] = 1;
155 for ( unsigned int i = 0; i < SL2.size(); i++ )
156 {
157 for ( unsigned int j = 0; j < SL2[i].size() / 4; j++ )
158 {
159 if ( SL2[i][3 - ln + j * 4] == cell + 1 ) SL2HitCount[i][j] += 1;
160 }
161 }
162 } // end super layer2
163
164 if ( superlayer == 3 )
165 {
166 if ( ln == 2 ) SL3PivotCellHit[cell] = 1;
167 for ( unsigned int i = 0; i < SL3.size(); i++ )
168 {
169 for ( unsigned int j = 0; j < SL3[i].size() / 4; j++ )
170 {
171 if ( SL3[i][3 - ln + j * 4] == cell + 1 ) SL3HitCount[i][j] += 1;
172 }
173 }
174 } // end super layer3
175
176 if ( superlayer == 4 )
177 {
178 if ( ln == 2 ) SL4PivotCellHit[cell] = 1;
179 for ( unsigned int i = 0; i < SL4.size(); i++ )
180 {
181 for ( unsigned int j = 0; j < SL4[i].size() / 4; j++ )
182 {
183 if ( SL4[i][3 - ln + j * 4] == cell + 1 ) SL4HitCount[i][j] += 1;
184 }
185 }
186 } // end super layer4
187
188 if ( superlayer == 5 )
189 {
190 if ( ln == 1 ) SL5PivotCellHit[cell] = 1;
191 for ( unsigned int i = 0; i < SL5.size(); i++ )
192 {
193 for ( unsigned int j = 0; j < SL5[i].size() / 4; j++ )
194 {
195 if ( SL5[i][3 - ln + j * 4] == cell + 1 ) SL5HitCount[i][j] += 1;
196 }
197 }
198 } // end super layer5
199 }
200 else
201 {
202 superlayer = (int)layer / 4 + 1;
203 ln = layer % 4;
204 if ( ln == 1 ) SL10PivotCellHit[cell] = 1;
205 for ( unsigned int i = 0; i < SL10.size(); i++ )
206 {
207 for ( unsigned int j = 0; j < SL10[i].size() / 4; j++ )
208 {
209 if ( SL10[i][3 - ln + j * 4] == cell + 1 ) SL10HitCount[i][j] += 1;
210 }
211 }
212 } // end super layer10
213 }
214}
EvtStreamInputIterator< typename Generator::result_type > iter(Generator gen, int N=0)

Referenced by GetTS().

◆ Dump()

void MdcTSF::Dump ( )

Definition at line 397 of file MdcTSF.cxx.

397 {
398 std::vector<int> combine_size;
399 cout << endl;
400 cout << " ***************check data file tsf: ***************** " << endl;
401 cout << "*--------------------------BEGIN-------------------------------*" << endl;
402 cout << endl;
403
404 cout << " -------------------SL1---------------------- " << endl;
405 combine_size.clear();
406 for ( unsigned int i = 0; i < SL1.size(); i++ )
407 {
408 cout << "Cell ID --> " << i << endl;
409 combine_size.push_back( SL1[i].size() );
410 for ( unsigned int j = 0; j < SL1[i].size(); j++ )
411 {
412 cout << SL1[i][j] << " ";
413 if ( ( j + 1 ) % 4 == 0 ) cout << endl;
414 }
415 cout << endl;
416 }
417 sort( combine_size.begin(), combine_size.end() );
418 cout << "The Max Number of Combination is " << combine_size[combine_size.size() - 1] / 4
419 << endl;
420 cout << endl;
421
422 cout << " -------------------SL2---------------------- " << endl;
423 combine_size.clear();
424 for ( unsigned int i = 0; i < SL2.size(); i++ )
425 {
426 cout << "Cell ID --> " << i << endl;
427 combine_size.push_back( SL2[i].size() );
428 for ( unsigned int j = 0; j < SL2[i].size(); j++ )
429 {
430 cout << SL2[i][j] << " ";
431 if ( ( j + 1 ) % 4 == 0 ) cout << endl;
432 }
433 cout << endl;
434 }
435 sort( combine_size.begin(), combine_size.end() );
436 cout << "The Max Number of Combination is " << combine_size[combine_size.size() - 1] / 4
437 << endl;
438 cout << endl;
439
440 cout << " -------------------SL3---------------------- " << endl;
441 combine_size.clear();
442 for ( unsigned int i = 0; i < SL3.size(); i++ )
443 {
444 cout << "Cell ID --> " << i << endl;
445 combine_size.push_back( SL3[i].size() );
446 for ( unsigned int j = 0; j < SL3[i].size(); j++ )
447 {
448 cout << SL3[i][j] << " ";
449 if ( ( j + 1 ) % 4 == 0 ) cout << endl;
450 }
451 cout << endl;
452 }
453 sort( combine_size.begin(), combine_size.end() );
454 cout << "The Max Number of Combination is " << combine_size[combine_size.size() - 1] / 4
455 << endl;
456 cout << endl;
457
458 cout << " -------------------SL4---------------------- " << endl;
459 combine_size.clear();
460 for ( unsigned int i = 0; i < SL4.size(); i++ )
461 {
462 cout << "Cell ID --> " << i << endl;
463 combine_size.push_back( SL4[i].size() );
464 for ( unsigned int j = 0; j < SL4[i].size(); j++ )
465 {
466 cout << SL4[i][j] << " ";
467 if ( ( j + 1 ) % 4 == 0 ) cout << endl;
468 }
469 cout << endl;
470 }
471 sort( combine_size.begin(), combine_size.end() );
472 cout << "The Max Number of Combination is " << combine_size[combine_size.size() - 1] / 4
473 << endl;
474 cout << endl;
475
476 cout << " -------------------SL5---------------------- " << endl;
477 combine_size.clear();
478 for ( unsigned int i = 0; i < SL5.size(); i++ )
479 {
480 cout << "Cell ID --> " << i << endl;
481 combine_size.push_back( SL5[i].size() );
482 for ( unsigned int j = 0; j < SL5[i].size(); j++ )
483 {
484 cout << SL5[i][j] << " ";
485 if ( ( j + 1 ) % 4 == 0 ) cout << endl;
486 }
487 cout << endl;
488 }
489 sort( combine_size.begin(), combine_size.end() );
490 cout << "The Max Number of Combination is " << combine_size[combine_size.size() - 1] / 4
491 << endl;
492 cout << endl;
493
494 cout << " -------------------SL10---------------------- " << endl;
495 combine_size.clear();
496 for ( unsigned int i = 0; i < SL10.size(); i++ )
497 {
498 cout << "Cell ID --> " << i << endl;
499 combine_size.push_back( SL10[i].size() );
500 for ( unsigned int j = 0; j < SL10[i].size(); j++ )
501 {
502 cout << SL10[i][j] << " ";
503 if ( ( j + 1 ) % 4 == 0 ) cout << endl;
504 }
505 cout << endl;
506 }
507 sort( combine_size.begin(), combine_size.end() );
508 cout << "The Max Number of Combination is " << combine_size[combine_size.size() - 1] / 4
509 << endl;
510 cout << endl;
511
512 cout << "*---------------------------END------------------------------*" << endl;
513}

◆ get_Mdc()

MdcTSF * MdcTSF::get_Mdc ( void )
static

Definition at line 28 of file MdcTSF.cxx.

28 {
29 if ( !mdc_Pointer ) mdc_Pointer = new MdcTSF();
30 return mdc_Pointer;
31}
MdcTSF()
Definition MdcTSF.cxx:33

Referenced by BesTrigL1::initialize(), and MdcTF::MdcTF().

◆ GetSL10TSF()

int MdcTSF::GetSL10TSF ( int i)
inline

Definition at line 24 of file MdcTSF.h.

24{ return SL10TSF[i]; }

◆ GetSL1TSF()

int MdcTSF::GetSL1TSF ( int i)
inline

Definition at line 19 of file MdcTSF.h.

19{ return SL1TSF[i]; }

◆ GetSL2TSF()

int MdcTSF::GetSL2TSF ( int i)
inline

Definition at line 20 of file MdcTSF.h.

20{ return SL2TSF[i]; }

◆ GetSL3TSF()

int MdcTSF::GetSL3TSF ( int i)
inline

Definition at line 21 of file MdcTSF.h.

21{ return SL3TSF[i]; }

◆ GetSL4TSF()

int MdcTSF::GetSL4TSF ( int i)
inline

Definition at line 22 of file MdcTSF.h.

22{ return SL4TSF[i]; }

◆ GetSL5TSF()

int MdcTSF::GetSL5TSF ( int i)
inline

Definition at line 23 of file MdcTSF.h.

23{ return SL5TSF[i]; }

◆ GetTS()

void MdcTSF::GetTS ( )

Definition at line 215 of file MdcTSF.cxx.

215 {
216 CountTS();
217 // find TSF in each super layer
218 for ( int i = 0; i < 48; i++ )
219 for ( int j = 0; j < 8; j++ )
220 {
221 if ( SL1HitCount[i][j] >= 3 )
222 {
223 SL1TSF[i] = 1;
224 break;
225 } // cout<<"SL1 cell id : "<<i<<endl; break; }
226 }
227
228 for ( int i = 0; i < 80; i++ )
229 for ( int j = 0; j < 12; j++ )
230 {
231 if ( SL2HitCount[i][j] >= 3 )
232 {
233 SL2TSF[i] = 1;
234 break;
235 } // cout<<"SL2 cell id : "<<i<<endl; break; }
236 }
237
238 for ( int i = 0; i < 88; i++ )
239 for ( int j = 0; j < 16; j++ )
240 {
241 if ( SL3HitCount[i][j] >= 3 )
242 {
243 SL3TSF[i] = 1;
244 break;
245 } // cout<<"SL3: "<<i<<endl; break; }
246 }
247
248 for ( int i = 0; i < 112; i++ )
249 for ( int j = 0; j < 22; j++ )
250 {
251 if ( SL4HitCount[i][j] >= 3 )
252 {
253 SL4TSF[i] = 1;
254 break;
255 } // cout<<"SL4: "<<i<<endl; break; }
256 }
257
258 for ( int i = 0; i < 128; i++ )
259 for ( int j = 0; j < 31; j++ )
260 {
261 if ( SL5HitCount[i][j] >= 3 )
262 {
263 SL5TSF[i] = 1;
264 break;
265 } // cout<<"SL5: "<<i<<endl; break; }
266 }
267
268 for ( int i = 0; i < 128; i++ )
269 for ( int j = 0; j < 81; j++ )
270 {
271 if ( SL10HitCount[i][j] >= 3 )
272 {
273 SL10TSF[i] = 1;
274 break;
275 } // cout<<"SL10 : "<<i<<endl; break; }
276 }
277
278 // combine the continuous TSF
279}
void CountTS()
Definition MdcTSF.cxx:83

◆ ReadLut()

void MdcTSF::ReadLut ( )

Definition at line 281 of file MdcTSF.cxx.

281 {
282 fstream readin;
283 int ncell = 0, pl = 0;
284 int a, b, l4, l3, l2, l1;
285 SL1.clear();
286 SL2.clear();
287 SL3.clear();
288 SL4.clear();
289 SL5.clear();
290 SL10.clear();
291 for ( int n = 1; n < 6; n++ )
292 {
293 if ( n == 1 )
294 {
295 ncell = 48;
296 pl = 3;
297 }
298 if ( n == 2 )
299 {
300 ncell = 80;
301 pl = 7;
302 }
303 if ( n == 3 )
304 {
305 ncell = 88;
306 pl = 11;
307 }
308 if ( n == 4 )
309 {
310 ncell = 112;
311 pl = 15;
312 }
313 if ( n == 5 )
314 {
315 ncell = 128;
316 pl = 18;
317 }
318
319 for ( int i = 1; i < ( ncell + 1 ); i++ )
320 {
321 std::vector<int> tmp;
322 tmp.clear();
323 int num = 0;
324 TString filename = TString( getenv( "TRIGGERROOT" ) );
325 filename += "/data/tsf";
326 filename += n;
327 filename += "/TSF-SL";
328 filename += n;
329 filename += "-L";
330 filename += pl;
331 filename += "-C";
332 filename += i;
333 filename += ".pat";
334 readin.clear();
335 readin.open( filename, ios_base::in );
336 if ( !readin ) cerr << "can not open the file " << filename << endl;
337 while ( readin.good() )
338 {
339 readin >> a >> b >> l4 >> l3 >> l2 >> l1;
340 num++;
341 }
342 readin.close();
343 readin.clear();
344 readin.open( filename, ios_base::in );
345 if ( !readin ) cerr << "can not open the file again " << filename << endl;
346 for ( int j = 0; j < ( num - 1 ); j++ )
347 {
348 readin >> a >> b >> l4 >> l3 >> l2 >> l1;
349 tmp.push_back( l4 );
350 tmp.push_back( l3 );
351 tmp.push_back( l2 );
352 tmp.push_back( l1 );
353 }
354 readin.close();
355 if ( n == 1 ) SL1.push_back( tmp );
356 if ( n == 2 ) SL2.push_back( tmp );
357 if ( n == 3 ) SL3.push_back( tmp );
358 if ( n == 4 ) SL4.push_back( tmp );
359 if ( n == 5 ) SL5.push_back( tmp );
360 }
361 }
362 for ( int i = 1; i < 129; i++ )
363 {
364 std::vector<int> tmp1;
365 tmp1.clear();
366 int num = 0;
367 // TString filename = "/ihepbatch/bes/caogf/data/tsf/tsf10C/TSF-SL10C-L38-C";
368 TString filename = TString( getenv( "TRIGGERROOT" ) );
369 filename += "/data/tsf10C/TSF-SL10C-L38-C";
370 filename += i;
371 filename += ".pat";
372 readin.clear();
373 readin.open( filename, ios_base::in );
374 if ( !readin ) cerr << "can not open the file " << filename << endl;
375 while ( readin.good() )
376 {
377 readin >> a >> b >> l4 >> l3 >> l2 >> l1;
378 num++;
379 }
380 readin.close();
381 readin.clear();
382 readin.open( filename, ios_base::in );
383 if ( !readin ) cerr << "can not open the file again " << filename << endl;
384
385 for ( int j = 0; j < ( num - 1 ); j++ )
386 {
387 readin >> a >> b >> l4 >> l3 >> l2 >> l1;
388 tmp1.push_back( l4 );
389 tmp1.push_back( l3 );
390 tmp1.push_back( l2 );
391 tmp1.push_back( l1 );
392 }
393 readin.close();
394 SL10.push_back( tmp1 );
395 }
396}
const Int_t n

Referenced by MdcTSF().

◆ setMdcDigi()

void MdcTSF::setMdcDigi ( std::vector< int > & vmdcHit)

Definition at line 38 of file MdcTSF.cxx.

38 {
39 std::vector<int> vtmp;
40 vtmp.clear();
41 digiId.clear();
42
43 for ( std::vector<int>::iterator iter = vmdcHit.begin(); iter != vmdcHit.end(); iter += 2 )
44 {
45 int layer = *iter;
46 int wire = *( iter + 1 );
47 if ( layer <= 19 )
48 {
49 vtmp.push_back( layer );
50 vtmp.push_back( wire );
51 }
52 if ( layer >= 36 && layer <= 39 )
53 {
54 wire = int( wire / 2 ); // combine neighbor two cells
55 vtmp.push_back( layer );
56 vtmp.push_back( wire );
57 }
58 }
59
60 // remove the same layer, same cell, because of combine in 10 super layer;
61 for ( std::vector<int>::iterator iter = vtmp.begin(); iter != vtmp.end(); iter += 2 )
62 {
63 bool ifsamelem = false;
64 int layerId = *( iter );
65 int cellId = *( iter + 1 );
66 for ( std::vector<int>::iterator iter_tmp = iter; iter_tmp != vtmp.end(); iter_tmp += 2 )
67 {
68 if ( ( iter_tmp + 2 ) != vtmp.end() )
69 {
70 int layerId_tmp = *( iter_tmp + 2 );
71 int cellId_tmp = *( iter_tmp + 3 );
72 if ( ( layerId == layerId_tmp ) && ( cellId == cellId_tmp ) ) ifsamelem = true;
73 }
74 }
75 if ( ifsamelem == false )
76 {
77 digiId.push_back( layerId );
78 digiId.push_back( cellId );
79 // std::cout<<"layer: "<<layerId<<" "<<"wire: "<<cellId<<std::endl;
80 }
81 }
82}

The documentation for this class was generated from the following files: