![]() |
|
|
Generated: 18 Jul 2008 |
00001 // $Header: /local/reps/Gaudi/HbookCnv/src/HbookDef.h,v 1.10 2005/12/02 14:45:52 hmd Exp $ 00002 #ifndef HBOOKCNVSVC_HBOOKDEF_H 00003 #define HBOOKCNVSVC_HBOOKDEF_H 1 00004 00005 // Include files 00006 #include <string> 00007 00008 //------------------------------------------------------------------------------ 00009 // 00010 // Description: Definitions of HBOOK subroutines used in HbookCnv 00011 // 00012 // Author: Pavel Binko 00013 // 00014 //------------------------------------------------------------------------------ 00015 00016 class NTUPLEINFO; 00017 00018 // Global flag to switch between explicit data types 00019 // for row-wise N-tuples and FLOAT only version 00020 enum DataTypePolicy { USE_DATA_TYPES, FLOAT_ONLY, FORTRAN_STYLE, HUNGARIAN_STYLE }; 00021 extern long dataTypePolicy(); 00022 00023 inline void cleanForString(char* title, long len) { 00024 for ( int i = len; i >= 0; i-- ) { 00025 if ( title[i]==' ' || title[i] == 0 ) title[i] = 0; 00026 else if ( title[i]!=' ' ) break; 00027 } 00028 title[len] = 0; 00029 } 00030 00031 extern "C" { 00032 00033 // This structure MUST map to the upper fortran structure 00034 #ifdef _WIN32 00035 #define HBOOK_CALL_TYPE __stdcall 00036 void HBOOK_CALL_TYPE HBOOK1( const long&, const char*, int, const long&, const float&, 00037 const float&, const float& ); 00038 void HBOOK_CALL_TYPE HBOOKB( const long&, const char*, int, const long&, const float*, const float& ); 00039 void HBOOK_CALL_TYPE HBOOK2( const long&, const char*, int, const long&, const float&, 00040 const float&, const long&, const float&, 00041 const float&, const float& ); 00042 void HBOOK_CALL_TYPE CLOSEHBOOK(const char*, int, const char*, int); 00043 void HBOOK_CALL_TYPE INITHBOOK(const char*, int, const char*, int, 00044 const int&, const int&, const int&); 00045 void HBOOK_CALL_TYPE INITHBOOKNF(const int&); 00046 void HBOOK_CALL_TYPE SETMEANRMS( const long&, const float&, const float&, const float&, const float& ); 00047 void HIDOPT(const long&, const char*, int); 00048 void HBOOK_CALL_TYPE HGIVE (const int&, char*, int, int&, float&, float&, int&, float&, float&, int&, int&); 00049 void HBOOK_CALL_TYPE HUNPAK(const int&, float*, const char*, int, int&); 00050 void HBOOK_CALL_TYPE HUNPKE(const int&, float*, const char*, int, int&); 00051 float HBOOK_CALL_TYPE HSTATI(const int&, const int&, const char*, int, const int&); 00052 00053 int HBOOK_CALL_TYPE GETQUEST( const int& ) ; 00054 int HBOOK_CALL_TYPE SETQUEST( const int& , const int& ) ; 00055 00056 #else 00057 #define HBOOK_CALL_TYPE 00058 void hbook1_( const long&, const char*, const long&, const float&, 00059 const float&, const float&, int ); 00060 void hbookb_( const long&, const char*, const long&, const float*, const float&, int ); 00061 void hbook2_( const long&, const char*, const long&, const float&, 00062 const float&, const long&, const float&, 00063 const float&, const float&, int ); 00064 void closehbook_(const char*, const char*, int, int); 00065 void inithbook_(const char*, const char*, const int&, const int &, 00066 const int&, int, int); 00067 void inithbooknf_(const int&); 00068 void setmeanrms_(const long&, const float&, const float&, const float&, const float&); 00069 void hidopt_(const int&, const char*, int); 00070 void hgive_ (const int&, char*, int&, float&, float&, 00071 int&, float&, float&, 00072 int&, int&, int); 00073 void hunpak_(const int&, float*, const char*, const int&, int); 00074 void hunpke_(const int&, float*, const char*, const int&, int); 00075 float hstati_(const int&, const int&, const char*, const int&, int); 00076 00077 int getquest_( const int& ) ; 00078 int setquest_( const int& , const int& ) ; 00079 00080 #define HROUT hrout_ 00081 #define HDELET hdelet_ 00082 #define HFILL hfill_ 00083 #define HPAK hpak_ 00084 #define HPAKE hpake_ 00085 #define HFILL hfill_ 00086 #define HPRINT hprint_ 00087 #define HEXIST hexist_ 00088 #define HRESET hreset_ 00089 #define HPRNT hprnt_ 00090 #define HFNTB hfntb_ 00091 #define HFNT hfnt_ 00092 #define HFN hfn_ 00093 #define HGNT hgnt_ 00094 #define HGN hgn_ 00095 #define HGNF hgnf_ 00096 #define HGNPAR hgnpar_ 00097 #define HRIN hrin_ 00098 #define NTUPLETYPE ntupletype_ 00099 #define HREND hrend_ 00100 #define F77CLOSE f77close_ 00101 #define F77GETLUN f77getlun_ 00102 #define HNOENT hnoent_ 00103 #define HXYIJ hxyij_ 00104 #define HIJXY hijxy_ 00105 #define HX hx_ 00106 #define HXE hxe_ 00107 #define HI hi_ 00108 #define HIX hix_ 00109 #define HIE hie_ 00110 #define HIJ hij_ 00111 #define HIJE hije_ 00112 #define HXY hxy_ 00113 #define HKIND hkind_ 00114 00115 #define GETQUEST getquest_ 00116 #define SETQUEST setquest_ 00117 00118 #endif 00119 void HBOOK_CALL_TYPE HROUT(const long&, int*, const char*, int); 00120 void HBOOK_CALL_TYPE HDELET(const long&); 00121 void HBOOK_CALL_TYPE HFILL (const long&, const float&, const float&, const float& ); 00122 void HBOOK_CALL_TYPE HPAK (const long&, const void*); 00123 void HBOOK_CALL_TYPE HPAKE (const long&, const void*); 00124 00125 void HBOOK_CALL_TYPE F77CLOSE(const long&); 00126 long HBOOK_CALL_TYPE F77GETLUN(); 00127 void HBOOK_CALL_TYPE HPRINT (const long& id); 00128 long HBOOK_CALL_TYPE HEXIST (const long& id); 00129 void HBOOK_CALL_TYPE HPRNT (const long& id); 00130 void HBOOK_CALL_TYPE HFNTB (const long& id, const char* title, int); 00131 void HBOOK_CALL_TYPE HFNT (const long& id); 00132 void HBOOK_CALL_TYPE HFN (const long& id, const float* buffer); 00133 void HBOOK_CALL_TYPE HNOENT (const long& id, long& nument); 00134 void HBOOK_CALL_TYPE HRESET (const long& id, const char* title, int); 00135 void HBOOK_CALL_TYPE HRIN (const long&, const long&, const long&); 00136 void HBOOK_CALL_TYPE HGNT (const long&, const long&, long&); 00137 void HBOOK_CALL_TYPE HPRNTU (const long&); 00138 void HBOOK_CALL_TYPE HGNPAR (const long&, const char*, long); 00139 void HBOOK_CALL_TYPE HGNF (const long&, const long&, float*, long&); 00140 void HBOOK_CALL_TYPE HGN (const long&, long&, const long&, float*, long&); 00141 void HBOOK_CALL_TYPE HREND (const char*, int); 00142 void HBOOK_CALL_TYPE HKIND (const int&, long*, const char*, int); 00143 // Calls with interface... 00144 long HBOOK_CALL_TYPE NTUPLETYPE (const long&); 00145 void HBOOK_CALL_TYPE HIX (const long&, const long&, float&); 00146 void HBOOK_CALL_TYPE HXYIJ (const long&, const float&, const float&, long&, long&); 00147 void HBOOK_CALL_TYPE HIJXY (const long&, const long&, const long&, float&, float&); 00148 float HBOOK_CALL_TYPE HX (const long&, const float&); 00149 float HBOOK_CALL_TYPE HXE (const long&, const float&); 00150 float HBOOK_CALL_TYPE HXY (const long&, const float&, const float&); 00151 float HBOOK_CALL_TYPE HXYE (const long&, const float&, const float&); 00152 float HBOOK_CALL_TYPE HI (const long&, const long&); 00153 float HBOOK_CALL_TYPE HIE (const long&, const long&); 00154 float HBOOK_CALL_TYPE HIJ (const long&, const long&, const long&); 00155 float HBOOK_CALL_TYPE HIJE (const long&, const long&, const long&); 00156 } 00157 00158 void HLDIR(const std::string& a, const std::string& b = " "); 00159 void HCDIR(const std::string& a, const std::string& b = " "); 00160 void HMDIR(const std::string& a, const std::string& b = " "); 00161 void HBNAME (const long& id, const std::string& a, const void* opt, const std::string& b); 00162 void HROPEN(const long& lun, const std::string& a, const std::string& b, const std::string& c, long& i, long& j); 00163 void HLNEXT(long& id, std::string& a, std::string& b, const std::string& c); 00164 long RWNT_BOOK(const NTUPLEINFO& ); 00165 long RWNT_INFO(NTUPLEINFO& ); 00166 long CWNT_BOOK(const NTUPLEINFO& ); 00167 long CWNT_INFO(NTUPLEINFO& ); 00168 00169 #ifdef _WIN32 00170 inline void HBOOK1(int id, const std::string& t, int nx, float l, float h) 00171 { HBOOK1(id, t.data(), t.length(), nx, l, h, 0.0); } 00172 inline void HBOOKB(int id, const std::string& t, int nx, float* l) 00173 { HBOOKB(id, t.data(), t.length(), nx, l, 0.0); } 00174 inline void HBOOK2(int id, const std::string& t, int nx, float l, float h, int ny, float x, float y) 00175 { HBOOK2(id, t.data(), t.length(), nx, l, h, ny, x, y, 0.0); } 00176 inline void CLOSE_HBOOK(const std::string& a, const std::string& b) 00177 { CLOSEHBOOK(a.data(), a.length(), b.data(), b.length()); } 00178 inline void INIT_HBOOK(const std::string& a, const std::string& b, 00179 const int nw, const int nrec, const int recl) 00180 { INITHBOOK(a.data(), a.length(), b.data(), b.length(), nw, nrec, recl); } 00181 inline void INIT_HBOOK(const int nw) 00182 { INITHBOOKNF(nw); } 00183 inline void SET_MEAN_RMS(long histoID, float mean, float rms, float sumOfHeights, float equivEntries) 00184 { SETMEANRMS(histoID, mean, rms, sumOfHeights, equivEntries); } 00185 inline void HIDOPT(int id, const std::string& t) 00186 { HIDOPT(id, t.data(), t.length()); } 00187 inline void HUNPAK(int id, float* buff, const std::string& opt, int nslice = 0) 00188 { HUNPAK(id, buff, opt.data(), opt.length(), nslice); } 00189 inline void HUNPKE(int id, float* buff, const std::string& opt, int nslice = 0) 00190 { HUNPKE(id, buff, opt.data(), opt.length(), nslice); } 00191 inline float HSTATI(int id, int what, const std::string& opt, int nslice = 0) 00192 { return HSTATI(id, what, opt.data(), opt.length(), nslice); } 00193 inline void HGIVE (int id, std::string& title, 00194 int& nx, float& xmi, float& xma, 00195 int& ny, float& ymi, float& yma, 00196 int& nwd, int& loc) { 00197 char tit[80]; 00198 HGIVE(id, tit, sizeof(tit), nx, xmi, xma, ny, ymi, yma, nwd, loc); 00199 cleanForString(tit, sizeof(tit)-1); 00200 title = tit; 00201 } 00202 00203 #else 00204 00205 inline void HBOOK1(int id, const std::string& t, int nx, float l, float h) 00206 { hbook1_(id, t.data(), nx, l, h, 0.0, t.length()); } 00207 inline void HBOOKB(int id, const std::string& t, int nx, float* l) 00208 { hbookb_(id, t.data(), nx, l, 0.0, t.length()); } 00209 inline void HBOOK2(int id, const std::string& t, int nx, float l, float h, int ny, float x, float y) 00210 { hbook2_(id, t.data(), nx, l, h, ny, x, y, 0.0, t.length()); } 00211 inline void CLOSE_HBOOK(const std::string& a, const std::string& b) 00212 { closehbook_(a.data(), b.data(), a.length(), b.length()); } 00213 inline void INIT_HBOOK(const std::string& a, const std::string& b, 00214 const int nw, const int nrec, const int recl) 00215 { inithbook_(a.data(), b.data(), nw, nrec, recl, a.length(), b.length()); } 00216 inline void INIT_HBOOK(const int nw) 00217 { inithbooknf_(nw); } 00218 inline void SET_MEAN_RMS(long histoID, float mean, float rms, float sumOfHeights, float equivEntries) 00219 { setmeanrms_(histoID, mean, rms, sumOfHeights, equivEntries); } 00220 inline void HIDOPT(int id, const std::string& t) 00221 { hidopt_(id, t.data(), t.length()); } 00222 inline void HUNPAK(int id, float* buff, const std::string& opt, int nslice = 0) 00223 { hunpak_(id, buff, opt.data(), nslice, opt.length()); } 00224 inline void HUNPKE(int id, float* buff, const std::string& opt, int nslice = 0) 00225 { hunpke_(id, buff, opt.data(), nslice, opt.length()); } 00226 inline void HGIVE (int id, std::string& title, 00227 int& nx, float& xmi, float& xma, 00228 int& ny, float& ymi, float& yma, 00229 int& nwd, int& loc) { 00230 char tit[80]; 00231 hgive_(id, tit, nx, xmi, xma, ny, ymi, yma, nwd, loc, sizeof(tit)); 00232 cleanForString(tit, sizeof(tit)-1); 00233 title = tit; 00234 } 00235 inline float HSTATI(int id, int what, const std::string& opt, int nslice = 0) 00236 { return hstati_(id, what, opt.data(), nslice, opt.length()); } 00237 00238 #endif 00239 00240 #endif // HBOOKCNVSVC_HBOOKDEF_H 00241 00242 00243