| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- File List
- File Members

# NTupleInterface.cpp

Go to the documentation of this file.

    00001 #include "GaudiKernel/NTuple.h"
    00002 #include "HbookDef.h"
    00003 #include "NTupleInfo.h"
    00004
    00005 #ifdef _WIN32
    00006 extern"C" {
    00007  long HBOOK_CALL_TYPE RWNTBOOK( const long& id,
    00008                                 const long& dim,
    00009                                 const char tag[512][64], long,
    00010                                 const char* rzdir, long,
    00011                                 const char* title, long);
    00012  long HBOOK_CALL_TYPE RWNTINFO( const long& id,
    00013                                 long& dim,
    00014                                 long& ents,
    00015                                 char tags[512][64], long,
    00016                                 double range[512][2],
    00017                                 char title[], long);
    00018  long HBOOK_CALL_TYPE CWNTBOOK( const long& id,
    00019                                 const char title[], long,
    00020                                 const char opt[], long);
    00021  long HBOOK_CALL_TYPE CWNTINFO( const long& id,
    00022                                 char name[512][64], long,
    00023                                 long dim[],
    00024                                 long theDim[512][5],
    00025                                 long hasIndex[],
    00026                                 char index[512][64], long,
    00027                                 char type[], long,
    00028                                 long size[],
    00029                                 long hasRange[],
    00030                                 long irange[512][2],
    00031                                 double frange[512][2],
    00032                                 char title[], long,
    00033                                 long& numVar,
    00034                                 long& numEnt,
    00035                                 char block[512][12], long);
    00036   void HBOOK_CALL_TYPE HBNAME  (const long& id,
    00037         const char* title, int,
    00038         const void* opt,
    00039         const char* form, int);
    00040
    00041   void HBOOK_CALL_TYPE HROPEN  (const long& lun,
    00042         const char*, int,
    00043         const char*, int,
    00044         const char*, int,
    00045         long&, long&);
    00046   void HBOOK_CALL_TYPE HLNEXT  (long& id,
    00047         char*, int,
    00048         char*, int,
    00049         const char*, int);
    00050   void HBOOK_CALL_TYPE HLDIR   (const char*, int,
    00051         const char*, int);
    00052   void HBOOK_CALL_TYPE HCDIR(const char*, int, const char*, int);
    00053   void HBOOK_CALL_TYPE HMDIR(const char*, int, const char*, int);
    00054 }
    00055
    00056 long RWNT_BOOK ( const NTUPLEINFO& i )  {
    00057   return ::RWNTBOOK(i.id,
    00058         i.numVar,
    00059         i.name, sizeof(i.name[0]),
    00060         i.rzdir, strlen(i.rzdir),
    00061         i.title, strlen(i.title));
    00062 }
    00063
    00064 long RWNT_INFO ( NTUPLEINFO& i ) {
    00065   long r=::RWNTINFO(i.id, i.numVar, i.numEnt, i.name, sizeof(i.name[0]), i.frange, i.title, sizeof(i.title));
    00066   for ( long j = 0; j < i.numVar; j++ )   {
    00067     i.size[j] = sizeof(float)*CHAR_BIT;
    00068     i.dim[j] = 0;
    00069     i.hasRange[j] = 0;
    00070     i.hasIndex[j] = 0;
    00071   }
    00072   memset(i.block,0,sizeof(i.block));
    00073   return r;
    00074 }
    00075
    00076 long CWNT_BOOK ( const NTUPLEINFO& i )  {
    00077   return ::CWNTBOOK(i.id, i.title, strlen(i.title)," ", 1);
    00078 }
    00079
    00080 long CWNT_INFO ( NTUPLEINFO& i ) {
    00081   long r=::CWNTINFO(i.id,
    00082                     i.name, sizeof(i.name[0]),
    00083                     i.dim,
    00084                     i.theDim,
    00085                     i.hasIndex,
    00086                     i.index, sizeof(i.index[0]),
    00087                     i.type, 1,
    00088                     i.size,
    00089                     i.hasRange,
    00090                     i.irange,
    00091                     i.frange,
    00092                     i.title,sizeof(i.title)-1,
    00093                     i.numVar,
    00094                     i.numEnt,
    00095                     i.block,sizeof(i.block[0])
    00096                     );
    00097   // Clean up ntuple block names
    00098   for (long iv=0; iv<i.numVar; ++iv) {
    00099     std::string blk = i.block[iv];
    00100     blk = blk.substr(0,8);
    00101     int ibs;
    00102     if ( (ibs = blk.find(" ")) >= 0 ) {
    00103       blk = blk.substr(0,ibs);
    00104     }
    00105     strcpy(i.block[iv],blk.c_str());
    00106   }
    00107   //  cleanForString(i.block, sizeof(i.block)-1);
    00108   cleanForString(i.title, sizeof(i.title)-1);
    00109   return r;
    00110 }
    00111
    00112 void HLNEXT(long& id, std::string& a, std::string& b, const std::string& c) {
    00113   char buff[256], typ[2] = {0,0};
    00114   memset(buff,0,sizeof(buff));
    00115   ::HLNEXT(id, typ, sizeof(typ)-1, buff, sizeof(buff), c.data(), c.length());
    00116   buff[sizeof(buff)-1] = 0;
    00117   cleanForString(buff, sizeof(buff)-1);
    00118   b = buff;
    00119   a = typ;
    00120 }
    00121
    00122 void HCDIR(const std::string& a, const std::string& b )  {
    00123   ::HCDIR(a.data(), a.length(), b.data(), b.length());
    00124 }
    00125
    00126 void HLDIR(const std::string& a, const std::string& b )  {
    00127   ::HLDIR(a.data(), a.length(), b.data(), b.length());
    00128 }
    00129
    00130 void HMDIR(const std::string& a, const std::string& b )  {
    00131   ::HMDIR(a.data(), a.length(), b.data(), b.length());
    00132 }
    00133
    00134 void HBNAME (const long& id, const std::string& a, const void* opt, const std::string& b) {
    00135   ::HBNAME(id, a.data(), a.length(), opt, b.data(), b.length());
    00136 }
    00137
    00138 void HROPEN(const long& lun, const std::string& a, const std::string& b, const std::string& c, long& i, long& j) {
    00139   ::HROPEN(lun, a.data(), a.length(), b.data(), b.length(), c.data(), c.length(), i, j);
    00140 }
    00141
    00142 #else
    00143 extern"C" {
    00144  long HBOOK_CALL_TYPE rwntbook_(const long& id,
    00145                                 const long& dim,
    00146                                 const char tag[512][64],
    00147                                 const char* rzdir,
    00148                                 const char* title, long, long, long);
    00149  long HBOOK_CALL_TYPE rwntinfo_(const long& id,
    00150                                 long& dim,
    00151                                 long& ents,
    00152                                 char tags[512][64],
    00153                                 double range[512][2],
    00154                                 char title[], long, long);
    00155  long HBOOK_CALL_TYPE cwntbook_(const long& id,
    00156                                 const char title[],
    00157                                 const char opt[], long, long);
    00158  long HBOOK_CALL_TYPE cwntinfo_(const long& id,
    00159                                 char name[512][64],
    00160                                 long dim[],
    00161                                 long theDim[512][5],
    00162                                 long hasIndex[],
    00163                                 char index[512][64],
    00164                                 char type[],
    00165                                 long size[],
    00166                                 long hasRange[],
    00167                                 long irange[512][2],
    00168                                 double frange[512][2],
    00169                                 char title[],
    00170                                 long& numVar,
    00171                                 long& numEnt,
    00172                                 char block[512][12],
    00173                                 long, long, long, long, long, long);
    00174   void HBOOK_CALL_TYPE hlnext_(long& id, char*, char*, const char*, int, int, int);
    00175   void hbname_ (const long& id, const char* title, const void* opt, const char* form, int, int);
    00176   void hropen_(const long&, const char*, const char*, const char*, long&, long&, int,int,int);
    00177   void hcdir_(const char*, const char*, int, int);
    00178   void hldir_(const char*, const char*, int, int);
    00179   void hmdir_(const char*, const char*, int, int);
    00180 }
    00181
    00182 long RWNT_BOOK(const NTUPLEINFO& i)  {
    00183   return rwntbook_(i.id,
    00184        i.numVar,
    00185        i.name,
    00186        i.rzdir,
    00187        i.title,
    00188        sizeof(i.name[0]), strlen(i.rzdir), strlen(i.title));
    00189 }
    00190
    00191 long RWNT_INFO(NTUPLEINFO& i) {
    00192   long r = rwntinfo_(i.id,
    00193          i.numVar,
    00194          i.numEnt,
    00195          i.name,
    00196          i.frange,
    00197          i.title,
    00198          sizeof(i.name[0]), sizeof(i.title));
    00199   for ( long j = 0; j < i.numVar; j++ )   {
    00200     i.size[j] = sizeof(float)*CHAR_BIT;
    00201     i.dim[j] = 0;
    00202     i.hasRange[j] = 0;
    00203     i.hasIndex[j] = 0;
    00204   }
    00205   memset(i.block,0,sizeof(i.block));
    00206   return r;
    00207 }
    00208
    00209 long CWNT_BOOK(const NTUPLEINFO& i)  {
    00210   return cwntbook_(i.id, i.title, " ", strlen(i.title), 1);
    00211 }
    00212
    00213 long CWNT_INFO(NTUPLEINFO& i) {
    00214   long r = cwntinfo_(i.id,
    00215                      i.name,
    00216                      i.dim,
    00217                      i.theDim,
    00218                      i.hasIndex,
    00219                      i.index,
    00220                      i.type,
    00221                      i.size,
    00222                      i.hasRange,
    00223                      i.irange,
    00224                      i.frange,
    00225                      i.title,
    00226                      i.numVar,
    00227                      i.numEnt,
    00228                      i.block,
    00229                      sizeof(i.name[0]), sizeof(i.index[0]), 1,
    00230                      sizeof(i.title)-1,
    00231                      sizeof(i.block[0]),sizeof(i.index[0])
    00232                      );
    00233
    00234   // Clean up ntuple block names
    00235   for (long iv=0; iv<i.numVar; ++iv) {
    00236     std::string blk = i.block[iv];
    00237     blk = blk.substr(0,8);
    00238     int ibs;
    00239     if ( (ibs = blk.find(" ")) >= 0 ) {
    00240       blk = blk.substr(0,ibs);
    00241     }
    00242     strcpy(i.block[iv],blk.c_str());
    00243   }
    00244
    00245   cleanForString(i.title, sizeof(i.title)-1);
    00246   return r;
    00247 }
    00248
    00249 void HLNEXT(long& id, std::string& a, std::string& b, const std::string& c) {
    00250   char buff[256], typ[2] = {0,0};
    00251   memset(buff,0,sizeof(buff));
    00252   hlnext_(id, typ, buff, c.c_str(), sizeof(typ)-1, sizeof(buff), c.length());
    00253   buff[sizeof(buff)-1] = 0;
    00254   cleanForString(buff, sizeof(buff)-1);
    00255   b = buff;
    00256   a = typ;
    00257 }
    00258
    00259 void HCDIR(const std::string& a, const std::string& b )  {
    00260   hcdir_(a.c_str(), b.c_str(), a.length(), b.length());
    00261 }
    00262 void HLDIR(const std::string& a, const std::string& b )  {
    00263   hldir_(a.c_str(), b.c_str(), a.length(), b.length());
    00264 }
    00265 void HMDIR(const std::string& a, const std::string& b )  {
    00266   hmdir_(a.c_str(), b.c_str(), a.length(), b.length());
    00267 }
    00268 void HBNAME (const long& id, const std::string& a, const void* opt, const std::string& b) {
    00269   hbname_(id, a.c_str(), opt, b.c_str(), a.length(), b.length());
    00270 }
    00271 void HROPEN(const long& lun, const std::string& a, const std::string& b, const std::string& c, long& i, long& j) {
    00272   hropen_(lun, a.c_str(), b.c_str(), c.c_str(), i, j, a.length(), b.length(), c.length());
    00273 }
    00274 #endif