| # Gaudi Framework, version v20r4
Generated: 8 Jan 2009

# NTupleInfo.h

Go to the documentation of this file.

    00001 #ifdef __cplusplus
    00002
    00003 #ifndef HBOOKCNV_NTUPLEINFO_H
    00004 #define HBOOKCNV_NTUPLEINFO_H 1
    00005
    00006 #include "GaudiKernel/Kernel.h"
    00007
    00008 class NTUPLEINFO   {
    00009 public:
    00010   long    id;
    00011   char    title[128];
    00012   char    rzdir[256];
    00013   long    numEnt;
    00014   long    numVar;
    00015
    00016   //  struct _var   {
    00017     char     name[512][64];
    00018     long     dim[512];
    00019     long     theDim[512][5];
    00020     long     hasIndex[512];
    00021     char     index[512][64];
    00022     char     type[512];
    00023     long     size[512];
    00024     long     hasRange[512];
    00025     long     irange[512][2];
    00026     double   frange[512][2];
    00027     char     block[512][12];
    00028     template <class TYPE>
    00029     void getBounds(long i, TYPE& min, TYPE& max, TYPE& null)  const  {
    00030       if ( hasRange )   {
    00031         min = (type[i]=='R') ? TYPE(frange[i][0]) : TYPE(irange[i][0]);
    00032         max = (type[i]=='R') ? TYPE(frange[i][1]) : TYPE(irange[i][1]);
    00033       }
    00034       else  {
    00035         min = NTuple::Range<TYPE>::min();
    00036         max = NTuple::Range<TYPE>::max();
    00037       }
    00038       null = TYPE(0);
    00039     }
    00040     TEMPLATE_SPECIALIZATION
    00041     void getBounds(long /*i*/, bool& min, bool& max, bool& null )  const  {
    00042       min = null = false;
    00043       max = true;
    00044     }
    00045     template <class TYPE>
    00046     bool isRangeWithin(long i, TYPE min, TYPE max)  const  {
    00047       if ( hasRange[i] )   {
    00048         return min <= (TYPE)irange[i][0] && (TYPE)irange[i][1] <= max;
    00049       }
    00050       else if ( type[i] == 'I' || type[i] == 'U' )   {
    00051         return NTuple::Range<TYPE>::min() <= min && NTuple::Range<TYPE>::max() >= max;
    00052       }
    00053       return false;
    00054     }
    00055     TEMPLATE_SPECIALIZATION
    00056       bool isRangeWithin(long i, float /* min */, float /* max*/ )  const  {
    00057       if ( size[i] == 32 ) return true;
    00058       return false;
    00059     }
    00060     TEMPLATE_SPECIALIZATION
    00061       bool isRangeWithin(long i, double /* min */, double /* max */ )  const  {
    00062       if ( size[i] == 64 ) return true;
    00063       return false;
    00064     }
    00065     TEMPLATE_SPECIALIZATION
    00066     bool isRangeWithin(long /* i */ , bool min, bool max)  const  {
    00067       return min == false && max == true;
    00068     }
    00069     long idist(long i)   const   {
    00070         return irange[i][1] - irange[i][0];
    00071     }
    00072     double fdist(long i)  const    {
    00073         return frange[i][1] - frange[i][0];
    00074     }
    00075   //  } var[512];
    00076
    00077   long getIndex(const char* nam)  const  {
    00078     if ( nam[0] != 0 )   {
    00079       for ( int i = 0; i < numVar; i++ )    {
    00080         if ( strncmp(name[i], nam, sizeof(name[i])) == 0 )   {
    00081           return i;
    00082         }
    00083       }
    00084     }
    00085     return -1;
    00086   }
    00087 };
    00088
    00089 #endif // HBOOKCNV_NTUPLEINFO_H
    00090
    00091 #else
    00092 #ifdef _WIN32
    00093         STRUCTURE /NTUPLEVAR/
    00094           CHARACTER*64 NAME
    00095           INTEGER      NDIM
    00096            INTEGER      THEDIM(5)
    00097           INTEGER      HASINDEX
    00098            CHARACTER*64 INDEX
    00099           CHARACTER*1  TYPE
    00100            INTEGER      SIZE
    00101           INTEGER      HASRANGE
    00102           UNION
    00103             MAP
    00104               INTEGER IMIN, IMAX
    00105             END MAP
    00106             MAP
    00107               REAL*8  FMIN, FMAX
    00108             END MAP
    00109           END UNION
    00110           CHARACTER*12 VBLOCK
    00111         END STRUCTURE
    00112
    00113         STRUCTURE /NTUPLEINFO/
    00114           INTEGER       ID
    00115           CHARACTER*128 TITLE
    00116           INTEGER       NOENT
    00117           INTEGER       NDIM
    00118            RECORD /NTUPLEVAR/ VAR(512)
    00119         END STRUCTURE
    00120 #else
    00121 c        TYPE NTUPLEVAR
    00122           CHARACTER*64 VNAME(512)
    00123           INTEGER      VNDIM(512)
    00124           INTEGER      VTHEDIM(512,5)
    00125           INTEGER      VHASINDEX(512)
    00126           CHARACTER*64 VINDEX(512)
    00127           CHARACTER*1  VTYPE(512)
    00128           INTEGER      VSIZE(512)
    00129           INTEGER      VHASRANGE(512)
    00130 c          UNION
    00131 c            MAP
    00132   INTEGER VIMIN(512), VIMAX(512)
    00133 c            END MAP
    00134 c            MAP
    00135   REAL*8  VFMIN(512), VFMAX(512)
    00136 c            END MAP
    00137 c          END UNION
    00138 c        END TYPE NTUPLEVAR
    00139
    00140 c        TYPE NTUPLEINFO
    00141           INTEGER       NTID
    00142           CHARACTER*128 NTTITLE
    00143           INTEGER       NTNOENT
    00144           INTEGER       NTNDIM
    00145 c          TYPE(NTUPLEVAR) VAR(512)
    00146 c        END TYPE NTUPLEINFO
    00147         CHARACTER*12  VBLOCK(512)
    00148        COMMON/NTUPLEINFO/VNAME,VNDIM,VTHEDIM,
    00149      &  VHASINDEX,VINDEX,VTYPE,VSIZE,
    00150      &  VHASRANGE, VIMIN, VIMAX, VFMIN, VFMAX,
    00151      &  NTID, NTTITLE, NTNDIM, VBLOCK
    00152 #endif
    00153 #endif