Legend:
- Unmodified
- Added
- Removed
-
tools/ddd/Functions.cpp
r197 r198 37 37 default: break; 38 38 } 39 if (RD->RHeader->MagicNum == MAGICNUM_OPEN) { 39 RunHeader *R = RD->RHeader; 40 41 if (R->MagicNum == MAGICNUM_OPEN) { 40 42 QMessageBox::warning(this, "ddd Message","Magic number in run header indicates that the file has not been closed properly.",QMessageBox::Ok); 41 43 } 42 if (R D->RHeader->MagicNum == MAGICNUM_ERROR) {44 if (R->MagicNum == MAGICNUM_ERROR) { 43 45 QMessageBox::warning(this, "ddd Message","Magic number in run header indicates that an error occurred while writing the file.",QMessageBox::Ok); 44 46 } … … 52 54 EventNo->setEnabled(true); 53 55 ChannelNo->setEnabled(true); 56 ChipNo->setEnabled(true); 54 57 BoardNo->setEnabled(true); 55 58 PixelID->setEnabled(true); … … 57 60 M0Stop->setEnabled(true); 58 61 PhysPipeAction->setEnabled(true); 59 EventNo->setRange(1, R D->RHeader->Events);62 EventNo->setRange(1, R->Events); 60 63 M0Display->setEnabled(true); 61 M0Start->setRange(0,(RD->RHeader->Samples)-1); 62 M0Stop->setRange(0,(RD->RHeader->Samples)-1); 63 ChannelNo->setRange(0, RD->RHeader->NChannels*RD->RHeader->NChips-1); 64 BoardNo->setRange(0, RD->RHeader->NBoards-1); 64 M0Start->setRange(0, R->Samples-1); 65 M0Stop->setRange(0, R->Samples-1); 66 ChannelNo->setRange(0, R->NChannels-1); 67 ChipNo->setRange(0, R->NChips-1); 68 BoardNo->setRange(0, R->NBoards-1); 65 69 DisplayEvent(); 66 70 } … … 71 75 EventNo->setEnabled(false); 72 76 ChannelNo->setEnabled(false); 77 ChipNo->setEnabled(false); 73 78 BoardNo->setEnabled(false); 74 79 PixelID->setEnabled(false); … … 85 90 void ddd::DisplayEvent(int) { 86 91 87 PixelID->setText(PixMap->DRS_to_Pixel(BoardNo->value(), ChannelNo->value()/RD->RHeader->NChannels, 88 ChannelNo->value()%RD->RHeader->NChannels).c_str()); // Translate to pixel ID 92 PixelID->setText(PixMap->DRS_to_Pixel(BoardNo->value(), ChipNo->value(), ChannelNo->value()).c_str()); // Translate to pixel ID 89 93 if(Socket->state() == QAbstractSocket::ConnectedState) return; // do not execute if socket is open 90 94 … … 104 108 return; 105 109 } 106 110 RunHeader *R = RD->RHeader; 111 107 112 // Print event header and trigger cell information from event data 108 113 rewind(Tmpfile); … … 111 116 112 117 text.append("\nTrigger cells: "); 113 for (unsigned int i=0; i<R D->RHeader->NBoards*RD->RHeader->NChips; i++) {118 for (unsigned int i=0; i<R->NBoards*R->NChips; i++) { 114 119 QString a; 115 120 text.append(a.sprintf("%d ", *((int *)RD->Data + i))); … … 118 123 119 124 // Case data in double format required by qwt library 120 double *x = new double [R D->RHeader->Samples];121 double *y = new double [R D->RHeader->Samples];122 123 for (unsigned int i=0; i<R D->RHeader->Samples; i++) {125 double *x = new double [R->Samples]; 126 double *y = new double [R->Samples]; 127 128 for (unsigned int i=0; i<R->Samples; i++) { 124 129 x[i] = (double) (i/RD->BStruct[BoardNo->value()].NomFreq); 125 130 if (PhysPipeAction->isChecked()) { 126 y[(i + *((int *) RD->Data + BoardNo->value()*RD->RHeader->NChips+ChannelNo->value()/RD->RHeader->NChannels))%1024] = (double) *((short *) (RD->Data + RD->RHeader->NBoards*RD->RHeader->NChips*sizeof(int)) + BoardNo->value()*RD->RHeader->NChips*RD->RHeader->NChannels * RD->RHeader->Samples + ChannelNo->value()*RD->RHeader->Samples + i)*RD->BStruct[BoardNo->value()].ScaleFactor; 131 y[(i + *((int *) RD->Data + BoardNo->value()*R->NChips+ChipNo->value()))%1024] = 132 (double) *((short *) (RD->Data + R->NBoards*R->NChips*sizeof(int)) + 133 BoardNo->value()*R->NChips*R->NChannels*R->Samples + 134 ChipNo->value()*R->NChannels*R->Samples + 135 ChannelNo->value()*RD->RHeader->Samples + i) * RD->BStruct[BoardNo->value()].ScaleFactor; 127 136 } 128 137 else { 129 y[i] = (double) *((short *) (RD->Data + RD->RHeader->NBoards*RD->RHeader->NChips*sizeof(int)) + BoardNo->value()*RD->RHeader->NChips*RD->RHeader->NChannels * RD->RHeader->Samples+ChannelNo->value()*RD->RHeader->Samples+(i))*RD->BStruct[BoardNo->value()].ScaleFactor; 138 y[i] = (double) *((short *) (RD->Data + R->NBoards*R->NChips*sizeof(int)) + 139 BoardNo->value()*R->NChips*R->NChannels*R->Samples + 140 ChipNo->value()*R->NChannels*R->Samples + 141 ChannelNo->value()*R->Samples + i) * RD->BStruct[BoardNo->value()].ScaleFactor; 130 142 } 131 143 } 132 144 133 Signal->setData(x, y, (int) R D->RHeader->Samples);145 Signal->setData(x, y, (int) R->Samples); 134 146 Signal->show(); 135 147 Zoomer->setZoomBase(Signal->boundingRect()); … … 255 267 GetButton->setEnabled(false); 256 268 WaitForData = true; 257 sprintf(Command, "read %d %d %d restart", BoardNo->value(), Ch annelNo->value()/10, ChannelNo->value()%10);269 sprintf(Command, "read %d %d %d restart", BoardNo->value(), ChipNo->value(), ChannelNo->value()); 258 270 Socket->write(Command); 259 271 } … … 299 311 300 312 ChannelNo->setEnabled(true); 313 ChipNo->setEnabled(true); 301 314 BoardNo->setEnabled(true); 302 315 PixelID->setEnabled(true); 303 316 ChannelNo->setRange(0, 65535); 317 ChipNo->setRange(0, 65535); 304 318 BoardNo->setRange(0, 65535); 305 319 … … 390 404 GetButton->setEnabled(false); 391 405 ChannelNo->setEnabled(false); 406 ChipNo->setEnabled(false); 392 407 BoardNo->setEnabled(false); 393 408 PixelID->setEnabled(false); … … 407 422 int Channel = PixMap->Pixel_to_DRSchannel(PixelID->text().toStdString()); 408 423 409 if(Board>=BoardNo->minimum() && Board<=BoardNo->maximum() && 410 (Chip*10+Channel)>=ChannelNo->minimum() && (Chip*10+Channel)<=ChannelNo->maximum()) { 424 if(Board >= BoardNo->minimum() && Board <= BoardNo->maximum() && 425 Chip >= ChipNo->minimum() && Chip <= ChipNo->maximum() && 426 Channel>= ChannelNo->minimum() && Channel <= ChannelNo->maximum()) { 411 427 BoardNo->setValue(Board); 412 ChannelNo->setValue(Chip*10+Channel); 428 ChipNo->setValue(Chip); 429 ChannelNo->setValue(Channel); 413 430 } 414 431 else if(Board==999999999) QMessageBox::warning(this, "ddd Message","Pixel ID unknown.",QMessageBox::Ok); -
tools/ddd/GUI.cpp
r129 r198 47 47 SpinLayout = new QFormLayout(); 48 48 SpinLayout->setRowWrapPolicy(QFormLayout::WrapAllRows); 49 SpinLayout->addRow("E&vent #", EventNo);49 SpinLayout->addRow("E&vent", EventNo); 50 50 51 51 // SpinBox for channel number … … 53 53 ChannelNo->setEnabled(false); 54 54 connect(ChannelNo, SIGNAL(valueChanged(int)), this, SLOT(DisplayEvent(int))); 55 ChannelNo->setToolTip("Channels 0-19 for 2 DRS chips per mezzanine board"); 55 ChannelNo->setToolTip("DRS channel number"); 56 57 // SpinBox for chip number 58 ChipNo = new QSpinBox(Central); 59 ChipNo->setEnabled(false); 60 connect(ChipNo, SIGNAL(valueChanged(int)), this, SLOT(DisplayEvent(int))); 61 ChipNo->setToolTip("DRS chip number"); 56 62 57 63 // SpinBox for board number … … 70 76 FormLayout = new QFormLayout; 71 77 FormLayout->setRowWrapPolicy(QFormLayout::WrapAllRows); 72 FormLayout->addRow("&Channel #", ChannelNo); 73 FormLayout->addRow("&Board #", BoardNo); 78 FormLayout->addRow("&Channel", ChannelNo); 79 FormLayout->addRow("Chip", ChipNo); 80 FormLayout->addRow("&Board", BoardNo); 74 81 FormLayout->addRow("Pixel ID", PixelID); 75 82 -
tools/ddd/GUI.h
r129 r198 32 32 QToolButton *LoadButton; 33 33 QLineEdit *FilenameBox, *IPAddress, *Command, *PixelID; 34 QSpinBox *EventNo, *ChannelNo, * BoardNo, *Port, *M0Start, *M0Stop;34 QSpinBox *EventNo, *ChannelNo, *ChipNo, *BoardNo, *Port, *M0Start, *M0Stop; 35 35 QPlainTextEdit *RunHeaderDisplay, *EventHeaderDisplay, *SocketOutput; 36 36 QTabWidget *TabWidget;
Note:
See TracChangeset
for help on using the changeset viewer.