Changeset 11127 for trunk/FACT++/src
- Timestamp:
- 06/23/11 09:29:42 (14 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/FACT++/src/EventBuilderWrapper.h ¶
r11097 r11127 719 719 DimDescribedService fDimEvents; 720 720 DimDescribedService fDimCurrentEvent; 721 DimDescribedService fDimEventData; 721 722 722 723 bool fDebugStream; … … 735 736 fDimEvents("FAD_CONTROL/EVENTS", "I:2", ""), 736 737 fDimCurrentEvent("FAD_CONTROL/CURRENT_EVENT", "I:1", ""), 738 fDimEventData("FAD_CONTROL/EVENT_DATA", "S:1;I:1;S:1;I:2;S:1;S", ""), 737 739 fDebugStream(false), fDebugRead(false) 738 740 { 739 741 if (This) 740 742 throw logic_error("EventBuilderWrapper cannot be instantiated twice."); … … 1083 1085 } 1084 1086 1087 struct DimEventData 1088 { 1089 uint16_t Roi ; // #slices per pixel (same for all pixels and tmarks) 1090 uint32_t EventNum ; // EventNumber as from FTM 1091 uint16_t TriggerType ; // Trigger Type from FTM 1092 1093 uint32_t PCTime ; // when did event start to arrive at PC 1094 uint32_t BoardTime; // 1095 1096 int16_t StartPix; // First Channel per Pixel (Pixels sorted according Software ID) ; -1 if not filled 1097 int16_t StartTM; // First Channel for TimeMark (sorted Hardware ID) ; -1 if not filled 1098 1099 uint16_t Adc_Data[]; // final length defined by malloc .... 1100 1101 } __attribute__((__packed__));; 1102 1103 template<typename T> 1104 vector<T> Check(const PEVNT_HEADER *fadhd, const T &val, bool &rc) 1105 { 1106 const size_t offset = reinterpret_cast<const char*>(&val)-reinterpret_cast<const char*>(fadhd); 1107 1108 vector<T> vec(40); 1109 1110 vec[0] = val; 1111 1112 rc = true; 1113 for (int i=1; i<40; i++) 1114 { 1115 1116 const T &t = *reinterpret_cast<const T*>(reinterpret_cast<const char*>(fadhd+i)+offset); 1117 if (t!=val) 1118 rc = false; 1119 1120 vec[i] = t; 1121 } 1122 1123 return vec; 1124 } 1125 1126 template<typename T> 1127 vector<uint8_t> CheckBits(const PEVNT_HEADER *fadhd, const T &val, T &rc) 1128 { 1129 const size_t offset = reinterpret_cast<const char*>(&val)-reinterpret_cast<const char*>(fadhd); 1130 1131 vector<uint8_t> vec(40); 1132 1133 rc = 0; 1134 for (int i=0; i<40; i++) 1135 { 1136 const T &t = *reinterpret_cast<const T*>(reinterpret_cast<const char*>(fadhd+i)+offset); 1137 1138 rc |= val^t; 1139 1140 vec[i] = t; 1141 } 1142 1143 // Return 1 for all bits which are identical 1144 // 0 for all other bits 1145 rc = ~rc; 1146 return vec; 1147 } 1148 1149 1150 int eventCheck(PEVNT_HEADER *fadhd, EVENT *event) 1151 { 1152 /* 1153 fadhd[i] ist ein array mit den 40 fad-headers 1154 (falls ein board nicht gelesen wurde, ist start_package_flag =0 ) 1155 1156 event ist die Struktur, die auch die write routine erhaelt; 1157 darin sind im header die 'soll-werte' fuer z.B. eventID 1158 als auch die ADC-Werte (falls Du die brauchst) 1159 1160 Wenn die routine einen negativen Wert liefert, wird das event 1161 geloescht (nicht an die write-routine weitergeleitet [mind. im Prinzip] 1162 */ 1163 1164 bool ok_verno; 1165 bool ok_runno; 1166 uint16_t ok_bitmask; 1167 1168 const vector<uint16_t> verno = Check(fadhd, fadhd->version_no, ok_verno); 1169 const vector<uint32_t> runno = Check(fadhd, fadhd->runnumber, ok_runno); 1170 const vector<uint8_t> bitmask = CheckBits(fadhd, fadhd->PLLLCK, ok_bitmask); 1171 1172 /* 1173 uint16_t start_package_flag; 1174 uint16_t package_length; 1175 uint16_t version_no; 1176 uint16_t PLLLCK; 1177 1178 uint16_t trigger_crc; 1179 uint16_t trigger_type; 1180 uint32_t trigger_id; 1181 1182 uint32_t fad_evt_counter; 1183 uint32_t REFCLK_frequency; 1184 1185 uint16_t board_id; 1186 uint8_t zeroes; 1187 int8_t adc_clock_phase_shift; 1188 uint16_t number_of_triggers_to_generate; 1189 uint16_t trigger_generator_prescaler; 1190 1191 uint64_t DNA; 1192 1193 uint32_t time; 1194 uint32_t runnumber; 1195 1196 int16_t drs_temperature[NTemp]; 1197 1198 uint16_t dac[NDAC]; 1199 */ 1200 1201 static DimEventData *data = 0; 1202 1203 const size_t sz = sizeof(DimEventData)+event->Roi*2; 1204 1205 if (data && data->Roi != event->Roi) 1206 { 1207 delete data; 1208 data = 0; 1209 } 1210 1211 if (!data) 1212 data = reinterpret_cast<DimEventData*>(new char[sz]); 1213 1214 // cout << sizeof(DimEventData) << " " << event->Roi << " " << sz << " " << sizeof(*data) << endl; 1215 1216 data->Roi = event->Roi; 1217 data->EventNum = event->EventNum; 1218 data->TriggerType = event->TriggerType; 1219 data->PCTime = event->PCTime; 1220 data->BoardTime = event->BoardTime[0]; 1221 data->StartPix = event->StartPix[0]; 1222 data->StartTM = event->StartTM[0]; 1223 1224 memcpy(data->Adc_Data, event->Adc_Data, event->Roi*2); 1225 1226 fDimEventData.setData(data, sz); 1227 fDimEventData.updateService(); 1228 1229 //delete data; 1230 1231 return 0; 1232 } 1233 1085 1234 }; 1086 1235 … … 1151 1300 int eventCheck(PEVNT_HEADER *fadhd, EVENT *event) 1152 1301 { 1153 /* 1154 fadhd[i] ist ein array mit den 40 fad-headers 1155 (falls ein board nicht gelesen wurde, ist start_package_flag =0 ) 1156 1157 event ist die Struktur, die auch die write routine erhaelt; 1158 darin sind im header die 'soll-werte' fuer z.B. eventID 1159 als auch die ADC-Werte (falls Du die brauchst) 1160 1161 Wenn die routine einen negativen Wert liefert, wird das event 1162 geloescht (nicht an die write-routine weitergeleitet [mind. im Prinzip] 1163 */ 1164 1165 return 0; 1302 return EventBuilderWrapper::This->eventCheck(fadhd, event); 1166 1303 } 1167 1304 } -
TabularUnified trunk/FACT++/src/fadctrl.cc ¶
r11126 r11127 1173 1173 } 1174 1174 1175 bool fStatusT;1176 1175 vector<uint8_t> fStatus1; 1177 1176 vector<uint8_t> fStatus2; 1177 bool fStatusT; 1178 1178 1179 1179 int Execute() … … 1197 1197 vector<uint8_t> stat2(40); 1198 1198 1199 int cnt = 0; // counter for en bled board1199 int cnt = 0; // counter for enabled board 1200 1200 1201 1201 for (int idx=0; idx<40; idx++) -
TabularUnified trunk/FACT++/src/ftmctrl.cc ¶
r11107 r11127 1429 1429 //map<uint32_t,uint32_t>::const_iterator = fClockConditionerMap.find(freq); 1430 1430 1431 static const uint64_t R1 = 0x00010101; 1432 static const uint64_t R8 = 0x10000908; 1433 static const uint64_t R9 = 0xa0032a09; 1434 static const uint64_t R11 = 0x0082000b; 1435 static const uint64_t R13 = 0x020a000d; 1436 1437 static const uint64_t freq0700[8] = { 0x0003e000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400f50f }; 1438 static const uint64_t freq1000[8] = { 0x0003a000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f }; 1439 static const uint64_t freq2000[8] = { 0x00035000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f }; 1440 static const uint64_t freq2001[8] = { 0x00038000, R1, R8, R9, R11, R13, 0x0830280e, 0x1400fa0f }; 1441 static const uint64_t freq3000[8] = { 0x00037200, R1, R8, R9, R11, R13, 0x0830400e, 0x1420a30f }; 1442 // static const uint64_t freq4000[8] = { 0x00032800, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f }; 1443 static const uint64_t freq4000[8] = { 0x00034000, R1, R8, R9, R11, R13, 0x0830280e, 0x1400fa0f }; 1444 static const uint64_t freq5000[8] = { 0x00032000, R1, R8, R9, R11, R13, 0x0830400e, 0x1400fa0f }; 1431 static const uint64_t R0hi = 0x00030000; 1432 static const uint64_t R8 = 0x10000908; 1433 static const uint64_t R9 = 0xa0032a09; 1434 static const uint64_t R11 = 0x0082000b; 1435 static const uint64_t R13 = 0x020a000d; 1436 static const uint64_t R14hi = 0x08300000; 1437 1438 static const uint64_t freq0800[8] = { R0hi|0xfe00, 0x00010101, R8, R9, R11, R13, R14hi|0x800e, 0x14027b0f }; 1439 static const uint64_t freq1000[8] = { R0hi|0xd000, 0x00010101, R8, R9, R11, R13, R14hi|0x400e, 0x1401450f }; 1440 static const uint64_t freq2000[8] = { R0hi|0x8000, 0x00010101, R8, R9, R11, R13, R14hi|0x280e, 0x1400fa0f }; 1441 static const uint64_t freq3000[8] = { R0hi|0x9000, 0x00030101, R8, R9, R11, R13, R14hi|0x400e, 0x1402a30f }; 1442 static const uint64_t freq4000[8] = { R0hi|0x4000, 0x00010100, R8, R9, R11, R13, R14hi|0x280e, 0x1400fa0f }; 1443 static const uint64_t freq5000[8] = { R0hi|0x8000, 0x00030200, R8, R9, R11, R13, R14hi|0x280e, 0x1402710f }; 1445 1444 1446 1445 const uint64_t *reg = 0; … … 1448 1447 switch (freq) 1449 1448 { 1450 case 700: reg = freq0700; break;1449 case 800: reg = freq0800; break; 1451 1450 case 1000: reg = freq1000; break; 1452 1451 case 2000: reg = freq2000; break; 1453 case 2001: reg = freq2001; break;1454 1452 case 3000: reg = freq3000; break; 1455 1453 case 4000: reg = freq4000; break;
Note:
See TracChangeset
for help on using the changeset viewer.