58 #define PAWC_SIZE 4000000
65 # define hcbits hcbits_
66 # define hcbook hcbook_
76 # define hcbits HCBITS
77 # define hcbook HCBOOK
80 extern "C" int quest[100];
83 extern "C" int rzcl[11];
103 # define hlimit hlimit_
104 # define hldir hldir_
105 # define hropen hropen_
106 # define hrend hrend_
108 # define hnoent hnoent_
109 # define hgive hgive_
110 # define hgiven hgiven_
111 # define hgnpar hgnpar_
114 # define hgntf hgntf_
115 # define hgnt1 hgnt1_
116 # define rzink rzink_
117 # define hdcofl hdcofl_
118 # define hmaxim hmaxim_
119 # define hminim hminim_
120 # define hdelet hdelet_
121 # define hntvar2 hntvar2_
122 # define hntvar3 hntvar3_
123 # define hbname hbname_
124 # define hbnamc hbnamc_
125 # define hbnam hbnam_
131 # define hijxy hijxy_
133 # define hcdir hcdir_
135 # define type_of_call
136 # define DEFCHAR const char*
137 # define PASSCHAR(string) string
139 # define hlimit HLIMIT
141 # define hropen HROPEN
144 # define hnoent HNOENT
146 # define hgiven HGIVEN
147 # define hgnpar HGNPAR
153 # define hdcofl HDCOFL
154 # define hmaxim HMAXIM
155 # define hminim HMINIM
156 # define hdelet HDELET
157 # define hntvar2 HNTVAR2
158 # define hntvar3 HNTVAR3
159 # define hbname HBNAME
160 # define hbnamc HBNAMC
170 # define type_of_call _stdcall
171 # define DEFCHAR const char*, const int
172 # define PASSCHAR(string) string, strlen(string)
178 const int&,
const int&,
const int,
const int,
const int);
182 const int&,
const int&);
190 const int&,
const float&,
const float&,
const int&,
const int&,
const int);
193 const int&,
const float&,
const float&,
const int&,
const int&);
199 const float&,
const float&,
const int,
const int);
203 const float&,
const float&);
208 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);
222 extern "C" void type_of_call hgnf(
const int&,
const int&,
const float&,
const int&);
225 extern "C" void type_of_call rzink(
const int&,
const int&,
const char *,
const int);
235 extern "C" void type_of_call hijxy(
const int&,
const int&,
const int&,
const float&,
const float&);
276 for (i=0;i<10;i++)
fgLuns[i] = 0;
289 Error(
"THbookFile",
"Too many HbookFiles\n");
293 snprintf(topdir,19,
"lun%d",
fLun);
303 snprintf(topdir,19,
"//lun%d",
fLun);
306 if (ier)
printf (
" Error on hropen was %d \n", ier);
308 printf(
"Error cannot open input file: %s\n",fname);
310 if (ier ||
quest[0]) {
319 gROOT->GetListOfBrowsables()->Add(
this,fname);
323 for (
Int_t key=1;key<1000000;key++) {
327 if (
quest[13] & 8)
continue;
362 Int_t nch = strlen(dirname);
374 for (i=0;i<512;i++) cdir[i] =
' ';
383 for (i=510;i>=0;i--) {
384 if (cdir[i] !=
' ')
break;
401 gROOT->GetListOfBrowsables()->Remove(
this);
446 for (
Int_t key=1;key<1000000;key++) {
450 if (
quest[13] & 8)
continue;
452 if (
id == idd)
break;
454 if (
id == 0)
return 0;
456 printf(
"Error cannot find ID = %d\n",idd);
466 printf(
"WARNING, previous ID=%d is replaced\n",
id);
473 printf(
"Error cannot read ID = %d\n",
id);
519 hgnf(
id,entry+1,x[0],ier);
521 hgnt(
id,entry+1,ier);
535 hgntf(
id,entry+1,ier);
554 if (!formula)
return;
556 for (
Int_t i=1;i<=ncodes;i++) {
564 if (var == 1 && i == ncodes) last = 1;
611 Int_t nch = strlen(rootname);
614 rfile =
new char[nch+1];
615 strlcpy(rfile,rootname,nch+1);
618 rfile =
new char[nch+1];
619 strlcpy(rfile,
GetName(),nch+1);
620 char *
dot = strrchr(rfile,
'.');
621 if (dot) strcpy(dot+1,
"root");
622 else strlcat(rfile,
".root",nch+1);
626 char *cmd =
new char[nch+1];
627 snprintf(cmd,nch,
"h2root %s %s",
GetName(),rfile);
628 if (opt.
Contains(
"c")) strlcat (cmd,
" 0",nch+1);
629 if (opt.
Contains(
"l")) strlcat (cmd,
" 0",nch+1);
634 if (opt.
Contains(
"no")) {
delete [] rfile;
return 0;}
650 int nsub,itype,isize,ielem;
652 float rmin[1000], rmax[1000];
654 if (
id > 0) snprintf(
idname,127,
"h%d",
id);
655 else snprintf(
idname,127,
"h_%d",-
id);
664 chtag_out =
new char[nvar*nchar+1];
671 chtag_out[nvar*nchar]=0;
672 for (i=0;i<80;i++)
chtitl[i]=0;
674 hgiven(
id,
chtitl,nvar,chtag_out,rmin[0],rmax[0],80,nchar);
676 hgiven(
id,
chtitl,80,nvar,chtag_out,nchar,rmin[0],rmax[0]);
686 strlcpy(oldblock,
"OLDBLOCK",32);
687 Int_t oldischar = -1;
688 for (i=80;i>0;i--) {
if (
chtitl[i] ==
' ')
chtitl[i] = 0; }
693 char *bigbuf = tree->
MakeX(500000);
704 for(i=0; i<nvar;i++) {
705 memset(name,
' ',
sizeof(name));
706 name[
sizeof(
name)-1] = 0;
707 memset(block,
' ',
sizeof(block));
708 block[
sizeof(block)-1] = 0;
709 memset(fullname,
' ',
sizeof(fullname));
710 fullname[
sizeof(fullname)-1]=0;
712 hntvar2(
id,i+1,
PASSCHAR(name),
PASSCHAR(fullname),
PASSCHAR(block),nsub,itype,isize,nbits,ielem,32,64,32);
719 if(golower) name[j] = tolower(name[j]);
720 if (name[j] ==
' ') name[j] = 0;
722 if (golower == 2) name[0] = tolower(name[0]);
725 if(golower && fullname[j-1] !=
'[') fullname[j] = tolower(fullname[j]);
727 if (golower == 2) fullname[j] = tolower(fullname[j]);
728 if (fullname[j] ==
' ') fullname[j] = 0;
731 if (golower == 2) fullname[0] = tolower(fullname[0]);
733 if (block[j] ==
' ') block[j] = 0;
736 if (itype == 1 && isize == 4) strlcat(fullname,
"/F",64);
737 if (itype == 1 && isize == 8) strlcat(fullname,
"/D",64);
738 if (itype == 2) strlcat(fullname,
"/I",64);
739 if (itype == 3) strlcat(fullname,
"/i",64);
741 if (itype == 4) strlcat(fullname,
"/b",64);
742 if (itype == 5) strlcat(fullname,
"/C",64);
745 if (itype == 5) ischar = 1;
748 if (ischar != oldischar || strcmp(oldblock,block) != 0) {
750 strlcpy(oldblock,block,32);
753 Int_t lblock = strlen(block);
762 Int_t bufsize = 8000;
773 if (itype == 4) {isabool++; boolflag[i] = bufpos; lenbool[i] = ielem;}
774 bufpos += isize*ielem;
775 if (ischar) {isachar++; charflag[i] = bufpos-1; lenchar[i] = isize*ielem;}
804 float rmin[1000], rmax[1000];
806 if (
id > 0) snprintf(
idname,127,
"h%d",
id);
807 else snprintf(
idname,127,
"h_%d",-
id);
817 chtag_out =
new char[nvar*nchar+1];
820 chtag_out[nvar*nchar]=0;
821 for (i=0;i<80;i++)
chtitl[i]=0;
823 hgiven(
id,
chtitl,nvar,chtag_out,rmin[0],rmax[0],80,nchar);
825 hgiven(
id,
chtitl,80,nvar,chtag_out,nchar,rmin[0],rmax[0]);
828 char *
name = chtag_out;
829 for (i=80;i>0;i--) {
if (
chtitl[i] ==
' ')
chtitl[i] = 0; }
836 for(i=0; i<nvar;i++) {
841 for (j=nchar-2;j>0;j--) {
842 if(golower) name[j] = tolower(name[j]);
843 if (name[j] ==
' ' && last == 0) name[j] = 0;
846 if (golower == 2) name[0] = tolower(name[0]);
849 for (j=0;j<nchar;j++) {
850 if (name[j] !=
' ')
break;
853 Int_t bufsize = 8000;
880 if (
id > 0) snprintf(
idname,127,
"h%d",
id);
881 else snprintf(
idname,127,
"h_%d",-
id);
886 hgive(
id,
chtitl,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb,80);
888 hgive(
id,
chtitl,80,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb);
892 const char *option=
" ";
893 if (
iq[lw] == 1) option =
"S";
894 if (
iq[lw] == 2) option =
"I";
897 const Int_t kCON1 = 9;
901 for (i=1;i<=
ncx;i++) {
905 p->
Fill(x+offsetx,y);
921 if (
id > 0) snprintf(
idname,127,
"h%d",
id);
922 else snprintf(
idname,127,
"h_%d",-
id);
925 hgive(
id,
chtitl,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb,80);
927 hgive(
id,
chtitl,80,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb);
935 for (i=0;i<=
ncx;i++) xbins[i] =
q[lbins+i+1];
949 for (i=0;i<=
ncx+1;i++) {
973 if (
id > 0) snprintf(
idname,127,
"h%d",
id);
974 else snprintf(
idname,127,
"h_%d",-
id);
977 hgive(
id,
chtitl,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb,80);
979 hgive(
id,
chtitl,80,
ncx,
xmin,
xmax,
ncy,
ymin,
ymax,
nwt,
idb);
992 h2->
Fill(x+offsetx,
y+offsety,
hij(
id,i,j));
1008 Int_t nch = strlen(path);
void Add(TObject *obj, const char *name=0, Int_t check=-1)
Add object with name to browser.
virtual const char * GetTitle() const
Returns title of object.
A TLeaf describes individual elements of a TBranch See TBranch structure in TTree.
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
TList * GetListOfFunctions() const
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual void SetMaximum(Double_t maximum=-1111)
virtual TObject * ConvertProfile(Int_t id)
Convert an Hbook profile histogram into a Root TProfile.
A ROOT file is a suite of consecutive data records (TKey instances) with a well defined format...
virtual void SetMinimum(Double_t minimum=-1111)
virtual TObject * ConvertRWN(Int_t id)
Convert the Row-Wise-Ntuple id to a Root Tree.
1-D histogram with a float per channel (see TH1 documentation)}
void ToLower()
Change string to lower-case.
virtual TObject * ConvertCWN(Int_t id)
Convert the Column-Wise-Ntuple id to a Root Tree.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual void Browse(TBrowser *b)
to be implemented
TObject * Get(Int_t id)
import Hbook object with identifier idd in memory
const char * Data() const
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 TObjArray * GetListOfBranches()
Double_t dot(const TVector2 &v1, const TVector2 &v2)
The TNamed class is the base class for all named ROOT classes.
virtual void Close(Option_t *option="")
Close the Hbook file.
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 ~THbookFile()
destructor
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
virtual void SetBinError(Int_t bin, Double_t error)
see convention for numbering bins in TH1::GetBin
virtual void SetAddress(void *addobj)
Set address of this branch See important remark in the header of THbookTree.
virtual Bool_t IsOpen() const
Returns kTRUE in case file is open and kFALSE if file is not open.
virtual void SetUniqueID(UInt_t uid)
Set the unique object id.
TObject * UncheckedAt(Int_t i) const
Using a TBrowser one can browse all ROOT objects.
void DeleteID(Int_t id)
remove id from file and memory
virtual Double_t GetBinCenter(Int_t bin) const
return bin center for 1D historam Better to use h1.GetXaxis().GetBinCenter(bin)
R__EXTERN TSystem * gSystem
2-D histogram with a float per channel (see TH1 documentation)}
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...
Int_t Fill(const Double_t *v)
virtual const char * GetName() const
Returns name of object.
void SetBlockName(const char *name)
virtual Int_t Exec(const char *shellcmd)
Execute a command.
char * MakeX(Int_t nvars)
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...
virtual void SetType(Int_t atype)
virtual TLeaf * GetLeafCount() const
Int_t GetEntryBranch(Int_t entry, Int_t id)
Read in memory only the branch bname.
virtual void SetBranchAddress(Int_t id, const char *bname, void *add)
Set branch address.
ClassImp(TMCParticle) void TMCParticle printf(": p=(%7.3f,%7.3f,%9.3f) ;", fPx, fPy, fPz)
virtual Long64_t SetEntries(Long64_t n=-1)
Set the number of entries in the tree header and its branches.
virtual void SetHbookFile(THbookFile *file)
A wrapper class supporting Hbook ntuples (CWN and RWN).
TObjArray * GetListOfLeaves()
virtual Int_t GetMaximum() const
Mother of all ROOT objects.
virtual void SetMaximum(Int_t max)
virtual void SetPoint(Int_t i, Double_t x, Double_t y)
Set x and y values for point number i.
virtual void Add(TObject *obj)
virtual Bool_t cd(const char *dirname="")
change directory to dirname
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
virtual void Sumw2(Bool_t flag=kTRUE)
Create structure to store sum of squares of weights.
A Graph is a graphics object made of two arrays X and Y with npoints each.
This class is an interface to the Hbook objects in Hbook files.
virtual void SetEntries(Double_t n)
virtual TObject * Convert1D(Int_t id)
Convert an Hbook 1-d histogram into a Root TH1F.
ClassImp(THbookFile) THbookFile
the constructor
Double_t Sqrt(Double_t x)
virtual TObject * Convert2D(Int_t id)
Convert an Hbook 2-d histogram into a Root TH2F.
Int_t Fill(Double_t)
Invalid Fill method.
virtual void SetTitle(const char *title="")
Change (i.e. set) the title of the TNamed.
virtual void ls(const char *path="") const
List contents of Hbook directory.
A TLeaf for an Integer data type.
virtual TObject * FindObject(const char *name) const
return object with name in fList in memory