Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

hbook.h

Go to the documentation of this file.
00001 #ifndef HBOOK_H
00002 #define HBOOK_H
00003 
00004 #ifdef __cplusplus
00005 #  include <string>
00006 #  include <algorithm>
00007 #  include <vector>
00008 #endif /* ifdef __cplusplus */
00009 
00010 #ifndef FTYPES_H
00011 #  include "jbltools/kinfit/ftypes.h"
00012 #endif /* #ifndef FTYPES_H */
00013 
00014 #ifdef __cplusplus
00015 #  include "jbltools/kinfit/nhmem.h"
00016 #endif /* ifdef __cplusplus */
00017 
00018 /*
00019 // ******************************************************************************
00020 // *
00021 // * This header file defines wrapper functions for the various HBOOK routines
00022 // * The first part contains the declarations of the FORTRAN routines, in C style
00023 // * (i.e. without references)
00024 // * The second part defines C++ wrappers for these functions
00025 // *
00026 // * This header file should in principle also work for pure ANSI C,
00027 // * all C++ specific stuff is included in "#ifdef _cplusplus" directives.
00028 // *
00029 // * The general philosophy is that all functions can be called from C++ the same
00030 // * way as from FORTRAN. In some cases default arguments are provided, and in some
00031 // * cases, where only one variable serves as output, this variable is also guven
00032 // * as function result valus, and often a form exist where the variable has not to be
00033 // * passed by the calling routine first.
00034 // *
00035 // * Generally, all functions that have strings as arguments take C-style strings
00036 // * and C++ strings as arguments.
00037 // *
00038 // * The routines are ordered according to the
00039 // *  HBOOK reference manual, version 4.24, CERN library long writeup Y250
00040 // *
00041 // * This file also declares the PAWC common, of a size given by NHMEM, which is
00042 // * assumed to be defined as enum in nhmem.h
00043 // * The PAWC common is defined in hbook.cxx, so hbook.o has to be linked to
00044 // * all programs using this hbook header
00045 // * The PAWC common is initialized in a way that ensures proper initialization
00046 // * (i.e. calling of hlimit) before it is ever used by a routine which is
00047 // * defined in a file that includes this header file
00048 // *
00049 // * Benno List
00050 // * CERN -EP/OPAL-
00051 // * CH-1211 Geneva 23
00052 // * Switzerland
00053 // * Benno.List@cern.ch
00054 // *
00055 // * Version 0.99, 3.11.98
00056 // * Version 0.991, 4.11.98
00057 // *
00058 // * Change V0.991, 4.11.98:
00059 // *   handling of string arrays and strings returned from FORTRAN completely new
00060 // *
00061 // ******************************************************************************
00062 */
00063 #ifdef __cplusplus
00064 extern "C" {
00065 #endif /* ifdef __cplusplus */
00066 
00067 /* ============================================================================= */             
00068 /* Chapter 2: One and two dimensional histograms - basics                        */
00069 /* ============================================================================= */             
00070 
00071 /* 2.1 Booking */
00072 
00073 /* 2.1.1 One-dimensional case */
00074 
00075   void hbook1_ (FInteger *id, 
00076                 const FCharacter *chtitl, 
00077                 FInteger *nx, 
00078                 FReal *xmi, 
00079                 FReal *xma, 
00080                 FReal *vmx, 
00081                 FStrLength chtitl_length);
00082                 
00083 /* 2.1.2 Two-dimensional case */
00084 
00085   void hbook2_ (FInteger *id, 
00086                 const FCharacter *chtitl, 
00087                 FInteger *nx, 
00088                 FReal *xmi, 
00089                 FReal *xma, 
00090                 FInteger *ny, 
00091                 FReal *ymi, 
00092                 FReal *yma, 
00093                 FReal *vmx, 
00094                 FStrLength chtitl_length);
00095 
00096 /* 2.2 Filling */
00097 
00098   void hfill_  (FInteger *id, 
00099                 FReal *x, 
00100                 FReal *y, 
00101                 FReal *weight);
00102 
00103 /* 2.3 Editing */
00104                 
00105   void histdo_ ();
00106   void hprint_ (FInteger *id);
00107 
00108 /* 2.4 Copy, rename, reset and delete */
00109 
00110   void hcopy_   (FInteger *id1, 
00111                  FInteger *id2, 
00112                  const FCharacter *chtitl, 
00113                  FStrLength chtitl_length); 
00114   void hcopypr_ (FInteger *id1, 
00115                  FInteger *id2, 
00116                  const FCharacter *chtitl, 
00117                  FInteger *ibinx1, 
00118                  FInteger *ibinx2, 
00119                  FInteger *ibiny1, 
00120                  FInteger *ibiny2, 
00121                  FStrLength chtitl_length); 
00122   void hrenid_  (FInteger *idold, 
00123                  FInteger *idnew); 
00124   void hreset_  (FInteger *id, 
00125                  const FCharacter *chtitl, 
00126                  FStrLength chtitl_length); 
00127   void hdelet_ (FInteger *id);
00128                 
00129 /* ============================================================================= */             
00130 /* Chapter 3: Ntuples                                                            */
00131 /* ============================================================================= */             
00132 
00133 /* 3.2 Row-wise-ntuples (RWN) */
00134 
00135 /* 3.2.1 Booking a RWN */
00136 
00137   void hbookn_ (FInteger *id, 
00138                 const FCharacter *chtitl, 
00139                 FInteger *nvar, 
00140                 const FCharacter *chrzpa, 
00141                 FInteger *nwbuff, 
00142                 const FCharacter *chtags, 
00143                 FStrLength chtitl_length, 
00144                 FStrLength chrzpa_length, 
00145                 FStrLength chtags_length);
00146                 
00147 /* 3.2.2 Filling a RWN */
00148 
00149   void hfn_    (FInteger *id, 
00150                 const FReal x[]);
00151   void hfnov_  (FInteger *id, 
00152                 const FReal x[]);
00153 
00154 /* 3.3 More general ntuples: column-wise-ntuples (CWN) */
00155 
00156 /* 3.3.1 Booking a CWN */
00157 
00158   void hbnt_   (FInteger *id, 
00159                 const FCharacter *chfile, 
00160                 const FCharacter *chopt, 
00161                 FStrLength chfile_length, 
00162                 FStrLength chopt_length);
00163   void hbset_  (const FCharacter *chopt, 
00164                 FInteger *ival,
00165                 FInteger *ierr,
00166                 FStrLength chopt_length);
00167                 
00168 /* 3.3.2 Describing the columns of a CWN */
00169 
00170   void hbname_ (FInteger *id, 
00171                 const FCharacter *chblok, 
00172                 FInteger *variable,
00173                 const FCharacter *chform, 
00174                 FStrLength chblok_length, 
00175                 FStrLength chform_length);
00176   void hbnamc_ (FInteger *id, 
00177                 const FCharacter *chblok, 
00178                 FInteger *variable,
00179                 const FCharacter *chform, 
00180                 FStrLength chblok_length, 
00181                 FStrLength chform_length);
00182 
00183 /* 3.3.3 Creating CHFORM dynamically */
00184 
00185   void hnform_ (const FCharacter *chform, 
00186                 const FCharacter *chname, 
00187                 FInteger *ldim,
00188                 const FCharacter *chtype, 
00189                 FReal *xlow,
00190                 FReal *xhigh,
00191                 FStrLength chform_length, 
00192                 FStrLength chname_length, 
00193                 FStrLength chtype_length);
00194   void hbooknc_(FInteger *id,
00195                 const FCharacter *chtitl, 
00196                 FInteger *nvar,
00197                 const FCharacter *block, 
00198                 FReal *tuple,
00199                 const FCharacter *chtags,
00200                 FStrLength chtitl_length, 
00201                 FStrLength block_length, 
00202                 FStrLength chtags_length);
00203 
00204 /* 3.3.4 Filling a CWN */
00205 
00206   void hfnt_   (FInteger *id);
00207   void hfntb_  (FInteger *id, 
00208                 const FCharacter *chblok, 
00209                 FStrLength chblok_length);
00210   void hprnt_  (FInteger *id);
00211   void hrecov_ (FInteger *id, 
00212                 const FCharacter *chopt, 
00213                 FStrLength chopt_length);
00214 
00215 /* 3.4 Making projections of a RWN */
00216 
00217   void hproj1_ (FInteger *id, 
00218                 FInteger *idn, 
00219                 FInteger *isel, 
00220                 FReal fun(const FReal [], FInteger *), 
00221                 FInteger *ifrom, 
00222                 FInteger *ito, 
00223                 FInteger *ivarx);
00224   void hproj2_ (FInteger *id, 
00225                 FInteger *idn, 
00226                 FInteger *isel, 
00227                 FReal fun(const FReal [], FInteger *), 
00228                 FInteger *ifrom, 
00229                 FInteger *ito, 
00230                 FInteger *ivarx, 
00231                 FInteger *ivary);
00232 
00233 /* 3.5 Get information about an ntuple */
00234 
00235   void hgiven_ (FInteger *id,
00236                 FCharacter *chtitl,
00237                 FInteger *nvar,
00238                 FCharacter *chtag,
00239                 FReal rlow[],
00240                 FReal rhigh[],
00241                 FStrLength chtitl_length,
00242                 FStrLength chtag_length);
00243 
00244 /* 3.5.1 Retrieve the contents of a RWN into an array */
00245 
00246   void hgn_    (FInteger *id,
00247                 FInteger *idn,
00248                 FInteger *idnevt,
00249                 FReal x[],
00250                 FInteger *ierror);
00251   void hgnpar_ (FInteger *id, 
00252                 const FCharacter *chrout, 
00253                 FStrLength chrout_length); 
00254   void hgnf_   (FInteger *id,
00255                 FInteger *idnevt,
00256                 FReal x[],
00257                 FInteger *ierror);
00258 
00259 /* 3.5.2 Retrieve the contents of a CWN into a common block */
00260 
00261   void hgnt_   (FInteger *id, 
00262                 FInteger *idnevt, 
00263                 FInteger *ierr);
00264   void hgntb_  (FInteger *id, 
00265                 const FCharacter *chblok, 
00266                 FInteger *irow, 
00267                 FInteger *ierr, 
00268                 FStrLength chblok_length);
00269   void hgntv_  (FInteger *id, 
00270                 const FCharacter *chvar,
00271                 FInteger *nvar,
00272                 FInteger *irow,
00273                 FInteger *ierr,
00274                 FStrLength chvar_length);
00275   void hgntf_  (FInteger *id, 
00276                 FInteger *irow,
00277                 FInteger *ierr);
00278   /* hntvdef_ */
00279 
00280 /* 3.5.3 Generate a user function */
00281 
00282   void huwfun_ (FInteger *lun,
00283                 FInteger *id,
00284                 const FCharacter *chfun,
00285                 FInteger *itrunc,
00286                 const FCharacter *chopt,
00287                 FStrLength chfun_length,
00288                 FStrLength chopt_length);
00289 
00290 /* 3.6 Ntuple operations */
00291 
00292   void hntdup_ (FInteger *id1,
00293                 FInteger *id2,
00294                 FInteger *newbuf,
00295                 const FCharacter *chtitl,
00296                 const FCharacter *chopt,
00297                 FStrLength chtitl_length,
00298                 FStrLength chopt_length);
00299   void hrename_(FInteger *id,
00300                 const FCharacter *chold,
00301                 const FCharacter *chnew,
00302                 FStrLength chold_length,
00303                 FStrLength chnew_length);
00304   void hconvol_(FInteger *id1,
00305                 FInteger *id2,
00306                 FInteger *id3,
00307                 FInteger *ierror);
00308   
00309 /* ============================================================================= */             
00310 /* Chapter 4: Advanced features for booking and editing operations               */
00311 /* ============================================================================= */             
00312 
00313 /* 4.1 Overview of booking options */
00314 
00315 /* 4.1.1 Histograms with non-equidistant bins */
00316 
00317   void hbookb_ (FInteger *id, 
00318                 const FCharacter *chtitl, 
00319                 FInteger *ncx, 
00320                 const FReal xbins[], 
00321                 FReal *vmx, 
00322                 FStrLength chtitl_length);
00323 
00324 /* 4.1.2 Profile histograms */
00325 
00326   void hbprof_ (FInteger *id, 
00327                 const FCharacter *chtitl, 
00328                 FInteger *ncx, 
00329                 FReal *xlow, 
00330                 FReal *xup, 
00331                 FReal *ymin, 
00332                 FReal *ymax, 
00333                 const FCharacter *chopt, 
00334                 FStrLength chtitl_length, 
00335                 FStrLength chopt_length);
00336 
00337 /* 4.1.3 Rounding */
00338 
00339   void hbinsz_ (const FCharacter *chopt, 
00340                 FStrLength chopt_length);
00341 
00342 /* 4.1.4 Projections, slices, bands */
00343 
00344   void hbpro_  (FInteger *id, 
00345                 FReal *vmx);
00346   void hbprox_ (FInteger *id, 
00347                 FReal *vmx);
00348   void hbproy_ (FInteger *id, 
00349                 FReal *vmx);
00350   void hbandx_ (FInteger *id, 
00351                 FReal *ymi, 
00352                 FReal *yma, 
00353                 FReal *vmx);
00354   void hbandy_ (FInteger *id, 
00355                 FReal *xmi, 
00356                 FReal *xma, 
00357                 FReal *vmx);
00358   void hbslix_ (FInteger *id, 
00359                 FInteger *nsli, 
00360                 FReal *vmx);
00361   void hbsliy_ (FInteger *id, 
00362                 FInteger *nsli, 
00363                 FReal *vmx);
00364 
00365 /* 4.1.5 Statistics */
00366 
00367   void hbarx_  (FInteger *id);
00368   void hbary_  (FInteger *id);
00369   void hbar2_  (FInteger *id);
00370 
00371 /* 4.1.6 Function representation */
00372 
00373   void hbfun1_ (FInteger *id, 
00374                 const FCharacter *chtitl, 
00375                 FInteger *nx, 
00376                 FReal *xmi, 
00377                 FReal *xma, 
00378                 FReal fun(const FReal *), 
00379                 FStrLength chtitl_length);
00380   void hbfun2_ (FInteger *id, 
00381                 const FCharacter *chtitl, 
00382                 FInteger *nx, 
00383                 FReal *xmi, 
00384                 FReal *xma, 
00385                 FInteger *ny, 
00386                 FReal *ymi, 
00387                 FReal *yma, 
00388                 FReal fun(const FReal *, const FReal *), 
00389                 FStrLength chtitl_length);
00390   void hfunc_  (FInteger *id, 
00391                 FReal fun(const FReal *));
00392                
00393 /* 4.1.7 Reserve array in memory */
00394 
00395   void harray_ (FInteger *id,
00396                 FInteger *nwords,
00397                 FInteger *loc);
00398 
00399 /* 4.1.8 Axis labels and histograms */
00400 
00401   void hlabel_ (FInteger *id,
00402                 FInteger *nlab,
00403                 FCharacter *clab,
00404                 const FCharacter *chopt,
00405                 FStrLength chlab_length,
00406                 FStrLength chopt_length); 
00407 
00408 /* 4.2 Filling operations */
00409 
00410 /* 4.2.1 Fast filling entries */
00411 
00412   void hf1_    (FInteger *id,
00413                 FReal *x,
00414                 FReal *weight);
00415   void hf1e_   (FInteger *id,
00416                 FReal *x,
00417                 FReal *weight,
00418                 FReal *errors);
00419   void hf2_    (FInteger *id,
00420                 FReal *x,
00421                 FReal *y,
00422                 FReal *weight);
00423   void hff1_   (FInteger *id,
00424                 FInteger *nid,
00425                 FReal *x,
00426                 FReal *weight);
00427   void hff2_   (FInteger *id,
00428                 FInteger *nid,
00429                 FReal *x,
00430                 FReal *y,
00431                 FReal *weight);
00432   void hfpak1_ (FInteger *id,
00433                 FInteger *nid,
00434                 const FReal v[],
00435                 FInteger *n);
00436   void hipak1_ (FInteger *id,
00437                 FInteger *nid,
00438                 const FInteger iv[],
00439                 FInteger *n);
00440   
00441 /* 4.2.2 Global filling */
00442 
00443   void hpak_   (FInteger *id,
00444                 const FReal conten[]);
00445   void hpakad_ (FInteger *id,
00446                 const FReal conten[]);
00447   void hpake_  (FInteger *id,
00448                 const FReal errors[]);
00449 
00450 /* 4.2.3 Filling histograms using character variables */
00451 
00452   void hfc1_   (FInteger *id,
00453                 FInteger *ibin,
00454                 const FCharacter *clab,
00455                 FReal *w,
00456                 const FCharacter *chopt,
00457                 FStrLength chlab_length,
00458                 FStrLength chopt_length);
00459   void hfc2_   (FInteger *id,
00460                 FInteger *ibinx,
00461                 const FCharacter *clabx,
00462                 FInteger *ibiny,
00463                 const FCharacter *claby,
00464                 FReal *w,
00465                 const FCharacter *chopt,
00466                 FStrLength chlabx_length,
00467                 FStrLength chlaby_length,
00468                 FStrLength chopt_length);
00469 
00470 /* 4.3 Editing operations */
00471 
00472 /* 4.3.1 Index and general title */
00473 
00474   void hindex_ ();
00475   void htitle_ (const FCharacter *chgtit, 
00476                 FInteger chgtit_length);
00477 
00478 /* 4.3.2 What to print (1-dimensional histogram) */
00479 
00480   void hidopt_ (FInteger *id, 
00481                 const FCharacter *chopt, 
00482                 FStrLength chopt_length);
00483   void hstaf_  (const FCharacter *chopt, 
00484                 FStrLength chopt_length);
00485 
00486 /* 4.3.3 Graphic choices (1-dimensional histogram) */
00487 
00488   void hpchar_ (const FCharacter *chopt, 
00489                 FCharacter *charac,
00490                 FStrLength chopt_length);
00491   void hbigbi_ (FInteger *id,
00492                 FInteger *ncol); 
00493 
00494 /* 4.3.4 Scale definition and normalization */
00495 
00496   void hmaxim_ (FInteger *id,
00497                 FReal *fmax); 
00498   void hminim_ (FInteger *id,
00499                 FReal *fmin); 
00500   void hcompa_ (const FInteger idvect[],
00501                 FInteger *n); 
00502   void hnorma_ (FInteger *id,
00503                 FReal *xnorm); 
00504   void hscale_ (FInteger *id, FReal *factor);
00505 
00506 /* 4.3.5 Page control */
00507 
00508   void hsquez_ (const FCharacter *chopt, 
00509                 FStrLength chopt_length);
00510   void hpagsz_ (FInteger *nlines);
00511 
00512 /* 4.3.6 selective editing */
00513 
00514   void hphist_ (FInteger *id,
00515                 const FCharacter *choice, 
00516                 FInteger *num,
00517                 FStrLength choice_length);
00518   void hprot_  (FInteger *id,
00519                 const FCharacter *choice, 
00520                 FInteger *num,
00521                 FStrLength choice_length);
00522   void hpscat_  (FInteger *id);
00523   void hptab_   (FInteger *id);
00524   void hphs_    (FInteger *id);
00525   void hphst_   (FInteger *id);
00526 
00527 /* 4.3.7 Printing after system error recovery */
00528 
00529   void hponce_ ();
00530 
00531 /* 4.3.8 Changing logical unit numbers for output and message files */
00532 
00533   void houtpu_ (FInteger *lout);
00534   void hermes_ (FInteger *lerr);
00535 
00536 /* ============================================================================= */             
00537 /* Chapter 5: Accessing Information                                              */
00538 /* ============================================================================= */             
00539                 
00540 /* 5.1: Testing if a histogram exists in memory */
00541 
00542   FLogical hexist_ (FInteger *id); 
00543                 
00544 /* 5.2 List of histograms */
00545 
00546   void hid1_   (FInteger idvect[],
00547                 FInteger *n);
00548   void hid2_   (FInteger idvect[],
00549                 FInteger *n);
00550   void hidall_ (FInteger idvect[],
00551                 FInteger *n);
00552 
00553 /* 5.3 Number of entries */
00554 
00555   void hnoent_ (FInteger *id,
00556                 FInteger *noent);
00557 
00558 /* 5.4 Histogram attributes contents */
00559 
00560   void hkind_  (FInteger *id,
00561                 FInteger kind[],
00562                 const FCharacter *chopt, 
00563                 FStrLength chopt_length);
00564                 
00565 /* 5.5 Contents */
00566                                                 
00567   void hunpak_ (FInteger *id,
00568                 FReal conten[],
00569                 const FCharacter *choice,   
00570                 FInteger * num,     
00571                 FStrLength choice_length);
00572   FReal hi_    (FInteger *id,
00573                 FInteger *i);
00574   FReal hij_   (FInteger *id,
00575                 FInteger *i,
00576                 FInteger *j);
00577   FReal hx_    (FInteger *id,
00578                 FReal *x);
00579   FReal hxy_   (FInteger *id,
00580                 FReal *x,
00581                 FReal *y);
00582 
00583 /* 5.6 Errors */               
00584                 
00585   void hunpke_ (FInteger *id,
00586                 FReal conten[],
00587                 const FCharacter *choice,   
00588                 FInteger * num,     
00589                 FStrLength choice_length);
00590   FReal hie_   (FInteger *id,
00591                 FInteger *i);
00592   FReal hije_  (FInteger *id,
00593                 FInteger *i,
00594                 FInteger *j);
00595   FReal hxe_   (FInteger *id,
00596                 FReal *x);
00597   FReal hxye_  (FInteger *id,
00598                 FReal *x,
00599                 FReal *y);
00600                 
00601 /* 5.7 Associated function */ 
00602                 
00603   FReal hif_   (FInteger *id,
00604                 FInteger *i);
00605 
00606 /* 5.8 Abscissa to channel number */ 
00607                 
00608   FReal hxi_   (FInteger *id,
00609                 FReal *x,
00610                 FInteger *i);
00611   FReal hxyij_ (FInteger *id,
00612                 FReal *x,
00613                 FReal *y,
00614                 FInteger *i,
00615                 FInteger *j);
00616   FReal hix_   (FInteger *id,
00617                 FInteger *i,
00618                 FReal *x);
00619   FReal hijxy_ (FInteger *id,
00620                 FInteger *i,
00621                 FInteger *j,
00622                 FReal *x,
00623                 FReal *y);
00624                 
00625 /* 5.9 Maximum and minimum */
00626 
00627   FReal hmax_  (FInteger *id);
00628   FReal hmin_  (FInteger *id);
00629   
00630 // 5.10 Rebinning */
00631 
00632   void hrebin_ (FInteger *id, 
00633                 FReal x[], 
00634                 FReal y[],
00635                 FReal ex[], 
00636                 FReal ey[],
00637                 FInteger *n, 
00638                 FInteger *ifirst, 
00639                 FInteger *ilast);
00640 
00641 /* 5.11 Integrated contents */
00642 
00643   FReal hsum_  (FInteger *id);
00644   
00645 /* 5.12 Histogram definition */
00646 
00647   FReal hdump_ (FInteger *id);
00648   void hgive_  (FInteger *id,
00649                 FCharacter chtitl[80],
00650                 FInteger *nx,
00651                 FReal *xmi,
00652                 FReal *xma,
00653                 FInteger *ny,
00654                 FReal *ymi,
00655                 FReal *yma,
00656                 FInteger *nwt,
00657                 FInteger *loc,
00658                 FStrLength chtitl_length);
00659 
00660 /* 5.13 Statistics */
00661 
00662   FReal hstati_ (FInteger *id,
00663                 FInteger *icase,
00664                 const FCharacter *choice,   
00665                 FInteger * num,     
00666                 FStrLength choice_length);
00667   
00668 /* ============================================================================= */             
00669 /* Chapter 6: Operations on histograms                                           */
00670 /* ============================================================================= */             
00671 
00672 /* 6.1 Arithmetic operations  */               
00673 
00674   void hopera_(FInteger *id1, 
00675                const FCharacter *choper,
00676                FInteger *id2, 
00677                FInteger *id3, 
00678                FReal *c1,  
00679                FReal *c2, 
00680                FStrLength choper_length);
00681 
00682 /* 6.2 Statistical differences between histograms */
00683 
00684   void hdiff_  (FInteger *id1, 
00685                 FInteger *id2, 
00686                 FReal *prob,
00687                 const FCharacter *chopt,
00688                 FStrLength chopt_length);
00689 
00690 /* 6.3 Bin by bin histogram comparisons */
00691 
00692   void hdiffb_ (FInteger *id1, 
00693                 FInteger *id2, 
00694                 FReal *tol,
00695                 FInteger *nbins,
00696                 const FCharacter *chopt,
00697                 FInteger *nbad,
00698                 FReal diff[],
00699                 FStrLength chopt_length);
00700   
00701 /* ============================================================================= */             
00702 /* Chapter 7: Fitting, parametrization and smoothing                             */
00703 /* ============================================================================= */             
00704 
00705 /* 7.1 Fitting */
00706 
00707 /* 7.1.1 One and two-dimensional distributions */
00708 
00709   void hfith_ (FInteger *id,
00710                FReal fun(FReal *), 
00711                const FCharacter *chopt,
00712                FInteger *np,
00713                FReal param [],
00714                const FReal step [],
00715                const FReal pmin [],
00716                const FReal pmax [],
00717                FReal sigpar [],
00718                FReal *chi2,
00719                FStrLength chopt_length);
00720 
00721 /* 7.1.2 Fitting one-dimensional histograms with special functions */
00722 
00723   void hfitn_ (FInteger *id,
00724                const FCharacter *chfun, 
00725                const FCharacter *chopt,
00726                FInteger *np,
00727                FReal param [],
00728                const FReal step [],
00729                const FReal pmin [],
00730                const FReal pmax [],
00731                FReal sigpar [],
00732                FReal *chi2,
00733                FStrLength chfun_length,
00734                FStrLength chopt_length);
00735 
00736 /* 7.1.3 Fitting one or multi-dimensional arrays */
00737 
00738   void hfitv_ (FInteger *n,
00739                FInteger *ndim,
00740                FInteger *nvar,
00741                const FReal x[],
00742                const FReal y[],
00743                const FReal ey[],
00744                FReal fun(FReal *), 
00745                const FCharacter *chopt,
00746                FInteger *np,
00747                FReal param [],
00748                const FReal step [],
00749                const FReal pmin [],
00750                const FReal pmax [],
00751                FReal sigpar [],
00752                FReal *chi2,
00753                FStrLength chopt_length);
00754 
00755 /* 7.1.4 Naming the parameters of a fit */
00756 
00757   void hfinam_ (FInteger *id, 
00758                 const FCharacter *chpnam,
00759                 FInteger *npar,
00760                 FStrLength chpnam_length);
00761   void hgfit_  (FInteger *id,              
00762                 FInteger *nfpar,
00763                 FInteger *npfits,
00764                 FReal *fitchi,
00765                 FReal fitpar [],
00766                 FReal fitsig [],
00767                 FCharacter *fitnam,
00768                 FStrLength fitnam_length);
00769                 
00770 /* 7.1.5 The user parametric function */
00771 
00772   void hderiv_ (FReal deriv[]);
00773 
00774 /* 7.2 Basic concepts of Minuit */
00775 
00776 /* 7.3 Deprecated fitting routines */
00777 
00778 /* The following deprecated routines are not supported by this package:
00779   // hfitl_
00780   // hfits_
00781   // hfitn_
00782   // hfit1_
00783   // hfitex_
00784   // hfitga_
00785   // hfitpo_
00786 */
00787 
00788 /* 7.4 Parametrization */
00789 
00790   void hparam_ (FInteger *id,
00791                 FInteger *ic,
00792                 FReal *r2min,
00793                 const FInteger maxpow [],
00794                 FInteger iterm [],
00795                 FInteger *nco,
00796                 FReal8 coeff []);
00797   void hsetpr_ (const FCharacter *chname,
00798                 FReal *value,
00799                 FStrLength chname_length);
00800   void hparmn_ (const FReal x [],
00801                 const FReal y [],
00802                 const FReal ey [],
00803                 FInteger *np,
00804                 FInteger *nvar,
00805                 FInteger *ic,
00806                 FReal *r2min,
00807                 const FInteger maxpow [],
00808                 FReal8 coeff [],
00809                 FInteger iterm [],
00810                 FInteger *nco);
00811 
00812 /* 7.5 Smoothing */
00813 
00814   void hsmoof_ (FInteger *id,
00815                 FInteger *icase,
00816                 FReal *chi2);
00817   void hspli1_ (FInteger *id,
00818                 FInteger *ic,
00819                 FInteger *n,
00820                 FInteger *k,
00821                 FReal *chi2);
00822   void hspli2_ (FInteger *id,
00823                 FInteger *nx,
00824                 FInteger *ny,
00825                 FInteger *kx,
00826                 FInteger *ky);
00827   FReal hspfun_ (FInteger *id,
00828                  FReal *x,
00829                  FInteger *n,
00830                  FInteger *k);
00831   void hquad_  (FInteger *id,
00832                 const FCharacter *chopt,
00833                 FInteger *mode,
00834                 FReal *sensit,
00835                 FReal *smooth,
00836                 FInteger *nsig,
00837                 FReal *chisq,
00838                 FInteger *ndf,
00839                 FReal *fmin,
00840                 FReal *fmax,
00841                 FInteger *ierr,
00842                 FStrLength chopt_length);
00843   
00844 /* 7.6 Random number generation */
00845 
00846   FReal hrndm1_ (FInteger *id);
00847   void hrndm2_ (FInteger *id, FReal *rx, FReal *ry);
00848 
00849 /* 7.7 Fitting with Monte Carlo statistics */
00850 
00851   void hmcmll_ (FInteger *idd,
00852                 const FInteger idm[],
00853                 const FInteger idw[],
00854                 FInteger *nsrc,
00855                 const FCharacter *chopt,
00856                 const FInteger ifix[],
00857                 const FReal frc[],
00858                 const FReal flim[][2],
00859                 const FReal start[],
00860                 const FReal step[],
00861                 FReal *up,
00862                 FReal par[],
00863                 FReal dpar[],
00864                 FStrLength chopt_length);
00865   void hmcini_ (FInteger *iddata, 
00866                 const FInteger idmc[],
00867                 const FInteger idwt[],
00868                 FInteger *nsrc,
00869                 const FCharacter *chopt,
00870                 FInteger *ierr,
00871                 FStrLength chopt_length);
00872                 
00873   FReal8 hmclnl_ (const FReal frac[]);
00874   
00875 /* ============================================================================= */             
00876 /* Chapter 8: Memory management and input/output routines                        */
00877 /* ============================================================================= */             
00878 
00879 /* 8.2 Memory size control */
00880 
00881   void hlimit_ (FInteger *npaw);
00882   void hlocat_ (FInteger *id,
00883                 FInteger *loc);
00884   
00885 /* 8.3 Directories */
00886 
00887   void hmdir_  (const FCharacter *chpath, 
00888                 const FCharacter *chopt, 
00889                 FStrLength chpath_length, 
00890                 FStrLength chopt_length);
00891   void hcdir_  (const FCharacter *chpath, 
00892                 const FCharacter *chopt, 
00893                 FStrLength chpath_length, 
00894                 FStrLength chopt_length);
00895   void hldir_  (const FCharacter *chpath, 
00896                 const FCharacter *chopt, 
00897                 FStrLength chpath_length, 
00898                 FStrLength chopt_length);
00899   void hddir_  (const FCharacter *chpath, 
00900                 FStrLength chpath_length);
00901   void hpdir_  (const FCharacter *chpath, 
00902                 const FCharacter *chopt, 
00903                 FStrLength chpath_length, 
00904                 FStrLength chopt_length);
00905   void hlnext_ (FInteger *idh,
00906                 FCharacter *chtype, 
00907                 FCharacter *chtitl, 
00908                 const FCharacter *chopt, 
00909                 FStrLength chtype_length, 
00910                 FStrLength chtitl_length, 
00911                 FStrLength chopt_length);
00912   void hrdir_  (FInteger *maxdir,
00913                 FCharacter *chdir,
00914                 FInteger *ndir,
00915                 FStrLength chdir_length);
00916                       
00917 /* 8.4 Input/output routines */
00918 
00919   void hrput_  (FInteger *id, 
00920                 const FCharacter *chfile, 
00921                 const FCharacter *chopt, 
00922                 FStrLength chfile_length, 
00923                 FStrLength chopt_length);
00924   void hrget_  (FInteger *id, 
00925                 const FCharacter *chfile, 
00926                 const FCharacter *chopt, 
00927                 FStrLength chfile_length, 
00928                 FStrLength chopt_length);
00929   void hropen_ (FInteger *lun, 
00930                 const FCharacter *chtop, 
00931                 const FCharacter *chfile, 
00932                 const FCharacter *chopt, 
00933                 FInteger *lrec, 
00934                 FInteger *istat, 
00935                 FStrLength chtop_length, 
00936                 FStrLength chfile_length, 
00937                 FStrLength chopt_length);
00938   void hrfile_ (FInteger *lun, 
00939                 const FCharacter *chtop, 
00940                 const FCharacter *chopt, 
00941                 FStrLength chtop_length, 
00942                 FStrLength chopt_length);
00943   void hrout_  (FInteger *id, 
00944                 FInteger *icycle, 
00945                 const FCharacter *chopt, 
00946                 FStrLength chopt_length);
00947   void hrin_   (FInteger *id, 
00948                 FInteger *icycle, 
00949                 FInteger *ioffset);
00950   void hmerge_ (FInteger *nfiles,
00951                 const FCharacter *chfin,
00952                 const FCharacter *chfout,
00953                 FStrLength chfin_length,
00954                 FStrLength chfout_length);
00955   void hmergin_ ();
00956   void hscr_   (FInteger *id, 
00957                 FInteger *icycle,
00958                 const FCharacter *chopt, 
00959                 FStrLength chopt_length);
00960   void hrend_  (const FCharacter *chtop, 
00961                 FStrLength chtop_length); 
00962                 
00963 #ifdef __cplusplus
00964 } // extern "C" 
00965 #endif /* ifdef __cplusplus */
00966 
00967 #ifdef __cplusplus
00968 
00969 // Global helper functions
00970 
00971 using std::string;
00972 using std::vector;
00973 
00974 void charray_to_fortran (int n, 
00975                          int charraylen,
00976                          const FCharacter *charrayin,
00977                          FCharacter *& charrayout);
00978 void charray_from_fortran (int n, 
00979                            int charraylen,
00980                            const FCharacter *charrayin,
00981                            FCharacter *& charrayout);
00982 void string_to_fortran (int n, 
00983                         unsigned int& charraylen,
00984                         const string sarrayin[],
00985                         FCharacter *& charrayout);
00986 void string_to_fortran (unsigned int& charraylen,
00987                         const vector<string>& sarrayin,
00988                         FCharacter *& charrayout);
00989 void string_from_fortran (int n, 
00990                           unsigned int charraylen,
00991                           const FCharacter *charrayin,
00992                           string sarrayout[]);
00993 void string_from_fortran (unsigned int charraylen,
00994                           const FCharacter *charrayin,
00995                           string& sout);
00996 
00997 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
00998 // C++ wrappers start here
00999 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
01000 
01001 // =============================================================================            
01002 // Chapter 2: One and two dimensional histograms - basics
01003 // =============================================================================             
01004 
01005 // 2.1 Booking
01006 
01007 // 2.1.1 One-dimensional case
01008 
01009 inline void hbook1 (FInteger id, 
01010                     const FCharacter *chtitl, 
01011                     FInteger nx, 
01012                     FReal xmi, 
01013                     FReal xma, 
01014                     FReal vmx = 0) {
01015   hbook1_ (&id, chtitl, &nx, &xmi, &xma, &vmx, strlen (chtitl));
01016 }
01017 inline void hbook1 (FInteger id, 
01018                     const string& chtitl, 
01019                     FInteger nx, 
01020                     FReal xmi, 
01021                     FReal xma, 
01022                     FReal vmx = 0) {
01023   hbook1_ (&id, chtitl.c_str(), &nx, &xmi, &xma, &vmx, chtitl.length());
01024 }
01025 
01026 // 2.1.2 Two-dimensional case
01027 
01028 inline void hbook2 (FInteger id, 
01029                     const FCharacter *chtitl, 
01030                     FInteger nx, 
01031                     FReal xmi, 
01032                     FReal xma, 
01033                     FInteger ny, 
01034                     FReal ymi, 
01035                     FReal yma, 
01036                     FReal vmx = 0) {
01037   hbook2_ (&id, chtitl, &nx, &xmi, &xma, &ny, &ymi, &yma, &vmx, strlen (chtitl));
01038 }
01039 inline void hbook2 (FInteger id, 
01040                     const string& chtitl, 
01041                     FInteger nx, 
01042                     FReal xmi, 
01043                     FReal xma, 
01044                     FInteger ny, 
01045                     FReal ymi, 
01046                     FReal yma, 
01047                     FReal vmx = 0) {
01048   hbook2_ (&id, chtitl.c_str(), &nx, &xmi, &xma, &ny, &ymi, &yma, &vmx, chtitl.length());
01049 }
01050 
01051 // 2.2 Filling 
01052 
01053 inline void hfill (FInteger id, 
01054                    FReal x, 
01055                    FReal y = 0, 
01056                    FReal weight = 1) {
01057   hfill_ (&id, &x, &y, &weight);
01058 }
01059 
01060 // 2.3 Editing
01061 
01062 inline void histdo () {
01063   histdo_();
01064 }
01065 inline void hprint (FInteger id = 0) {
01066   hprint_ (&id);
01067 }
01068 
01069 // 2.4 Copy, rename, reset and delete
01070 
01071 inline void hcopy  (FInteger id1, 
01072                     FInteger id2, 
01073                     const FCharacter *chtitl = " ")  {
01074   hcopy_ (&id1, &id2, chtitl, strlen (chtitl));
01075 }
01076 inline void hcopy  (FInteger id1, 
01077                     FInteger id2, 
01078                     const string& chtitl)  {
01079   hcopy_ (&id1, &id2, chtitl.c_str(), chtitl.length());
01080 }
01081 inline void hcopypr (FInteger id1, 
01082                      FInteger id2, 
01083                      const FCharacter *chtitl, 
01084                      FInteger ibinx1, 
01085                      FInteger ibinx2, 
01086                      FInteger ibiny1 = 0, 
01087                      FInteger ibiny2 = 0) {
01088   hcopypr_ (&id1, &id2, chtitl, &ibinx1, &ibinx2, &ibiny1, &ibiny2, strlen (chtitl));
01089 }  
01090 inline void hcopypr (FInteger id1, 
01091                      FInteger id2, 
01092                      const string& chtitl, 
01093                      FInteger ibinx1, 
01094                      FInteger ibinx2, 
01095                      FInteger ibiny1 = 0, 
01096                      FInteger ibiny2 = 0) {
01097   hcopypr_ (&id1, &id2, chtitl.c_str(), &ibinx1, &ibinx2, &ibiny1, &ibiny2, chtitl.length());
01098 }  
01099 inline void hcopypr (FInteger id1, 
01100                      FInteger id2, 
01101                      FInteger ibinx1, 
01102                      FInteger ibinx2, 
01103                      FInteger ibiny1 = 0, 
01104                      FInteger ibiny2 = 0) {
01105   hcopypr_ (&id1, &id2, " ", &ibinx1, &ibinx2, &ibiny1, &ibiny2, 1);
01106 }  
01107 inline void hrenid  (FInteger idold, 
01108                      FInteger idnew) {
01109   hrenid_ (&idold, &idnew);
01110 }
01111 inline void hreset  (FInteger id, 
01112                      const FCharacter *chtitl = " ") {
01113   hreset_ (&id, chtitl, strlen (chtitl));
01114 }                
01115 inline void hreset  (FInteger id, 
01116                      const string& chtitl) {
01117   hreset_ (&id, chtitl.c_str(), chtitl.length());
01118 }                              
01119 inline void hdelet (FInteger id) {
01120   hdelet_ (&id);
01121 }
01122                 
01123 // =============================================================================             
01124 // Chapter 3: Ntuples
01125 // =============================================================================             
01126 
01127 // 3.2 Row-wise-ntuples (RWN)
01128 
01129 // 3.2.1 Booking a RWN
01130 
01131 template<int chtagslen>
01132 void hbookn (FInteger id, 
01133              const FCharacter *chtitl, 
01134              FInteger nvar, 
01135              const FCharacter *chrzpa, 
01136              FInteger nwbuff, 
01137              const FCharacter chtags [][chtagslen]) {
01138   FCharacter *chtags_ = new FCharacter [nvar*chtagslen];
01139   charray_to_fortran (nvar, chtagslen, chtags, chtags_); 
01140   hbookn_ (&id, chtitl, &nvar, chrzpa, &nwbuff, chtags_,
01141             strlen (chtitl), strlen (chrzpa), chtagslen);
01142   delete[] chtags_;
01143 }
01144 void hbookn (FInteger id, 
01145              const string& chtitl, 
01146              FInteger nvar, 
01147              const string& chrzpa, 
01148              FInteger nwbuff, 
01149              const string chtags[]);
01150                     
01151 // 3.2.2 Filling a RWN
01152 
01153 inline void hfn    (FInteger id, 
01154                     const FReal x[]) {
01155   hfn_ (&id, x);
01156 }
01157 inline void hfnov  (FInteger id,  
01158                     const FReal x[]) {
01159   hfnov_ (&id, x);
01160 }
01161 
01162 // 3.3 More general ntuples: column-wise-ntuples (CWN)
01163 
01164 // 3.3.1 Booking a CWN
01165 
01166 inline void hbnt  (FInteger id, 
01167                    const FCharacter *chfile = " ", 
01168                    const FCharacter *chopt = " ") {
01169   hbnt_ (&id, chfile, chopt, strlen (chfile), strlen (chopt));
01170 }
01171 inline void hbnt  (FInteger id, 
01172                    const string& chfile, 
01173                    const string& chopt = " ") {
01174   hbnt_ (&id, chfile.c_str(), chopt.c_str(), chfile.length(), chopt.length());
01175 }
01176 inline FInteger hbset  (const FCharacter *chopt, 
01177                    FInteger ival,
01178                    FInteger& ierr) {
01179   hbset_ (chopt, &ival, &ierr, strlen (chopt));
01180   return ierr;
01181 }
01182 inline FInteger hbset  (FInteger ival,
01183                    FInteger& ierr) {
01184   const FCharacter *chopt = "BSIZE";
01185   hbset_ (chopt, &ival, &ierr, strlen (chopt));
01186   return ierr;
01187 }
01188 inline FInteger hbset  (const FCharacter *chopt, 
01189                    FInteger ival) {
01190   FInteger ierr = 0;
01191   hbset_ (chopt, &ival, &ierr, strlen (chopt));
01192   return ierr;
01193 }
01194 inline FInteger hbset  (FInteger ival = 1024) {
01195   const FCharacter *chopt = "BSIZE";
01196   FInteger ierr = 0;
01197   hbset_ (chopt, &ival, &ierr, strlen (chopt));
01198   return ierr;
01199 }
01200 inline FInteger hbset  (const string& chopt, 
01201                    FInteger ival,
01202                    FInteger& ierr) {
01203   hbset_ (chopt.c_str(), &ival, &ierr, chopt.length());
01204   return ierr;
01205 }
01206 inline FInteger hbset  (const string& chopt, 
01207                    FInteger ival) {
01208   FInteger ierr = 0;
01209   hbset_ (chopt.c_str(), &ival, &ierr, chopt.length());
01210   return ierr;
01211 }
01212 
01213 // 3.3.2 Describing the columns of a CWN
01214 
01215 template <class C>
01216 inline void hbname (FInteger id, 
01217                     const FCharacter *chblok, 
01218                     C& variable,
01219                     const FCharacter *chform) {
01220    hbname_ (&id, chblok, reinterpret_cast<FInteger *>(&variable), chform, 
01221             strlen (chblok), strlen (chform));
01222 }
01223 template <class C>
01224 inline void hbname (FInteger id, 
01225                     const FCharacter *chblok, 
01226                     C *variable,
01227                     const FCharacter *chform) {
01228    hbname_ (&id, chblok, reinterpret_cast<FInteger *>(variable), chform, 
01229             strlen (chblok), strlen (chform));
01230 }
01231 template <class C>
01232 inline void hbname (FInteger id, 
01233                     const string& chblok, 
01234                     C& variable,
01235                     const string& chform) {
01236    hbname_ (&id, chblok.c_str(), reinterpret_cast<FInteger *>(&variable), chform.c_str(), 
01237             chblok.length(), chform.length());
01238 }
01239 template <class C>
01240 inline void hbname (FInteger id, 
01241                     const string& chblok, 
01242                     C *variable,
01243                     const string& chform) {
01244    hbname_ (&id, chblok.c_str(), reinterpret_cast<FInteger *>(variable), chform.c_str(), 
01245             chblok.length(), chform.length());
01246 }
01247 template <class C>
01248 inline void hbnamc (FInteger id, 
01249                     const FCharacter *chblok, 
01250                     C& variable,
01251                     const FCharacter *chform) {
01252    hbnamc_ (&id, chblok, reinterpret_cast<FInteger *>(&variable), chform, 
01253             strlen (chblok), strlen (chform));
01254 }
01255 template <class C>
01256 inline void hbnamc (FInteger id, 
01257                     const FCharacter *chblok, 
01258                     C *variable,
01259                     const FCharacter *chform) {
01260    hbnamc_ (&id, chblok, reinterpret_cast<FInteger *>(variable), chform, 
01261             strlen (chblok), strlen (chform));
01262 }
01263 template <class C>
01264 inline void hbnamc (FInteger id, 
01265                     const string& chblok, 
01266                     C& variable,
01267                     const string& chform) {
01268    hbnamc_ (&id, chblok.c_str(), reinterpret_cast<FInteger *>(&variable), chform.c_str(), 
01269             chblok.length(), chform.length());
01270 }
01271 template <class C>
01272 inline void hbnamc (FInteger id, 
01273                     const string& chblok, 
01274                     C *variable,
01275                     const string& chform) {
01276    hbnamc_ (&id, chblok.c_str(), reinterpret_cast<FInteger *>(variable), chform.c_str(), 
01277             chblok.length(), chform.length());
01278 }
01279 
01280 // 3.3.3 Creating CHFORM dynamically
01281 
01282 inline void hnform (const FCharacter *chform, 
01283                     const FCharacter *chname, 
01284                     FInteger ldim,
01285                     const FCharacter *chtype, 
01286                     FReal xlow = 0,
01287                     FReal xhigh = 0) {
01288    hnform_ (chform, chname, &ldim, chtype, &xlow, &xhigh,
01289             strlen (chform), strlen (chname), strlen (chtype));
01290 }
01291 inline void hnform (const FCharacter *chform, 
01292                     const FCharacter *chname, 
01293                     FInteger ldim[],
01294                     const FCharacter *chtype, 
01295                     FReal xlow = 0,
01296                     FReal xhigh = 0) {
01297    hnform_ (chform, chname, ldim, chtype, &xlow, &xhigh,
01298             strlen (chform), strlen (chname), strlen (chtype));
01299 }
01300 inline void hnform (const FCharacter *chform, 
01301                     const FCharacter *chname, 
01302                     const FCharacter *chtype, 
01303                     FReal xlow = 0,
01304                     FReal xhigh = 0) {
01305    int ldim = 0;
01306    hnform_ (chform, chname, &ldim, chtype, &xlow, &xhigh,
01307             strlen (chform), strlen (chname), strlen (chtype));
01308 }
01309 inline void hnform (const string& chform, 
01310                     const string& chname, 
01311                     FInteger ldim,
01312                     const string& chtype, 
01313                     FReal xlow = 0,
01314                     FReal xhigh = 0) {
01315    hnform_ (chform.c_str(), chname.c_str(), &ldim, chtype.c_str(), &xlow, &xhigh,
01316             chform.length(), chname.length(), chtype.length());
01317 }
01318 inline void hnform (const string& chform, 
01319                     const string& chname, 
01320                     FInteger ldim[],
01321                     const string& chtype, 
01322                     FReal xlow = 0,
01323                     FReal xhigh = 0) {
01324    hnform_ (chform.c_str(), chname.c_str(), ldim, chtype.c_str(), &xlow, &xhigh,
01325             chform.length(), chname.length(), chtype.length());
01326 }
01327 inline void hnform (const string& chform, 
01328                     const string& chname, 
01329                     const string& chtype, 
01330                     FReal xlow = 0,
01331                     FReal xhigh = 0) {
01332    int ldim = 0;
01333    hnform_ (chform.c_str(), chname.c_str(), &ldim, chtype.c_str(), &xlow, &xhigh,
01334             chform.length(), chname.length(), chtype.length());
01335 }
01336 template <class C, int chtagslen>
01337 void hbooknc(FInteger id, 
01338              const FCharacter *chtitl, 
01339              FInteger nvar, 
01340              const FCharacter *block, 
01341              C& tuple, 
01342              const FCharacter chtags [][chtagslen]) {
01343   FCharacter *chtags_ = new FCharacter [nvar*chtagslen];
01344   charray_to_fortran (nvar, chtagslen, chtags[0], chtags_);
01345   hbooknc_ (&id, chtitl, &nvar, block, static_cast<FReal *> (&tuple), chtags_,
01346             strlen (chtitl), strlen (block), chtagslen);
01347   delete[] chtags_;
01348 }
01349 template <class C, int chtagslen>
01350 void hbooknc(FInteger id, 
01351              const FCharacter *chtitl, 
01352              FInteger nvar, 
01353              const FCharacter *block, 
01354              C *tuple, 
01355              const FCharacter chtags [][chtagslen]) {
01356   FCharacter *chtags_ = new FCharacter [nvar*chtagslen];
01357   charray_to_fortran (nvar, chtagslen, chtags[0], chtags_);
01358   hbooknc_ (&id, chtitl, &nvar, block, static_cast<FReal *> (tuple), chtags_,
01359             strlen (chtitl), strlen (block), chtagslen);
01360   delete[] chtags_;
01361 }
01362 template <class C>
01363 void hbooknc(FInteger id, 
01364              const string& chtitl, 
01365              FInteger nvar, 
01366              const string& block, 
01367              C& tuple, 
01368              const string chtags[]) {
01369   unsigned int chtagslen = 0;
01370   FCharacter *chtags_ = 0;
01371   string_to_fortran (nvar, chtagslen, chtags, chtags_); 
01372   hbooknc_ (&id, chtitl.c_str(), &nvar, block.c_str(), static_cast<FReal *> (&tuple), chtags_,
01373             chtitl.length(), block.length(), chtagslen);
01374   delete[] chtags_;
01375 }
01376 template <class C>
01377 inline void hbooknc(FInteger id, 
01378                     const string& chtitl, 
01379                     FInteger nvar, 
01380                     const string& block, 
01381                     C *tuple, 
01382                     const string chtags[]) {
01383   unsigned int chtagslen = 0;
01384   FCharacter *chtags_ = 0;
01385   string_to_fortran (nvar, chtagslen, chtags, chtags_); 
01386   hbooknc_ (&id, chtitl.c_str(), &nvar, block.c_str(), static_cast<FReal *> (tuple), chtags_,
01387             chtitl.length(), block.length(), chtagslen);
01388   delete[] chtags;
01389 }
01390 
01391 // 3.3.4 Filling a CWN
01392 
01393 inline void hfnt (FInteger id) {
01394    hfnt_ (&id);
01395 }
01396 inline void hfntb (FInteger id,
01397                    const FCharacter *chblok) {
01398    hfntb_ (&id, chblok, strlen (chblok));
01399 }
01400 inline void hfntb (FInteger id,
01401                    const string& chblok) {
01402    hfntb_ (&id, chblok.c_str(), chblok.length());
01403 }
01404 inline void hprnt (FInteger id) {
01405    hprnt_ (&id);
01406 }
01407 inline void hrecov (FInteger id,
01408                     const FCharacter *chopt = " ") {
01409    hrecov_ (&id, chopt, strlen (chopt));
01410 }
01411 inline void hrecov (FInteger id,
01412                     const string& chopt) {
01413    hrecov_ (&id, chopt.c_str(), chopt.length());
01414 }
01415 
01416 // 3.4 Making projections of a RWN
01417 
01418 inline void hproj1 (FInteger id, 
01419                     FInteger idn, 
01420                     FInteger isel, 
01421                     FReal fun (const FReal[], const FInteger *),
01422                     FInteger ifrom,
01423                     FInteger ito,
01424                     FInteger ivarx) {
01425    hproj1_ (&id, &idn, &isel, 
01426             reinterpret_cast<FReal (*)(const FReal *, FInteger *)> (fun), 
01427             &ifrom, &ito, &ivarx);                    
01428 }
01429 
01430 inline void hproj1 (FInteger id, 
01431                     FInteger idn, 
01432                     FInteger isel, 
01433                     FReal fun (const FReal[], const FInteger&),
01434                     FInteger ifrom,
01435                     FInteger ito,
01436                     FInteger ivarx) {
01437    hproj1_ (&id, &idn, &isel, 
01438             reinterpret_cast<FReal (*)(const FReal *, FInteger *)> (fun), 
01439             &ifrom, &ito, &ivarx);                    
01440 }
01441 
01442 inline void hproj2 (FInteger id, 
01443                     FInteger idn, 
01444                     FInteger isel, 
01445                     FReal fun (const FReal[], const FInteger *),
01446                     FInteger ifrom,
01447                     FInteger ito,
01448                     FInteger ivarx,
01449                     FInteger ivary) {
01450    hproj2_ (&id, &idn, &isel, 
01451             reinterpret_cast<FReal (*)(const FReal *, FInteger *)> (fun), 
01452             &ifrom, &ito, &ivarx, &ivary);                    
01453 }
01454 inline void hproj2 (FInteger id, 
01455                     FInteger idn, 
01456                     FInteger isel, 
01457                     FReal fun (const FReal[], const FInteger&),
01458                     FInteger ifrom,
01459                     FInteger ito,
01460                     FInteger ivarx,
01461                     FInteger ivary) {
01462    hproj2_ (&id, &idn, &isel, 
01463             reinterpret_cast<FReal (*)(const FReal *, FInteger *)> (fun), 
01464             &ifrom, &ito, &ivarx, &ivary);                    
01465 }
01466 
01467 // 3.5 Get information about an ntuple
01468 
01469 template<int chtitllen, int chtaglen>
01470 void hgiven (FInteger id,
01471              FCharacter chtitl [chtitllen],
01472              FInteger& nvar,
01473              FCharacter chtag[][chtaglen],
01474              FReal rlow[],
01475              FReal rhigh[]) {
01476   hgiven_ (&id, chtitl, &nvar, chtag[0], rlow, rhigh, chtitllen, chtaglen);
01477   charray_from_fortran (1, chtitllen, chtitl, chtitl);
01478   charray_from_fortran (nvar, chtaglen, chtag[0], chtag[0]);
01479 }  
01480 void hgiven (FInteger id,
01481              string& chtitl,
01482              FInteger& nvar,
01483              string chtag[],
01484              FReal rlow[],
01485              FReal rhigh[]);
01486                     
01487 // 3.5.1 Retrieve the contents of a RWN into an array
01488 
01489 inline FInteger hgn    (FInteger id,
01490                         FInteger& idn,
01491                         FInteger idnevt,
01492                         FReal x[],
01493                         FInteger& ierror) {
01494   hgn_ (&id, &idn, &idnevt, x, &ierror);
01495   return ierror;
01496 }
01497 inline FInteger hgn    (FInteger id,
01498                         FInteger& idn,
01499                         FInteger idnevt,
01500                         FReal x[]) {
01501   FInteger ierror = 0;
01502   hgn_ (&id, &idn, &idnevt, x, &ierror);
01503   return ierror;
01504 }
01505 inline void hgnpar  (FInteger id, 
01506                      const FCharacter *chrout = " ") {
01507   hgnpar_ (&id, chrout, strlen (chrout));
01508 }                
01509 inline void hgnpar  (FInteger id, 
01510                      const string& chrout) {
01511  hgnpar_  (&id, chrout.c_str(), chrout.length());
01512 }                              
01513 inline FInteger hgnf   (FInteger id,
01514                         FInteger idnevt,
01515                         FReal x[],
01516                         FInteger& ierror) {
01517   hgnf_ (&id, &idnevt, x, &ierror);
01518   return ierror;
01519 }
01520 inline FInteger hgnf   (FInteger id,
01521                         FInteger idnevt,
01522                         FReal x[]) {
01523   FInteger ierror = 0;
01524   hgnf_ (&id, &idnevt, x, &ierror);
01525   return ierror;
01526 }
01527 
01528 // 3.5.2 Retrieve the contents of a CWN into a common block
01529 
01530 inline FInteger hgnt (FInteger id,
01531                       FInteger idnevt,
01532                       FInteger& ierr) {
01533    hgnt_ (&id, &idnevt, &ierr);
01534    return ierr;
01535 }
01536 inline FInteger hgnt (FInteger id,
01537                       FInteger idnevt) {
01538    FInteger ierr = 0;
01539    hgnt_ (&id, &idnevt, &ierr);
01540    return ierr;
01541 }
01542 inline FInteger hgntb (FInteger id,
01543                    const FCharacter *chblok,
01544                    FInteger irow,
01545                    FInteger& ierr) {
01546    hgntb_ (&id, chblok, &irow, &ierr, strlen (chblok));
01547    return ierr;
01548 }
01549 inline FInteger hgntb (FInteger id,
01550                    const FCharacter *chblok,
01551                    FInteger irow) {
01552    FInteger ierr=0;                
01553    hgntb_ (&id, chblok, &irow, &ierr, strlen (chblok));
01554    return ierr;
01555 }
01556 inline FInteger hgntb (FInteger id,
01557                    const string& chblok,
01558                    FInteger irow,
01559                    FInteger& ierr) {
01560    hgntb_ (&id, chblok.c_str(), &irow, &ierr, chblok.length());
01561    return ierr;
01562 }
01563 inline FInteger hgntb (FInteger id,
01564                    const string& chblok,
01565                    FInteger irow) {
01566    FInteger ierr=0;                
01567    hgntb_ (&id, chblok.c_str(), &irow, &ierr, chblok.length());
01568    return ierr;
01569 }
01570 template<int chvarlen>
01571 FInteger hgntv  (FInteger id, 
01572                  const FCharacter chvar[][chvarlen],
01573                  FInteger nvar,
01574                  FInteger irow,
01575                  FInteger& ierr) {
01576   FCharacter *chvar_ = new FCharacter [nvar*chvarlen];
01577   charray_to_fortran (nvar, chvarlen, chvar [0], chvar_);
01578   hgntv_ (&id, chvar_, &nvar, &irow, &ierr, chvarlen);
01579   delete[] chvar_;
01580   return ierr;
01581 }                  
01582 template<int chvarlen>
01583 FInteger hgntv  (FInteger id, 
01584                  const FCharacter chvar[][chvarlen],
01585                  FInteger nvar,
01586                  FInteger irow) {
01587   FInteger ierr = 0;
01588   FCharacter *chvar_ = new FCharacter [nvar*chvarlen];
01589   charray_to_fortran (nvar, chvarlen, chvar [0], chvar_);
01590   hgntv_ (&id, chvar_, &nvar, &irow, &ierr, chvarlen);
01591   delete[] chvar_;
01592   return ierr;
01593 }                  
01594 FInteger hgntv  (FInteger id, 
01595                  const string chvar[],
01596                  FInteger nvar,
01597                  FInteger irow,
01598                  FInteger& ierr);
01599 inline FInteger hgntf (FInteger id, 
01600                        FInteger irow,
01601                        FInteger& ierr) {
01602   hgntf_ (&id, &irow, &ierr);
01603   return ierr;
01604 }
01605 inline FInteger hgntf (FInteger id, 
01606                        FInteger irow) {
01607   FInteger ierr = 0;
01608   hgntf_ (&id, &irow, &ierr);
01609   return ierr;
01610 }
01611   // hntvdef
01612 
01613 // 3.5.3 Generate a user function
01614 
01615 inline void huwfun (FInteger lun,
01616                     FInteger id,
01617                     const FCharacter *chfun,
01618                     FInteger itrunc = 0,
01619                     const FCharacter *chopt = "B") {
01620   huwfun_ (&lun, &id, chfun, &itrunc, chopt, strlen (chfun), strlen (chopt));
01621 }
01622 inline void huwfun (FInteger lun,
01623                     FInteger id,
01624                     const string& chfun,
01625                     FInteger itrunc = 0,
01626                     const string& chopt = "B") {
01627   huwfun_ (&lun, &id, chfun.c_str(), &itrunc, chopt.c_str(), chfun.length(), chopt.length());
01628 }
01629 
01630 // 3.6 Ntuple operations
01631 
01632 inline void hntdup (FInteger id1,
01633                     FInteger id2,
01634                     FInteger newbuf = 0,
01635                     const FCharacter *chtitl = " ",
01636                     const FCharacter *chopt = " ") {
01637   hntdup_ (&id1, &id2, &newbuf, chtitl, chopt, strlen (chtitl), strlen (chopt));
01638 }
01639 inline void hntdup (FInteger id1,
01640                     FInteger id2,
01641                     FInteger newbuf,
01642                     const string& chtitl,
01643                     const string& chopt = " ") {
01644   hntdup_ (&id1, &id2, &newbuf, chtitl.c_str(), chopt.c_str(), chtitl.length(), chopt.length());
01645 }
01646 inline void hrename(FInteger id,
01647                     const FCharacter *chold,
01648                     const FCharacter *chnew) {
01649   hrename_ (&id, chold, chnew, strlen (chold), strlen (chnew));
01650 }
01651 inline void hrename(FInteger id,
01652                     const string& chold,
01653                     const string& chnew) {
01654   hrename_ (&id, chold.c_str(), chnew.c_str(), chold.length(), chnew.length());
01655 }
01656 inline FInteger hconvol(FInteger id1,
01657                         FInteger id2,
01658                         FInteger id3,
01659                         FInteger& ierror) {
01660   hconvol_ (&id1, &id2, &id3, &ierror);
01661   return ierror;
01662 }
01663 inline FInteger hconvol(FInteger id1,
01664                         FInteger id2,
01665                         FInteger id3) {
01666   FInteger ierror = 0;
01667   hconvol_ (&id1, &id2, &id3, &ierror);
01668   return ierror;
01669 }
01670 
01671 // =============================================================================             
01672 // Chapter 4: Advanced features for booking and editing operations
01673 // =============================================================================             
01674 
01675 // 4.1 Overview of booking options
01676 
01677 // 4.1.1 Histograms with non-equidistant bins
01678 
01679 inline void hbookb (FInteger id, 
01680                     const FCharacter *chtitl, 
01681                     FInteger ncx, 
01682                     const FReal xbins[], 
01683                     FReal vmx = 0) {
01684   hbookb_ (&id, chtitl, &ncx, xbins, &vmx, strlen (chtitl));
01685 }
01686 inline void hbookb (FInteger id, 
01687                     const string& chtitl, 
01688                     FInteger ncx, 
01689                     const FReal xbins[], 
01690                     FReal vmx = 0) {
01691   hbookb_ (&id, chtitl.c_str(), &ncx, xbins, &vmx, chtitl.length());
01692 }
01693 
01694 
01695 // 4.1.2 Profile histograms
01696 
01697 inline void hbprof (FInteger id, 
01698                     const FCharacter *chtitl, 
01699                     FInteger ncx, 
01700                     FReal xlow, 
01701                     FReal xup, 
01702                     FReal ymin, 
01703                     FReal ymax, 
01704                     const FCharacter *chopt = " ") {
01705   hbprof_ (&id, chtitl, &ncx, &xlow, &xup, &ymin, &ymax, chopt, strlen (chtitl), strlen (chopt));
01706 }
01707 inline void hbprof (FInteger id, 
01708                     const string& chtitl, 
01709                     FInteger ncx, 
01710                     FReal xlow, 
01711                     FReal xup, 
01712                     FReal ymin, 
01713                     FReal ymax, 
01714                     const string& chopt = " ") {
01715   hbprof_ (&id, chtitl.c_str(), &ncx, &xlow, &xup, &ymin, &ymax, chopt.c_str(), chtitl.length(), chopt.length());
01716 }
01717 
01718 
01719 // 4.1.3 Rounding
01720 
01721 inline void hbinsz (const FCharacter *chopt) {
01722   hbinsz_ (chopt, strlen (chopt));
01723 }
01724 inline void hbinsz (const string& chopt) {
01725   hbinsz_ (chopt.c_str(), chopt.length());
01726 }
01727 inline void hbinsz (bool opt) {
01728   if (opt) {
01729     hbinsz_ ("YES", 3);
01730   }
01731   else {
01732     hbinsz_ ("NO", 2);
01733   }
01734 }
01735 
01736 // 4.1.4 Projections, slices, bands
01737 
01738 inline void hbpro  (FInteger id,
01739                     FReal vmx = 0) {
01740   hbpro_ (&id, &vmx);
01741 }
01742 inline void hbprox (FInteger id,
01743                     FReal vmx = 0) {
01744   hbprox_ (&id, &vmx);
01745 }
01746 inline void hbproy (FInteger id,
01747                     FReal vmx = 0) {
01748   hbproy_ (&id, &vmx);
01749 }
01750 inline void hbandx (FInteger id,
01751                     FReal ymi, 
01752                     FReal yma, 
01753                     FReal vmx = 0) {
01754   hbandx_ (&id, &ymi, &yma, &vmx);
01755 }
01756 inline void hbandy (FInteger id,
01757                     FReal xmi, 
01758                     FReal xma, 
01759                     FReal vmx = 0) {
01760   hbandy_ (&id, &xmi, &xma, &vmx);
01761 }
01762 inline void hbslix (FInteger id,
01763                     FInteger nsli, 
01764                     FReal vmx = 0) {
01765   hbslix_ (&id, &nsli, &vmx);
01766 }
01767 inline void hbsliy (FInteger id,
01768                     FInteger nsli, 
01769                     FReal vmx = 0) {
01770   hbsliy_ (&id, &nsli, &vmx);
01771 }
01772 
01773 // 4.1.5 Statistics
01774 
01775 inline void hbarx (FInteger id) {
01776   hbarx_ (&id);
01777 }
01778 inline void hbary (FInteger id) {
01779   hbary_ (&id);
01780 }
01781 inline void hbar2 (FInteger id) {
01782   hbar2_ (&id);
01783 }
01784 
01785 // 4.1.6 Function representation
01786 
01787 inline void hbfun1 (FInteger id, 
01788                     const FCharacter *chtitl, 
01789                     FInteger nx, 
01790                     FReal xmi, 
01791                     FReal xma, 
01792                     FReal fun (const FReal *)) {
01793   hbfun1_ (&id, chtitl, &nx, &xmi, &xma, fun, strlen (chtitl));
01794 }
01795 inline void hbfun1 (FInteger id, 
01796                     const FCharacter *chtitl, 
01797                     FInteger nx, 
01798                     FReal xmi, 
01799                     FReal xma, 
01800                     FReal fun (const FReal&)) {
01801   hbfun1_ (&id, chtitl, &nx, &xmi, &xma, 
01802            reinterpret_cast<FReal (*)(const FReal *)> (fun), strlen (chtitl));
01803 }
01804 inline void hbfun1 (FInteger id, 
01805                     const string& chtitl, 
01806                     FInteger nx, 
01807                     FReal xmi, 
01808                     FReal xma, 
01809                     FReal fun (const FReal *)) {
01810   hbfun1_ (&id, chtitl.c_str(), &nx, &xmi, &xma, fun, chtitl.length());
01811 }
01812 inline void hbfun1 (FInteger id, 
01813                     const string& chtitl, 
01814                     FInteger nx, 
01815                     FReal xmi, 
01816                     FReal xma, 
01817                     FReal fun (const FReal&)) {
01818   hbfun1_ (&id, chtitl.c_str(), &nx, &xmi, &xma, 
01819            reinterpret_cast<FReal (*)(const FReal *)> (fun), chtitl.length());
01820 }
01821 inline void hbfun2 (FInteger id, 
01822                     const FCharacter *chtitl, 
01823                     FInteger nx, 
01824                     FReal xmi, 
01825                     FReal xma, 
01826                     FInteger ny, 
01827                     FReal ymi, 
01828                     FReal yma, 
01829                     FReal fun (const FReal *, const FReal *)) {
01830   hbfun2_ (&id, chtitl, &nx, &xmi, &xma, &ny, &ymi, &yma, fun, strlen (chtitl));
01831 }
01832 inline void hbfun2 (FInteger id, 
01833                     const FCharacter *chtitl, 
01834                     FInteger nx, 
01835                     FReal xmi, 
01836                     FReal xma, 
01837                     FInteger ny, 
01838                     FReal ymi, 
01839                     FReal yma, 
01840                     FReal fun (const FReal&, const FReal&)) {
01841   hbfun2_ (&id, chtitl, &nx, &xmi, &xma, &ny, &ymi, &yma, 
01842            reinterpret_cast<FReal (*)(const FReal *, const FReal *)> (fun), strlen (chtitl));
01843 }
01844 inline void hbfun2 (FInteger id, 
01845                     const string& chtitl, 
01846                     FInteger nx, 
01847                     FReal xmi, 
01848                     FReal xma, 
01849                     FInteger ny, 
01850                     FReal ymi, 
01851                     FReal yma, 
01852                     FReal fun (const FReal *, const FReal *)) {
01853   hbfun2_ (&id, chtitl.c_str(), &nx, &xmi, &xma, &ny, &ymi, &yma, fun, chtitl.length());
01854 }
01855 inline void hbfun2 (FInteger id, 
01856                     const string& chtitl, 
01857                     FInteger nx, 
01858                     FReal xmi, 
01859                     FReal xma, 
01860                     FInteger ny, 
01861                     FReal ymi, 
01862                     FReal yma, 
01863                     FReal fun (const FReal&, const FReal&)) {
01864   hbfun2_ (&id, chtitl.c_str(), &nx, &xmi, &xma, &ny, &ymi, &yma, 
01865            reinterpret_cast<FReal (*)(const FReal *, const FReal *)> (fun), chtitl.length());
01866 }
01867 inline void hfunc  (FInteger id, 
01868                     FReal fun (const FReal *)) {
01869   hfunc_ (&id, fun);
01870 }
01871 inline void hfunc  (FInteger id, 
01872                     FReal fun (const FReal&)) {
01873   hfunc_ (&id, reinterpret_cast<FReal (*)(const FReal *)> (fun));
01874 }
01875 
01876 // 4.1.7 Reserve array in memory
01877 
01878 inline FInteger harray (FInteger id,
01879                         FInteger nwords,
01880                         FInteger& loc) {
01881   harray_ (&id, &nwords, &loc);
01882   return loc;
01883 }
01884 inline FInteger harray (FInteger id,
01885                         FInteger nwords) {
01886   FInteger loc = 0;
01887   harray_ (&id, &nwords, &loc);
01888   return loc;
01889 }
01890 
01891 // 4.1.8 Axis labels and histograms
01892 
01893 template<int clablen>
01894 void hlabel (FInteger id,
01895              FInteger nlab,
01896              FCharacter clab[][clablen],
01897              const FCharacter *chopt) {
01898   charray_to_fortran (nlab, clablen, clab [0], clab [0]);
01899   hlabel_ (&id, &nlab, clab [0], chopt, clablen, strlen (chopt));
01900   charray_from_fortran (nlab, clablen, clab [0], clab [0]);
01901 } 
01902 
01903 void hlabel (FInteger id,
01904              FInteger nlab,
01905              string clab[],
01906              const string& chopt);
01907                     
01908 // 4.2 Filling operations
01909 
01910 // 4.2.1 Fast filling entries
01911 
01912 inline void hf1    (FInteger id,
01913                     FReal x,
01914                     FReal weight) {
01915   hf1_ (&id, &x, &weight);
01916 }                    
01917 inline void hf1e   (FInteger id,
01918                     FReal x,
01919                     FReal weight,
01920                     FReal errors) {
01921   hf1e_ (&id, &x, &weight, &errors);
01922 }                    
01923 inline void hf2    (FInteger id,
01924                     FReal x,
01925                     FReal y,
01926                     FReal weight) {
01927   hf2_ (&id, &x, &y, &weight);
01928 }                    
01929 inline void hff1   (FInteger id,
01930                     FInteger& nid,
01931                     FReal x,
01932                     FReal weight) {
01933   hff1_ (&id, &nid, &x, &weight);
01934 }                    
01935 inline void hff2   (FInteger id,
01936                     FInteger& nid,
01937                     FReal x,
01938                     FReal y,
01939                     FReal weight) {
01940   hff2_ (&id, &nid, &x, &y, &weight);
01941 }                    
01942 inline void hfpak1 (FInteger id,
01943                     FInteger& nid,
01944                     const FReal v[],
01945                     FInteger n) {
01946   hfpak1_ (&id, &nid, v, &n);
01947 }                    
01948 inline void hfpak1 (FInteger id,
01949                     const FReal v[],
01950                     FInteger n) {
01951   FInteger nid = 0;
01952   hfpak1_ (&id, &nid, v, &n);
01953 }                    
01954 inline void hipak1 (FInteger id,
01955                     FInteger& nid,
01956                     const FInteger iv[],
01957                     FInteger n) {
01958   hipak1_ (&id, &nid, iv, &n);
01959 }                    
01960 inline void hipak1 (FInteger id,
01961                     const FInteger iv[],
01962                     FInteger n) {
01963   FInteger nid = 0;
01964   hipak1_ (&id, &nid, iv, &n);
01965 }                    
01966 
01967 // 4.2.2 Global filling
01968 
01969 inline void hpak   (FInteger id,
01970                     const FReal conten[]){
01971   hpak_ (&id, conten);
01972 }
01973 inline void hpakad (FInteger id,
01974                     const FReal conten[]){
01975   hpakad_ (&id, conten);
01976 }
01977 inline void hpake  (FInteger id,
01978                     const FReal errors[]){
01979   hpake_ (&id, errors);
01980 }
01981 
01982 // 4.2.3 Filling histograms using character variables
01983 
01984 inline void hfc1   (FInteger id,
01985                     FInteger ibin,
01986                     const FCharacter *clab,
01987                     FReal w = 1,
01988                     const FCharacter *chopt = " ") {
01989   hfc1_ (&id, &ibin, clab, &w, chopt, strlen (clab), strlen (chopt));
01990 }
01991 inline void hfc1   (FInteger id,
01992                     const FCharacter *clab,
01993                     FReal w = 1,
01994                     const FCharacter *chopt = " ") {
01995   FInteger ibin = 0;
01996   hfc1_ (&id, &ibin, clab, &w, chopt, strlen (clab), strlen (chopt));
01997 }
01998 inline void hfc1   (FInteger id,
01999                     FInteger ibin,
02000                     FReal w = 1,
02001                     const FCharacter *chopt = " ") {
02002   hfc1_ (&id, &ibin, " ", &w, chopt, 1, strlen (chopt));
02003 }
02004 inline void hfc1   (FInteger id,
02005                     FInteger ibin,
02006                     const string& clab,
02007                     FReal w = 1,
02008                     const string& chopt = " ") {
02009   hfc1_ (&id, &ibin, clab.c_str(), &w, chopt.c_str(), clab.length(), chopt.length());
02010 }
02011 inline void hfc1   (FInteger id,
02012                     const string& clab,
02013                     FReal w = 1,
02014                     const string& chopt = " ") {
02015   FInteger ibin = 0;
02016   hfc1_ (&id, &ibin, clab.c_str(), &w, chopt.c_str(), clab.length(), chopt.length());
02017 }
02018 inline void hfc1   (FInteger id,
02019                     FInteger ibin,
02020                     FReal w,
02021                     const string& chopt) {
02022   hfc1_ (&id, &ibin, " ", &w, chopt.c_str(), 1, chopt.length());
02023 }
02024 inline void hfc2   (FInteger id,
02025                     FInteger ibinx,
02026                     const FCharacter *clabx,
02027                     FInteger ibiny,
02028                     const FCharacter *claby,
02029                     FReal w = 1,
02030                     const FCharacter *chopt = " ") {
02031   hfc2_ (&id, &ibinx, clabx, &ibiny, claby, &w, chopt, 
02032          strlen (clabx), strlen (claby), strlen (chopt));
02033 }
02034 inline void hfc2   (FInteger id,
02035                     const FCharacter *clabx,
02036                     const FCharacter *claby,
02037                     FReal w = 1,
02038                     const FCharacter *chopt = " ") {
02039   FInteger ibinx = 0;
02040   FInteger ibiny = 0;
02041   hfc2_ (&id, &ibinx, clabx, &ibiny, claby, &w, chopt, 
02042          strlen (clabx), strlen (claby), strlen (chopt));
02043 }
02044 inline void hfc2   (FInteger id,
02045                     FInteger ibinx,
02046                     FInteger ibiny,
02047                     FReal w = 1,
02048                     const FCharacter *chopt = " ") {
02049   hfc2_ (&id, &ibinx, " ", &ibiny, " ", &w, chopt, 
02050          1, 1, strlen (chopt));
02051 }
02052 inline void hfc2   (FInteger id,
02053                     const FCharacter *clabx,
02054                     FInteger ibiny,
02055                     FReal w = 1,
02056                     const FCharacter *chopt = " ") {
02057   FInteger ibinx = 0;
02058   hfc2_ (&id, &ibinx, clabx, &ibiny, " ", &w, chopt, 
02059          strlen (clabx), 1, strlen (chopt));
02060 }
02061 inline void hfc2   (FInteger id,
02062                     FInteger ibinx,
02063                     const FCharacter *claby,
02064                     FReal w = 1,
02065                     const FCharacter *chopt = " ") {
02066   FInteger ibiny = 0;
02067   hfc2_ (&id, &ibinx, " ", &ibiny, claby, &w, chopt, 
02068          1, strlen (claby), strlen (chopt));
02069 }
02070 inline void hfc2   (FInteger id,
02071                     FInteger ibinx,
02072                     const string& clabx,
02073                     FInteger ibiny,
02074                     const string& claby,
02075                     FReal w = 1,
02076                     const string& chopt = " ") {
02077   hfc2_ (&id, &ibinx, clabx.c_str(), &ibiny, claby.c_str(), &w, chopt.c_str(), 
02078          clabx.length(), claby.length(), chopt.length());
02079 }
02080 inline void hfc2   (FInteger id,
02081                     const string& clabx,
02082                     const string& claby,
02083                     FReal w = 1,
02084                     const string& chopt = " ") {
02085   FInteger ibinx = 0;
02086   FInteger ibiny = 0;
02087   hfc2_ (&id, &ibinx, clabx.c_str(), &ibiny, claby.c_str(), &w, chopt.c_str(), 
02088          clabx.length(), claby.length(), chopt.length());
02089 }
02090 inline void hfc2   (FInteger id,
02091                     const string& clabx,
02092                     FInteger ibiny,
02093                     FReal w = 1,
02094                     const string& chopt = " ") {
02095   FInteger ibinx = 0;
02096   hfc2_ (&id, &ibinx, clabx.c_str(), &ibiny, " ", &w, chopt.c_str(), 
02097          clabx.length(), 1, chopt.length());
02098 }
02099 inline void hfc2   (FInteger id,
02100                     FInteger ibinx,
02101                     const string& claby,
02102                     FReal w = 1,
02103                     const string& chopt = " ") {
02104   FInteger ibiny = 0;
02105   hfc2_ (&id, &ibinx, " ", &ibiny, claby.c_str(), &w, chopt.c_str(), 
02106          1, claby.length(), chopt.length());
02107 }
02108 inline void hfc2   (FInteger id,
02109                     FInteger ibinx,
02110                     FInteger ibiny,
02111                     FReal w,
02112                     const string& chopt) {
02113   hfc2_ (&id, &ibinx, " ", &ibiny, " ", &w, chopt.c_str(), 
02114          1, 1, chopt.length());
02115 }
02116 
02117 // 4.3 Editing operations
02118 
02119 // 4.3.1 Index and general title
02120 
02121 inline void hindex () {
02122   hindex_ ();
02123 }
02124 inline void htitle (const FCharacter *chgtit) {
02125   htitle_ (chgtit, strlen (chgtit));
02126 }
02127 inline void htitle (const string& chgtit) {
02128   htitle_ (chgtit.c_str(), chgtit.length());
02129 }
02130 
02131 // 4.3.2 What to print (1-dimensional histogram)
02132 
02133 inline void hidopt (FInteger id,
02134                     const FCharacter *chopt = " ") {
02135    hidopt_ (&id, chopt, strlen (chopt));
02136 }
02137 inline void hidopt (FInteger id,
02138                     const string& chopt) {
02139    hidopt_ (&id, chopt.c_str(), chopt.length());
02140 }
02141 inline void hstaf  (const FCharacter *chopt = " ") {
02142    hstaf_ (chopt, strlen (chopt));
02143 }
02144 inline void hstaf  (const string& chopt) {
02145    hstaf_ (chopt.c_str(), chopt.length());
02146 }
02147 
02148 // 4.3.3 Graphic choices (1-dimensional histogram)
02149 
02150 inline void hpchar  (const FCharacter *chopt, FCharacter charac) {
02151    hpchar_ (chopt, &charac, strlen (chopt));
02152 }
02153 inline void hpchar  (const string& chopt, FCharacter charac) {
02154    hpchar_ (chopt.c_str(), &charac, chopt.length());
02155 }
02156 inline void hbigbi (FInteger id,
02157                     FInteger ncol) {
02158   hbigbi_ (&id, &ncol);
02159 }
02160 
02161 // 4.3.4 Scale definition and normalization
02162 
02163 inline void hmaxim (FInteger id,
02164                     FReal fmax) {
02165   hmaxim_ (&id, &fmax);
02166 }
02167 inline void hminim (FInteger id,
02168                     FReal fmin) {
02169   hminim_ (&id, &fmin);
02170 }
02171 inline void hcompa (const FInteger idvect[],
02172                     FInteger n) {
02173   hcompa_ (idvect, &n);
02174 }
02175 inline void hnorma (FInteger id,
02176                     FReal xnorm) {
02177   hnorma_ (&id, &xnorm);
02178 }
02179 inline void hscale (FInteger id, FReal factor) {
02180   hscale_ (&id, &factor);
02181 }
02182 
02183 // 4.3.5 Page control
02184 
02185 inline void hsquez (const FCharacter *chopt) {
02186   hsquez_ (chopt, strlen (chopt));
02187 }
02188 inline void hsquez (const string& chopt) {
02189   hsquez_ (chopt.c_str(), chopt.length());
02190 }
02191 inline void hsquez (bool opt) {
02192   if (opt) {
02193     hsquez_ ("YES", 3);
02194   }
02195   else {
02196     hsquez_ ("NO", 2);
02197   }
02198 }
02199 inline void hpagsz (FInteger nlines) {
02200   hpagsz_ (&nlines);
02201 }
02202 
02203 // 4.3.6 selective editing
02204 
02205 inline void hphist (FInteger id,
02206                     const FCharacter *choice = " ", 
02207                     FInteger num = 0) {
02208   hphist_ (&id, choice, &num, strlen (choice));
02209 }
02210 inline void hprot  (FInteger id,
02211                     const FCharacter *choice = " ", 
02212                     FInteger num = 0) {
02213   hprot_ (&id, choice, &num, strlen (choice));
02214 }
02215 inline void hpscat (FInteger id) {
02216   hpscat_ (&id);
02217 }
02218 inline void hptab  (FInteger id) {
02219   hptab_ (&id);
02220 }
02221 inline void hphs   (FInteger id) {
02222   hphs_ (&id);
02223 }
02224 inline void hphst  (FInteger id) {
02225  hphst_ (&id);
02226 }
02227 
02228 // 4.3.7 Printing after system error recovery
02229 
02230 inline void hponce () {
02231   hponce_ ();
02232 }
02233 
02234 // 4.3.8 Changing logical unit numbers for output and message files
02235 
02236 inline void houtpu (FInteger lout) {
02237   houtpu_ (&lout);
02238 }
02239 inline void hermes (FInteger lerr) {
02240   hermes_ (&lerr);
02241 }
02242 
02243 // =============================================================================             
02244 // Chapter 5: Accessing Information
02245 // =============================================================================             
02246                 
02247 // 5.1: Testing if a histogram exists in memory
02248 
02249 inline FLogical hexist (FInteger id) {
02250   return hexist_ (&id);
02251 }
02252 
02253 // 5.2 List of histograms
02254 
02255 inline void hid1   (FInteger idvect[],
02256                     FInteger &n) {
02257   hid1_ (idvect, &n);
02258 }
02259 inline void hid2   (FInteger idvect[],
02260                     FInteger &n) {
02261   hid2_ (idvect, &n);
02262 }
02263 inline void hidall (FInteger idvect[],
02264                     FInteger &n) {
02265   hidall_ (idvect, &n);
02266 }
02267 
02268 // 5.3 Number of entries
02269 
02270 inline FInteger hnoent (FInteger id, 
02271                         FInteger& noent) {
02272   hnoent_ (&id, &noent);
02273   return noent;
02274 }
02275 inline FInteger hnoent (FInteger id) {
02276   FInteger noent = 0;
02277   hnoent_ (&id, &noent);
02278   return noent;
02279 }
02280 
02281 // 5.4 Histogram attributes contents
02282 
02283 inline FInteger hkind  (FInteger id,
02284                         FInteger kind[],
02285                         const FCharacter *chopt = " ") { 
02286   hkind_ (&id, kind, chopt, strlen (chopt));
02287   return kind[0];
02288 }                
02289 inline FInteger hkind  (FInteger id) { 
02290   FInteger kind[1];
02291   hkind_ (&id, kind, " ", 1);
02292   return kind[0];
02293 }
02294 inline FInteger hkind  (FInteger id,
02295                         FInteger kind[],
02296                         const string& chopt) { 
02297   hkind_ (&id, kind, chopt.c_str(), chopt.length());
02298   return kind[0];
02299 }                
02300                 
02301 // 5.5 Contents
02302                                                 
02303 inline void hunpak (FInteger id,
02304                     FReal conten[],
02305                     const FCharacter *choice = " ",
02306                     FInteger num = 0) {
02307    hunpak_ (&id, conten, choice, &num, strlen (choice));
02308 }
02309 inline void hunpak (FInteger id,
02310                     FReal conten[],
02311                     const string& choice,
02312                     FInteger num = 0) {
02313    hunpak_ (&id, conten, choice.c_str(), &num, choice.length());
02314 }
02315 inline FReal hi     (FInteger id, FInteger i) {
02316   return hi_ (&id, &i);
02317 }
02318 inline FReal hij    (FInteger id, FInteger i, FInteger j) {
02319   return hij_ (&id, &i, &j);
02320 }
02321 inline FReal hx     (FInteger id, FReal x) {
02322   return hx_ (&id, &x);
02323 }
02324 inline FReal hxy    (FInteger id, FReal x, FReal y) {
02325   return hxy_ (&id, &x, &y);
02326 }
02327 
02328 // 5.6 Errors               
02329                 
02330 inline void hunpke (FInteger id,
02331                     FReal conten[],
02332                     const FCharacter *choice = " ",
02333                     FInteger num = 0) {
02334    hunpke_ (&id, conten, choice, &num, strlen (choice));
02335 }
02336 inline void hunpke (FInteger id,
02337                     FReal conten[],
02338                     const string& choice,
02339                     FInteger num = 0) {
02340    hunpke_ (&id, conten, choice.c_str(), &num, choice.length());
02341 }
02342 inline FReal hie    (FInteger id, FInteger i) {
02343   return hie_ (&id, &i);
02344 }
02345 inline FReal hije   (FInteger id, FInteger i, FInteger j) {
02346   return hije_ (&id, &i, &j);
02347 }
02348 inline FReal hxe    (FInteger id, FReal x) {
02349   return hxe_ (&id, &x);
02350 }
02351 inline FReal hxye   (FInteger id, FReal x, FReal y) {
02352   return hxye_ (&id, &x, &y);
02353 }
02354                 
02355 // 5.7 Associated function
02356                 
02357 inline FReal hif    (FInteger id, FInteger i) {
02358   return hif_ (&id, &i);
02359 }
02360 
02361 // 5.8 Abscissa to channel number
02362                 
02363 inline FInteger hxi   (FInteger id, FReal x, FInteger& i) {
02364   hxi_ (&id, &x, &i);
02365   return i;
02366 }
02367 inline FInteger hxi   (FInteger id, FReal x) {
02368   FInteger i;
02369   hxi_ (&id, &x, &i);
02370   return i;
02371 }
02372 inline void hxyij   (FInteger id, FReal x, FReal y, FInteger& i, FInteger& j) {
02373   hxyij_ (&id, &x, &y, &i, &j);
02374 }
02375 
02376 inline FReal hix   (FInteger id, FInteger i, FReal& x) {
02377   hix_ (&id, &i, &x);
02378   return x;
02379 }
02380 inline FReal hix   (FInteger id, FInteger i) {
02381   FReal x;
02382   hix_ (&id, &i, &x);
02383   return x;
02384 }
02385 inline void hijxy   (FInteger id, FInteger i, FInteger j, FReal& x, FReal& y) {
02386   hijxy_ (&id, &i, &j, &x, &y);
02387 }
02388                 
02389 // 5.9 Maximum and minimum
02390 
02391 inline FReal hmax   (FInteger id) {
02392   return hmax_ (&id);
02393 }
02394 inline FReal hmin   (FInteger id) {
02395   return hmin_ (&id);
02396 }
02397   
02398 // 5.10 Rebinning
02399 
02400 inline void hrebin (FInteger id, 
02401                     FReal x[], 
02402                     FReal y[],
02403                     FReal ex[], 
02404                     FReal ey[],
02405                     FInteger n, 
02406                     FInteger ifirst, 
02407                     FInteger ilast) {
02408   hrebin_ (&id, x, y, ex, ey, &n, &ifirst, &ilast);
02409 }
02410 
02411 // 5.11 Integrated contents
02412 
02413 inline FReal hsum   (FInteger id) {
02414   return hsum_ (&id);
02415 }
02416   
02417 // 5.12 Histogram definition
02418 
02419 inline FReal hdump  (FInteger id) {
02420   return hdump_ (&id);
02421 }
02422 template<int chtitllen>
02423 void hgive  (FInteger id,
02424              FCharacter chtitl [chtitllen],
02425              FInteger& nx,
02426              FReal& xmi,
02427              FReal& xma,
02428              FInteger& ny,
02429              FReal& ymi,
02430              FReal& yma,
02431              FInteger& nwt,
02432              FInteger& loc) {
02433   hgive_ (&id, chtitl, &nx, &xmi, &xma, &ny, &ymi, &yma, &nwt, &loc, chtitllen);
02434   charray_from_fortran (1, chtitllen, chtitl, chtitl);
02435 }             
02436 void hgive  (FInteger id,
02437              string& chtitl,
02438              FInteger& nx,
02439              FReal& xmi,
02440              FReal& xma,
02441              FInteger& ny,
02442              FReal& ymi,
02443              FReal& yma,
02444              FInteger& nwt,
02445              FInteger& loc);
02446                       
02447 // 5.13 Statistics
02448 
02449 inline FReal hstati (FInteger id,
02450                     FInteger icase,
02451                     const FCharacter *choice = " ",
02452                     FInteger num = 0) {
02453    return hstati_ (&id, &icase, choice, &num, strlen (choice));
02454 }
02455 
02456 // =============================================================================             
02457 // Chapter 6: Operations on Histograms
02458 // =============================================================================             
02459 
02460 // 6.1 Arithmetic operations                
02461 
02462 inline void hopera (FInteger id1, 
02463                     const FCharacter *choper, 
02464                     FInteger id2, 
02465                     FInteger id3,
02466                     FReal c1 = 1,
02467                     FReal c2 = 1) {
02468    hopera_ (&id1, choper, &id2, &id3, &c1, &c2, strlen (choper));
02469 }
02470 inline void hopera (FInteger id1, 
02471                     const string& choper, 
02472                     FInteger id2, 
02473                     FInteger id3,
02474                     FReal c1 = 1,
02475                     FReal c2 = 1) {
02476    hopera_ (&id1, choper.c_str(), &id2, &id3, &c1, &c2, choper.length());
02477 }
02478 
02479 // 6.2 Statistical differences between histograms
02480 
02481 inline FReal hdiff (FInteger id1, 
02482                     FInteger id2, 
02483                     FReal& prob,
02484                     const FCharacter *chopt) {
02485   hdiff_ (&id1, &id2, &prob, chopt, strlen (chopt));
02486   return prob;
02487 }
02488 inline FReal hdiff (FInteger id1, 
02489                     FInteger id2, 
02490                     const FCharacter *chopt) {
02491   FReal prob = 0;
02492   hdiff_ (&id1, &id2, &prob, chopt, strlen (chopt));
02493   return prob;
02494 }
02495 inline FReal hdiff (FInteger id1, 
02496                     FInteger id2, 
02497                     FReal& prob,
02498                     const string& chopt) {
02499   hdiff_ (&id1, &id2, &prob, chopt.c_str(), chopt.length());
02500   return prob;
02501 }
02502 inline FReal hdiff (FInteger id1, 
02503                     FInteger id2, 
02504                     const string& chopt) {
02505   FReal prob = 0;
02506   hdiff_ (&id1, &id2, &prob, chopt.c_str(), chopt.length());
02507   return prob;
02508 }
02509 
02510 // 6.3 Bin by bin histogram comparisons
02511 
02512 inline void hdiffb (FInteger id1, 
02513                     FInteger id2, 
02514                     FReal tol,
02515                     FInteger nbin,
02516                     const FCharacter *chopt,
02517                     FInteger& nbad,
02518                     FReal diff[]) {
02519   hdiffb_ (&id1, &id2, &tol, &nbin, chopt, &nbad, diff, strlen (chopt));
02520 }
02521 inline void hdiffb (FInteger id1, 
02522                     FInteger id2, 
02523                     FReal tol,
02524                     FInteger nbin,
02525                     const string& chopt,
02526                     FInteger& nbad,
02527                     FReal diff[]) {
02528   hdiffb_ (&id1, &id2, &tol, &nbin, chopt.c_str(), &nbad, diff, chopt.length());
02529 }
02530   
02531 // =============================================================================             
02532 // Chapter 7: Fitting, parametrization and smoothing
02533 // =============================================================================             
02534 
02535 // 7.1 Fitting
02536 
02537 // 7.1.1 One and two-dimensional distributions
02538 
02539 inline void hfith (FInteger id,
02540                    FReal fun(FReal *),
02541                    const FCharacter *chopt,
02542                    FInteger np,
02543                    FReal param [],
02544                    const FReal step [],
02545                    const FReal pmin [],
02546                    const FReal pmax [],
02547                    FReal sigpar [],
02548                    FReal& chi2) {
02549   hfith_ (&id, fun, chopt, &np, param, step, pmin, pmax, sigpar, &chi2, 
02550           strlen (chopt));
02551 }  
02552 inline void hfith (FInteger id,
02553                    FReal fun(FReal&),
02554                    const FCharacter *chopt,
02555                    FInteger np,
02556                    FReal param [],
02557                    const FReal step [],
02558                    const FReal pmin [],
02559                    const FReal pmax [],
02560                    FReal sigpar [],
02561                    FReal& chi2) {
02562   hfith_ (&id, reinterpret_cast <FReal (*)(FReal *)> (fun), 
02563           chopt, &np, param, step, pmin, pmax, sigpar, &chi2, 
02564           strlen (chopt));
02565 }  
02566 inline void hfith (FInteger id,
02567                    FReal fun(FReal *),
02568                    const string& chopt,
02569                    FInteger np,
02570                    FReal param [],
02571                    const FReal step [],
02572                    const FReal pmin [],
02573                    const FReal pmax [],
02574                    FReal sigpar [],
02575                    FReal& chi2) {
02576   hfith_ (&id, fun, chopt.c_str(), &np, param, step, pmin, pmax, sigpar, &chi2, 
02577           chopt.length());
02578 }  
02579 inline void hfith (FInteger id,
02580                    FReal fun(FReal& ),
02581                    const string& chopt,
02582                    FInteger np,
02583                    FReal param [],
02584                    const FReal step [],
02585                    const FReal pmin [],
02586                    const FReal pmax [],
02587                    FReal sigpar [],
02588                    FReal& chi2) {
02589   hfith_ (&id, reinterpret_cast <FReal (*)(FReal *)> (fun), 
02590           chopt.c_str(), &np, param, step, pmin, pmax, sigpar, &chi2, 
02591           chopt.length());
02592 }
02593 
02594 // 7.1.2 Fitting one-dimensional histograms with special functions
02595 
02596 inline void hfitn (FInteger id,
02597                    const FCharacter *chfun,
02598                    const FCharacter *chopt,
02599                    FInteger np,
02600                    FReal param [],
02601                    const FReal step [],
02602                    const FReal pmin [],
02603                    const FReal pmax [],
02604                    FReal sigpar [],
02605                    FReal& chi2) {
02606   hfitn_ (&id, chfun, chopt, &np, param, step, pmin, pmax, sigpar, &chi2, 
02607           strlen (chfun), strlen (chopt));
02608 }  
02609 inline void hfitn (FInteger id,
02610                    const string& chfun,
02611                    const string& chopt,
02612                    FInteger np,
02613                    FReal param [],
02614                    const FReal step [],
02615                    const FReal pmin [],
02616                    const FReal pmax [],
02617                    FReal sigpar [],
02618                    FReal& chi2) {
02619   hfitn_ (&id, chfun.c_str(), chopt.c_str(), &np, param, step, pmin, pmax, sigpar, &chi2, 
02620           chfun.length(), chopt.length());
02621 }  
02622 
02623 // 7.1.3 Fitting one or multi-dimensional arrays
02624 
02625 inline void hfitv (FInteger n,
02626                    FInteger ndim,
02627                    FInteger nvar,
02628                    const FReal x[],
02629                    const FReal y[],
02630                    const FReal ey[],
02631                    FReal fun(FReal *),
02632                    const FCharacter *chopt,
02633                    FInteger np,
02634                    FReal param [],
02635                    const FReal step [],
02636                    const FReal pmin [],
02637                    const FReal pmax [],
02638                    FReal sigpar [],
02639                    FReal& chi2) {
02640   hfitv_ (&n, &ndim, &nvar, x, y, ey, 
02641           fun, chopt, &np, param, step, pmin, pmax, sigpar, &chi2, 
02642           strlen (chopt));
02643 }  
02644 inline void hfitv (FInteger n,
02645                    FInteger ndim,
02646                    FInteger nvar,
02647                    const FReal x[],
02648                    const FReal y[],
02649                    const FReal ey[],
02650                    FReal fun(FReal&),
02651                    const FCharacter *chopt,
02652                    FInteger np,
02653                    FReal param [],
02654                    const FReal step [],
02655                    const FReal pmin [],
02656                    const FReal pmax [],
02657                    FReal sigpar [],
02658                    FReal& chi2) {
02659   hfitv_ (&n, &ndim, &nvar, x, y, ey, 
02660           reinterpret_cast <FReal (*)(FReal *)> (fun), 
02661           chopt, &np, param, step, pmin, pmax, sigpar, &chi2, 
02662           strlen (chopt));
02663 }  
02664 inline void hfitv (FInteger n,
02665                    FInteger ndim,
02666                    FInteger nvar,
02667                    const FReal x[],
02668                    const FReal y[],
02669                    const FReal ey[],
02670                    FReal fun(FReal *),
02671                    const string& chopt,
02672                    FInteger np,
02673                    FReal param [],
02674                    const FReal step [],
02675                    const FReal pmin [],
02676                    const FReal pmax [],
02677                    FReal sigpar [],
02678                    FReal& chi2) {
02679   hfitv_ (&n, &ndim, &nvar, x, y, ey, 
02680           fun, chopt.c_str(), &np, param, step, pmin, pmax, sigpar, &chi2, 
02681           chopt.length());
02682 }  
02683 inline void hfitv (FInteger n,
02684                    FInteger ndim,
02685                    FInteger nvar,
02686                    const FReal x[],
02687                    const FReal y[],
02688                    const FReal ey[],
02689                    FReal fun(FReal& ),
02690                    const string& chopt,
02691                    FInteger np,
02692                    FReal param [],
02693                    const FReal step [],
02694                    const FReal pmin [],
02695                    const FReal pmax [],
02696                    FReal sigpar [],
02697                    FReal& chi2) {
02698   hfitv_ (&n, &ndim, &nvar, x, y, ey, 
02699           reinterpret_cast <FReal (*)(FReal *)> (fun), 
02700           chopt.c_str(), &np, param, step, pmin, pmax, sigpar, &chi2, 
02701           chopt.length());
02702 }
02703 
02704 // 7.1.4 Naming the parameters of a fit
02705 
02706 template<int chpnamlen> 
02707 void hfinam (FInteger id, 
02708              const FCharacter chpnam[][chpnamlen],
02709              FInteger npar) {
02710   FCharacter *chpnam_ = new FCharacter [npar*chpnamlen];
02711   charray_to_fortran (npar, chpnamlen, chpnam [0], chpnam_);             
02712   hfinam_ (&id, chpnam_, &npar, chpnamlen);
02713   delete[] chpnam_;
02714 }
02715 void hfinam (FInteger id, 
02716              const string chpnam[],
02717              FInteger npar);
02718 void hfinam (FInteger id, 
02719              const vector<string>& chpnam,
02720              FInteger npar);
02721 template <int fitnamlen>
02722 void hgfit  (FInteger id,
02723              FInteger& nfpar,
02724              FInteger& npfits,
02725              FReal& fitchi,
02726              FReal fitpar [],
02727              FReal fitsig [],
02728              FCharacter fitnam[][fitnamlen]) {
02729   FCharacter *fitnam_ = new FCharacter [nfpar*fitnamlen];
02730   charray_to_fortran (nfpar, fitnamlen, fitnam[0], fitnam_);
02731   hgfit_ (&id, &nfpar, &npfits, &fitchi, fitpar, fitsig, fitnam_, fitnamlen);
02732   delete[] fitnam_;
02733 }                  
02734 void hgfit  (FInteger id,
02735              FInteger& nfpar,
02736              FInteger& npfits,
02737              FReal& fitchi,
02738              FReal fitpar [],
02739              FReal fitsig [],
02740              string fitnam[]);
02741                 
02742 // 7.1.5 The user parametric function
02743 
02744 inline void hderiv (FReal deriv[]) {
02745   hderiv_ (deriv);
02746 }
02747 
02748 // 7.2 Basic concepts of Minuit
02749 
02750 // 7.3 Deprecated fitting routines
02751 
02752 // The following deprecated routines are not supported by this package:
02753   // hfitl
02754   // hfits
02755   // hfitn
02756   // hfit1
02757   // hfitex
02758   // hfitga
02759   // hfitpo
02760 
02761 // 7.4 Parametrization
02762 
02763 inline void hparam (FInteger id,
02764                     FInteger ic,
02765                     FReal r2min,
02766                     const FInteger maxpow [],
02767                     FInteger iterm [],
02768                     FInteger& nco,
02769                     FReal8 coeff []) {
02770   hparam_ (&id, &ic, &r2min, maxpow, iterm, &nco, coeff);
02771 }                   
02772 inline void hsetpr (const FCharacter *chname,
02773                     FReal value) {
02774   hsetpr_ (chname, &value, strlen (chname));
02775 }
02776 inline void hsetpr (const string& chname,
02777                     FReal value) {
02778   hsetpr_ (chname.c_str(), &value, chname.length());
02779 }
02780 inline void hparmn (const FReal x [],
02781                     const FReal y [],
02782                     const FReal ey [],
02783                     FInteger np,
02784                     FInteger nvar,
02785                     FInteger ic,
02786                     FReal r2min,
02787                     const FInteger maxpow [],
02788                     FReal8 coeff [],
02789                     FInteger iterm [],
02790                     FInteger& nco) {
02791   hparmn_ (x, y, ey, &np, &nvar, &ic, &r2min, maxpow, coeff, iterm, &nco);
02792 }                   
02793                
02794 // 7.5 Smoothing
02795 
02796 inline FReal hsmoof (FInteger id,
02797                      FInteger icase,
02798                      FReal& chi2) {
02799   hsmoof_ (&id, &icase, &chi2);
02800   return chi2;
02801 }
02802 inline FReal hsmoof (FInteger id,
02803                      FInteger icase = 0) {
02804   FReal chi2 = 0;
02805   hsmoof_ (&id, &icase, &chi2);
02806   return chi2;
02807 }
02808 inline FReal hspli1 (FInteger id,
02809                      FInteger ic,
02810                      FInteger n,
02811                      FInteger k,
02812                      FReal& chi2) {
02813   hspli1_ (&id, &ic, &n, &k, &chi2);
02814   return chi2;
02815 }
02816 inline FReal hspli1 (FInteger id,
02817                      FInteger ic,
02818                      FInteger n,
02819                      FInteger k) {
02820   FReal chi2 = 0;
02821   hspli1_ (&id, &ic, &n, &k, &chi2);
02822   return chi2;
02823 }
02824 inline void hspli2 (FInteger id,
02825                     FInteger nx,
02826                     FInteger ny,
02827                     FInteger kx,
02828                     FInteger ky) {
02829   hspli2_ (&id, &nx, &ny, &kx, &ky);
02830 }
02831 inline FReal hspfun (FInteger id,
02832                      FReal x,
02833                      FInteger n,
02834                      FInteger k) {
02835   return hspfun_ (&id, &x, &n, &k);
02836 }
02837 inline FInteger hquad  (FInteger id,
02838                         const FCharacter *chopt,
02839                         FInteger mode,
02840                         FReal sensit,
02841                         FReal smooth,
02842                         FInteger& nsig,
02843                         FReal& chisq,
02844                         FInteger& ndf,
02845                         FReal& fmin,
02846                         FReal& fmax,
02847                         FInteger& ierr) {
02848   hquad_ (&id, chopt, &mode, &sensit, &smooth, &nsig, &chisq, &ndf, &fmin, &fmax, &ierr, 
02849           strlen (chopt));
02850   return ierr;
02851 }
02852 inline FInteger hquad  (FInteger id,
02853                         const FCharacter *chopt,
02854                         FInteger mode,
02855                         FReal sensit,
02856                         FReal smooth,
02857                         FInteger& nsig,
02858                         FReal& chisq,
02859                         FInteger& ndf,
02860                         FReal& fmin,
02861                         FReal& fmax) {
02862   FInteger ierr = 0;
02863   hquad_ (&id, chopt, &mode, &sensit, &smooth, &nsig, &chisq, &ndf, &fmin, &fmax, &ierr, 
02864           strlen (chopt));
02865   return ierr;
02866 }
02867 inline FInteger hquad  (FInteger id,
02868                         const string& chopt,
02869                         FInteger mode,
02870                         FReal sensit,
02871                         FReal smooth,
02872                         FInteger& nsig,
02873                         FReal& chisq,
02874                         FInteger& ndf,
02875                         FReal& fmin,
02876                         FReal& fmax,
02877                         FInteger& ierr) {
02878   hquad_ (&id, chopt.c_str(), &mode, &sensit, &smooth, &nsig, &chisq, &ndf, &fmin, &fmax, &ierr, 
02879           chopt.length());
02880   return ierr;
02881 }
02882 inline FInteger hquad  (FInteger id,
02883                         const string& chopt,
02884                         FInteger mode,
02885                         FReal sensit,
02886                         FReal smooth,
02887                         FInteger& nsig,
02888                         FReal& chisq,
02889                         FInteger& ndf,
02890                         FReal& fmin,
02891                         FReal& fmax) {
02892   FInteger ierr = 0;
02893   hquad_ (&id, chopt.c_str(), &mode, &sensit, &smooth, &nsig, &chisq, &ndf, &fmin, &fmax, &ierr, 
02894           chopt.length());
02895   return ierr;
02896 }
02897 
02898 // 7.6 Random number generation
02899 
02900 inline FReal hrndm1 (FInteger id) {
02901   return hrndm1_ (&id);
02902 }
02903 inline void hrndm2 (FInteger id, 
02904                     FReal& rx, 
02905                     FReal& ry) {
02906   hrndm2_ (&id, &rx, &ry);
02907 }
02908 
02909 // 7.7 Fitting with Monte Carlo statistics
02910 
02911 inline void hmcmll (FInteger idd,
02912                     const FInteger idm[],
02913                     const FInteger idw[],
02914                     FInteger nsrc,
02915                     const FCharacter *chopt,
02916                     const FInteger ifix[],
02917                     const FReal frc[],
02918                     const FReal flim[][2],
02919                     const FReal start[],
02920                     const FReal step[],
02921                     FReal up,
02922                     FReal par[],
02923                     FReal dpar[]) {
02924   hmcmll_ (&idd, idm, idw, &nsrc, chopt, ifix, frc, flim, start, step, &up, par, dpar, 
02925            strlen (chopt));
02926 }
02927 inline void hmcmll (FInteger idd,
02928                     const FInteger idm[],
02929                     const FInteger idw[],
02930                     FInteger nsrc,
02931                     const string& chopt,
02932                     const FInteger ifix[],
02933                     const FReal frc[],
02934                     const FReal flim[][2],
02935                     const FReal start[],
02936                     const FReal step[],
02937                     FReal up,
02938                     FReal par[],
02939                     FReal dpar[]) {
02940   hmcmll_ (&idd, idm, idw, &nsrc, chopt.c_str(), ifix, frc, flim, start, step, &up, par, dpar, 
02941            chopt.length());
02942 }
02943 inline FInteger hmcini (FInteger iddata, 
02944                         const FInteger idmc[],
02945                         const FInteger idwt[],
02946                         FInteger nsrc,
02947                         const FCharacter *chopt,
02948                         FInteger& ierr) {
02949   hmcini_ (&iddata, idmc, idwt, &nsrc, chopt, &ierr, strlen (chopt));
02950   return ierr;
02951 }
02952 inline FInteger hmcini (FInteger iddata, 
02953                         const FInteger idmc[],
02954                         const FInteger idwt[],
02955                         FInteger nsrc,
02956                         const FCharacter *chopt = " ") {
02957   FInteger ierr = 0;
02958   hmcini_ (&iddata, idmc, idwt, &nsrc, chopt, &ierr, strlen (chopt));
02959   return ierr;
02960 }
02961 inline FInteger hmcini (FInteger iddata, 
02962                         const FInteger idmc[],
02963                         const FInteger idwt[],
02964                         FInteger nsrc,
02965                         const string& chopt,
02966                         FInteger& ierr) {
02967   hmcini_ (&iddata, idmc, idwt, &nsrc, chopt.c_str(), &ierr, chopt.length());
02968   return ierr;
02969 }
02970 inline FInteger hmcini (FInteger iddata, 
02971                         const FInteger idmc[],
02972                         const FInteger idwt[],
02973                         FInteger nsrc,
02974                         const string& chopt) {
02975   FInteger ierr = 0;
02976   hmcini_ (&iddata, idmc, idwt, &nsrc, chopt.c_str(), &ierr, chopt.length());
02977   return ierr;
02978 }
02979 inline FReal8 hmclnl (const FReal frac[]) {
02980   return hmclnl_ (frac);
02981 }
02982  
02983 // =============================================================================             
02984 // Chapter 8: Memory management and input/output routines
02985 // =============================================================================             
02986 
02987 // 8.2 Memory size control
02988 
02989 inline void hlimit (FInteger npaw) {
02990   hlimit_ (&npaw);
02991 }
02992 inline FInteger hlocat (FInteger id,
02993                         FInteger &loc) {
02994   hlocat_ (&id, &loc);
02995   return loc;
02996 }
02997 inline FInteger hlocat (FInteger id) {
02998   FInteger loc = 0;
02999   hlocat_ (&id, &loc);
03000   return loc;
03001 }
03002   
03003 // 8.3 Directories
03004 
03005 inline void hmdir (const FCharacter *chpath, 
03006                    const FCharacter *chopt = " ") {
03007   hmdir_ (chpath, chopt, strlen (chpath), strlen (chopt));
03008 }
03009 inline void hmdir (const string& chpath, 
03010                    const string& chopt = " ") {
03011   hmdir_ (chpath.c_str(), chopt.c_str(), chpath.length(), chopt.length());
03012 }
03013 inline void hcdir (const FCharacter *chpath, 
03014                    const FCharacter *chopt = " ") {
03015   hcdir_ (chpath, chopt, strlen (chpath), strlen (chopt));
03016 }
03017 inline void hcdir (const string& chpath, 
03018                    const string& chopt = " ") {
03019   hcdir_ (chpath.c_str(), chopt.c_str(), chpath.length(), chopt.length());
03020 }
03021 inline void hldir (const FCharacter *chpath, 
03022                    const FCharacter *chopt = " ") {
03023   hldir_ (chpath, chopt, strlen (chpath), strlen (chopt));
03024 }
03025 inline void hldir (const string& chpath, 
03026                    const string& chopt = " ") {
03027   hldir_ (chpath.c_str(), chopt.c_str(), chpath.length(), chopt.length());
03028 }
03029 inline void hddir (const FCharacter *chpath = " ") {
03030   hddir_ (chpath, strlen (chpath));
03031 }
03032 inline void hddir (const string& chpath) {
03033   hddir_ (chpath.c_str(), chpath.length());
03034 }
03035 inline void hpdir (const FCharacter *chpath, 
03036                    const FCharacter *chopt = " ") {
03037   hpdir_ (chpath, chopt, strlen (chpath), strlen (chopt));
03038 }
03039 inline void hpdir (const string& chpath, 
03040                    const string& chopt = " ") {
03041   hpdir_ (chpath.c_str(), chopt.c_str(), chpath.length(), chopt.length());
03042 }
03043 template<int chtypelen, int chtitllen>
03044 FInteger hlnext (FInteger& idh,
03045                  FCharacter chtype[chtypelen], 
03046                  FCharacter chtitl[chtitllen], 
03047                  const FCharacter *chopt = " ") {
03048   FCharacter *chtype_ = new FCharacter [chtypelen];
03049   charray_to_fortran (1, chtypelen, chtype, chtype_);
03050   hlnext_ (&idh, chtype_, chtitl, chopt, chtypelen, chtitllen, strlen (chopt));
03051   charray_from_fortran (1, chtypelen, chtype_, chtype);
03052   charray_from_fortran (1, chtitllen, chtitl, chtitl);
03053   delete[] chtype_;
03054   return idh;
03055 }
03056 FInteger hlnext (FInteger& idh,
03057                  string& chtype, 
03058                  string& chtitl, 
03059                  const FCharacter *chopt = " "); 
03060 template<int chdirlen>
03061 FInteger hrdir  (FInteger maxdir,
03062                  FCharacter chdir[][chdirlen],
03063                  FInteger &ndir) {
03064   hrdir_ (&maxdir, chdir [0], &ndir, chdirlen);
03065   charray_from_fortran (ndir, chdirlen, chdir, chdir);
03066   return ndir;
03067 }
03068 template<int chdirlen>
03069 FInteger hrdir  (FInteger maxdir,
03070                  FCharacter chdir[][chdirlen]) {
03071   FInteger ndir = 0;
03072   hrdir_ (&maxdir, chdir [0], &ndir, chdirlen);
03073   charray_from_fortran (ndir, chdirlen, chdir, chdir);
03074   return ndir;
03075 }
03076 FInteger hrdir  (FInteger maxdir,
03077                  string chdir[],
03078                  FInteger &ndir);
03079 FInteger hrdir  (FInteger maxdir,
03080                  string chdir[]);
03081 
03082 // 8.4 Input/output routines
03083 
03084 inline void hrput (FInteger id = 0, 
03085                    const FCharacter *chfile = " ", 
03086                    const FCharacter *chopt = "N") {
03087   hrput_ (&id, chfile, chopt, strlen (chfile), strlen (chopt));
03088 }
03089 inline void hrput (FInteger id, 
03090                    const string& chfile, 
03091                    const string& chopt = "N") {
03092   hrput_ (&id, chfile.c_str(), chopt.c_str(), chfile.length(), chopt.length());
03093 }
03094 inline void hrget (FInteger id = 0, 
03095                    const FCharacter *chfile = " ", 
03096                    const FCharacter *chopt = "A") {
03097   hrget_ (&id, chfile, chopt, strlen (chfile), strlen (chopt));
03098 }
03099 inline void hrget (FInteger id, 
03100                    const string& chfile, 
03101                    const string& chopt = "A") {
03102   hrget_ (&id, chfile.c_str(), chopt.c_str(), chfile.length(), chopt.length());
03103 }
03104 inline FInteger hropen (FInteger lun, 
03105                     const FCharacter *chtop, 
03106                     const FCharacter *chfile, 
03107                     const FCharacter *chopt,
03108                     FInteger& lrec,
03109                     FInteger& istat) {
03110   hropen_ (&lun, chtop, chfile, chopt, &lrec, &istat, 
03111            strlen (chtop), strlen (chfile), strlen (chopt));
03112            return istat;
03113 }
03114 inline FInteger hropen (FInteger lun, 
03115                     const FCharacter *chtop, 
03116                     const FCharacter *chfile, 
03117                     const FCharacter *chopt,
03118                     FInteger& lrec) {
03119   FInteger istat = 0;
03120   hropen_ (&lun, chtop, chfile, chopt, &lrec, &istat, 
03121            strlen (chtop), strlen (chfile), strlen (chopt));
03122            return istat;
03123 }
03124 /*
03125 // The following two overloaded functions do not compile under aCC
03126 inline int hropen  (FInteger lun, 
03127                     const FCharacter *chtop, 
03128                     const FCharacter *chfile, 
03129                     const FCharacter *chopt,
03130                     const FInteger lrec,
03131                     FInteger& istat) {
03132   FInteger local_lrec = lrec;
03133   hropen_ (&lun, chtop, chfile, chopt, &local_lrec, &istat, 
03134            strlen (chtop), strlen (chfile), strlen (chopt));
03135            return istat;
03136 }
03137 inline int hropen  (FInteger lun, 
03138                     const FCharacter *chtop, 
03139                     const FCharacter *chfile, 
03140                     const FCharacter *chopt = " ",
03141                     const FInteger lrec = 0) {
03142   FInteger local_lrec = lrec;
03143   FInteger istat = 0;
03144   hropen_ (&lun, chtop, chfile, chopt, &local_lrec, &istat, 
03145            strlen (chtop), strlen (chfile), strlen (chopt));
03146            return istat;
03147 }
03148 */
03149 inline int hropen (FInteger lun, 
03150                     const string& chtop, 
03151                     const string& chfile, 
03152                     const string& chopt,
03153                     FInteger& lrec,
03154                     FInteger& istat) {
03155   hropen_ (&lun, chtop.c_str(), chfile.c_str(), chopt.c_str(), &lrec, &istat, 
03156            chtop.length(), chfile.length(), chopt.length());
03157            return istat;
03158 }
03159 inline int hropen (FInteger lun, 
03160                     const string& chtop, 
03161                     const string& chfile, 
03162                     const string& chopt,
03163                     FInteger& lrec) {
03164   FInteger istat = 0;
03165   hropen_ (&lun, chtop.c_str(), chfile.c_str(), chopt.c_str(), &lrec, &istat, 
03166            chtop.length(), chfile.length(), chopt.length());
03167            return istat;
03168 }
03169 /*
03170 // The following two overloaded functions do not compile under aCC
03171 inline int hropen (FInteger lun, 
03172                     const string& chtop, 
03173                     const string& chfile, 
03174                     const string& chopt,
03175                     const FInteger lrec,
03176                     FInteger& istat) {
03177   FInteger local_lrec = lrec;
03178   hropen_ (&lun, chtop.c_str(), chfile.c_str(), chopt.c_str(), &local_lrec, &istat, 
03179            chtop.length(), chfile.length(), chopt.length());
03180            return istat;
03181 }
03182 inline int hropen (FInteger lun, 
03183                     const string& chtop, 
03184                     const string& chfile, 
03185                     const string& chopt = " ",
03186                     const FInteger lrec = 0) {
03187   FInteger local_lrec = lrec;
03188   FInteger istat = 0;
03189   hropen_ (&lun, chtop.c_str(), chfile.c_str(), chopt.c_str(), &local_lrec, &istat, 
03190            chtop.length(), chfile.length(), chopt.length());
03191            return istat;
03192 }
03193 */
03194 inline void hrfile (FInteger lun, 
03195                     const FCharacter *chtop, 
03196                     const FCharacter *chopt) {
03197   hrfile_ (&lun, chtop, chopt, strlen (chtop), strlen (chopt));
03198 }
03199 inline void hrfile (FInteger lun, 
03200                     const string& chtop, 
03201                     const string& chopt) {
03202   hrfile_ (&lun, chtop.c_str(), chopt.c_str(), chtop.length(), chopt.length());
03203 }
03204 inline FInteger hrout (FInteger id,
03205                        FInteger& icycle,
03206                        const FCharacter *chopt = " ") {
03207    hrout_ (&id, &icycle, chopt, strlen (chopt));
03208    return icycle;
03209 }                    
03210 inline FInteger hrout (FInteger id,
03211                        const FCharacter *chopt = " ") {
03212    FInteger icycle = 0;
03213    hrout_ (&id, &icycle, chopt, strlen (chopt));
03214    return icycle;
03215 }                    
03216 inline FInteger hrout (FInteger id,
03217                        const string& chopt) {
03218    FInteger icycle = 0;
03219    hrout_ (&id, &icycle, chopt.c_str(), chopt.length());
03220    return icycle;
03221 }                    
03222 inline void hrin (FInteger id, 
03223                   FInteger icycle,
03224                   FInteger ioffset = 0) {
03225   hrin_ (&id, &icycle, &ioffset);
03226 }
03227 template<int chfinlen>
03228 inline void hmerge (FInteger nfiles,
03229                     const FCharacter chfin [][chfinlen],
03230                     const FCharacter *chfout) {
03231   hmerge_ (&nfiles, chfin[0], chfout, chfinlen, strlen (chfout));
03232 }                     
03233 void hmerge (FInteger nfiles,
03234              const string chfin [],
03235              const string& chfout);
03236 inline void hmergin () {
03237   hmergin_ ();
03238 }
03239 inline void hscr (FInteger id = 0, 
03240                   FInteger icycle = 0,
03241                   const FCharacter *chopt = " ") {
03242   hscr_ (&id, &icycle, chopt, strlen (chopt));
03243 }
03244 inline void hscr (FInteger id, 
03245                   FInteger icycle,
03246                   const string& chopt) {
03247   hscr_ (&id, &icycle, chopt.c_str(), chopt.length());
03248 }
03249 inline void hrend (const FCharacter *chtop = " ") {
03250    hrend_ (chtop, strlen (chtop));
03251 }                    
03252 inline void hrend (const string& chtop) {
03253    hrend_ (chtop.c_str(), chtop.length());
03254 }                    
03255 
03256 
03257 //==============================================================================
03258 // The PAWC common
03259 
03260 // For a discussion of the initialization technique used here, see
03261 // B. Stroustrup, The C++ programming language, 3rd ed., p. 639.
03262 
03263 struct PAWC_Type {
03264   FInteger memor[NHMEM];
03265   
03266   struct Init {
03267     Init() {
03268       if (count++ == 0) {
03269         hlimit (NHMEM);
03270       }
03271     }
03272     
03273     ~Init() {
03274       --count;
03275     }
03276     
03277     static int count;  
03278   };
03279 };
03280 
03281 static PAWC_Type::Init pawc_init_; 
03282 
03283 #endif /* ifdef __cplusplus */
03284 
03285 // Interface to fitting common block
03286 
03287 struct HCFITDType;
03288 extern HCFITDType hcfitd_;
03289 
03290 struct HCFITDType {
03291   FReal8 dpar [24];
03292   FReal8 fitfun;
03293   
03294 #ifdef __cplusplus
03295   inline static FReal8 getDPar (int i);
03296   inline static FReal8 getFitFun ();
03297   inline static FReal8 setDPar (int i, double d);
03298   inline static FReal8 setFitFun (FReal8 f);
03299 
03300 #endif /* ifdef __cplusplus */
03301 };
03302 #ifdef __cplusplus
03303 FReal8 HCFITDType::getDPar (int i) {
03304   return (i >= 0 && i < 24) ? hcfitd_.dpar [i] : 0;
03305 }
03306 FReal8 HCFITDType::getFitFun () {
03307   return hcfitd_.fitfun;
03308 }
03309 FReal8 HCFITDType::setDPar (int i, double d) {
03310   return (i >= 0 && i < 24) ? (hcfitd_.dpar [i] = d) : 0;
03311 }
03312 FReal8 HCFITDType::setFitFun (FReal8 f) {
03313   return (hcfitd_.fitfun = f);
03314 }
03315 #endif /* ifdef __cplusplus */
03316 
03317 // Interface to IQUEST common block
03318 struct QUESTType;
03319 extern QUESTType quest_;
03320 
03321 struct QUESTType {
03322   FInteger iquest [100];
03323   
03324 #ifdef __cplusplus
03325   inline static FInteger getIFXLow ();
03326   inline static FInteger getIFXUp ();
03327   inline static FInteger getIFYLow ();
03328   inline static FInteger getIFYUp ();
03329   inline static FInteger setIFXLow (int i);
03330   inline static FInteger setIFXUp (int i);
03331   inline static FInteger setIFYLow (int i);
03332   inline static FInteger setIFYUp (int i);
03333 
03334 #endif /* ifdef __cplusplus */
03335 };
03336 #ifdef __cplusplus
03337 FInteger QUESTType::getIFXLow ()      {return quest_.iquest [10];}
03338 FInteger QUESTType::getIFXUp ()       {return quest_.iquest [11];}
03339 FInteger QUESTType::getIFYLow ()      {return quest_.iquest [12];}
03340 FInteger QUESTType::getIFYUp ()       {return quest_.iquest [13];}
03341 FInteger QUESTType::setIFXLow (int i) {return quest_.iquest [10] = i;}
03342 FInteger QUESTType::setIFXUp (int i)  {return quest_.iquest [11] = i;}
03343 FInteger QUESTType::setIFYLow (int i) {return quest_.iquest [12] = i;}
03344 FInteger QUESTType::setIFYUp (int i)  {return quest_.iquest [13] = i;}
03345 #endif /* ifdef __cplusplus */                               
03346 
03347 #endif /* ifdef H_HBOOK */

Generated on Fri Sep 14 17:38:21 2007 for Kinfit by doxygen 1.3.2