Changeset 11127 for trunk/FACT++
- Timestamp:
- 06/23/11 09:29:42 (13 years ago)
- Location:
- trunk/FACT++
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/gui/FactGui.h
r11117 r11127 387 387 DimStampedInfo fDimFadEvents; 388 388 DimStampedInfo fDimFadCurrentEvent; 389 DimStampedInfo fDimFadEventData; 389 390 DimStampedInfo fDimFadConnections; 390 391 … … 960 961 } 961 962 963 struct DimEventData 964 { 965 uint16_t Roi ; // #slices per pixel (same for all pixels and tmarks) 966 uint32_t EventNum ; // EventNumber as from FTM 967 uint16_t TriggerType ; // Trigger Type from FTM 968 969 uint32_t PCTime ; // when did event start to arrive at PC 970 uint32_t BoardTime; // 971 972 int16_t StartPix; // First Channel per Pixel (Pixels sorted according Software ID) ; -1 if not filled 973 int16_t StartTM; // First Channel for TimeMark (sorted Hardware ID) ; -1 if not filled 974 975 uint16_t Adc_Data[]; // final length defined by malloc .... 976 977 } __attribute__((__packed__));; 978 979 void handleFadEventData(const DimData &d) 980 { 981 if (d.size()==0) 982 return; 983 984 #ifdef HAVE_ROOT 985 const DimEventData &dat = d.ref<DimEventData>(); 986 987 if (d.size()<sizeof(DimEventData)) 988 { 989 cout << "Size mismatch in " << d.name << ": Found=" << d.size() << " Expected=" << sizeof(DimEventData) << endl; 990 return; 991 } 992 993 if (d.size()!=dat.Roi*2+sizeof(DimEventData)) 994 { 995 cout << "Size mismatch in " << d.name << ": Found=" << d.size() << " Expected=" << dat.Roi*2+sizeof(DimEventData) << endl; 996 return; 997 } 998 999 TCanvas *c = fAdcDataCanv->GetCanvas(); 1000 1001 TH1 *h = dynamic_cast<TH1*>(c->FindObject("EventData")); 1002 if (h && h->GetNbinsX()!=dat.Roi) 1003 { 1004 delete h; 1005 h = 0; 1006 } 1007 1008 if (!h) 1009 { 1010 c->cd(); 1011 1012 TH1D hist("EventData", "", dat.Roi, -0.5, dat.Roi-0.5); 1013 hist.SetStats(kFALSE); 1014 //hist->SetBit(TH1::kNoTitle); 1015 hist.SetMarkerStyle(kFullDotMedium); 1016 hist.SetYTitle("Voltage [mV]"); 1017 hist.GetXaxis()->CenterTitle(); 1018 hist.GetYaxis()->CenterTitle(); 1019 hist.SetMinimum(-1025); 1020 hist.SetMaximum(1025); 1021 h = hist.DrawCopy("P"); 1022 h->SetDirectory(0); 1023 1024 } 1025 1026 ostringstream str; 1027 str << "ADC Pipeline (start=" << dat.StartTM << ")"; 1028 h->SetXTitle(str.str().c_str()); 1029 1030 //str.str(""); 1031 //str << "Crate=" << crate << " Board=" << board << " Channel=" << channel << " [" << d.time() << "]" << endl; 1032 //hist->SetTitle(str.str().c_str()); 1033 1034 for (int i=0; i<dat.Roi; i++) 1035 h->SetBinContent(i+1, dat.Adc_Data[i]-1024); 1036 1037 c->Modified(); 1038 c->Update(); 1039 #endif 1040 } 1041 962 1042 void handleFadConnections(const DimData &d) 963 1043 { 964 if (!CheckSize(d, 4 0))1044 if (!CheckSize(d, 41)) 965 1045 return; 966 1046 … … 976 1056 } 977 1057 } 978 } 979 980 /* 981 TCanvas *c = fAdcDataCanv->GetCanvas(); 982 983 TH1D *hist = c->FindObject("Hist"); 984 if (hist && hist->GetNbinsX()!=...) 985 { 986 delete hist; 987 hist = 0; 988 989 } 990 if (!hist) 991 { 992 hist = new TH1D("Hist", "", n, -0.5, n-0.5); 993 hist->SetStats(kFALSE); 994 hist->SetDirectory(0); 995 //hist->SetBit(TH1::kNoTitle); 996 hist->SetBit(kCanDelete); 997 hist->SetMarkerStyle(kFullDotMedium); 998 hist->SetYTitle("Voltage [mV]"); 999 hist->GetXaxis()->CenterTitle(); 1000 hist->GetYaxis()->CenterTitle(); 1001 hist->SetMinimum(-1025); 1002 hist->SetMaximum(1025); 1003 hist->Draw("P"); 1004 } 1005 1006 ostringstream str; 1007 str << "ADC Pipeline (start=" << startbin << ")"; 1008 hist->SetXTitle(str.str().c_str()); 1009 1010 str.str(""); 1011 str << "Crate=" << crate << " Board=" << board << " Channel=" << channel << " [" << d.time() << "]" << endl; 1012 hist->SetTitle(str.str().c_str()); 1013 1014 for (int i=0; i<n; i++) 1015 hist->SetBinContent(i+1, value[i]-1024); 1016 1017 c->Modified(); 1018 c->Update(); 1019 */ 1058 1059 SetLedColor(fFadLEDEventBuilder, ptr[40]==0?kLedRed:kLedGreen, d.time); 1060 } 1020 1061 1021 1062 // ===================== FTM ============================================ … … 1077 1118 return; 1078 1119 1079 const double avgrate = sdata.fTimeStamp>0 ? double(sdata.fTriggerCounter)/sdata.fTimeStamp*1000000 : 1;1120 // const double avgrate = sdata.fTimeStamp>0 ? double(sdata.fTriggerCounter)/sdata.fTimeStamp*1000000 : 1; 1080 1121 1081 1122 const double t1 = h->GetXaxis()->GetXmax(); … … 1800 1841 return PostInfoHandler(&FactGui::handleFadCurrentEvent); 1801 1842 1843 if (getInfo()==&fDimFadEventData) 1844 return PostInfoHandler(&FactGui::handleFadEventData); 1845 1802 1846 /* 1803 1847 if (getInfo()==&fDimFadSetup) … … 2223 2267 fDimFadEvents ("FAD_CONTROL/EVENTS", (void*)NULL, 0, this), 2224 2268 fDimFadCurrentEvent ("FAD_CONTROL/CURRENT_EVENT", (void*)NULL, 0, this), 2269 fDimFadEventData ("FAD_CONTROL/EVENT_DATA", (void*)NULL, 0, this), 2225 2270 fDimFadConnections ("FAD_CONTROL/CONNECTIONS", (void*)NULL, 0, this) 2226 2271 { 2227 fClockCondFreq->addItem("- /-",QVariant(-1));2228 fClockCondFreq->addItem(" 700 MHz", QVariant(700));2272 fClockCondFreq->addItem("--- Hz", QVariant(-1)); 2273 fClockCondFreq->addItem("800 MHz", QVariant(800)); 2229 2274 fClockCondFreq->addItem("1 GHz", QVariant(1000)); 2230 2275 fClockCondFreq->addItem("2 GHz", QVariant(2000)); 2231 fClockCondFreq->addItem("2 GHz (*)", QVariant(2001));2232 2276 fClockCondFreq->addItem("3 GHz", QVariant(3000)); 2233 2277 fClockCondFreq->addItem("4 GHz", QVariant(4000)); -
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 } -
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++) -
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.