Changeset 12481
- Timestamp:
- 11/09/11 22:38:09 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilderWrapper.h
r12470 r12481 194 194 fDimRoi ("FAD_CONTROL/REGION_OF_INTEREST", "S:2", ""), 195 195 fDimDac ("FAD_CONTROL/DAC", "S:336", ""), 196 fDimDrsCalibration("FAD_CONTROL/DRS_CALIBRATION", "I: 3;I:1;F:1474560;F:1474560;F:1474560;F:1474560;F:1474560;F:1474560;F:163840;F:163840", ""),196 fDimDrsCalibration("FAD_CONTROL/DRS_CALIBRATION", "I:1;I:3;F:1474560;F:1474560;F:1474560;F:1474560;F:1474560;F:1474560;F:163840;F:163840", ""), 197 197 fDimStatistics1 ("FAD_CONTROL/STATISTICS1", "I:3;I:5;X:4;I:3;I:3;I:40;I:1;I:2;C:40;I:40;I:40;X:40", ""), 198 198 fDimStatistics2 ("FAD_CONTROL/STATISTICS2", "I:1;I:280;X:40;I:40;I:4;I:4;I:2;I:2;I:3;C:40", ""), … … 223 223 } 224 224 225 struct RunDescription 226 { 227 uint32_t maxtime; 228 uint32_t maxevt; 229 230 string name; 231 232 FAD::Configuration reference; 233 234 bool started; 235 }; 236 237 map<uint32_t, RunDescription> fExpectedRuns; 225 set<uint32_t> fIsRunStarted; 226 map<uint32_t, FAD::RunDescription> fExpectedRuns; 238 227 239 228 uint32_t StartNewRun(int64_t maxtime, int64_t maxevt, const pair<string, FAD::Configuration> &ref) … … 244 233 maxevt = INT32_MAX; 245 234 246 const RunDescription descr =235 const FAD::RunDescription descr = 247 236 { 248 237 uint32_t(maxtime), … … 250 239 ref.first, 251 240 ref.second, 252 false253 241 }; 254 242 … … 258 246 259 247 fExpectedRuns[fRunNumber] = descr; 248 fIsRunStarted.insert(fRunNumber); 260 249 return fRunNumber++; 261 250 } … … 535 524 fMsg.Info(" ==> TODO: Write information from fTargetConfig to header!"); 536 525 526 map<uint32_t,FAD::RunDescription>::iterator it = fExpectedRuns.begin(); 527 while (1) 528 { 529 if (it->first<runid) 530 { 531 ostringstream str; 532 str << "runOpen - Missed run " << runid << "." << endl; 533 fMsg.Info(str); 534 535 fExpectedRuns.erase(it); 536 } 537 if (it->first==runid) 538 break; 539 it++; 540 } 541 if (it==fExpectedRuns.end()) 542 { 543 ostringstream str; 544 str << "runOpen - Run " << runid << " wasn't expected." << endl; 545 fMsg.Warn(str); 546 } 547 548 const FAD::RunDescription desc = it->second; 549 550 fExpectedRuns.erase(it); 551 537 552 // Check if file already exists... 538 553 DataProcessorImp *file = 0; … … 548 563 try 549 564 { 550 if (!file->Open(h ))565 if (!file->Open(h, desc)) 551 566 return 0; 552 567 } … … 923 938 bool IsRunStarted() const 924 939 { 925 const map<uint32_t,RunDescription>::const_iterator it = fExpectedRuns.find(fRunNumber-1);926 return it==f ExpectedRuns.end();// ? true : it->second.started;940 const set<uint32_t>::const_iterator it = fIsRunStarted.find(fRunNumber-1); 941 return it==fIsRunStarted.end();// ? true : it->second.started; 927 942 } 928 943 … … 938 953 } 939 954 940 void gotNewRun( int runnr, PEVNT_HEADER */*headers*/)955 void gotNewRun(uint32_t runnr, PEVNT_HEADER */*headers*/) 941 956 { 942 957 // This function is called even when writing is switched off 943 const map<uint32_t,RunDescription>::iterator it = fExpectedRuns.find(runnr); 944 if (it==fExpectedRuns.end()) 958 set<uint32_t>::iterator it = fIsRunStarted.begin(); 959 while (1) 960 { 961 if (*it<runnr) 962 { 963 ostringstream str; 964 str << "gotNewRun - Missed run " << runnr << "." << endl; 965 fMsg.Info(str); 966 967 fIsRunStarted.erase(it); 968 } 969 if (*it==runnr) 970 break; 971 it++; 972 } 973 if (it==fIsRunStarted.end()) 974 { 975 ostringstream str; 976 str << "gotNewRun - Not waiting for run " << runnr << "." << endl; 977 fMsg.Warn(str); 978 return; 979 } 980 981 map<uint32_t,FAD::RunDescription>::iterator i2 = fExpectedRuns.find(runnr); 982 if (i2==fExpectedRuns.end()) 945 983 { 946 984 ostringstream str; 947 985 str << "gotNewRun - Run " << runnr << " wasn't expected." << endl; 948 return; 949 } 950 951 CloseRunFile(runnr, time(NULL)+it->second.maxtime, it->second.maxevt); 986 fMsg.Warn(str); 987 return; 988 } 989 990 CloseRunFile(runnr, time(NULL)+i2->second.maxtime, i2->second.maxevt); 952 991 // return: 0=close scheduled / >0 already closed / <0 does not exist 953 992 … … 955 994 // be opened/closed 956 995 957 it->second.started = true; 958 959 fExpectedRuns.erase(it); 996 fIsRunStarted.erase(it); 960 997 } 961 998 … … 1320 1357 } 1321 1358 1322 void gotNewRun( int runnr, PEVNT_HEADER *headers)1359 void gotNewRun(uint32_t runnr, PEVNT_HEADER *headers) 1323 1360 { 1324 1361 return EventBuilderWrapper::This->gotNewRun(runnr, headers);
Note:
See TracChangeset
for help on using the changeset viewer.