ROOT logo
// @(#)root/hbook:$Id$
// Author: Rene Brun   18/02/2002

/*************************************************************************
 * Copyright (C) 1995-2002, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

////////////////////////////////////////////////////////////////////////
//  This class is an interface to the Hbook objects in Hbook files
//  Any Hbook object (1-D, 2-D, Profile, RWN or CWN can be read
//  NB: a THbookFile can only be used in READ mode
//      Use the utility in $ROOTSYS/bin/h2root to convert Hbook to Root
//
// Example of use:
//  gSystem->Load("libHbook");
//  THbookFile f("myfile.hbook");
//  f.ls();
//  TH1F *h1 = (TH1F*)f.Get(1);  //import histogram ID=1 in h1
//  h1->Fit("gaus");
//  THbookTree *T = (THbookTree*)f.Get(111); //import ntuple header
//  T->Print();  //show the Hbook ntuple variables
//  T->Draw("x","y<0"); // as in normal TTree::Draw
//
//  THbookFile can be browsed via TBrowser.
//
////////////////////////////////////////////////////////////////////////

#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#include "TROOT.h"
#include "THbookFile.h"
#include "TH2.h"
#include "THbookTree.h"
#include "THbookBranch.h"
#include "THbookKey.h"
#include "TGraph.h"
#include "TProfile.h"
#include "TTreeFormula.h"
#include "TLeafI.h"
#include "TBrowser.h"
#include "TSystem.h"
#include "TMath.h"

#define PAWC_SIZE 4000000

//  Define the names of the Fortran common blocks for the different OSs

#ifndef WIN32
#  define pawc pawc_
#  define quest quest_
#  define hcbits hcbits_
#  define hcbook hcbook_
#  define rzcl rzcl_
int pawc[PAWC_SIZE];
int quest[112];
int hcbits[48];
int hcbook[64];
int rzcl[16];
#else
#  define pawc   PAWC
#  define quest  QUEST
#  define hcbits HCBITS
#  define hcbook HCBOOK
#  define rzcl   RZCL
extern "C" int pawc[PAWC_SIZE];
extern "C" int quest[100];
extern "C" int hcbits[37];
extern "C" int hcbook[51];
extern "C" int rzcl[11];
#endif

int *iq, *lq;
float *q;
char idname[128];
int nentries;
char chtitl[128];
int ncx,ncy,nwt,idb;
int lcont, lcid, lcdir, ltab;
float xmin,xmax,ymin,ymax;
const Int_t kNRH  = 6;
const Int_t kMIN1 = 7;
const Int_t kMAX1 = 8;

static Int_t gLastEntry = -1;

//  Define the names of the Fortran subroutine and functions for the different OSs

#ifndef WIN32
# define hlimit  hlimit_
# define hldir   hldir_
# define hropen  hropen_
# define hrend   hrend_
# define hrin    hrin_
# define hnoent  hnoent_
# define hgive   hgive_
# define hgiven  hgiven_
# define hgnpar  hgnpar_
# define hgnf    hgnf_
# define hgnt    hgnt_
# define hgntf   hgntf_
# define hgnt1   hgnt1_
# define rzink   rzink_
# define hdcofl  hdcofl_
# define hmaxim  hmaxim_
# define hminim  hminim_
# define hdelet  hdelet_
# define hntvar2 hntvar2_
# define hntvar3 hntvar3_
# define hbname  hbname_
# define hbnamc  hbnamc_
# define hbnam   hbnam_
# define hi      hi_
# define hie     hie_
# define hif     hif_
# define hij     hij_
# define hix     hix_
# define hijxy   hijxy_
# define hije    hije_
# define hcdir   hcdir_

# define type_of_call
# define DEFCHAR  const char*
# define PASSCHAR(string) string
#else
# define hlimit  HLIMIT
# define hldir   HLDIR
# define hropen  HROPEN
# define hrend   HREND
# define hrin    HRIN
# define hnoent  HNOENT
# define hgive   HGIVE
# define hgiven  HGIVEN
# define hgnpar  HGNPAR
# define hgnf    HGNF
# define hgnt    HGNT
# define hgntf   HGNTF
# define hgnt1   HGNT1
# define rzink   RZINK
# define hdcofl  HDCOFL
# define hmaxim  HMAXIM
# define hminim  HMINIM
# define hdelet  HDELET
# define hntvar2 HNTVAR2
# define hntvar3 HNTVAR3
# define hbname  HBNAME
# define hbnamc  HBNAMC
# define hbnam   HBNAM
# define hi      HI
# define hie     HIE
# define hif     HIF
# define hij     HIJ
# define hix     HIX
# define hijxy   HIJXY
# define hije    HIJE
# define hcdir   HCDIR
# define type_of_call  _stdcall
# define DEFCHAR  const char*, const int
# define PASSCHAR(string) string, strlen(string)
#endif

extern "C" void  type_of_call hlimit(const int&);
#ifndef WIN32
extern "C" void  type_of_call hropen(const int&,DEFCHAR,DEFCHAR,DEFCHAR,
                        const int&,const int&,const int,const int,const int);
extern "C" void  type_of_call hrend(DEFCHAR,const int);
#else
extern "C" void  type_of_call hropen(const int&,DEFCHAR,DEFCHAR,DEFCHAR,
                        const int&,const int&);
extern "C" void  type_of_call hrend(DEFCHAR);
#endif

extern "C" void  type_of_call hrin(const int&,const int&,const int&);
extern "C" void  type_of_call hnoent(const int&,const int&);
#ifndef WIN32
extern "C" void  type_of_call hgive(const int&,DEFCHAR,const int&,const float&,const float&,
   const int&,const float&,const float&,const int&,const int&,const int);
#else
extern "C" void  type_of_call hgive(const int&,DEFCHAR,const int&,const float&,const float&,
   const int&,const float&,const float&,const int&,const int&);
#endif

  //SUBROUTINE HGNT1(IDD,BLKNA1,VAR,IOFFST,NVAR,IDNEVT,IERROR)
#ifndef WIN32
extern "C" void  type_of_call hgiven(const int&,DEFCHAR,const int&,DEFCHAR,
   const float&,const float&,const int,const int);
extern "C" void  type_of_call hgnt1(const int&,DEFCHAR,DEFCHAR,const int&,const int&,const int&,const int&,const int,const int);
#else
extern "C" void  type_of_call hgiven(const int&,DEFCHAR,const int&,DEFCHAR,
   const float&,const float&);
extern "C" void  type_of_call hgnt1(const int&,DEFCHAR,DEFCHAR,const int&,const int&,const int&,const int&);
#endif

#ifndef WIN32
extern "C" void  type_of_call hntvar2(const int&,const int&,DEFCHAR,DEFCHAR,DEFCHAR,int&,int&,int&,int&,int&,const int,const int, const int);
extern "C" void  type_of_call hntvar3(const int&,const int&,DEFCHAR, const int);
#else
extern "C" void  type_of_call hntvar2(const int&,const int&,DEFCHAR,DEFCHAR,DEFCHAR,int&,int&,int&,int&,int&);
extern "C" void  type_of_call hntvar3(const int&,const int&,DEFCHAR);
#endif

#ifndef WIN32
extern "C" void  type_of_call hbnam(const int&,DEFCHAR,const int&,DEFCHAR,const int&,const int, const int);
#else
extern "C" void  type_of_call hbnam(const int&,DEFCHAR,const int&,DEFCHAR,const int&);
#endif

extern "C" void  type_of_call hgnpar(const int&,const char *,const int);
extern "C" void  type_of_call hgnf(const int&,const int&,const float&,const int&);
extern "C" void  type_of_call hgnt(const int&,const int&,const int&);
extern "C" void  type_of_call hgntf(const int&,const int&,const int&);
extern "C" void  type_of_call rzink(const int&,const int&,const char *,const int);
extern "C" void  type_of_call hdcofl();
extern "C" void  type_of_call hmaxim(const int&,const float&);
extern "C" void  type_of_call hminim(const int&,const float&);
extern "C" void  type_of_call hdelet(const int&);
extern "C" float type_of_call hi(const int&,const int&);
extern "C" float type_of_call hie(const int&,const int&);
extern "C" float type_of_call hif(const int&,const int&);
extern "C" float type_of_call hij(const int&,const int&,const int&);
extern "C" void  type_of_call hix(const int&,const int&,const float&);
extern "C" void  type_of_call hijxy(const int&,const int&,const int&,const float&,const float&);
extern "C" float type_of_call hije(const int&,const int&,const int&);
#ifndef WIN32
extern "C" void  type_of_call hcdir(DEFCHAR,DEFCHAR ,const int,const int);
extern "C" void  type_of_call hldir(DEFCHAR,DEFCHAR ,const int,const int);
#else
extern "C" void  type_of_call hcdir(DEFCHAR,DEFCHAR);
extern "C" void  type_of_call hldir(DEFCHAR,DEFCHAR);
#endif

Bool_t THbookFile::fgPawInit = kFALSE;
Int_t  *THbookFile::fgLuns   = 0;

ClassImp(THbookFile)

//______________________________________________________________________________
THbookFile::THbookFile() : TNamed(),fLun(0),fLrecl(0)
{
   //the constructor
   fList = new TList();
   fKeys = new TList();
}

//_____________________________________________________________________________
THbookFile::THbookFile(const char *fname, Int_t lrecl)
           :TNamed(fname,"")
{
//  Constructor for an HBook file object

   // Initialize the Hbook/Zebra store
   Int_t i;
   if (!fgPawInit) {
      fgPawInit = kTRUE;
      lq = &pawc[9];
      iq = &pawc[17];
      void *qq = iq;
      q = (float*)qq;
      int pawc_size = PAWC_SIZE;
      hlimit(pawc_size);
      fgLuns = new Int_t[10];
      for (i=0;i<10;i++) fgLuns[i] = 0;
   }

   //find a free logical unit (max 10)
   fLun = 0;
   for (i=0;i<10;i++) {
      if (fgLuns[i] == 0) {
         fLun = 10+i;
         fgLuns[i] = 1;
         break;
      }
   }
   if (fLun == 0) {
      Error("THbookFile","Too many HbookFiles\n");
      return;
   }
   char topdir[20];
   snprintf(topdir,19,"lun%d",fLun);

   Int_t ier = 0;
#ifndef WIN32
   hropen(fLun,PASSCHAR(topdir),PASSCHAR(fname),PASSCHAR("p"),lrecl,ier,strlen(topdir),strlen(fname),1);
#else
   hropen(fLun,PASSCHAR(topdir),PASSCHAR(fname),PASSCHAR("p"),lrecl,ier);
#endif
   fLrecl = lrecl;
   SetTitle(topdir);
   snprintf(topdir,19,"//lun%d",fLun);
   fCurDir = topdir;

   if (ier) printf (" Error on hropen was %d \n", ier);
   if (quest[0]) {
      printf("Error cannot open input file: %s\n",fname);
   }
   if (ier || quest[0]) {
      fgLuns[fLun-10]=0; 
      fLun  = 0;
      fList = 0;
      fKeys = 0;
      MakeZombie();
      return;
   }

   gROOT->GetListOfBrowsables()->Add(this,fname);

   fList = new TList();
   fKeys = new TList();
   for (Int_t key=1;key<1000000;key++) {
      int z0 = 0;
      rzink(key,z0,"S",1);
      if (quest[0]) break;
      if (quest[13] & 8) continue;
      Int_t id = quest[20];
      THbookKey *akey = new THbookKey(id,this);
      fKeys->Add(akey);
   }
}

//______________________________________________________________________________
THbookFile::~THbookFile()
{
   //destructor
   if (!fList) return;
   Close();
   delete fList;
   delete fKeys;
}

//______________________________________________________________________________
void THbookFile::Browse(TBrowser *b)
{
// to be implemented

   if( b ) {
      b->Add(fList, "memory");
      b->Add(fKeys, "IDs on disk");
   }
   cd();
}

//______________________________________________________________________________
Bool_t THbookFile::cd(const char *dirname)
{
// change directory to dirname

   Int_t nch = strlen(dirname);
   if (nch == 0) {
#ifndef WIN32
      hcdir(PASSCHAR(fCurDir.Data()),PASSCHAR(" "),fCurDir.Length(),1);
#else
      hcdir(PASSCHAR(fCurDir.Data()),PASSCHAR(" "));
#endif
      return kTRUE;
   }

   char cdir[512];
   Int_t i;
   for (i=0;i<512;i++) cdir[i] = ' ';
   cdir[511] = 0;
#ifndef WIN32
   hcdir(PASSCHAR(dirname),PASSCHAR(" "),nch,1);
   hcdir(PASSCHAR(cdir),PASSCHAR("R"),511,1);
#else
   hcdir(PASSCHAR(dirname),PASSCHAR(" "));
   hcdir(PASSCHAR(cdir),PASSCHAR("R"));
#endif
   for (i=510;i>=0;i--) {
      if (cdir[i] != ' ') break;
      cdir[i] = 0;
   }
   fCurDir = cdir;
   printf("fCurdir=%s\n",fCurDir.Data());

   return kTRUE;
}

//______________________________________________________________________________
void THbookFile::Close(Option_t *)
{
// Close the Hbook file

   if(!IsOpen()) return;
   if (!fList) return;
   
   gROOT->GetListOfBrowsables()->Remove(this);

   cd();

   fList->Delete();
   fKeys->Delete();
   if (fgLuns) fgLuns[fLun-10] = 0;
   hdelet(0);
#ifndef WIN32
   hrend(PASSCHAR(GetTitle()),strlen(GetTitle()));
#else
   hrend(PASSCHAR(GetTitle()));
#endif
}

//______________________________________________________________________________
void THbookFile::DeleteID(Int_t id)
{
   //remove id from file and memory
   hdelet(id);
}

//______________________________________________________________________________
TObject *THbookFile::FindObject(const char *name) const
{
// return object with name in fList in memory
   return fList->FindObject(name);
}

//______________________________________________________________________________
TObject *THbookFile::FindObject(const TObject *obj) const
{
// return object with pointer obj in fList in memory
   return fList->FindObject(obj);
}

//______________________________________________________________________________
TObject *THbookFile::Get(Int_t idd)
{
// import Hbook object with identifier idd in memory

   Int_t id = 0;
   for (Int_t key=1;key<1000000;key++) {
      int z0 = 0;
      rzink(key,z0,"S",1);
      if (quest[0]) break;
      if (quest[13] & 8)  continue;
      id = quest[20];
      if (id == idd) break;
   }
   if (id == 0) return 0;
   if (id != idd) {
      printf("Error cannot find ID = %d\n",idd);
      return 0;
   }

   int i999 = 999;
   // must delete any previous object with the same ID !!
   lcdir = hcbook[6];
   ltab  = hcbook[9];
   for (Int_t i=1;i<=iq[lcdir+kNRH];i++) {
      if (iq[ltab+i] == id) {
         printf("WARNING, previous ID=%d is replaced\n",id);
         hdelet(id);
         break;
      }
   }
   hrin(id,i999,0);
   if (quest[0]) {
      printf("Error cannot read ID = %d\n",id);
      return 0;
   }
   hdcofl();
   lcid  = hcbook[10];
   lcont = lq[lcid-1];
   TObject *obj = 0;
   if (hcbits[3]) {
      if (iq[lcid-2] == 2) obj = ConvertRWN(id);
      else                 obj = ConvertCWN(id);
      //hdelet(id); //cannot be deleted here since used in GetEntry
      if (obj) {
         fList->Add(obj);
         ((THbookTree *)obj)->SetTitle(GetName());
      }
      return obj;
   }
   if (hcbits[0] && hcbits[7]) {
      obj = ConvertProfile(id);
      hdelet(id);
      if (obj) fList->Add(obj);
      return obj;
   }
   if (hcbits[0]) {
      obj = Convert1D(id);
      hdelet(id);
      if (obj) fList->Add(obj);
      return obj;
   }
   if (hcbits[1] || hcbits[2]) {
      obj = Convert2D(id);
      hdelet(id);
      if (obj) fList->Add(obj);
      return obj;
   }
   return obj;
}


//______________________________________________________________________________
Int_t THbookFile::GetEntry(Int_t entry, Int_t id, Int_t atype, Float_t *x)
{
// Read in memory all columns of entry number of ntuple id from the Hbook file

   Int_t ier = 0;
   if (atype == 0) {
      hgnf(id,entry+1,x[0],ier);
   } else {
      hgnt(id,entry+1,ier);
   }
   return 0;
}

//______________________________________________________________________________
Int_t THbookFile::GetEntryBranch(Int_t entry, Int_t id)
{
// Read in memory only the branch bname

   if (entry == gLastEntry) return 0;
   gLastEntry = entry;
   Int_t ier = 0;
   //uses the fast read method using the Hbook tables computed in InitLeaves
   hgntf(id,entry+1,ier);
   //old alternative slow method
//#ifndef WIN32
//   hgnt1(id,PASSCHAR(blockname),PASSCHAR(branchname),0,-1,entry+1,ier,strlen(blockname),strlen(branchname));
//#else
//   hgnt1(id,PASSCHAR(blockname),PASSCHAR(branchname),0,-1,entry+1,ier);
//#endif
   return 0;
}


//______________________________________________________________________________
void THbookFile::InitLeaves(Int_t id, Int_t var, TTreeFormula *formula)
{
// This function is called from the first entry in TTreePlayer::InitLoop
// It analyzes the list of variables involved in the current query
// and pre-process the internal Hbook tables to speed-up the search
// at the next entries.

   if (!formula) return;
   Int_t ncodes = formula->GetNcodes();
   for (Int_t i=1;i<=ncodes;i++) {
      TLeaf *leaf = formula->GetLeaf(i-1);
      if (!leaf) continue;
      if (var == 5) {
         //leafcount may be null in case of a fix size array
         if (leaf->GetLeafCount()) leaf = leaf->GetLeafCount();
      }
      Int_t last = 0;
      if (var == 1 && i == ncodes) last = 1;
#ifndef WIN32
      hntvar3(id,last,PASSCHAR(leaf->GetName()),strlen(leaf->GetName()));
#else
      hntvar3(id,last,PASSCHAR(leaf->GetName()));
#endif
   }
}

//______________________________________________________________________________
Bool_t THbookFile::IsOpen() const
{
   // Returns kTRUE in case file is open and kFALSE if file is not open.

   return fLun == 0 ? kFALSE : kTRUE;
}


//______________________________________________________________________________
void THbookFile::SetBranchAddress(Int_t id, const char *bname, void *add)
{
   //Set branch address
   Int_t *iadd = (Int_t*)add;
   Int_t &aadd = *iadd;
#ifndef WIN32
   hbnam(id,PASSCHAR(bname),aadd,PASSCHAR("$SET"),0,strlen(bname),4);
#else
   hbnam(id,PASSCHAR(bname),aadd,PASSCHAR("$SET"),0);
#endif
}

//______________________________________________________________________________
TFile *THbookFile::Convert2root(const char *rootname, Int_t /*lrecl*/,
                                Option_t *option)
{
// Convert this Hbook file to a Root file with name rootname.
// if rootname="', rootname = hbook file name with .root instead of .hbook
// By default, the Root file is connected and returned
// option:
//       - "NO" do not connect the Root file
//       - "C"  do not compress file (default is to compress)
//       - "L"  do not convert names to lower case (default is to convert)

   TString opt = option;
   opt.ToLower();

   Int_t nch = strlen(rootname);
   char *rfile=0;
   if (nch) {
      rfile = new char[nch+1];
      strlcpy(rfile,rootname,nch+1);
   } else {
      nch = strlen(GetName());
      rfile = new char[nch+1];
      strlcpy(rfile,GetName(),nch+1);
      char *dot = strrchr(rfile,'.');
      if (dot) strcpy(dot+1,"root");
      else     strlcat(rfile,".root",nch+1);
   }

   nch = 2*nch+50;
   char *cmd = new char[nch+1];
   snprintf(cmd,nch,"h2root %s %s",GetName(),rfile);
   if (opt.Contains("c")) strlcat (cmd," 0",nch+1);
   if (opt.Contains("l")) strlcat (cmd," 0",nch+1);

   gSystem->Exec(cmd);
   
   delete [] cmd;
   if (opt.Contains("no")) {delete [] rfile; return 0;}
   TFile *f = new TFile(rfile);
   delete [] rfile;
   if (f->IsZombie()) {delete f; f = 0;}
   return f;
}


//______________________________________________________________________________
TObject *THbookFile::ConvertCWN(Int_t id)
{
// Convert the Column-Wise-Ntuple id to a Root Tree

   const int nchar=9;
   int nvar;
   int i,j;
   int nsub,itype,isize,ielem;
   char *chtag_out;
   float rmin[1000], rmax[1000];

   if (id > 0) snprintf(idname,127,"h%d",id);
   else        snprintf(idname,127,"h_%d",-id);
   hnoent(id,nentries);
   //printf(" Converting CWN with ID= %d, nentries = %d\n",id,nentries);
   nvar=0;
#ifndef WIN32
   hgiven(id,chtitl,nvar,PASSCHAR(""),rmin[0],rmax[0],80,0);
#else
   hgiven(id,chtitl,80,nvar,PASSCHAR(""),rmin[0],rmax[0]);
#endif
   chtag_out = new char[nvar*nchar+1];
   Int_t *charflag = new Int_t[nvar];
   Int_t *lenchar  = new Int_t[nvar];
   Int_t *boolflag = new Int_t[nvar];
   Int_t *lenbool  = new Int_t[nvar];
   UChar_t *boolarr = new UChar_t[10000];

   chtag_out[nvar*nchar]=0;
   for (i=0;i<80;i++)chtitl[i]=0;
#ifndef WIN32
   hgiven(id,chtitl,nvar,chtag_out,rmin[0],rmax[0],80,nchar);
#else
   hgiven(id,chtitl,80,nvar,chtag_out,nchar,rmin[0],rmax[0]);
#endif

   Int_t bufpos = 0;
   Int_t isachar = 0;
   Int_t isabool = 0;
   char fullname[64];
   char name[32];
   char block[32];
   char oldblock[32];
   strlcpy(oldblock,"OLDBLOCK",32); 
   Int_t oldischar = -1;
   for (i=80;i>0;i--) {if (chtitl[i] == ' ') chtitl[i] = 0; }
   THbookTree *tree = new THbookTree(idname,id);
   tree->SetHbookFile(this);
   tree->SetType(1);

   char *bigbuf = tree->MakeX(500000);

#ifndef WIN32
   hbnam(id,PASSCHAR(" "),bigbuf[0],PASSCHAR("$CLEAR"),0,1,6);
#else
   hbnam(id,PASSCHAR(" "),bigbuf[0],PASSCHAR("$CLEAR"),0);
#endif

   UInt_t varNumber = 0;
   Int_t golower  = 1;
   Int_t nbits = 0;
   for(i=0; i<nvar;i++) {
      memset(name,' ',sizeof(name));
      name[sizeof(name)-1] = 0;
      memset(block,' ',sizeof(block));
      block[sizeof(block)-1] = 0;
      memset(fullname,' ',sizeof(fullname));
      fullname[sizeof(fullname)-1]=0;
#ifndef WIN32
      hntvar2(id,i+1,PASSCHAR(name),PASSCHAR(fullname),PASSCHAR(block),nsub,itype,isize,nbits,ielem,32,64,32);
#else
      hntvar2(id,i+1,PASSCHAR(name),PASSCHAR(fullname),PASSCHAR(block),nsub,itype,isize,nbits,ielem);
#endif
      TString hbookName = name;

      for (j=30;j>0;j--) {
         if(golower) name[j] = tolower(name[j]);
         if (name[j] == ' ') name[j] = 0;
      }
      if (golower == 2) name[0] = tolower(name[0]);

      for (j=62;j>0;j--) {
         if(golower && fullname[j-1] != '[') fullname[j] = tolower(fullname[j]);
         // convert also character after [, if golower == 2
         if (golower == 2) fullname[j] = tolower(fullname[j]);
         if (fullname[j] == ' ') fullname[j] = 0;
      }
      // convert also first character, if golower == 2
      if (golower == 2) fullname[0] = tolower(fullname[0]);
      for (j=30;j>0;j--) {
         if (block[j] == ' ') block[j] = 0;
         else break;
      }
      if (itype == 1 && isize == 4) strlcat(fullname,"/F",64);
      if (itype == 1 && isize == 8) strlcat(fullname,"/D",64);
      if (itype == 2) strlcat(fullname,"/I",64);
      if (itype == 3) strlcat(fullname,"/i",64);
//     if (itype == 4) strlcat(fullname,"/i",64);
      if (itype == 4) strlcat(fullname,"/b",64);
      if (itype == 5) strlcat(fullname,"/C",64);
//printf("Creating branch:%s, block:%s, fullname:%s, nsub=%d, itype=%d, isize=%d, ielem=%d, bufpos=%d\n",name,block,fullname,nsub,itype,isize,ielem,bufpos);
      Int_t ischar;
      if (itype == 5) ischar = 1;
      else            ischar = 0;

      if (ischar != oldischar || strcmp(oldblock,block) != 0) {
         varNumber = 0;
         strlcpy(oldblock,block,32); 
         oldischar = ischar;
         Long_t add= (Long_t)&bigbuf[bufpos];
         Int_t lblock   = strlen(block);
#ifndef WIN32
         hbnam(id,PASSCHAR(block),add,PASSCHAR("$SET"),ischar,lblock,4);
#else
         hbnam(id,PASSCHAR(block),add,PASSCHAR("$SET"),ischar);
#endif 

      }

      Int_t bufsize = 8000;
      THbookBranch *branch = new THbookBranch(tree,name,(void*)&bigbuf[bufpos],fullname,bufsize);
      tree->GetListOfBranches()->Add(branch);
      branch->SetBlockName(block);
      branch->SetUniqueID(varNumber);
      varNumber++;

      //NB: the information about isachar should be saved in the branch
      // to be done
      boolflag[i] = -10;
      charflag[i] = 0;
      if (itype == 4) {isabool++; boolflag[i] = bufpos; lenbool[i] = ielem;}
      bufpos += isize*ielem;
      if (ischar) {isachar++; charflag[i] = bufpos-1; lenchar[i] = isize*ielem;}
      TObjArray *ll= branch->GetListOfLeaves();
      TLeaf *leaf = (TLeaf*)ll->UncheckedAt(0);
      if (!leaf) continue;
      TLeafI *leafcount = (TLeafI*)leaf->GetLeafCount();
      if (leafcount) {
         if (leafcount->GetMaximum() <= 0) leafcount->SetMaximum(ielem);
      }
   }
   tree->SetEntries(nentries);
   delete [] charflag;
   delete [] lenchar;
   delete [] boolflag;
   delete [] lenbool;
   delete [] boolarr;
   delete [] chtag_out;

   return tree;
}

//______________________________________________________________________________
TObject *THbookFile::ConvertRWN(Int_t id)
{
// Convert the Row-Wise-Ntuple id to a Root Tree

   const int nchar=9;
   int nvar;
   int i,j;
   char *chtag_out;
   float rmin[1000], rmax[1000];

   if (id > 0) snprintf(idname,127,"h%d",id);
   else        snprintf(idname,127,"h_%d",-id);
   hnoent(id,nentries);
   //printf(" Converting RWN with ID= %d, nentries = %d\n",id,nentries);
   nvar=0;
#ifndef WIN32
   hgiven(id,chtitl,nvar,PASSCHAR(""),rmin[0],rmax[0],80,0);
#else
   hgiven(id,chtitl,80,nvar,PASSCHAR(""),rmin[0],rmax[0]);
#endif

   chtag_out = new char[nvar*nchar+1];

   Int_t golower  = 1;
   chtag_out[nvar*nchar]=0;
   for (i=0;i<80;i++)chtitl[i]=0;
#ifndef WIN32
   hgiven(id,chtitl,nvar,chtag_out,rmin[0],rmax[0],80,nchar);
#else
   hgiven(id,chtitl,80,nvar,chtag_out,nchar,rmin[0],rmax[0]);
#endif
   hgnpar(id,"?",1);
   char *name = chtag_out;
   for (i=80;i>0;i--) {if (chtitl[i] == ' ') chtitl[i] = 0; }
   THbookTree *tree = new THbookTree(idname,id);
   tree->SetHbookFile(this);
   tree->SetType(0);
   Float_t *x = (Float_t*)tree->MakeX(nvar*4);

   Int_t first,last;
   for(i=0; i<nvar;i++) {
      name[nchar-1] = 0;
      first = last = 0;
      TString hbookName = name;
      // suppress trailing blanks
      for (j=nchar-2;j>0;j--) {
         if(golower) name[j] = tolower(name[j]);
         if (name[j] == ' ' && last == 0) name[j] = 0;
         else last = j;
      }
      if (golower == 2) name[0] = tolower(name[0]);

      // suppress heading blanks
      for (j=0;j<nchar;j++) {
         if (name[j] != ' ') break;
         first = j+1;
      }
      Int_t bufsize = 8000;
      //tree->Branch(&name[first],&x[i],&name[first],bufsize);
      THbookBranch *branch = new THbookBranch(tree,&name[first],&x[4*i],&name[first],bufsize);
      branch->SetAddress(&x[i]);
      branch->SetBlockName(hbookName.Data());
      tree->GetListOfBranches()->Add(branch);
      name += nchar;
   }
   tree->SetEntries(nentries);
   return tree;
}

//______________________________________________________________________________
TObject *THbookFile::ConvertProfile(Int_t id)
{
// Convert an Hbook profile histogram into a Root TProfile
//
// the following structure is used in Hbook
//    lcid points to the profile in array iq
//    lcont = lq(lcid-1)
//    lw    = lq(lcont)
//    ln    = lq(lw)
//      if option S jbyt(iq(lw),1,2) = 1
//      if option I jbyt(iq(lw),1,2) = 2

   if (id > 0) snprintf(idname,127,"h%d",id);
   else        snprintf(idname,127,"h_%d",-id);
   hnoent(id,nentries);
   Int_t lw = lq[lcont];
   Int_t ln = lq[lw];
#ifndef WIN32
   hgive(id,chtitl,ncx,xmin,xmax,ncy,ymin,ymax,nwt,idb,80);
#else
   hgive(id,chtitl,80,ncx,xmin,xmax,ncy,ymin,ymax,nwt,idb);
#endif
   Float_t offsetx = 0.5*(xmax-xmin)/ncx;
   chtitl[4*nwt] = 0;
   const char *option= " ";
   if (iq[lw] == 1) option = "S";
   if (iq[lw] == 2) option = "I";
   TProfile *p = new TProfile(idname,chtitl,ncx,xmin,xmax,ymin,ymax,option);

   const Int_t kCON1 = 9;
   Int_t i;
   Float_t x = 0.;
   Float_t y = 0.5*(ymin+ymax);
   for (i=1;i<=ncx;i++) {
      Int_t n = Int_t(q[ln+i]);
      hix(id,i,x);
      for (Int_t j=0;j<n;j++) {
         p->Fill(x+offsetx,y);
      }
      Float_t content = q[lcont+kCON1+i];
      Float_t error   = TMath::Sqrt(q[lw+i]);
      p->SetBinContent(i,content);
      p->SetBinError(i,error);
   }
   p->SetEntries(nentries);
   return p;
}

//______________________________________________________________________________
TObject *THbookFile::Convert1D(Int_t id)
{
// Convert an Hbook 1-d histogram into a Root TH1F

   if (id > 0) snprintf(idname,127,"h%d",id);
   else        snprintf(idname,127,"h_%d",-id);
   hnoent(id,nentries);
#ifndef WIN32
   hgive(id,chtitl,ncx,xmin,xmax,ncy,ymin,ymax,nwt,idb,80);
#else
   hgive(id,chtitl,80,ncx,xmin,xmax,ncy,ymin,ymax,nwt,idb);
#endif
   chtitl[4*nwt] = 0;
   TH1F *h1;
   Int_t i;
   if (hcbits[5]) {
      Int_t lbins = lq[lcid-2];
      Double_t *xbins = new Double_t[ncx+1];
      for (i=0;i<=ncx;i++) xbins[i] = q[lbins+i+1];
      h1 = new TH1F(idname,chtitl,ncx,xbins);
      delete [] xbins;
   } else {
      h1 = new TH1F(idname,chtitl,ncx,xmin,xmax);
   }
   if (hcbits[8]) h1->Sumw2();
   TGraph *gr = 0;
   if (hcbits[11]) {
      gr = new TGraph(ncx);
      h1->GetListOfFunctions()->Add(gr);
   }

   Float_t x;
   for (i=0;i<=ncx+1;i++) {
      x = h1->GetBinCenter(i);
      h1->Fill(x,hi(id,i));
      if (hcbits[8]) h1->SetBinError(i,hie(id,i));
      if (gr && i>0 && i<=ncx) gr->SetPoint(i,x,hif(id,i));
   }
   Float_t yymin, yymax;
   if (hcbits[19]) {
      yymax = q[lcid+kMAX1];
      h1->SetMaximum(yymax);
   }
   if (hcbits[20]) {
      yymin = q[lcid+kMIN1];
      h1->SetMinimum(yymin);
   }
   h1->SetEntries(nentries);
   return h1;
}

//______________________________________________________________________________
TObject *THbookFile::Convert2D(Int_t id)
{
// Convert an Hbook 2-d histogram into a Root TH2F

   if (id > 0) snprintf(idname,127,"h%d",id);
   else        snprintf(idname,127,"h_%d",-id);
   hnoent(id,nentries);
#ifndef WIN32
   hgive(id,chtitl,ncx,xmin,xmax,ncy,ymin,ymax,nwt,idb,80);
#else
   hgive(id,chtitl,80,ncx,xmin,xmax,ncy,ymin,ymax,nwt,idb);
#endif
   chtitl[4*nwt] = 0;
   TH2F *h2 = new TH2F(idname,chtitl,ncx,xmin,xmax,ncy,ymin,ymax);
   Float_t offsetx = 0.5*(xmax-xmin)/ncx;
   Float_t offsety = 0.5*(ymax-ymin)/ncy;
   Int_t lw = lq[lcont];
   if (lw) h2->Sumw2();

   Float_t x = 0.,y = 0.;
   for (Int_t j=0;j<=ncy+1;j++) {
      for (Int_t i=0;i<=ncx+1;i++) {
         hijxy(id,i,j,x,y);
         h2->Fill(x+offsetx,y+offsety,hij(id,i,j));
         if (lw) {
            Double_t err2 = hije(id,i,j);
            h2->SetCellError(i,j,err2);
         }
      }
   }
   h2->SetEntries(nentries);
   return h2;
}

//______________________________________________________________________________
void THbookFile::ls(const char *path) const
{
// List contents of Hbook directory

   Int_t nch = strlen(path);
   if (nch == 0) {
#ifndef WIN32
      hldir(PASSCHAR(fCurDir.Data()),PASSCHAR("T"),fCurDir.Length(),1);
#else
      hldir(PASSCHAR(fCurDir.Data()),PASSCHAR("T"));
#endif
      return;
   }

#ifndef WIN32
   hldir(PASSCHAR(path),PASSCHAR("T"),strlen(path),1);
#else
   hldir(PASSCHAR(path),PASSCHAR("T"));
#endif
}
 THbookFile.cxx:1
 THbookFile.cxx:2
 THbookFile.cxx:3
 THbookFile.cxx:4
 THbookFile.cxx:5
 THbookFile.cxx:6
 THbookFile.cxx:7
 THbookFile.cxx:8
 THbookFile.cxx:9
 THbookFile.cxx:10
 THbookFile.cxx:11
 THbookFile.cxx:12
 THbookFile.cxx:13
 THbookFile.cxx:14
 THbookFile.cxx:15
 THbookFile.cxx:16
 THbookFile.cxx:17
 THbookFile.cxx:18
 THbookFile.cxx:19
 THbookFile.cxx:20
 THbookFile.cxx:21
 THbookFile.cxx:22
 THbookFile.cxx:23
 THbookFile.cxx:24
 THbookFile.cxx:25
 THbookFile.cxx:26
 THbookFile.cxx:27
 THbookFile.cxx:28
 THbookFile.cxx:29
 THbookFile.cxx:30
 THbookFile.cxx:31
 THbookFile.cxx:32
 THbookFile.cxx:33
 THbookFile.cxx:34
 THbookFile.cxx:35
 THbookFile.cxx:36
 THbookFile.cxx:37
 THbookFile.cxx:38
 THbookFile.cxx:39
 THbookFile.cxx:40
 THbookFile.cxx:41
 THbookFile.cxx:42
 THbookFile.cxx:43
 THbookFile.cxx:44
 THbookFile.cxx:45
 THbookFile.cxx:46
 THbookFile.cxx:47
 THbookFile.cxx:48
 THbookFile.cxx:49
 THbookFile.cxx:50
 THbookFile.cxx:51
 THbookFile.cxx:52
 THbookFile.cxx:53
 THbookFile.cxx:54
 THbookFile.cxx:55
 THbookFile.cxx:56
 THbookFile.cxx:57
 THbookFile.cxx:58
 THbookFile.cxx:59
 THbookFile.cxx:60
 THbookFile.cxx:61
 THbookFile.cxx:62
 THbookFile.cxx:63
 THbookFile.cxx:64
 THbookFile.cxx:65
 THbookFile.cxx:66
 THbookFile.cxx:67
 THbookFile.cxx:68
 THbookFile.cxx:69
 THbookFile.cxx:70
 THbookFile.cxx:71
 THbookFile.cxx:72
 THbookFile.cxx:73
 THbookFile.cxx:74
 THbookFile.cxx:75
 THbookFile.cxx:76
 THbookFile.cxx:77
 THbookFile.cxx:78
 THbookFile.cxx:79
 THbookFile.cxx:80
 THbookFile.cxx:81
 THbookFile.cxx:82
 THbookFile.cxx:83
 THbookFile.cxx:84
 THbookFile.cxx:85
 THbookFile.cxx:86
 THbookFile.cxx:87
 THbookFile.cxx:88
 THbookFile.cxx:89
 THbookFile.cxx:90
 THbookFile.cxx:91
 THbookFile.cxx:92
 THbookFile.cxx:93
 THbookFile.cxx:94
 THbookFile.cxx:95
 THbookFile.cxx:96
 THbookFile.cxx:97
 THbookFile.cxx:98
 THbookFile.cxx:99
 THbookFile.cxx:100
 THbookFile.cxx:101
 THbookFile.cxx:102
 THbookFile.cxx:103
 THbookFile.cxx:104
 THbookFile.cxx:105
 THbookFile.cxx:106
 THbookFile.cxx:107
 THbookFile.cxx:108
 THbookFile.cxx:109
 THbookFile.cxx:110
 THbookFile.cxx:111
 THbookFile.cxx:112
 THbookFile.cxx:113
 THbookFile.cxx:114
 THbookFile.cxx:115
 THbookFile.cxx:116
 THbookFile.cxx:117
 THbookFile.cxx:118
 THbookFile.cxx:119
 THbookFile.cxx:120
 THbookFile.cxx:121
 THbookFile.cxx:122
 THbookFile.cxx:123
 THbookFile.cxx:124
 THbookFile.cxx:125
 THbookFile.cxx:126
 THbookFile.cxx:127
 THbookFile.cxx:128
 THbookFile.cxx:129
 THbookFile.cxx:130
 THbookFile.cxx:131
 THbookFile.cxx:132
 THbookFile.cxx:133
 THbookFile.cxx:134
 THbookFile.cxx:135
 THbookFile.cxx:136
 THbookFile.cxx:137
 THbookFile.cxx:138
 THbookFile.cxx:139
 THbookFile.cxx:140
 THbookFile.cxx:141
 THbookFile.cxx:142
 THbookFile.cxx:143
 THbookFile.cxx:144
 THbookFile.cxx:145
 THbookFile.cxx:146
 THbookFile.cxx:147
 THbookFile.cxx:148
 THbookFile.cxx:149
 THbookFile.cxx:150
 THbookFile.cxx:151
 THbookFile.cxx:152
 THbookFile.cxx:153
 THbookFile.cxx:154
 THbookFile.cxx:155
 THbookFile.cxx:156
 THbookFile.cxx:157
 THbookFile.cxx:158
 THbookFile.cxx:159
 THbookFile.cxx:160
 THbookFile.cxx:161
 THbookFile.cxx:162
 THbookFile.cxx:163
 THbookFile.cxx:164
 THbookFile.cxx:165
 THbookFile.cxx:166
 THbookFile.cxx:167
 THbookFile.cxx:168
 THbookFile.cxx:169
 THbookFile.cxx:170
 THbookFile.cxx:171
 THbookFile.cxx:172
 THbookFile.cxx:173
 THbookFile.cxx:174
 THbookFile.cxx:175
 THbookFile.cxx:176
 THbookFile.cxx:177
 THbookFile.cxx:178
 THbookFile.cxx:179
 THbookFile.cxx:180
 THbookFile.cxx:181
 THbookFile.cxx:182
 THbookFile.cxx:183
 THbookFile.cxx:184
 THbookFile.cxx:185
 THbookFile.cxx:186
 THbookFile.cxx:187
 THbookFile.cxx:188
 THbookFile.cxx:189
 THbookFile.cxx:190
 THbookFile.cxx:191
 THbookFile.cxx:192
 THbookFile.cxx:193
 THbookFile.cxx:194
 THbookFile.cxx:195
 THbookFile.cxx:196
 THbookFile.cxx:197
 THbookFile.cxx:198
 THbookFile.cxx:199
 THbookFile.cxx:200
 THbookFile.cxx:201
 THbookFile.cxx:202
 THbookFile.cxx:203
 THbookFile.cxx:204
 THbookFile.cxx:205
 THbookFile.cxx:206
 THbookFile.cxx:207
 THbookFile.cxx:208
 THbookFile.cxx:209
 THbookFile.cxx:210
 THbookFile.cxx:211
 THbookFile.cxx:212
 THbookFile.cxx:213
 THbookFile.cxx:214
 THbookFile.cxx:215
 THbookFile.cxx:216
 THbookFile.cxx:217
 THbookFile.cxx:218
 THbookFile.cxx:219
 THbookFile.cxx:220
 THbookFile.cxx:221
 THbookFile.cxx:222
 THbookFile.cxx:223
 THbookFile.cxx:224
 THbookFile.cxx:225
 THbookFile.cxx:226
 THbookFile.cxx:227
 THbookFile.cxx:228
 THbookFile.cxx:229
 THbookFile.cxx:230
 THbookFile.cxx:231
 THbookFile.cxx:232
 THbookFile.cxx:233
 THbookFile.cxx:234
 THbookFile.cxx:235
 THbookFile.cxx:236
 THbookFile.cxx:237
 THbookFile.cxx:238
 THbookFile.cxx:239
 THbookFile.cxx:240
 THbookFile.cxx:241
 THbookFile.cxx:242
 THbookFile.cxx:243
 THbookFile.cxx:244
 THbookFile.cxx:245
 THbookFile.cxx:246
 THbookFile.cxx:247
 THbookFile.cxx:248
 THbookFile.cxx:249
 THbookFile.cxx:250
 THbookFile.cxx:251
 THbookFile.cxx:252
 THbookFile.cxx:253
 THbookFile.cxx:254
 THbookFile.cxx:255
 THbookFile.cxx:256
 THbookFile.cxx:257
 THbookFile.cxx:258
 THbookFile.cxx:259
 THbookFile.cxx:260
 THbookFile.cxx:261
 THbookFile.cxx:262
 THbookFile.cxx:263
 THbookFile.cxx:264
 THbookFile.cxx:265
 THbookFile.cxx:266
 THbookFile.cxx:267
 THbookFile.cxx:268
 THbookFile.cxx:269
 THbookFile.cxx:270
 THbookFile.cxx:271
 THbookFile.cxx:272
 THbookFile.cxx:273
 THbookFile.cxx:274
 THbookFile.cxx:275
 THbookFile.cxx:276
 THbookFile.cxx:277
 THbookFile.cxx:278
 THbookFile.cxx:279
 THbookFile.cxx:280
 THbookFile.cxx:281
 THbookFile.cxx:282
 THbookFile.cxx:283
 THbookFile.cxx:284
 THbookFile.cxx:285
 THbookFile.cxx:286
 THbookFile.cxx:287
 THbookFile.cxx:288
 THbookFile.cxx:289
 THbookFile.cxx:290
 THbookFile.cxx:291
 THbookFile.cxx:292
 THbookFile.cxx:293
 THbookFile.cxx:294
 THbookFile.cxx:295
 THbookFile.cxx:296
 THbookFile.cxx:297
 THbookFile.cxx:298
 THbookFile.cxx:299
 THbookFile.cxx:300
 THbookFile.cxx:301
 THbookFile.cxx:302
 THbookFile.cxx:303
 THbookFile.cxx:304
 THbookFile.cxx:305
 THbookFile.cxx:306
 THbookFile.cxx:307
 THbookFile.cxx:308
 THbookFile.cxx:309
 THbookFile.cxx:310
 THbookFile.cxx:311
 THbookFile.cxx:312
 THbookFile.cxx:313
 THbookFile.cxx:314
 THbookFile.cxx:315
 THbookFile.cxx:316
 THbookFile.cxx:317
 THbookFile.cxx:318
 THbookFile.cxx:319
 THbookFile.cxx:320
 THbookFile.cxx:321
 THbookFile.cxx:322
 THbookFile.cxx:323
 THbookFile.cxx:324
 THbookFile.cxx:325
 THbookFile.cxx:326
 THbookFile.cxx:327
 THbookFile.cxx:328
 THbookFile.cxx:329
 THbookFile.cxx:330
 THbookFile.cxx:331
 THbookFile.cxx:332
 THbookFile.cxx:333
 THbookFile.cxx:334
 THbookFile.cxx:335
 THbookFile.cxx:336
 THbookFile.cxx:337
 THbookFile.cxx:338
 THbookFile.cxx:339
 THbookFile.cxx:340
 THbookFile.cxx:341
 THbookFile.cxx:342
 THbookFile.cxx:343
 THbookFile.cxx:344
 THbookFile.cxx:345
 THbookFile.cxx:346
 THbookFile.cxx:347
 THbookFile.cxx:348
 THbookFile.cxx:349
 THbookFile.cxx:350
 THbookFile.cxx:351
 THbookFile.cxx:352
 THbookFile.cxx:353
 THbookFile.cxx:354
 THbookFile.cxx:355
 THbookFile.cxx:356
 THbookFile.cxx:357
 THbookFile.cxx:358
 THbookFile.cxx:359
 THbookFile.cxx:360
 THbookFile.cxx:361
 THbookFile.cxx:362
 THbookFile.cxx:363
 THbookFile.cxx:364
 THbookFile.cxx:365
 THbookFile.cxx:366
 THbookFile.cxx:367
 THbookFile.cxx:368
 THbookFile.cxx:369
 THbookFile.cxx:370
 THbookFile.cxx:371
 THbookFile.cxx:372
 THbookFile.cxx:373
 THbookFile.cxx:374
 THbookFile.cxx:375
 THbookFile.cxx:376
 THbookFile.cxx:377
 THbookFile.cxx:378
 THbookFile.cxx:379
 THbookFile.cxx:380
 THbookFile.cxx:381
 THbookFile.cxx:382
 THbookFile.cxx:383
 THbookFile.cxx:384
 THbookFile.cxx:385
 THbookFile.cxx:386
 THbookFile.cxx:387
 THbookFile.cxx:388
 THbookFile.cxx:389
 THbookFile.cxx:390
 THbookFile.cxx:391
 THbookFile.cxx:392
 THbookFile.cxx:393
 THbookFile.cxx:394
 THbookFile.cxx:395
 THbookFile.cxx:396
 THbookFile.cxx:397
 THbookFile.cxx:398
 THbookFile.cxx:399
 THbookFile.cxx:400
 THbookFile.cxx:401
 THbookFile.cxx:402
 THbookFile.cxx:403
 THbookFile.cxx:404
 THbookFile.cxx:405
 THbookFile.cxx:406
 THbookFile.cxx:407
 THbookFile.cxx:408
 THbookFile.cxx:409
 THbookFile.cxx:410
 THbookFile.cxx:411
 THbookFile.cxx:412
 THbookFile.cxx:413
 THbookFile.cxx:414
 THbookFile.cxx:415
 THbookFile.cxx:416
 THbookFile.cxx:417
 THbookFile.cxx:418
 THbookFile.cxx:419
 THbookFile.cxx:420
 THbookFile.cxx:421
 THbookFile.cxx:422
 THbookFile.cxx:423
 THbookFile.cxx:424
 THbookFile.cxx:425
 THbookFile.cxx:426
 THbookFile.cxx:427
 THbookFile.cxx:428
 THbookFile.cxx:429
 THbookFile.cxx:430
 THbookFile.cxx:431
 THbookFile.cxx:432
 THbookFile.cxx:433
 THbookFile.cxx:434
 THbookFile.cxx:435
 THbookFile.cxx:436
 THbookFile.cxx:437
 THbookFile.cxx:438
 THbookFile.cxx:439
 THbookFile.cxx:440
 THbookFile.cxx:441
 THbookFile.cxx:442
 THbookFile.cxx:443
 THbookFile.cxx:444
 THbookFile.cxx:445
 THbookFile.cxx:446
 THbookFile.cxx:447
 THbookFile.cxx:448
 THbookFile.cxx:449
 THbookFile.cxx:450
 THbookFile.cxx:451
 THbookFile.cxx:452
 THbookFile.cxx:453
 THbookFile.cxx:454
 THbookFile.cxx:455
 THbookFile.cxx:456
 THbookFile.cxx:457
 THbookFile.cxx:458
 THbookFile.cxx:459
 THbookFile.cxx:460
 THbookFile.cxx:461
 THbookFile.cxx:462
 THbookFile.cxx:463
 THbookFile.cxx:464
 THbookFile.cxx:465
 THbookFile.cxx:466
 THbookFile.cxx:467
 THbookFile.cxx:468
 THbookFile.cxx:469
 THbookFile.cxx:470
 THbookFile.cxx:471
 THbookFile.cxx:472
 THbookFile.cxx:473
 THbookFile.cxx:474
 THbookFile.cxx:475
 THbookFile.cxx:476
 THbookFile.cxx:477
 THbookFile.cxx:478
 THbookFile.cxx:479
 THbookFile.cxx:480
 THbookFile.cxx:481
 THbookFile.cxx:482
 THbookFile.cxx:483
 THbookFile.cxx:484
 THbookFile.cxx:485
 THbookFile.cxx:486
 THbookFile.cxx:487
 THbookFile.cxx:488
 THbookFile.cxx:489
 THbookFile.cxx:490
 THbookFile.cxx:491
 THbookFile.cxx:492
 THbookFile.cxx:493
 THbookFile.cxx:494
 THbookFile.cxx:495
 THbookFile.cxx:496
 THbookFile.cxx:497
 THbookFile.cxx:498
 THbookFile.cxx:499
 THbookFile.cxx:500
 THbookFile.cxx:501
 THbookFile.cxx:502
 THbookFile.cxx:503
 THbookFile.cxx:504
 THbookFile.cxx:505
 THbookFile.cxx:506
 THbookFile.cxx:507
 THbookFile.cxx:508
 THbookFile.cxx:509
 THbookFile.cxx:510
 THbookFile.cxx:511
 THbookFile.cxx:512
 THbookFile.cxx:513
 THbookFile.cxx:514
 THbookFile.cxx:515
 THbookFile.cxx:516
 THbookFile.cxx:517
 THbookFile.cxx:518
 THbookFile.cxx:519
 THbookFile.cxx:520
 THbookFile.cxx:521
 THbookFile.cxx:522
 THbookFile.cxx:523
 THbookFile.cxx:524
 THbookFile.cxx:525
 THbookFile.cxx:526
 THbookFile.cxx:527
 THbookFile.cxx:528
 THbookFile.cxx:529
 THbookFile.cxx:530
 THbookFile.cxx:531
 THbookFile.cxx:532
 THbookFile.cxx:533
 THbookFile.cxx:534
 THbookFile.cxx:535
 THbookFile.cxx:536
 THbookFile.cxx:537
 THbookFile.cxx:538
 THbookFile.cxx:539
 THbookFile.cxx:540
 THbookFile.cxx:541
 THbookFile.cxx:542
 THbookFile.cxx:543
 THbookFile.cxx:544
 THbookFile.cxx:545
 THbookFile.cxx:546
 THbookFile.cxx:547
 THbookFile.cxx:548
 THbookFile.cxx:549
 THbookFile.cxx:550
 THbookFile.cxx:551
 THbookFile.cxx:552
 THbookFile.cxx:553
 THbookFile.cxx:554
 THbookFile.cxx:555
 THbookFile.cxx:556
 THbookFile.cxx:557
 THbookFile.cxx:558
 THbookFile.cxx:559
 THbookFile.cxx:560
 THbookFile.cxx:561
 THbookFile.cxx:562
 THbookFile.cxx:563
 THbookFile.cxx:564
 THbookFile.cxx:565
 THbookFile.cxx:566
 THbookFile.cxx:567
 THbookFile.cxx:568
 THbookFile.cxx:569
 THbookFile.cxx:570
 THbookFile.cxx:571
 THbookFile.cxx:572
 THbookFile.cxx:573
 THbookFile.cxx:574
 THbookFile.cxx:575
 THbookFile.cxx:576
 THbookFile.cxx:577
 THbookFile.cxx:578
 THbookFile.cxx:579
 THbookFile.cxx:580
 THbookFile.cxx:581
 THbookFile.cxx:582
 THbookFile.cxx:583
 THbookFile.cxx:584
 THbookFile.cxx:585
 THbookFile.cxx:586
 THbookFile.cxx:587
 THbookFile.cxx:588
 THbookFile.cxx:589
 THbookFile.cxx:590
 THbookFile.cxx:591
 THbookFile.cxx:592
 THbookFile.cxx:593
 THbookFile.cxx:594
 THbookFile.cxx:595
 THbookFile.cxx:596
 THbookFile.cxx:597
 THbookFile.cxx:598
 THbookFile.cxx:599
 THbookFile.cxx:600
 THbookFile.cxx:601
 THbookFile.cxx:602
 THbookFile.cxx:603
 THbookFile.cxx:604
 THbookFile.cxx:605
 THbookFile.cxx:606
 THbookFile.cxx:607
 THbookFile.cxx:608
 THbookFile.cxx:609
 THbookFile.cxx:610
 THbookFile.cxx:611
 THbookFile.cxx:612
 THbookFile.cxx:613
 THbookFile.cxx:614
 THbookFile.cxx:615
 THbookFile.cxx:616
 THbookFile.cxx:617
 THbookFile.cxx:618
 THbookFile.cxx:619
 THbookFile.cxx:620
 THbookFile.cxx:621
 THbookFile.cxx:622
 THbookFile.cxx:623
 THbookFile.cxx:624
 THbookFile.cxx:625
 THbookFile.cxx:626
 THbookFile.cxx:627
 THbookFile.cxx:628
 THbookFile.cxx:629
 THbookFile.cxx:630
 THbookFile.cxx:631
 THbookFile.cxx:632
 THbookFile.cxx:633
 THbookFile.cxx:634
 THbookFile.cxx:635
 THbookFile.cxx:636
 THbookFile.cxx:637
 THbookFile.cxx:638
 THbookFile.cxx:639
 THbookFile.cxx:640
 THbookFile.cxx:641
 THbookFile.cxx:642
 THbookFile.cxx:643
 THbookFile.cxx:644
 THbookFile.cxx:645
 THbookFile.cxx:646
 THbookFile.cxx:647
 THbookFile.cxx:648
 THbookFile.cxx:649
 THbookFile.cxx:650
 THbookFile.cxx:651
 THbookFile.cxx:652
 THbookFile.cxx:653
 THbookFile.cxx:654
 THbookFile.cxx:655
 THbookFile.cxx:656
 THbookFile.cxx:657
 THbookFile.cxx:658
 THbookFile.cxx:659
 THbookFile.cxx:660
 THbookFile.cxx:661
 THbookFile.cxx:662
 THbookFile.cxx:663
 THbookFile.cxx:664
 THbookFile.cxx:665
 THbookFile.cxx:666
 THbookFile.cxx:667
 THbookFile.cxx:668
 THbookFile.cxx:669
 THbookFile.cxx:670
 THbookFile.cxx:671
 THbookFile.cxx:672
 THbookFile.cxx:673
 THbookFile.cxx:674
 THbookFile.cxx:675
 THbookFile.cxx:676
 THbookFile.cxx:677
 THbookFile.cxx:678
 THbookFile.cxx:679
 THbookFile.cxx:680
 THbookFile.cxx:681
 THbookFile.cxx:682
 THbookFile.cxx:683
 THbookFile.cxx:684
 THbookFile.cxx:685
 THbookFile.cxx:686
 THbookFile.cxx:687
 THbookFile.cxx:688
 THbookFile.cxx:689
 THbookFile.cxx:690
 THbookFile.cxx:691
 THbookFile.cxx:692
 THbookFile.cxx:693
 THbookFile.cxx:694
 THbookFile.cxx:695
 THbookFile.cxx:696
 THbookFile.cxx:697
 THbookFile.cxx:698
 THbookFile.cxx:699
 THbookFile.cxx:700
 THbookFile.cxx:701
 THbookFile.cxx:702
 THbookFile.cxx:703
 THbookFile.cxx:704
 THbookFile.cxx:705
 THbookFile.cxx:706
 THbookFile.cxx:707
 THbookFile.cxx:708
 THbookFile.cxx:709
 THbookFile.cxx:710
 THbookFile.cxx:711
 THbookFile.cxx:712
 THbookFile.cxx:713
 THbookFile.cxx:714
 THbookFile.cxx:715
 THbookFile.cxx:716
 THbookFile.cxx:717
 THbookFile.cxx:718
 THbookFile.cxx:719
 THbookFile.cxx:720
 THbookFile.cxx:721
 THbookFile.cxx:722
 THbookFile.cxx:723
 THbookFile.cxx:724
 THbookFile.cxx:725
 THbookFile.cxx:726
 THbookFile.cxx:727
 THbookFile.cxx:728
 THbookFile.cxx:729
 THbookFile.cxx:730
 THbookFile.cxx:731
 THbookFile.cxx:732
 THbookFile.cxx:733
 THbookFile.cxx:734
 THbookFile.cxx:735
 THbookFile.cxx:736
 THbookFile.cxx:737
 THbookFile.cxx:738
 THbookFile.cxx:739
 THbookFile.cxx:740
 THbookFile.cxx:741
 THbookFile.cxx:742
 THbookFile.cxx:743
 THbookFile.cxx:744
 THbookFile.cxx:745
 THbookFile.cxx:746
 THbookFile.cxx:747
 THbookFile.cxx:748
 THbookFile.cxx:749
 THbookFile.cxx:750
 THbookFile.cxx:751
 THbookFile.cxx:752
 THbookFile.cxx:753
 THbookFile.cxx:754
 THbookFile.cxx:755
 THbookFile.cxx:756
 THbookFile.cxx:757
 THbookFile.cxx:758
 THbookFile.cxx:759
 THbookFile.cxx:760
 THbookFile.cxx:761
 THbookFile.cxx:762
 THbookFile.cxx:763
 THbookFile.cxx:764
 THbookFile.cxx:765
 THbookFile.cxx:766
 THbookFile.cxx:767
 THbookFile.cxx:768
 THbookFile.cxx:769
 THbookFile.cxx:770
 THbookFile.cxx:771
 THbookFile.cxx:772
 THbookFile.cxx:773
 THbookFile.cxx:774
 THbookFile.cxx:775
 THbookFile.cxx:776
 THbookFile.cxx:777
 THbookFile.cxx:778
 THbookFile.cxx:779
 THbookFile.cxx:780
 THbookFile.cxx:781
 THbookFile.cxx:782
 THbookFile.cxx:783
 THbookFile.cxx:784
 THbookFile.cxx:785
 THbookFile.cxx:786
 THbookFile.cxx:787
 THbookFile.cxx:788
 THbookFile.cxx:789
 THbookFile.cxx:790
 THbookFile.cxx:791
 THbookFile.cxx:792
 THbookFile.cxx:793
 THbookFile.cxx:794
 THbookFile.cxx:795
 THbookFile.cxx:796
 THbookFile.cxx:797
 THbookFile.cxx:798
 THbookFile.cxx:799
 THbookFile.cxx:800
 THbookFile.cxx:801
 THbookFile.cxx:802
 THbookFile.cxx:803
 THbookFile.cxx:804
 THbookFile.cxx:805
 THbookFile.cxx:806
 THbookFile.cxx:807
 THbookFile.cxx:808
 THbookFile.cxx:809
 THbookFile.cxx:810
 THbookFile.cxx:811
 THbookFile.cxx:812
 THbookFile.cxx:813
 THbookFile.cxx:814
 THbookFile.cxx:815
 THbookFile.cxx:816
 THbookFile.cxx:817
 THbookFile.cxx:818
 THbookFile.cxx:819
 THbookFile.cxx:820
 THbookFile.cxx:821
 THbookFile.cxx:822
 THbookFile.cxx:823
 THbookFile.cxx:824
 THbookFile.cxx:825
 THbookFile.cxx:826
 THbookFile.cxx:827
 THbookFile.cxx:828
 THbookFile.cxx:829
 THbookFile.cxx:830
 THbookFile.cxx:831
 THbookFile.cxx:832
 THbookFile.cxx:833
 THbookFile.cxx:834
 THbookFile.cxx:835
 THbookFile.cxx:836
 THbookFile.cxx:837
 THbookFile.cxx:838
 THbookFile.cxx:839
 THbookFile.cxx:840
 THbookFile.cxx:841
 THbookFile.cxx:842
 THbookFile.cxx:843
 THbookFile.cxx:844
 THbookFile.cxx:845
 THbookFile.cxx:846
 THbookFile.cxx:847
 THbookFile.cxx:848
 THbookFile.cxx:849
 THbookFile.cxx:850
 THbookFile.cxx:851
 THbookFile.cxx:852
 THbookFile.cxx:853
 THbookFile.cxx:854
 THbookFile.cxx:855
 THbookFile.cxx:856
 THbookFile.cxx:857
 THbookFile.cxx:858
 THbookFile.cxx:859
 THbookFile.cxx:860
 THbookFile.cxx:861
 THbookFile.cxx:862
 THbookFile.cxx:863
 THbookFile.cxx:864
 THbookFile.cxx:865
 THbookFile.cxx:866
 THbookFile.cxx:867
 THbookFile.cxx:868
 THbookFile.cxx:869
 THbookFile.cxx:870
 THbookFile.cxx:871
 THbookFile.cxx:872
 THbookFile.cxx:873
 THbookFile.cxx:874
 THbookFile.cxx:875
 THbookFile.cxx:876
 THbookFile.cxx:877
 THbookFile.cxx:878
 THbookFile.cxx:879
 THbookFile.cxx:880
 THbookFile.cxx:881
 THbookFile.cxx:882
 THbookFile.cxx:883
 THbookFile.cxx:884
 THbookFile.cxx:885
 THbookFile.cxx:886
 THbookFile.cxx:887
 THbookFile.cxx:888
 THbookFile.cxx:889
 THbookFile.cxx:890
 THbookFile.cxx:891
 THbookFile.cxx:892
 THbookFile.cxx:893
 THbookFile.cxx:894
 THbookFile.cxx:895
 THbookFile.cxx:896
 THbookFile.cxx:897
 THbookFile.cxx:898
 THbookFile.cxx:899
 THbookFile.cxx:900
 THbookFile.cxx:901
 THbookFile.cxx:902
 THbookFile.cxx:903
 THbookFile.cxx:904
 THbookFile.cxx:905
 THbookFile.cxx:906
 THbookFile.cxx:907
 THbookFile.cxx:908
 THbookFile.cxx:909
 THbookFile.cxx:910
 THbookFile.cxx:911
 THbookFile.cxx:912
 THbookFile.cxx:913
 THbookFile.cxx:914
 THbookFile.cxx:915
 THbookFile.cxx:916
 THbookFile.cxx:917
 THbookFile.cxx:918
 THbookFile.cxx:919
 THbookFile.cxx:920
 THbookFile.cxx:921
 THbookFile.cxx:922
 THbookFile.cxx:923
 THbookFile.cxx:924
 THbookFile.cxx:925
 THbookFile.cxx:926
 THbookFile.cxx:927
 THbookFile.cxx:928
 THbookFile.cxx:929
 THbookFile.cxx:930
 THbookFile.cxx:931
 THbookFile.cxx:932
 THbookFile.cxx:933
 THbookFile.cxx:934
 THbookFile.cxx:935
 THbookFile.cxx:936
 THbookFile.cxx:937
 THbookFile.cxx:938
 THbookFile.cxx:939
 THbookFile.cxx:940
 THbookFile.cxx:941
 THbookFile.cxx:942
 THbookFile.cxx:943
 THbookFile.cxx:944
 THbookFile.cxx:945
 THbookFile.cxx:946
 THbookFile.cxx:947
 THbookFile.cxx:948
 THbookFile.cxx:949
 THbookFile.cxx:950
 THbookFile.cxx:951
 THbookFile.cxx:952
 THbookFile.cxx:953
 THbookFile.cxx:954
 THbookFile.cxx:955
 THbookFile.cxx:956
 THbookFile.cxx:957
 THbookFile.cxx:958
 THbookFile.cxx:959
 THbookFile.cxx:960
 THbookFile.cxx:961
 THbookFile.cxx:962
 THbookFile.cxx:963
 THbookFile.cxx:964
 THbookFile.cxx:965
 THbookFile.cxx:966
 THbookFile.cxx:967
 THbookFile.cxx:968
 THbookFile.cxx:969
 THbookFile.cxx:970
 THbookFile.cxx:971
 THbookFile.cxx:972
 THbookFile.cxx:973
 THbookFile.cxx:974
 THbookFile.cxx:975
 THbookFile.cxx:976
 THbookFile.cxx:977
 THbookFile.cxx:978
 THbookFile.cxx:979
 THbookFile.cxx:980
 THbookFile.cxx:981
 THbookFile.cxx:982
 THbookFile.cxx:983
 THbookFile.cxx:984
 THbookFile.cxx:985
 THbookFile.cxx:986
 THbookFile.cxx:987
 THbookFile.cxx:988
 THbookFile.cxx:989
 THbookFile.cxx:990
 THbookFile.cxx:991
 THbookFile.cxx:992
 THbookFile.cxx:993
 THbookFile.cxx:994
 THbookFile.cxx:995
 THbookFile.cxx:996
 THbookFile.cxx:997
 THbookFile.cxx:998
 THbookFile.cxx:999
 THbookFile.cxx:1000
 THbookFile.cxx:1001
 THbookFile.cxx:1002
 THbookFile.cxx:1003
 THbookFile.cxx:1004
 THbookFile.cxx:1005
 THbookFile.cxx:1006
 THbookFile.cxx:1007