Index: trunk/MagicSoft/Mars/mgeom/GeomLinkDef.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/GeomLinkDef.h	(revision 2282)
+++ trunk/MagicSoft/Mars/mgeom/GeomLinkDef.h	(revision 2283)
@@ -7,4 +7,5 @@
 #pragma link C++ class MGeomPMT+;
 #pragma link C++ class MGeomMirror+;
+#pragma link C++ class MGeomCorsikaCT+;
 #pragma link C++ class MGeomPix+;
 #pragma link C++ class MGeomCam+;
Index: trunk/MagicSoft/Mars/mgeom/MGeomCorsikaCT.cc
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCorsikaCT.cc	(revision 2283)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCorsikaCT.cc	(revision 2283)
@@ -0,0 +1,72 @@
+/* ======================================================================== *\
+!
+! *
+! * This file is part of MARS, the MAGIC Analysis and Reconstruction
+! * Software. It is distributed to you in the hope that it can be a useful
+! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
+! * It is distributed WITHOUT ANY WARRANTY.
+! *
+! * Permission to use, copy, modify and distribute this software and its
+! * documentation for any purpose is hereby granted without fee,
+! * provided that the above copyright notice appear in all copies and
+! * that both that copyright notice and this permission notice appear
+! * in supporting documentation. It is provided "as is" without express
+! * or implied warranty.
+! *
+!
+!
+!   Author(s): Oscar Blanch 11/2002 <mailto:blanch@ifae.es>
+!
+!   Copyright: MAGIC Software Development, 2000-2002
+!
+!
+\* ======================================================================== */
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// MGeomCorsikaCT
+//
+// This is the base class of the PMT characteristics. 
+//
+////////////////////////////////////////////////////////////////////////////
+#include "MGeomCorsikaCT.h"
+
+#include "MLog.h"
+#include "MLogManip.h"
+
+ClassImp(MGeomCorsikaCT);
+
+using namespace std;
+
+// --------------------------------------------------------------------------
+//
+// Initializes a Telescope geometry.
+//
+MGeomCorsikaCT::MGeomCorsikaCT(const char *name, const char *title)
+{
+    fName  = name  ? name  : "MGeomCorsikaCT";
+    fTitle = title ? title : "Storage container for CT Telescope characteristics";
+}
+
+// --------------------------------------------------------------------------
+//
+// It fills the member variable of this class
+//
+void MGeomCorsikaCT::Fill(Float_t ctx, Float_t cty, Float_t ctz,
+			  Float_t cttheta, Float_t ctphi,
+			  Float_t ctdiam, Float_t ctfocal){
+  
+  fCTx=ctx;
+  fCTy=cty;
+  fCTz=ctz;
+  fCTtheta=cttheta;
+  fCTphi=ctphi;
+  fCTdiam=ctdiam;
+  fCTfocal=ctfocal;
+
+}
+
+
+
+
+
Index: trunk/MagicSoft/Mars/mgeom/MGeomCorsikaCT.h
===================================================================
--- trunk/MagicSoft/Mars/mgeom/MGeomCorsikaCT.h	(revision 2283)
+++ trunk/MagicSoft/Mars/mgeom/MGeomCorsikaCT.h	(revision 2283)
@@ -0,0 +1,36 @@
+#ifndef MARS_MGeomCorsikaCT
+#define MARS_MGeomCorsikaCT
+
+#ifndef ROOT_TArrayF
+#include <TArrayF.h>
+#endif
+#ifndef MARS_MParContainer
+#include "MParContainer.h"
+#endif
+
+class MGeomCorsikaCT : public MParContainer
+{
+private:
+
+    Float_t fCTx;  // X position of the CT center
+    Float_t fCTy;  // Y position of the CT center
+    Float_t fCTz;  // Z above high position of the CT center
+    Float_t fCTtheta; // 
+    Float_t fCTphi;   //
+    Float_t fCTdiam;  // Diamiter where the Cph are stored at MMCs level
+    Float_t fCTfocal; // Focal of the CT
+
+public:
+
+    MGeomCorsikaCT(const char *name=NULL, const char *title=NULL);
+
+    void Fill(Float_t ctx, Float_t cty, Float_t ctz,
+	      Float_t cttheta, Float_t ctphi,
+	      Float_t ctdiam, Float_t ctfocal);
+
+    ClassDef(MGeomCorsikaCT, 1)  // class containing information about CTelescope
+};
+
+#endif
+
+
Index: trunk/MagicSoft/Mars/mgeom/Makefile
===================================================================
--- trunk/MagicSoft/Mars/mgeom/Makefile	(revision 2282)
+++ trunk/MagicSoft/Mars/mgeom/Makefile	(revision 2283)
@@ -37,4 +37,5 @@
            MGeomCamECO1000.cc \
            MGeomCamECO1000HG.cc \
+           MGeomCorsikaCT.cc \
 	   MGeomMirror.cc \
 	   MGeomPMT.cc
Index: trunk/MagicSoft/include-Classes/MMcFormat/MFadcDefine.h
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/MFadcDefine.h	(revision 2282)
+++ trunk/MagicSoft/include-Classes/MMcFormat/MFadcDefine.h	(revision 2283)
@@ -41,3 +41,3 @@
 // -->  The maximum number of FADC channels
 //      Most likely it will be always equal to CAMERA_PIXELS 
-#define MFADC_CHANNELS  577
+#define MFADC_CHANNELS  3500
Index: trunk/MagicSoft/include-Classes/MMcFormat/MMcCorsikaRunHeader.cc
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/MMcCorsikaRunHeader.cc	(revision 2282)
+++ trunk/MagicSoft/include-Classes/MMcFormat/MMcCorsikaRunHeader.cc	(revision 2283)
@@ -33,4 +33,5 @@
 //
 ////////////////////////////////////////////////////////////////////////////
+#include "MGeomCorsikaCT.h"
 #include "MMcCorsikaRunHeader.h"
 
@@ -44,5 +45,6 @@
 //
 //
-MMcCorsikaRunHeader::MMcCorsikaRunHeader(const char *name, const char *title)
+MMcCorsikaRunHeader::MMcCorsikaRunHeader(const char *name, const char *title,
+					 int NumCT)
 {
     fName  = name  ? name  : "MMcCorsikaRunHeader";
@@ -79,6 +81,14 @@
     for (int i=0;i<4; i++)  fNFL[i] = 0;
 
+    fViewconeAngles[0]=0.0;
+    fViewconeAngles[1]=0.0;
+
     fWobbleMode=0;
     fAtmosphericModel=0;
+
+    fNumCT=NumCT;
+    for  (int i=0;i<NumCT;i++)
+      fTelescopes[i]= new MGeomCorsikaCT;
+
 }
 
@@ -109,4 +119,5 @@
 			       const Float_t  catm[5],
 			       const Float_t  nfl[4],
+			       const Float_t  viewcone[2],
 			       const Float_t  wobble,
 			       const Float_t  atmospher
@@ -143,6 +154,23 @@
     for (int i=0; i<4; i++)  fNFL[i] = nfl[i];
 
+    fViewconeAngles[0]=viewcone[0];
+    fViewconeAngles[1]=viewcone[1];
+
     fWobbleMode=wobble;
     fAtmosphericModel=atmospher;
+
+}
+
+// -------------------------------------------------------------------------
+//
+// Fill C Telescope information in Corsika Run Header
+//
+void MMcCorsikaRunHeader::FillCT(Float_t ctx, Float_t cty, Float_t ctz,
+				 Float_t cttheta, Float_t ctphi,
+				 Float_t ctdiam, Float_t ctfocal,
+				 Int_t CTnum){
+
+  static_cast<MGeomCorsikaCT*>(fTelescopes.UncheckedAt(CTnum))
+    ->Fill(ctx, cty, ctz, cttheta, ctphi, ctdiam, ctfocal);
 
 }
@@ -157,3 +185,2 @@
 
 
-
Index: trunk/MagicSoft/include-Classes/MMcFormat/MMcCorsikaRunHeader.h
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/MMcCorsikaRunHeader.h	(revision 2282)
+++ trunk/MagicSoft/include-Classes/MMcFormat/MMcCorsikaRunHeader.h	(revision 2283)
@@ -10,4 +10,9 @@
 #endif
 
+#ifndef ROOT_TObjArray
+#include <TObjArray.h>
+#endif
+
+class MGeomCorsikaCT;
 
 class MMcCorsikaRunHeader : public MParContainer
@@ -43,4 +48,8 @@
     Float_t fNFL[4];
 
+    // (degrees) Inner and outer angles in Corsika's VIEWCONE option
+    Float_t fViewconeAngles[2]; 
+                                  
+
     Float_t fWobbleMode;     // Indicates wobble mode with which
                              //  reflector has been run 
@@ -49,7 +58,10 @@
                                // 1 = atm_90percent, 2 = atm_isothermal,
                                // 3 = atm_corsika.
+    UInt_t fNumCT;
+    TObjArray fTelescopes;
 
 public:
-    MMcCorsikaRunHeader(const char *name=NULL, const char *title=NULL);
+    MMcCorsikaRunHeader(const char *name=NULL, const char *title=NULL,
+			int NumCT=1);
 
     void Fill(const Float_t  runnumber,
@@ -75,4 +87,5 @@
               const Float_t  catm[5],
               const Float_t  nfl[4],
+	      const Float_t  viewcone[2],
 	      const Float_t  wobble,
 	      const Float_t  atmospher
@@ -83,5 +96,10 @@
     Float_t GetSlopeSpec() const { return fSlopeSpec; }
 
-    ClassDef(MMcCorsikaRunHeader, 2) // storage container for corsika setup information
+    void FillCT(Float_t ctx, Float_t cty, Float_t ctz,
+		Float_t cttheta, Float_t ctphi,
+		Float_t ctdiam, Float_t ctfocal,
+		Int_t CTnum);
+
+    ClassDef(MMcCorsikaRunHeader, 3) // storage container for corsika setup information
 };
 #endif
Index: trunk/MagicSoft/include-Classes/MMcFormat/MMcFadcHeader.cxx
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/MMcFadcHeader.cxx	(revision 2282)
+++ trunk/MagicSoft/include-Classes/MMcFormat/MMcFadcHeader.cxx	(revision 2283)
@@ -32,4 +32,6 @@
   fAmplFadc=MFADC_RESPONSE_AMPLITUDE;
   fFwhmFadc=MFADC_RESPONSE_FWHM;
+  fAmplFadcOuter=MFADC_RESPONSE_AMPLITUDE;
+  fFwhmFadcOuter=MFADC_RESPONSE_FWHM;
 
   for(i=0;i<MFADC_CHANNELS;i++){
@@ -53,6 +55,10 @@
   cout << "Monte Carlo Fadc output:" << endl;
   cout << " Shape type of the signal: "       << fFadcShape << endl;
-  cout << " Amplitude of the trigger in mV: " << fAmplFadc << endl;
+  cout << " FADC integral for sphe [counts*ns]: " << fAmplFadc << endl;
   cout << " Width of the signal in nsec: "    << fFwhmFadc << endl;
+  cout << " Outer FADC integral for sphe [counts*ns]: " << fAmplFadcOuter
+       << endl;
+  cout << " Width of the signal in nsec for outer: "    << fFwhmFadcOuter 
+       << endl;
   cout << " Pedestals and ElecNoise in fadc counts: " << endl;
   for (int i=0;i<MFADC_CHANNELS;i++){
Index: trunk/MagicSoft/include-Classes/MMcFormat/MMcFadcHeader.hxx
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/MMcFadcHeader.hxx	(revision 2282)
+++ trunk/MagicSoft/include-Classes/MMcFormat/MMcFadcHeader.hxx	(revision 2283)
@@ -14,6 +14,8 @@
                             // the signal   
                             // = 0 --> a gaussian  
-  Float_t  fAmplFadc    ;   // the amplitude of the trigger in mV
+  Float_t  fAmplFadc    ;   // the integral of sph response [counts*ns]
   Float_t  fFwhmFadc    ;   // the width of the signal in nsec
+  Float_t  fAmplFadcOuter;  // the integral of sph response [counts*ns], outer
+  Float_t  fFwhmFadcOuter;  // the width of the signal in nsec, outer
   Float_t  fPedesMean[MFADC_CHANNELS]    ;  //  The mean value for the pedestal
                                             //  of each pixel (channel)
@@ -21,4 +23,5 @@
                                            //  due to the electronics for
                                            //  each pixel (channel)
+  Float_t fLow2HighGain;    // low gain factor 
 
  public:
@@ -33,10 +36,16 @@
   }
 
-  void SetAmplitud(Float_t amp){
+  void SetLow2High(Float_t l2h){
+    fLow2HighGain=l2h;
+  }
+
+  void SetAmplitud(Float_t amp, Float_t ampout=0.0){
     fAmplFadc=amp;
+    fAmplFadcOuter=ampout;
  }
 
-  void SetFwhm(Float_t fwhm){
+  void SetFwhm(Float_t fwhm, Float_t fwhmout=0.0){
     fFwhmFadc=fwhm;
+    fFwhmFadcOuter=fwhmout;
   }
 
@@ -57,5 +66,5 @@
   UInt_t GetNumPixel() const { return MFADC_CHANNELS; }
 
-  ClassDef(MMcFadcHeader, 1)  //Stores Montecarlo Information describing the FADC behaviour
+  ClassDef(MMcFadcHeader, 2)  //Stores Montecarlo Information describing the FADC behaviour
 
 };
Index: trunk/MagicSoft/include-Classes/MMcFormat/MMcRunHeader.cxx
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/MMcRunHeader.cxx	(revision 2282)
+++ trunk/MagicSoft/include-Classes/MMcFormat/MMcRunHeader.cxx	(revision 2283)
@@ -180,4 +180,5 @@
 			const Float_t  shphimax,
 			const Float_t  shphimin,
+			const Float_t  impactmax,
 			const Float_t  cwavelower,
 			const Float_t  cwaveupper,
@@ -223,4 +224,6 @@
     fShowerPhiMin = shphimin;
 
+    fImpactMax=impactmax;
+
     fCWaveLower = cwavelower;
     fCWaveUpper = cwaveupper;
Index: trunk/MagicSoft/include-Classes/MMcFormat/MMcRunHeader.hxx
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/MMcRunHeader.hxx	(revision 2282)
+++ trunk/MagicSoft/include-Classes/MMcFormat/MMcRunHeader.hxx	(revision 2283)
@@ -33,4 +33,5 @@
   UInt_t  fNumSimulatedShowers; // Number of showers that were simualted
   UInt_t  fNumStoredShowers;    // Number of store showers in this run
+  UInt_t  fNumEvents;           // Number of events in this root file
   
   //  Coordinates of the Starfield
@@ -60,4 +61,7 @@
   Float_t fShowerPhiMax; // [deg] See note in class description.
   Float_t fShowerPhiMin; // [deg] See note in class description.
+
+  //  Maximum impact parameter in the input rfl file
+  Float_t fImpactMax; // [cm] 
 
   UShort_t fCorsikaVersion;
@@ -125,4 +129,5 @@
 	    const Float_t  shphimax,
 	    const Float_t  shphimin,
+	    const Float_t  impactmax,
 	    const Float_t  cwavelower,
 	    const Float_t  cwaveupper,
@@ -146,6 +151,7 @@
   UInt_t   GetCorsikaVersion() const      { return fCorsikaVersion; }
   Bool_t   GetAllEvtsTriggered() const    { return fAllEvtsTriggered ? kTRUE : kFALSE; }
+  Float_t GetImpactMax() const            {return fImpactMax;}
 
-  ClassDef(MMcRunHeader, 3)	// storage container for general run info
+  ClassDef(MMcRunHeader, 4)	// storage container for general run info
 };
 #endif
Index: trunk/MagicSoft/include-Classes/MMcFormat/MTriggerDefine.h
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/MTriggerDefine.h	(revision 2282)
+++ trunk/MagicSoft/include-Classes/MMcFormat/MTriggerDefine.h	(revision 2283)
@@ -4,5 +4,5 @@
 //
 //
-#define TRIGGER_PIXELS        397
+#define TRIGGER_PIXELS        3500
 //
 //      This is the number of Pixels contributing to the TRIGGER logic
Index: trunk/MagicSoft/include-Classes/MMcFormat/Mdefine.h
===================================================================
--- trunk/MagicSoft/include-Classes/MMcFormat/Mdefine.h	(revision 2282)
+++ trunk/MagicSoft/include-Classes/MMcFormat/Mdefine.h	(revision 2283)
@@ -7,5 +7,5 @@
 //     Number of the Pixels in the Camera
 
-#define     CAMERA_PIXELS         577
+#define     CAMERA_PIXELS         3500
 
 //     Number of the Slices of one Fadc. Be carefull this is the number of 
