Changeset 10118
- Timestamp:
- 01/25/11 09:47:27 (14 years ago)
- Location:
- fact
- Files:
-
- 4 deleted
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
fact/BIASctrl/Crate.cc
r10096 r10118 32 32 Present[i][j] = false; 33 33 Current[i][j] = 0; 34 CurrentOffset[i][j] = 0;35 34 } 36 35 } … … 293 292 294 293 295 // ***** Determine offset for current measurement *****296 bool Crate::CurrentCalib(double Voltage) {297 298 // Set voltage of all channels and wait for current to settle299 if (GlobalSet((int) (Voltage/90*0xfff)) != 1) return false;300 sleep(1);301 302 // Measure current of all channels303 if (ReadAll() != 1) return false;304 305 for (int i=0; i<MAX_NUM_BOARDS; i++) for (int j=0; j<NUM_CHANNELS; j++) {306 CurrentOffset[i][j] = Current[i][j];307 }308 return true;309 }310 311 312 294 // ***** Set all voltages of board to zero ***** 313 295 void Crate::ClearVoltageArrays() { … … 343 325 344 326 if (Channel >= MAX_NUM_BOARDS*NUM_CHANNELS) return 0; 345 else return Current[Channel/NUM_CHANNELS][Channel%NUM_CHANNELS] -CurrentOffset[Channel/NUM_CHANNELS][Channel%NUM_CHANNELS];327 else return Current[Channel/NUM_CHANNELS][Channel%NUM_CHANNELS]; 346 328 } 347 329 -
fact/BIASctrl/Crate.h
r10096 r10118 35 35 double Volt[MAX_NUM_BOARDS][NUM_CHANNELS]; // Voltage in Volt 36 36 float Current[MAX_NUM_BOARDS][NUM_CHANNELS]; 37 float CurrentOffset[MAX_NUM_BOARDS][NUM_CHANNELS]; // Offset for current measurement38 37 39 38 std::vector<unsigned char> Communicate(std::string); … … 63 62 int GlobalSet(double); 64 63 bool Synch(); 65 bool CurrentCalib(double);66 64 double GetVoltage(unsigned int); 67 65 unsigned int GetDAC(unsigned int); -
fact/BIASctrl/User.cc
r10107 r10118 16 16 } CommandList[] = 17 17 {{"synch", &User::cmd_synch, 0, "", "Synchronize board"}, 18 {"hv", &User::cmd_hv, 2, "<id>|<ch>|<all> <v>", "Change bias of pixel or (all) chan. of active boards"}, 18 {"pixel", &User::cmd_hv, 2, "<pixel id> <v>", "Change bias of pixel"}, 19 {"channel", &User::cmd_hv, 2, "<channel|all> <v>", "Change bias of (all) channels of active boards"}, 19 20 {"gs", &User::cmd_gs, 1, "[crate] <volt>", "Global voltage set"}, 20 21 {"status", &User::cmd_status, 0, "[dac|current]", "Show status information (DAC values if requested)"}, 21 {"ccal", &User::cmd_ccal, 1, "<volt>", "Calibrate current measurement at given voltage"},22 22 {"mode", &User::cmd_mode, 1, "<static|dynamic>", "Set voltage stabilization mode"}, 23 23 {"load", &User::cmd_load, 1, "<file>", "Load and set bias settings from file"}, … … 63 63 } 64 64 65 // Create instances 66 pm = new PixelMap(GetConfig("PixMapTable")); 65 // Create PixelMap instance (map from config server) 66 DimRpcInfo RPC((char *) "ConfigRequest", (char *) ""); 67 RPC.setData((char *) "Misc PixelMap"); 68 PixMap = new PixelMap(std::string(RPC.getString(), RPC.getSize())); 67 69 68 70 // Install DIM command (after all initialized) … … 90 92 91 93 delete DIMCommand; 92 delete pm;94 delete PixMap; 93 95 delete ConsoleOut; 94 96 free(ConsoleText); … … 169 171 for (unsigned int n=1; n < Parameter.size()-1; n+=2) { 170 172 171 // Extract channel identification 172 if (pm->Pixel_to_HVboard(Parameter[n]) != 999999999) { 173 Crt.Min = Crt.Max = pm->Pixel_to_HVboard(Parameter[n]); 174 Chan.Min = Chan.Max = pm->Pixel_to_HVchain(Parameter[n])*NUM_CHANNELS + pm->Pixel_to_HVchannel(Parameter[n]); 175 } 173 // Pixel identification? 174 if (Match(Parameter[0], "pixel")) { 175 // Skip if first character is not digit 176 if (isdigit(Parameter[n][0] == 0)) continue; 177 // Skip if pixel ID not existing 178 if (PixMap->Pixel_to_HVcrate(atoi(Parameter[n].c_str())) == PixMap->PM_ERROR_CODE) continue; 179 180 Crt.Min = Crt.Max = PixMap->Pixel_to_HVcrate(atoi(Parameter[n].c_str())); 181 Chan.Min = Chan.Max = PixMap->Pixel_to_HVboard(atoi(Parameter[n].c_str()))*NUM_CHANNELS + PixMap->Pixel_to_HVchannel(atoi(Parameter[n].c_str())); 182 } 183 // Channel identification 176 184 else { 177 185 vector<string> T = Tokenize(Parameter[n], "/"); … … 181 189 Chan.Max = MAX_NUM_BOARDS*NUM_CHANNELS-1; 182 190 183 if (Parameter[n] == "-") continue;184 185 191 if (T.size() == 2) { 186 192 if(!ConvertToRange(T[0], Crt) || !ConvertToRange(T[1], Chan)) { … … 204 210 } 205 211 206 207 212 // Loop over given crates and channels 208 213 for (int i=Crt.Min; i<=Crt.Max; i++) for (int j=Chan.Min; j<=Chan.Max; j++) { … … 342 347 } 343 348 } 344 }345 346 //347 // Determine current measurement offset348 //349 void User::cmd_ccal() {350 351 double Voltage;352 353 if (!ConvertToDouble(Parameter[1], &Voltage)) {354 PrintMessage("Error with format of voltage parameter\n");355 return;356 }357 358 // Execute current offset determination359 for (unsigned int i=0; i<Crates.size(); i++) {360 if (!Crates[i]->CurrentCalib(Voltage)) {361 PrintMessage("Error with current calibration of crate %d\n", i);362 return;363 }364 365 PrintMessage("Current calibration of crate %d done\n", i);366 }367 349 } 368 350 -
fact/BIASctrl/User.h
r10070 r10118 26 26 enum RunMode {mode_static, mode_dynamic}; 27 27 28 PixelMap * pm;28 PixelMap *PixMap; 29 29 DimCommand *DIMCommand; 30 30 DimService *ConsoleOut; … … 66 66 void cmd_exit(); void cmd_rate(); 67 67 void cmd_timeout(); void cmd_reset(); 68 void cmd_help(); void cmd_ccal(); 69 void cmd_mode(); 68 void cmd_help(); void cmd_mode(); 70 69 }; 71 70 -
fact/Evidence/Edd/Edd.cc
r10112 r10118 23 23 class EddDim *Handler; 24 24 QString DRSBoard = "drsdaq"; 25 std::string PixelMapText; 25 26 26 27 // History chooser function (opens plot for numeric data, TextHist for all other) … … 1016 1017 1017 1018 // Constructor 1018 EventScope::EventScope(QWidget *P): EddBasePlot(P), PixelMap( "../../config/PixelMap.txt", false) {1019 EventScope::EventScope(QWidget *P): EddBasePlot(P), PixelMap(PixelMapText, false) { 1019 1020 1020 1021 Name = DRSBoard+"/EventData"; … … 1064 1065 struct ItemDetails N; 1065 1066 1066 N.Signal = NewCurve(QString::number(Board)+","+QString::number(Chip)+","+ QString::number(Channel)+ " (" + DRS_to_Pixel(Board, Chip, Channel).c_str() + ")");1067 N.Signal = NewCurve(QString::number(Board)+","+QString::number(Chip)+","+ QString::number(Channel)+ " (" + ToPixel(0, Board, Chip, Channel) + ")"); 1067 1068 N.Board = Board; 1068 1069 N.Chip = Chip; … … 1090 1091 ClearCurve(0); 1091 1092 1092 List.first().Signal->setTitle(QString::number(Board)+","+QString::number(Chip)+","+ QString::number(Channel) + " (" + DRS_to_Pixel(Board, Chip, Channel).c_str() + ")");1093 List.first().Signal->setTitle(QString::number(Board)+","+QString::number(Chip)+","+ QString::number(Channel) + " (" + ToPixel(0, Board, Chip, Channel) + ")"); 1093 1094 List.first().Board = Board; 1094 1095 List.first().Chip = Chip; … … 1269 1270 } 1270 1271 1271 1272 // Translate FPA ID to Pixel ID (use '-' instead of PM_ERROR_CODE) 1273 QString EventScope::ToPixel(unsigned int Crate, unsigned int Board, unsigned int Patch, unsigned int Pixel) { 1274 1275 if (FPA_to_Pixel(Crate, Board, Patch, Pixel) == PM_ERROR_CODE) return "-"; 1276 else return QString::number(FPA_to_Pixel(Crate, Board, Patch, Pixel)); 1277 } 1278 1272 1279 //------------------------------------------------------------------ 1273 1280 //**************************** Tab pages *************************** … … 1491 1498 1492 1499 // Pixel ID 1493 PixelID = new Q LineEdit;1500 PixelID = new QSpinBox; 1494 1501 PixelID->setMaximumWidth(60); 1495 connect(PixelID, SIGNAL(returnPressed()), SLOT(TranslatePixelID())); 1502 PixelID->setRange(-1, 9999); 1503 PixelID->setSpecialValueText("n/a"); 1504 connect(PixelID, SIGNAL(valueChanged(int)), SLOT(TranslatePixelID(int))); 1496 1505 PixelID->setToolTip("Pixel identification"); 1497 1506 … … 1560 1569 StartStop(false); 1561 1570 connect(Scope, SIGNAL(PixelData(QVector<double>)), SLOT(SetPixelData(QVector<double>))); 1571 1572 // Call to get initial pixel ID correct 1573 UpdateScope(0); 1562 1574 } 1563 1575 … … 1568 1580 1569 1581 // Translate pixel ID to board, chip, channel 1570 void TP_DAQ::TranslatePixelID() { 1571 1572 if (Scope->Pixel_to_DRSboard(PixelID->text().toStdString()) == 999999999) { 1573 QMessageBox::warning(this, "Edd Message","Pixel ID unknown.",QMessageBox::Ok); 1574 } 1582 void TP_DAQ::TranslatePixelID(int ID) { 1583 1584 // setValue() below will call UpdateScope() through signal, therefore need to store numbers here 1585 unsigned int BoardNo = Scope->Pixel_to_FPAboard(ID); 1586 unsigned int PatchNo = Scope->Pixel_to_FPApatch(ID); 1587 unsigned int PixelNo = Scope->Pixel_to_FPApixel(ID); 1588 1589 if (BoardNo == Scope->PM_ERROR_CODE) PixelID->setValue(-1); 1575 1590 else { 1576 Board->setValue( Scope->Pixel_to_DRSboard(PixelID->text().toStdString()));1577 Chip->setValue( Scope->Pixel_to_DRSchip(PixelID->text().toStdString()));1578 Channel->setValue( Scope->Pixel_to_DRSchannel(PixelID->text().toStdString()));1591 Board->setValue(BoardNo); 1592 Chip->setValue(PatchNo); 1593 Channel->setValue(PixelNo); 1579 1594 } 1580 1595 } … … 1599 1614 1600 1615 // Update pixel ID 1601 PixelID->setText(Scope->DRS_to_Pixel(Board->value(), Chip->value(), Channel->value()).c_str()); 1616 PixelID->setValue(Scope->FPA_to_Pixel(0, Board->value(), Chip->value(), Channel->value())); 1617 if (PixelID->value() == (int) Scope->PM_ERROR_CODE) PixelID->setValue(-1); 1618 1602 1619 // Update first trace 1603 1620 Scope->UpdateFirst(Board->value(), Chip->value(), Channel->value()); … … 1885 1902 if (argc > 1) DRSBoard = "FADctrl"; 1886 1903 1904 // Make RPC to get pixelmap 1905 DimRpcInfo RPC((char *) "ConfigRequest", (char *) ""); 1906 RPC.setData((char *) "Misc PixelMap"); 1907 PixelMapText = std::string(RPC.getString(), RPC.getSize()); 1908 1887 1909 QApplication app(argc, argv); 1888 1910 GUI MainWindow; -
fact/Evidence/Edd/Edd.h
r10112 r10118 290 290 void AddTrace(int, int, int); 291 291 void SetActive(bool); 292 QString ToPixel(unsigned int, unsigned int, unsigned int, unsigned int); 292 293 293 294 private slots: … … 339 340 QPlainTextEdit *RunHeaderDisplay, *EventHeaderDisplay; 340 341 341 QSpinBox *Channel, *Chip, *Board; 342 QLineEdit *PixelID; 342 QSpinBox *Channel, *Chip, *Board, *PixelID; 343 343 QFormLayout *FormLayout; 344 344 QWidget *Display; … … 347 347 348 348 private slots: 349 void TranslatePixelID( );349 void TranslatePixelID(int); 350 350 void UpdateScope(int); 351 351 void KeepCurrent(); -
fact/Feedback/Feedback.cc
r269 r10118 10 10 #include "Feedback.h" 11 11 #include "PixelMap.h" 12 13 #define PIXMAP_LOCATION "../config/PixelMap.txt"14 12 15 13 static const char* FBState_Description[] = { … … 42 40 Feedback::Feedback(): EvidenceServer(SERVER_NAME) { 43 41 44 PixMap = new PixelMap(PIXMAP_LOCATION, false); 42 // Make RPC to get pixelmap 43 DimRpcInfo RPC((char *) "ConfigRequest", (char *) ""); 44 RPC.setData((char *) "Misc PixelMap"); 45 46 PixMap = new PixelMap(std::string(RPC.getString(), RPC.getSize())); 45 47 TimeBarrier = 0; 46 48 … … 52 54 fIDTable = Tokenize(GetConfig("IDTable"), " \t"); 53 55 Multiplicity = new unsigned int [fIDTable.size()]; 54 55 multiset<string> A; 56 char *Buf; 57 56 57 // Determine multiplicity of bias to pixel connection 58 std::vector<unsigned int> A; 58 59 for (unsigned int i=0; i<fIDTable.size(); i++) { 59 if (asprintf(&Buf, "BiasID%d%d%d", PixMap->Pixel_to_HVboard(fIDTable[i]), 60 PixMap->Pixel_to_HVchain(fIDTable[i]), PixMap->Pixel_to_HVchannel(fIDTable[i])) == -1) Message(FATAL, "asprintf() failed"); 61 A.insert(Buf); 62 free(Buf); 63 } 64 65 for (unsigned int i=0; i<fIDTable.size(); i++) { 66 if (asprintf(&Buf, "BiasID%d%d%d", PixMap->Pixel_to_HVboard(fIDTable[i]), 67 PixMap->Pixel_to_HVchain(fIDTable[i]), PixMap->Pixel_to_HVchannel(fIDTable[i])) == -1) Message(FATAL, "asprintf() failed"); 68 Multiplicity[i] = A.count(Buf); 69 free(Buf); 70 } 71 60 A = PixMap->HV_to_Pixel(PixMap->Pixel_to_HVcrate(atoi(fIDTable[i].c_str())), PixMap->Pixel_to_HVboard(atoi(fIDTable[i].c_str())), PixMap->Pixel_to_HVchannel(atoi(fIDTable[i].c_str()))); 61 Multiplicity[i] = A.size(); 62 } 63 72 64 // Initialise with zero content ??? 73 65 Average = new float [fIDTable.size()]; … … 227 219 float Correction; 228 220 229 // Re fect data isfeedback off or timestamp too early221 // Reject data if feedback off or timestamp too early 230 222 if (FBMode == Off || getCommand()->getTimestamp() < TimeBarrier) return; 231 223 TimeBarrier = 0; … … 298 290 // Send command (non-blocking since in handler thread) 299 291 if (!Cmd.str().empty()) { 300 DimClient::sendCommandNB("Bias/Command", (char *) (" hv"+Cmd.str()).c_str());292 DimClient::sendCommandNB("Bias/Command", (char *) ("pixel "+Cmd.str()).c_str()); 301 293 } 302 294 … … 385 377 // Build command 386 378 for (unsigned int i=0; i<fIDTable.size(); i++) { 387 Cmd << fIDTable[i] << " " << std::showpos << -U/2/Multiplicity[i] << " "; 379 Cmd << fIDTable[i] << " " << std::showpos << -U/2/Multiplicity[i] << " "; 388 380 } 389 381 390 382 // Send command 391 383 if (!Cmd.str().empty()) { 392 DimClient::sendCommand("Bias/Command", (" hv"+Cmd.str()).c_str());384 DimClient::sendCommand("Bias/Command", ("pixel "+Cmd.str()).c_str()); 393 385 } 394 386 395 387 DiffVoltage = U; 396 388 SetFBMode(ResponseFirst); 397 PrintMessage(" HVFeedback: Decreasing voltages by %f for response measurement, acquiring data.\n",DiffVoltage/2);389 PrintMessage("Feedback: Decreasing voltages by %f for response measurement, acquiring data.\n",DiffVoltage/2); 398 390 } 399 391 … … 439 431 void Feedback::commandHandler() { 440 432 441 string Command = ToString( "C", getCommand()->getData(), getCommand()->getSize());433 string Command = ToString((char *) "C", getCommand()->getData(), getCommand()->getSize()); 442 434 443 435 // Parse command into tokens -
fact/Feedback/Makefile
r269 r10118 12 12 13 13 CPPFLAGS = -DREVISION='"$(REVISION)"' -O3 -Wall 14 LIBS = - lstdc++ -lz -lpthread -lutil -lfl -lreadline -ltermcap $(DIMDIR)/linux/libdim.a14 LIBS = -L /usr/lib/termcap -lstdc++ -lz -lpthread -lutil -lfl -lreadline -ltermcap $(DIMDIR)/linux/libdim.a 15 15 16 16 Feedback: $(OBJECTS) -
fact/drsdaq/Makefile
r269 r10118 26 26 27 27 CPPFLAGS = -DREVISION='"$(REVISION)"' -O3 -Wall $(VMECTRL) 28 LIBS = - lstdc++ -lz -lpthread -lutil -lfl -lreadline -ltermcap $(VMELIB) $(DIMDIR)/linux/libdim.a28 LIBS = -L /usr/lib/termcap -lstdc++ -lz -lpthread -lutil -lfl -lreadline -ltermcap $(VMELIB) $(DIMDIR)/linux/libdim.a 29 29 30 30 drsdaq: $(OBJECTS) -
fact/tools/Scripts/Logon
r274 r10118 12 12 export LD_LIBRARY_PATH=$QWTDIR/lib:$DIMDIR/linux:$LD_LIBRARY_PATH 13 13 export PATH=$DIMDIR/linux:$REPOS_DIR/tools/Scripts:$QTDIR/bin:.:$PATH 14 15 echo16 echo Note: Operation needs Evidence configuration server running on $DIM_DNS_NODE17 echo "To start, log on as user 'daqct3' and execute 'start' script"18 echo "Contact: Oliver Grimm (32192) or Quirin Weitzel (33973)"19 echo20 14 21 15 # Check if repository is a mixed or locally modified version (only for login shell)) -
fact/tools/ddd/Functions.cpp
r198 r10118 57 57 BoardNo->setEnabled(true); 58 58 PixelID->setEnabled(true); 59 M0Start->setEnabled(true);60 M0Stop->setEnabled(true);61 59 PhysPipeAction->setEnabled(true); 62 60 EventNo->setRange(1, R->Events); 63 M0Display->setEnabled(true);64 M0Start->setRange(0, R->Samples-1);65 M0Stop->setRange(0, R->Samples-1);66 61 ChannelNo->setRange(0, R->NChannels-1); 67 62 ChipNo->setRange(0, R->NChips-1); … … 78 73 BoardNo->setEnabled(false); 79 74 PixelID->setEnabled(false); 80 M0Start->setEnabled(false);81 M0Stop->setEnabled(false);82 75 PhysPipeAction->setEnabled(false); 83 76 RunHeaderDisplay->clear(); … … 90 83 void ddd::DisplayEvent(int) { 91 84 92 PixelID->set Text(PixMap->DRS_to_Pixel(BoardNo->value(), ChipNo->value(), ChannelNo->value()).c_str()); // Translate to pixel ID85 PixelID->setValue(PixMap->FPA_to_Pixel(0, BoardNo->value(), ChipNo->value(), ChannelNo->value())); // Translate to pixel ID 93 86 if(Socket->state() == QAbstractSocket::ConnectedState) return; // do not execute if socket is open 94 87 … … 149 142 delete[] x; delete[] y; 150 143 151 // ************************************152 // Get data for M0 display (event based)153 // ************************************154 155 if (!(M0Display->isEnabled())) return;156 157 double z[6][6] = {{0}};//36 pixels158 bool IDerror = false;159 160 //only interested in M0 data using DRS2161 //if (RD->RHeader->NChannels == 9) IDerror = true;162 163 //only interested in M0 data using DRS4164 if (RD->RHeader->NChannels == 10) IDerror = true;165 166 for(unsigned int i=0; i<RD->RHeader->NBoards; i++) {//board loop167 for(unsigned int j=0; j<RD->RHeader->NChips; j++) {//chip loop168 for(unsigned int k=0; k<RD->RHeader->NChannels; k++) {//channel loop169 170 //for DRS2 data (requires the correct pixelmap!!!171 //if( ( (i==0 || i==1) && (j<=1) && (k<=7) ) || ( (i==2) && (j==0) && (k<=3) ) ) {172 173 //for DRS4 data (requires the correct pixelmap!!!174 if( ( (i==0 || i==1) && (j<=3) && (k==0 || k==2 || k==4 || k==6) ) || ( (i==2) && (j==0) && (k==0 || k==2 || k==4 || k==6) ) ) {175 176 //get module, superpixel and pixel number from pixel name177 std::string pixelname = PixMap->DRS_to_Pixel(i,j,k);178 if (pixelname == "") {179 IDerror = true;180 continue;181 }182 char pixelname_copy[256];183 memset(pixelname_copy,'\0',256);184 pixelname.copy(pixelname_copy, 256);185 186 char delim[] = "-";187 char *buffer = NULL;188 int module = -1;189 int superpixel = -1;190 int pixel = -1;191 192 buffer = strtok(pixelname_copy, delim);193 module = atoi(buffer);194 buffer = strtok(NULL, delim);195 superpixel = atoi(buffer);196 buffer = strtok(NULL, delim);197 pixel = atoi(buffer);198 199 //usual M0 mapping200 //int binx = 5-(int((superpixel-1)/3)*2)-(int((pixel%4)/2));201 //int biny = 5-(((superpixel-1)%3)*2)-(int((pixel-1)/2));202 203 //M0 upside down204 int binx = 5-(5-(int((superpixel-1)/3)*2)-(int((pixel%4)/2)));205 int biny = 5-(5-(((superpixel-1)%3)*2)-(int((pixel-1)/2)));206 207 //search maximum sample amplitude within user specified window208 //start bin is always smaller than stop bin (taken care of by updated ranges)209 int StartBin = (int)(M0Start->value());210 int StopBin = (int)(M0Stop->value());211 212 for(int l=StartBin; l<=StopBin; l++){213 214 float sample = *((short *) (RD->Data + RD->RHeader->NBoards*RD->RHeader->NChips*sizeof(int)) +215 i*RD->RHeader->NChips*RD->RHeader->NChannels*RD->RHeader->Samples+216 j*RD->RHeader->NChannels*RD->RHeader->Samples+217 k*RD->RHeader->Samples+218 l)*RD->BStruct[i].ScaleFactor;219 220 if (fabs(sample) > z[binx][biny]) {221 z[binx][biny]=fabs(sample);222 }223 224 }//sample loop225 }//only M0 data226 }//channel loop227 }//chip loop228 }//board loop229 230 if(IDerror){231 QMessageBox::warning(this, "ddd Message","Sorry! The M0 display is not available for this data file because of a pixel ID mismatch.",QMessageBox::Ok);232 if(M0Window->isVisible()) M0Window->hide();233 M0Display->setEnabled(false);234 return;235 }236 237 //fill data to M0 display (event based)238 Signal2D->setData(SpectrogramDataM0(z));239 Graph2D->axisWidget(QwtPlot::yRight)->setColorMap(Signal2D->data().range(),Signal2D->colorMap());240 Graph2D->setAxisScale(QwtPlot::yRight,Signal2D->data().range().minValue(),Signal2D->data().range().maxValue() );241 Graph2D->replot();242 243 //update ranges for start and stop bin to avoid startbin > stopbin244 M0Start->setRange(0, M0Stop->value());245 M0Stop->setRange(M0Start->value(),(RD->RHeader->Samples)-1);246 144 } 247 145 … … 252 150 else SocketWindow->show(); 253 151 } 254 255 // +++ Open sub window for M0 Display +++256 void ddd::OpenM0Window() {257 258 if(M0Window->isVisible()) M0Window->hide();259 else M0Window->show();260 }261 262 152 263 153 // +++ Acquire data through socket (acquire botton only available if socket exists) +++ … … 307 197 CloseDatafile(); 308 198 309 M0Window->hide();310 M0Display->setEnabled(false);311 312 199 ChannelNo->setEnabled(true); 313 200 ChipNo->setEnabled(true); … … 416 303 417 304 // +++ Translate pixel ID +++ 418 void ddd::TranslatePixelID() { 419 420 int Board = PixMap->Pixel_to_DRSboard(PixelID->text().toStdString()); 421 int Chip = PixMap->Pixel_to_DRSchip(PixelID->text().toStdString()); 422 int Channel = PixMap->Pixel_to_DRSchannel(PixelID->text().toStdString()); 423 305 void ddd::TranslatePixelID(int ID) { 306 307 // setValue() below will call UpdateScope() through signal, therefore need to store numbers here 308 int Board = PixMap->Pixel_to_FPAboard(ID); 309 int Chip = PixMap->Pixel_to_FPApatch(ID); 310 int Channel = PixMap->Pixel_to_FPApixel(ID); 311 424 312 if(Board >= BoardNo->minimum() && Board <= BoardNo->maximum() && 425 313 Chip >= ChipNo->minimum() && Chip <= ChipNo->maximum() && … … 429 317 ChannelNo->setValue(Channel); 430 318 } 431 else if (Board==999999999) QMessageBox::warning(this, "ddd Message","Pixel ID unknown.",QMessageBox::Ok);319 else if (Board == (int) PixMap->PM_ERROR_CODE) PixelID->setValue(-1); 432 320 else QMessageBox::warning(this, "ddd Message","Pixel ID out of current range.",QMessageBox::Ok); 433 321 } -
fact/tools/ddd/GUI.cpp
r198 r10118 22 22 // Instantiate without console output 23 23 RD = new RawDataCTX(true); 24 PixMap = new PixelMap("../../config/PixelMap.txt", false); 24 25 // Instantiate PixelMap 26 DimRpcInfo RPC((char *) "ConfigRequest", (char *) ""); 27 RPC.setData((char *) "Misc PixelMap"); 28 PixMap = new PixelMap(std::string(RPC.getString(), RPC.getSize())); 25 29 26 30 Tmpfile = tmpfile(); … … 67 71 BoardNo->setToolTip("Mezzanine board number"); 68 72 69 // TextBox for pixel ID70 PixelID = new Q LineEdit(Central);73 // SpinBox for pixel ID 74 PixelID = new QSpinBox(Central); 71 75 PixelID->setEnabled(false); 72 connect(PixelID, SIGNAL(returnPressed()), this, SLOT(TranslatePixelID())); 76 PixelID->setRange(-1, 9999); 77 PixelID->setSpecialValueText("n/a"); 78 connect(PixelID, SIGNAL(valueChanged(int)), this, SLOT(TranslatePixelID(int))); 73 79 PixelID->setToolTip("Pixel identification"); 74 80 … … 86 92 connect(SocketButton, SIGNAL(clicked()), this, SLOT(OpenSocketWindow())); 87 93 SocketButton->setToolTip("Open window for socket communication"); 88 89 // M0 display button90 M0Display = new QPushButton("M0 Display",Central);91 M0Display->setFont(QFont("Times", 10, QFont::Bold));92 connect(M0Display, SIGNAL(clicked()), this, SLOT(OpenM0Window()));93 M0Display->setToolTip("Open window for M0 display");94 94 95 95 // Acquire button and Continuous check box … … 150 150 MainLayout->addLayout(FormLayout, 2, 0); 151 151 MainLayout->addWidget(SocketButton, 6,0); 152 MainLayout->addWidget(M0Display, 3,0);153 152 MainLayout->addWidget(GetButton, 4,0); 154 153 MainLayout->addWidget(ContinuousBox, 5,0); … … 229 228 SocketLayout->addWidget(SocketOutput, 2, 0, 4, 4); 230 229 231 //-----------------------------------------------------------------------232 //**************************** M0 window ****************************233 //-----------------------------------------------------------------------234 235 M0Window = new QWidget();236 M0Window->setWindowTitle("ddd - M0 Display");237 238 Graph2D = new QwtPlot(M0Window);239 Graph2D->setAutoReplot(true);240 Graph2D->setCanvasBackground(QColor(Qt::white));241 242 M0Start = new QSpinBox(M0Window);243 M0Start->setEnabled(false);244 connect(M0Start, SIGNAL(valueChanged(int)), this, SLOT(DisplayEvent(int)));245 M0Start->setToolTip("First bin/sample of time window");246 M0StartLayout = new QFormLayout;247 M0StartLayout->addRow("First Bin", M0Start);248 249 M0Stop = new QSpinBox(M0Window);250 M0Stop->setEnabled(false);251 M0Stop->setRange(0,1023);252 M0Stop->setValue(1023);253 connect(M0Stop, SIGNAL(valueChanged(int)), this, SLOT(DisplayEvent(int)));254 M0Stop->setToolTip("Last bin/sample of time window");255 M0StopLayout = new QFormLayout;256 M0StopLayout->addRow("Last Bin", M0Stop);257 258 M0Layout = new QGridLayout(M0Window);259 M0Layout->addWidget(Graph2D, 1,1,3,3);260 M0Layout->addLayout(M0StartLayout,4,1);261 M0Layout->addLayout(M0StopLayout,4,2);262 263 Signal2D = new QwtPlotSpectrogram;264 Signal2D->attach(Graph2D);265 266 //initialize raster data of M0 display267 double z[6][6];268 for (int i=0; i<6; i++){269 for (int j=0; j<6; j++){270 z[i][j]=i+j;271 }272 }273 Signal2D->setData(SpectrogramDataM0(z));274 275 //color (z-) axis of M0 display276 colorMap = QwtLinearColorMap(Qt::yellow, Qt::red);277 Signal2D->setColorMap(colorMap);278 279 Graph2D->axisWidget(QwtPlot::yRight)->setTitle("Maximum Sample Amplitude (mV)");280 Graph2D->axisWidget(QwtPlot::yRight)->setColorBarEnabled(true);281 Graph2D->axisWidget(QwtPlot::yRight)->setColorMap(Signal2D->data().range(),Signal2D->colorMap());282 283 Graph2D->setAxisScale(QwtPlot::yRight,Signal2D->data().range().minValue(),Signal2D->data().range().maxValue());284 Graph2D->enableAxis(QwtPlot::yRight);285 Graph2D->plotLayout()->setAlignCanvasToScales(true);286 Graph2D->replot();287 288 230 } 289 231 … … 291 233 // Qwt items 292 234 delete Grid; delete Signal; 293 delete Signal2D;294 235 // Layout items 295 236 delete PortLayout; delete CommandLayout; 296 delete M0StartLayout; delete M0StopLayout;297 237 delete AddressLayout; delete FormLayout; 298 238 delete SpinLayout; 299 239 // Other items 300 240 delete SocketWindow; 301 delete M0Window;302 241 delete PixMap; delete RD; 303 242 -
fact/tools/ddd/GUI.h
r198 r10118 10 10 #include <qwt_plot_zoomer.h> 11 11 #include <qwt_plot_panner.h> 12 #include <qwt_plot_spectrogram.h>13 #include <qwt_raster_data.h>14 #include <qwt_scale_widget.h>15 #include <qwt_plot_layout.h>16 #include <qwt_color_map.h>17 12 18 13 #include "../../drsdaq/RawDataCTX.h" 19 14 #include "../../pixelmap/PixelMap.h" 15 #include "dic.hxx" 20 16 21 17 #define SOCKET_TIMEOUT 10000 // Milliseconds to wait for socket connection … … 28 24 Q_OBJECT 29 25 30 QPushButton *GetButton, *SocketButton, *Connect , *M0Display;26 QPushButton *GetButton, *SocketButton, *Connect; 31 27 QCheckBox *ContinuousBox; 32 28 QToolButton *LoadButton; 33 QLineEdit *FilenameBox, *IPAddress, *Command , *PixelID;34 QSpinBox * EventNo, *ChannelNo, *ChipNo, *BoardNo, *Port, *M0Start, *M0Stop;29 QLineEdit *FilenameBox, *IPAddress, *Command; 30 QSpinBox *PixelID, *EventNo, *ChannelNo, *ChipNo, *BoardNo, *Port; 35 31 QPlainTextEdit *RunHeaderDisplay, *EventHeaderDisplay, *SocketOutput; 36 32 QTabWidget *TabWidget; 37 33 QTcpSocket *Socket; 38 QWidget *SocketWindow, *Central , *M0Window;34 QWidget *SocketWindow, *Central; 39 35 QAction *OpenAction, *ConnectAction, *PhysPipeAction; 40 QGridLayout *SocketLayout, *MainLayout , *M0Layout;41 QFormLayout *CommandLayout, *PortLayout, *AddressLayout, *FormLayout, *SpinLayout , *M0StartLayout, *M0StopLayout;36 QGridLayout *SocketLayout, *MainLayout; 37 QFormLayout *CommandLayout, *PortLayout, *AddressLayout, *FormLayout, *SpinLayout; 42 38 43 QwtPlot *Graph , *Graph2D;39 QwtPlot *Graph; 44 40 QwtPlotZoomer *Zoomer; 45 41 QwtPlotCurve *Signal; 46 42 QwtPlotPanner *Panner; 47 43 QwtPlotGrid *Grid; 48 QwtPlotSpectrogram *Signal2D; 49 QwtLinearColorMap colorMap; 50 44 51 45 void closeEvent(QCloseEvent *); 52 46 … … 66 60 void FileDialog(); 67 61 void OpenSocketWindow(); 68 void OpenM0Window();69 62 void GetSignalFromSocket(); 70 63 void MakeConnection(); … … 73 66 void GotDisconnected(); 74 67 void HandleZoom(const QwtDoubleRect &); 75 void TranslatePixelID( );68 void TranslatePixelID(int); 76 69 77 70 void MenuSave(); … … 81 74 void MenuAbout(); 82 75 }; 83 84 //Data class for 2D spectrogram (MO display specific)85 class SpectrogramDataM0: public QwtRasterData {86 87 private:88 89 double _z[6][6];90 double _zmin;91 double _zmax;92 93 public:94 95 SpectrogramDataM0(const double z[6][6]): QwtRasterData(QwtDoubleRect(0, 0, 6, 6)) {96 for (int i = 0; i<6; i++){97 for (int j = 0; j<6; j++){98 _z[i][j] = z[i][j];99 if (z[i][j] > _zmax) _zmax = z[i][j];100 if (z[i][j] < _zmin) _zmin = z[i][j];101 }102 }103 }104 105 virtual QwtRasterData *copy() const {106 return new SpectrogramDataM0(_z);107 }108 109 virtual QwtDoubleInterval range() const {110 return QwtDoubleInterval(_zmin, _zmax);111 }112 113 virtual void initRaster(const QwtDoubleRect = QwtDoubleRect(0, 0, 6, 6),114 const QSize =QSize(1,1)) {};115 116 virtual double value(double x, double y) const {117 118 unsigned int first = (unsigned int)x;119 unsigned int second = (unsigned int)y;120 121 const double v = _z[first][second];122 return v;123 124 }125 126 }; -
fact/tools/ddd/ddd.pro
r229 r10118 6 6 TARGET = 7 7 DEPENDPATH += . 8 INCLUDEPATH += . /ihp/local/qwt-5.2.1/include8 INCLUDEPATH += . .. $(QWTDIR)/include $(DIMDIR)/dim ../../drsdaq ../../pixelmap 9 9 10 10 # Input 11 11 HEADERS += GUI.h ../../pixelmap/Pixel.h ../../pixelmap/PixelMap.h ../../drsdaq/RawDataCTX.h 12 12 SOURCES += Functions.cpp GUI.cpp ../../pixelmap/Pixel.cc ../../pixelmap/PixelMap.cc ../../drsdaq/RawDataCTX.cc 13 LIBS += -L /ihp/local/qwt-5.2.1/lib -lqwt13 LIBS += -L$(QWTDIR)/lib -lqwt $(DIMDIR)/linux/libdim.a 14 14 QT += network
Note:
See TracChangeset
for help on using the changeset viewer.