Changeset 16105
- Timestamp:
- 05/24/13 13:54:56 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/EventBuilder.h
r15473 r16105 14 14 15 15 */ 16 extern int g_runStat ; //main steering variable17 16 extern int g_reset ; //>0 = reset different levels of eventbuilder 18 extern int g_maxProc ;19 17 extern size_t g_maxMem ; //maximum memory allowed for buffer 20 18 … … 23 21 extern uint gi_NumConnect[NBOARDS]; //4 crates * 10 boards 24 22 23 class DrsCalibration; 24 25 enum FileStatus_t 26 { 27 kFileNotYetOpen, 28 kFileOpen, 29 kFileClosed 30 }; 31 32 enum CloseRequest_t 33 { 34 kRequestNone = 0, 35 kRequestManual = 1, 36 kRequestTimeout = 2, 37 kRequestConnectionChange = 4 38 }; 39 40 41 struct RUN_CTRL2 42 { 43 int64_t runId ; // Run number 44 45 time_t openTime; // Time when first event (first board) was received 46 time_t lastTime; // Time when last event was received (set when first board data received) 47 time_t closeTime; // Time when run should be closed 48 uint32_t night; // night as int as determined for this run 49 50 uint32_t lastEvt; // number of events received (counted when the first board was received) 51 uint32_t maxEvt; // maximum number which should be written to file 52 53 uint16_t roi0; // roi for normal pixels 54 uint16_t roi8; // roi for pixels8 55 56 std::string runType; 57 58 FileStatus_t fileStat; 59 int closeRequest; 60 61 std::shared_ptr<DrsCalibration> calib; 62 63 RUN_CTRL2() : runId(-1), lastTime(0), lastEvt(0), maxEvt(1<<31), fileStat(kFileNotYetOpen), closeRequest(kRequestNone) 64 { 65 // runId = -1; 66 // fileId = kFileNotYetOpen; 67 // lastEvt = 0; // Number of events partially started to read 68 // actEvt = 0; // Number of written events 69 // maxEvt = 1<<31; // max number events allowed (~2400min @ 250Hz) 70 71 } 72 //~RUN_CTRL2(); 73 }; 74 75 struct EVT_CTRL2 76 { 77 int64_t runNum; 78 uint32_t evNum; 79 80 uint32_t trgNum; 81 uint32_t trgTyp; 82 uint32_t fadLen; 83 84 uint32_t nBoard; 85 int16_t board[NBOARDS]; 86 87 uint16_t nRoi; 88 uint16_t nRoiTM; 89 90 timeval time; 91 uint8_t Errors[4]; 92 93 std::shared_ptr<PEVNT_HEADER> FADhead; 94 EVENT *fEvent; 95 96 std::shared_ptr<RUN_CTRL2> runCtrl; 97 98 EVT_CTRL2(std::shared_ptr<RUN_CTRL2> run=std::shared_ptr<RUN_CTRL2>()) : runNum(-1), runCtrl(run) 99 { 100 Errors[0] = 0; 101 Errors[1] = 0; 102 Errors[2] = 0; 103 Errors[3] = 0; 104 105 //flag all boards as unused 106 nBoard = 0; 107 for (int b=0; b<NBOARDS; b++) 108 board[b] = -1; 109 } 110 111 operator RUN_HEAD() const 112 { 113 RUN_HEAD rh; 114 115 rh.Nroi = nRoi; 116 rh.NroiTM = nRoiTM; 117 rh.RunTime = time.tv_sec; 118 rh.RunUsec = time.tv_usec; 119 120 memcpy(rh.FADhead, FADhead.get(), NBOARDS*sizeof(PEVNT_HEADER)); 121 122 return rh; 123 } 124 125 void initEvent(const std::shared_ptr<PEVNT_HEADER> &mem) 126 { 127 FADhead = mem; 128 fEvent = reinterpret_cast<EVENT*>(mem.get()+NBOARDS); 129 130 memset(fEvent->Adc_Data, 0, (NPIX+NTMARK)*2*nRoi); 131 132 //flag all pixels as unused 133 for (int k = 0; k < NPIX; k++) 134 fEvent->StartPix[k] = -1; 135 136 //flag all TMark as unused 137 for (int k = 0; k < NTMARK; k++) 138 fEvent->StartTM[k] = -1; 139 140 fEvent->NumBoards = 0; 141 fEvent->SoftTrig = 0; 142 fEvent->PCTime = time.tv_sec; 143 fEvent->PCUsec = time.tv_usec; 144 fEvent->Roi = nRoi; 145 fEvent->RoiTM = nRoiTM; 146 fEvent->EventNum = evNum; 147 fEvent->TriggerNum = trgNum; 148 fEvent->TriggerType = trgTyp; 149 } 150 }; 151 25 152 #endif
Note:
See TracChangeset
for help on using the changeset viewer.