- Timestamp:
- 11/21/13 17:18:41 (11 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilder.cc
r17236 r17332 15 15 #include "MessageImp.h" 16 16 #include "EventBuilder.h" 17 #include "HeadersFAD.h" 17 18 18 19 using namespace std; … … 59 60 bool runOpen(const EVT_CTRL2 &evt); 60 61 bool runWrite(const EVT_CTRL2 &evt); 61 void runClose( RUN_CTRL2 &run);62 void runClose(const EVT_CTRL2 &run); 62 63 void applyCalib(const EVT_CTRL2 &evt, const size_t &size); 63 64 void factOut(int severity, const char *message); … … 866 867 return true; 867 868 868 runClose( run);869 runClose(*evt); 869 870 run.fileStat = kFileClosed; 870 871 … … 914 915 event->BoardTime[ib] = evt->FADhead[ib].time; 915 916 917 RUN_CTRL2 &run = *evt->runCtrl; 918 919 // Physics trigger 920 if (evt->trgTyp && !(evt->trgTyp & FAD::EventHeader::kAll)) 921 run.triggerCounter[0]++; 922 // Pure pedestal trigger 923 else if ((evt->trgTyp&FAD::EventHeader::kPedestal) && !(evt->trgTyp&FAD::EventHeader::kTIM)) 924 run.triggerCounter[1]++; 925 // external light pulser trigger 926 else if (evt->trgTyp & FAD::EventHeader::kLPext) 927 run.triggerCounter[2]++; 928 // time calibration triggers 929 else if (evt->trgTyp & (FAD::EventHeader::kTIM|FAD::EventHeader::kPedestal)) 930 run.triggerCounter[3]++; 931 // internal light pulser trigger 932 else if (evt->trgTyp & FAD::EventHeader::kLPint) 933 run.triggerCounter[4]++; 934 // external trigger input 1 935 else if (evt->trgTyp & FAD::EventHeader::kExt1) 936 run.triggerCounter[5]++; 937 // external trigger input 2 938 else if (evt->trgTyp & FAD::EventHeader::kExt2) 939 run.triggerCounter[6]++; 940 // other triggers 941 else 942 run.triggerCounter[7]++; 943 944 evt->triggerCounter = run.triggerCounter; 945 916 946 if (!eventCheck(*evt)) 917 947 { -
trunk/FACT++/src/EventBuilder.h
r16619 r17332 4 4 #include "FAD.h" 5 5 6 #include <list> 6 7 #include <array> 7 8 #include <forward_list> 9 8 10 9 11 /* global variables; … … 67 69 FileStatus_t fileStat; 68 70 71 std::array<uint32_t, 8> triggerCounter; 72 69 73 std::shared_ptr<DrsCalibration> calib; 70 74 std::list<std::array<int16_t,1440>> prevStart; // History for start cells of previous events (for step calibration) … … 72 76 RUN_CTRL2() : runId(-1), reportMem(0), lastTime(0), lastEvt(0), maxEvt(1<<31), fileStat(kFileNotYetOpen) 73 77 { 78 triggerCounter.fill(0); 79 74 80 // runId = -1; 75 81 // fileId = kFileNotYetOpen; … … 123 129 int closeRequest; 124 130 131 std::array<uint32_t, 8> triggerCounter; 132 125 133 std::shared_ptr<RUN_CTRL2> runCtrl; 126 134 -
trunk/FACT++/src/EventBuilderWrapper.h
r17319 r17332 72 72 DimDescribedService fDimRuns; 73 73 DimDescribedService fDimEvents; 74 DimDescribedService fDimTrigger; 74 75 DimDescribedService fDimRawData; 75 76 DimDescribedService fDimEventData; … … 94 95 Queue<tuple<Time,bool,FAD::EventHeader>> fQueueProcHeader; 95 96 Queue<pair<Time,array<uint32_t,4>>> fQueueEvents; 97 Queue<tuple<Time,char,array<uint32_t,8>>> fQueueTrigger; 96 98 Queue<pair<Time,array<uint16_t,2>>> fQueueRoi; 97 99 Queue<vector<char>> fQueueRawData; … … 216 218 "Event counts" 217 219 "|evtsCount[int]:Num evts cur. run, total (all run), evt ID, trig. Num"), 220 fDimTrigger ("FAD_CONTROL/TRIGGER_COUNTER", "I:1;I:1;I:1;I:1;I:1;I:1;I:1;I:1", 221 "Trigger counter" 222 "|N_trg[uint32]:Number of physics triggers" 223 "|N_ped[uint32]:Number of pure pedestal triggers" 224 "|N_lpe[uint32]:Number of external light pulser triggers" 225 "|N_tim[uint32]:Number of time calibration triggers" 226 "|N_lpi[uint32]:Number of internal light pulser triggers" 227 "|N_ext1[uint32]:Number of external triggers at input ext1" 228 "|N_ext2[uint32]:Number of external triggers at input ext2" 229 "|N_misc[uint32]:Number of all other triggers"), 218 230 fDimRawData ("FAD_CONTROL/RAW_DATA", "S:1;S:1;I:1;I:1;S:1;I:1;I:2;I:40;S:1440;S:160;F", 219 231 "|roi[uint16]:number of samples per pixel" … … 279 291 fQueueProcHeader( std::bind(&EventBuilderWrapper::procHeader, this, placeholders::_1)), 280 292 fQueueEvents( std::bind(&EventBuilderWrapper::UpdateDimEvents, this, placeholders::_1)), 293 fQueueTrigger( std::bind(&EventBuilderWrapper::UpdateDimTrigger, this, placeholders::_1)), 281 294 fQueueRoi( std::bind(&EventBuilderWrapper::UpdateDimRoi, this, placeholders::_1)), 282 295 fQueueRawData( std::bind(&EventBuilderWrapper::UpdateDimRawData, this, placeholders::_1)), … … 521 534 } 522 535 536 bool UpdateDimTrigger(const tuple<Time,char,array<uint32_t,8>> &stat) 537 { 538 fDimTrigger.setQuality(get<1>(stat)); 539 fDimTrigger.setData(get<2>(stat).data(), sizeof(uint32_t)*8); 540 fDimTrigger.Update(get<0>(stat)); 541 return true; 542 } 543 523 544 bool runOpen(const EVT_CTRL2 &evt) 524 545 { … … 528 549 // If there is still an open file: close it 529 550 if (fFile) 530 runClose( *evt.runCtrl);551 runClose(evt); 531 552 532 553 // Keep a copy of the currently valid drs calibration … … 576 597 fNumEvts[kTriggerId] = 0; 577 598 fNumEvts[kCurrent] = 0; 578 fQueueEvents.emplace(Time(), fNumEvts); 599 600 const Time time; 601 602 fQueueEvents.emplace(time, fNumEvts); 603 fQueueTrigger.emplace(time, 'o', evt.triggerCounter); 579 604 580 605 ostringstream str; … … 604 629 }*/ 605 630 606 const EVENT &evt = *e.fEvent; 607 if (!fFile->WriteEvt(evt)) 631 if (!fFile->WriteEvt(e)) 608 632 return false; 609 633 634 //const EVENT &evt = *e.fEvent; 635 610 636 fNumEvts[kCurrent]++; 611 fNumEvts[kEventId] = e vt.EventNum;612 fNumEvts[kTriggerId] = e vt.TriggerNum;637 fNumEvts[kEventId] = e.evNum;//evt.EventNum; 638 fNumEvts[kTriggerId] = e.trgNum;//evt.TriggerNum; 613 639 fNumEvts[kTotal]++; 614 640 … … 618 644 { 619 645 fQueueEvents.emplace(newt, fNumEvts); 646 fQueueTrigger.emplace(newt, 'w', e.triggerCounter); 620 647 oldt = newt; 621 648 } … … 624 651 } 625 652 626 void runClose( RUN_CTRL2 &run)653 void runClose(const EVT_CTRL2 &evt) 627 654 { 628 655 if (!fFile) … … 635 662 636 663 // Close the file 637 const bool rc = fFile->Close( NULL);664 const bool rc = fFile->Close(evt); 638 665 639 666 fLastClosed = fFile->GetRunId(); … … 653 680 654 681 // Time for update events before time for update runs 655 fQueueEvents.emplace(Time(), fNumEvts); 682 const Time time; 683 684 fQueueEvents.emplace(time, fNumEvts); 685 fQueueTrigger.emplace(time, 'c', evt.triggerCounter); 686 656 687 UpdateRuns(); 657 688 … … 667 698 // the memory will stay in scope until the end of its operation. 668 699 const DrsCalibration &cal = DataCalib::GetCalibration(); 700 701 RUN_CTRL2 &run = *evt.runCtrl; 669 702 if (!run.calib || run.calib->fStep != cal.fStep || run.calib->fRoi!=cal.fRoi) 670 703 run.calib = make_shared<DrsCalibration>(cal); … … 893 926 } 894 927 895 fQueueTempRefClk.emplace(tm, clk, tmp);896 897 928 // check REFCLK_frequency 898 929 // check consistency with command configuration 899 930 // how to log errors? 900 931 // need gotNewRun/closedRun to know it is finished 932 933 fQueueTempRefClk.emplace(tm, clk, tmp); 934 935 if (evt.runCtrl->fileStat == kFileClosed) 936 { 937 static Time oldt(boost::date_time::neg_infin); 938 if (tm>oldt+boost::posix_time::seconds(1)) 939 { 940 fQueueTrigger.emplace(tm, 0, evt.runCtrl->triggerCounter); 941 oldt = tm; 942 } 943 } 901 944 902 945 return true; … … 1399 1442 } 1400 1443 1401 void runClose( RUN_CTRL2 &run)1444 void runClose(const EVT_CTRL2 &evt) 1402 1445 { 1403 EventBuilderWrapper::This->runClose( run);1446 EventBuilderWrapper::This->runClose(evt); 1404 1447 } 1405 1448
Note:
See TracChangeset
for help on using the changeset viewer.