| # Gaudi Framework, version v20r3
Generated: 24 Nov 2008

# 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 #include "GaudiKernel/NTuple.h"
    00008
    00009 class NTUPLEINFO   {
    00010 public:
    00011   long    id;
    00012   char    title[128];
    00013   char    rzdir[256];
    00014   long    numEnt;
    00015   long    numVar;
    00016   char    block[32];
    00017
    00018   //  struct _var   {
    00019     char     name[512][64];
    00020     long     dim[512];
    00021     long     theDim[512][5];
    00022     long     hasIndex[512];
    00023     char     index[512][64];
    00024     char     type[512];
    00025     long     size[512];
    00026     long     hasRange[512];
    00027     long     irange[512][2];
    00028     double   frange[512][2];
    00029     template <class TYPE>
    00030     void getBounds(long i, TYPE& min, TYPE& max, TYPE& null)  const  {
    00031       if ( hasRange )   {
    00032         min = (type[i]=='R') ? TYPE(frange[i][0]) : TYPE(irange[i][0]);
    00033         max = (type[i]=='R') ? TYPE(frange[i][1]) : TYPE(irange[i][1]);
    00034       }
    00035       else  {
    00036         min = NTuple::Range<TYPE>::min();
    00037         max = NTuple::Range<TYPE>::max();
    00038       }
    00039       null = TYPE(0);
    00040     }
    00041     TEMPLATE_SPECIALIZATION
    00042     void getBounds(long /*i*/, bool& min, bool& max, bool& null )  const  {
    00043       min = null = false;
    00044       max = true;
    00045     }
    00046     template <class TYPE>
    00047     bool isRangeWithin(long i, TYPE min, TYPE max)  const  {
    00048       if ( hasRange[i] )   {
    00049         return min <= (TYPE)irange[i][0] && (TYPE)irange[i][1] <= max;
    00050       }
    00051       else if ( type[i] == 'I' || type[i] == 'U' )   {
    00052         return NTuple::Range<TYPE>::min() <= min && NTuple::Range<TYPE>::max() >= max;
    00053       }
    00054       return false;
    00055     }
    00056     TEMPLATE_SPECIALIZATION
    00057       bool isRangeWithin(long i, float /* min */, float /* max*/ )  const  {
    00058       if ( size[i] == 32 ) return true;
    00059       return false;
    00060     }
    00061     TEMPLATE_SPECIALIZATION
    00062       bool isRangeWithin(long i, double /* min */, double /* max */ )  const  {
    00063       if ( size[i] == 64 ) return true;
    00064       return false;
    00065     }
    00066    TEMPLATE_SPECIALIZATION
    00067     bool isRangeWithin(long /* i */ , bool min, bool max)  const  {
    00068       return min == false && max == true;
    00069     }
    00070     long idist(long i)   const   {
    00071         return irange[i][1] - irange[i][0];
    00072     }
    00073     double fdist(long i)  const    {
    00074         return frange[i][1] - frange[i][0];
    00075     }
    00076   //  } var[512];
    00077
    00078   long getIndex(const char* nam)  const  {
    00079     if ( nam[0] != 0 )   {
    00080       for ( int i = 0; i < numVar; i++ )    {
    00081         if ( strncmp(name[i], nam, sizeof(name[i])) == 0 )   {
    00082           return i;
    00083         }
    00084       }
    00085     }
    00086     return -1;
    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         END STRUCTURE
    00111
    00112         STRUCTURE /NTUPLEINFO/
    00113           INTEGER       ID
    00114           CHARACTER*128 TITLE
    00115           INTEGER       NOENT
    00116           INTEGER       NDIM
    00117            CHARACTER*8   BLOCK
    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           CHARACTER*8   NTBLOCK
    00146 c          TYPE(NTUPLEVAR) VAR(512)
    00147 c        END TYPE NTUPLEINFO
    00148        COMMON/NTUPLEINFO/VNAME,VNDIM,VTHEDIM,
    00149      &  VHASINDEX,VINDEX,VTYPE,VSIZE,
    00150      &  VHASRANGE, VIMIN, VIMAX, VFMIN, VFMAX,
    00151      &  NTID, NTTITLE, NTNDIM, NTBLOCK
    00152 #endif
    00153 #endif