Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.cc	(revision 4117)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.cc	(revision 4139)
@@ -26,4 +26,14 @@
 // MDisplay
 //
+// Class to display camera events (MCamEvent)
+// You can set an event-by-event display with pause between two consecutive 
+// events. You can set an output PS file.
+//
+// Input containers (to be provided to the constructor):
+//
+//  MCamEvent
+//  MGeomCam
+//
+// Output containers:
 //
 //
@@ -33,4 +43,7 @@
 #include <math.h>
 
+#include "TCanvas.h"
+#include "TPostScript.h"
+
 #include "MParList.h"
 #include "MDisplay.h"
@@ -38,6 +51,4 @@
 #include "MGeomCam.h"
 #include "MHCamera.h"
-
-#include "TCanvas.h"
 
 #include "MLog.h"
@@ -48,13 +59,16 @@
 using namespace std;
 
-static const TString gsDefName  = "MDisplay";
-static const TString gsDefTitle = "Camera display task";
+static const TString gsDefName       = "MDisplay";
+static const TString gsDefTitle      = "Camera display task";
+static const TString gsDefPSFileName = "display.ps";
 
 // -------------------------------------------------------------------------
 //
-// Constructor.
+// Constructor. Need to provide the MCamEvent container to be displayed <event>
+// and camera geometry <geom>. Also the display type <type> can be specified
+// (see the MHCamera documentation for more details)
 //
 MDisplay::MDisplay(MCamEvent* event, MGeomCam* geom, Int_t type, const char* name, const char* title) 
-  :  fGeomCam(geom), fCamEvent(event),  fCanvas(NULL), fDisplayType(type)
+  :  fGeomCam(geom), fCamEvent(event),  fCanvas(NULL), fPSFile(NULL), fDisplayType(type), fCreatePSFile(kFALSE), fPause(kTRUE)
 {
   fName  = name  ? name  : gsDefName.Data();
@@ -63,4 +77,6 @@
   fDisplay = new MHCamera(*geom);
   fDisplay->SetPrettyPalette();
+  
+  fPSFileName = gsDefPSFileName;
 }
 // -------------------------------------------------------------------------
@@ -73,13 +89,19 @@
   if(fCanvas)
     delete fCanvas;
+  if(fPSFile)
+    delete fPSFile;
 }
 
 // -------------------------------------------------------------------------
 //
-// Look for needed containers.
+// Create the canvas, eventually set the batch mode and open ps file
 //
 Int_t MDisplay::PreProcess(MParList* pList)
 { 
   fCanvas = new TCanvas("myCanvas","Event Display",600,600);
+  if(fCreatePSFile) 
+    fPSFile = new TPostScript(fPSFileName,111);
+  if(!fPause)
+    fCanvas->SetBatch();
   fCanvas->cd(1);
   fDisplay->Draw();
@@ -90,9 +112,15 @@
 // -------------------------------------------------------------------------
 //
-// Call to compute a new position and then save it in the histogram (fMode==kOn) 
-// of to read the new position from the histogram (fMode==kOff)
+// Set the new containt of the camera event and update the display.
+// Set new page if ps file is requested
+// Pause execution if event-by-event display is chosen
 //
 Int_t MDisplay::Process()
 {  
+  // new page in ps file
+  if(fPSFile)
+    fPSFile->NewPage();
+
+  // update the display contents
   fDisplay->SetCamContent(*fCamEvent);
   fCanvas->GetPad(1)->Modified();
@@ -100,20 +128,24 @@
 
   // pause execution
-  cout << "Type 'q' to exit, <return> to go on: ";      
-  TString input;
-  input =cin.get(); 
-  
-  if (input=='q')
-    return kFALSE;
-  else
-    return kTRUE;
+  if(fPause)
+    {
+      cout << "Type 'q' to exit, <return> to go on: ";      
+      TString input;
+      input =cin.get(); 
+      
+      if (input=='q')
+	return kFALSE;
+    }
+
+  return kTRUE;
 }
 
 // -------------------------------------------------------------------------
 //
-// Dump 2D histo statistics
+// Close ps file if it was open
 //
 Int_t MDisplay::PostProcess()
 {
+  if(fPSFile) fPSFile->Close();
   return kTRUE;
 }
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.h
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.h	(revision 4117)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/MDisplay.h	(revision 4139)
@@ -10,14 +10,20 @@
 class MGeomCam;
 class TCanvas;
+class TPostScript;
 
 class MDisplay : public MTask
 {
  private:
-  MHCamera*  fDisplay;     // pointer to the camera display
-  MGeomCam*  fGeomCam;     // pointer to the camera geometry
-  MCamEvent* fCamEvent;    // pointer to camera event
-  TCanvas*   fCanvas;      // pointer to the canvas
-  Int_t      fDisplayType; 
+  MHCamera*     fDisplay;      // pointer to the camera display
+  MGeomCam*     fGeomCam;      // pointer to the camera geometry
+  MCamEvent*    fCamEvent;     // pointer to camera event
+  TCanvas*      fCanvas;       // pointer to the canvas
+  TPostScript*  fPSFile;       // pointer to ps file
+  TString       fPSFileName;   // name for ps file
+  Int_t         fDisplayType;  // display type (see MHCamera)
+  Bool_t        fCreatePSFile; // flag to produce a ps file with events
+  Bool_t        fPause;        // flag to pause execution between events
   
+
   virtual Int_t PostProcess();
 
@@ -30,7 +36,14 @@
   virtual ~MDisplay();
 
-  MGeomCam*    GetGeomCam()               {return fGeomCam;}
-  void         SetDisplayType(Int_t type) {fDisplayType=type;}
-  virtual void Paint(Option_t* option)    {};
+  virtual void Paint(Option_t* option)     {};
+
+  MGeomCam*    GetGeomCam()                {return fGeomCam;}
+  Bool_t       GetPauseMode()              {return fPause;}
+  Bool_t       GetCreatePSFile()           {return fCreatePSFile;}
+
+  void         SetDisplayType(Int_t type)  {fDisplayType=type;}
+  void         SetPSFile(Bool_t set=kTRUE) {fCreatePSFile=set;}
+  void         SetPSFileName(TString name) {fPSFileName=name;}
+  void         SetPause(Bool_t set=kTRUE)  {fPause=set;}
 
   ClassDef(MDisplay, 0) // Task to display camera containers
Index: trunk/MagicSoft/Mars/mtemp/mifae/library/MHillasDisplay.cc
===================================================================
--- trunk/MagicSoft/Mars/mtemp/mifae/library/MHillasDisplay.cc	(revision 4117)
+++ trunk/MagicSoft/Mars/mtemp/mifae/library/MHillasDisplay.cc	(revision 4139)
@@ -26,5 +26,17 @@
 // MDisplayHillas
 //
+// Display the camera event of type MCerPhotEvt plus the computed hillas
+// parameters.
 //
+// Input containers (in constructor):
+//  MCerPhotEvt
+//  MGeomCam
+//
+// Input containers
+//  MHillas
+//  [MSrcPosCam]
+//
+// Output containers
+//  [...]
 //
 //////////////////////////////////////////////////////////////////////////////
@@ -56,5 +68,5 @@
 // -------------------------------------------------------------------------
 //
-// Constructor.
+// Constructor (see MDisplay documentation for more information)
 //
 MHillasDisplay::MHillasDisplay(MCerPhotEvt* event, MGeomCam* geom, Int_t type, const char* name, const char* title) 
@@ -66,5 +78,6 @@
 // -------------------------------------------------------------------------
 //
-// Look for needed containers.
+// Call for MHillas::PreProcess and look for MHillas and look for the
+// needed containers
 //
 Int_t MHillasDisplay::PreProcess(MParList* pList)
@@ -99,5 +112,5 @@
 {
    // draw the hillas parameters
-  if(fHillas)
+  if(fHillas && GetPauseMode())
     fHillas->Print();
    
@@ -109,5 +122,5 @@
 // -------------------------------------------------------------------------
 //
-// Paint
+// Stuff to be painted when canvas will be updated
 //
 void MHillasDisplay::Paint(Option_t* option)
