Index: tools/ddd/Functions.cpp
===================================================================
--- tools/ddd/Functions.cpp	(revision 59)
+++ tools/ddd/Functions.cpp	(revision 60)
@@ -110,77 +110,62 @@
       Zoomer->setZoomBase(Signal->boundingRect());
 
-      double z[6][6];
-
-      for(unsigned int i=0; i<RD->RHeader->NBoards; i++){
-	  for(unsigned int j=0; j<RD->RHeader->NChips; j++){
-	      for(unsigned int k=0; k<RD->RHeader->NChannels; k++) {
-
-		  //only interested in M0 data
-		  if( ( (i==0 || i==1) && (j<=1) && (k<=7) ) || ( (i==2) && (j==0) && (k<=3) ) ) {
-
-		      std::string pixelname = PixMap->DRS_to_Pixel(i,j,k);
-		      char pixelname_copy[256];
-		      memset(pixelname_copy,'\0',256);
-		      pixelname.copy(pixelname_copy, 256);
-		      
-		      //printf("\nboard %d, chip %d, channel %d, pixel %s:\t", i,j,k,pixelname_copy);
-
-		      char delim[] = "-";
-		      char *buffer = NULL;
-		      int module = -1;
-		      int superpixel = -1;
-		      int pixel = -1;
-
-		      //buffer = strtok(const_cast<char*>(pixelname.c_str()), delim);
-		      buffer = strtok(pixelname_copy, delim);
-		      module = atoi(buffer);
-		      buffer = strtok(NULL, delim);
-		      superpixel = atoi(buffer);
-		      buffer = strtok(NULL, delim);
-		      pixel = atoi(buffer);
-
-		      //printf("%d,%d,%d:\t", module, superpixel, pixel);
-		      //printf("%d:\t", (int((superpixel-1)/3)*2));
-		      //printf("%d:\t", int((pixel%4)+1) );
-		      //printf("%d:\t", int((pixel%4)/2) );
-		      //printf("%d:\t", (superpixel-1)%3 );
-
-		      int binx = 5-(int((superpixel-1)/3)*2)-(int((pixel%4)/2));
-		      int biny = 5-(((superpixel-1)%3)*2)-(int((pixel-1)/2));
-
-		      //printf("%d, %d:\t",binx,biny);
-
-		      int StartBin = 100;
-		      int StopBin = 120;
-
-		      for(int l=StartBin; l<(StopBin+1); l++){
-
-			  float sample = RD->Data[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;
-			  
-			  //printf("%.1f ",sample);
-			  
-			  if (sample > z[binx][biny]) {
-			      z[binx][biny]=sample;
-			  }
-			  
-		      }//sample loop
+      //Get data for M0 display (event based)
+
+      double z[6][6];//36 pixels
+
+      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
+
+	    //only interested in M0 data
+	    if( ( (i==0 || i==1) && (j<=1) && (k<=7) ) || ( (i==2) && (j==0) && (k<=3) ) ) {
+
+	      //get module, superpixel and pixel number from pixel name
+
+	      std::string pixelname = PixMap->DRS_to_Pixel(i,j,k);
+	      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);
+	      	      
+	      int binx = 5-(int((superpixel-1)/3)*2)-(int((pixel%4)/2));
+	      int biny = 5-(((superpixel-1)%3)*2)-(int((pixel-1)/2));
+	      
+	      //search maximum sample amplitude within following window -> should not be hardcoded!
+	      int StartBin = 100;
+	      int StopBin = 120;
+	      
+	      for(int l=StartBin; l<(StopBin+1); l++){
+		
+		float sample = RD->Data[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 (sample > z[binx][biny]) {
+		  z[binx][biny]=sample;
+		}
+		
+	      }//sample loop
+	      
+	    }//only M0 data
+	    
+	  }//channel loop
+	}//chip loop
+      }//board loop
       
-		  }//only M0 data
-		  
-	      }//channel loop
-	  }//chip loop
-      }//board loop
-
-      /*
-      for (int i=0; i<6; i++){
-	  for (int j=0; j<6; j++){
-	      z[i][j]=i;
-	  }
-      }
-      */
-
+      //fill data to M0 display (event based)
       Signal2D->setData(SpectrogramDataM0(z));
       Graph2D->axisWidget(QwtPlot::yRight)->setColorMap(Signal2D->data().range(),Signal2D->colorMap());
Index: tools/ddd/GUI.cpp
===================================================================
--- tools/ddd/GUI.cpp	(revision 59)
+++ tools/ddd/GUI.cpp	(revision 60)
@@ -230,5 +230,5 @@
   Signal2D->attach(Graph2D);
 
-  //initialize raster
+  //initialize raster data of M0 display
   double z[6][6];
   for (int i=0; i<6; i++){
@@ -239,8 +239,9 @@
   Signal2D->setData(SpectrogramDataM0(z));
 
+  //color (z-) axis of M0 display
   colorMap = QwtLinearColorMap(Qt::yellow, Qt::red);  
   Signal2D->setColorMap(colorMap);
 
-  //Graph2D->axisWidget(QwtPlot::yRight)->setTitle("Yo!");
+  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());
Index: tools/ddd/GUI.h
===================================================================
--- tools/ddd/GUI.h	(revision 59)
+++ tools/ddd/GUI.h	(revision 60)
@@ -79,5 +79,5 @@
 };
 
-//class for 2D spectrogram data
+//Data class for 2D spectrogram (MO display specific)
 class SpectrogramDataM0: public QwtRasterData {
 
