Index: /trunk/MagicSoft/Simulation/Detector/include-GENERAL/DllImport.h
===================================================================
--- /trunk/MagicSoft/Simulation/Detector/include-GENERAL/DllImport.h	(revision 293)
+++ /trunk/MagicSoft/Simulation/Detector/include-GENERAL/DllImport.h	(revision 293)
@@ -0,0 +1,24 @@
+
+/*
+  This include file defines DllImport/DllExport macro
+  to build DLLs under Windows OS.
+
+  They are defined as dummy for UNIX's
+*/
+
+#ifndef ROOT_DllImport
+#define ROOT_DllImport
+
+#ifndef __CINT__
+#if defined(WIN32) && defined(_DLL)
+#  define DllImport     __declspec( dllimport )
+#  define DllExport     __declspec( dllexport )
+#else
+#  define DllImport
+#  define DllExport
+#endif
+#  define EXTERN       DllImport extern
+#endif
+
+
+#endif
Index: /trunk/MagicSoft/Simulation/Detector/include-GENERAL/RConfig.h
===================================================================
--- /trunk/MagicSoft/Simulation/Detector/include-GENERAL/RConfig.h	(revision 293)
+++ /trunk/MagicSoft/Simulation/Detector/include-GENERAL/RConfig.h	(revision 293)
@@ -0,0 +1,159 @@
+
+#ifndef ROOT_RConfig
+#define ROOT_RConfig
+
+/*************************************************************************
+ *                                                                       *
+ * RConfig                                                               *
+ *                                                                       *
+ * Defines used by ROOT.                                                 *
+ *                                                                       *
+ *************************************************************************/
+
+/*---- machines --------------------------------------------------------------*/
+
+#ifdef __hpux
+#   define R__HPUX
+#   define R__UNIX
+#   define ANSICPP
+#endif
+
+#ifdef _AIX
+#   define R__AIX
+#   define R__UNIX
+#   define ANSICPP
+#   define NEED_STRCASECMP
+#endif
+
+#ifdef __alpha
+#   define R__ALPHA
+#   define R__UNIX
+#   define ANSICPP
+#   define R__B64
+#   define R__BYTESWAP
+#endif
+
+#ifdef __sun
+#   ifdef __SVR4
+#      define R__SOLARIS
+#      define ANSICPP
+#      ifdef __i386
+#         define R__I386
+#         define R__BYTESWAP
+#      endif
+#   else
+#      define R__SUN
+#      include <stdlib.h>
+#   endif
+#   define R__UNIX
+#   define NEED_STRING
+#   define NEED_SIGJMP
+#endif
+
+#ifdef __sgi
+#   define R__SGI
+#   define R__UNIX
+#   define ANSICPP
+#   define NEED_STRING
+#   define NEED_SIGJMP
+#   ifdef IRIX64
+#     define R__SGI64
+#   endif
+#endif
+
+#if defined(__linux) && !defined(__powerpc)
+#   define R__LINUX
+#   define R__UNIX
+#   define R__BYTESWAP
+#   define NEED_SIGJMP
+#endif
+
+#if defined(__linux) && defined(__powerpc)
+#   define R__MKLINUX
+#   define R__LINUX
+#   define R__UNIX
+#   define NEED_SIGJMP
+#endif
+
+#ifdef __GNUG__
+#   define R__GNU
+#   define ANSICPP
+#endif
+
+#ifdef BORLAND
+#   define MSDOS        /* Windows will always stay MSDOS */
+#   define ANSICPP
+#   define R__INT16
+#   define R__BYTESWAP
+#endif
+
+#ifdef __SC__
+#   define SC
+#   if defined(macintosh)
+#      define R__MAC
+#      define NEED_STRING
+#      define ANSICPP
+#   elif WIN32
+#      define NEED_STRING
+#      define NEED_STRCASECMP
+#      define ANSICPP
+#   else
+#      define MSDOS
+#      define NEED_STRCASECMP
+#   endif
+#endif
+
+#ifdef WIN32
+#   define NEED_STRING
+#   define NEED_STRCASECMP
+#   define ANSICPP
+#   define R__BYTESWAP
+#endif
+
+#ifdef __MWERKS__
+#   define R__MWERKS
+#   define R__MAC
+#   define ANSILIB      /* ANSI C++ Standard Library conformant */
+#   define ANSICPP
+#   define NEED_STRING
+#   define NEED_STRCASECMP
+#endif
+
+
+/*--- memory and object statistics -------------------------------------------*/
+
+/* #define NOSTATS     */
+
+
+/*--- cpp --------------------------------------------------------------------*/
+
+#ifdef ANSICPP
+   /* symbol concatenation operator */
+#   define _NAME1_(name) name
+#   define _NAME2_(name1,name2) name1##name2
+#   define _NAME3_(name1,name2,name3) name1##name2##name3
+
+   /* stringizing */
+#   define _QUOTE_(name) #name
+
+#else
+
+#   define _NAME1_(name) name
+#   define _NAME2_(name1,name2) _NAME1_(name1)name2
+#   define _NAME3_(name1,name2,name3) _NAME2_(name1,name2)name3
+
+#   define _QUOTE_(name) "name"
+
+#endif
+
+
+/*---- misc ------------------------------------------------------------------*/
+
+#ifdef R__GNU
+#   define SafeDelete(p) { if (p) { delete p; p = 0; } }
+#else
+#   define SafeDelete(p) { delete p; p = 0; }
+#endif
+
+#endif
+
Index: /trunk/MagicSoft/Simulation/Detector/include-GENERAL/Rtypes.h
===================================================================
--- /trunk/MagicSoft/Simulation/Detector/include-GENERAL/Rtypes.h	(revision 293)
+++ /trunk/MagicSoft/Simulation/Detector/include-GENERAL/Rtypes.h	(revision 293)
@@ -0,0 +1,151 @@
+
+#ifndef ROOT_Rtypes
+#define ROOT_Rtypes
+
+// Copyright (C) 1994 CodeCERN. All rights reserved.
+
+//////////////////////////////////////////////////////////////////////////
+//                                                                      //
+// Rtypes                                                               //
+//                                                                      //
+// Basic types used by ROOT.                                            //
+//                                                                      //
+//////////////////////////////////////////////////////////////////////////
+
+
+#ifndef ROOT_RConfig
+//*KEEP,RConfig.
+#include "RConfig.h"
+//*KEND.
+#endif
+
+#include <stdio.h>
+
+//*KEEP,DllImport,T=C.
+#include "DllImport.h"
+//*KEND.
+
+//---- types -------------------------------------------------------------------
+
+typedef char           Char_t;      //Signed Character 1 byte
+typedef unsigned char  UChar_t;     //Unsigned Character 1 byte
+typedef short          Short_t;     //Signed Short integer 2 bytes
+typedef unsigned short UShort_t;    //Unsigned Short integer 2 bytes
+#ifdef R__INT16
+typedef long           Int_t;       //Signed integer 4 bytes
+typedef unsigned long  UInt_t;      //Unsigned integer 4 bytes
+#else
+typedef int            Int_t;       //Signed integer 4 bytes
+typedef unsigned int   UInt_t;      //Unsigned integer 4 bytes
+#endif
+#ifdef R__B64
+typedef int            Seek_t;      //File pointer
+typedef long           Long_t;      //Signed long integer 4 bytes
+typedef unsigned long  ULong_t;     //Unsigned long integer 4 bytes
+#else
+typedef int            Seek_t;      //File pointer
+typedef long           Long_t;      //Signed long integer 8 bytes
+typedef unsigned long  ULong_t;     //Unsigned long integer 8 bytes
+#endif
+typedef float          Float_t;     //Float 4 bytes
+typedef double         Double_t;    //Float 8 bytes
+typedef char           Text_t;      //General string
+typedef unsigned char  Bool_t;      //Boolean (0=false, 1=true)
+typedef unsigned char  Byte_t;      //Byte (8 bits)
+typedef short          Version_t;   //Class version identifier
+typedef char           Option_t;    //Option string
+typedef int            Ssiz_t;      //String size
+typedef float          Real_t;      //TVector and TMatrix element type
+
+typedef void         (*VoidFuncPtr_t)();  //pointer to void function
+
+
+//---- constants ---------------------------------------------------------------
+
+#ifndef NULL
+#define NULL 0
+#endif
+
+const Bool_t kTRUE   = 1;
+const Bool_t kFALSE  = 0;
+
+const Int_t  kMaxInt      = 2147483647;
+const Int_t  kMaxShort    = 32767;
+const size_t kBitsPerByte = 8;
+const Ssiz_t kNPOS        = ~(Ssiz_t)0;
+
+
+//--- bit manipulation ---------------------------------------------------------
+
+#define BIT(n)       (1 << (n))
+#define SETBIT(n,i)  ((n) |= BIT(i))
+#define CLRBIT(n,i)  ((n) &= ~BIT(i))
+#define TESTBIT(n,i) ((Bool_t)(((n) & BIT(i)) != 0))
+
+
+//---- debug global ------------------------------------------------------------
+
+EXTERN Bool_t gDebug;
+
+
+//---- ClassDef macros ---------------------------------------------------------
+
+class TClass;
+class TBuffer;
+class TMemberInspector;
+
+extern TClass *CreateClass(const char *cname, Version_t id,
+                           const char *dfil, const char *ifil,
+                           Int_t dl, Int_t il);
+
+#define ClassDef(name,id) \
+private: \
+  static TClass *fgIsA; \
+public: \
+  static const char *DeclFileName() { return __FILE__; } \
+  static int DeclFileLine() { return __LINE__; } \
+  static const char *ImplFileName(); \
+  static int ImplFileLine(); \
+  static Version_t Class_Version() { return id; } \
+  static TClass *Class(); \
+  static void Dictionary(); \
+  virtual TClass *IsA() const { return name::Class(); } \
+  virtual void ShowMembers(TMemberInspector &insp, char *parent); \
+  virtual void Streamer(TBuffer &b); \
+  friend TBuffer &operator>>(TBuffer &buf, name *&obj);
+
+#define _ClassInit_(name) \
+   extern void AddClass(const char *cname, Version_t id, VoidFuncPtr_t dict); \
+   extern void RemoveClass(const char *cname); \
+   class _NAME3_(__,name,Init__) { \
+      public: \
+         _NAME3_(__,name,Init__)() { \
+            AddClass(_QUOTE_(name), name::Class_Version(), \
+                     &name::Dictionary); \
+         } \
+         ~_NAME3_(__,name,Init__)() { \
+            RemoveClass(_QUOTE_(name)); \
+         } \
+   }; \
+   static _NAME3_(__,name,Init__) _NAME3_(__g,name,Init__);
+
+#define _ClassImp_(name) \
+   TClass *name::Class() \
+          { if (!fgIsA) name::Dictionary(); return fgIsA; } \
+   const char *name::ImplFileName() { return __FILE__; } \
+   int name::ImplFileLine() { return __LINE__; } \
+   TClass *name::fgIsA = 0; \
+   _ClassInit_(name)
+
+#define ClassImp(name) \
+   void name::Dictionary() \
+   { \
+      TClass *c = CreateClass(_QUOTE_(name), Class_Version(), \
+                              DeclFileName(), ImplFileName(), \
+                              DeclFileLine(), ImplFileLine()); \
+      fgIsA = c; \
+   } \
+   _ClassImp_(name)
+
+#endif
+
Index: /trunk/MagicSoft/Simulation/Detector/include-GENERAL/jcdebug.h
===================================================================
--- /trunk/MagicSoft/Simulation/Detector/include-GENERAL/jcdebug.h	(revision 293)
+++ /trunk/MagicSoft/Simulation/Detector/include-GENERAL/jcdebug.h	(revision 293)
@@ -0,0 +1,53 @@
+/********************************************************************** 
+ ********************************************************************** 
+ * jcdebug                                                               
+ *                                                                      
+ *   Created: Mon Jan 12 12:36:19 1998
+ *   Author.: Jose Carlos Gonzales
+ *   Notes..: 
+ *                                                                      
+ ********************************************************************** 
+ **********************************************************************/
+
+// @T \newpage
+
+// @section Source code of {\tt jcdebug.h}
+
+/* Begin */
+
+#ifndef __JC_DEBUG__
+#define __JC_DEBUG__
+
+// @code
+
+int DBGi;
+
+#ifdef __DEBUG__
+
+#define DBGvec(a,n,m)    {puts("DBG> vector " #a);\
+               for(DBGi=n;DBGi<=m;DBGi++)\
+                 printf("     " #a "[%d] = %e \012",\
+                    DBGi, (a[DBGi]));\
+                 puts("");}
+
+#define DBG(a)           { printf("DBG> " #a " = %g\n", (a)); }
+#define DBGi(a)          { printf("DBG> " #a " = %d\n", (a)); }
+#define DBGmsg(m)        { puts("DBG> " #m); }
+
+#else // not __DEBUG__
+
+#define DBGvec(a,n,m)    
+#define DBG(a)           
+#define DBGi(a)           
+#define DBGmsg(m)       
+
+#endif // not __DEBUG__
+
+
+#endif // __JC_DEBUG__
+
+// @endcode
+
+/* End */
+
+
Index: /trunk/MagicSoft/Simulation/Detector/include-GENERAL/jcmacros.h
===================================================================
--- /trunk/MagicSoft/Simulation/Detector/include-GENERAL/jcmacros.h	(revision 293)
+++ /trunk/MagicSoft/Simulation/Detector/include-GENERAL/jcmacros.h	(revision 293)
@@ -0,0 +1,58 @@
+/********************************************************************** 
+ ********************************************************************** 
+ * jcmacros                                                               
+ *                                                                      
+ *   Created: Mon Jan 12 10:14:05 1998
+ *   Author.: Jose Carlos Gonzales
+ *   Notes..: 
+ *                                                                      
+ ********************************************************************** 
+ **********************************************************************/
+
+// @T \newpage
+
+// @section Source code of {\tt jcmacros.h}
+
+// @code
+
+/* Begin */
+
+#ifndef __JC_MACROS__
+#define __JC_MACROS__
+
+#define TRUE            1
+#define FALSE           0
+#define YES             1.
+#define NO              0.
+                        
+#define SQR(x)          ((x)*(x))
+#define CUB(x)          ((x)*(x)*(x))
+#define ABS(x)          (((x)<0)? -(x) : (x))
+#define SGN(x)          (((x)>0.)? 1. : -1.)
+#define MAX(a,b)        (((a)>(b))?(a):(b))
+#define MIN(a,b)        (((a)<(b))?(a):(b))
+#define DEG2RAD         (M_PI/180.)
+#define NORM(x)       (sqrt(SQR(x[0])+SQR(x[1])+SQR(x[2]))) /* Norm(vector) */
+#define PROD(x,y)     ((x[0]*y[0])+(x[1]*y[1])+(x[2]*y[2])) /* Direct.Prod. */
+
+#define DEG2RAD       (M_PI/180.)   /* Degrees to Radians conversion factor */
+#define DEG360        (2.*M_PI)                                 /* 2 Pi     */
+#define DEG180        (M_PI)                                    /*   Pi     */
+#define DEG120        (2.*M_PI/3.)                              /* 2 Pi / 3 */
+#define DEG90         (M_PI/2.)                                 /*   Pi / 2 */
+#define DEG60         (M_PI/3.)                                 /*   Pi / 3 */
+#define DEG30         (M_PI/6.)                                 /*   Pi / 6 */
+#define RAD(x)        ((x)*0.0174532925199433)
+#define DEG(x)        ((x)*57.2957795130823)
+
+
+#define RANDOM        ((float)drand48())           /* Uniform random number */
+
+                                       /* Define Null pointer (in fact,     */ 
+#define NIL           (void *)0        /* there is a NULL=(void*)0 defined) */
+
+#endif // __JC_MACROS__
+
+// @endcode
+
+/* End */
Index: /trunk/MagicSoft/Simulation/Detector/include-GENERAL/lagrange.h
===================================================================
--- /trunk/MagicSoft/Simulation/Detector/include-GENERAL/lagrange.h	(revision 293)
+++ /trunk/MagicSoft/Simulation/Detector/include-GENERAL/lagrange.h	(revision 293)
@@ -0,0 +1,76 @@
+/////////////////////////////////////////////////////////////////
+//
+// lagrange
+//_______________________________________________________________
+//
+//  Created: Sun Jun 14 14:10:18 MET DST 1998
+//  Author:  Jose Carlos Gonzales
+//  Purpose: Macro for Lagrange interpolation of 3rd. order
+//  Notes:   
+//  
+/////////////////////////////////////////////////////////////////
+
+
+// @T \newpage
+
+// @section Source code of {\tt lagrange.h}
+
+// @code
+
+//++
+// Formula for Lagrange interpolation of 3rd. order
+// x: value to be interpolated
+// t: table(2xN), table[0]: abscissas, table[1]: ordinates
+// n: higher value of abscissas, such that t[0][n] <= x
+//--
+
+#define Lagrange(t,n,x)   ((t[1][ (n) ]*((x-t[0][(n)+1])*(x-t[0][(n)+2]))/ \
+                ((t[0][ (n) ]-t[0][(n)+1])*(t[0][ (n) ]-t[0][(n)+2])))+ \
+               (t[1][(n)+1]*((x-t[0][ (n) ])*(x-t[0][(n)+2]))/ \
+                ((t[0][(n)+1]-t[0][ (n) ])*(t[0][(n)+1]-t[0][(n)+2])))+ \
+               (t[1][(n)+2]*((x-t[0][ (n) ])*(x-t[0][(n)+1]))/ \
+                ((t[0][(n)+2]-t[0][ (n) ])*(t[0][(n)+2]-t[0][(n)+1]))) \
+               )                             
+  
+//++
+// Macro to find, and save in variable "m", the value of 
+// "n" to be used in the "Lagrange{t,n,x)" macro
+//--
+
+#define FindLagrange(t,m,x)  {m = 0; while (t[0][++m] < x);} --m
+
+// @endcode
+
+// @subsection Sample program 
+
+// @code
+
+//////////////////////////////////////////////////////////////////////////////
+// Here follows a sample program using this two macros
+//////////////////////////////////////////////////////////////////////////////
+// #include <iostream.h>
+// #include "lagrange.h"
+// 
+// void main(void)
+// {
+//   float data[2][20];
+//   int i, number;
+//   float x, y;
+// 
+//   for (i=0; i<20; ++i) {
+//     data[0][i] = i*10.;
+//     data[1][i] = 3.0*data[0][i]*data[0][i];
+//     cout << data[0][i] << ' ' << data[1][i] << '\n';
+//   }
+// 
+//   while (1==1) {
+//     cout << "Enter x = ";
+//     cin >> x;
+//     FindLagrange(data,number,x);
+//     y = Lagrange(data,number,x);
+//     cout << x << ' ' << y << '\n';
+//   }
+// }
+//////////////////////////////////////////////////////////////////////////////   
+
+// @endcode
Index: /trunk/MagicSoft/Simulation/Detector/include-GENERAL/ranlib.h
===================================================================
--- /trunk/MagicSoft/Simulation/Detector/include-GENERAL/ranlib.h	(revision 293)
+++ /trunk/MagicSoft/Simulation/Detector/include-GENERAL/ranlib.h	(revision 293)
@@ -0,0 +1,33 @@
+/* Prototypes for all user accessible RANLIB routines */
+
+extern void advnst(long k);
+extern float genbet(float aa,float bb);
+extern float genchi(float df);
+extern float genexp(float av);
+extern float genf(float dfn, float dfd);
+extern float gengam(float a,float r);
+extern void genmn(float *parm,float *x,float *work);
+extern void genmul(long n,float *p,long ncat,long *ix);
+extern float gennch(float df,float xnonc);
+extern float gennf(float dfn, float dfd, float xnonc);
+extern float gennor(float av,float sd);
+extern void genprm(long *iarray,int larray);
+extern float genunf(float low,float high);
+extern void getsd(long *iseed1,long *iseed2);
+extern void gscgn(long getset,long *g);
+extern long ignbin(long n,float pp);
+extern long ignnbn(long n,float p);
+extern long ignlgi(void);
+extern long ignpoi(float mu);
+extern long ignuin(long low,long high);
+extern void initgn(long isdtyp);
+extern long mltmod(long a,long s,long m);
+extern void phrtsd(char* phrase,long* seed1,long* seed2);
+extern float ranf(void);
+extern void setall(long iseed1,long iseed2);
+extern void setant(long qvalue);
+extern void setgmn(float *meanv,float *covm,long p,float *parm);
+extern void setsd(long iseed1,long iseed2);
+extern float sexpo(void);
+extern float sgamma(float a);
+extern float snorm(void);
