Index: trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx	(revision 378)
+++ trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.cxx	(revision 378)
@@ -0,0 +1,313 @@
+/////////////////////////////////////////////////////////////////
+//
+//  MFadc
+//
+//  
+#include "MFadc.hxx"
+
+#include "MMcEvt.h"
+
+#include "TROOT.h"
+#include <TApplication.h>
+#include <TVirtualX.h>
+#include <TGClient.h>
+
+#include "TH1.h"
+#include "TObjArray.h"
+
+#include "MGFadcSignal.hxx"
+
+MFadc::MFadc() { 
+  //
+  //  default constructor 
+  //  
+  //  The procedure is the following: 
+  //  1. some parameters of the trigger are set to default.   
+  //     this parameters of the trigger may be changed
+  //  3. Then the all signals are set to zero
+  
+  fwhm_resp = MFADC_RESPONSE_FWHM       ; 
+  ampl_resp = MFADC_RESPONSE_AMPLITUDE  ; 
+  
+  //
+  //    set up the response shape
+  // 
+  Int_t  i ; 
+  
+  Float_t   sigma ; 
+  Float_t   x, x0 ; 
+
+  sigma = fwhm_resp / 2.35 ; 
+  x0 = 3*sigma ; 
+  
+  Float_t   dX, dX2 ; 
+  
+  dX  = WIDTH_FADC_TIMESLICE / SUBBINS ; 
+  dX2 = dX/2. ; 
+  
+  for (i=0; i< RESPONSE_SLICES_MFADC ; i++ ) {  
+
+    x = i * dX + dX2 ; 
+    
+    //
+    //   the value 0.125 was introduced to normalize the things
+    //
+    sing_resp[i] = 0.125 *  
+      ampl_resp * expf(-0.5 * (x-x0)*(x-x0) / (sigma*sigma) ) ; 
+
+  } 
+
+  //
+  //    init the Random Generator for Electonic Noise
+  //
+
+  GenElec = new TRandom () ; 
+
+  //
+  //  set all the booleans used to FALSE, indicating that the pixel is not 
+  //  used in this event. 
+  //
+  
+  for ( i =0 ; i <CAMERA_PIXELS ; i++ ) { 
+    used [i] = FALSE ; 
+  }
+}
+
+  
+void MFadc::Reset() { 
+  //
+  //  set all values of the signals to zero
+  //
+  Int_t  i ; 
+  
+  for ( i =0 ; i <CAMERA_PIXELS ; i++ ) {
+    used [i] = FALSE ; 
+  } 
+}
+
+
+void MFadc::Fill( Int_t iPix, Float_t time, Float_t amplitude ) { 
+  
+  //
+  // fills the information about one single Phe in the Trigger class
+  //
+  // parameter is the number of the pixel and the time-difference to the
+  // first particle
+  //
+  //
+
+  Int_t i, ichan, ichanfadc ; 
+  
+  //
+  //   first we have to check if the pixel iPix is used or not until now
+  //   if this is the first use, reset all signal for that pixels
+  // 
+  if ( iPix > CAMERA_PIXELS ) {
+    cout << " WARNING:  MFadc::Fill() :  iPix greater than CAMERA_PIXELS"
+	 << endl ;
+    exit(987) ; 
+  }
+
+  if ( used[iPix] == FALSE ) {
+    used [iPix] = TRUE ; 
+    
+    for (i=0; i < SLICES_MFADC; i++ ) {
+      sig[iPix][i] = 0. ; 
+    }
+  }
+
+  //
+  //   then select the time slice to use (ican) 
+  // 
+
+  
+  if ( time < 0. ) {
+    cout << "  WARNING! Fadc::Fill  " << time << "  below ZERO!! Very strange!!" 
+	 << endl ; 
+  }
+  else if ( time < TOTAL_TRIGGER_TIME ) { 
+    //
+    //   determine the slices number assuming the WIDTH_RESPONSE_MFADC
+    //
+    ichan = (Int_t) ( time / ((Float_t) WIDTH_RESPONSE_MFADC )); 
+
+    //
+    //   putting the response slices in the right sig slices.
+    //   Be carefull, because both slices have different widths. 
+    //
+
+    for ( i = 0 ; i<RESPONSE_SLICES; i++ ) {
+      ichanfadc = (Int_t) ((ichan+i)/SUBBINS) ; 
+      if ( (ichanfadc) < SLICES_MFADC ) {  
+	sig[iPix][ichanfadc] += (amplitude * sing_resp[i] )  ; 
+      } 
+    }
+  }
+  else {
+    cout << "  WARNING!  Fadc::Fill " << time << "  out of TriggerTimeRange " 
+	 << TOTAL_TRIGGER_TIME << endl ; 
+  }
+
+}
+
+void MFadc::ElecNoise() {
+  //
+  //  
+  //
+  
+  for ( Int_t i = 0 ; i < CAMERA_PIXELS; i++) {
+    if ( used [i] == TRUE ) {
+      
+      for ( Int_t is=0 ; is< SLICES_MFADC ; is++ ) {
+
+	sig[i][is] += GenElec->Gaus(0., 2.) ; 
+      }
+    }
+  }
+}
+
+
+
+void MFadc::Scan() {
+  
+
+  for ( Int_t ip=0; ip<CAMERA_PIXELS; ip++ ) {
+    
+    if ( used[ip] == kTRUE ) {
+
+      printf ("Pid %3d",  ip ) ; 
+
+      for ( Int_t is=0 ; is < SLICES_MFADC; is++ ) {
+
+	if ( sig[ip][is] > 0. ) {
+	  printf (" %4.1f/", sig[ip][is] ) ;
+	}
+	else {
+	  printf ("----/" ) ;
+	}
+      }
+      
+      printf ("\n"); 
+
+    }
+  }
+  
+} 
+
+void MFadc::Scan(Float_t time) {
+  
+  //
+  //    first of all we subtract from the time a offset (8 ns) 
+  // 
+  
+  Float_t t ; 
+
+  t = time - 10. ; // to show also the start of the pulse before the
+                   // the trigger time
+
+  if ( t < 0. ) {
+    cout << " WARNING!! FROM MFADC::SCAN(t) " << endl ; 
+    exit (776) ;  
+  }
+
+  //
+  //  calculate the first slice to write out
+  // 
+  
+  Int_t  iFirstSlice ; 
+
+  iFirstSlice = (Int_t) ( t /  WIDTH_FADC_TIMESLICE ) ; 
+
+  for ( Int_t ip=0; ip<CAMERA_PIXELS; ip++ ) {
+    
+    if ( used[ip] == kTRUE ) {
+
+      printf ("Pid %3d",  ip ) ; 
+
+      for ( Int_t is=iFirstSlice ; is < (iFirstSlice+15); is++ ) {
+	printf (" %5.2f /", sig[ip][is] ) ; 
+      }
+      
+      printf ("\n"); 
+
+    }
+  }  
+} 
+
+
+
+void MFadc::ShowSignal (MMcEvt *McEvt, Float_t trigTime) { 
+  // ============================================================
+  //
+  //  This method is used to book the histogramm to show the signal in 
+  //  a special gui frame (class MGTriggerSignal). After the look onto the
+  //  signals for a better understanding of the things we will expect 
+  //  the gui frame and all histogramms will be destroyed.   
+  //
+  
+  //
+  //  first of all create a list of the histograms to show
+  //
+  //  take only that one with a entry
+
+  TH1F *hist ; 
+  Char_t dumm[10]; 
+  Char_t name[256]; 
+  
+  TObjArray  *AList ;
+  AList = new TObjArray(10) ; 
+
+  // the list of analog signal histograms
+  // at the beginning we initalise 10 elements
+  // but this array expand automaticly if neccessay
+  
+  Int_t ic = 0 ; 
+  for ( Int_t i=0 ; i < CAMERA_PIXELS; i++  ) {
+    if ( used [i] == TRUE ) {
+
+      sprintf (dumm, "FADC_%d", i ) ; 
+      sprintf (name, "fadc signal %d", i ) ; 
+      
+      hist = new TH1F(dumm, name, SLICES_MFADC, 0., TOTAL_TRIGGER_TIME); 
+      //
+      //  fill the histogram
+      //
+      
+      for (Int_t ibin=1; ibin <=SLICES_MFADC; ibin++) {
+	hist->SetBinContent (ibin, sig[i][ibin-1]) ;
+      }
+
+      //      hist->SetMaximum( 5.);
+      //      hist->SetMinimum(-10.);
+      hist->SetStats(kFALSE); 
+  
+      //      hist->SetAxisRange(0., 80. ) ; 
+      
+      AList->Add(hist) ; 
+      
+      ic++ ; 
+    }
+  }  
+
+  //
+  //   create the Gui Tool
+  //
+  //
+  
+  new MGFadcSignal(McEvt,
+  		   AList,
+		   trigTime, 
+  		   gClient->GetRoot(), 
+		   gClient->GetRoot(), 
+  		   400, 400 ) ; 
+   
+  //
+  //   delete the List of histogramms
+  //
+  AList->Delete() ; 
+  
+  delete AList ; 
+}
+
+
+
Index: trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.hxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.hxx	(revision 378)
+++ trunk/MagicSoft/Simulation/Detector/include-MFadc/MFadc.hxx	(revision 378)
@@ -0,0 +1,120 @@
+#ifndef __MFadc__
+#define __MFadc__
+//
+//     class MFadc
+//
+//     implemented by Harald Kornmayer
+//
+//     This is a class to simulate the FADC. 
+//     It assumes a special response of the PMT for one single Photo-electron. 
+//     
+//
+//
+#include <stream.h>
+#include <math.h>
+
+#include "TObject.h"
+#include "TRandom.h"
+
+#include "Mdefine.h" 
+
+#include "MTriggerDefine.h"
+
+class MMcEvt  ; 
+
+//==========
+//  MFadc 
+//
+//  The simulation of the Flash ADC system for the MAGIC teleskop is done with
+//  this class. 
+//  So all methods concerning the FADC System should be done inside this
+//  class. 
+//
+//  The Idea is to (in)put the data of the photo electrons into the class and
+//  generate the response (output) of the FADC to that input. Response means 
+//  in this sense the ADC values of the different time slices for all pixels
+//
+//  The pixelisation is done by the camera program of Jose Carlos. 
+//
+//  This class is closly connected to the MTrigger classs. So some of the
+//  values defined in MTriggerDefine.h are also used by this class. 
+//
+//  But a lot of other stuff is defined here. 
+//
+//  --> Frist of all the WIDTH of the time slice of one FADC slice 
+//      this is 3.33333 nsec.
+//
+#define WIDTH_FADC_TIMESLICE   (50./15.)       //  this means 3.33 nsec 
+//
+//  --> Second the number of slices to fill in MFADC. This must by 
+//      connected to the MTrigger class. The time of interest must be
+//      equal in both classes. 
+//
+#define SLICES_MFADC           (TOTAL_TRIGGER_TIME / WIDTH_FADC_TIMESLICE)
+//
+//  --> like the trigger the FADC value will also have a standard response
+//      to one single Photo electron. This response is binned with smaller
+//      bins. The WIDTH of that response function is done here. 
+// 
+#define SUBBINS     5.
+#define WIDTH_RESPONSE_MFADC   (WIDTH_FADC_TIMESLICE /  SUBBINS )   // 5 sub-bin in one FADC slice 
+//
+//  --> the number of Response slices
+//
+#define RESPONSE_SLICES_MFADC   45         
+//
+//
+#define MFADC_RESPONSE_FWHM        5.0
+
+//
+//
+#define MFADC_RESPONSE_AMPLITUDE   4.0
+//
+//
+//
+//
+class MFadc {
+ private:
+  //
+  //    then for all pixels the shape of all the analog signals 
+  //
+  Bool_t   used[CAMERA_PIXELS] ;  //  a boolean to indicated if the pixels is used in this event
+
+  Float_t  sig[CAMERA_PIXELS][(Int_t) SLICES_MFADC] ; //  the analog signal for pixels
+
+  //
+  //    first the data for the response function
+  //
+  Float_t fwhm_resp ;                      // fwhm of the phe_response function 
+  Float_t ampl_resp ;                      // amplitude of the phe_response function (in mV)
+  Float_t sing_resp[ RESPONSE_SLICES_MFADC ] ;   // the shape of the phe_response function 
+
+  //
+  //   RandomGenerator for the Electonic Noise
+  //
+
+  TRandom  *GenElec ; 
+
+
+public:
+
+  MFadc() ; 
+  
+  void Reset() ; 
+
+  void Fill( Int_t, Float_t, Float_t  ) ;  
+
+  void ElecNoise() ; 
+
+  void Scan() ; 
+
+  void Scan(Float_t time) ;
+
+  void ShowSignal ( MMcEvt *McEvt , Float_t ) ; 
+} ; 
+
+
+#endif
+
+
+
Index: trunk/MagicSoft/Simulation/Detector/include-MFadc/MGFadcSignal.cxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MFadc/MGFadcSignal.cxx	(revision 378)
+++ trunk/MagicSoft/Simulation/Detector/include-MFadc/MGFadcSignal.cxx	(revision 378)
@@ -0,0 +1,355 @@
+//
+//
+//
+#include "MGFadcSignal.hxx" 
+
+#include "TPavesText.h"
+#include "TObjArray.h"
+#include "TCanvas.h"
+
+#include "TLine.h"
+
+MGFadcSignal::MGFadcSignal(const MMcEvt    *McInfo, 
+			   const TObjArray *aList, 
+			   Float_t   trigTime, 
+			   const TGWindow *p, const TGWindow *main,
+			   UInt_t w, UInt_t h, UInt_t options) :
+     TGTransientFrame(p, main, w, h, options)
+{
+  //  Default constructor
+  //
+  // Create a frame to show the signals.
+  // 
+  //
+  fTrigTime = trigTime ; 
+
+  iAnaSigs =  aList->GetEntries() ; 
+
+  iPage = 1 ;  
+
+  //
+  //  at the beginning copy the aList into Liste    
+  //
+  
+  ListeA = new TObjArray( *aList ) ; 
+
+  Liste  = new TObjArray( *ListeA ) ; 
+  
+  
+  //
+  //  First of all the Menus in the menubar
+  //
+   
+  fMenuFile = new TGPopupMenu(gClient->GetRoot());
+  fMenuFile->AddEntry("Open...", M_FILE_OPEN);
+  fMenuFile->AddEntry("Save", M_FILE_SAVE);
+  fMenuFile->AddEntry("Save as...", M_FILE_SAVEAS);
+  fMenuFile->AddEntry("Close", M_FILE_CLOSE);
+  fMenuFile->AddSeparator();
+  fMenuFile->AddEntry("Print", M_FILE_PRINT);
+  fMenuFile->AddSeparator();
+  fMenuFile->AddEntry("Exit", M_FILE_EXIT );
+  
+  fMenuFile->DisableEntry(M_FILE_OPEN);
+  fMenuFile->DisableEntry(M_FILE_SAVE);
+  fMenuFile->DisableEntry(M_FILE_SAVEAS);
+  fMenuFile->DisableEntry(M_FILE_CLOSE);
+  fMenuFile->DisableEntry(M_FILE_PRINT);
+  fMenuFile->DisableEntry(M_FILE_EXIT);
+
+  fMenuFile->Associate(this);
+
+  //
+  //   create the menu bar
+  //
+
+  fMenuBar = new TGMenuBar(this, 1, 1, kHorizontalFrame);
+  fMenuBar->AddPopup("&File", fMenuFile, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 0, 0));
+
+  AddFrame(fMenuBar, new TGLayoutHints(kLHintsTop | kLHintsLeft | kLHintsExpandX,
+				       0, 0, 1, 1));
+
+  //
+  //    create the information frame
+  // 
+
+  Char_t winf[100]; 
+  fMcInfo = new TGCompositeFrame(this, 60, 20, kHorizontalFrame | kLHintsTop |kSunkenFrame );
+  sprintf ( winf,"Particle: %d", McInfo->GetPartId() ); 
+  fMcInfo->AddFrame(new TGLabel (fMcInfo, winf ),
+		    new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+					10, 10, 10, 10));  
+
+  sprintf ( winf,"Energy: %6.1f [GeV]", McInfo->GetEnergy() ); 
+  fMcInfo->AddFrame(new TGLabel (fMcInfo, winf ),
+		    new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+					10, 10, 10, 10));  
+
+  sprintf ( winf,"Theta: %6.1f [deg]", McInfo->GetTheta()* 57.2974 ); 
+  fMcInfo->AddFrame(new TGLabel (fMcInfo, winf ),
+		    new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+					10, 10, 10, 10));  
+ 
+  sprintf ( winf,"Impact: %6.1f [m]", McInfo->GetImpact()/100. ); 
+  fMcInfo->AddFrame(new TGLabel (fMcInfo, winf ),
+		    new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+					10, 10, 10, 10));  
+
+  AddFrame(fMcInfo, new TGLayoutHints(kLHintsTop | kLHintsExpandX,
+				      0, 0, 1, 0));
+
+  //
+  //   build the canvas (here we will plot the histograms
+  //
+
+  fCanvasWindow = new TRootEmbeddedCanvas("test",this, 800, 500);
+  fContainer = new TGCompositeFrame(fCanvasWindow->GetViewPort(), 10, 10,
+				    kHorizontalFrame, GetWhitePixel());
+  fContainer->SetLayoutManager(new TGTileLayout(fContainer, 7));
+  fCanvasWindow->SetContainer(fContainer);
+  
+  tcan = fCanvasWindow->GetCanvas() ; 
+
+  AddFrame(fCanvasWindow, new TGLayoutHints(kLHintsExpandX | kLHintsExpandY,
+  				    0, 0, 2, 2));
+  
+
+  //
+  //  build the control frame
+  //
+  fControl = new TGCompositeFrame(this, 60, 20, kHorizontalFrame | kLHintsTop |kSunkenFrame );
+  
+  fPrevChannels = new TGTextButton(fControl, "Previous Channels", M_PREV_CHANNELS);
+  fPrevChannels->Associate(this);
+  fPrevChannels->SetToolTipText("To see the previous sample of chanels");
+  fControl->AddFrame(fPrevChannels, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
+
+
+  lPage = new TGLabel (fControl, "--") ;
+  fControl->AddFrame(lPage,
+		     new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+                                          5, 0, 10, 5));
+  sprintf ( winf,"/"); 
+  fControl->AddFrame(new TGLabel (fControl, "/" ),
+		     new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+					0, 0, 10, 5));
+  
+  lPageAll = new TGLabel (fControl, "--") ;
+  fControl->AddFrame(lPageAll,
+		     new TGLayoutHints(kLHintsTop | kLHintsLeft ,
+                                          0, 5, 10, 5));
+   
+  fNextChannels = new TGTextButton(fControl, "Next Channels", M_NEXT_CHANNELS);
+  fNextChannels->Associate(this);
+  fNextChannels->SetToolTipText("To see the next sample of chanels");
+  fControl->AddFrame(fNextChannels, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
+
+
+  fAnalog = new TGTextButton(fControl, "analog", M_ANALOG);
+  fAnalog->Associate(this);
+  fAnalog->SetToolTipText("Display of analog signals");
+  fControl->AddFrame(fAnalog, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 50, 5, 5, 5));
+
+
+  fDigital = new TGTextButton(fControl, "digital", M_DIGITAL);
+  fDigital->Associate(this);
+  fDigital->SetToolTipText("Display of digital signals");
+  fControl->AddFrame(fDigital, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
+
+
+  fBeide = new TGTextButton(fControl, "both", M_BEIDE);
+  fBeide->Associate(this);
+  fBeide->SetToolTipText("Display the analog and digital signals");
+  fControl->AddFrame(fBeide, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 5, 5, 5, 5));
+
+
+
+  AddFrame(fControl, new TGLayoutHints(kLHintsExpandX,
+				       0, 0, 1, 0));
+  
+
+  //
+  //    the close button line
+  // 
+
+  fFrame = new TGCompositeFrame(this, 60, 20, kHorizontalFrame |
+				kSunkenFrame);
+
+  fCloseButton = new TGTextButton(fFrame, "Close", M_BUTTON_CLOSE);
+  fCloseButton->Associate(this);
+  fCloseButton->SetToolTipText("Close and skip to the next event!");
+  fFrame->AddFrame(fCloseButton, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 100, 5, 5, 5));
+ 
+
+  fExitButton = new TGTextButton(fFrame, "Stop Job", M_BUTTON_EXIT);
+  fExitButton->Associate(this);
+  fExitButton->SetToolTipText("Shut down this job!");
+  fFrame->AddFrame(fExitButton, 
+		   new TGLayoutHints(kLHintsTop | kLHintsLeft, 200, 5, 5, 5));
+
+  AddFrame(fFrame, new TGLayoutHints(kLHintsBottom | kLHintsExpandX,
+				     0, 0, 1, 0));
+  
+  SetWindowName("MGFadcSignal");
+
+  MapSubwindows();
+
+  // we need to use GetDefault...() to initialize the layout algorithm...
+  Resize(GetDefaultSize());
+
+  //  Resize (1000,650); 
+
+  MapWindow();
+
+  DisplayChannels ( Liste) ; 
+  
+  gClient->WaitFor(this);  
+}
+
+
+MGFadcSignal::~MGFadcSignal() {
+  delete  fMenuBar ; 
+  delete  fMenuFile; 
+
+  delete  fContainer ; 
+  delete  fCanvasWindow ; 
+
+  delete  fCloseButton ; 
+  delete  fExitButton ; 
+  delete  fFrame ; 
+}
+
+void MGFadcSignal::CloseWindow() {
+   delete this ; 
+}
+
+
+void MGFadcSignal::DisplayChannels ( TObjArray *disList ) {
+  
+  Int_t imax ; 
+
+  if ( iPage == 0 ) {
+    printf ("Warning from DisplayChannels: Page 0 don't exist!!\n"); 
+    iPage = 1 ;
+    return ; 
+  }
+  
+  if ( (iPage-1)*16 >= (imax = disList->GetEntries()) ) {
+    printf ("Warning from DisplayChannels: PageNumber to big!\n");
+    iPage=iPage-1 ; 
+    return;
+  } 
+  
+  Char_t wort[4] ; 
+  sprintf ( wort, "%d", iPage) ;   
+  lPage->SetText ( new TGString ( wort ) ) ; 
+  sprintf ( wort, "%d", imax/16 + 1 ) ;   
+  lPageAll->SetText ( new TGString ( wort ) ) ; 
+ 
+
+  tcan->Clear() ; 
+  tcan->Divide(4,4) ;
+
+  Int_t ifirst, ilast ; 
+
+  ifirst = (iPage-1)*16 ; 
+  ilast  = iPage*16 ; 
+
+  if ( ilast > imax ) {
+    ilast = imax ; 
+  }
+
+  Int_t ic = 1 ; 
+  for (Int_t ih=ifirst; ih<ilast; ih++ ) {
+    tcan->cd(ic++);
+    disList->At(ih)->Draw() ; 
+
+    TLine *linie = new TLine( fTrigTime, 0., fTrigTime, 20. ) ; 
+    linie->Draw() ; 
+  }
+
+
+
+  tcan->Modified();
+  tcan->Update();
+  
+  
+
+}
+
+// ========================================
+// ========================================
+// ========================================
+
+Bool_t MGFadcSignal::ProcessMessage(Long_t msg, Long_t parm1, Long_t) {
+  // Handle messages send to the TestMainFrame object. E.g. all menu button
+  // messages.
+  
+  //  printf (" processmessage \n" ) ; 
+
+  switch (GET_MSG(msg)) {
+    
+  case kC_COMMAND:
+    switch (GET_SUBMSG(msg)) {
+       
+    case kCM_MENU:
+      printf("Pointer over menu entry, id=%ld\n", parm1);
+      break;
+
+      
+    case kCM_BUTTON:
+      switch ( parm1 ) {
+	
+      case M_BUTTON_CLOSE:      
+	CloseWindow() ; 
+        break; 
+
+      case M_BUTTON_EXIT:      
+        exit (1234)  ; 
+        break; 
+
+      case M_PREV_CHANNELS:
+	iPage = iPage - 1 ; 
+	DisplayChannels (Liste) ; 
+	break; 
+
+      case M_NEXT_CHANNELS:
+	iPage = iPage + 1 ; 
+	DisplayChannels (Liste) ; 
+	break; 
+
+      case M_ANALOG:
+	Liste  = new TObjArray( *ListeA ) ;
+	DisplayChannels (Liste) ; 
+	break; 
+
+      case M_DIGITAL:
+	break; 
+
+      case M_BEIDE:
+	//
+	//  to draw the analog and the digital signal
+	//
+	break; 
+      } 
+      
+      return kFALSE;
+    }
+    return kFALSE; 
+  }  
+  return kTRUE;
+}
+
+
+
+
+
+
+
+
Index: trunk/MagicSoft/Simulation/Detector/include-MFadc/MGFadcSignal.hxx
===================================================================
--- trunk/MagicSoft/Simulation/Detector/include-MFadc/MGFadcSignal.hxx	(revision 378)
+++ trunk/MagicSoft/Simulation/Detector/include-MFadc/MGFadcSignal.hxx	(revision 378)
@@ -0,0 +1,113 @@
+#ifndef __MGFadcSignal__
+#define __MGFadcSignal__
+
+
+#include <stdlib.h>
+#include <iostream.h>
+
+#include <TROOT.h>
+#include <TApplication.h>
+#include <TVirtualX.h>
+
+#include <TGListBox.h>
+#include <TGClient.h>
+#include <TGFrame.h>
+#include <TGIcon.h>
+#include <TGLabel.h>
+#include <TGButton.h>
+#include <TGTextEntry.h>
+#include <TGMsgBox.h>
+#include <TGMenu.h>
+#include <TGCanvas.h>
+#include <TGComboBox.h>
+#include <TGTab.h>
+#include <TGSlider.h>
+#include <TGDoubleSlider.h>
+#include <TGFileDialog.h>
+#include <TRootEmbeddedCanvas.h>
+#include <TCanvas.h>
+#include <TH1.h>
+#include <TH2.h>
+#include <TRandom.h>
+#include <TSystem.h>
+#include <TEnv.h>
+
+#include "MMcEvt.h"
+
+
+enum ETestCommandIdentifiers {
+   M_FILE_OPEN = 201,
+   M_FILE_SAVE,
+   M_FILE_SAVEAS,
+   M_FILE_CLOSE,
+   M_FILE_PRINT,
+   M_FILE_EXIT , 
+   
+   M_BUTTON_CLOSE,
+   M_BUTTON_EXIT,
+
+   M_PREV_CHANNELS, 
+   M_NEXT_CHANNELS,
+   M_ANALOG,
+   M_DIGITAL, 
+   M_BEIDE
+}; 
+
+
+
+
+
+class MGFadcSignal : public TGTransientFrame {
+
+private:
+  Float_t             fTrigTime ; 
+  Int_t               iAnaSigs ; 
+  Int_t               iDigSigs ;
+  Int_t               iPage  ; 
+
+  TObjArray           *ListeA ; 
+  TObjArray           *Liste ; 
+
+  TGCompositeFrame    *fFrame ; 
+  TGButton            *fCloseButton;
+  TGButton            *fExitButton;
+
+  TGCompositeFrame    *fControl ; 
+  TGButton            *fPrevChannels;
+  TGLabel             *lPageAll    ;
+  TGLabel             *lPage    ;
+  TGButton            *fNextChannels;
+  TGButton            *fAnalog;
+  TGButton            *fDigital;
+  TGButton            *fBeide;
+
+  TGCompositeFrame    *fMcInfo ; 
+
+  TRootEmbeddedCanvas *fCanvasWindow ; 
+  TGCompositeFrame    *fContainer ; 
+  TCanvas             *tcan ; 
+
+  TGMenuBar           *fMenuBar;
+  TGPopupMenu         *fMenuFile;
+
+
+public:
+  MGFadcSignal(const MMcEvt    *McInfo, 
+	       const TObjArray *aList,
+	       Float_t   trigTime, 
+	       const TGWindow *p, const TGWindow *main, UInt_t w, UInt_t h,
+	       UInt_t options = kMainFrame | kVerticalFrame);
+  virtual ~MGFadcSignal();
+  
+  virtual void CloseWindow();
+
+  void DisplayChannels( TObjArray *disList ) ; 
+
+  virtual Bool_t ProcessMessage(Long_t msg, Long_t parm1, Long_t parm2);
+};
+
+#endif
+
+
+
+
