60#define PAWC_SIZE 4000000
67# define hcbits hcbits_
68# define hcbook hcbook_
82extern "C" int quest[100];
85extern "C" int rzcl[11];
105# define hlimit hlimit_
107# define hropen hropen_
110# define hnoent hnoent_
112# define hgiven hgiven_
113# define hgnpar hgnpar_
119# define hdcofl hdcofl_
120# define hmaxim hmaxim_
121# define hminim hminim_
122# define hdelet hdelet_
123# define hntvar2 hntvar2_
124# define hntvar3 hntvar3_
125# define hbname hbname_
126# define hbnamc hbnamc_
138# define DEFCHAR const char*
139# define PASSCHAR(string) string
141# define hlimit HLIMIT
143# define hropen HROPEN
146# define hnoent HNOENT
148# define hgiven HGIVEN
149# define hgnpar HGNPAR
155# define hdcofl HDCOFL
156# define hmaxim HMAXIM
157# define hminim HMINIM
158# define hdelet HDELET
159# define hntvar2 HNTVAR2
160# define hntvar3 HNTVAR3
161# define hbname HBNAME
162# define hbnamc HBNAMC
172# define type_of_call _stdcall
173# define DEFCHAR const char*, const int
174# define PASSCHAR(string) string, strlen(string)
180 const int&,
const int&,
const int,
const int,
const int);
184 const int&,
const int&);
192 const int&,
const float&,
const float&,
const int&,
const int&,
const int);
195 const int&,
const float&,
const float&,
const int&,
const int&);
201 const float&,
const float&,
const int,
const int);
205 const float&,
const float&);
210extern "C" void type_of_call hntvar2(
const int&,
const int&,
DEFCHAR,
DEFCHAR,
DEFCHAR,
int&,
int&,
int&,
int&,
int&,
const int,
const int,
const int);
278 for (i=0;i<10;i++)
fgLuns[i] = 0;
291 Error(
"THbookFile",
"Too many HbookFiles\n");
308 if (ier) printf (
" Error on hropen was %d \n", ier);
310 printf(
"Error cannot open input file: %s\n",fname);
312 if (ier ||
quest[0]) {
321 gROOT->GetListOfBrowsables()->Add(
this,fname);
325 for (
Int_t key=1;key<1000000;key++) {
329 if (
quest[13] & 8)
continue;
354 b->Add(
fKeys,
"IDs on disk");
364 Int_t nch = strlen(dirname);
376 for (i=0;i<512;i++) cdir[i] =
' ';
385 for (i=510;i>=0;i--) {
386 if (cdir[i] !=
' ')
break;
403 gROOT->GetListOfBrowsables()->Remove(
this);
448 for (
Int_t key=1;key<1000000;key++) {
452 if (
quest[13] & 8)
continue;
454 if (
id == idd)
break;
456 if (
id == 0)
return 0;
458 printf(
"Error cannot find ID = %d\n",idd);
468 printf(
"WARNING, previous ID=%d is replaced\n",
id);
475 printf(
"Error cannot read ID = %d\n",
id);
521 hgnf(
id,entry+1,
x[0],ier);
523 hgnt(
id,entry+1,ier);
537 hgntf(
id,entry+1,ier);
556 if (!formula)
return;
558 for (
Int_t i=1;i<=ncodes;i++) {
566 if (var == 1 && i == ncodes) last = 1;
613 Int_t nch = strlen(rootname);
616 rfile =
new char[nch+1];
617 strlcpy(rfile,rootname,nch+1);
620 rfile =
new char[nch+1];
621 strlcpy(rfile,
GetName(),nch+1);
622 char *dot = strrchr(rfile,
'.');
623 if (dot) strcpy(dot+1,
"root");
624 else strlcat(rfile,
".root",nch+1);
628 char *cmd =
new char[nch+1];
630 if (opt.
Contains(
"c")) strlcat (cmd,
" 0",nch+1);
631 if (opt.
Contains(
"l")) strlcat (cmd,
" 0",nch+1);
636 if (opt.
Contains(
"no")) {
delete [] rfile;
return 0;}
639 if (
f->IsZombie()) {
delete f;
f = 0;}
652 int nsub,itype,isize,ielem;
654 float rmin[1000], rmax[1000];
666 chtag_out =
new char[nvar*nchar+1];
673 chtag_out[nvar*nchar]=0;
674 for (i=0;i<80;i++)
chtitl[i]=0;
676 hgiven(
id,
chtitl,nvar,chtag_out,rmin[0],rmax[0],80,nchar);
678 hgiven(
id,
chtitl,80,nvar,chtag_out,nchar,rmin[0],rmax[0]);
688 strlcpy(oldblock,
"OLDBLOCK",32);
689 Int_t oldischar = -1;
690 for (i=80;i>0;i--) {
if (
chtitl[i] ==
' ')
chtitl[i] = 0; }
692 tree->SetHbookFile(
this);
695 char *bigbuf =
tree->MakeX(500000);
706 for(i=0; i<nvar;i++) {
709 memset(block,
' ',
sizeof(block));
710 block[
sizeof(block)-1] = 0;
711 memset(fullname,
' ',
sizeof(fullname));
712 fullname[
sizeof(fullname)-1]=0;
714 hntvar2(
id,i+1,
PASSCHAR(
name),
PASSCHAR(fullname),
PASSCHAR(block),nsub,itype,isize,nbits,ielem,32,64,32);
721 if(golower)
name[j] = tolower(
name[j]);
724 if (golower == 2)
name[0] = tolower(
name[0]);
727 if(golower && fullname[j-1] !=
'[') fullname[j] = tolower(fullname[j]);
729 if (golower == 2) fullname[j] = tolower(fullname[j]);
730 if (fullname[j] ==
' ') fullname[j] = 0;
733 if (golower == 2) fullname[0] = tolower(fullname[0]);
735 if (block[j] ==
' ') block[j] = 0;
738 if (itype == 1 && isize == 4) strlcat(fullname,
"/F",64);
739 if (itype == 1 && isize == 8) strlcat(fullname,
"/D",64);
740 if (itype == 2) strlcat(fullname,
"/I",64);
741 if (itype == 3) strlcat(fullname,
"/i",64);
743 if (itype == 4) strlcat(fullname,
"/b",64);
744 if (itype == 5) strlcat(fullname,
"/C",64);
747 if (itype == 5) ischar = 1;
750 if (ischar != oldischar || strcmp(oldblock,block) != 0) {
752 strlcpy(oldblock,block,32);
755 Int_t lblock = strlen(block);
764 Int_t bufsize = 8000;
766 tree->GetListOfBranches()->Add(branch);
775 if (itype == 4) {isabool++; boolflag[i] = bufpos; lenbool[i] = ielem;}
776 bufpos += isize*ielem;
777 if (ischar) {isachar++; charflag[i] = bufpos-1; lenchar[i] = isize*ielem;}
806 float rmin[1000], rmax[1000];
819 chtag_out =
new char[nvar*nchar+1];
822 chtag_out[nvar*nchar]=0;
823 for (i=0;i<80;i++)
chtitl[i]=0;
825 hgiven(
id,
chtitl,nvar,chtag_out,rmin[0],rmax[0],80,nchar);
827 hgiven(
id,
chtitl,80,nvar,chtag_out,nchar,rmin[0],rmax[0]);
830 char *
name = chtag_out;
831 for (i=80;i>0;i--) {
if (
chtitl[i] ==
' ')
chtitl[i] = 0; }
833 tree->SetHbookFile(
this);
838 for(i=0; i<nvar;i++) {
843 for (j=nchar-2;j>0;j--) {
844 if(golower)
name[j] = tolower(
name[j]);
845 if (
name[j] ==
' ' && last == 0)
name[j] = 0;
848 if (golower == 2)
name[0] = tolower(
name[0]);
851 for (j=0;j<nchar;j++) {
852 if (
name[j] !=
' ')
break;
855 Int_t bufsize = 8000;
860 tree->GetListOfBranches()->Add(branch);
888 hgive(
id,
chtitl,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb,80);
890 hgive(
id,
chtitl,80,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb);
894 const char *option=
" ";
895 if (
iq[lw] == 1) option =
"S";
896 if (
iq[lw] == 2) option =
"I";
899 const Int_t kCON1 = 9;
903 for (i=1;i<=
ncx;i++) {
927 hgive(
id,
chtitl,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb,80);
929 hgive(
id,
chtitl,80,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb);
937 for (i=0;i<=
ncx;i++) xbins[i] =
q[lbins+i+1];
951 for (i=0;i<=
ncx+1;i++) {
979 hgive(
id,
chtitl,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb,80);
981 hgive(
id,
chtitl,80,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb);
994 h2->
Fill(
x+offsetx,
y+offsety,
hij(
id,i,j));
1010 Int_t nch = strlen(path);
R__EXTERN TSystem * gSystem
TObjArray * GetListOfLeaves()
Using a TBrowser one can browse all ROOT objects.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format.
A TGraph is an object made of two arrays X and Y with npoints each.
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
1-D histogram with a float per channel (see TH1 documentation)}
virtual Double_t GetBinCenter(Int_t bin) const
Return bin center for 1D histogram.
virtual void SetMaximum(Double_t maximum=-1111)
virtual void SetBinError(Int_t bin, Double_t error)
Set the bin Error Note that this resets the bin eror option to be of Normal Type and for the non-empt...
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
virtual void SetMinimum(Double_t minimum=-1111)
virtual void SetBinContent(Int_t bin, Double_t content)
Set bin content see convention for numbering bins in TH1::GetBin In case the bin number is greater th...
TList * GetListOfFunctions() const
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
virtual void SetEntries(Double_t n)
2-D histogram with a float per channel (see TH1 documentation)}
Int_t Fill(Double_t)
Invalid Fill method.
void SetBlockName(const char *name)
virtual void SetAddress(void *addobj)
Set address of this branch See important remark in the header of THbookTree.
This class is an interface to the Hbook objects in Hbook files.
void 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 variabl...
TObject * Get(Int_t id)
import Hbook object with identifier idd in memory
void DeleteID(Int_t id)
remove id from file and memory
Int_t GetEntryBranch(Int_t entry, Int_t id)
Read in memory only the branch bname.
virtual void Close(Option_t *option="")
Close the Hbook file.
virtual TObject * FindObject(const char *name) const
return object with name in fList in memory
virtual ~THbookFile()
destructor
virtual void SetBranchAddress(Int_t id, const char *bname, void *add)
Set branch address.
virtual Bool_t cd(const char *dirname="")
change directory to dirname
THbookFile()
the constructor
virtual void ls(const char *path="") const
List contents of Hbook directory.
virtual TObject * Convert1D(Int_t id)
Convert an Hbook 1-d histogram into a Root TH1F.
virtual void Browse(TBrowser *b)
to be implemented
virtual TObject * ConvertProfile(Int_t id)
Convert an Hbook profile histogram into a Root TProfile.
virtual TFile * Convert2root(const char *rootname="", Int_t lrecl=0, Option_t *option="")
Convert this Hbook file to a Root file with name rootname.
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
virtual TObject * Convert2D(Int_t id)
Convert an Hbook 2-d histogram into a Root TH2F.
virtual TObject * ConvertCWN(Int_t id)
Convert the Column-Wise-Ntuple id to a Root Tree.
Int_t 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.
virtual TObject * ConvertRWN(Int_t id)
Convert the Row-Wise-Ntuple id to a Root Tree.
A wrapper class supporting Hbook ntuples (CWN and RWN).
A TLeaf for an Integer data type.
virtual Int_t GetMaximum() const
virtual void SetMaximum(Int_t max)
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual TLeaf * GetLeafCount() const
If this leaf stores a variable-sized array or a multi-dimensional array whose last dimension has vari...
virtual void Add(TObject *obj)
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
The TNamed class is the base class for all named ROOT classes.
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
virtual const char * GetTitle() const
Returns title of object.
virtual const char * GetName() const
Returns name of object.
TObject * UncheckedAt(Int_t i) const
Mother of all ROOT objects.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
Int_t Fill(const Double_t *v)
void ToLower()
Change string to lower-case.
const char * Data() const
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual Int_t Exec(const char *shellcmd)
Execute a command.
Double_t Sqrt(Double_t x)