36 ISvcLocator* svcLocator = Gaudi::svcLocator();
37 StatusCode sc = svcLocator->service(
"BesGlobalTrigSvc", m_tmpSvc );
41 for (
int i = 0; i < 8; i++ )
44 for (
int j = 0; j < 4; j++ )
46 nfireLayerBR[i][j] = 0;
47 nhitLayerBR[i][j] = 0;
52 for (
int i = 0; i < 2; i++ )
55 for (
int j = 0; j < 4; j++ )
58 for (
int k = 0; k < 4; k++ )
60 nfireLayerEC[i][j][k] = 0;
61 nhitLayerEC[i][j][k] = 0;
68 m_MucTrigHit->getFastOr();
71 for (
int i = 0; i < 8; i++ )
72 for (
int j = 0; j < 4; j++ )
73 for (
int k = 0; k < 7; k++ )
76 foBR[i][j][k] = m_MucTrigHit->getfoBR( i, j, k );
77 if ( foBR[i][j][k] == 1 )
79 nfireLayerBR[i][j] = 1;
80 nhitLayerBR[i][j] += 1;
84 int index = 1000 + i * 100 + j * 10 + k;
85 vIndex.push_back( index );
89 for (
int i = 0; i < 2; i++ )
90 for (
int j = 0; j < 4; j++ )
91 for (
int k = 0; k < 4; k++ )
92 for (
int l = 0; l < 4; l++ )
95 foEC[i][j][k][l] = m_MucTrigHit->getfoEC( i, j, k, l );
96 if ( foEC[i][j][k][l] == 1 )
98 nfireLayerEC[i][j][k] = 1;
99 nhitLayerEC[i][j][k] += 1;
100 nhitSegEC[i][j] += 1;
104 if ( i == 0 ) index = 0 + j * 100 + k * 10 + l;
105 if ( i == 1 ) index = 2000 + j * 100 + k * 10 + l;
106 vIndex.push_back( index );
115 for (
int i = 0; i < 8; i++ )
121 for (
unsigned int j = 0; j < vindexb.size(); j++ )
123 int ly1, ly2, ly3, ly4;
125 ly2 = vindexb[j][1] - 10;
126 ly3 = vindexb[j][2] - 20;
127 ly4 = vindexb[j][3] - 30;
128 if ( ( foBR[i][0][ly1] + foBR[i][1][ly2] + foBR[i][2][ly3] + foBR[i][3][ly4] ) >= 3 )
133 if ( foBR[i][0][ly1] == 1 && foBR[i][2][ly3] == 1 )
138 if ( foBR[i][1][ly2] == 1 && foBR[i][3][ly4] == 1 )
145 for (
unsigned int j = 0; j < vindexb.size(); j++ )
147 int ly1, ly2, ly3, ly4;
149 ly2 = vindexb[j][1] - 10;
150 ly3 = vindexb[j][2] - 20;
151 ly4 = vindexb[j][3] - 30;
152 if ( ( foBR[i][0][ly1] + foBR[i][1][ly2] + foBR[i][2][ly3] + foBR[i][3][ly4] ) >= 3 )
161 for (
unsigned int j = 0; j < vindexb3.size(); j++ )
163 int ly1, ly2, ly3, ly4;
164 ly1 = vindexb3[j][0];
165 ly2 = vindexb3[j][1] - 10;
166 ly3 = vindexb3[j][2] - 20;
167 ly4 = vindexb3[j][3] - 30;
168 if ( ( foBR[i][0][ly1] + foBR[i][1][ly2] + foBR[i][2][ly3] + foBR[i][3][ly4] ) >= 3 )
173 if ( foBR[i][0][ly1] == 1 && foBR[i][2][ly3] == 1 )
178 if ( foBR[i][1][ly2] == 1 && foBR[i][3][ly4] == 1 )
185 for (
unsigned int j = 0; j < vindexb3.size(); j++ )
187 int ly1, ly2, ly3, ly4;
188 ly1 = vindexb3[j][0];
189 ly2 = vindexb3[j][1] - 10;
190 ly3 = vindexb3[j][2] - 20;
191 ly4 = vindexb3[j][3] - 30;
192 if ( ( foBR[i][0][ly1] + foBR[i][1][ly2] + foBR[i][2][ly3] + foBR[i][3][ly4] ) >= 3 )
202 for (
int i = 0; i < 4; i++ )
208 for (
unsigned int j = 0; j < vindexe.size(); j++ )
210 int ly1, ly2, ly3, ly4;
212 ly2 = vindexe[j][1] - 10;
213 ly3 = vindexe[j][2] - 20;
214 ly4 = vindexe[j][3] - 30;
216 if ( ( foEC[0][i][0][ly1] + foEC[0][i][1][ly2] + foEC[0][i][2][ly3] +
217 foEC[0][i][3][ly4] ) >= 3 )
222 if ( foEC[0][i][0][ly1] == 1 && foEC[0][i][2][ly3] == 1 )
227 if ( foEC[0][i][1][ly2] == 1 && foEC[0][i][3][ly4] == 1 )
234 for (
unsigned int j = 0; j < vindexe.size(); j++ )
236 int ly1, ly2, ly3, ly4;
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] +
243 foEC[1][i][3][ly4] ) >= 3 )
248 if ( foEC[1][i][0][ly1] == 1 && foEC[1][i][2][ly3] == 1 )
253 if ( foEC[1][i][1][ly2] == 1 && foEC[1][i][3][ly4] == 1 )
260 for (
unsigned int j = 0; j < vindexe.size(); j++ )
262 int ly1, ly2, ly3, ly4;
264 ly2 = vindexe[j][1] - 10;
265 ly3 = vindexe[j][2] - 20;
266 ly4 = vindexe[j][3] - 30;
268 if ( ( foEC[0][i][0][ly1] + foEC[0][i][1][ly2] + foEC[0][i][2][ly3] +
269 foEC[0][i][3][ly4] ) >= 3 )
275 for (
unsigned int j = 0; j < vindexe.size(); j++ )
277 int ly1, ly2, ly3, ly4;
279 ly2 = vindexe[j][1] - 10;
280 ly3 = vindexe[j][2] - 20;
281 ly4 = vindexe[j][3] - 30;
283 if ( ( foEC[1][i][0][ly1] + foEC[1][i][1][ly2] + foEC[1][i][2][ly3] +
284 foEC[1][i][3][ly4] ) >= 3 )
295 int b3ltrack = 0, e3ltrack = 0;
296 for (
int i = 0; i < 8; i++ )
298 btrack = btrack + trackBR[i];
299 b3ltrack = b3ltrack + track3lBR[i];
301 for (
int i = 0; i < 4; i++ )
303 etrack = etrack + trackEE[i] + trackWE[i];
304 e3ltrack = e3ltrack + track3lWE[i] + track3lEE[i];
309 bool mucBB3478 =
false, mucBB37 =
false;
310 if ( ( track3lBR[2] > 0 && track3lBR[6] > 0 ) || ( track3lBR[3] > 0 && track3lBR[7] > 0 ) )
312 if ( track3lBR[2] > 0 && track3lBR[6] > 0 ) mucBB37 =
true;
315 m_pIBGT->setMucBB3478( mucBB3478 );
316 m_pIBGT->setMucBB37( mucBB37 );
319 m_pIBGT->setMucNtrackBR( btrack );
320 m_pIBGT->setMucNtrackEC( etrack );
321 m_pIBGT->setMucN3ltrackTotal( b3ltrack + e3ltrack );
473 std::string filename = std::string( getenv(
"TRIGGERROOT" ) );
474 std::string filename1 =
475 filename +
"/data/mufield0.5_1.5GeV_cos0.76_phi456thseg_index_select.txt";
476 std::string filename2 =
477 filename +
"/data/mufield0.5_1.5GeV_cos0.76_phi234thseg_index_select.txt";
478 std::string filename3 = filename +
"/data/mufield0.5_1.5GeV_ee2_index_select.txt";
479 infile1.open( filename1.c_str(), ios_base::in );
480 infile2.open( filename2.c_str(), ios_base::in );
481 infile3.open( filename3.c_str(), ios_base::in );
487 if ( !infile1 ) cout <<
"open file1 failture" << endl;
490 infile1.getline( line, 255 );
491 token = strtok( line,
" " );
493 std::vector<int> tmp;
499 token = strtok( NULL,
" " );
500 int Index = atoi( str.c_str() );
501 if (
num != 0 ) tmp.push_back(
Index );
505 }
while ( token != NULL );
506 if ( tmp.size() == 4 ) vindexb.push_back( tmp );
508 cout <<
"total " << vindexb.size() <<
" index in barrel have been read!" << endl;
510 if ( !infile2 ) cout <<
"open file2 failture" << endl;
513 infile2.getline( line, 255 );
514 token = strtok( line,
" " );
516 std::vector<int> tmp;
522 token = strtok( NULL,
" " );
523 int Index = atoi( str.c_str() );
524 if (
num != 0 ) tmp.push_back(
Index );
528 }
while ( token != NULL );
529 if ( tmp.size() == 4 ) vindexb3.push_back( tmp );
531 cout <<
"total " << vindexb3.size() <<
" index in barrel 3 have been read!" << endl;
533 if ( !infile3 ) cout <<
"open file3 failture" << endl;
536 infile3.getline( line, 255 );
537 token = strtok( line,
" " );
539 std::vector<int> tmp;
545 token = strtok( NULL,
" " );
546 int Index = atoi( str.c_str() );
547 if (
num != 0 ) tmp.push_back(
Index );
551 }
while ( token != NULL );
552 if ( tmp.size() == 4 ) vindexe.push_back( tmp );
554 cout <<
"total " << vindexe.size() <<
" index in endcap have been read!" << endl;