Skip to content
Snippets Groups Projects
Commit 24630a64 authored by Fons Rademakers's avatar Fons Rademakers
Browse files

new directory containing code for libHbook.so. This library provides an

interface to legacy HBOOK files and provides histogram and ntuple reading
capability.


git-svn-id: http://root.cern.ch/svn/root/trunk@4015 27541ba8-7e3a-0410-8455-c3a389f83636
parent 7a3f0ad9
No related branches found
No related tags found
No related merge requests found
......@@ -97,6 +97,9 @@ endif
ifneq ($(SRPUTILLIB),)
MODULES += srputils
endif
ifneq ($(CERNLIBS),)
MODULES += hbook
endif
ifneq ($(findstring $(MAKECMDGOALS),distclean maintainer-clean),)
MODULES += unix winnt x11 x11ttf win32 win32gdk gl rfio thread pythia \
......@@ -594,6 +597,7 @@ showbuild:
@echo "OPENGLLIB = $(OPENGLLIB)"
@echo "OPENGLINCDIR = $(OPENGLINCDIR)"
@echo "CERNLIBDIR = $(CERNLIBDIR)"
@echo "CERNLIBS = $(CERNLIBS)"
@echo "OSTHREADLIB = $(OSTHREADLIB)"
@echo "SHIFTLIB = $(SHIFTLIB)"
@echo "DCAPLIB = $(DCAPLIB)"
......
# Module.mk for hbook module
# Copyright (c) 2002 Rene Brun and Fons Rademakers
#
# Author: Fons Rademakers, 18/2/2002
MODDIR := hbook
MODDIRS := $(MODDIR)/src
MODDIRI := $(MODDIR)/inc
HBOOKDIR := $(MODDIR)
HBOOKDIRS := $(HBOOKDIR)/src
HBOOKDIRI := $(HBOOKDIR)/inc
##### libHbook #####
HBOOKL := $(MODDIRI)/LinkDef.h
HBOOKDS := $(MODDIRS)/G__Hbook.cxx
HBOOKDO := $(HBOOKDS:.cxx=.o)
HBOOKDH := $(HBOOKDS:.cxx=.h)
HBOOKH := $(filter-out $(MODDIRI)/LinkDef%,$(wildcard $(MODDIRI)/*.h))
HBOOKS1 := $(filter-out $(MODDIRS)/G__%,$(wildcard $(MODDIRS)/*.cxx))
HBOOKS2 := $(MODDIRS)/hntvar2.f
HBOOKO := $(HBOOKS1:.cxx=.o) $(HBOOKS2:.f=.o)
HBOOKDEP := $(HBOOKS1:.cxx=.d) $(HBOOKDO:.o=.d)
HBOOKLIB := $(LPATH)/libHbook.$(SOEXT)
# used in the main Makefile
ALLHDRS += $(patsubst $(MODDIRI)/%.h,include/%.h,$(HBOOKH))
ALLLIBS += $(HBOOKLIB)
# include all dependency files
INCLUDEFILES += $(HBOOKDEP)
##### local rules #####
include/%.h: $(HBOOKDIRI)/%.h
cp $< $@
$(HBOOKLIB): $(HBOOKO) $(HBOOKDO) $(MAINLIBS)
@$(MAKELIB) $(PLATFORM) $(LD) "$(LDFLAGS)" \
"$(SOFLAGS)" libHbook.$(SOEXT) $@ "$(HBOOKO) $(HBOOKDO)" \
"$(CERNLIBDIR) $(CERNLIBS) $(F77LIBS)"
$(HBOOKDS): $(HBOOKH) $(HBOOKL) $(ROOTCINTTMP)
@echo "Generating dictionary $@..."
$(ROOTCINTTMP) -f $@ -c $(HBOOKH) $(HBOOKL)
$(HBOOKDO): $(HBOOKDS)
$(CXX) $(NOOPT) $(CXXFLAGS) -I. -o $@ -c $<
all-hbook: $(HBOOKLIB)
clean-hbook:
@rm -f $(HBOOKO) $(HBOOKDO)
clean:: clean-hbook
distclean-hbook: clean-hbook
@rm -f $(HBOOKDEP) $(HBOOKDS) $(HBOOKDH) $(HBOOKLIB)
distclean:: distclean-hbook
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class THbookFile+;
#pragma link C++ class THbookTree+;
#pragma link C++ class THbookBranch+;
#endif
// @(#)root/hbook:$Name:$:$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. *
*************************************************************************/
#ifndef ROOT_THbookBranch
#define ROOT_THbookBranch
//////////////////////////////////////////////////////////////////////////
// //
// THbookBranch //
// //
// A branch for a THbookTree //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TBranch
#include "TBranch.h"
#endif
class THbookBranch : public TBranch {
protected:
TString fBlockName; //Hbook block name
public:
THbookBranch() {;}
THbookBranch(const char *name, void *address, const char *leaflist, Int_t basketsize=32000, Int_t compress=-1);
virtual ~THbookBranch();
virtual Int_t GetEntry(Int_t entry=0, Int_t getall=0);
const char *GetBlockName() const {return fBlockName.Data();}
void SetBlockName(const char *name) {fBlockName=name;}
virtual void SetEntries(Int_t n) {fEntries=n;}
ClassDef(THbookBranch,1) //A branch for a THbookTree
};
#endif
// @(#)root/hbook:$Name:$:$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. *
*************************************************************************/
#ifndef ROOT_THbookFile
#define ROOT_THbookFile
//////////////////////////////////////////////////////////////////////////
// //
// THbookFile //
// //
// ROOT interface to Hbook/PAW files //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TFile
#include "TFile.h"
#endif
class THbookFile : public TFile {
protected:
Int_t fLun; //Fortran logical unit for this file
static Bool_t fgPawInit;
static Int_t *fgLuns;
public:
THbookFile();
THbookFile(const char *fname, Int_t lrecl=1024);
virtual ~THbookFile();
virtual Bool_t cd(const char *dirname="");
virtual void Close(Option_t *option="") {;}
virtual TObject *ConvertCWN(Int_t id);
virtual TObject *ConvertRWN(Int_t id);
virtual TObject *ConvertProfile(Int_t id);
virtual TObject *Convert1D(Int_t id);
virtual TObject *Convert2D(Int_t id);
virtual void Copy(TObject &) { MayNotUse("Copy(TObject &)"); }
virtual void Delete(const char *namecycle="") {;}
void DeleteID(Int_t id);
virtual void Flush() {;}
TObject *Get(Int_t id);
Int_t GetBestBuffer() const {return 1024;}
TArrayC *GetClassIndex() const { return 0; }
Int_t GetCompressionLevel() const { return 0; }
Float_t GetCompressionFactor() {return 1;}
Int_t GetEntry(Int_t entry,Int_t id, Int_t atype, Float_t *x);
Int_t GetEntryBranch(Int_t entry,Int_t id, const char *blockname, const char *branchname);
Int_t GetVersion() const { return 1; }
Seek_t GetSize() const {return 0;}
virtual Bool_t IsOpen() const {return kTRUE;}
virtual void ls(Option_t *option="") const;
virtual void Map() {;}
virtual void Print(Option_t *option="") const {;}
ClassDef(THbookFile,1) //ROOT interface to Hbook/PAW files
};
#endif
// @(#)root/hbook:$Name:$:$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. *
*************************************************************************/
#ifndef ROOT_THbookTree
#define ROOT_THbookTree
//////////////////////////////////////////////////////////////////////////
// //
// THbookTree //
// //
// A wrapper class supporting Hbook ntuples (CWN and RWN). //
// The normal TTree calls can be used, including TTree::Draw(). //
// Data read directly from the Hbook file via THbookFile. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_TTree
#include "TTree.h"
#endif
#ifndef ROOT_THbookFile
#include "THbookFile.h"
#endif
class THbookTree : public TTree {
protected:
Int_t fID; //Hbook identifier
Int_t fType; //RWN (0) or CWN (1)
char *fX; //storage area for RWN
THbookFile *fFile; //pointer to Hbook file
public:
THbookTree();
THbookTree(const char *name, Int_t id);
virtual ~THbookTree();
virtual Int_t GetEntry(Int_t entry=0, Int_t getall=0);
THbookFile *GetHbookFile() {return fFile;}
virtual Int_t GetID() {return fID;}
virtual Int_t GetType() {return fType;}
Float_t *GetX() {return (Float_t*)fX;}
char *MakeX(Int_t nvars) {fX = new char[nvars]; return fX;}
virtual void Print(Option_t *option="") const;
virtual void SetEntries(Int_t n);
virtual void SetHbookFile(THbookFile *file) {fFile = file;}
virtual void SetType(Int_t atype) {fType = atype;}
ClassDef(THbookTree,1) //A wrapper class supporting Hbook ntuples (CWN and RWN)
};
#endif
// @(#)root/hbook:$Name:$:$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. *
*************************************************************************/
#include "THbookBranch.h"
#include "THbookTree.h"
ClassImp(THbookBranch)
//______________________________________________________________________________
THbookBranch::THbookBranch(const char *name, void *address, const char *leaflist, Int_t basketsize, Int_t compress)
:TBranch(name,address,leaflist,basketsize,compress)
{
}
//______________________________________________________________________________
THbookBranch::~THbookBranch()
{
}
//______________________________________________________________________________
Int_t THbookBranch::GetEntry(Int_t entry, Int_t getall)
{
THbookTree *tree = (THbookTree*)GetTree();
THbookFile *file = tree->GetHbookFile();
if (tree->GetType() == 0) {
return file->GetEntry(entry,tree->GetID(),0,tree->GetX());
} else {
return file->GetEntryBranch(entry,tree->GetID(),fBlockName.Data(),GetName());
}
}
This diff is collapsed.
// @(#)root/hbook:$Name:$:$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. *
*************************************************************************/
//////////////////////////////////////////////////////////////////////////
// //
// THbookTree //
// //
// A wrapper class supporting Hbook ntuples (CWN and RWN). //
// The normal TTree calls can be used, including TTree::Draw(). //
// Data read directly from the Hbook file via THbookFile. //
// //
//////////////////////////////////////////////////////////////////////////
#include "THbookTree.h"
#include "THbookBranch.h"
ClassImp(THbookTree)
//______________________________________________________________________________
THbookTree::THbookTree(): TTree()
{
fID = 0;
fType = 0;
fX = 0;
fFile = 0;
}
//______________________________________________________________________________
THbookTree::THbookTree(const char *name,Int_t id)
:TTree(name,name)
{
fID = id;
fType = 0;
fX = 0;
fFile = 0;
}
//______________________________________________________________________________
THbookTree::~THbookTree()
{
if (fX) delete [] fX;
if (fFile) fFile->DeleteID(fID);
}
//______________________________________________________________________________
Int_t THbookTree::GetEntry(Int_t entry, Int_t getall)
{
return fFile->GetEntry(entry,fID,fType,GetX());
}
//______________________________________________________________________________
void THbookTree::Print(Option_t *option) const
{
TTree::Print(option);
}
//______________________________________________________________________________
void THbookTree::SetEntries(Int_t n)
{
fEntries = n;
TIter next(GetListOfBranches());
THbookBranch *branch;
while ((branch=(THbookBranch*)next())) {
branch->SetEntries(n);
}
}
*CMZ : 2.21/05 08/02/99 11.10.43 by Rene Brun
*CMZ : 0.90/10 09/12/96 17.08.32 by Rene Brun
*-- Author : Rene Brun 09/12/96
SUBROUTINE HNTVAR2(ID1,IVAR,CHTAG,CHFULL,BLOCK,NSUB,ITYPE,ISIZE
+ ,IELEM)
*.==========>
*.
*. Returns the tag, block, type, size and array length of the
*. variable with index IVAR in N-tuple ID1.
*. N-tuple must already be in memory.
*.
*. This routine is a modification of the HBOOK routine HNTVAR.
*.
*..=========> ( R.Brun, A.A.Rademakers )
*
*KEEP,HCNTPAR.
INTEGER ZBITS, ZNDIM, ZNOENT, ZNPRIM, ZNRZB, ZIFCON,
+ ZIFNAM, ZIFCHA, ZIFINT, ZIFREA, ZNWTIT, ZITIT1,
+ ZNCHRZ, ZDESC, ZLNAME, ZNAME, ZARIND, ZRANGE, ZNADDR,
+ ZIBLOK, ZNBLOK, ZLCONT, ZIFBIT, ZIBANK, ZIFTMP, ZITMP,
+ ZID, ZNTMP, ZNTMP1, ZLINK
PARAMETER(ZBITS=1, ZNDIM=2, ZNOENT=3, ZNPRIM=4, ZLCONT=6,
+ ZNRZB=5, ZIFCON=7, ZIFNAM=4, ZIFCHA=5, ZIFINT=6,
+ ZIFREA=7, ZNWTIT=8, ZITIT1=9, ZNCHRZ=13, ZIFBIT=8,
+ ZDESC=1, ZLNAME=2, ZNAME=3, ZRANGE=4, ZNADDR=12,
+ ZARIND=11, ZIBLOK=8, ZNBLOK=10, ZIBANK=9, ZIFTMP=11,
+ ZID=12, ZITMP=10, ZNTM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
+ KNBIT ,KNOENT ,KSTAT1 ,KNSDIR ,KNRH ,
+ KCON1 ,KCON2 ,KBITS ,KNTOT
PARAMETER(KNCX=3,KXMIN=4,KXMAX=5,KMIN1=7,KMAX1=8,KNORM=9,KTIT1=10,
+ KNCY=7,KYMIN=8,KYMAX=9,KMIN2=6,KMAX2=10,KSCAL2=11,
+ KTIT2=12,KNBIT=1,KNOENT=2,KSTAT1=3,KNSDIR=5,KNRH=6,
+ KCON1=9,KCON2=3,KBITS=1,KNTOT=2)
*
*KEEP,HCBITS.
INTEGER I1, I2, I3, I4, I5, I6, I7, I8,
+ I9, I10, I11, I12, I13, I14, I15, I16,
+I17, I18, I19, I20, I21, I22, I23, I24, I25, I26, I27,
+I28, I29, I30, I31, I32, I33, I34, I35, I123, I230
COMMON / HCBITS / I1, I2, I3, I4, I5, I6, I7, I8,
+ I9, I10, I11, I12, I13, I14, I15, I16,
+I17, I18, I19, I20, I21, I22, I23, I24, I25, I26, I27,
+I28, I29, I30, I31, I32, I33, I34, I35, I123, I230
*
*KEND.
*
CHARACTER*(*) CHTAG, CHFULL, BLOCK
CHARACTER*80 VAR
CHARACTER*32 NAME, SUBS
LOGICAL LDUM
*
ID = ID1
IDPOS = LOCATI(IQ(LTAB+1),IQ(LCDIR+KNRH),ID)
IF (IDPOS .LE. 0) THEN
CALL HBUG('Unknown N-tuple','HNTVAR',ID1)
RETURN
ENDIF
LCID = LQ(LTAB-IDPOS)
*
CHTAG = ' '
NAME = ' '
BLOCK = ' '
NSUB = 0
ITYPE = 0
ISIZE = 0
IELEM = 0
*
ICNT = 0
*
*
IF (IVAR .GT. IQ(LCID+ZNDIM)) RETURN
*
LBLOK = LQ(LCID-1)
LCHAR = LQ(LCID-2)
LINT = LQ(LCID-3)
LREAL = LQ(LCID-4)
*
*-- loop over all blocks
*
5 LNAME = LQ(LBLOK-1)
*
IOFF = 0
NDIM = IQ(LBLOK+ZNDIM)
*
DO 10 I = 1, NDIM
ICNT = ICNT + 1
IF (ICNT .EQ. IVAR) THEN
*
CALL HNDESC(IOFF, NSUB, ITYPE, ISIZE, NBITS, LDUM)
*
LL = IQ(LNAME+IOFF+ZLNAME)
LV = IQ(LNAME+IOFF+ZNAME)
CALL UHTOC(IQ(LCHAR+LV), 4, NAME, LL)
CALL UHTOC(IQ(LBLOK+ZIBLOK), 4, BLOCK, 8)
*
IELEM = 1
IF (NSUB .GT. 0) THEN
VAR = NAME(1:LL)//'['
DO 25 J = NSUB,1,-1
LP = IQ(LINT+IQ(LNAME+IOFF+ZARIND)+(J-1))
IF (LP .LT. 0) THEN
IE = -LP
CALL HITOC(IE, SUBS, LL, IERR)
ELSE
LL = IQ(LNAME+LP-1+ZLNAME)
LV = IQ(LNAME+LP-1+ZNAME)
CALL UHTOC(IQ(LCHAR+LV), 4, SUBS, LL)
LL1 = IQ(LNAME+LP-1+ZRANGE)
IE = IQ(LINT+LL1+1)
ENDIF
IELEM = IELEM*IE
IF (J .EQ. NSUB) THEN
VAR = VAR(1:LENOCC(VAR))//SUBS(1:LL)
ELSE
VAR = VAR(1:LENOCC(VAR))//']['//SUBS(1:LL)
ENDIF
25 CONTINUE
*
VAR = VAR(1:LENOCC(VAR))//']'
ELSE
VAR = NAME(1:LL)
ENDIF
CHTAG = NAME
CHFULL = VAR
RETURN
*
ENDIF
*
IOFF = IOFF + ZNADDR
10 CONTINUE
*
LBLOK = LQ(LBLOK)
IF (LBLOK .NE. 0) GOTO 5
*
END
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment