Changeset 198 for tools


Ignore:
Timestamp:
04/19/10 10:01:39 (15 years ago)
Author:
ogrimm
Message:
Added chip selection spin box
Location:
tools/ddd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • tools/ddd/Functions.cpp

    r197 r198  
    3737    default: break;
    3838  }
    39   if (RD->RHeader->MagicNum == MAGICNUM_OPEN) {
     39  RunHeader *R = RD->RHeader;
     40
     41  if (R->MagicNum == MAGICNUM_OPEN) {
    4042    QMessageBox::warning(this, "ddd Message","Magic number in run header indicates that the file has not been closed properly.",QMessageBox::Ok);
    4143  }
    42   if (RD->RHeader->MagicNum == MAGICNUM_ERROR) {
     44  if (R->MagicNum == MAGICNUM_ERROR) {
    4345    QMessageBox::warning(this, "ddd Message","Magic number in run header indicates that an error occurred while writing the file.",QMessageBox::Ok);
    4446  }
     
    5254  EventNo->setEnabled(true);
    5355  ChannelNo->setEnabled(true);
     56  ChipNo->setEnabled(true);
    5457  BoardNo->setEnabled(true);
    5558  PixelID->setEnabled(true);
     
    5760  M0Stop->setEnabled(true);
    5861  PhysPipeAction->setEnabled(true);
    59   EventNo->setRange(1, RD->RHeader->Events);
     62  EventNo->setRange(1, R->Events);
    6063  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);
    6569  DisplayEvent();
    6670}
     
    7175    EventNo->setEnabled(false);
    7276    ChannelNo->setEnabled(false);
     77    ChipNo->setEnabled(false);
    7378    BoardNo->setEnabled(false);
    7479    PixelID->setEnabled(false);
     
    8590void ddd::DisplayEvent(int) {
    8691
    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
    8993  if(Socket->state() == QAbstractSocket::ConnectedState) return; // do not execute if socket is open
    9094 
     
    104108    return;
    105109  }
    106  
     110  RunHeader *R = RD->RHeader;
     111
    107112  // Print event header and trigger cell information from event data
    108113  rewind(Tmpfile);
     
    111116 
    112117  text.append("\nTrigger cells: ");
    113   for (unsigned int i=0; i<RD->RHeader->NBoards*RD->RHeader->NChips; i++) {
     118  for (unsigned int i=0; i<R->NBoards*R->NChips; i++) {
    114119    QString a;
    115120    text.append(a.sprintf("%d ", *((int *)RD->Data + i)));
     
    118123
    119124  // Case data in double format required by qwt library
    120   double *x = new double [RD->RHeader->Samples];
    121   double *y = new double [RD->RHeader->Samples];
    122 
    123   for (unsigned int i=0; i<RD->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++) {
    124129    x[i] = (double) (i/RD->BStruct[BoardNo->value()].NomFreq);
    125130        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;
    127136        }
    128137        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;
    130142        }
    131143  }
    132144
    133   Signal->setData(x, y, (int) RD->RHeader->Samples);
     145  Signal->setData(x, y, (int) R->Samples);
    134146  Signal->show();
    135147  Zoomer->setZoomBase(Signal->boundingRect());
     
    255267  GetButton->setEnabled(false);
    256268  WaitForData = true;
    257   sprintf(Command, "read %d %d %d restart", BoardNo->value(), ChannelNo->value()/10, ChannelNo->value()%10);
     269  sprintf(Command, "read %d %d %d restart", BoardNo->value(), ChipNo->value(), ChannelNo->value());
    258270  Socket->write(Command);
    259271}
     
    299311
    300312      ChannelNo->setEnabled(true);
     313      ChipNo->setEnabled(true);
    301314      BoardNo->setEnabled(true);
    302315      PixelID->setEnabled(true);
    303316      ChannelNo->setRange(0, 65535);
     317      ChipNo->setRange(0, 65535);
    304318      BoardNo->setRange(0, 65535);
    305319     
     
    390404  GetButton->setEnabled(false);
    391405  ChannelNo->setEnabled(false);
     406  ChipNo->setEnabled(false);
    392407  BoardNo->setEnabled(false);
    393408  PixelID->setEnabled(false);
     
    407422  int Channel = PixMap->Pixel_to_DRSchannel(PixelID->text().toStdString());
    408423
    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()) {
    411427    BoardNo->setValue(Board);
    412     ChannelNo->setValue(Chip*10+Channel);
     428    ChipNo->setValue(Chip);
     429    ChannelNo->setValue(Channel);
    413430  }
    414431  else if(Board==999999999) QMessageBox::warning(this, "ddd Message","Pixel ID unknown.",QMessageBox::Ok);
  • tools/ddd/GUI.cpp

    r129 r198  
    4747  SpinLayout = new QFormLayout();
    4848  SpinLayout->setRowWrapPolicy(QFormLayout::WrapAllRows);
    49   SpinLayout->addRow("E&vent #", EventNo);
     49  SpinLayout->addRow("E&vent", EventNo);
    5050
    5151  // SpinBox for channel number
     
    5353  ChannelNo->setEnabled(false);
    5454  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");
    5662 
    5763  // SpinBox for board number
     
    7076  FormLayout = new QFormLayout;
    7177  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);
    7481  FormLayout->addRow("Pixel ID", PixelID);
    7582
  • tools/ddd/GUI.h

    r129 r198  
    3232    QToolButton *LoadButton;
    3333    QLineEdit *FilenameBox, *IPAddress, *Command, *PixelID;
    34     QSpinBox *EventNo, *ChannelNo, *BoardNo, *Port, *M0Start, *M0Stop;
     34    QSpinBox *EventNo, *ChannelNo, *ChipNo, *BoardNo, *Port, *M0Start, *M0Stop;
    3535    QPlainTextEdit *RunHeaderDisplay, *EventHeaderDisplay, *SocketOutput;
    3636    QTabWidget *TabWidget;
Note: See TracChangeset for help on using the changeset viewer.