Index: /tags/Mars_V0-4/Mars/mmc/MFadcDefine.h
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/MFadcDefine.h	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/MFadcDefine.h	(revision 9635)
@@ -0,0 +1,43 @@
+//
+//  --> 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)
+//
+//  --> The amount of FADC slice written to the raw format.
+//
+#define FADC_SLICES  15
+//
+//  --> The amount of ns before trigger that would be read from the ADC
+//      in oder to show also the start of the pulse before the
+//      the trigger time.
+//
+#define TIME_BEFORE_TRIGGER    10.
+//  --> 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
+//
+// -->  The maximum number of FADC channels
+//      Most likely it will be always equal to CAMERA_PIXELS 
+#define MFADC_CHANNELS  577
Index: /tags/Mars_V0-4/Mars/mmc/MMcEvt.cxx
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/MMcEvt.cxx	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/MMcEvt.cxx	(revision 9635)
@@ -0,0 +1,169 @@
+#include <iostream.h>
+#include "MMcEvt.hxx"
+
+
+//==========
+// MMcEvt
+//    
+// This class handles and contains the MonteCarlo information
+// with which the events have been generated
+// This information exists for each event.
+ 
+
+
+ClassImp(MMcEvt)
+
+
+
+MMcEvt::MMcEvt() {
+  //
+  //  default constructor
+  //  set all values to zero
+
+  fPartId = 0  ;
+  fEnergy  = 0. ;
+
+  fTheta   = 0. ;
+  fPhi     = 0. ;
+
+  fCoreD   = 0. ;
+  fCoreX   = 0. ;
+  fCoreY   = 0. ;
+  fImpact  = 0. ;
+
+  fPhotIni      = 0 ;
+  fPassPhotAtm  = 0 ;
+  fPassPhotRef  = 0 ;
+  fPassPhotCone = 0 ;
+  fPhotElfromShower = 0 ;
+  fPhotElinCamera = 0 ;
+}
+
+MMcEvt::MMcEvt( UShort_t usPId, 
+		Float_t  fEner, 
+		Float_t  fThet, 
+		Float_t  fPhii, 
+		Float_t  fCorD, 
+		Float_t  fCorX, 
+		Float_t  fCorY,
+		Float_t  fImpa, 
+		UInt_t   uiPin, 
+		UInt_t   uiPat,  
+		UInt_t   uiPre, 
+		UInt_t   uiPco,  
+		UInt_t   uiPelS,
+		UInt_t   uiPelC ) {
+  //
+  //  constuctor II 
+  //
+  //  All datamembers are parameters. 
+  //
+  //  Don't use this memberfunction in analysis
+  //  
+
+  fPartId = usPId  ;
+  fEnergy  = fEner  ;
+
+  fTheta   = fThet ;
+  fPhi     = fPhii ;
+
+  fCoreD   = fCorD ;
+  fCoreX   = fCorX ;
+  fCoreY   = fCorY ;
+  fImpact  = fImpa ;
+
+  fPhotIni      = uiPin ;
+  fPassPhotAtm  = uiPat ;
+  fPassPhotRef  = uiPre ;
+  fPassPhotCone = uiPco ;
+  fPhotElfromShower = uiPelS ;
+  fPhotElinCamera   = uiPelC ;
+}
+
+
+
+MMcEvt::~MMcEvt() {
+  //
+  //  default destructor
+  //
+}
+
+
+
+
+void MMcEvt::Clear(Option_t *opt) {
+  //
+  //  
+  //  reset all values to zero
+
+  fPartId = 0  ;
+  fEnergy  = 0. ;
+
+  fTheta   = 0. ;
+  fPhi     = 0. ;
+
+  fCoreD   = 0. ;
+  fCoreX   = 0. ;
+  fCoreY   = 0. ;
+  fImpact  = 0. ;
+
+  fPhotIni      = 0 ;
+  fPassPhotAtm  = 0 ;
+  fPassPhotRef  = 0 ;
+  fPassPhotCone = 0 ;
+  fPhotElfromShower = 0 ;
+  fPhotElinCamera   = 0 ;
+}
+
+void MMcEvt::Fill( UShort_t usPId, 
+		   Float_t  fEner, 
+		   Float_t  fThet, 
+		   Float_t  fPhii, 
+		   Float_t  fCorD, 
+		   Float_t  fCorX, 
+		   Float_t  fCorY,
+		   Float_t  fImpa, 
+		   UInt_t   uiPin, 
+		   UInt_t   uiPat,  
+		   UInt_t   uiPre, 
+		   UInt_t   uiPco,  
+		   UInt_t   uiPelS,  
+		   UInt_t   uiPelC ) {
+  //
+  //  All datamembers are filled with the correspondin parameters. 
+  //
+  //  Don't use this memberfunction in analysis
+  //  
+
+  fPartId = usPId  ;
+  fEnergy  = fEner  ;
+
+  fTheta   = fThet ;
+  fPhi     = fPhii ;
+
+  fCoreD   = fCorD ;
+  fCoreX   = fCorX ;
+  fCoreY   = fCorY ;
+  fImpact  = fImpa ;
+
+  fPhotIni      = uiPin ;
+  fPassPhotAtm  = fPhotIni-uiPat ;
+  fPassPhotRef  = fPassPhotAtm-uiPre ;
+  fPassPhotCone = uiPco ;
+  fPhotElfromShower = uiPelS ;
+  fPhotElinCamera = uiPelC ;
+}
+
+
+
+void MMcEvt::Print(Option_t *Option) {
+  //
+  //  print out the data member on screen
+  //
+  cout <<endl << "Monte Carlo output:" <<endl;
+  cout << " Particle Id    : " << fPartId ; 
+  cout << " Energy (GeV)   : " << fEnergy  ; 
+  cout << " Impactpar. (m) : " << fImpact  ; 
+  cout << " Photoelectrons : " << fPhotElfromShower ; 
+  cout << endl ; 
+}
Index: /tags/Mars_V0-4/Mars/mmc/MMcEvt.hxx
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/MMcEvt.hxx	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/MMcEvt.hxx	(revision 9635)
@@ -0,0 +1,110 @@
+#ifndef __MMcEvt__
+#define __MMcEvt__
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>  
+
+#include <iostream.h>
+#include "MParContainer.h"
+
+
+class MMcEvt : public MParContainer{
+ private:
+  UShort_t fPartId;     // Type of particle
+  Float_t fEnergy;       // Energy in GeV
+
+  Float_t fTheta;        // Theta angle of event 
+  Float_t fPhi;          // Phi angle of event 
+
+  Float_t fCoreD;        // Core d pos
+  Float_t fCoreX;        // Core x pos
+  Float_t fCoreY;        // Core y pos
+  Float_t fImpact;       // impact parameter
+
+  UInt_t fPhotIni;      // Initial number of photons
+  UInt_t fPassPhotAtm;  // Passed atmosphere
+  UInt_t fPassPhotRef;  // Passed reflector(reflectivity + effective area)
+  UInt_t fPassPhotCone; // Passed glas
+  UInt_t fPhotElfromShower;   // Passed qe coming from the shower
+  UInt_t fPhotElinCamera;     // usPhotElfromShower + mean of phe
+                               // from NSB
+
+ public:
+  MMcEvt() ;
+  
+  MMcEvt( UShort_t, 
+	  Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t,
+	  UInt_t, UInt_t, UInt_t, UInt_t, UInt_t, UInt_t ) ; 
+  
+  ~MMcEvt(); 
+
+  void Clear(Option_t *opt=NULL);
+
+  void Fill( UShort_t, 
+	     Float_t, Float_t, Float_t, Float_t, Float_t, Float_t, Float_t,
+	     UInt_t, UInt_t, UInt_t, UInt_t, UInt_t, UInt_t ) ; 
+
+
+  void Print(Option_t *);
+
+  Short_t GetPartId() const { return fPartId; }       //Get Type of particle
+  Float_t GetEnergy() const { return fEnergy; }        //Get Energy
+
+  Float_t GetTheta() const { return fTheta; }          //Get Theta angle
+  Float_t GetPhi() const { return fPhi ;  }            //Get Phi angle
+
+/*    Float_t GetCoreD() { return fCoreD; }          //Get Core d pos */
+/*    Float_t GetCoreX() { return fCoreX; }          //Get Core x pos */
+/*    Float_t GetCoreY() { return fCoreY; }          //Get Core y pos */
+  Float_t GetImpact() const { return fImpact;}         //Get impact parameter 
+
+/*    UInt_t GetPhotIni() { return fPhotIni; }           //Get Initial photons */
+/*    UInt_t GetPassPhotAtm() { return fPassPhotAtm;}    //Get Passed atmosphere */
+/*    UInt_t GetPassPhotRef() { return fPassPhotRef; }   //Get Passed reflector */
+/*    UInt_t GetPassPhotCone() { return fPassPhotCone; } //Get Passed glas */
+  UInt_t GetPhotElfromShower() { return fPhotElfromShower; }             //Get Passed qe from shower
+/*    UInt_t GetPhotElinCamera() { return fPhotElinCamera; }             //Get Passed qe total*/
+
+
+  void SetPartId(Short_t PartId)
+  {fPartId=PartId;}             //Set Type of particle 
+
+  void SetEnergy(Float_t Energy)
+  { fEnergy=Energy; }              //Set Energy 
+ 
+  void SetTheta(Float_t Theta) 
+  { fTheta=Theta; }                //Set Theta angle 
+
+  void SetPhi(Float_t Phi) 
+  { fPhi=Phi;  }                   //Set Phi angle 
+ 
+  void SetCoreD(Float_t CoreD) 
+  { fCoreD=CoreD; }                //Set Core d pos
+
+  void SetCoreX(Float_t CoreX)
+  { fCoreX=CoreX; }                //Set Core x pos 
+
+  void SetCoreY(Float_t CoreY ) 
+  { fCoreY=CoreY; }                //Set Core y pos
+
+  void SetImpact(Float_t Impact) 
+  { fImpact=Impact;}               //Set impact parameter
+  
+/*    void SetPhotIni(Short_t PhotIni)  */
+/*      { fPhotIni=PhotIni; }                 //Set Initial photons */
+/*    void SetPassPhotAtm(Short_t PassPhotAtm)  */
+/*      { fPassPhotAtm=PassPhotAtm;}         //Set Passed atmosphere */
+/*    void SetPassPhotRef(Short_t PassPhotRef)  */
+/*      { fPassPhotRef=PassPhotRef ; }       //Set Passed reflector */
+/*    void SetPassPhotCone(Short_t PhotCon)  */
+/*      { fPassPhotCone=PhotCon; }           //Set Passed glas */
+
+
+  ClassDef(MMcEvt, 1)  //Stores Montecarlo Information of one event (eg. the energy)
+
+};
+
+#endif
Index: /tags/Mars_V0-4/Mars/mmc/MMcFadcHeader.cxx
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/MMcFadcHeader.cxx	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/MMcFadcHeader.cxx	(revision 9635)
@@ -0,0 +1,57 @@
+#include <iostream.h>
+#include "MMcFadcHeader.hxx"
+
+
+//==========
+// MMcFadcHeader
+//    
+// This class contains the MonteCarlo information
+// of the FADC simulation for the current run.
+// The information is saved only once, whatever the
+// number of events is
+ 
+
+
+ClassImp(MMcFadcHeader)
+
+
+
+MMcFadcHeader::MMcFadcHeader() {
+  //
+  //  default constructor
+  //  set all values to zero
+
+  Int_t i;
+
+  fFadcShape=0.0; 
+  fAmplFadc=MFADC_RESPONSE_AMPLITUDE;
+  fFwhmFadc=MFADC_RESPONSE_FWHM;
+
+  for(i=0;i<MFADC_CHANNELS;i++){
+    fPedesMean[i]= 0.0    ;
+    fElecNoise[i]=-1.0   ;
+  }
+}
+
+MMcFadcHeader::~MMcFadcHeader(){
+  //
+  //  default destructor
+  //
+}
+
+
+void MMcFadcHeader::Print(Option_t *Option) {
+  //
+  //  print out the data member on screen
+  //
+
+  cout <<endl << "Monte Carlo Fadc output:" <<endl;
+  cout << " Shape type of the signal : "<<fFadcShape<<endl;
+  cout << " Amplitude of the trigger in mV : "<<fAmplFadc<<endl;
+  cout << " Width of the signal in nsec : "<<fFwhmFadc<<endl;
+  cout << " Pedestals and ElecNoise in fadc counts : "<<endl;
+  for (int i=0;i<MFADC_CHANNELS;i++){
+    cout << " Pixel "<<i<<" : "<<fPedesMean[i]<<"  "<<fElecNoise[i]<<endl;
+  }
+  cout << endl ; 
+}
Index: /tags/Mars_V0-4/Mars/mmc/MMcFadcHeader.hxx
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/MMcFadcHeader.hxx	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/MMcFadcHeader.hxx	(revision 9635)
@@ -0,0 +1,69 @@
+#ifndef __MMcFadcHeader__
+#define __MMcFadcHeader__
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>  
+
+#include <iostream.h>
+#include "MParContainer.h"
+
+#include "MTriggerDefine.h"
+#include "MFadcDefine.h"
+
+class MMcFadcHeader : public MParContainer{
+ private:
+
+  Float_t  fFadcShape   ;   // a number that indicate the shape type of 
+                            // the signal   
+                            // = 0 --> a gaussian  
+  Float_t  fAmplFadc    ;   // the amplitude of the trigger in mV
+  Float_t  fFwhmFadc    ;   // the width of the signal in nsec
+  Float_t  fPedesMean[MFADC_CHANNELS]    ;  //  The mean value for the pedestal
+                                            //  of each pixel (channel)
+  Float_t  fElecNoise[MFADC_CHANNELS]   ;  //  The rms value in the pedestal 
+                                           //  due to the electronics for
+                                           //  each pixel (channel)
+
+ public:
+  MMcFadcHeader() ;
+
+  ~MMcFadcHeader(); 
+
+  void Print(Option_t *);
+  
+  void SetShape(Float_t shape){
+    fFadcShape=shape;
+  }
+
+  void SetAmplitud(Float_t amp){
+    fAmplFadc=amp;
+ }
+
+  void SetFwhm(Float_t fwhm){
+    fFwhmFadc=fwhm;
+  }
+
+  void SetPedestal(Float_t *mean, Int_t dim){
+    for (Int_t i=0;i<dim;i++)
+      fPedesMean[i]=mean[i];
+  }
+
+  void SetElecNoise(Float_t *sigma, Int_t dim){
+    for (Int_t i=0;i<dim;i++)
+      fElecNoise[i]=sigma[i];
+  }
+  
+  Float_t GetPedestal(UInt_t i) const    { return fPedesMean[i]; }
+  Float_t GetPedestalRms(UInt_t i) const { return fElecNoise[i]; }
+
+  UInt_t GetNumPixel() const { return MFADC_CHANNELS; }
+
+  ClassDef(MMcFadcHeader, 1)  //Stores Montecarlo Information describing the FADC behaviour
+
+};
+
+#endif
+
Index: /tags/Mars_V0-4/Mars/mmc/MMcTrig.cxx
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/MMcTrig.cxx	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/MMcTrig.cxx	(revision 9635)
@@ -0,0 +1,114 @@
+#include <iostream.h>
+#include "MMcTrig.hxx"
+
+
+//==========
+// MMcTrig
+//    
+// This class handles and contains the MonteCarlo information
+// with which the events have been generated
+// This information exists for each event.
+ 
+
+
+ClassImp(MMcTrig)
+
+
+
+MMcTrig::MMcTrig() {
+  //
+  //  default constructor
+  //  set all values to zero
+
+  
+  *fName  = "MMcTrig";
+  *fTitle = "Trigger info from Monte Carlo";
+
+    
+  Int_t i,j;
+
+  fNumFirstLevel  = 0 ;
+
+  for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
+    fTimeFirst[i]    = -99.9;
+    for(j=0;j<TRIGGER_PIXELS/8+1;j++){
+      fPixelsFirst[j][i]   = 0;
+    }
+  }
+
+  fNumSecondLevel = 0 ; 
+  for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
+    fFirstToSecond[i]=0;
+  }
+}
+
+MMcTrig::~MMcTrig() {
+  //
+  //  default destructor
+  //
+}
+
+void MMcTrig::Clear(Option_t *opt) {
+  //
+  //  
+  //  reset all values to zero
+  Int_t i,j;
+
+  fNumFirstLevel  = 0 ;
+  for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
+    fTimeFirst[i]    = -99.9;
+    for(j=0;j<TRIGGER_PIXELS/8+1;j++){
+      fPixelsFirst[j][i]   = 0;
+    }
+  }
+
+  fNumSecondLevel = 0 ; 
+  for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
+    fFirstToSecond[i]=0;
+  }
+
+  //  cout << "MMcTrig::Clear() " << endl ; 
+}
+
+void MMcTrig::Print(Option_t *Option) {
+  //
+  //  print out the data member on screen
+  //
+  Int_t i,j;
+
+  cout <<endl << "Monte Carlo Trigger output:" <<endl;
+  cout << " First  Level Trigger in this Event : "<<fNumFirstLevel<<endl; 
+  cout << " Times of first  Level Trigger in this Event : ";
+  for (i=0;i<fNumFirstLevel;i++){
+    cout<< fTimeFirst[i]<<"-";
+  }
+  cout<<endl;
+  cout << " Pixels of first  Level Trigger in this Event : ";
+  for (i=0;i<fNumFirstLevel;i++){
+    for(j=0;j<TRIGGER_PIXELS/8+1;j++){
+      cout<<fPixelsFirst[j][i]<<"-";
+    }
+  }
+  cout<<endl;
+  cout << " Second Level Trigger in this Event : " << fNumSecondLevel << endl; 
+  cout << endl ; 
+}
+
+Byte_t MMcTrig::IsPixelFired(Int_t npix, Int_t nfirstlevel){
+  //======================================================================
+  //
+  //  It returns >1 if the pixel npix was fired when the nfirstlevel
+  //  first level trigger happened, 0 if not.
+  //
+
+  Byte_t ret=0;
+  Byte_t reminder;
+  Int_t body;
+
+  body=npix/8;
+  reminder=(Byte_t)(pow(2,npix%8));
+
+  ret=reminder&fPixelsFirst[body][nfirstlevel];
+  return(ret);
+
+}
Index: /tags/Mars_V0-4/Mars/mmc/MMcTrig.hxx
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/MMcTrig.hxx	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/MMcTrig.hxx	(revision 9635)
@@ -0,0 +1,74 @@
+#ifndef __MMcTrig__
+#define __MMcTrig__
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>  
+
+#include <iostream.h>
+#include "MParContainer.h"
+
+#include "MTriggerDefine.h"
+
+class MMcTrig : public MParContainer {
+ private:
+
+  Short_t fNumFirstLevel  ;    // Number of First Level Trigger in this Event
+  Short_t fNumSecondLevel ;    // Number of Second Level Trigger in this Event
+
+  Float_t fTimeFirst[((Int_t)(TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME))+1];
+                            // Time when it triggers
+  Byte_t fPixelsFirst[((Int_t)(TRIGGER_PIXELS/8))+1][((Int_t)(TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME))+1];
+                            // Pixel which are above threshold when trigger happens
+  Short_t fFirstToSecond[((Int_t)(TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME))+1];
+
+ public:
+  MMcTrig() ;
+
+  ~MMcTrig(); 
+
+  void Clear(Option_t *opt=NULL);
+  
+  void Print(Option_t *);
+
+  void SetFirstLevel  ( Short_t nTr ) {
+    fNumFirstLevel = nTr ; 
+  } 
+  void SetSecondLevel ( Short_t nTr ) {
+    fNumSecondLevel = nTr ; 
+  } 
+
+  void SetTime( Float_t t, Int_t i){
+    if (i>TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1  || i<1){
+      cout<<"fNumFirstLevel out of range. Time will be -99"<<endl;
+    }
+    else{
+      fTimeFirst[i-1]=t;
+    }
+  }
+
+  void SetMapPixels(Byte_t *map,Int_t nfirst){
+    //  
+    //  It sets the map of pixel that are above the trheshold
+    //
+
+    int i;
+
+    for(i=0;i<((Int_t)(TRIGGER_PIXELS/8))+1;i++){
+      fPixelsFirst[i][nfirst]=map[i];
+    }
+  }
+
+  Int_t GetFirstLevel() const {
+    return ( fNumFirstLevel );  
+  }
+
+  Byte_t IsPixelFired(Int_t npix, Int_t nfirstlevel);
+
+  ClassDef(MMcTrig, 1)  //Stores Montecarlo Information (number of 1st, 2nd level triggers)
+
+};
+
+#endif
Index: /tags/Mars_V0-4/Mars/mmc/MMcTrigHeader.cxx
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/MMcTrigHeader.cxx	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/MMcTrigHeader.cxx	(revision 9635)
@@ -0,0 +1,60 @@
+#include <iostream.h>
+#include "MMcTrigHeader.hxx"
+
+
+//==========
+// MMcTrigHeader
+//    
+// This class contains the MonteCarlo information
+// of the trigger simulation for the current run.
+// The information is saved only once, whatever the
+// number of events is
+ 
+
+
+ClassImp(MMcTrigHeader)
+
+
+
+MMcTrigHeader::MMcTrigHeader() {
+  //
+  //  default constructor
+  //  set all values to zero
+
+  Int_t i;
+
+  fTopology     = -1 ;
+  fMultiplicity = -1 ;
+  for(i=0;i<TRIGGER_PIXELS;i++){
+    fThreshold[i] = -1.0;
+  }
+  
+  fTrigPattern[0]=0;
+  fTrigPattern[1]=0;
+
+  fTrigShape=0.0; 
+  fAmplTrig=RESPONSE_AMPLITUDE;
+  fFwhmTrig=RESPONSE_FWHM;
+  fOverlapingTime=TRIGGER_OVERLAPING;
+  fGateLeng=TRIGGER_GATE ;
+}
+
+MMcTrigHeader::~MMcTrigHeader() {
+  //
+  //  default destructor
+  //
+}
+
+
+void MMcTrigHeader::Print(Option_t *Option) {
+  //
+  //  print out the data member on screen
+  //
+
+  cout <<endl << "Monte Carlo Trigger output:" <<endl;
+  cout << " XSTopology Trigger in this run : "<<fTopology<<endl;
+  cout << " Multiplicity Trigger in this run : "<<fMultiplicity<<endl;
+  cout << " Trigger Pattern in this run : "<<fTrigPattern[0]<<
+    fTrigPattern[1]<<endl;
+  cout << endl ; 
+}
Index: /tags/Mars_V0-4/Mars/mmc/MMcTrigHeader.hxx
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/MMcTrigHeader.hxx	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/MMcTrigHeader.hxx	(revision 9635)
@@ -0,0 +1,93 @@
+#ifndef __MMcTrigHeader__
+#define __MMcTrigHeader__
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>  
+
+#include <iostream.h>
+#include "MParContainer.h"
+
+#include "MTriggerDefine.h"
+
+class MMcTrigHeader : public MParContainer{
+ private:
+
+  Short_t fTopology     ;      // Topology of the trigger
+                                   // 0 = N-1 neighbours of one pixel
+                                   // 1 = N neighbours
+                                   // 2 = N closed pack
+  Short_t fMultiplicity ;      // Pixel multiplicity of trigger configuration
+  Float_t fThreshold[TRIGGER_PIXELS] ; // Threshold for trigger
+  UInt_t fTrigPattern[2];     // Used to inddentify with 
+                              // RawEvt::Trigger Pattern identification  
+  Float_t  fTrigShape   ;   // a number that indicate the shape type of 
+                            // the signal   
+                            // = 0 --> a gaussian  
+  Float_t  fAmplTrig    ;   // the amplitude of the trigger in mV
+  Float_t  fFwhmTrig    ;   // the width of the signal in nsec
+  Float_t  fOverlapingTime;// Minimum coincidence time
+  Float_t  fGateLeng;       // the length of the digital signal if analog signal is above threshold
+
+ public:
+  MMcTrigHeader() ;
+
+  ~MMcTrigHeader(); 
+
+  void Print(Option_t *);
+  
+  void SetTopology(Short_t nTop) {
+    fTopology=nTop;
+  }
+
+  void SetMultiplicity(Short_t nMul) {
+    fMultiplicity=nMul;
+  }
+
+  void SetThreshold(Float_t fthr[]){
+    int i;
+    for(i=0;i<TRIGGER_PIXELS;i++){
+      fThreshold[i]=fthr[i];
+    }
+  }
+
+  void SetTrigPattern (UInt_t upi, UInt_t loi){
+
+    if (upi==loi==0) {
+      fTrigPattern[0]= (UInt_t) fThreshold[0];
+      fTrigPattern[1]= (UInt_t) (100*fMultiplicity+fTopology);
+    }
+    else {
+      fTrigPattern[0]=upi;
+      fTrigPattern[1]=loi;
+    }
+  }
+
+  void SetShape(Float_t shape){
+    fTrigShape=shape;
+  }
+
+  void SetAmplitud(Float_t amp){
+    fAmplTrig=amp;
+ }
+
+  void SetFwhm(Float_t fwhm){
+    fFwhmTrig=fwhm;
+  }
+
+  void SetOverlap(Float_t overlap){
+    fOverlapingTime=overlap;
+  }
+
+  void SetGate(Float_t gate){
+    fGateLeng=gate;
+  }
+
+  ClassDef(MMcTrigHeader, 1)  //Stores Montecarlo Information which describes the used trigger
+
+};
+
+#endif
+
Index: /tags/Mars_V0-4/Mars/mmc/MTriggerDefine.h
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/MTriggerDefine.h	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/MTriggerDefine.h	(revision 9635)
@@ -0,0 +1,96 @@
+//
+//
+//      In this file are the fundamental definitions for the class MCTrigger
+//
+//
+#define TRIGGER_PIXELS        271
+//
+//      This is the number of Pixels contributing to the TRIGGER logic
+//      All Pixels-Id above that value don't do an trigger stuff. 
+//      
+//
+#define TOTAL_TRIGGER_TIME    160 
+//
+//      This values defines the total range in that we try to find
+//      a trigger. 
+//
+#define LEVEL1_DEAD_TIME    50
+//
+//      Dead time of the detector after one first level trigger happens.
+//
+#define LEVEL2_DEAD_TIME    300
+//
+//      Dead time of the detector after second level trigger fires
+//
+#define SLICES_PER_NSEC         4
+//      
+//      Each nano second is divided into the number of this values slices. 
+//      So you can get the total number of timeslices for one Pixel by 
+//      ( TOTAL_TRIGGER_TIME * SLICES_PER_NSEC ). 
+//      In the current settings this are 1000 slices
+//
+#define TRIGGER_TIME_SLICES     (TOTAL_TRIGGER_TIME*SLICES_PER_NSEC) 
+//
+//
+//
+//
+//       ------>>>   SETTINGS for the RESPONSE FUNCTION
+// 
+#define RESPONSE_SLICES        40
+//
+//       This is for the standard response Signal to 1 Photoelectron
+//       that leaves the Photocathode
+//       The whole Timescale for the signal is 10 nsec
+//
+//       The Response function
+//
+//       These values are discussed with Eckart. We start from this point. 
+//
+#define RESPONSE_FWHM          2. 
+
+#define RESPONSE_AMPLITUDE     1. 
+//
+//       This are the Standard values of the response function for
+//       1 photo electron. ( 1 means 1 mV per phote electron ) 
+//
+//
+//       -------->>> SETTINGS for the DISKRIMINATORS
+//
+//
+#define CHANNEL_THRESHOLD      2.5 
+//
+//       This is the diskriminator threshold for each individual channel
+//       First we set the value to 2 unit of the RESPONSE_AMPLITUDE 
+//
+#define TRIGGER_GATE           3. 
+// 
+//       Here we set the width of the digital signal we get if the signal
+//       passes the diskriminator
+//
+//
+#define TRIGGER_OVERLAPING           0.25 
+// 
+//       Here we set the required overlaping time among pixels
+//       to be in coincidence.
+//
+//
+//      --------->>>> SETTINGS for the TRIGGER logic
+//
+//
+#define TRIGGER_CELLS          19  
+//
+//       Number of trigger cells that cover the trigger zone
+//
+#define TRIGGER_MULTI          4.  
+//
+//       We get a Level Zero Trigger, if we have a least TRIGGER_MULTI
+//       channels with a diskrimiator signal at the same time 
+//
+#define TRIGGER_GEOM           0
+//
+//      This defines the geometry required for a trigger. There exists 
+//      different meaning for this behaviour: 
+//         0 means a pixel with trigger_multi-1 neighbours
+//         1 means trigger_multi neighbours
+//         2 means trigger_multi closed neighbours
+//
Index: /tags/Mars_V0-4/Mars/mmc/Makefile
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/Makefile	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/Makefile	(revision 9635)
@@ -0,0 +1,52 @@
+##################################################################
+#
+#   makefile
+# 
+#   for the MARS software
+#
+##################################################################
+# @maintitle
+
+# @code
+
+#
+#  please change all system depend values in the 
+#  config.mk.${OSTYPE} file 
+#
+#
+include ../Makefile.conf.$(OSTYPE)
+include ../Makefile.conf.general
+
+# @endcode 
+
+INCLUDES = -I.  -I../mbase
+
+# @code 
+
+CINT     = Mc
+LIB      = mmc.a
+
+#------------------------------------------------------------------------------
+
+.SUFFIXES: .c .cc .cxx .h .hxx .o 
+
+SRCFILES = MMcTrigHeader.cxx \
+	   MMcFadcHeader.cxx \
+	   MMcEvt.cxx \
+           MMcTrig.cxx 
+
+SRCS    = $(SRCFILES)
+HEADERS = $(SRCFILES:.cxx=.hxx)
+OBJS    = $(SRCFILES:.cxx=.o) 
+
+############################################################
+
+all: $(LIB)
+
+include ../Makefile.rules
+
+clean:	rmlib rmcint rmobjs rmcore
+
+mrproper:	clean rmbak
+
+# @endcode
Index: /tags/Mars_V0-4/Mars/mmc/McIncl.h
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/McIncl.h	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/McIncl.h	(revision 9635)
@@ -0,0 +1,3 @@
+#ifndef __CINT__
+
+#endif // __CINT__
Index: /tags/Mars_V0-4/Mars/mmc/McLinkDef.h
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/McLinkDef.h	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/McLinkDef.h	(revision 9635)
@@ -0,0 +1,17 @@
+#ifdef __CINT__
+#define __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+ 
+#pragma link C++ class MMcEvt;
+#pragma link C++ class MMcTrig;
+#pragma link C++ class MMcTrigHeader;
+#pragma link C++ class MMcFadcHeader;
+
+#endif
+
+
+
+
Index: /tags/Mars_V0-4/Mars/mmc/Mdefine.h
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/Mdefine.h	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/Mdefine.h	(revision 9635)
@@ -0,0 +1,41 @@
+//
+//     Mdefine.h
+//
+//     defines some Values for the MAGIC telecope
+//
+
+//     Number of the Pixels in the Camera
+
+#define     CAMERA_PIXELS         577
+
+//     Number of the Slices of one Fadc. Be carefull this is the number of 
+//     slices for one gain branch. We sample two times this number. 
+
+#define     FADC_SLICES            15
+
+//     ParticleId for Monte Carlo simulation
+
+#define  GAMMA 0
+#define  PROTON 14
+#define  HELIUM 402
+#define  OXIGEN 1608
+#define  IRON 5626
+
+
+//---------------------------------------------------------
+// definition of constants
+
+#define TRUE 1
+#define FALSE 0
+
+#define MAX_ADC 30  // nummber of ADC conversions per pixel
+
+//camera dimensions and definitions
+#define PIXEL_DIST  10.0  //cm
+#define CAMERA_COLOR 13   //Background light grey
+#define DEFAULT_COLOR 1 //black
+//#define TRACK_WALL_COLOR 7   //light blue
+#define PIXEL_LINE_COLOR 15 //dark grey
+#define COLORTABLE_START 18 //Begin of colortable
+#define MAX_PH_EL 500 //upper limit for colortable
+
Index: /tags/Mars_V0-4/Mars/mmc/readme.txt
===================================================================
--- /tags/Mars_V0-4/Mars/mmc/readme.txt	(revision 9635)
+++ /tags/Mars_V0-4/Mars/mmc/readme.txt	(revision 9635)
@@ -0,0 +1,6 @@
+
+ Please be aware of that this subdirectory is used in two CVS modules.
+ 
+ If you change something it can affect the Mars and/or Monte Carlo
+ code!
+ 
