Changeset 11532 for trunk/FACT++
- Timestamp:
- 07/22/11 08:49:55 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilderWrapper.h
r11522 r11532 11 11 #include <boost/thread.hpp> 12 12 #include <boost/date_time/posix_time/posix_time_types.hpp> 13 13 14 14 15 #include <CCfits/CCfits> … … 453 454 AddColumnEntry(colNames, dataTypes, 1, 'J', "EventNum"); 454 455 AddColumnEntry(colNames, dataTypes, 1, 'I', "TriggerType"); 456 AddColumnEntry(colNames, dataTypes, 1, 'I', "NumBoards"); 457 AddColumnEntry(colNames, dataTypes, 1, 'I', "reserved"); 455 458 AddColumnEntry(colNames, dataTypes, 1, 'J', "SoftTrig"); 456 459 AddColumnEntry(colNames, dataTypes, 2, 'J', "PCTime"); … … 461 464 462 465 ostringstream fmt; 463 fmt << "I:1;S:1;I:1;I: 2";466 fmt << "I:1;S:1;I:1;I:1;I:1;I:2"; 464 467 fmt << ";I:" << NBOARDS; 465 468 fmt << ";S:" << NPIX; … … 865 868 } 866 869 867 map<uint32_t, pair<uint32_t, uint32_t>> fExpectedRuns; 868 869 uint32_t StartNewRun(int64_t maxtime, int64_t maxevt) 870 { 871 if (maxtime==0) 870 struct RunDescription 871 { 872 uint32_t maxtime; 873 uint32_t maxevt; 874 875 FAD::Configuration reference; 876 }; 877 878 map<uint32_t, RunDescription> fExpectedRuns; 879 880 uint32_t StartNewRun(int64_t maxtime, int64_t maxevt, const FAD::Configuration &ref) 881 { 882 if (maxtime<=0 || maxtime>24*60*60) 872 883 maxtime = 24*60*60; 873 if (maxevt ==0)884 if (maxevt<=0 || maxevt>INT32_MAX) 874 885 maxevt = INT32_MAX; 875 886 876 fExpectedRuns[fRunNumber] = make_pair(maxtime, maxevt); 887 const RunDescription descr = 888 { 889 uint32_t(maxtime), 890 uint32_t(maxevt), 891 ref 892 }; 893 894 fExpectedRuns[fRunNumber] = descr; 877 895 return fRunNumber++; 878 896 } … … 1330 1348 */ 1331 1349 1332 // Check consistency of:1333 // =====================1334 1335 // Write a single key for:1336 // -----------------------1337 // Start package flag1338 // package length1339 // version number1340 // status1341 // Prescaler1342 1343 // Write 40 kays for (?)1344 // Phaseshift1345 // DNA1346 // DAC1347 1348 1349 1350 /* 1350 uint16_t start_package_flag; 1351 uint16_t package_length; 1352 uint16_t version_no; 1353 uint16_t PLLLCK; 1354 1355 uint16_t trigger_crc; 1356 uint16_t trigger_type; 1357 uint32_t trigger_id; 1358 1359 uint32_t fad_evt_counter; 1360 uint32_t REFCLK_frequency; 1361 1362 uint16_t board_id; 1363 uint8_t zeroes; 1364 int8_t adc_clock_phase_shift; 1365 uint16_t number_of_triggers_to_generate; 1366 uint16_t trigger_generator_prescaler; 1367 1368 uint64_t DNA; 1369 1370 uint32_t time; 1371 uint32_t runnumber; 1372 1373 int16_t drs_temperature[NTemp]; 1374 1375 int16_t dac[NDAC]; 1376 */ 1377 1351 const FAD::EventHeader *beg = reinterpret_cast<FAD::EventHeader*>(fadhd); 1352 const FAD::EventHeader *end = reinterpret_cast<FAD::EventHeader*>(fadhd)+41; 1353 1354 for (const FAD::EventHeader *ptr=beg; ptr!=end; ptr++) 1355 { 1356 // Event incomplete 1357 if (ptr->fStartDelimiter==0) 1358 return -1; 1359 1360 // Either one of 1361 // * fStatus 1362 // * fRunNumber 1363 // * fEventCounter 1364 // * fAdcClockPhaseShift 1365 // * fTriggerGeneratorPrescaler 1366 // * fDac 1367 // inconsistent 1368 if (*ptr != *beg) 1369 return -1; 1370 1371 if (ptr->fTriggerType != beg->fTriggerType) 1372 return -1; 1373 if (ptr->fTriggerId != beg->fTriggerId) 1374 return -1; 1375 if (ptr->fVersion != beg->fVersion) 1376 return -1; 1377 }*/ 1378 1379 // check REFCLK_frequency 1380 // check consistency with command configuration 1381 // how to log errors? 1382 // need gotNewRun/closedRun to know it is finished 1378 1383 1379 1384 static Time oldt(boost::date_time::neg_infin); … … 1390 1395 fDimEventData.updateService(); 1391 1396 1392 //delete data;1393 1394 1397 return 0; 1395 1398 } … … 1403 1406 { 1404 1407 // This function is called even when writing is switched off 1405 const map<uint32_t, pair<uint32_t,uint32_t>>::iterator it = fExpectedRuns.find(runnr);1408 const map<uint32_t,RunDescription>::iterator it = fExpectedRuns.find(runnr); 1406 1409 if (it==fExpectedRuns.end()) 1407 1410 { … … 1411 1414 } 1412 1415 1413 CloseRunFile(runnr, time(NULL)+it->second. first, it->second.second);1416 CloseRunFile(runnr, time(NULL)+it->second.maxtime, it->second.maxevt); 1414 1417 // return: 0=close scheduled / >0 already closed / <0 does not exist 1415 1418
Note:
See TracChangeset
for help on using the changeset viewer.