40 ISvcLocator* svcLocator = Gaudi::svcLocator();
41 StatusCode sc = svcLocator->service(
"BesGlobalTrigSvc", m_tmpSvc);
45 for(
int i=0; i<8; i++)
48 for(
int j=0; j<4; j++)
50 nfireLayerBR[i][j] = 0;
51 nhitLayerBR[i][j] = 0;
56 for(
int i=0; i<2; i++)
59 for(
int j=0; j<4; j++)
62 for(
int k=0; k<4; k++)
64 nfireLayerEC[i][j][k] = 0;
65 nhitLayerEC[i][j][k] = 0;
75 for(
int i=0; i<8; i++)
76 for(
int j=0; j<4; j++)
77 for(
int k=0; k<7; k++)
80 foBR[i][j][k] = m_MucTrigHit->
getfoBR(i, j, k);
81 if(foBR[i][j][k] == 1) {
82 nfireLayerBR[i][j] = 1;
87 int index = 1000 + i*100 + j*10 + k;
88 vIndex.push_back(index);
92 for(
int i=0; i<2; i++)
93 for(
int j=0; j<4; j++)
94 for(
int k=0; k<4; k++)
95 for(
int l=0; l<4; l++)
98 foEC[i][j][k][l] = m_MucTrigHit->
getfoEC(i, j, k, l);
99 if(foEC[i][j][k][l]==1) {
100 nfireLayerEC[i][j][k] = 1;
101 nhitLayerEC[i][j][k]+=1;
106 if(i==0) index = 0 + j*100 + k*10 + l;
107 if(i==1) index = 2000 + j*100 + k*10 +l;
108 vIndex.push_back(index);
118 for(
int i=0; i<8; i++)
123 for(
unsigned int j=0; j<vindexb.size(); j++)
127 ly2 = vindexb[j][1]-10;
128 ly3 = vindexb[j][2]-20;
129 ly4 = vindexb[j][3]-30;
130 if((foBR[i][0][ly1]+foBR[i][1][ly2]+foBR[i][2][ly3]+foBR[i][3][ly4])>=3) {
134 if(foBR[i][0][ly1]==1&&foBR[i][2][ly3]==1) { trackBR[i]++;
break; }
135 if(foBR[i][1][ly2]==1&&foBR[i][3][ly4]==1) { trackBR[i]++;
break; }
138 for(
unsigned int j=0; j<vindexb.size(); j++)
142 ly2 = vindexb[j][1]-10;
143 ly3 = vindexb[j][2]-20;
144 ly4 = vindexb[j][3]-30;
145 if((foBR[i][0][ly1]+foBR[i][1][ly2]+foBR[i][2][ly3]+foBR[i][3][ly4])>=3) {
152 for(
unsigned int j=0; j<vindexb3.size(); j++)
155 ly1 = vindexb3[j][0];
156 ly2 = vindexb3[j][1]-10;
157 ly3 = vindexb3[j][2]-20;
158 ly4 = vindexb3[j][3]-30;
159 if((foBR[i][0][ly1]+foBR[i][1][ly2]+foBR[i][2][ly3]+foBR[i][3][ly4])>=3) {
163 if(foBR[i][0][ly1]==1&&foBR[i][2][ly3]==1) { trackBR[i]++;
break; }
164 if(foBR[i][1][ly2]==1&&foBR[i][3][ly4]==1) { trackBR[i]++;
break; }
167 for(
unsigned int j=0; j<vindexb3.size(); j++)
170 ly1 = vindexb3[j][0];
171 ly2 = vindexb3[j][1]-10;
172 ly3 = vindexb3[j][2]-20;
173 ly4 = vindexb3[j][3]-30;
174 if((foBR[i][0][ly1]+foBR[i][1][ly2]+foBR[i][2][ly3]+foBR[i][3][ly4])>=3) {
183 for(
int i=0; i<4; i++)
189 for(
unsigned int j=0; j<vindexe.size(); j++)
193 ly2 = vindexe[j][1]-10;
194 ly3 = vindexe[j][2]-20;
195 ly4 = vindexe[j][3]-30;
197 if((foEC[0][i][0][ly1]+foEC[0][i][1][ly2]+foEC[0][i][2][ly3]+foEC[0][i][3][ly4])>=3) {
201 if(foEC[0][i][0][ly1]==1&&foEC[0][i][2][ly3]==1) { trackEE[i]++;
break; }
202 if(foEC[0][i][1][ly2]==1&&foEC[0][i][3][ly4]==1) { trackEE[i]++;
break; }
205 for(
unsigned int j=0; j<vindexe.size(); j++)
209 ly2 = vindexe[j][1]-10;
210 ly3 = vindexe[j][2]-20;
211 ly4 = vindexe[j][3]-30;
213 if((foEC[1][i][0][ly1]+foEC[1][i][1][ly2]+foEC[1][i][2][ly3]+foEC[1][i][3][ly4])>=3) {
217 if(foEC[1][i][0][ly1]==1&&foEC[1][i][2][ly3]==1) { trackWE[i]++;
break; }
218 if(foEC[1][i][1][ly2]==1&&foEC[1][i][3][ly4]==1) { trackWE[i]++;
break; }
221 for(
unsigned int j=0; j<vindexe.size(); j++)
225 ly2 = vindexe[j][1]-10;
226 ly3 = vindexe[j][2]-20;
227 ly4 = vindexe[j][3]-30;
229 if((foEC[0][i][0][ly1]+foEC[0][i][1][ly2]+foEC[0][i][2][ly3]+foEC[0][i][3][ly4])>=3) {
234 for(
unsigned int j=0; j<vindexe.size(); j++)
238 ly2 = vindexe[j][1]-10;
239 ly3 = vindexe[j][2]-20;
240 ly4 = vindexe[j][3]-30;
242 if((foEC[1][i][0][ly1]+foEC[1][i][1][ly2]+foEC[1][i][2][ly3]+foEC[1][i][3][ly4])>=3) {
252 int b3ltrack = 0, e3ltrack = 0;
253 for(
int i=0; i<8; i++) { btrack = btrack + trackBR[i]; b3ltrack = b3ltrack + track3lBR[i]; }
254 for(
int i=0; i<4; i++) { etrack = etrack + trackEE[i] + trackWE[i]; e3ltrack = e3ltrack + track3lWE[i] + track3lEE[i]; }
257 bool mucBB3478 =
false, mucBB37 =
false;
258 if((track3lBR[2] > 0 && track3lBR[6] > 0) || (track3lBR[3] > 0 && track3lBR[7] > 0)) mucBB3478 =
true;
259 if(track3lBR[2] > 0 && track3lBR[6] > 0) mucBB37 =
true;
275 for(
int i=0; i<8; i++)
278 for(
int j=0; j<4; j++)
280 if(nfireLayerBR[i][j] == 1) {
285 nlayer = 100 + i*10 + nlayer;
286 vfireLayer.push_back(nlayer);
290 for(
int i=0; i<2; i++)
291 for(
int j=0; j<4; j++)
294 for(
int k=0; k<4; k++)
296 if(nfireLayerEC[i][j][k] == 1) {
301 if(i==0) nlayer = 0 + j*10 + nlayer;
302 else nlayer = 200 + j*10 + nlayer;
303 vfireLayer.push_back(nlayer);
342 for(
int i=0; i<8; i++)
343 for(
int j=0; j<4; j++)
345 if(nhitLayerBR[i][j] != 0) {
347 int hit = 1000 + i*100 + j*10 + nhitLayerBR[i][j];
348 vhitLayer.push_back(hit);
352 for(
int i=0; i<2; i++)
353 for(
int j=0; j<4; j++)
354 for(
int k=0; k<4; k++)
356 if(nhitLayerEC[i][j][k] != 0) {
359 if(i==0) hit = 0 + j*100 + k*10 + nhitLayerEC[i][j][k];
361 else hit = 2000 + j*100 + k*10 + nhitLayerEC[i][j][k];
362 vhitLayer.push_back(hit);
426 std::string filename = std::string(getenv(
"TRIGGERROOT" ));
427 std::string filename1 = filename +
"/data/mufield0.5_1.5GeV_cos0.76_phi456thseg_index_select.txt";
428 std::string filename2 = filename +
"/data/mufield0.5_1.5GeV_cos0.76_phi234thseg_index_select.txt";
429 std::string filename3 = filename +
"/data/mufield0.5_1.5GeV_ee2_index_select.txt";
430 infile1.open(filename1.c_str(), ios_base::in);
431 infile2.open(filename2.c_str(), ios_base::in);
432 infile3.open(filename3.c_str(), ios_base::in);
438 if(!infile1) cout<<
"open file1 failture"<<endl;
440 infile1.getline( line, 255 );
441 token = strtok( line,
" " );
443 std::vector<int> tmp;
448 token = strtok(NULL,
" ");
449 int Index = atoi(str.c_str());
450 if(
num != 0) tmp.push_back(Index);
454 }
while (token!=NULL);
455 if(tmp.size() == 4) vindexb.push_back(tmp);
457 cout<<
"total "<<vindexb.size()<<
" index in barrel have been read!"<<endl;
460 if(!infile2) cout<<
"open file2 failture"<<endl;
462 infile2.getline( line, 255 );
463 token = strtok( line,
" " );
465 std::vector<int> tmp;
470 token = strtok(NULL,
" ");
471 int Index = atoi(str.c_str());
472 if(
num != 0) tmp.push_back(Index);
476 }
while (token!=NULL);
477 if(tmp.size() == 4) vindexb3.push_back(tmp);
479 cout<<
"total "<<vindexb3.size()<<
" index in barrel 3 have been read!"<<endl;
481 if(!infile3) cout<<
"open file3 failture"<<endl;
483 infile3.getline( line, 255 );
484 token = strtok( line,
" " );
486 std::vector<int> tmp;
491 token = strtok(NULL,
" ");
492 int Index = atoi(str.c_str());
493 if(
num != 0) tmp.push_back(Index);
497 }
while (token!=NULL);
498 if(tmp.size() == 4) vindexe.push_back(tmp);
500 cout<<
"total "<<vindexe.size()<<
" index in endcap have been read!"<<endl;