Index: fact/tools/ddd/Functions.cpp
===================================================================
--- fact/tools/ddd/Functions.cpp	(revision 9839)
+++ fact/tools/ddd/Functions.cpp	(revision 10118)
@@ -57,11 +57,6 @@
   BoardNo->setEnabled(true);
   PixelID->setEnabled(true);
-  M0Start->setEnabled(true);
-  M0Stop->setEnabled(true);
   PhysPipeAction->setEnabled(true);
   EventNo->setRange(1, R->Events);
-  M0Display->setEnabled(true);
-  M0Start->setRange(0, R->Samples-1);  
-  M0Stop->setRange(0, R->Samples-1);
   ChannelNo->setRange(0, R->NChannels-1);
   ChipNo->setRange(0, R->NChips-1);
@@ -78,6 +73,4 @@
     BoardNo->setEnabled(false);
     PixelID->setEnabled(false);
-    M0Start->setEnabled(false);
-    M0Stop->setEnabled(false);
 	PhysPipeAction->setEnabled(false);
     RunHeaderDisplay->clear();
@@ -90,5 +83,5 @@
 void ddd::DisplayEvent(int) {
 
-  PixelID->setText(PixMap->DRS_to_Pixel(BoardNo->value(), ChipNo->value(),	ChannelNo->value()).c_str());  // Translate to pixel ID
+  PixelID->setValue(PixMap->FPA_to_Pixel(0, BoardNo->value(), ChipNo->value(),	ChannelNo->value()));  // Translate to pixel ID
   if(Socket->state() == QAbstractSocket::ConnectedState) return; // do not execute if socket is open
   
@@ -149,99 +142,4 @@
   delete[] x;	delete[] y;
 
-  // ************************************   
-  // Get data for M0 display (event based)
-  // ************************************   
-
-  if (!(M0Display->isEnabled())) return;
-
-  double z[6][6] = {{0}};//36 pixels
-  bool IDerror = false;
-
-  //only interested in M0 data using DRS2
-  //if (RD->RHeader->NChannels == 9) IDerror = true;  
-
-  //only interested in M0 data using DRS4
-  if (RD->RHeader->NChannels == 10) IDerror = true;  
-
-  for(unsigned int i=0; i<RD->RHeader->NBoards; i++) {//board loop
-    for(unsigned int j=0; j<RD->RHeader->NChips; j++) {//chip loop
-      for(unsigned int k=0; k<RD->RHeader->NChannels; k++) {//channel loop
-
-	//for DRS2 data (requires the correct pixelmap!!!
-	//if( ( (i==0 || i==1) && (j<=1) && (k<=7) ) || ( (i==2) && (j==0) && (k<=3) ) ) {
-
-	//for DRS4 data (requires the correct pixelmap!!!
-	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) ) ) {
-	 
-	  //get module, superpixel and pixel number from pixel name
-	  std::string pixelname = PixMap->DRS_to_Pixel(i,j,k);
-	  if (pixelname == "") {
-	    IDerror = true;
-	    continue;
-	  }
-	  char pixelname_copy[256];
-	  memset(pixelname_copy,'\0',256);
-	  pixelname.copy(pixelname_copy, 256);
-
-	  char delim[] = "-";
-	  char *buffer = NULL;
-	  int module = -1;
-	  int superpixel = -1;
-	  int pixel = -1;
-
-	  buffer = strtok(pixelname_copy, delim);
-	  module = atoi(buffer);
-	  buffer = strtok(NULL, delim);
-	  superpixel = atoi(buffer);
-	  buffer = strtok(NULL, delim);
-	  pixel = atoi(buffer);
-
-	  //usual M0 mapping
-	  //int binx = 5-(int((superpixel-1)/3)*2)-(int((pixel%4)/2));
-	  //int biny = 5-(((superpixel-1)%3)*2)-(int((pixel-1)/2));
-
-	  //M0 upside down
-	  int binx = 5-(5-(int((superpixel-1)/3)*2)-(int((pixel%4)/2)));
-	  int biny = 5-(5-(((superpixel-1)%3)*2)-(int((pixel-1)/2)));
-
-	  //search maximum sample amplitude within user specified window
-	  //start bin is always smaller than stop bin (taken care of by updated ranges)
-	  int StartBin = (int)(M0Start->value());
-	  int StopBin = (int)(M0Stop->value());
-
-	  for(int l=StartBin; l<=StopBin; l++){
-
-	    float sample = *((short *) (RD->Data + RD->RHeader->NBoards*RD->RHeader->NChips*sizeof(int)) + 
-			     i*RD->RHeader->NChips*RD->RHeader->NChannels*RD->RHeader->Samples+
-			     j*RD->RHeader->NChannels*RD->RHeader->Samples+
-			     k*RD->RHeader->Samples+
-			     l)*RD->BStruct[i].ScaleFactor;
-
-	    if (fabs(sample) > z[binx][biny]) {
-	      z[binx][biny]=fabs(sample);
-	    }
-
-	  }//sample loop
-	}//only M0 data
-      }//channel loop
-    }//chip loop
-  }//board loop
-
-  if(IDerror){
-    QMessageBox::warning(this, "ddd Message","Sorry! The M0 display is not available for this data file because of a pixel ID mismatch.",QMessageBox::Ok);
-    if(M0Window->isVisible()) M0Window->hide();
-    M0Display->setEnabled(false);
-    return;
-  }
-
-  //fill data to M0 display (event based)
-  Signal2D->setData(SpectrogramDataM0(z));
-  Graph2D->axisWidget(QwtPlot::yRight)->setColorMap(Signal2D->data().range(),Signal2D->colorMap());
-  Graph2D->setAxisScale(QwtPlot::yRight,Signal2D->data().range().minValue(),Signal2D->data().range().maxValue() );
-  Graph2D->replot();
-
-  //update ranges for start and stop bin to avoid startbin > stopbin
-  M0Start->setRange(0, M0Stop->value());  
-  M0Stop->setRange(M0Start->value(),(RD->RHeader->Samples)-1);
 }
 
@@ -252,12 +150,4 @@
   else SocketWindow->show();
 }
-
-// +++ Open sub window for M0 Display +++
-void ddd::OpenM0Window() {
-
-  if(M0Window->isVisible()) M0Window->hide();
-  else M0Window->show();
-}
-
 
 // +++ Acquire data through socket (acquire botton only available if socket exists) +++
@@ -307,7 +197,4 @@
       CloseDatafile();
 
-      M0Window->hide();
-      M0Display->setEnabled(false);
-
       ChannelNo->setEnabled(true);
       ChipNo->setEnabled(true);
@@ -416,10 +303,11 @@
 
 // +++ Translate pixel ID +++
-void ddd::TranslatePixelID() {
-  
-  int Board = PixMap->Pixel_to_DRSboard(PixelID->text().toStdString());
-  int Chip = PixMap->Pixel_to_DRSchip(PixelID->text().toStdString());
-  int Channel = PixMap->Pixel_to_DRSchannel(PixelID->text().toStdString());
-
+void ddd::TranslatePixelID(int ID) {
+  
+  // setValue() below will call UpdateScope() through signal, therefore need to store numbers here
+  int Board = PixMap->Pixel_to_FPAboard(ID);
+  int Chip = PixMap->Pixel_to_FPApatch(ID);
+  int Channel = PixMap->Pixel_to_FPApixel(ID);
+  
   if(Board	>= BoardNo->minimum()	&& Board	<= BoardNo->maximum() && 
      Chip	>= ChipNo->minimum()	&& Chip		<= ChipNo->maximum() &&
@@ -429,5 +317,5 @@
     ChannelNo->setValue(Channel);
   }
-  else if(Board==999999999) QMessageBox::warning(this, "ddd Message","Pixel ID unknown.",QMessageBox::Ok);
+  else if (Board == (int) PixMap->PM_ERROR_CODE) PixelID->setValue(-1);
   else QMessageBox::warning(this, "ddd Message","Pixel ID out of current range.",QMessageBox::Ok);
 }
Index: fact/tools/ddd/GUI.cpp
===================================================================
--- fact/tools/ddd/GUI.cpp	(revision 9839)
+++ fact/tools/ddd/GUI.cpp	(revision 10118)
@@ -22,5 +22,9 @@
   // Instantiate without console output
   RD = new RawDataCTX(true);
-  PixMap = new PixelMap("../../config/PixelMap.txt", false);
+
+  // Instantiate PixelMap
+  DimRpcInfo RPC((char *) "ConfigRequest", (char *) "");
+  RPC.setData((char *) "Misc PixelMap");
+  PixMap = new PixelMap(std::string(RPC.getString(), RPC.getSize()));
    
   Tmpfile = tmpfile();
@@ -67,8 +71,10 @@
   BoardNo->setToolTip("Mezzanine board number");
  
-   // TextBox for pixel ID
-  PixelID = new QLineEdit(Central);
+  // SpinBox for pixel ID
+  PixelID = new QSpinBox(Central);
   PixelID->setEnabled(false);
-  connect(PixelID, SIGNAL(returnPressed()), this, SLOT(TranslatePixelID()));
+  PixelID->setRange(-1, 9999);
+  PixelID->setSpecialValueText("n/a");
+  connect(PixelID, SIGNAL(valueChanged(int)), this, SLOT(TranslatePixelID(int)));
   PixelID->setToolTip("Pixel identification");
  
@@ -86,10 +92,4 @@
   connect(SocketButton, SIGNAL(clicked()), this, SLOT(OpenSocketWindow()));
   SocketButton->setToolTip("Open window for socket communication");
-
-  // M0 display button
-  M0Display = new QPushButton("M0 Display",Central);
-  M0Display->setFont(QFont("Times", 10, QFont::Bold));
-  connect(M0Display, SIGNAL(clicked()), this, SLOT(OpenM0Window()));
-  M0Display->setToolTip("Open window for M0 display");
 
   // Acquire button and Continuous check box
@@ -150,5 +150,4 @@
   MainLayout->addLayout(FormLayout, 2, 0);
   MainLayout->addWidget(SocketButton, 6,0);
-  MainLayout->addWidget(M0Display, 3,0);
   MainLayout->addWidget(GetButton, 4,0);
   MainLayout->addWidget(ContinuousBox, 5,0);
@@ -229,61 +228,4 @@
   SocketLayout->addWidget(SocketOutput, 2, 0, 4, 4);
 
-  //-----------------------------------------------------------------------
-  //**************************** M0 window ****************************
-  //-----------------------------------------------------------------------
-   
-  M0Window = new QWidget();
-  M0Window->setWindowTitle("ddd - M0 Display");
-
-  Graph2D = new QwtPlot(M0Window);
-  Graph2D->setAutoReplot(true);
-  Graph2D->setCanvasBackground(QColor(Qt::white));
-
-  M0Start = new QSpinBox(M0Window);
-  M0Start->setEnabled(false);
-  connect(M0Start, SIGNAL(valueChanged(int)), this, SLOT(DisplayEvent(int)));
-  M0Start->setToolTip("First bin/sample of time window");
-  M0StartLayout = new QFormLayout;  
-  M0StartLayout->addRow("First Bin", M0Start);
-
-  M0Stop = new QSpinBox(M0Window);
-  M0Stop->setEnabled(false);
-  M0Stop->setRange(0,1023);
-  M0Stop->setValue(1023);
-  connect(M0Stop, SIGNAL(valueChanged(int)), this, SLOT(DisplayEvent(int)));
-  M0Stop->setToolTip("Last bin/sample of time window");
-  M0StopLayout = new QFormLayout;  
-  M0StopLayout->addRow("Last Bin", M0Stop);
-
-  M0Layout = new QGridLayout(M0Window);
-  M0Layout->addWidget(Graph2D, 1,1,3,3);
-  M0Layout->addLayout(M0StartLayout,4,1);
-  M0Layout->addLayout(M0StopLayout,4,2);
-
-  Signal2D = new QwtPlotSpectrogram;
-  Signal2D->attach(Graph2D);
-
-  //initialize raster data of M0 display
-  double z[6][6];
-  for (int i=0; i<6; i++){
-      for (int j=0; j<6; j++){
-	  z[i][j]=i+j;
-      }
-  }
-  Signal2D->setData(SpectrogramDataM0(z));
-
-  //color (z-) axis of M0 display
-  colorMap = QwtLinearColorMap(Qt::yellow, Qt::red);  
-  Signal2D->setColorMap(colorMap);
-
-  Graph2D->axisWidget(QwtPlot::yRight)->setTitle("Maximum Sample Amplitude (mV)");
-  Graph2D->axisWidget(QwtPlot::yRight)->setColorBarEnabled(true);
-  Graph2D->axisWidget(QwtPlot::yRight)->setColorMap(Signal2D->data().range(),Signal2D->colorMap());
-
-  Graph2D->setAxisScale(QwtPlot::yRight,Signal2D->data().range().minValue(),Signal2D->data().range().maxValue());
-  Graph2D->enableAxis(QwtPlot::yRight);
-  Graph2D->plotLayout()->setAlignCanvasToScales(true);
-  Graph2D->replot();
-
 }
 
@@ -291,13 +233,10 @@
   // Qwt items
   delete Grid;			delete Signal;
-  delete Signal2D;
   // Layout items
   delete PortLayout;		delete CommandLayout;
-  delete M0StartLayout;         delete M0StopLayout;
   delete AddressLayout;		delete FormLayout;
   delete SpinLayout;
   // Other items 		
   delete SocketWindow;
-  delete M0Window;
   delete PixMap;		delete RD;
   
Index: fact/tools/ddd/GUI.h
===================================================================
--- fact/tools/ddd/GUI.h	(revision 9839)
+++ fact/tools/ddd/GUI.h	(revision 10118)
@@ -10,12 +10,8 @@
 #include <qwt_plot_zoomer.h>
 #include <qwt_plot_panner.h>
-#include <qwt_plot_spectrogram.h>
-#include <qwt_raster_data.h>
-#include <qwt_scale_widget.h>
-#include <qwt_plot_layout.h>
-#include <qwt_color_map.h>
 
 #include "../../drsdaq/RawDataCTX.h"
 #include "../../pixelmap/PixelMap.h"
+#include "dic.hxx"
 
 #define SOCKET_TIMEOUT 10000	// Milliseconds to wait for socket connection
@@ -28,25 +24,23 @@
     Q_OBJECT
 
-    QPushButton *GetButton, *SocketButton, *Connect, *M0Display;
+    QPushButton *GetButton, *SocketButton, *Connect;
     QCheckBox *ContinuousBox;
     QToolButton *LoadButton;
-    QLineEdit *FilenameBox, *IPAddress, *Command, *PixelID;
-    QSpinBox *EventNo, *ChannelNo, *ChipNo, *BoardNo, *Port, *M0Start, *M0Stop;
+    QLineEdit *FilenameBox, *IPAddress, *Command;
+    QSpinBox *PixelID, *EventNo, *ChannelNo, *ChipNo, *BoardNo, *Port;
     QPlainTextEdit *RunHeaderDisplay, *EventHeaderDisplay, *SocketOutput;
     QTabWidget *TabWidget;
     QTcpSocket *Socket;
-    QWidget *SocketWindow, *Central, *M0Window;
+    QWidget *SocketWindow, *Central;
     QAction *OpenAction, *ConnectAction, *PhysPipeAction;
-    QGridLayout *SocketLayout, *MainLayout, *M0Layout;
-    QFormLayout *CommandLayout, *PortLayout, *AddressLayout, *FormLayout, *SpinLayout, *M0StartLayout, *M0StopLayout;
+    QGridLayout *SocketLayout, *MainLayout;
+    QFormLayout *CommandLayout, *PortLayout, *AddressLayout, *FormLayout, *SpinLayout;
     
-    QwtPlot *Graph, *Graph2D;
+    QwtPlot *Graph;
     QwtPlotZoomer *Zoomer;
     QwtPlotCurve *Signal;
     QwtPlotPanner *Panner;
     QwtPlotGrid *Grid;
-    QwtPlotSpectrogram *Signal2D;
-    QwtLinearColorMap colorMap;
-    
+
     void closeEvent(QCloseEvent *); 
 
@@ -66,5 +60,4 @@
     void FileDialog();
     void OpenSocketWindow();
-    void OpenM0Window();
     void GetSignalFromSocket();
     void MakeConnection();
@@ -73,5 +66,5 @@
     void GotDisconnected();
     void HandleZoom(const QwtDoubleRect &);
-    void TranslatePixelID();
+    void TranslatePixelID(int);
     
     void MenuSave();
@@ -81,46 +74,2 @@
     void MenuAbout();
 };
-
-//Data class for 2D spectrogram (MO display specific)
-class SpectrogramDataM0: public QwtRasterData {
-
-private:
-
-    double _z[6][6];
-    double _zmin;
-    double _zmax;
-
-public:
-    
-    SpectrogramDataM0(const double z[6][6]): QwtRasterData(QwtDoubleRect(0, 0, 6, 6)) {
-	for (int i = 0; i<6; i++){
-	  for (int j = 0; j<6; j++){
-	      _z[i][j] = z[i][j];
-	      if (z[i][j] > _zmax) _zmax = z[i][j];
-	      if (z[i][j] < _zmin) _zmin = z[i][j];
-	   }
-	}
-    }
-
-    virtual QwtRasterData *copy() const {
-	return new SpectrogramDataM0(_z);
-    }
-
-    virtual QwtDoubleInterval range() const {
-        return QwtDoubleInterval(_zmin, _zmax);
-    }
-
-    virtual void initRaster(const QwtDoubleRect = QwtDoubleRect(0, 0, 6, 6),
-			    const QSize =QSize(1,1)) {};	 
-	 	
-    virtual double value(double x, double y) const {
-
-	unsigned int first = (unsigned int)x;
-	unsigned int second = (unsigned int)y;
-
-	const double v = _z[first][second];
-        return v;
-
-    }
-
-};
Index: fact/tools/ddd/ddd.pro
===================================================================
--- fact/tools/ddd/ddd.pro	(revision 9839)
+++ fact/tools/ddd/ddd.pro	(revision 10118)
@@ -6,9 +6,9 @@
 TARGET = 
 DEPENDPATH += .
-INCLUDEPATH += . /ihp/local/qwt-5.2.1/include
+INCLUDEPATH += . .. $(QWTDIR)/include $(DIMDIR)/dim ../../drsdaq ../../pixelmap
 
 # Input
 HEADERS += GUI.h ../../pixelmap/Pixel.h ../../pixelmap/PixelMap.h ../../drsdaq/RawDataCTX.h
 SOURCES += Functions.cpp GUI.cpp ../../pixelmap/Pixel.cc ../../pixelmap/PixelMap.cc ../../drsdaq/RawDataCTX.cc
-LIBS += -L/ihp/local/qwt-5.2.1/lib -lqwt
+LIBS += -L$(QWTDIR)/lib -lqwt $(DIMDIR)/linux/libdim.a
 QT += network
