27MdcTSF* MdcTSF::mdc_Pointer=0;
29 if(!mdc_Pointer) mdc_Pointer =
new MdcTSF();
43 std::vector<int> vtmp;
47 for(std::vector<int>::iterator
iter = vmdcHit.begin();
iter != vmdcHit.end();
iter += 2)
50 int wire = *(
iter + 1);
51 if(layer<=19) { vtmp.push_back(layer); vtmp.push_back(wire); }
52 if(layer>=36&&layer<=39)
55 vtmp.push_back(layer);
61 for(std::vector<int>::iterator
iter = vtmp.begin();
iter != vtmp.end();
iter += 2) {
62 bool ifsamelem =
false;
63 int layerId = *(
iter);
64 int cellId = *(
iter+1);
65 for(std::vector<int>::iterator iter_tmp =
iter; iter_tmp != vtmp.end(); iter_tmp += 2) {
66 if((iter_tmp+2) != vtmp.end()) {
67 int layerId_tmp = *(iter_tmp+2);
68 int cellId_tmp = *(iter_tmp+3);
69 if((layerId == layerId_tmp) && (cellId == cellId_tmp)) ifsamelem =
true;
72 if(ifsamelem ==
false) {
73 digiId.push_back(layerId);
74 digiId.push_back(cellId);
86 SL1PivotCellHit[i] = 0;
90 SL1HitCount[i][j] = 0;
96 SL2PivotCellHit[i] = 0;
100 SL2HitCount[i][j] = 0;
104 for(
int i=0;i<88;i++)
106 SL3PivotCellHit[i] = 0;
108 for(
int j=0;j<16;j++)
110 SL3HitCount[i][j] = 0;
114 for(
int i=0;i<112;i++)
116 SL4PivotCellHit[i] = 0;
118 for(
int j=0;j<22;j++)
120 SL4HitCount[i][j] = 0;
124 for(
int i=0;i<128;i++)
126 SL5PivotCellHit[i] = 0;
128 for(
int j=0;j<31;j++)
130 SL5HitCount[i][j] = 0;
134 for(
int i=0;i<128;i++)
136 SL10PivotCellHit[i] = 0;
138 for(
int j=0;j<81;j++)
140 SL10HitCount[i][j] = 0;
146 int layer,cell,superlayer,ln;
148 for(std::vector<int>::iterator
iter=digiId.begin();
iter!=digiId.end();
iter+=2)
154 superlayer = (int) layer/4+1;
158 if(ln==2) SL1PivotCellHit[cell] = 1;
159 for(
unsigned int i = 0;i < SL1.size(); i++)
161 for(
unsigned int j = 0; j < SL1[i].size()/4; j++) {
162 if(SL1[i][3-ln+j*4] == cell+1) SL1HitCount[i][j] += 1;
169 if(ln==2) SL2PivotCellHit[cell] = 1;
170 for(
unsigned int i = 0;i < SL2.size(); i++)
172 for(
unsigned int j = 0; j < SL2[i].size()/4; j++) {
173 if(SL2[i][3-ln+j*4] == cell+1) SL2HitCount[i][j] += 1;
180 if(ln==2) SL3PivotCellHit[cell] = 1;
181 for(
unsigned int i = 0;i < SL3.size(); i++)
183 for(
unsigned int j = 0; j < SL3[i].size()/4; j++) {
184 if(SL3[i][3-ln+j*4] == cell+1) SL3HitCount[i][j] += 1;
191 if(ln==2) SL4PivotCellHit[cell] = 1;
192 for(
unsigned int i = 0;i < SL4.size(); i++)
194 for(
unsigned int j = 0; j < SL4[i].size()/4; j++) {
195 if(SL4[i][3-ln+j*4] == cell+1) SL4HitCount[i][j] += 1;
202 if(ln==1) SL5PivotCellHit[cell] = 1;
203 for(
unsigned int i = 0;i < SL5.size(); i++)
205 for(
unsigned int j = 0; j < SL5[i].size()/4; j++) {
206 if(SL5[i][3-ln+j*4] == cell+1) SL5HitCount[i][j] += 1;
213 superlayer = (int) layer/4+1;
215 if(ln==1) SL10PivotCellHit[cell] = 1;
216 for(
unsigned int i = 0;i < SL10.size(); i++)
218 for(
unsigned int j = 0; j < SL10[i].size()/4; j++) {
219 if(SL10[i][3-ln+j*4] == cell+1) SL10HitCount[i][j] += 1;
229 for(
int i=0; i<48; i++)
230 for(
int j=0; j<8; j++)
232 if(SL1HitCount[i][j] >= 3) { SL1TSF[i] = 1;
break; }
235 for(
int i=0; i<80; i++)
236 for(
int j=0; j<12; j++)
238 if(SL2HitCount[i][j] >= 3) { SL2TSF[i] = 1;
break; }
241 for(
int i = 0; i < 88; i++)
242 for(
int j = 0; j < 16; j++)
244 if(SL3HitCount[i][j] >= 3) { SL3TSF[i] = 1;
break; }
247 for(
int i = 0; i < 112; i++)
248 for(
int j = 0; j < 22; j++)
250 if(SL4HitCount[i][j] >= 3) { SL4TSF[i] = 1;
break; }
253 for(
int i = 0; i < 128; i++)
254 for(
int j = 0; j < 31; j++)
256 if(SL5HitCount[i][j] >= 3) { SL5TSF[i] = 1;
break; }
259 for(
int i = 0; i < 128; i++)
260 for(
int j = 0; j < 81; j++)
262 if(SL10HitCount[i][j] >= 3) { SL10TSF[i] = 1;
break; }
284 if(
n==1) { ncell=48; pl=3; }
285 if(
n==2) { ncell=80; pl=7; }
286 if(
n==3) { ncell=88; pl=11; }
287 if(
n==4) { ncell=112; pl=15; }
288 if(
n==5) { ncell=128; pl=18; }
290 for(
int i=1;i<(ncell+1);i++)
292 std::vector<int> tmp;
295 TString filename = TString(getenv(
"TRIGGERROOT" ));
296 filename+=
"/data/tsf";
306 readin.open(filename,ios_base::in);
307 if(!readin) cerr<<
"can not open the file "<<filename<<endl;
310 readin>>a>>
b>>l4>>l3>>l2>>l1;
315 readin.open(filename,ios_base::in);
316 if(!readin) cerr<<
"can not open the file again "<<filename<<endl;
317 for(
int j=0;j<(
num-1);j++)
319 readin>>a>>
b>>l4>>l3>>l2>>l1;
326 if(
n==1) SL1.push_back(tmp);
327 if(
n==2) SL2.push_back(tmp);
328 if(
n==3) SL3.push_back(tmp);
329 if(
n==4) SL4.push_back(tmp);
330 if(
n==5) SL5.push_back(tmp);
333 for(
int i=1;i<129;i++)
335 std::vector<int> tmp1;
339 TString filename = TString(getenv(
"TRIGGERROOT" ));
340 filename+=
"/data/tsf10C/TSF-SL10C-L38-C";
344 readin.open(filename,ios_base::in);
345 if(!readin) cerr<<
"can not open the file "<<filename<<endl;
348 readin>>a>>
b>>l4>>l3>>l2>>l1;
353 readin.open(filename,ios_base::in);
354 if(!readin) cerr<<
"can not open the file again "<<filename<<endl;
356 for(
int j=0;j<(
num-1);j++)
358 readin>>a>>
b>>l4>>l3>>l2>>l1;
365 SL10.push_back(tmp1);
370 std::vector<int> combine_size;
372 cout<<
" ***************check data file tsf: ***************** "<<endl;
373 cout<<
"*--------------------------BEGIN-------------------------------*"<<endl;
376 cout<<
" -------------------SL1---------------------- "<<endl;
377 combine_size.clear();
378 for(
unsigned int i=0; i<SL1.size(); i++) {
379 cout<<
"Cell ID --> "<<i<<endl;
380 combine_size.push_back(SL1[i].size());
381 for(
unsigned int j=0; j<SL1[i].size(); j++) {
382 cout<<SL1[i][j]<<
" ";
383 if((j+1)%4==0) cout<<endl;
387 sort(combine_size.begin(),combine_size.end());
388 cout<<
"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl;
391 cout<<
" -------------------SL2---------------------- "<<endl;
392 combine_size.clear();
393 for(
unsigned int i=0; i<SL2.size(); i++) {
394 cout<<
"Cell ID --> "<<i<<endl;
395 combine_size.push_back(SL2[i].size());
396 for(
unsigned int j=0; j<SL2[i].size(); j++) {
397 cout<<SL2[i][j]<<
" ";
398 if((j+1)%4==0) cout<<endl;
402 sort(combine_size.begin(),combine_size.end());
403 cout<<
"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl;
406 cout<<
" -------------------SL3---------------------- "<<endl;
407 combine_size.clear();
408 for(
unsigned int i=0; i<SL3.size(); i++) {
409 cout<<
"Cell ID --> "<<i<<endl;
410 combine_size.push_back(SL3[i].size());
411 for(
unsigned int j=0; j<SL3[i].size(); j++) {
412 cout<<SL3[i][j]<<
" ";
413 if((j+1)%4==0) cout<<endl;
417 sort(combine_size.begin(),combine_size.end());
418 cout<<
"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl;
421 cout<<
" -------------------SL4---------------------- "<<endl;
422 combine_size.clear();
423 for(
unsigned int i=0; i<SL4.size(); i++) {
424 cout<<
"Cell ID --> "<<i<<endl;
425 combine_size.push_back(SL4[i].size());
426 for(
unsigned int j=0; j<SL4[i].size(); j++) {
427 cout<<SL4[i][j]<<
" ";
428 if((j+1)%4==0) cout<<endl;
432 sort(combine_size.begin(),combine_size.end());
433 cout<<
"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl;
436 cout<<
" -------------------SL5---------------------- "<<endl;
437 combine_size.clear();
438 for(
unsigned int i=0; i<SL5.size(); i++) {
439 cout<<
"Cell ID --> "<<i<<endl;
440 combine_size.push_back(SL5[i].size());
441 for(
unsigned int j=0; j<SL5[i].size(); j++) {
442 cout<<SL5[i][j]<<
" ";
443 if((j+1)%4==0) cout<<endl;
447 sort(combine_size.begin(),combine_size.end());
448 cout<<
"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl;
451 cout<<
" -------------------SL10---------------------- "<<endl;
452 combine_size.clear();
453 for(
unsigned int i=0; i<SL10.size(); i++) {
454 cout<<
"Cell ID --> "<<i<<endl;
455 combine_size.push_back(SL10[i].size());
456 for(
unsigned int j=0; j<SL10[i].size(); j++) {
457 cout<<SL10[i][j]<<
" ";
458 if((j+1)%4==0) cout<<endl;
462 sort(combine_size.begin(),combine_size.end());
463 cout<<
"The Max Number of Combination is "<<combine_size[combine_size.size()-1]/4<<endl;
466 cout<<
"*---------------------------END------------------------------*"<<endl;
static MdcTSF * get_Mdc(void)
void setMdcDigi(std::vector< int > &vmdcHit)