117 log =
new MsgStream(messageService(), name() );
120 StatusCode status = service(
"RealizationSvc",tmpReal);
121 if (!status.isSuccess())
123 (*log) << MSG::FATAL <<
" Could not initialize Realization Service" << endreq;
128 if(m_RealizationSvc->
UseDBFlag() ==
true && m_RealizationSvc->
ifReadRandTrg() ==
true && m_dbUserRequest ==
true) {
133 if(! m_pattern.empty())
135 for(
unsigned int k = 0; k < m_bgfiles.size(); k++) {
136 size_t pos_round = m_bgfiles[k].rfind(
"round");
137 (*log) << MSG::INFO <<
"m_bgfiles: "<<m_bgfiles[k]<<endreq;
138 if(pos_round!=string::npos){
139 m_bgfiles[k].replace(m_bgfiles[k].begin(), m_bgfiles[k].begin()+pos_round, m_pattern);
140 (*log) << MSG::INFO<<
"new random trigger data path: "<<m_bgfiles[k]<<endreq;
143 (*log) << MSG::ERROR<<
"string 'round' not found in random trigger path!"<<endreq;
148 if (! m_newdatadir.empty())
150 for(
unsigned int k = 0; k < m_bgfiles.size(); k++) {
152 std::strcpy (tmp, m_bgfiles[k].c_str());
153 string fname = basename(tmp);
154 m_bgfiles[k].replace(m_bgfiles[k].begin(), m_bgfiles[k].end(), m_newdatadir+
'/'+fname);
155 (*log) << MSG::INFO<<
"new random trigger data path: "<<m_bgfiles[k]<<endreq;
161 std::ifstream conff(m_rawReviseConfig.c_str());
165 static const bool CREATEIFNOTTHERE(
true);
166 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
167 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
169 (*log) << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
175 status = service(
"DataInfoSvc",tmpInfoSvc);
176 if (status.isSuccess()) {
177 (*log) << MSG::INFO <<
"get the DataInfoSvc" << endreq;
178 m_jobInfoSvc=
dynamic_cast<DataInfoSvc *
>(tmpInfoSvc);
180 (*log) << MSG::WARNING <<
"could not get the DataInfoSvc." << endreq;
184 if(m_RealizationSvc->
UseDBFlag() ==
false || m_dbUserRequest ==
true) {
185 if(m_bgfiles.empty()) {
186 (*log) << MSG::WARNING <<
"No background datafiles found" << endreq;
187 return StatusCode::SUCCESS;
192 m_bgfilesIndex.clear();
193 for(
unsigned int bg_index = 0; bg_index < m_bgfiles.size(); bg_index++) {
194 m_bgfilesIndex.push_back(m_bgfiles[bg_index] +
".idx");
196 if(m_skip ==
true && m_readBGMethod == 1) m_fr =
new RawFileReader(m_bgfiles, m_bgfilesIndex) ;
201 return StatusCode::FAILURE;
209 if(nt1) m_tuple1 = nt1;
211 m_tuple1 =
ntupleSvc()->book(
"FILE1/n1",CLID_ColumnWiseTuple,
"Field");
213 status = m_tuple1->addItem(
"time1", m_time1 );
214 status = m_tuple1->addItem(
"time2", m_time2 );
215 status = m_tuple1->addItem(
"time3", m_time3 );
218 (*log) << MSG::ERROR <<
" Cannot book N-tuple:" <<long(m_tuple1)<< endreq;
219 return StatusCode::FAILURE;
224 if(nt2) m_tuple2 = nt2;
226 m_tuple2 =
ntupleSvc()->book(
"FILE1/n2",CLID_ColumnWiseTuple,
"Field");
228 status = m_tuple2->addItem(
"tdc", m_tdc );
231 (*log) << MSG::ERROR <<
" Cannot book N-tuple:" <<long(m_tuple2)<< endreq;
232 return StatusCode::FAILURE;
237 if(nt3) m_tuple3 = nt3;
239 m_tuple3 =
ntupleSvc()->book(
"FILE1/n3",CLID_ColumnWiseTuple,
"Field");
241 status = m_tuple3->addItem(
"time4", m_time4 );
242 status = m_tuple3->addItem(
"time5", m_time5 );
245 (*log) << MSG::ERROR <<
" Cannot book N-tuple:" <<long(m_tuple3)<< endreq;
246 return StatusCode::FAILURE;
250 status = service(
"BesTimerSvc", m_timersvc);
251 if (status.isFailure()) {
252 (*log) << MSG::ERROR << name() <<
": Unable to locate BesTimer Service" << endreq;
253 return StatusCode::FAILURE;
255 m_timer = m_timersvc->
addItem(
"Read field Time");
256 m_timer1 = m_timersvc->
addItem(
"Read raw files");
260 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"MIX");
261 HepRandom::setTheEngine(engine);
262 HepRandom::showEngineStatus();
264 return StatusCode::SUCCESS;
275 SmartDataPtr<Event::EventHeader> evt(eventSvc(),
"/Event/EventHeader");
277 return StatusCode::FAILURE;
280 if(m_RealizationSvc->
UseDBFlag() ==
true && m_RealizationSvc->
ifReadRandTrg() ==
true && m_dbUserRequest ==
false) {
281 int runNo = evt -> runNumber();
286 std::vector<std::string> bgfiles = m_RealizationSvc->
getBgFileName();
287 if(bgfiles.size() == 0) {
288 (*log) << MSG::ERROR <<
"No random trigger files are found in the run " << m_runNo << std::endl;
292 if(! m_pattern.empty())
294 for(
unsigned int k = 0; k < bgfiles.size(); k++) {
295 size_t pos_round = bgfiles[k].rfind(
"round");
296 (*log) << MSG::INFO<<
"bgfiles: "<<bgfiles[k]<<endreq;
297 if(pos_round!=string::npos){
298 bgfiles[k].replace(bgfiles[k].begin(), bgfiles[k].begin()+pos_round, m_pattern);
299 (*log) << MSG::INFO<<
"new random trigger data path: "<<bgfiles[k]<<endreq;
302 (*log) << MSG::ERROR<<
"string 'round' not found in random trigger path!"<<endreq;
307 if (! m_newdatadir.empty())
309 for(
unsigned int k = 0; k < bgfiles.size(); k++) {
311 std::strcpy (tmp, bgfiles[k].c_str());
312 string fname = basename(tmp);
313 bgfiles[k].replace(bgfiles[k].begin(), bgfiles[k].end(), m_newdatadir+
'/'+fname);
314 (*log) << MSG::INFO<<
"new random trigger data path: "<<bgfiles[k]<<endreq;
319 std::vector<std::string> bgfilesIndex;
320 bgfilesIndex.clear();
321 for(
unsigned int bg_index = 0; bg_index < bgfiles.size(); bg_index++) {
322 bgfilesIndex.push_back(bgfiles[bg_index] +
".idx");
326 if(m_fr)
delete m_fr;
328 std::vector<int> ranTrgEvents = m_fr->
getEventNumber(bgfilesIndex);
332 m_bgfilesIndex.clear();
333 m_ranTrgEvents.clear();
334 for(
unsigned int bg_index = 0; bg_index < bgfiles.size(); bg_index++) {
335 if(ranTrgEvents[bg_index] > 0) {
336 m_bgfiles.push_back(bgfiles[bg_index]);
337 m_bgfilesIndex.push_back(bgfilesIndex[bg_index]);
338 m_ranTrgEvents.push_back(ranTrgEvents[bg_index]);
343 if(m_fr)
delete m_fr;
348 bgfilesIndex.clear();
349 ranTrgEvents.clear();
352 if(m_bgfiles.empty() || m_ranTrgEvents.empty()) {
353 (*log) << MSG::WARNING <<
"No background datafiles found!!!" << endreq;
354 return StatusCode::SUCCESS;
358 if(m_mixingMethod == 1) {
360 m_ranStepLenInCurrentFile.clear();
366 bool ifsucc =
file_sort(m_bgfiles,m_ranTrgEvents);
367 if( !ifsucc )
return StatusCode::FAILURE;
370 m_bgfilesIndex.clear();
371 for(
unsigned int bg_index = 0; bg_index < m_bgfiles.size(); bg_index++) {
372 m_bgfilesIndex.push_back(m_bgfiles[bg_index] +
".idx");
376 m_vRanEvtNumInSubSet.clear();
377 m_vStreamNumInSubSet.clear();
380 int ranEvtNumInSubSet = 0;
382 for(
unsigned int i = 0; i < m_ranTrgEvents.size(); i++) {
383 if(i == 0) set_no = m_numSets[i];
384 if((i != 0) && (set_no != m_numSets[i])) {
385 m_vRanEvtNumInSubSet.push_back(ranEvtNumInSubSet);
386 m_vStreamNumInSubSet.push_back(nstream);
387 ranEvtNumInSubSet = 0;
389 set_no = m_numSets[i];
392 m_totRanEvtNum += m_ranTrgEvents[i];
393 ranEvtNumInSubSet += m_ranTrgEvents[i];
395 if(i == m_ranTrgEvents.size() - 1) {
396 m_vRanEvtNumInSubSet.push_back(ranEvtNumInSubSet);
397 m_vStreamNumInSubSet.push_back(nstream);
402 int evtNumInRun = -1;
403 std::vector<int> vtotEvtNo = m_jobInfoSvc->
getTotEvtNo();
404 for(
unsigned int ii = 0; ii < vtotEvtNo.size(); ii+=2) {
405 if(std::abs(
runNo) == std::abs(vtotEvtNo[ii]))
406 evtNumInRun = vtotEvtNo[ii+1];
413 std::cout <<
"ERROR: In MixerAlg::execute() ---> The tau value or total run time is 0, please check it. Exit! " << std::endl;
417 bool using_exp =
true;
418 if(totalTime*100 < tau) using_exp =
false;
419 m_vStepLength.clear();
422 if(using_exp ==
true) ranNum = RandExponential::shoot(tau);
423 else ranNum = RandFlat::shoot(0., totalTime);
424 if(ranNum > totalTime)
continue;
425 ranNum = ranNum*m_totRanEvtNum/totalTime;
426 m_vStepLength.push_back((
int)ranNum);
427 if(m_vStepLength.size() == evtNumInRun*m_nevent)
break;
430 sort(m_vStepLength.begin(), m_vStepLength.end());
435 if(evtNumInRun <= 0 || m_totRanEvtNum <= 0) {
436 (*log) << MSG::ERROR <<
"The event number (or random trigger event number) in run " << evt->runNumber() <<
" is zero" << endreq;
437 return StatusCode::FAILURE;
444 map_stepLength.clear();
445 for(
unsigned int i = 0; i < m_ranTrgEvents.size(); i++) {
446 std::vector<int> vstepLength;
447 typedef pair<int, std::vector<int> > vpair;
448 map_stepLength.insert(vpair(i,vstepLength));
451 for(
unsigned int i = 0; i < m_ranTrgEvents.size(); ) {
453 int pre_ranEvtNumSubSet = 0;
454 int cur_ranEvtNumSubSet = 0;
455 set_no = m_numSets[i];
456 for(
int j = 0; j < set_no; j++) {
457 if(j != (set_no - 1)) pre_ranEvtNumSubSet += m_vRanEvtNumInSubSet[j];
458 cur_ranEvtNumSubSet += m_vRanEvtNumInSubSet[j];
461 for(
unsigned j = 0; j < m_vStepLength.size(); j++) {
463 if((m_vStepLength[j] >= pre_ranEvtNumSubSet) && (m_vStepLength[j] < cur_ranEvtNumSubSet)) {
464 int sub_stepLength = int((m_vStepLength[j]-pre_ranEvtNumSubSet)/m_vStreamNumInSubSet[set_no - 1]);
466 int begin_fileId = -1, end_fileId = -1;
467 for(std::map<
int,std::vector<int> >::iterator
iter = map_stepLength.begin();
iter != map_stepLength.end();
iter++) {
469 if(set_no == m_numSets[
iter->first]) {
470 if(begin_fileId == -1) begin_fileId =
iter->first;
474 end_fileId = begin_fileId + file_id;
475 bool add_succ =
false;
479 int random_file = int(RandFlat::shootInt(
long(begin_fileId),
long(end_fileId)));
480 if(sub_stepLength < m_ranTrgEvents[random_file]) {
481 map_stepLength[random_file].push_back(sub_stepLength);
488 (*log) << MSG::ALWAYS <<
"Loop time is larger than MAX_LOOP_TIMES(" <<
MAX_LOOP_TIMES <<
") in MixAlg, when assigning step length for each bg file." << endreq;
494 i += m_vStreamNumInSubSet[set_no - 1];
498 unsigned int ranSelectedNum = 0;
499 for(std::map<
int,std::vector<int> >::iterator
iter = map_stepLength.begin();
iter != map_stepLength.end();
iter++) {
500 ranSelectedNum += (
iter->second).size();
503 if(ranSelectedNum != m_vStepLength.size()) {
504 (*log) << MSG::ERROR <<
"In MixerAlg::excute()--> selected bg events number not equal to MC events" << endreq;
505 return StatusCode::FAILURE;
510 if(m_mixingMethod == 2) {
512 if (m_fr)
delete m_fr;
515 m_bgfilesIndex.clear();
516 for(
unsigned int bg_index = 0; bg_index < m_bgfiles.size(); bg_index++) {
517 m_bgfilesIndex.push_back(m_bgfiles[bg_index] +
".idx");
519 if(m_skip ==
true && m_readBGMethod == 1) m_fr =
new RawFileReader(m_bgfiles, m_bgfilesIndex) ;
524 return StatusCode::FAILURE;
528 m_raw_event->
reset();
537 SmartDataPtr<MdcDigiCol> mdcMcDigits(eventSvc(),
"/Event/Digi/MdcDigiCol");
539 (*log) << MSG::ERROR <<
"Unable to retrieve MdcDigiCol" << endreq;
541 (*log) << MSG::INFO <<
"MdcDigiCol retrieved of size "<< mdcMcDigits->size() << endreq;
543 SmartDataPtr<EmcDigiCol> emcMcDigits(eventSvc(),
"/Event/Digi/EmcDigiCol");
545 (*log) << MSG::ERROR <<
"Unable to retrieve EmcDigiCol" << endreq;
547 (*log) << MSG::INFO <<
"EmcDigiCol retrieved of size "<< emcMcDigits->size() << endreq;
549 SmartDataPtr<MucDigiCol> mucMcDigits(eventSvc(),
"/Event/Digi/MucDigiCol");
551 (*log) << MSG::ERROR <<
"Unable to retrieve MucDigiCol" << endreq;
553 (*log) << MSG::INFO <<
"MucDigiCol retrieved of size "<< mucMcDigits->size() << endreq;
555 SmartDataPtr<TofDigiCol> tofMcDigits(eventSvc(),
"/Event/Digi/TofDigiCol");
557 (*log) << MSG::ERROR <<
"Unable to retrieve TofDigiCol" << endreq;
559 (*log) << MSG::INFO <<
"TofDigiCol retrieved of size "<< tofMcDigits->size() << endreq;
561 for(
int ievent = 0; ievent<m_nevent; ievent++)
563 (*log) << MSG::INFO <<
"Mixing BG Event " << ievent << endreq;
571 if(m_mixingMethod == 1) {
572 if(m_RealizationSvc->
UseDBFlag() ==
true && m_dbUserRequest ==
false) {
573 if(m_skipCount >= m_ranStepLenInCurrentFile.size()) {
574 m_ranStepLenInCurrentFile.clear();
575 for(std::map<
int,std::vector<int> >::iterator
iter = map_stepLength.begin();
iter != map_stepLength.end();
iter++) {
576 if(currentBGFile ==
"") {
577 if((
iter->second).size() == 0)
continue;
578 if(m_fr)
delete m_fr;
580 if(m_readBGMethod == 1) m_fr =
new RawFileReader(m_bgfiles[
iter->first], m_bgfiles[
iter->first]+
".idx") ;
582 m_totEvtNumInCurFile = m_ranTrgEvents[
iter->first];
587 m_ranStepLenInCurrentFile =
iter->second;
592 if(currentBGFile == m_bgfiles[
iter->first]) {
594 if(
iter == map_stepLength.end())
return StatusCode::FAILURE;
595 if((
iter->second).size() == 0) {
598 if(
iter == map_stepLength.end())
return StatusCode::FAILURE;
599 if((
iter->second).size() > 0)
break;
602 if(m_fr)
delete m_fr;
604 if(m_readBGMethod == 1) m_fr =
new RawFileReader(m_bgfiles[
iter->first], m_bgfiles[
iter->first]+
".idx") ;
606 m_totEvtNumInCurFile = m_ranTrgEvents[
iter->first];
611 m_ranStepLenInCurrentFile =
iter->second;
620 if(m_skipCount == 0) nskip = m_ranStepLenInCurrentFile[m_skipCount];
621 else nskip = m_ranStepLenInCurrentFile[m_skipCount] - m_ranStepLenInCurrentFile[m_skipCount - 1];
623 m_nEventsToEnd = (m_totEvtNumInCurFile - 1) - m_ranStepLenInCurrentFile[m_skipCount];
625 if(m_skipCount == 0 && nskip == 0) nskip = 1;
629 if(m_RealizationSvc->
UseDBFlag() ==
false || m_dbUserRequest ==
true) nskip = int (2*m_NSkip*(RandFlat::shoot())) + 1;
630 if(m_totalEvent == 0 && nskip == 0) nskip = 1;
632 if(m_mixingMethod == 2) {
633 nskip = int (2*m_NSkip*(RandFlat::shoot())) + 1;
642 if(m_readBGMethod == 0) {
644 for(
int j = 0; j < nskip; j++) {
648 (*log) << MSG::ERROR <<
"Cannot get next background event" << endreq;
649 return StatusCode::FAILURE;
653 if(m_readBGMethod == 1) {
655 next =
nextEvent(nskip,0,m_nEventsToEnd);
658 (*log) << MSG::ERROR <<
"Cannot get next background event" << endreq;
659 return StatusCode::FAILURE;
662 if(m_readBGMethod == 2) {
667 (*log) << MSG::ERROR <<
"Cannot get next background event" << endreq;
668 return StatusCode::FAILURE;
676 if(m_mixingMethod == 1) {
677 if ( !next && m_totalEvent == 0) {
678 (*log) << MSG::ERROR <<
"Cannot get next background event" << endreq;
679 return StatusCode::FAILURE;
683 if(m_mixingMethod == 2) {
685 (*log) << MSG::ERROR <<
"Cannot get next background event" << endreq;
686 return StatusCode::FAILURE;
690 mixDigi(mdcMcDigits, emcMcDigits, mucMcDigits, tofMcDigits);
702 return StatusCode::SUCCESS;
716 m_raw_event->
reset();
723 const uint32_t* fragment;
724 if(m_skip ==
true && m_readBGMethod == 0) fragment = m_fr->
nextEvent();
725 if(m_skip ==
true && m_readBGMethod == 1) {
727 else fragment = m_fr->
nextEvent(nskip - 1);
729 if(m_skip ==
true && m_readBGMethod == 2) {
733 if(m_skip ==
false) fragment = m_fr->
nextEvent();
747 std::cerr <<
"Found invalid event (traceback):" << std::endl;
751 uint32_t fFragmentSize =
f.fragment_size_word();
752 (*log) << MSG::DEBUG <<
"[Event No. #" <<
f.global_id()
753 <<
"] " <<
f.fragment_size_word() <<
" words in "
754 <<
f.nchildren() <<
" subdetectors "
760 cout<<
"EventNo "<<
f.global_id()<<endl;
764 const uint32_t* ef=
NULL;
765 f.event_filter_info(ef);
767 (*log) << MSG::ERROR <<
"Event Filter Data Failed!!!" << endreq;
771 (*log) << MSG::DEBUG<<
"Event Filter Information*********" <<std::hex<<endreq
772 <<*ef<<
" "<<*(ef+1)<<
" "<<*(ef+2)<<
" "<<*(ef+3)<<std::dec<<endreq;
773 m_raw_event->
addReHltRaw((uint32_t*)ef, (uint32_t)4);
779 for (
int robi = 0; robi < nrobs; robi++) {
782 uint32_t* dataptr =
NULL;
787 source_id_number <<= 8;
788 source_id_number >>= 24;
791 switch(source_id_number) {
831 if(m_usingFilter ==
true) {
833 if(m_skip ==
true && m_readBGMethod == 0) {
834 return nextEvent(1, evtbyte, eventsToEnd);
836 if(m_skip ==
true && m_readBGMethod == 1) {
837 if(m_RealizationSvc->
UseDBFlag() ==
false || m_dbUserRequest ==
true)
return nextEvent(1, evtbyte, eventsToEnd);
838 if(eventsToEnd > 0 && m_RealizationSvc->
UseDBFlag() ==
true && m_dbUserRequest ==
false ) {
840 return nextEvent(1, evtbyte, eventsToEnd);
843 if(m_skip ==
true && m_readBGMethod == 2) {
844 return nextEvent(1, evtbyte, eventsToEnd);
846 if(m_skip ==
false)
return nextEvent(nskip, evtbyte, eventsToEnd);
857 if(m_skip ==
true && m_readBGMethod == 1) m_fr =
new RawFileReader(m_bgfiles, m_bgfilesIndex) ;
865 return nextEvent(nskip, evtbyte, eventsToEnd);
871 std::cerr << std::endl <<
"Uncaught eformat issue: " << ex.what() << std::endl;
874 std::cerr << std::endl <<
"Uncaught ERS issue: " << ex.what() << std::endl;
876 catch (std::exception& ex) {
877 std::cerr << std::endl <<
"Uncaught std exception: " << ex.what() << std::endl;
880 std::cerr << std::endl <<
"Uncaught unknown exception" << std::endl;
1000 SmartDataPtr<EmcDigiCol>& emcMcDigits,
1001 SmartDataPtr<MucDigiCol>& mucMcDigits,
1002 SmartDataPtr<TofDigiCol>& tofMcDigits)
1012 int tdc_min = -9, tdc_max = -9, tdc_tot = 0, tdc_num = 0;
1013 for(MdcDigiCol::const_iterator
bg = mdcCol.begin();
bg != mdcCol.end();
bg++ )
1015 if((*bg)->getTimeChannel() < 0x7FFFFFFF) {
1016 tdc_tot += (*bg)->getTimeChannel();
1018 if(tdc_min < 0) tdc_min = (*bg)->getTimeChannel();
1020 if(tdc_min > (*bg)->getTimeChannel()) tdc_min = (*bg)->getTimeChannel();
1022 if(tdc_max < 0) tdc_max = (*bg)->getTimeChannel();
1024 if(tdc_max < (*bg)->getTimeChannel()) tdc_max = (*bg)->getTimeChannel();
1028 int tdc_mean = (int) ((
double)tdc_tot/(
double)tdc_num);
1032 tdc_shift = tdc_mean - CLHEP::RandFlat::shootInt(
long(0),
long(80*24/0.09375));
1033 if((tdc_min - tdc_shift)>=0 && (tdc_max - tdc_shift) <=
int(80*24/0.09375))
break;
1035 if(tdc_num > m_maxLoop)
break;
1039 for(MdcDigiCol::const_iterator
bg = mdcCol.begin();
bg != mdcCol.end();
bg++ )
1041 if((*bg)->getTimeChannel() >= 0x7FFFFFFF)
continue;
1042 int newTDC = (*bg)->getTimeChannel() - tdc_shift;
1043 if(newTDC < 0 || newTDC >
int(80*24/0.09375)) newTDC = int(CLHEP::RandFlat::shoot()*80*24/0.09375);
1044 (*bg)->setTimeChannel(newTDC);
1172 std::vector<std::string> tmp_files = files;
1173 std::vector<int> tmp_ranEvtNums = ranEvtNums;
1178 const char* file_index[100];
1181 for(
int i = 0; i < 100; i++) {
1187 if(tmp_files.size() >= 100) {
1188 std::cout <<
"ERROR: In MixerAlg::file_sort(), please change bigger array size" << std::endl;
1192 for(
unsigned int i = 0; i < tmp_files.size(); i++) {
1194 const char* file1 = tmp_files[i].c_str();
1195 const char* substr1 = strstr(file1,
"_file");
1196 int strlen1 = strlen(substr1);
1200 for(
int sub1 = 0; sub1 < strlen1; sub1++) {
1201 if(substr1[sub1] ==
'e') {
1202 cset1[0] = substr1[sub1+1];
1203 cset1[1] = substr1[sub1+2];
1204 cset1[2] = substr1[sub1+3];
1207 else if(substr1[sub1] ==
'-') {
1208 cnum1[0] = substr1[sub1+1];
1217 int set1 = atoi(cset1);
1218 int num1 = atoi(cnum1);
1219 int encode_set1 = set1*100 +
num1;
1221 for(
unsigned int j = 0; j < tmp_files.size(); j++) {
1222 if(i == j)
continue;
1223 const char* file2 = tmp_files[j].c_str();
1224 const char* substr2 = strstr(file2,
"_file");
1225 int strlen2 = strlen(substr2);
1228 for(
int sub2 = 0; sub2 < strlen2; sub2++) {
1229 if(substr2[sub2] ==
'e') {
1230 cset2[0] = substr2[sub2+1];
1231 cset2[1] = substr2[sub2+2];
1232 cset2[2] = substr2[sub2+3];
1235 else if(substr2[sub2] ==
'-') {
1236 cnum2[0] = substr2[sub2+1];
1244 int set2 = atoi(cset2);
1245 int num2 = atoi(cnum2);
1246 int encode_set2 = set2*100 + num2;
1247 if(encode_set1 > encode_set2) index++;
1249 file_index[index] = tmp_files[i].c_str();
1250 num_index[index] = tmp_ranEvtNums[i];
1251 set_index[index] = set1;
1255 for(
unsigned int i = 0; i < tmp_files.size(); i++) {
1256 files.push_back(file_index[i]);
1257 ranEvtNums.push_back(num_index[i]);
1258 if(setNo != set_index[i]) {
1259 setNo = set_index[i];
1260 int numSets_size = m_numSets.size();
1261 if(numSets_size == 0) m_numSets.push_back(1);
1262 if(numSets_size != 0) m_numSets.push_back(m_numSets[numSets_size - 1] + 1);
1265 int numSets_size = m_numSets.size();
1266 m_numSets.push_back(m_numSets[numSets_size - 1]);