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
146# define hlimit HLIMIT
148# define hropen HROPEN
151# define hnoent HNOENT
153# define hgiven HGIVEN
154# define hgnpar HGNPAR
160# define hdcofl HDCOFL
161# define hmaxim HMAXIM
162# define hminim HMINIM
163# define hdelet HDELET
164# define hntvar2 HNTVAR2
165# define hntvar3 HNTVAR3
166# define hbname HBNAME
167# define hbnamc HBNAMC
177# define type_of_call _stdcall
178# define DEFCHAR const char*, const int
179# define PASSCHAR(string) string, strlen(string)
189 const int&,
const int&);
200 const int&,
const float&,
const float&,
const int&,
const int&);
210 const float&,
const float&);
215extern "C" void type_of_call hntvar2(
const int&,
const int&,
DEFCHAR,
DEFCHAR,
DEFCHAR,
int&,
int&,
int&,
int&,
int&,
fortran_charlen_t,
fortran_charlen_t,
fortran_charlen_t);
282 for (i=0;i<10;i++)
fgLuns[i] = 0;
295 Error(
"THbookFile",
"Too many HbookFiles\n");
312 if (ier) printf (
" Error on hropen was %d \n", ier);
314 printf(
"Error cannot open input file: %s\n",fname);
316 if (ier ||
quest[0]) {
325 gROOT->GetListOfBrowsables()->Add(
this,fname);
329 for (
Int_t key=1;key<1000000;key++) {
333 if (
quest[13] & 8)
continue;
358 b->Add(
fKeys,
"IDs on disk");
368 Int_t nch = strlen(dirname);
380 for (i=0;i<512;i++) cdir[i] =
' ';
389 for (i=510;i>=0;i--) {
390 if (cdir[i] !=
' ')
break;
394 printf(
"fCurdir=%s\n",
fCurDir.Data());
407 gROOT->GetListOfBrowsables()->Remove(
this);
443 return fList->FindObject(obj);
452 for (
Int_t key=1;key<1000000;key++) {
456 if (
quest[13] & 8)
continue;
458 if (
id == idd)
break;
460 if (
id == 0)
return nullptr;
462 printf(
"Error cannot find ID = %d\n",idd);
472 printf(
"WARNING, previous ID=%d is replaced\n",
id);
479 printf(
"Error cannot read ID = %d\n",
id);
499 if (obj)
fList->Add(obj);
505 if (obj)
fList->Add(obj);
511 if (obj)
fList->Add(obj);
525 hgnf(
id,entry+1,
x[0],ier);
527 hgnt(
id,entry+1,ier);
541 hgntf(
id,entry+1,ier);
560 if (!formula)
return;
562 for (
Int_t i=1;i<=ncodes;i++) {
570 if (var == 1 && i == ncodes) last = 1;
617 Int_t nch = strlen(rootname);
620 rfile =
new char[nch+1];
621 strlcpy(rfile,rootname,nch+1);
624 rfile =
new char[nch+1];
625 strlcpy(rfile,
GetName(),nch+1);
626 char *dot = strrchr(rfile,
'.');
627 if (dot) strcpy(dot+1,
"root");
628 else strlcat(rfile,
".root",nch+1);
632 char *cmd =
new char[nch+1];
634 if (opt.
Contains(
"c")) strlcat (cmd,
" 0",nch+1);
635 if (opt.
Contains(
"l")) strlcat (cmd,
" 0",nch+1);
640 if (opt.
Contains(
"no")) {
delete [] rfile;
return nullptr;}
643 if (
f->IsZombie()) {
delete f;
f =
nullptr;}
656 int nsub,itype,isize,ielem;
658 float rmin[1000], rmax[1000];
670 chtag_out =
new char[nvar*nchar+1];
677 chtag_out[nvar*nchar]=0;
678 for (i=0;i<80;i++)
chtitl[i]=0;
680 hgiven(
id,
chtitl,nvar,chtag_out,rmin[0],rmax[0],80,nchar);
682 hgiven(
id,
chtitl,80,nvar,chtag_out,nchar,rmin[0],rmax[0]);
692 strlcpy(oldblock,
"OLDBLOCK",32);
693 Int_t oldischar = -1;
694 for (i=80;i>0;i--) {
if (
chtitl[i] ==
' ')
chtitl[i] = 0; }
699 char *bigbuf = tree->
MakeX(500000);
710 for(i=0; i<nvar;i++) {
713 memset(block,
' ',
sizeof(block));
714 block[
sizeof(block)-1] = 0;
715 memset(fullname,
' ',
sizeof(fullname));
716 fullname[
sizeof(fullname)-1]=0;
718 hntvar2(
id,i+1,
PASSCHAR(
name),
PASSCHAR(fullname),
PASSCHAR(block),nsub,itype,isize,nbits,ielem,32,64,32);
725 if(golower)
name[j] = tolower(
name[j]);
728 if (golower == 2)
name[0] = tolower(
name[0]);
731 if(golower && fullname[j-1] !=
'[') fullname[j] = tolower(fullname[j]);
733 if (golower == 2) fullname[j] = tolower(fullname[j]);
734 if (fullname[j] ==
' ') fullname[j] = 0;
737 if (golower == 2) fullname[0] = tolower(fullname[0]);
739 if (block[j] ==
' ') block[j] = 0;
742 if (itype == 1 && isize == 4) strlcat(fullname,
"/F",64);
743 if (itype == 1 && isize == 8) strlcat(fullname,
"/D",64);
744 if (itype == 2) strlcat(fullname,
"/I",64);
745 if (itype == 3) strlcat(fullname,
"/i",64);
747 if (itype == 4) strlcat(fullname,
"/b",64);
748 if (itype == 5) strlcat(fullname,
"/C",64);
751 if (itype == 5) ischar = 1;
754 if (ischar != oldischar || strcmp(oldblock,block) != 0) {
756 strlcpy(oldblock,block,32);
759 Int_t lblock = strlen(block);
768 Int_t bufsize = 8000;
781 boolflag[i] = bufpos;
784 bufpos += isize*ielem;
787 charflag[i] = bufpos - 1;
788 lenchar[i] = isize * ielem;
818 float rmin[1000], rmax[1000];
831 chtag_out =
new char[nvar*nchar+1];
834 chtag_out[nvar*nchar]=0;
835 for (i=0;i<80;i++)
chtitl[i]=0;
837 hgiven(
id,
chtitl,nvar,chtag_out,rmin[0],rmax[0],80,nchar);
839 hgiven(
id,
chtitl,80,nvar,chtag_out,nchar,rmin[0],rmax[0]);
842 char *
name = chtag_out;
843 for (i=80;i>0;i--) {
if (
chtitl[i] ==
' ')
chtitl[i] = 0; }
850 for(i=0; i<nvar;i++) {
855 for (j=nchar-2;j>0;j--) {
856 if(golower)
name[j] = tolower(
name[j]);
857 if (
name[j] ==
' ' && last == 0)
name[j] = 0;
860 if (golower == 2)
name[0] = tolower(
name[0]);
863 for (j=0;j<nchar;j++) {
864 if (
name[j] !=
' ')
break;
867 Int_t bufsize = 8000;
900 hgive(
id,
chtitl,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb,80);
902 hgive(
id,
chtitl,80,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb);
906 const char *option=
" ";
907 if (
iq[lw] == 1) option =
"S";
908 if (
iq[lw] == 2) option =
"I";
911 const Int_t kCON1 = 9;
915 for (i=1;i<=
ncx;i++) {
939 hgive(
id,
chtitl,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb,80);
941 hgive(
id,
chtitl,80,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb);
949 for (i=0;i<=
ncx;i++) xbins[i] =
q[lbins+i+1];
959 h1->GetListOfFunctions()->Add(
gr);
963 for (i=0;i<=
ncx+1;i++) {
964 x =
h1->GetBinCenter(i);
965 h1->Fill(
x,
hi(
id,i));
967 if (
gr && i>0 && i<=
ncx)
gr->SetPoint(i,
x,
hif(
id,i));
972 h1->SetMaximum(yymax);
976 h1->SetMinimum(yymin);
991 hgive(
id,
chtitl,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb,80);
993 hgive(
id,
chtitl,80,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb);
1000 if (lw) h2->
Sumw2();
1006 h2->
Fill(
x+offsetx,
y+offsety,
hij(
id,i,j));
1022 Int_t nch = strlen(path);
int Int_t
Signed integer 4 bytes (int).
unsigned char UChar_t
Unsigned Character 1 byte (unsigned char).
unsigned int UInt_t
Unsigned integer 4 bytes (unsigned int).
long Long_t
Signed long integer 4 bytes (long). Size depends on architecture.
bool Bool_t
Boolean (0=false, 1=true) (bool).
double Double_t
Double 8 bytes.
float Float_t
Float 4 bytes (float).
const char Option_t
Option string (const char).
TObjArray * GetListOfLeaves()
Using a TBrowser one can browse all ROOT objects.
A file, usually with extension .root, that stores data and code in the form of serialized objects in ...
1-D histogram with a float per channel (see TH1 documentation)
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 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...
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) override
Invalid Fill method.
void SetAddress(void *addobj) override
Set address of this branch See important remark in the header of THbookTree.
void SetBlockName(const char *name)
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.
void ls(const char *path="") const override
List contents of Hbook directory.
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() override
destructor
THbookFile()
the constructor
TObject * FindObject(const char *name) const override
return object with name in fList in memory
virtual TObject * Convert1D(Int_t id)
Convert an Hbook 1-d histogram into a Root TH1F.
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.
void Browse(TBrowser *b) override
to be implemented
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).
virtual void SetType(Int_t atype)
char * MakeX(Int_t nvars)
Long64_t SetEntries(Long64_t n=-1) override
Set the number of entries in the tree header and its branches.
virtual void SetHbookFile(THbookFile *file)
A TLeaf for an Integer data type.
Int_t GetMaximum() const override
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 SetTitle(const char *title="")
Set the title of the TNamed.
const char * GetName() const override
Returns name of object.
const char * GetTitle() const override
Returns title of object.
TObject * UncheckedAt(Int_t i) const
void Add(TObject *obj) override
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
TObject()
TObject constructor.
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 TObjArray * GetListOfBranches()
Double_t Sqrt(Double_t x)
Returns the square root of x.