Changeset 10118 for fact/Evidence/Edd


Ignore:
Timestamp:
01/25/11 09:47:27 (14 years ago)
Author:
ogrimm
Message:
Adapted various programs to new PixelMap class
Location:
fact/Evidence/Edd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • fact/Evidence/Edd/Edd.cc

    r10112 r10118  
    2323class EddDim *Handler;
    2424QString DRSBoard = "drsdaq";
     25std::string PixelMapText;
    2526
    2627// History chooser function (opens plot for numeric data, TextHist for all other)
     
    10161017
    10171018// Constructor
    1018 EventScope::EventScope(QWidget *P): EddBasePlot(P), PixelMap("../../config/PixelMap.txt", false) {
     1019EventScope::EventScope(QWidget *P): EddBasePlot(P), PixelMap(PixelMapText, false) {
    10191020
    10201021  Name = DRSBoard+"/EventData";
     
    10641065  struct ItemDetails N;
    10651066 
    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) + ")");
    10671068  N.Board = Board;
    10681069  N.Chip = Chip;
     
    10901091  ClearCurve(0);
    10911092
    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) + ")");
    10931094  List.first().Board = Board;
    10941095  List.first().Chip = Chip;
     
    12691270}
    12701271
    1271 
     1272// Translate FPA ID to Pixel ID (use '-' instead of PM_ERROR_CODE)
     1273QString 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 
    12721279//------------------------------------------------------------------
    12731280//**************************** Tab pages ***************************
     
    14911498
    14921499  // Pixel ID
    1493   PixelID = new QLineEdit;
     1500  PixelID = new QSpinBox;
    14941501  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)));
    14961505  PixelID->setToolTip("Pixel identification");
    14971506 
     
    15601569  StartStop(false);
    15611570  connect(Scope, SIGNAL(PixelData(QVector<double>)), SLOT(SetPixelData(QVector<double>)));
     1571
     1572  // Call to get initial pixel ID correct
     1573  UpdateScope(0);
    15621574}
    15631575
     
    15681580
    15691581// 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   }
     1582void 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);
    15751590  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);
    15791594  }
    15801595}
     
    15991614
    16001615  // 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 
    16021619  // Update first trace
    16031620  Scope->UpdateFirst(Board->value(), Chip->value(), Channel->value());
     
    18851902  if (argc > 1) DRSBoard = "FADctrl";
    18861903
     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
    18871909  QApplication app(argc, argv);
    18881910  GUI MainWindow;
  • fact/Evidence/Edd/Edd.h

    r10112 r10118  
    290290        void AddTrace(int, int, int);
    291291        void SetActive(bool);
     292        QString ToPixel(unsigned int, unsigned int, unsigned int, unsigned int);
    292293
    293294  private slots:
     
    339340    QPlainTextEdit *RunHeaderDisplay, *EventHeaderDisplay;
    340341
    341         QSpinBox *Channel, *Chip, *Board;
    342         QLineEdit *PixelID;
     342        QSpinBox *Channel, *Chip, *Board, *PixelID;
    343343        QFormLayout *FormLayout;
    344344        QWidget *Display;
     
    347347
    348348  private slots:
    349         void TranslatePixelID();
     349        void TranslatePixelID(int);
    350350        void UpdateScope(int);
    351351        void KeepCurrent();
Note: See TracChangeset for help on using the changeset viewer.