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 m_mdcCnv->
init(m_exRunFrom,m_exRunTo);
164 static const bool CREATEIFNOTTHERE(
true);
165 StatusCode RndmStatus = service(
"BesRndmGenSvc", p_BesRndmGenSvc, CREATEIFNOTTHERE);
166 if (!RndmStatus.isSuccess() || 0 == p_BesRndmGenSvc)
168 (*log) << MSG::ERROR <<
" Could not initialize Random Number Service" << endreq;
174 status = service(
"DataInfoSvc",tmpInfoSvc);
175 if (status.isSuccess()) {
176 (*log) << MSG::INFO <<
"get the DataInfoSvc" << endreq;
177 m_jobInfoSvc=
dynamic_cast<DataInfoSvc *
>(tmpInfoSvc);
179 (*log) << MSG::WARNING <<
"could not get the DataInfoSvc." << endreq;
183 if(m_RealizationSvc->
UseDBFlag() ==
false || m_dbUserRequest ==
true) {
184 if(m_bgfiles.empty()) {
185 (*log) << MSG::WARNING <<
"No background datafiles found" << endreq;
186 return StatusCode::SUCCESS;
191 m_bgfilesIndex.clear();
192 for(
unsigned int bg_index = 0; bg_index < m_bgfiles.size(); bg_index++) {
193 m_bgfilesIndex.push_back(m_bgfiles[bg_index] +
".idx");
195 if(m_skip ==
true && m_readBGMethod == 1) m_fr =
new RawFileReader(m_bgfiles, m_bgfilesIndex) ;
200 return StatusCode::FAILURE;
208 if(nt1) m_tuple1 = nt1;
210 m_tuple1 =
ntupleSvc()->book(
"FILE1/n1",CLID_ColumnWiseTuple,
"Field");
212 status = m_tuple1->addItem(
"time1", m_time1 );
213 status = m_tuple1->addItem(
"time2", m_time2 );
214 status = m_tuple1->addItem(
"time3", m_time3 );
217 (*log) << MSG::ERROR <<
" Cannot book N-tuple:" <<long(m_tuple1)<< endreq;
218 return StatusCode::FAILURE;
223 if(nt2) m_tuple2 = nt2;
225 m_tuple2 =
ntupleSvc()->book(
"FILE1/n2",CLID_ColumnWiseTuple,
"Field");
227 status = m_tuple2->addItem(
"tdc", m_tdc );
230 (*log) << MSG::ERROR <<
" Cannot book N-tuple:" <<long(m_tuple2)<< endreq;
231 return StatusCode::FAILURE;
236 if(nt3) m_tuple3 = nt3;
238 m_tuple3 =
ntupleSvc()->book(
"FILE1/n3",CLID_ColumnWiseTuple,
"Field");
240 status = m_tuple3->addItem(
"time4", m_time4 );
241 status = m_tuple3->addItem(
"time5", m_time5 );
244 (*log) << MSG::ERROR <<
" Cannot book N-tuple:" <<long(m_tuple3)<< endreq;
245 return StatusCode::FAILURE;
249 status = service(
"BesTimerSvc", m_timersvc);
250 if (status.isFailure()) {
251 (*log) << MSG::ERROR << name() <<
": Unable to locate BesTimer Service" << endreq;
252 return StatusCode::FAILURE;
254 m_timer = m_timersvc->
addItem(
"Read field Time");
255 m_timer1 = m_timersvc->
addItem(
"Read raw files");
259 CLHEP::HepRandomEngine* engine = p_BesRndmGenSvc->
GetEngine(
"MIX");
260 HepRandom::setTheEngine(engine);
261 HepRandom::showEngineStatus();
263 return StatusCode::SUCCESS;
274 SmartDataPtr<Event::EventHeader> evt(eventSvc(),
"/Event/EventHeader");
276 return StatusCode::FAILURE;
279 if(m_RealizationSvc->
UseDBFlag() ==
true && m_RealizationSvc->
ifReadRandTrg() ==
true && m_dbUserRequest ==
false) {
280 int runNo = evt -> runNumber();
285 std::vector<std::string> bgfiles = m_RealizationSvc->
getBgFileName();
286 if(bgfiles.size() == 0) {
287 (*log) << MSG::ERROR <<
"No random trigger files are found in the run " << m_runNo << std::endl;
291 if(! m_pattern.empty())
293 for(
unsigned int k = 0; k < bgfiles.size(); k++) {
294 size_t pos_round = bgfiles[k].rfind(
"round");
295 (*log) << MSG::INFO<<
"bgfiles: "<<bgfiles[k]<<endreq;
296 if(pos_round!=string::npos){
297 bgfiles[k].replace(bgfiles[k].begin(), bgfiles[k].begin()+pos_round, m_pattern);
298 (*log) << MSG::INFO<<
"new random trigger data path: "<<bgfiles[k]<<endreq;
301 (*log) << MSG::ERROR<<
"string 'round' not found in random trigger path!"<<endreq;
306 if (! m_newdatadir.empty())
308 for(
unsigned int k = 0; k < bgfiles.size(); k++) {
310 std::strcpy (tmp, bgfiles[k].c_str());
311 string fname = basename(tmp);
312 bgfiles[k].replace(bgfiles[k].begin(), bgfiles[k].end(), m_newdatadir+
'/'+fname);
313 (*log) << MSG::INFO<<
"new random trigger data path: "<<bgfiles[k]<<endreq;
318 std::vector<std::string> bgfilesIndex;
319 bgfilesIndex.clear();
320 for(
unsigned int bg_index = 0; bg_index < bgfiles.size(); bg_index++) {
321 bgfilesIndex.push_back(bgfiles[bg_index] +
".idx");
325 if(m_fr)
delete m_fr;
327 std::vector<int> ranTrgEvents = m_fr->
getEventNumber(bgfilesIndex);
331 m_bgfilesIndex.clear();
332 m_ranTrgEvents.clear();
333 for(
unsigned int bg_index = 0; bg_index < bgfiles.size(); bg_index++) {
334 if(ranTrgEvents[bg_index] > 0) {
335 m_bgfiles.push_back(bgfiles[bg_index]);
336 m_bgfilesIndex.push_back(bgfilesIndex[bg_index]);
337 m_ranTrgEvents.push_back(ranTrgEvents[bg_index]);
342 if(m_fr)
delete m_fr;
347 bgfilesIndex.clear();
348 ranTrgEvents.clear();
351 if(m_bgfiles.empty() || m_ranTrgEvents.empty()) {
352 (*log) << MSG::WARNING <<
"No background datafiles found!!!" << endreq;
353 return StatusCode::SUCCESS;
357 if(m_mixingMethod == 1) {
359 m_ranStepLenInCurrentFile.clear();
365 bool ifsucc =
file_sort(m_bgfiles,m_ranTrgEvents);
366 if( !ifsucc )
return StatusCode::FAILURE;
369 m_bgfilesIndex.clear();
370 for(
unsigned int bg_index = 0; bg_index < m_bgfiles.size(); bg_index++) {
371 m_bgfilesIndex.push_back(m_bgfiles[bg_index] +
".idx");
375 m_vRanEvtNumInSubSet.clear();
376 m_vStreamNumInSubSet.clear();
379 int ranEvtNumInSubSet = 0;
381 for(
unsigned int i = 0; i < m_ranTrgEvents.size(); i++) {
382 if(i == 0) set_no = m_numSets[i];
383 if((i != 0) && (set_no != m_numSets[i])) {
384 m_vRanEvtNumInSubSet.push_back(ranEvtNumInSubSet);
385 m_vStreamNumInSubSet.push_back(nstream);
386 ranEvtNumInSubSet = 0;
388 set_no = m_numSets[i];
391 m_totRanEvtNum += m_ranTrgEvents[i];
392 ranEvtNumInSubSet += m_ranTrgEvents[i];
394 if(i == m_ranTrgEvents.size() - 1) {
395 m_vRanEvtNumInSubSet.push_back(ranEvtNumInSubSet);
396 m_vStreamNumInSubSet.push_back(nstream);
401 int evtNumInRun = -1;
402 std::vector<int> vtotEvtNo = m_jobInfoSvc->
getTotEvtNo();
403 for(
unsigned int ii = 0; ii < vtotEvtNo.size(); ii+=2) {
404 if(std::abs(
runNo) == std::abs(vtotEvtNo[ii]))
405 evtNumInRun = vtotEvtNo[ii+1];
412 std::cout <<
"ERROR: In MixerAlg::execute() ---> The tau value or total run time is 0, please check it. Exit! " << std::endl;
416 bool using_exp =
true;
417 if(totalTime*100 < tau) using_exp =
false;
418 m_vStepLength.clear();
421 if(using_exp ==
true) ranNum = RandExponential::shoot(tau);
422 else ranNum = RandFlat::shoot(0., totalTime);
423 if(ranNum > totalTime)
continue;
424 ranNum = ranNum*m_totRanEvtNum/totalTime;
425 m_vStepLength.push_back((
int)ranNum);
426 if(m_vStepLength.size() == evtNumInRun)
break;
429 sort(m_vStepLength.begin(), m_vStepLength.end());
434 if(evtNumInRun <= 0 || m_totRanEvtNum <= 0) {
435 (*log) << MSG::ERROR <<
"The event number (or random trigger event number) in run " << evt->runNumber() <<
" is zero" << endreq;
436 return StatusCode::FAILURE;
443 map_stepLength.clear();
444 for(
unsigned int i = 0; i < m_ranTrgEvents.size(); i++) {
445 std::vector<int> vstepLength;
446 typedef pair<int, std::vector<int> > vpair;
447 map_stepLength.insert(vpair(i,vstepLength));
450 for(
unsigned int i = 0; i < m_ranTrgEvents.size(); ) {
452 int pre_ranEvtNumSubSet = 0;
453 int cur_ranEvtNumSubSet = 0;
454 set_no = m_numSets[i];
455 for(
int j = 0; j < set_no; j++) {
456 if(j != (set_no - 1)) pre_ranEvtNumSubSet += m_vRanEvtNumInSubSet[j];
457 cur_ranEvtNumSubSet += m_vRanEvtNumInSubSet[j];
460 for(
unsigned j = 0; j < m_vStepLength.size(); j++) {
462 if((m_vStepLength[j] >= pre_ranEvtNumSubSet) && (m_vStepLength[j] < cur_ranEvtNumSubSet)) {
463 int sub_stepLength = int((m_vStepLength[j]-pre_ranEvtNumSubSet)/m_vStreamNumInSubSet[set_no - 1]);
465 int begin_fileId = -1, end_fileId = -1;
466 for(std::map<
int,std::vector<int> >::iterator
iter = map_stepLength.begin();
iter != map_stepLength.end();
iter++) {
468 if(set_no == m_numSets[
iter->first]) {
469 if(begin_fileId == -1) begin_fileId =
iter->first;
473 end_fileId = begin_fileId + file_id;
474 bool add_succ =
false;
478 int random_file = int(RandFlat::shootInt(
long(begin_fileId),
long(end_fileId)));
479 if(sub_stepLength < m_ranTrgEvents[random_file]) {
480 map_stepLength[random_file].push_back(sub_stepLength);
487 (*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;
493 i += m_vStreamNumInSubSet[set_no - 1];
497 unsigned int ranSelectedNum = 0;
498 for(std::map<
int,std::vector<int> >::iterator
iter = map_stepLength.begin();
iter != map_stepLength.end();
iter++) {
499 ranSelectedNum += (
iter->second).size();
502 if(ranSelectedNum != m_vStepLength.size()) {
503 (*log) << MSG::ERROR <<
"In MixerAlg::excute()--> selected bg events number not equal to MC events" << endreq;
504 return StatusCode::FAILURE;
509 if(m_mixingMethod == 2) {
511 if (m_fr)
delete m_fr;
514 m_bgfilesIndex.clear();
515 for(
unsigned int bg_index = 0; bg_index < m_bgfiles.size(); bg_index++) {
516 m_bgfilesIndex.push_back(m_bgfiles[bg_index] +
".idx");
518 if(m_skip ==
true && m_readBGMethod == 1) m_fr =
new RawFileReader(m_bgfiles, m_bgfilesIndex) ;
523 return StatusCode::FAILURE;
527 m_raw_event->
reset();
536 SmartDataPtr<MdcDigiCol> mdcMcDigits(eventSvc(),
"/Event/Digi/MdcDigiCol");
538 (*log) << MSG::ERROR <<
"Unable to retrieve MdcDigiCol" << endreq;
540 (*log) << MSG::INFO <<
"MdcDigiCol retrieved of size "<< mdcMcDigits->size() << endreq;
542 SmartDataPtr<EmcDigiCol> emcMcDigits(eventSvc(),
"/Event/Digi/EmcDigiCol");
544 (*log) << MSG::ERROR <<
"Unable to retrieve EmcDigiCol" << endreq;
546 (*log) << MSG::INFO <<
"EmcDigiCol retrieved of size "<< emcMcDigits->size() << endreq;
548 SmartDataPtr<MucDigiCol> mucMcDigits(eventSvc(),
"/Event/Digi/MucDigiCol");
550 (*log) << MSG::ERROR <<
"Unable to retrieve MucDigiCol" << endreq;
552 (*log) << MSG::INFO <<
"MucDigiCol retrieved of size "<< mucMcDigits->size() << endreq;
554 SmartDataPtr<TofDigiCol> tofMcDigits(eventSvc(),
"/Event/Digi/TofDigiCol");
556 (*log) << MSG::ERROR <<
"Unable to retrieve TofDigiCol" << endreq;
558 (*log) << MSG::INFO <<
"TofDigiCol retrieved of size "<< tofMcDigits->size() << endreq;
560 for(
int ievent = 0; ievent<m_nevent; ievent++)
562 (*log) << MSG::INFO <<
"Mixing BG Event " << ievent << endreq;
570 if(m_mixingMethod == 1) {
571 if(m_RealizationSvc->
UseDBFlag() ==
true && m_dbUserRequest ==
false) {
572 if(m_skipCount >= m_ranStepLenInCurrentFile.size()) {
573 m_ranStepLenInCurrentFile.clear();
574 for(std::map<
int,std::vector<int> >::iterator
iter = map_stepLength.begin();
iter != map_stepLength.end();
iter++) {
575 if(currentBGFile ==
"") {
576 if((
iter->second).size() == 0)
continue;
577 if(m_fr)
delete m_fr;
579 if(m_readBGMethod == 1) m_fr =
new RawFileReader(m_bgfiles[
iter->first], m_bgfiles[
iter->first]+
".idx") ;
581 m_totEvtNumInCurFile = m_ranTrgEvents[
iter->first];
586 m_ranStepLenInCurrentFile =
iter->second;
591 if(currentBGFile == m_bgfiles[
iter->first]) {
593 if(
iter == map_stepLength.end())
return StatusCode::FAILURE;
594 if((
iter->second).size() == 0) {
597 if(
iter == map_stepLength.end())
return StatusCode::FAILURE;
598 if((
iter->second).size() > 0)
break;
601 if(m_fr)
delete m_fr;
603 if(m_readBGMethod == 1) m_fr =
new RawFileReader(m_bgfiles[
iter->first], m_bgfiles[
iter->first]+
".idx") ;
605 m_totEvtNumInCurFile = m_ranTrgEvents[
iter->first];
610 m_ranStepLenInCurrentFile =
iter->second;
619 if(m_skipCount == 0) nskip = m_ranStepLenInCurrentFile[m_skipCount];
620 else nskip = m_ranStepLenInCurrentFile[m_skipCount] - m_ranStepLenInCurrentFile[m_skipCount - 1];
622 m_nEventsToEnd = (m_totEvtNumInCurFile - 1) - m_ranStepLenInCurrentFile[m_skipCount];
624 if(m_skipCount == 0 && nskip == 0) nskip = 1;
628 if(m_RealizationSvc->
UseDBFlag() ==
false || m_dbUserRequest ==
true) nskip = int (2*m_NSkip*(RandFlat::shoot())) + 1;
629 if(m_totalEvent == 0 && nskip == 0) nskip = 1;
631 if(m_mixingMethod == 2) {
632 nskip = int (2*m_NSkip*(RandFlat::shoot())) + 1;
641 if(m_readBGMethod == 0) {
643 for(
int j = 0; j < nskip; j++) {
647 (*log) << MSG::ERROR <<
"Cannot get next background event" << endreq;
648 return StatusCode::FAILURE;
652 if(m_readBGMethod == 1) {
654 next =
nextEvent(nskip,0,m_nEventsToEnd);
657 (*log) << MSG::ERROR <<
"Cannot get next background event" << endreq;
658 return StatusCode::FAILURE;
661 if(m_readBGMethod == 2) {
666 (*log) << MSG::ERROR <<
"Cannot get next background event" << endreq;
667 return StatusCode::FAILURE;
675 if(m_mixingMethod == 1) {
676 if ( !next && m_totalEvent == 0) {
677 (*log) << MSG::ERROR <<
"Cannot get next background event" << endreq;
678 return StatusCode::FAILURE;
682 if(m_mixingMethod == 2) {
684 (*log) << MSG::ERROR <<
"Cannot get next background event" << endreq;
685 return StatusCode::FAILURE;
689 mixDigi(mdcMcDigits, emcMcDigits, mucMcDigits, tofMcDigits);
701 return StatusCode::SUCCESS;
715 m_raw_event->
reset();
722 const uint32_t* fragment;
723 if(m_skip ==
true && m_readBGMethod == 0) fragment = m_fr->
nextEvent();
724 if(m_skip ==
true && m_readBGMethod == 1) {
726 else fragment = m_fr->
nextEvent(nskip - 1);
728 if(m_skip ==
true && m_readBGMethod == 2) {
732 if(m_skip ==
false) fragment = m_fr->
nextEvent();
746 std::cerr <<
"Found invalid event (traceback):" << std::endl;
751 (*log) << MSG::DEBUG <<
"[Event No. #" << f.
global_id()
759 const uint32_t* ef=NULL;
762 (*log) << MSG::ERROR <<
"Event Filter Data Failed!!!" << endreq;
766 (*log) << MSG::DEBUG<<
"Event Filter Information*********" <<std::hex<<endreq
767 <<*ef<<
" "<<*(ef+1)<<
" "<<*(ef+2)<<
" "<<*(ef+3)<<std::dec<<endreq;
768 m_raw_event->
addReHltRaw((uint32_t*)ef, (uint32_t)4);
774 for (
int robi = 0; robi < nrobs; robi++) {
777 uint32_t* dataptr = NULL;
782 source_id_number <<= 8;
783 source_id_number >>= 24;
786 switch(source_id_number) {
823 if(m_usingFilter ==
true) {
825 if(m_skip ==
true && m_readBGMethod == 0) {
826 return nextEvent(1, evtbyte, eventsToEnd);
828 if(m_skip ==
true && m_readBGMethod == 1) {
829 if(m_RealizationSvc->
UseDBFlag() ==
false || m_dbUserRequest ==
true)
return nextEvent(1, evtbyte, eventsToEnd);
830 if(eventsToEnd > 0 && m_RealizationSvc->
UseDBFlag() ==
true && m_dbUserRequest ==
false ) {
832 return nextEvent(1, evtbyte, eventsToEnd);
835 if(m_skip ==
true && m_readBGMethod == 2) {
836 return nextEvent(1, evtbyte, eventsToEnd);
838 if(m_skip ==
false)
return nextEvent(nskip, evtbyte, eventsToEnd);
849 if(m_skip ==
true && m_readBGMethod == 1) m_fr =
new RawFileReader(m_bgfiles, m_bgfilesIndex) ;
857 return nextEvent(nskip, evtbyte, eventsToEnd);
863 std::cerr << std::endl <<
"Uncaught eformat issue: " << ex.what() << std::endl;
866 std::cerr << std::endl <<
"Uncaught ERS issue: " << ex.what() << std::endl;
868 catch (std::exception& ex) {
869 std::cerr << std::endl <<
"Uncaught std exception: " << ex.what() << std::endl;
872 std::cerr << std::endl <<
"Uncaught unknown exception" << std::endl;
992 SmartDataPtr<EmcDigiCol>& emcMcDigits,
993 SmartDataPtr<MucDigiCol>& mucMcDigits,
994 SmartDataPtr<TofDigiCol>& tofMcDigits)
1004 int tdc_min = -9, tdc_max = -9, tdc_tot = 0, tdc_num = 0;
1005 for(MdcDigiCol::const_iterator
bg = mdcCol.begin();
bg != mdcCol.end();
bg++ )
1007 if((*bg)->getTimeChannel() < 0x7FFFFFFF) {
1008 tdc_tot += (*bg)->getTimeChannel();
1010 if(tdc_min < 0) tdc_min = (*bg)->getTimeChannel();
1012 if(tdc_min > (*bg)->getTimeChannel()) tdc_min = (*bg)->getTimeChannel();
1014 if(tdc_max < 0) tdc_max = (*bg)->getTimeChannel();
1016 if(tdc_max < (*bg)->getTimeChannel()) tdc_max = (*bg)->getTimeChannel();
1020 int tdc_mean = (int) ((
double)tdc_tot/(
double)tdc_num);
1024 tdc_shift = tdc_mean - CLHEP::RandFlat::shootInt(
long(0),
long(80*24/0.09375));
1025 if((tdc_min - tdc_shift)>=0 && (tdc_max - tdc_shift) <=
int(80*24/0.09375))
break;
1027 if(tdc_num > m_maxLoop)
break;
1031 for(MdcDigiCol::const_iterator
bg = mdcCol.begin();
bg != mdcCol.end();
bg++ )
1033 if((*bg)->getTimeChannel() >= 0x7FFFFFFF)
continue;
1034 int newTDC = (*bg)->getTimeChannel() - tdc_shift;
1035 if(newTDC < 0 || newTDC >
int(80*24/0.09375)) newTDC = int(CLHEP::RandFlat::shoot()*80*24/0.09375);
1036 (*bg)->setTimeChannel(newTDC);
1158 std::vector<std::string> tmp_files = files;
1159 std::vector<int> tmp_ranEvtNums = ranEvtNums;
1164 const char* file_index[100];
1167 for(
int i = 0; i < 100; i++) {
1173 if(tmp_files.size() >= 100) {
1174 std::cout <<
"ERROR: In MixerAlg::file_sort(), please change bigger array size" << std::endl;
1178 for(
unsigned int i = 0; i < tmp_files.size(); i++) {
1180 const char* file1 = tmp_files[i].c_str();
1181 const char* substr1 = strstr(file1,
"_file");
1182 int strlen1 = strlen(substr1);
1186 for(
int sub1 = 0; sub1 < strlen1; sub1++) {
1187 if(substr1[sub1] ==
'e') {
1188 cset1[0] = substr1[sub1+1];
1189 cset1[1] = substr1[sub1+2];
1190 cset1[2] = substr1[sub1+3];
1193 else if(substr1[sub1] ==
'-') {
1194 cnum1[0] = substr1[sub1+1];
1203 int set1 = atoi(cset1);
1204 int num1 = atoi(cnum1);
1205 int encode_set1 = set1*100 +
num1;
1207 for(
unsigned int j = 0; j < tmp_files.size(); j++) {
1208 if(i == j)
continue;
1209 const char* file2 = tmp_files[j].c_str();
1210 const char* substr2 = strstr(file2,
"_file");
1211 int strlen2 = strlen(substr2);
1214 for(
int sub2 = 0; sub2 < strlen2; sub2++) {
1215 if(substr2[sub2] ==
'e') {
1216 cset2[0] = substr2[sub2+1];
1217 cset2[1] = substr2[sub2+2];
1218 cset2[2] = substr2[sub2+3];
1221 else if(substr2[sub2] ==
'-') {
1222 cnum2[0] = substr2[sub2+1];
1230 int set2 = atoi(cset2);
1231 int num2 = atoi(cnum2);
1232 int encode_set2 = set2*100 + num2;
1233 if(encode_set1 > encode_set2) index++;
1235 file_index[index] = tmp_files[i].c_str();
1236 num_index[index] = tmp_ranEvtNums[i];
1237 set_index[index] = set1;
1241 for(
unsigned int i = 0; i < tmp_files.size(); i++) {
1242 files.push_back(file_index[i]);
1243 ranEvtNums.push_back(num_index[i]);
1244 if(setNo != set_index[i]) {
1245 setNo = set_index[i];
1246 int numSets_size = m_numSets.size();
1247 if(numSets_size == 0) m_numSets.push_back(1);
1248 if(numSets_size != 0) m_numSets.push_back(m_numSets[numSets_size - 1] + 1);
1251 int numSets_size = m_numSets.size();
1252 m_numSets.push_back(m_numSets[numSets_size - 1]);