Index: trunk/MagicSoft/include-Classes/LinkDef.h
===================================================================
--- trunk/MagicSoft/include-Classes/LinkDef.h	(revision 434)
+++ trunk/MagicSoft/include-Classes/LinkDef.h	(revision 436)
@@ -10,4 +10,5 @@
 #pragma link C++ class MMcEvt;
 #pragma link C++ class MMcTrig;
+#pragma link C++ class MHeaderTrig;
 
 #pragma link C++ class MPedData;
Index: trunk/MagicSoft/include-Classes/MHeaderTrig.cxx
===================================================================
--- trunk/MagicSoft/include-Classes/MHeaderTrig.cxx	(revision 436)
+++ trunk/MagicSoft/include-Classes/MHeaderTrig.cxx	(revision 436)
@@ -0,0 +1,55 @@
+#include <iostream.h>
+#include "MHeaderTrig.hxx"
+
+
+//==========
+// MHeaderTrig
+//    
+// 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(MHeaderTrig)
+
+
+
+MHeaderTrig::MHeaderTrig() {
+  //
+  //  default constructor
+  //  set all values to zero
+
+  Int_t i;
+
+  topology     = -1 ;
+  multiplicity = -1 ;
+  for(i=0;i<TRIGGER_PIXELS;i++){
+    threshold[i] = -1.0;
+  }
+  
+  TriggerPattern[0]=0;
+  TriggerPattern[1]=0;
+
+}
+
+MHeaderTrig::~MHeaderTrig() {
+  //
+  //  default destructor
+  //
+}
+
+
+void MHeaderTrig::Print(Option_t *Option) {
+  //
+  //  print out the data member on screen
+  //
+
+  cout <<endl << "Monte Carlo Trigger output:" <<endl;
+  cout << " XSTopology Trigger in this run : "<<topology<<endl;
+  cout << " Multiplicity Trigger in this run : "<<multiplicity<<endl;
+  cout << " Trigger Pattern in this run : "<<TriggerPattern[0]<<
+    TriggerPattern[1]<<endl;
+  cout << endl ; 
+}
Index: trunk/MagicSoft/include-Classes/MHeaderTrig.hxx
===================================================================
--- trunk/MagicSoft/include-Classes/MHeaderTrig.hxx	(revision 436)
+++ trunk/MagicSoft/include-Classes/MHeaderTrig.hxx	(revision 436)
@@ -0,0 +1,66 @@
+#ifndef __MHeaderTrig__
+#define __MHeaderTrig__
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+#include <fcntl.h>  
+
+#include <iostream.h>
+#include "TObject.h"
+
+#include "../Simulation/Detector/include-MTrigger/MTriggerDefine.h"
+
+class MHeaderTrig : public TObject {
+ private:
+
+  Short_t topology     ;      // Topology of the trigger
+                                   // 0 = N-1 neighbours of one pixel
+                                   // 1 = N neighbours
+                                   // 2 = N closed pack
+  Short_t multiplicity ;      // Pixel multiplicity of trigger configuration
+  Float_t threshold[TRIGGER_PIXELS] ; // Threshold for trigger
+  UInt_t TriggerPattern[2];     // Used to inddentify with 
+                              // RawEvt::Trigger Pattern identification  
+
+ public:
+  MHeaderTrig() ;
+
+  ~MHeaderTrig(); 
+
+  void Print(Option_t *);
+  
+  void SetTopology(Short_t nTop) {
+    topology=nTop;
+  }
+
+  void SetMultiplicity(Short_t nMul) {
+    multiplicity=nMul;
+  }
+
+  void SetThreshold(Float_t fthr[]){
+    int i;
+    for(i=0;i<TRIGGER_PIXELS;i++){
+      threshold[i]=fthr[i];
+    }
+  }
+
+  void SetTriggerPattern (UInt_t upi, UInt_t loi){
+
+    if (upi==loi==0) {
+      TriggerPattern[0]= (UInt_t) threshold[0];
+      TriggerPattern[1]= (UInt_t) (100*multiplicity+topology);
+    }
+    else {
+      TriggerPattern[0]=upi;
+      TriggerPattern[1]=loi;
+    }
+  }
+
+  ClassDef(MHeaderTrig, 1)  //Stores Montecarlo Information 
+
+};
+
+#endif
+
Index: trunk/MagicSoft/include-Classes/MMcTrig.cxx
===================================================================
--- trunk/MagicSoft/include-Classes/MMcTrig.cxx	(revision 434)
+++ trunk/MagicSoft/include-Classes/MMcTrig.cxx	(revision 436)
@@ -23,16 +23,15 @@
   Int_t i;
 
-  topology     = -1 ;
-  multiplicity = -1 ;
-  for(i=0;i<TRIGGER_PIXELS;i++){
-    threshold[i] = -1.0;
+  nFirstLevel  = 0 ;
+
+  for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
+    timeFirst[i]    = -99.9;
+    pixelFirst[i]   = -9;
   }
 
-  nFirstLevel  = 0 ;
-  timeFirst    = -99.9;
-  pixelFirst   = -9;
-   
   nSecondLevel = 0 ; 
-
+  for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
+    FirstToSecond[i]=0;
+  }
 }
 
@@ -50,8 +49,13 @@
 
   nFirstLevel  = 0 ;
-  timeFirst    = -99.9;
-  pixelFirst   = -9;
+  for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1;i++){
+    timeFirst[i]    = -99.9;
+    pixelFirst[i]   = -9;
+  }
 
-  nSecondLevel = 0 ;
+  nSecondLevel = 0 ; 
+  for(i=0;i<TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME+1;i++){
+    FirstToSecond[i]=0;
+  }
 
   //  cout << "MMcTrig::Clear() " << endl ; 
@@ -65,9 +69,15 @@
 
   cout <<endl << "Monte Carlo Trigger output:" <<endl;
-  cout << " Topology Trigger in this event : "<<topology<<endl;
-  cout << " Multiplicity Trigger in this event : "<<multiplicity<<endl;
   cout << " First  Level Trigger in this Event : "<<nFirstLevel<<endl; 
-  cout << " Time of first  Level Trigger in this Event : "<< timeFirst<<endl;
-  cout << " Pixels of first  Level Trigger in this Event : "<<pixelFirst<<endl;
+  cout << " Times of first  Level Trigger in this Event : ";
+  for (i=0;i<nFirstLevel;i++){
+    cout<< timeFirst[i]<<"-";
+  }
+  cout<<endl;
+  cout << " Pixels of first  Level Trigger in this Event : ";
+  for (i=0;i<nFirstLevel;i++){
+    cout<<pixelFirst[i]<<"-";
+  }
+  cout<<endl;
   cout << " Second Level Trigger in this Event : " << nSecondLevel << endl ; 
   cout << endl ; 
Index: trunk/MagicSoft/include-Classes/MMcTrig.hxx
===================================================================
--- trunk/MagicSoft/include-Classes/MMcTrig.hxx	(revision 434)
+++ trunk/MagicSoft/include-Classes/MMcTrig.hxx	(revision 436)
@@ -15,17 +15,13 @@
 class MMcTrig : public TObject {
  private:
-  Short_t topology     ;    // Topology of the trigger
-                                   // 0 = N-1 neighbours of one pixel
-                                   // 1 = N neighbours
-                                   // 2 = N closed pack
-  Short_t multiplicity ;    // Pixel multiplicity of trigger configuration
-  Float_t threshold[TRIGGER_PIXELS] ; // Threshold for trigger
-  
-  Short_t nZeroLevel   ;
+
   Short_t nFirstLevel  ;    // Number of First Level Trigger in this Event
   Short_t nSecondLevel ;    // Number of Second Level Trigger in this Event
 
-  Float_t timeFirst;    // Time when it triggers
-  Int_t pixelFirst;     // Pixel which triggers
+  Float_t timeFirst[((Int_t)(TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME))+1];
+                            // Time when it triggers
+  Int_t pixelFirst[((Int_t)(TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME))+1];
+                            // Pixel which triggers
+  Short_t FirstToSecond[((Int_t)(TOTAL_TRIGGER_TIME/LEVEL2_DEAD_TIME))+1];
 
  public:
@@ -38,23 +34,4 @@
   void Print(Option_t *);
 
-  void SetTopology(Short_t nTop) {
-    topology=nTop;
-  }
-
-  void SetMultiplicity(Short_t nMul) {
-    multiplicity=nMul;
-  }
-
-  void SetThreshold(Float_t fthr[]){
-    int i;
-    for(i=0;i<TRIGGER_PIXELS;i++){
-      threshold[i]=fthr[i];
-    }
-  }
-
-  void SetZeroLevel (Short_t nTr) {
-    nZeroLevel = nTr ; 
-  }
-
   void SetFirstLevel  ( Short_t nTr ) {
     nFirstLevel = nTr ; 
@@ -64,13 +41,23 @@
   } 
 
-  void SetTime( Float_t t){
-    timeFirst=t;
+  void SetTime( Float_t t, Int_t i){
+    if (i>TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1  || i<1){
+      cout<<"nFirstLevel out of range. Time will be -99"<<endl;
+    }
+    else{
+      timeFirst[i-1]=t;
+    }
   }
 
-  void SetPixel( Int_t iPix){
-    pixelFirst=iPix;
+  void SetPixel( Int_t iPix, Int_t i){
+    if (i>TOTAL_TRIGGER_TIME/LEVEL1_DEAD_TIME+1  || i<1){
+      cout<<"nFirstLevel out of range. Pixel will be -1"<<endl;
+    }
+    else{
+      pixelFirst[i-1]=iPix;
+    }
   }
 
-  int GetFirstLevel() {
+  Int_t GetFirstLevel() {
     return ( nFirstLevel );  
   }
@@ -81,3 +68,2 @@
 
 #endif
-
