Import Geant4 10.3.1 source tree
This commit is contained in:
@@ -1,791 +0,0 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_hbook_CHBOOK
|
||||
#define tools_hbook_CHBOOK
|
||||
|
||||
// A C interface to HBOOK.
|
||||
|
||||
#ifdef WIN32
|
||||
#include <cstring>
|
||||
#endif
|
||||
|
||||
namespace tools {
|
||||
namespace hbook {
|
||||
|
||||
#ifdef TOOLS_HBOOK_F2C_RET_DOUBLE
|
||||
typedef double rret;
|
||||
#else
|
||||
typedef float rret;
|
||||
#endif
|
||||
|
||||
#ifdef TOOLS_HBOOK_F2C_ARG_DOUBLE
|
||||
typedef double rarg;
|
||||
#else
|
||||
typedef float rarg;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/// functions with only a different name WIN32 versus UNIX //////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#ifdef WIN32
|
||||
extern "C" void __stdcall ZITOH(int*,int*,int*);
|
||||
extern "C" void __stdcall RZINK(int*,int*,const char *,int);
|
||||
extern "C" void __stdcall HLIMIT(int*);
|
||||
extern "C" void __stdcall HFILL(int*,rarg*,rarg*,rarg*);
|
||||
extern "C" void __stdcall HRIN(int*,int*,int*);
|
||||
extern "C" void __stdcall HNOENT(int*,int*);
|
||||
extern "C" void __stdcall HFNT(int*);
|
||||
extern "C" void __stdcall HGNPAR(int*,const char *,int);
|
||||
extern "C" void __stdcall HGNT(int*,int*,int*);
|
||||
extern "C" void __stdcall HDCOFL();
|
||||
extern "C" void __stdcall HDELET(int*);
|
||||
extern "C" void __stdcall HIJXY(int*,int*,int*,rarg*,rarg*);
|
||||
extern "C" rret __stdcall HIJE(int*,int*,int*);
|
||||
extern "C" rret __stdcall HIJ(int*,int*,int*);
|
||||
extern "C" rret __stdcall HIE(int*,int*);
|
||||
extern "C" void __stdcall HIX(int*,int*,rarg*);
|
||||
extern "C" void __stdcall HXI(int*,rarg*,int*);
|
||||
extern "C" rret __stdcall HI(int*,int*);
|
||||
extern "C" void __stdcall HXYIJ(int*,rarg*,rarg*,int*,int*);
|
||||
extern "C" rret __stdcall HMIN(int*);
|
||||
extern "C" rret __stdcall HMAX(int*);
|
||||
#else
|
||||
extern "C" void zitoh_(int*,int*,int*);
|
||||
extern "C" void rzink_(int*,int*,const char *,int);
|
||||
extern "C" void hlimit_(int*);
|
||||
extern "C" void hfill_(int*,rarg*,rarg*,rarg*);
|
||||
extern "C" void hrin_(int*,int*,int*);
|
||||
extern "C" void hnoent_(int*,int*);
|
||||
extern "C" void hfnt_(int*);
|
||||
extern "C" void hgnpar_(int*,const char *,int);
|
||||
extern "C" void hgnt_(int*,int*,int*);
|
||||
extern "C" void hdcofl_();
|
||||
extern "C" void hdelet_(int*);
|
||||
extern "C" void hijxy_(int*,int*,int*,rarg*,rarg*);
|
||||
extern "C" rret hije_(int*,int*,int*);
|
||||
extern "C" rret hij_(int*,int*,int*);
|
||||
extern "C" rret hie_(int*,int*);
|
||||
extern "C" void hix_(int*,int*,rarg*);
|
||||
extern "C" void hxi_(int*,rarg*,int*);
|
||||
extern "C" rret hi_(int*,int*);
|
||||
extern "C" void hxyij_(int*,rarg*,rarg*,int*,int*);
|
||||
extern "C" rret hmin_(int*);
|
||||
extern "C" rret hmax_(int*);
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/// functions with a different signature WIN32 versus UNIX //////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#ifdef WIN32
|
||||
#define DEFCHAR const char*,const int
|
||||
|
||||
extern "C" void __stdcall UHTOC(int*,int*,const char*,const int,int*);
|
||||
extern "C" void __stdcall HROPEN(int*,DEFCHAR,DEFCHAR,DEFCHAR,int*,int*);
|
||||
extern "C" void __stdcall HREND(DEFCHAR);
|
||||
extern "C" void __stdcall HROUT(int*,int*,DEFCHAR);
|
||||
extern "C" void __stdcall HGIVE(int*,DEFCHAR,int*,rarg*,rarg*,int*,rarg*,rarg*,int*,int*);
|
||||
extern "C" void __stdcall HGIVEN(int*,DEFCHAR,int*,DEFCHAR,rarg*,rarg*);
|
||||
extern "C" void __stdcall HBNT(int*,DEFCHAR,DEFCHAR);
|
||||
extern "C" void __stdcall HBNAME(int*,DEFCHAR,int*,DEFCHAR);
|
||||
extern "C" void __stdcall HBNAM(int*,DEFCHAR,int*,DEFCHAR,int*);
|
||||
extern "C" void __stdcall HBOOK1(int*,DEFCHAR,int*,rarg*,rarg*,rarg*);
|
||||
extern "C" void __stdcall HBOOK2(int*,DEFCHAR,int*,rarg*,rarg*,int*,rarg*,rarg*,rarg*);
|
||||
extern "C" void __stdcall HBOOKB(int*,DEFCHAR,int*,rarg*,rarg*);
|
||||
extern "C" void __stdcall HBPROF(int*,DEFCHAR,int*,rarg*,rarg*,rarg*,rarg*,DEFCHAR);
|
||||
extern "C" void __stdcall HCDIR(DEFCHAR,DEFCHAR);
|
||||
extern "C" void __stdcall HLDIR(DEFCHAR,DEFCHAR);
|
||||
extern "C" void __stdcall HMDIR(DEFCHAR,DEFCHAR);
|
||||
extern "C" void __stdcall HDDIR(DEFCHAR);
|
||||
extern "C" rret __stdcall HSTATI(int*,int*,DEFCHAR,int*);
|
||||
extern "C" void __stdcall HRESET(int*,DEFCHAR);
|
||||
extern "C" void __stdcall HOPERA(int*,DEFCHAR,int*,int*,rarg*,rarg*);
|
||||
extern "C" void __stdcall HKIND(int*,int*,DEFCHAR);
|
||||
|
||||
#undef DEFCHAR
|
||||
|
||||
#define PASSCHAR(a_string) a_string,::strlen(a_string)
|
||||
#else
|
||||
typedef const char* DEFCHAR;
|
||||
|
||||
extern "C" void uhtoc_(int*,int*,const char*,int*,int);
|
||||
extern "C" void hropen_(int*,DEFCHAR,DEFCHAR,DEFCHAR,int*,int*,int,int,int);
|
||||
extern "C" void hrend_(DEFCHAR,int);
|
||||
extern "C" void hrout_(int*,int*,DEFCHAR,int);
|
||||
extern "C" void hgive_(int*,DEFCHAR,int*,rarg*,rarg*,int*,rarg*,rarg*,int*,int*,int);
|
||||
extern "C" void hgiven_(int*,DEFCHAR,int*,DEFCHAR,rarg*,rarg*,int,int);
|
||||
extern "C" void hbnt_(int*,DEFCHAR,DEFCHAR,int,int);
|
||||
extern "C" void hbname_(int*,DEFCHAR,int*,DEFCHAR,int,int);
|
||||
extern "C" void hbnam_(int*,DEFCHAR,int*,DEFCHAR,int*,int,int);
|
||||
extern "C" void hbook1_(int*,DEFCHAR,int*,rarg*,rarg*,rarg*,int);
|
||||
extern "C" void hbook2_(int*,DEFCHAR,int*,rarg*,rarg*,int*,rarg*,rarg*,rarg*,int);
|
||||
extern "C" void hbookb_(int*,DEFCHAR,int*,rarg*,rarg*,int);
|
||||
extern "C" void hbprof_(int*,DEFCHAR,int*,rarg*,rarg*,rarg*,rarg*,DEFCHAR,int,int);
|
||||
extern "C" void hcdir_(DEFCHAR,DEFCHAR ,int,int);
|
||||
extern "C" void hldir_(DEFCHAR,DEFCHAR ,int,int);
|
||||
extern "C" void hmdir_(DEFCHAR,DEFCHAR ,int,int);
|
||||
extern "C" void hddir_(DEFCHAR,int);
|
||||
extern "C" rret hstati_(int*,int*,DEFCHAR,int*,int);
|
||||
extern "C" void hreset_(int*,DEFCHAR,int);
|
||||
extern "C" void hopera_(int*,DEFCHAR,int*,int*,rarg*,rarg*,int);
|
||||
extern "C" void hkind_(int*,int*,DEFCHAR,int);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
extern "C" int PAWC[1];
|
||||
extern "C" int QUEST[100];
|
||||
extern "C" int HCBOOK[51];
|
||||
extern "C" int RZCL[11];
|
||||
//extern "C" int HCBITS[37];
|
||||
#else
|
||||
extern "C" int pawc_[1];
|
||||
extern "C" int quest_[100];
|
||||
extern "C" int hcbook_[51];
|
||||
extern "C" int rzcl_[11];
|
||||
//extern "C" int hcbits_[37];
|
||||
#endif
|
||||
|
||||
}}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// our wrapping /////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cstring> //memset
|
||||
|
||||
namespace tools {
|
||||
namespace hbook {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// package //////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
inline void CHLIMIT(int a_num) {
|
||||
#ifdef WIN32
|
||||
HLIMIT(&a_num);
|
||||
#else
|
||||
hlimit_(&a_num);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHDELET(int a_id){
|
||||
#ifdef WIN32
|
||||
HDELET(&a_id);
|
||||
#else
|
||||
hdelet_(&a_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHDCOFL() {
|
||||
#ifdef WIN32
|
||||
HDCOFL();
|
||||
#else
|
||||
hdcofl_();
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CRZINK(int a_key,int a_cycle,const std::string& a_opts) {
|
||||
#ifdef WIN32
|
||||
RZINK(&a_key,&a_cycle,PASSCHAR(a_opts.c_str()));
|
||||
#else
|
||||
rzink_(&a_key,&a_cycle,a_opts.c_str(),a_opts.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CZITOH(int* a1,int* a2,int* a3) {
|
||||
#ifdef WIN32
|
||||
ZITOH(a1,a2,a3);
|
||||
#else
|
||||
zitoh_(a1,a2,a3);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int* get_pawc() {
|
||||
#ifdef WIN32
|
||||
return PAWC;
|
||||
#else
|
||||
return pawc_;
|
||||
#endif
|
||||
}
|
||||
inline int* get_quest() {
|
||||
#ifdef WIN32
|
||||
return QUEST;
|
||||
#else
|
||||
return quest_;
|
||||
#endif
|
||||
}
|
||||
//inline int* get_hcbits() {
|
||||
//#ifdef WIN32
|
||||
// return HCBITS;
|
||||
//#else
|
||||
// return hcbits_;
|
||||
//#endif
|
||||
//}
|
||||
inline int* get_hcbook() {
|
||||
#ifdef WIN32
|
||||
return HCBOOK;
|
||||
#else
|
||||
return hcbook_;
|
||||
#endif
|
||||
}
|
||||
inline int* get_rzcl() {
|
||||
#ifdef WIN32
|
||||
return RZCL;
|
||||
#else
|
||||
return rzcl_;
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// file /////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
inline int CHROPEN(int a1,const std::string& a2,const std::string& a3,const std::string& a4,int a5) {
|
||||
int ier = 0;
|
||||
#ifdef WIN32
|
||||
HROPEN(&a1,PASSCHAR(a2.c_str()),PASSCHAR(a3.c_str()),PASSCHAR(a4.c_str()),&a5,&ier);
|
||||
#else
|
||||
hropen_(&a1,a2.c_str(),a3.c_str(),a4.c_str(),&a5,&ier,a2.size(),a3.size(),a4.size());
|
||||
#endif
|
||||
return ier;
|
||||
}
|
||||
|
||||
|
||||
inline void CHRIN(int a_id,int a_cycle,int a_offset){
|
||||
#ifdef WIN32
|
||||
HRIN(&a_id,&a_cycle,&a_offset);
|
||||
#else
|
||||
hrin_(&a_id,&a_cycle,&a_offset);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHROUT(int a1,int a2,const std::string& a3) {
|
||||
#ifdef WIN32
|
||||
HROUT(&a1,&a2,PASSCHAR(a3.c_str()));
|
||||
#else
|
||||
hrout_(&a1,&a2,a3.c_str(),a3.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHREND(const std::string& a1) {
|
||||
#ifdef WIN32
|
||||
HREND(PASSCHAR(a1.c_str()));
|
||||
#else
|
||||
hrend_(a1.c_str(),a1.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHCDIR(const std::string& a1,const std::string& a2) {
|
||||
#ifdef WIN32
|
||||
HCDIR(PASSCHAR(a1.c_str()),PASSCHAR(a2.c_str()));
|
||||
#else
|
||||
hcdir_(a1.c_str(),a2.c_str(),a1.size(),a2.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHLDIR(const std::string& a1,const std::string& a2) {
|
||||
#ifdef WIN32
|
||||
HLDIR(PASSCHAR(a1.c_str()),PASSCHAR(a2.c_str()));
|
||||
#else
|
||||
hldir_(a1.c_str(),a2.c_str(),a1.size(),a2.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHPWDF(char* a_pwd) { //must be 1024 allocated.
|
||||
int l = 1024;
|
||||
{for(int i=0;i<l;i++) a_pwd[i] = 0;}
|
||||
static const char a2[] = "R";
|
||||
#ifdef WIN32
|
||||
HCDIR(a_pwd,l,a2,1);
|
||||
#else
|
||||
hcdir_(a_pwd,a2,l,1);
|
||||
#endif
|
||||
/*int len=0;*/
|
||||
{for(int i=l-1;i>0;i--) {
|
||||
if(a_pwd[i]==0) continue;
|
||||
if(a_pwd[i]!=' ') {/*len=i;*/break;}
|
||||
a_pwd[i] = 0;
|
||||
}}
|
||||
}
|
||||
|
||||
inline std::string CHPWD() {
|
||||
char pwd[1024];
|
||||
CHPWDF(pwd);
|
||||
return pwd;
|
||||
}
|
||||
|
||||
inline void CHMDIR(const std::string& a1,const std::string& a2) {
|
||||
#ifdef WIN32
|
||||
HMDIR(PASSCHAR(a1.c_str()),PASSCHAR(a2.c_str()));
|
||||
#else
|
||||
hmdir_(a1.c_str(),a2.c_str(),a1.size(),a2.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHDDIR(const std::string& a1) {
|
||||
#ifdef WIN32
|
||||
HDDIR(PASSCHAR(a1.c_str()));
|
||||
#else
|
||||
hddir_(a1.c_str(),a1.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHDIRS(bool a_PAWC,std::vector<std::string>& a_dirs){
|
||||
a_dirs.clear();
|
||||
|
||||
int* pawc = get_pawc();
|
||||
|
||||
if(a_PAWC) {
|
||||
|
||||
int* iq = &(pawc[17]);
|
||||
|
||||
int* lq = &(pawc[9]);
|
||||
int lcdir = get_hcbook()[6];
|
||||
int lf = lq[lcdir-1];
|
||||
while(lf!=0) {
|
||||
|
||||
int ncw = 4;
|
||||
//int ihdir[4];
|
||||
//CZITOH(iq+lf+1,ihdir,&ncw);
|
||||
int* ihdir = iq+lf+1;
|
||||
|
||||
char chdir[17];
|
||||
{for(int i=0;i<17;i++) chdir[i] = 0;}
|
||||
int nch=16;
|
||||
#ifdef WIN32
|
||||
UHTOC(ihdir,&ncw,chdir,16,&nch);
|
||||
#else
|
||||
uhtoc_(ihdir,&ncw,chdir,&nch,16);
|
||||
#endif
|
||||
{for(int i=17-1;i>0;i--) {
|
||||
if(chdir[i]==0) continue;
|
||||
if(chdir[i]!=' ') break;
|
||||
chdir[i] = 0;
|
||||
}}
|
||||
|
||||
a_dirs.push_back(chdir);
|
||||
|
||||
lf = lq[lf];
|
||||
}
|
||||
|
||||
} else { //On a UNIT.
|
||||
|
||||
int* iq = &(pawc[17]);
|
||||
|
||||
const int KLS = 26;
|
||||
const int KNSD = 23;
|
||||
int lcdir = get_rzcl()[2];
|
||||
int ls = iq[lcdir+KLS];
|
||||
int ndir = iq[lcdir+KNSD];
|
||||
for (int k=0;k<ndir;k++) {
|
||||
lcdir = get_rzcl()[2];
|
||||
int ncw = 4;
|
||||
int ihdir[4];
|
||||
CZITOH(iq+(lcdir+ls+7*k),ihdir,&ncw);
|
||||
|
||||
char chdir[17];
|
||||
{for(int i=0;i<17;i++) chdir[i] = 0;}
|
||||
int nch=16;
|
||||
#ifdef WIN32
|
||||
UHTOC(ihdir,&ncw,chdir,16,&nch);
|
||||
#else
|
||||
uhtoc_(ihdir,&ncw,chdir,&nch,16);
|
||||
#endif
|
||||
{for(int i=17-1;i>0;i--) {
|
||||
if(chdir[i]==0) continue;
|
||||
if(chdir[i]!=' ') break;
|
||||
chdir[i] = 0;
|
||||
}}
|
||||
|
||||
a_dirs.push_back(chdir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline std::vector<int> CHKEYS(){
|
||||
// Apply on a //LUN<unit> directory.
|
||||
std::vector<int> keys;
|
||||
int* quest = get_quest();
|
||||
for (int key=1;key<1000000;key++) {
|
||||
CRZINK(key,0,"S");
|
||||
if(quest[0]) break;
|
||||
if(quest[13] & 8) continue;
|
||||
int id = quest[20];
|
||||
keys.push_back(id);
|
||||
}
|
||||
return keys;
|
||||
}
|
||||
|
||||
inline bool CHEDIR(const std::string& a_dir,bool a_PAWC){
|
||||
std::vector<std::string> drs;
|
||||
CHDIRS(a_PAWC,drs);
|
||||
std::vector<std::string>::iterator it;
|
||||
for(it=drs.begin();it!=drs.end();++it){
|
||||
if(a_dir==(*it)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// histogram ////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
inline void CHBOOK1(int a_id,const std::string& a_title,int a_xnum,rarg a_xmin,rarg a_xmax,rarg a_vmx = 0) {
|
||||
#ifdef WIN32
|
||||
HBOOK1(&a_id,PASSCHAR(a_title.c_str()),&a_xnum,&a_xmin,&a_xmax,&a_vmx);
|
||||
#else
|
||||
hbook1_(&a_id,a_title.c_str(),&a_xnum,&a_xmin,&a_xmax,&a_vmx,a_title.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHBOOK2(int a_id,const std::string& a_title,int a_xnum,rarg a_xmin,rarg a_xmax,int a_ynum,rarg a_ymin,rarg a_ymax,rarg a_vmx = 0) {
|
||||
#ifdef WIN32
|
||||
HBOOK2(&a_id,PASSCHAR(a_title.c_str()),
|
||||
&a_xnum,&a_xmin,&a_xmax,&a_ynum,&a_ymin,&a_ymax,&a_vmx);
|
||||
#else
|
||||
hbook2_(&a_id,a_title.c_str(),
|
||||
&a_xnum,&a_xmin,&a_xmax,&a_ynum,&a_ymin,&a_ymax,&a_vmx,
|
||||
a_title.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline bool CHBOOKB(
|
||||
int a_id
|
||||
,const std::string& a_title
|
||||
,const std::vector<rarg>& a_edges
|
||||
,rarg a_vmx = 0
|
||||
) {
|
||||
if(!a_edges.size()) return false;
|
||||
|
||||
int edgen = (int)a_edges.size();
|
||||
rarg* edges = new rarg[edgen];
|
||||
for(int i=0;i<edgen;i++) edges[i] = a_edges[i];
|
||||
|
||||
int ncx = edgen-1;
|
||||
#ifdef WIN32
|
||||
HBOOKB(&a_id,PASSCHAR(a_title.c_str()),&ncx,edges,&a_vmx);
|
||||
#else
|
||||
hbookb_(&a_id,a_title.c_str(),&ncx,edges,&a_vmx,a_title.size());
|
||||
#endif
|
||||
delete [] edges;
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void CHBPROF(
|
||||
int a_id
|
||||
,const std::string& a_title
|
||||
,int a_xnum,rarg a_xmin,rarg a_xmax
|
||||
,rarg a_ymin,rarg a_ymax
|
||||
,const std::string& a_opts
|
||||
) {
|
||||
#ifdef WIN32
|
||||
HBPROF(&a_id,PASSCHAR(a_title.c_str()),
|
||||
&a_xnum,&a_xmin,&a_xmax,&a_ymin,&a_ymax,
|
||||
PASSCHAR(a_opts.c_str()));
|
||||
#else
|
||||
hbprof_(&a_id,a_title.c_str(),
|
||||
&a_xnum,&a_xmin,&a_xmax,&a_ymin,&a_ymax,
|
||||
a_opts.c_str(),a_title.size(),a_opts.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHGIVE(
|
||||
int a_id
|
||||
,std::string& a_title
|
||||
,int& a_xnum
|
||||
,rarg& a_xmin
|
||||
,rarg& a_xmax
|
||||
,int& a_ynum
|
||||
,rarg& a_ymin
|
||||
,rarg& a_ymax
|
||||
){
|
||||
char chtitl[128];
|
||||
int ncx,ncy;
|
||||
rarg xmin,xmax,ymin,ymax;
|
||||
int nwt,idb;
|
||||
#ifdef WIN32
|
||||
HGIVE(&a_id,chtitl,80,&ncx,&xmin,&xmax,&ncy,&ymin,&ymax,&nwt,&idb);
|
||||
#else
|
||||
hgive_(&a_id,chtitl,&ncx,&xmin,&xmax,&ncy,&ymin,&ymax,&nwt,&idb,80);
|
||||
#endif
|
||||
chtitl[4*nwt] = 0;
|
||||
a_title = chtitl;
|
||||
a_xnum = ncx;
|
||||
a_xmin = xmin;
|
||||
a_xmax = xmax;
|
||||
a_ynum = ncy;
|
||||
a_ymin = ymin;
|
||||
a_ymax = ymax;
|
||||
}
|
||||
|
||||
inline void CHGIVE( //without title.
|
||||
int a_id
|
||||
,int& a_xnum
|
||||
,rarg& a_xmin
|
||||
,rarg& a_xmax
|
||||
,int& a_ynum
|
||||
,rarg& a_ymin
|
||||
,rarg& a_ymax
|
||||
){
|
||||
char chtitl[128];
|
||||
int ncx,ncy;
|
||||
rarg xmin,xmax,ymin,ymax;
|
||||
int nwt,idb;
|
||||
#ifdef WIN32
|
||||
HGIVE(&a_id,chtitl,80,&ncx,&xmin,&xmax,&ncy,&ymin,&ymax,&nwt,&idb);
|
||||
#else
|
||||
hgive_(&a_id,chtitl,&ncx,&xmin,&xmax,&ncy,&ymin,&ymax,&nwt,&idb,80);
|
||||
#endif
|
||||
a_xnum = ncx;
|
||||
a_xmin = xmin;
|
||||
a_xmax = xmax;
|
||||
a_ynum = ncy;
|
||||
a_ymin = ymin;
|
||||
a_ymax = ymax;
|
||||
}
|
||||
|
||||
inline int CHNOENT(int a_id){
|
||||
int nentries;
|
||||
#ifdef WIN32
|
||||
HNOENT(&a_id,&nentries);
|
||||
#else
|
||||
hnoent_(&a_id,&nentries);
|
||||
#endif
|
||||
return nentries;
|
||||
}
|
||||
|
||||
inline void CHFILL(int a_id,rarg a_x,rarg a_y,rarg a_w){
|
||||
#ifdef WIN32
|
||||
HFILL(&a_id,&a_x,&a_y,&a_w);
|
||||
#else
|
||||
hfill_(&a_id,&a_x,&a_y,&a_w);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline rret CHI(int a_id,int a_i){
|
||||
#ifdef WIN32
|
||||
return HI(&a_id,&a_i);
|
||||
#else
|
||||
return hi_(&a_id,&a_i);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline rret CHIE(int a_id,int a_i){
|
||||
#ifdef WIN32
|
||||
return HIE(&a_id,&a_i);
|
||||
#else
|
||||
return hie_(&a_id,&a_i);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline rret CHIJ(int a_id,int a_i,int a_j){
|
||||
#ifdef WIN32
|
||||
return HIJ(&a_id,&a_i,&a_j);
|
||||
#else
|
||||
return hij_(&a_id,&a_i,&a_j);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline rret CHIJE(int a_id,int a_i,int a_j){
|
||||
#ifdef WIN32
|
||||
return HIJE(&a_id,&a_i,&a_j);
|
||||
#else
|
||||
return hije_(&a_id,&a_i,&a_j);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline rret CHIX(int a_id,int a_i){
|
||||
rarg x;
|
||||
#ifdef WIN32
|
||||
HIX(&a_id,&a_i,&x);
|
||||
#else
|
||||
hix_(&a_id,&a_i,&x);
|
||||
#endif
|
||||
return x;
|
||||
}
|
||||
|
||||
inline void CHIJXY(int a_id,int a_i,int a_j,rarg& aX,rarg& aY){
|
||||
rarg x,y;
|
||||
#ifdef WIN32
|
||||
HIJXY(&a_id,&a_i,&a_j,&x,&y);
|
||||
#else
|
||||
hijxy_(&a_id,&a_i,&a_j,&x,&y);
|
||||
#endif
|
||||
aX = x;
|
||||
aY = y;
|
||||
}
|
||||
|
||||
inline int CHXI(int a_id,rarg a_x){
|
||||
int i;
|
||||
#ifdef WIN32
|
||||
HXI(&a_id,&a_x,&i);
|
||||
#else
|
||||
hxi_(&a_id,&a_x,&i);
|
||||
#endif
|
||||
return i;
|
||||
}
|
||||
|
||||
inline void CHXYIJ(int a_id,rarg a_x,rarg a_y,int& aI,int& aJ){
|
||||
int i,j;
|
||||
#ifdef WIN32
|
||||
HXYIJ(&a_id,&a_x,&a_y,&i,&j);
|
||||
#else
|
||||
hxyij_(&a_id,&a_x,&a_y,&i,&j);
|
||||
#endif
|
||||
aI = i;
|
||||
aJ = j;
|
||||
}
|
||||
|
||||
inline rret CHMIN(int a_id){
|
||||
#ifdef WIN32
|
||||
return HMIN(&a_id);
|
||||
#else
|
||||
return hmin_(&a_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline rret CHMAX(int a_id){
|
||||
#ifdef WIN32
|
||||
return HMAX(&a_id);
|
||||
#else
|
||||
return hmax_(&a_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline rret CHSTATI(int a_id,int a_what,const std::string& aChoice,int a_num){
|
||||
#ifdef WIN32
|
||||
return HSTATI(&a_id,&a_what,PASSCHAR(aChoice.c_str()),&a_num);
|
||||
#else
|
||||
return hstati_(&a_id,&a_what,aChoice.c_str(),&a_num,aChoice.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHRESET(int a_id,const std::string& a_title){
|
||||
#ifdef WIN32
|
||||
HRESET(&a_id,PASSCHAR(a_title.c_str()));
|
||||
#else
|
||||
hreset_(&a_id,a_title.c_str(),a_title.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
/// Tuple ////////////////////////////////////////////////////////////////////
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
inline void CHBNT(int a1,const std::string& a2,const std::string& a3) {
|
||||
#ifdef WIN32
|
||||
HBNT(&a1,PASSCHAR(a2.c_str()),PASSCHAR(a3.c_str()));
|
||||
#else
|
||||
hbnt_(&a1,a2.c_str(),a3.c_str(),a2.size(),a3.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHBNAME(int a1,const std::string& a2,void* a3,const std::string& a4) {
|
||||
#ifdef WIN32
|
||||
HBNAME(&a1,PASSCHAR(a2.c_str()),(int*)a3,PASSCHAR(a4.c_str()));
|
||||
#else
|
||||
hbname_(&a1,a2.c_str(),(int*)a3,a4.c_str(),a2.size(),a4.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHBNAM(int a1,const std::string& a2,void* a3,const std::string& a4,int a5) {
|
||||
#ifdef WIN32
|
||||
HBNAM(&a1,PASSCHAR(a2.c_str()),(int*)a3,PASSCHAR(a4.c_str()),&a5);
|
||||
#else
|
||||
hbnam_(&a1,a2.c_str(),(int*)a3,a4.c_str(),&a5,a2.size(),a4.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHGNPAR(int a1,const std::string& a2) {
|
||||
#ifdef WIN32
|
||||
HGNPAR(&a1,PASSCHAR(a2.c_str()));
|
||||
#else
|
||||
hgnpar_(&a1,a2.c_str(),a2.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void CHFNT(int a1) {
|
||||
#ifdef WIN32
|
||||
HFNT(&a1);
|
||||
#else
|
||||
hfnt_(&a1);
|
||||
#endif
|
||||
}
|
||||
|
||||
inline int CHGIVEN(
|
||||
int a_id
|
||||
,std::string& a_title
|
||||
,std::vector<std::string>& aColumns
|
||||
){
|
||||
// Get number of columns :
|
||||
char chtitl[128];
|
||||
int nvar = 0;
|
||||
rarg rmin[1000],rmax[1000];
|
||||
#ifdef WIN32
|
||||
HGIVEN(&a_id,chtitl,80,&nvar,PASSCHAR(""),rmin,rmax);
|
||||
#else
|
||||
hgiven_(&a_id,chtitl,&nvar,"",rmin,rmax,80,0);
|
||||
#endif
|
||||
|
||||
// Get title and columns name :
|
||||
const int Nchar = 9;
|
||||
char* chtag_out = new char[nvar*Nchar+1];
|
||||
chtag_out[nvar*Nchar]=0;
|
||||
int i;
|
||||
for (i=0;i<=80;i++)chtitl[i]=0;
|
||||
#ifdef WIN32
|
||||
HGIVEN(&a_id,chtitl,80,&nvar,chtag_out,Nchar,rmin,rmax);
|
||||
#else
|
||||
hgiven_(&a_id,chtitl,&nvar,chtag_out,rmin,rmax,80,Nchar);
|
||||
#endif
|
||||
for (i=80;i>0;i--) {if (chtitl[i] == ' ') chtitl[i] = 0; }
|
||||
|
||||
a_title = chtitl;
|
||||
|
||||
aColumns.clear();
|
||||
char* name = chtag_out;
|
||||
for(i=0; i<nvar;i++) {
|
||||
name[Nchar-1] = 0;
|
||||
int first = 0;
|
||||
int last = 0;
|
||||
// suppress trailing blanks
|
||||
int j;
|
||||
for (j=Nchar-2;j>0;j--) {
|
||||
if (name[j] == ' ' && last == 0) name[j] = 0;
|
||||
else last = j;
|
||||
}
|
||||
// suppress heading blanks
|
||||
for (j=0;j<Nchar;j++) {
|
||||
if (name[j] != ' ') break;
|
||||
first = j+1;
|
||||
}
|
||||
aColumns.push_back(name+first);
|
||||
name += Nchar;
|
||||
}
|
||||
|
||||
return nvar;
|
||||
}
|
||||
|
||||
inline int CHGNT(int a_id,int a_row){
|
||||
int ier = 0;
|
||||
#ifdef WIN32
|
||||
HGNT(&a_id,&a_row,&ier);
|
||||
#else
|
||||
hgnt_(&a_id,&a_row,&ier);
|
||||
#endif
|
||||
return ier;
|
||||
}
|
||||
|
||||
inline void CHOPERA(int a_id1,const std::string& a_opts,int a_id2,int a_id3,rarg a_c1,rarg a_c2) {
|
||||
#ifdef WIN32
|
||||
HOPERA(&a_id1,PASSCHAR(a_opts.c_str()),&a_id2,&a_id3,&a_c1,&a_c2);
|
||||
#else
|
||||
hopera_(&a_id1,a_opts.c_str(),&a_id2,&a_id3,&a_c1,&a_c2,a_opts.size());
|
||||
#endif
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#ifdef WIN32
|
||||
#undef PASSCHAR
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,158 +0,0 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_hbook_axis
|
||||
#define tools_hbook_axis
|
||||
|
||||
#include "CHBOOK"
|
||||
|
||||
namespace tools {
|
||||
namespace hbook {
|
||||
|
||||
class axis {
|
||||
public:
|
||||
enum { UNDERFLOW_BIN = -2, OVERFLOW_BIN = -1 };
|
||||
public:
|
||||
axis(const std::string& a_path,int aID,
|
||||
int aDimension,bool aIsX,bool aFixed)
|
||||
:m_path(a_path),m_id(aID)
|
||||
,m_dimension(aDimension),m_is_x(aIsX),m_fixed(aFixed)
|
||||
{}
|
||||
virtual ~axis(){}
|
||||
public:
|
||||
axis(const axis& a_from)
|
||||
:m_path(a_from.m_path),m_id(a_from.m_id),m_dimension(a_from.m_dimension)
|
||||
,m_is_x(a_from.m_is_x),m_fixed(a_from.m_fixed)
|
||||
{}
|
||||
axis& operator=(const axis& a_from){
|
||||
m_path = a_from.m_path;
|
||||
m_id = a_from.m_id;
|
||||
m_dimension = a_from.m_dimension;
|
||||
m_is_x = a_from.m_is_x;
|
||||
m_fixed = a_from.m_fixed;
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
bool is_fixed_binning() const {return m_fixed;}
|
||||
rarg lower_edge() const {
|
||||
int xn,yn;
|
||||
rarg xmin,xmax,ymin,ymax;
|
||||
cd_beg();
|
||||
CHGIVE(m_id,xn,xmin,xmax,yn,ymin,ymax);
|
||||
cd_end();
|
||||
return m_is_x?xmin:ymin;
|
||||
}
|
||||
rarg upper_edge() const {
|
||||
int xn,yn;
|
||||
rarg xmin,xmax,ymin,ymax;
|
||||
cd_beg();
|
||||
CHGIVE(m_id,xn,xmin,xmax,yn,ymin,ymax);
|
||||
cd_end();
|
||||
return m_is_x?xmax:ymax;
|
||||
}
|
||||
|
||||
int bins() const {
|
||||
int xn,yn;
|
||||
rarg xmin,xmax,ymin,ymax;
|
||||
cd_beg();
|
||||
CHGIVE(m_id,xn,xmin,xmax,yn,ymin,ymax);
|
||||
cd_end();
|
||||
return m_is_x?xn:yn;
|
||||
}
|
||||
|
||||
rret bin_lower_edge(int a_index) const {
|
||||
int index = a_index + 1; //HBOOK counts in [1,NX]
|
||||
if(m_dimension==1) {
|
||||
cd_beg();
|
||||
rret v = CHIX(m_id,index);
|
||||
cd_end();
|
||||
return v;
|
||||
} else { //dimension 2
|
||||
rarg x,y;
|
||||
if(m_is_x) {
|
||||
cd_beg();
|
||||
CHIJXY(m_id,index,1,x,y);
|
||||
cd_end();
|
||||
return x;
|
||||
} else {
|
||||
cd_beg();
|
||||
CHIJXY(m_id,1,index,x,y);
|
||||
cd_end();
|
||||
return y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rret bin_upper_edge(int a_index) const {
|
||||
//FIXME : is it correct to ask for the lower bound of the next bin ?
|
||||
int index = a_index + 1 + 1; //HBOOK counts in [1,NX]
|
||||
if(m_dimension==1) {
|
||||
cd_beg();
|
||||
rret v = CHIX(m_id,index);
|
||||
cd_end();
|
||||
return v;
|
||||
} else { //dimension 2
|
||||
rarg x,y;
|
||||
if(m_is_x) {
|
||||
cd_beg();
|
||||
CHIJXY(m_id,index,1,x,y);
|
||||
cd_end();
|
||||
return x;
|
||||
} else {
|
||||
cd_beg();
|
||||
CHIJXY(m_id,1,index,x,y);
|
||||
cd_end();
|
||||
return y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rret bin_width(int a_index) const {
|
||||
return bin_upper_edge(a_index) - bin_lower_edge(a_index);
|
||||
}
|
||||
|
||||
int coord_to_index(rarg aCoord) const {
|
||||
if(m_dimension==1) {
|
||||
cd_beg();
|
||||
int v = CHXI(m_id,aCoord)-1; //HBOOK counts in [1,NX]
|
||||
cd_end();
|
||||
return v;
|
||||
} else { //dimension 2
|
||||
int i,j;
|
||||
if(m_is_x) {
|
||||
cd_beg();
|
||||
CHXYIJ(m_id,aCoord,0,i,j);
|
||||
cd_end();
|
||||
return i-1;
|
||||
} else {
|
||||
cd_beg();
|
||||
CHXYIJ(m_id,0,aCoord,i,j);
|
||||
cd_end();
|
||||
return j-1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rret bin_center(int a_index) const {
|
||||
return (bin_lower_edge(a_index) + bin_upper_edge(a_index))/2;
|
||||
}
|
||||
|
||||
private:
|
||||
void cd_beg() const {
|
||||
axis& self = const_cast<axis&>(*this);
|
||||
CHPWDF(self.m_tmp);
|
||||
CHCDIR(m_path," ");
|
||||
}
|
||||
void cd_end() const {CHCDIR(m_tmp," ");}
|
||||
private:
|
||||
std::string m_path;
|
||||
int m_id;
|
||||
int m_dimension;
|
||||
bool m_is_x;
|
||||
bool m_fixed;
|
||||
char m_tmp[1024];
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,155 +0,0 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_hbook_base_histo
|
||||
#define tools_hbook_base_histo
|
||||
|
||||
#include "axis"
|
||||
|
||||
#include <map> //for annotations
|
||||
|
||||
namespace tools {
|
||||
namespace hbook {
|
||||
|
||||
class base_histo {
|
||||
protected:
|
||||
base_histo(int aID):m_path(CHPWD()),m_id(aID){}
|
||||
virtual ~base_histo(){}
|
||||
protected:
|
||||
base_histo(const base_histo& a_from)
|
||||
:m_path(a_from.m_path)
|
||||
,m_id(a_from.m_id)
|
||||
,m_annotations(a_from.m_annotations)
|
||||
{}
|
||||
base_histo& operator=(const base_histo& a_from){
|
||||
m_path = a_from.m_path;
|
||||
m_id = a_from.m_id;
|
||||
m_annotations = a_from.m_annotations;
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
int hbook_id() const {return m_id;}
|
||||
|
||||
bool scale(rarg aScale) {
|
||||
//FIXME : Do we want the E option ?
|
||||
cd_beg();
|
||||
CHOPERA(m_id,"+E",m_id,m_id,aScale,0);
|
||||
cd_end();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add(const base_histo& a_histo,rarg a_1 = 1,rarg a_2 = 1){
|
||||
// this = a_1*this + a_2*a_histo
|
||||
//NOTE : it is assumed that m_id and a_histo.m_id are in the
|
||||
// same HBOOK directory.
|
||||
cd_beg();
|
||||
CHOPERA(m_id,"+E",a_histo.m_id,m_id,a_1,a_2);
|
||||
cd_end();
|
||||
return true;
|
||||
}
|
||||
bool subtract(const base_histo& a_histo,rarg a_1 = 1,rarg a_2 = 1){
|
||||
// this = a_1*this - a_2*a_histo
|
||||
//NOTE : it is assumed that m_id and a_histo.m_id are in the
|
||||
// same HBOOK directory.
|
||||
cd_beg();
|
||||
CHOPERA(m_id,"-E",a_histo.m_id,m_id,a_1,a_2);
|
||||
cd_end();
|
||||
return true;
|
||||
}
|
||||
bool multiply(const base_histo& a_histo,rarg a_1 = 1,rarg a_2 = 1){
|
||||
// this = a_1*this * a_2*a_histo
|
||||
//NOTE : it is assumed that m_id and a_histo.m_id are in the
|
||||
// same HBOOK directory.
|
||||
cd_beg();
|
||||
CHOPERA(m_id,"*E",a_histo.m_id,m_id,a_1,a_2);
|
||||
cd_end();
|
||||
return true;
|
||||
}
|
||||
bool divide(const base_histo& a_histo,rarg a_1 = 1,rarg a_2 = 1){
|
||||
// this = a_1*this / a_2*a_histo
|
||||
//NOTE : it is assumed that m_id and a_histo.m_id are in the
|
||||
// same HBOOK directory.
|
||||
cd_beg();
|
||||
CHOPERA(m_id,"/E",a_histo.m_id,m_id,a_1,a_2);
|
||||
cd_end();
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string title() const {
|
||||
std::string _title;
|
||||
int ncx,ncy;
|
||||
rarg xmin,xmax,ymin,ymax;
|
||||
cd_beg();
|
||||
CHGIVE(m_id,_title,ncx,xmin,xmax,ncy,ymin,ymax);
|
||||
cd_end();
|
||||
return _title;
|
||||
}
|
||||
bool reset() {
|
||||
cd_beg();
|
||||
CHRESET(m_id," ");
|
||||
cd_end();
|
||||
return true;
|
||||
}
|
||||
int all_entries() const {
|
||||
cd_beg();
|
||||
int v = CHNOENT(m_id);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
|
||||
public: //annotations :
|
||||
typedef std::map<std::string,std::string> annotations_t;
|
||||
const annotations_t& annotations() const {return m_annotations;}
|
||||
annotations_t annotations() {return m_annotations;}
|
||||
|
||||
void add_annotation(const std::string& a_key,const std::string& a_value) {
|
||||
m_annotations[a_key] = a_value; //override if a_key already exists.
|
||||
}
|
||||
bool annotation(const std::string& a_key,std::string& a_value) const {
|
||||
annotations_t::const_iterator it = m_annotations.find(a_key);
|
||||
if(it==m_annotations.end()) {a_value.clear();return false;}
|
||||
a_value = (*it).second;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected:
|
||||
void cd_beg() const{
|
||||
base_histo& self = const_cast<base_histo&>(*this);
|
||||
CHPWDF(self.m_tmp);
|
||||
CHCDIR(m_path," ");
|
||||
}
|
||||
void cd_end() const {CHCDIR(m_tmp," ");}
|
||||
protected:
|
||||
static int hindex(int aIndex,const hbook::axis& aAxis){
|
||||
if(aIndex==hbook::axis::UNDERFLOW_BIN)
|
||||
return 0;
|
||||
else if(aIndex==hbook::axis::OVERFLOW_BIN)
|
||||
return aAxis.bins()+1;
|
||||
else
|
||||
return aIndex+1;
|
||||
}
|
||||
protected:
|
||||
std::string m_path;
|
||||
int m_id;
|
||||
char m_tmp[1024];
|
||||
// etc :
|
||||
annotations_t m_annotations;
|
||||
};
|
||||
|
||||
// predefined annotation keys :
|
||||
inline const std::string& key_axis_x_title() {
|
||||
static const std::string s_v("axis_x.title");
|
||||
return s_v;
|
||||
}
|
||||
inline const std::string& key_axis_y_title() {
|
||||
static const std::string s_v("axis_y.title");
|
||||
return s_v;
|
||||
}
|
||||
inline const std::string& key_axis_z_title() {
|
||||
static const std::string s_v("axis_z.title");
|
||||
return s_v;
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,160 +0,0 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_hbook_h1
|
||||
#define tools_hbook_h1
|
||||
|
||||
#include "base_histo"
|
||||
|
||||
namespace tools {
|
||||
namespace hbook {
|
||||
|
||||
class h1 : public base_histo {
|
||||
public:
|
||||
h1(int aID,const std::string& a_title,
|
||||
int aXnumber,rarg aXmin,rarg aXmax)
|
||||
:base_histo(aID)
|
||||
,m_axis(m_path,aID,1,true,true)
|
||||
{
|
||||
//m_axis.copy(fHistogram.getAxis(0));
|
||||
cd_beg();
|
||||
CHBOOK1(m_id,a_title,aXnumber,aXmin,aXmax);
|
||||
cd_end();
|
||||
}
|
||||
h1(int aID,const std::string& a_title,
|
||||
const std::vector<rarg>& a_edges)
|
||||
:base_histo(aID)
|
||||
,m_axis(m_path,aID,1,true,false)
|
||||
{
|
||||
cd_beg();
|
||||
CHBOOKB(m_id,a_title,a_edges);
|
||||
cd_end();
|
||||
}
|
||||
virtual ~h1(){
|
||||
cd_beg();
|
||||
CHDELET(m_id);
|
||||
cd_end();
|
||||
}
|
||||
private:
|
||||
h1(const h1& a_from)
|
||||
:base_histo(a_from)
|
||||
,m_axis(a_from.m_axis)
|
||||
{}
|
||||
h1& operator=(const h1& a_from){
|
||||
base_histo::operator=(a_from);
|
||||
m_axis = a_from.m_axis;
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
bool configure(int aXnumber,rarg aXmin,rarg aXmax){
|
||||
cd_beg();
|
||||
CHBOOK1(m_id,title(),aXnumber,aXmin,aXmax);
|
||||
cd_end();
|
||||
return true;
|
||||
}
|
||||
bool configure(const std::vector<rarg>& a_edges){
|
||||
cd_beg();
|
||||
CHBOOKB(m_id,title(),a_edges);
|
||||
cd_end();
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
//bool set_title(const std::string& a_title) {
|
||||
// return false;
|
||||
//}
|
||||
int dimension() const {return 1;}
|
||||
|
||||
rret sum_bin_heights() const {
|
||||
int NX = axis().bins();
|
||||
rret w = 0;
|
||||
cd_beg();
|
||||
for(int i=1;i<=NX;i++) {
|
||||
w += CHI(m_id,i);
|
||||
}
|
||||
cd_end();
|
||||
return w;
|
||||
}
|
||||
rret sum_all_bin_heights() const {
|
||||
int NX1 = axis().bins()+1;
|
||||
rret w = 0;
|
||||
cd_beg();
|
||||
for(int i=0;i<=NX1;i++) {
|
||||
w += CHI(m_id,i);
|
||||
}
|
||||
cd_end();
|
||||
return w;
|
||||
}
|
||||
rret sum_extra_bin_heights() const {
|
||||
int NX1 = axis().bins()+1;
|
||||
rret w = 0;
|
||||
cd_beg();
|
||||
w += CHI(m_id,0);
|
||||
w += CHI(m_id,NX1);
|
||||
cd_end();
|
||||
return w;
|
||||
}
|
||||
|
||||
rret min_bin_height() const {
|
||||
cd_beg();
|
||||
rret v = CHMIN(m_id);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
rret max_bin_height() const {
|
||||
cd_beg();
|
||||
rret v = CHMAX(m_id);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
|
||||
void fill(rarg aX,rarg aWeight = 1) {
|
||||
cd_beg();
|
||||
CHFILL(m_id,aX,0,aWeight);
|
||||
cd_end();
|
||||
}
|
||||
|
||||
// optimization :
|
||||
void fill_beg() const {cd_beg();}
|
||||
void fill_fast(rarg aX,rarg aWeight = 1) {
|
||||
CHFILL(m_id,aX,0,aWeight);
|
||||
}
|
||||
void fill_end() const {cd_end();}
|
||||
|
||||
rret bin_height(int aIndex) const {
|
||||
cd_beg();
|
||||
rret v = CHI(m_id,hindex(aIndex,axis()));
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
rret bin_error(int aIndex) const {
|
||||
cd_beg();
|
||||
rret v = CHIE(m_id,aIndex+1);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
|
||||
rret mean() const {
|
||||
cd_beg();
|
||||
rret v = CHSTATI(m_id,1," ",0);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
rret rms() const {
|
||||
cd_beg();
|
||||
rret v = CHSTATI(m_id,2," ",0);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
|
||||
hbook::axis& axis() {return m_axis;}
|
||||
const hbook::axis& axis() const {return m_axis;}
|
||||
int coord_to_index(rarg aCoord) const {
|
||||
return m_axis.coord_to_index(aCoord);
|
||||
}
|
||||
protected:
|
||||
hbook::axis m_axis;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,202 +0,0 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_hbook_h2
|
||||
#define tools_hbook_h2
|
||||
|
||||
#include "base_histo"
|
||||
|
||||
namespace tools {
|
||||
namespace hbook {
|
||||
|
||||
class h2 : public base_histo {
|
||||
public:
|
||||
h2(int aID,const std::string& aTitle,
|
||||
int aXnumber,rarg aXmin,rarg aXmax,
|
||||
int aYnumber,rarg aYmin,rarg aYmax)
|
||||
:base_histo(aID)
|
||||
,m_axis_x(m_path,aID,2,true,true)
|
||||
,m_axis_y(m_path,aID,2,false,true)
|
||||
{
|
||||
//m_axis_x.copy(fHistogram.getAxis(0));
|
||||
//m_axis_y.copy(fHistogram.getAxis(1));
|
||||
cd_beg();
|
||||
CHBOOK2(m_id,aTitle,aXnumber,aXmin,aXmax,
|
||||
aYnumber,aYmin,aYmax);
|
||||
cd_end();
|
||||
}
|
||||
virtual ~h2(){
|
||||
cd_beg();
|
||||
CHDELET(m_id);
|
||||
cd_end();
|
||||
}
|
||||
private:
|
||||
h2(const h2& a_from)
|
||||
:base_histo(a_from)
|
||||
,m_axis_x(a_from.m_axis_x)
|
||||
,m_axis_y(a_from.m_axis_y)
|
||||
{}
|
||||
h2& operator=(const h2& a_from){
|
||||
base_histo::operator=(a_from);
|
||||
m_axis_x = a_from.m_axis_x;
|
||||
m_axis_y = a_from.m_axis_y;
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
bool configure(int aXnumber,rarg aXmin,rarg aXmax,
|
||||
int aYnumber,rarg aYmin,rarg aYmax){
|
||||
cd_beg();
|
||||
CHBOOK2(m_id,title(),aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax);
|
||||
cd_end();
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
void fill(rarg aX,rarg aY,rarg aWeight = 1) {
|
||||
cd_beg();
|
||||
CHFILL(m_id,aX,aY,aWeight);
|
||||
cd_end();
|
||||
}
|
||||
|
||||
// optimization :
|
||||
void fill_beg() const {cd_beg();}
|
||||
void fill_fast(rarg aX,rarg aY,rarg aWeight = 1) {
|
||||
CHFILL(m_id,aX,aY,aWeight);
|
||||
}
|
||||
void fill_end() const {cd_end();}
|
||||
|
||||
int dimension() const {return 2;}
|
||||
|
||||
rret mean_x() const {
|
||||
cd_beg();
|
||||
rret v = CHSTATI(m_id,1,"PROX",0);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
rret mean_y() const{
|
||||
cd_beg();
|
||||
rret v = CHSTATI(m_id,1,"PROY",0);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
rret rms_x() const {
|
||||
cd_beg();
|
||||
rret v = CHSTATI(m_id,2,"PROX",0);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
rret rms_y() const {
|
||||
cd_beg();
|
||||
rret v = CHSTATI(m_id,2,"PROY",0);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
const hbook::axis& axis_x() const {return m_axis_x;}
|
||||
hbook::axis& axis_x() {return m_axis_x;}
|
||||
const hbook::axis& axis_y() const {return m_axis_y;}
|
||||
hbook::axis& axis_y() {return m_axis_y;}
|
||||
int coord_to_index_x(rarg aCoordX) const {
|
||||
return m_axis_x.coord_to_index(aCoordX);
|
||||
}
|
||||
int coord_to_index_y(rarg aCoordY) const {
|
||||
return m_axis_y.coord_to_index(aCoordY);
|
||||
}
|
||||
rret min_bin_height() const {
|
||||
cd_beg();
|
||||
rret v = CHMIN(m_id);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
rret max_bin_height() const {
|
||||
cd_beg();
|
||||
rret v = CHMAX(m_id);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
rret bin_height(int aIndexX,int aIndexY) const {
|
||||
cd_beg();
|
||||
rret v = CHIJ(m_id,hindex(aIndexX,axis_x()),hindex(aIndexY,axis_y()));
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
rret sum_bin_heights() const {
|
||||
int NX = axis_x().bins();
|
||||
int NY = axis_y().bins();
|
||||
rret w = 0;
|
||||
cd_beg();
|
||||
for(int i=1;i<=NX;i++) {
|
||||
for(int j=1;j<=NY;j++) {
|
||||
w += CHIJ(m_id,i,j);
|
||||
}
|
||||
}
|
||||
cd_end();
|
||||
return w;
|
||||
}
|
||||
rret sum_all_bin_heights() const {
|
||||
int NX1 = axis_x().bins()+1;
|
||||
int NY1 = axis_y().bins()+1;
|
||||
rret w = 0;
|
||||
cd_beg();
|
||||
for(int i=0;i<=NX1;i++) {
|
||||
for(int j=0;j<=NY1;j++) {
|
||||
w += CHIJ(m_id,i,j);
|
||||
}
|
||||
}
|
||||
cd_end();
|
||||
return w;
|
||||
}
|
||||
rret sum_extra_bin_heights() const {
|
||||
int NX = axis_x().bins();
|
||||
int NY = axis_y().bins();
|
||||
int NX1 = NX+1;
|
||||
int NY1 = NY+1;
|
||||
rret w = 0;
|
||||
cd_beg();
|
||||
{for(int j=0;j<=NY1;j++) {
|
||||
w += CHIJ(m_id,0,j);
|
||||
}}
|
||||
for(int i=1;i<=NX;i++) {
|
||||
w += CHIJ(m_id,i,0);
|
||||
w += CHIJ(m_id,i,NY1);
|
||||
}
|
||||
{for(int j=0;j<=NY1;j++) {
|
||||
w += CHIJ(m_id,NX1,j);
|
||||
}}
|
||||
cd_end();
|
||||
return w;
|
||||
}
|
||||
rret bin_error(int aIndexX,int aIndexY) const {
|
||||
cd_beg();
|
||||
rret v = CHIJE(m_id,aIndexX+1,aIndexY+1);
|
||||
cd_end();
|
||||
return v;
|
||||
}
|
||||
rret bin_height_x(int aIndexX) const {
|
||||
int i = hindex(aIndexX,axis_x());
|
||||
int NY1 = axis_y().bins()+1;
|
||||
rret w = 0;
|
||||
cd_beg();
|
||||
for(int j=0;j<=NY1;j++) {
|
||||
w += CHIJ(m_id,i,j);
|
||||
}
|
||||
cd_end();
|
||||
return w;
|
||||
}
|
||||
rret bin_height_y(int aIndexY) const {
|
||||
int j = hindex(aIndexY,axis_y());
|
||||
int NX1 = axis_x().bins()+1;
|
||||
rret w = 0;
|
||||
cd_beg();
|
||||
for(int i=0;i<=NX1;i++) {
|
||||
w += CHIJ(m_id,i,j);
|
||||
}
|
||||
cd_end();
|
||||
return w;
|
||||
}
|
||||
protected:
|
||||
hbook::axis m_axis_x;
|
||||
hbook::axis m_axis_y;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,80 +0,0 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_hbook_p1
|
||||
#define tools_hbook_p1
|
||||
|
||||
#include "base_histo"
|
||||
|
||||
namespace tools {
|
||||
namespace hbook {
|
||||
|
||||
class p1 : public base_histo {
|
||||
public:
|
||||
p1(int aID,const std::string& aTitle,
|
||||
int aXnumber,rarg aXmin,rarg aXmax,
|
||||
rarg aVmin,rarg aVmax)
|
||||
:base_histo(aID)
|
||||
,m_axis(m_path,aID,1,true,true)
|
||||
{
|
||||
cd_beg();
|
||||
CHBPROF(m_id,aTitle,
|
||||
aXnumber,aXmin,aXmax,
|
||||
aVmin,aVmax,
|
||||
""); //FIXME : or "S" or "T" ?
|
||||
cd_end();
|
||||
}
|
||||
virtual ~p1(){
|
||||
cd_beg();
|
||||
CHDELET(m_id);
|
||||
cd_end();
|
||||
}
|
||||
private:
|
||||
p1(const p1& a_from)
|
||||
:base_histo(a_from)
|
||||
,m_axis(a_from.m_axis)
|
||||
{}
|
||||
p1& operator=(const p1& a_from){
|
||||
base_histo::operator=(a_from);
|
||||
m_axis = a_from.m_axis;
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
bool configure(int aXnumber,rarg aXmin,rarg aXmax,rarg aVmin,rarg aVmax){
|
||||
cd_beg();
|
||||
CHBPROF(m_id,title(),
|
||||
aXnumber,aXmin,aXmax,
|
||||
aVmin,aVmax,
|
||||
""); //FIXME : or "S" or "T" ?
|
||||
cd_end();
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
void fill(rarg aX,rarg aY,rarg aWeight = 1) {
|
||||
cd_beg();
|
||||
CHFILL(m_id,aX,aY,aWeight);
|
||||
cd_end();
|
||||
}
|
||||
|
||||
// optimization :
|
||||
void fill_beg() const {cd_beg();}
|
||||
void fill_fast(rarg aX,rarg aY,rarg aWeight = 1) {
|
||||
CHFILL(m_id,aX,aY,aWeight);
|
||||
}
|
||||
void fill_end() const {cd_end();}
|
||||
|
||||
int dimension() const {return 1;}
|
||||
|
||||
const hbook::axis& axis() const {return m_axis;}
|
||||
hbook::axis& axis() {return m_axis;}
|
||||
|
||||
int coord_to_index(rarg aCoord) const {
|
||||
return m_axis.coord_to_index(aCoord);
|
||||
}
|
||||
protected:
|
||||
hbook::axis m_axis;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
@@ -1,263 +0,0 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_hbook_wfile
|
||||
#define tools_hbook_wfile
|
||||
|
||||
#include <sstream>
|
||||
#include <ostream>
|
||||
|
||||
#include "CHBOOK"
|
||||
#include <tools/srep>
|
||||
#include <tools/sout>
|
||||
|
||||
#ifdef WIN32
|
||||
extern "C" void __stdcall OCLOSE(int*);
|
||||
#else
|
||||
extern "C" void oclose_(int*);
|
||||
#endif
|
||||
|
||||
namespace tools {
|
||||
namespace hbook {
|
||||
|
||||
class wfile {
|
||||
public:
|
||||
wfile(std::ostream& a_out,const std::string& a_file,
|
||||
unsigned int a_unit = 1,bool a_verbose = false)
|
||||
:m_out(a_out)
|
||||
,m_verbose(a_verbose)
|
||||
,m_file_name(a_file)
|
||||
,m_is_valid(false)
|
||||
,m_unit(0)
|
||||
{
|
||||
std::string opts("NQ");
|
||||
// maximum number of records
|
||||
get_quest()[9] = 65000;
|
||||
int record_size = 1024;
|
||||
|
||||
m_dir = "LUN";
|
||||
{std::ostringstream strm;
|
||||
strm << a_unit;
|
||||
m_dir += strm.str();}
|
||||
|
||||
//FIXME : we should check if m_dir already exists.
|
||||
|
||||
int ier = CHROPEN(a_unit,m_dir,m_file_name,opts,record_size);
|
||||
if(ier) {
|
||||
m_out << "tools::hbook::wfile :"
|
||||
<< " error on hropen, code " << ier
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(get_quest()[0]) {
|
||||
m_out << "tools::hbook::wfile :"
|
||||
<< " error, cannot open file " << a_file
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(m_verbose) {
|
||||
m_out << "tools::hbook::wfile :"
|
||||
<< " file " << a_file << " opened."
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
CHCDIR("//PAWC"," ");
|
||||
if(CHEDIR(m_dir,true)) CHDDIR(m_dir);
|
||||
CHMDIR(m_dir," ");
|
||||
|
||||
CHCDIR("//PAWC/"+m_dir," ");
|
||||
|
||||
m_unit = a_unit;
|
||||
m_is_valid = true;
|
||||
}
|
||||
virtual ~wfile() {
|
||||
if(m_verbose) {
|
||||
m_out << "tools::hbook::wfile::~wfile : cleanup..." << std::endl;
|
||||
}
|
||||
|
||||
//rootFolder().clear();
|
||||
|
||||
if(m_is_valid) {
|
||||
|
||||
//CHDELET(0);
|
||||
if(m_verbose) {
|
||||
m_out << "tools::hbook::wfile::~wfile : hrend..." << std::endl;
|
||||
}
|
||||
CHREND(m_dir);
|
||||
#ifdef WIN32
|
||||
OCLOSE(&m_unit);
|
||||
#else
|
||||
oclose_(&m_unit);
|
||||
#endif
|
||||
m_unit = 0;
|
||||
|
||||
CHCDIR("//PAWC"," ");
|
||||
if(CHEDIR(m_dir,true)) CHDDIR(m_dir);
|
||||
|
||||
}
|
||||
|
||||
if(m_verbose) {
|
||||
m_out << "tools::hbook::wfile::~wfile : end." << std::endl;
|
||||
}
|
||||
}
|
||||
private:
|
||||
wfile(const wfile& a_from):m_out(a_from.m_out){}
|
||||
wfile& operator=(const wfile&){return *this;}
|
||||
public:
|
||||
const std::string& store_name() const {return m_file_name;}
|
||||
bool is_valid() const {return m_is_valid;}
|
||||
bool write() {
|
||||
if(!m_is_valid) return false;
|
||||
|
||||
std::string pwd = CHPWD();
|
||||
|
||||
CHCDIR("//PAWC/"+m_dir," ");
|
||||
CHCDIR("//"+m_dir," ");
|
||||
CHROUT(0,0,"T");
|
||||
|
||||
//CHLDIR("//PAWC/"+m_dir,"T");
|
||||
//CHLDIR("//"+m_dir,"T");
|
||||
|
||||
CHCDIR(pwd," ");
|
||||
|
||||
return true;
|
||||
}
|
||||
bool close() {
|
||||
if(!m_is_valid) return true; //done or not opened.
|
||||
CHREND(m_dir);
|
||||
#ifdef WIN32
|
||||
OCLOSE(&m_unit);
|
||||
#else
|
||||
oclose_(&m_unit);
|
||||
#endif
|
||||
m_unit = 0;
|
||||
m_is_valid = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool cd_home(){
|
||||
if(!m_is_valid) return false;
|
||||
CHCDIR("//PAWC/"+m_dir," ");
|
||||
return true;
|
||||
}
|
||||
bool cd_up(){
|
||||
if(!m_is_valid) return false;
|
||||
|
||||
std::string pwd = CHPWD(); // pwd should be //PAWC/LUN<unit>/<something>
|
||||
if(pwd.substr(0,10)!="//PAWC/LUN") {
|
||||
m_out << "tools::hbook::wfile::cd_up :"
|
||||
<< " current directory " << tools::sout(pwd)
|
||||
<< " is not under //PAWC/LUN."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
// look if not under //PAWC/LUN<unit> :
|
||||
{std::string s = pwd;
|
||||
tools::replace(s,"//PAWC/LUN","");
|
||||
if(s.find('/')==std::string::npos) return true;} //Can't cd. But it is ok.
|
||||
|
||||
CHCDIR("\\"," "); //cd up under //PAWC/LUN<unit>/<something>
|
||||
std::string pwd2 = CHPWD();
|
||||
|
||||
std::string s = pwd;
|
||||
tools::replace(s,"//PAWC","/");
|
||||
// s should be //LUN<unit>/<something>
|
||||
|
||||
CHCDIR(s," ");
|
||||
CHCDIR("\\"," "); //cd up under //LUN<unit>/<something>
|
||||
|
||||
CHCDIR(pwd2," ");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mkdir(const std::string& a_name){
|
||||
// create a directory under
|
||||
// //LUN<unit>/<something>
|
||||
// and
|
||||
// //PAWC/LUN<unit>/<something>
|
||||
|
||||
if(!m_is_valid) return false;
|
||||
|
||||
// a_name should not be a path.
|
||||
if(a_name.find('/')!=std::string::npos) {
|
||||
m_out << "tools::hbook::wfile::mkdir :"
|
||||
<< " " << tools::sout(a_name) << " should not be a path."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(a_name.find('.')!=std::string::npos) {
|
||||
m_out << "tools::hbook::wfile::mkdir :"
|
||||
<< " " << tools::sout(a_name) << " should not be a path."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(a_name.empty()) return true;
|
||||
|
||||
std::string pwd = CHPWD(); // pwd should be //PAWC/LUN<unit>/<something>
|
||||
if(pwd.substr(0,10)!="//PAWC/LUN") {
|
||||
m_out << "tools::hbook::wfile::mkdir :"
|
||||
<< " current directory " << tools::sout(pwd)
|
||||
<< " is not under //PAWC/LUN."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}
|
||||
|
||||
if(CHEDIR(a_name,true)) {
|
||||
//we assume that a_name is also here under //LUN<unit>/<something>
|
||||
return true;
|
||||
}
|
||||
|
||||
CHMDIR(a_name," ");
|
||||
|
||||
std::string s = pwd;
|
||||
tools::replace(s,"//PAWC","/");
|
||||
// s should be //LUN<unit>/<something>
|
||||
|
||||
CHCDIR(s," ");
|
||||
CHMDIR(a_name," ");
|
||||
|
||||
CHCDIR(pwd," ");
|
||||
|
||||
return true;
|
||||
}
|
||||
bool mkcd(const std::string& a_name){
|
||||
if(!mkdir(a_name)) return false;
|
||||
CHCDIR(a_name," ");
|
||||
return true;
|
||||
}
|
||||
bool cd(const std::string& a_name){
|
||||
CHCDIR(a_name," ");
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
std::ostream& m_out;
|
||||
bool m_verbose;
|
||||
std::string m_file_name;
|
||||
bool m_is_valid;
|
||||
std::string m_dir;
|
||||
int m_unit;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
// NOTE :
|
||||
// For doing RZ write :
|
||||
// - A //LUN<unit> has to be open.
|
||||
// - We create a //PAWC/LUN<unit> under //PAWC.
|
||||
// - The hierarchy is done in //PAWC/LUN<unit> and histos
|
||||
// are booked here. (A HBOOK1 books anyway in a directory under //PAWC).
|
||||
// - The //PAWC/LUN<unit> structure has to be duplicated under //LUN<unit>.
|
||||
// - Then a global CHROUT(0,0,"T") can be done after doing :
|
||||
// CHCDIR("//PAWC/LUN<unit>"," ")
|
||||
// CHCDIR("//LUN<unit>"," ")
|
||||
|
||||
//exlib_build_use inlib
|
||||
@@ -1,241 +0,0 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_hbook_wntuple
|
||||
#define tools_hbook_wntuple
|
||||
|
||||
// A class to write an HBOOK ntuple.
|
||||
|
||||
#include <tools/vmanip>
|
||||
#include <tools/vfind>
|
||||
#include <tools/srep>
|
||||
#include <tools/sto>
|
||||
#include <tools/scast>
|
||||
#include <tools/stype>
|
||||
#include <tools/sout>
|
||||
#include <tools/num2s>
|
||||
#include <tools/ntuple_booking>
|
||||
|
||||
#include "CHBOOK"
|
||||
|
||||
#ifdef WIN32
|
||||
extern "C" int NTUC[1];
|
||||
#else
|
||||
extern "C" int ntuc_[1];
|
||||
#endif
|
||||
|
||||
namespace tools {
|
||||
namespace hbook {
|
||||
|
||||
class wntuple {
|
||||
|
||||
protected:
|
||||
class icol {
|
||||
public:
|
||||
virtual ~icol(){}
|
||||
public:
|
||||
virtual void* cast(const std::string&) const = 0;
|
||||
virtual const std::string& s_cls() const = 0;
|
||||
public:
|
||||
virtual const std::string& name() const = 0; //for find_named
|
||||
};
|
||||
|
||||
public:
|
||||
template <class T>
|
||||
class column : public virtual icol {
|
||||
public:
|
||||
static const std::string& s_class() {
|
||||
static const std::string s_v
|
||||
("tools::hbook::wntuple::column<"+tools::stype(T())+">");
|
||||
return s_v;
|
||||
}
|
||||
public: //icol
|
||||
virtual void* cast(const std::string& a_class) const {
|
||||
if(void* p = tools::cmp_cast< column<T> >(this,a_class)) return p;
|
||||
else return 0;
|
||||
}
|
||||
virtual const std::string& s_cls() const {return s_class();}
|
||||
virtual const std::string& name() const {return m_name;}
|
||||
public:
|
||||
column(const std::string& a_name)
|
||||
:m_name(a_name),m_tmp(0)
|
||||
{}
|
||||
virtual ~column(){}
|
||||
protected:
|
||||
column(const column& a_from)
|
||||
:icol(a_from),m_name(a_from.m_name),m_tmp(a_from.m_tmp)
|
||||
{}
|
||||
column& operator=(const column& a_from){
|
||||
m_name = a_from.m_name;
|
||||
m_tmp = a_from.m_tmp;
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
void set_address(T* a_pos) {m_tmp = a_pos;}
|
||||
bool fill(const T& a_value) {*m_tmp = a_value;return true;}
|
||||
protected:
|
||||
std::string m_name;
|
||||
T* m_tmp;
|
||||
};
|
||||
|
||||
public:
|
||||
wntuple(int a_id,const std::string& a_title)
|
||||
:m_path(CHPWD()),m_id(a_id),m_path_file(CHPWD())
|
||||
{
|
||||
// WARNING : the below assumes that we are under //PAWC/<something>
|
||||
// and that a //<something> exists and is attached to a file.
|
||||
tools::replace(m_path_file,"//PAWC","/");
|
||||
cd_beg();
|
||||
CHBNT(m_id,a_title," ");
|
||||
cd_end();
|
||||
}
|
||||
|
||||
wntuple(int a_id,std::ostream& a_out,const tools::ntuple_booking& a_bkg)
|
||||
:m_path(CHPWD()),m_id(a_id),m_path_file(CHPWD())
|
||||
{
|
||||
// WARNING : the below assumes that we are under //PAWC/<something>
|
||||
// and that a //<something> exists and is attached to a file.
|
||||
tools::replace(m_path_file,"//PAWC","/");
|
||||
cd_beg();
|
||||
CHBNT(m_id,a_bkg.title()," ");
|
||||
cd_end();
|
||||
|
||||
const std::vector<tools::column_booking>& cols = a_bkg.columns();
|
||||
std::vector<tools::column_booking>::const_iterator it;
|
||||
for(it=cols.begin();it!=cols.end();++it){
|
||||
|
||||
if((*it).cls_id()==tools::_cid(int(0))) {
|
||||
create_column<int>((*it).name());
|
||||
} else if((*it).cls_id()==tools::_cid(float(0))) {
|
||||
create_column<float>((*it).name());
|
||||
} else if((*it).cls_id()==tools::_cid(double(0))) {
|
||||
create_column<double>((*it).name());
|
||||
|
||||
} else {
|
||||
a_out << "tools::hbook::wntuple :"
|
||||
<< " for column " << tools::sout((*it).name())
|
||||
<< ", type with cid " << (*it).cls_id() << " not yet handled."
|
||||
<< std::endl;
|
||||
//throw
|
||||
tools::clear<icol>(m_cols);
|
||||
//FIXME : should undo the calls to CHBNAME.
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~wntuple(){
|
||||
cd_beg();
|
||||
CHDELET(m_id);
|
||||
cd_end();
|
||||
tools::clear<icol>(m_cols);
|
||||
}
|
||||
protected:
|
||||
//Can we copy the HBOOK object ?
|
||||
wntuple(const wntuple& a_from)
|
||||
:m_path(a_from.m_path),m_id(a_from.m_id)
|
||||
{}
|
||||
wntuple& operator=(const wntuple& a_from){
|
||||
m_path = a_from.m_path;
|
||||
m_id = a_from.m_id;
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
template <class T>
|
||||
column<T>* create_column(const std::string& a_name) {
|
||||
if(tools::find_named<icol>(m_cols,a_name)) return 0;
|
||||
|
||||
std::string block("blk"); //8 chars max.
|
||||
if(!tools::numas<unsigned int>(m_cols.size(),block)){}
|
||||
if(block.size()>8) return 0;
|
||||
|
||||
column<T>* col = new column<T>(a_name);
|
||||
|
||||
#ifdef WIN32
|
||||
int nvar = NTUC[0];
|
||||
char* pos = ((char*)NTUC)+8+8*nvar;
|
||||
NTUC[0]++;
|
||||
#else
|
||||
int nvar = ntuc_[0];
|
||||
char* pos = ((char*)ntuc_)+8+8*nvar;
|
||||
ntuc_[0]++;
|
||||
#endif
|
||||
|
||||
col->set_address((T*)pos);
|
||||
|
||||
cd_beg();
|
||||
CHBNAME(m_id,block,pos,a_name+":"+h_type(T()));
|
||||
cd_end();
|
||||
|
||||
m_cols.push_back(col);
|
||||
|
||||
return col;
|
||||
}
|
||||
|
||||
bool add_row() {
|
||||
cd_beg();
|
||||
CHFNT(m_id);
|
||||
cd_end();
|
||||
return true;
|
||||
}
|
||||
|
||||
// optimization :
|
||||
void add_row_beg() const {cd_beg();}
|
||||
bool add_row_fast() {CHFNT(m_id);return true;}
|
||||
void add_row_end() const {cd_end();}
|
||||
|
||||
|
||||
template <class T>
|
||||
column<T>* find_column(const std::string& a_name) {
|
||||
icol* col = tools::find_named<icol>(m_cols,a_name);
|
||||
if(!col) return 0;
|
||||
return tools::safe_cast<icol, column<T> >(*col);
|
||||
}
|
||||
|
||||
//std::string title() const {
|
||||
// std::string title;
|
||||
// int ncx,ncy;
|
||||
// rarg xmin,xmax,ymin,ymax;
|
||||
// cd_beg();
|
||||
// CHGIVE(m_id,title,ncx,xmin,xmax,ncy,ymin,ymax);
|
||||
// cd_end();
|
||||
// return title;
|
||||
//}
|
||||
|
||||
const std::vector<icol*>& columns() const {return m_cols;}
|
||||
|
||||
protected:
|
||||
static const std::string& h_type(int) {
|
||||
static const std::string s_v("I*4");
|
||||
return s_v;
|
||||
}
|
||||
static const std::string& h_type(float) {
|
||||
static const std::string s_v("R*4");
|
||||
return s_v;
|
||||
}
|
||||
static const std::string& h_type(double) {
|
||||
static const std::string s_v("R*8");
|
||||
return s_v;
|
||||
}
|
||||
|
||||
protected:
|
||||
void cd_beg() const{
|
||||
wntuple& self = const_cast<wntuple&>(*this);
|
||||
CHPWDF(self.m_tmp);
|
||||
CHCDIR(m_path," ");
|
||||
CHCDIR(m_path_file," "); // cd on file.
|
||||
}
|
||||
void cd_end() const {CHCDIR(m_tmp," ");}
|
||||
protected:
|
||||
std::string m_path;
|
||||
int m_id;
|
||||
std::string m_path_file;
|
||||
char m_tmp[1024];
|
||||
std::vector<icol*> m_cols;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
//exlib_build_use inlib
|
||||
@@ -1,77 +0,0 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_mpi_world
|
||||
#define tools_mpi_world
|
||||
|
||||
// code to wrap MPI global things by having an interface (inlib::mpi).
|
||||
|
||||
#include <tools/impi_world>
|
||||
|
||||
#ifdef TOOLS_USE_NATIVE_MPI
|
||||
#include <mpi.h>
|
||||
#else
|
||||
#include "dummy_mpi.h"
|
||||
#endif
|
||||
|
||||
#ifdef TOOLS_MEM
|
||||
#include <tools/mem>
|
||||
#endif
|
||||
|
||||
namespace tools {
|
||||
namespace mpi {
|
||||
|
||||
class world : public virtual tools::impi_world {
|
||||
typedef tools::impi_world parent;
|
||||
#ifdef TOOLS_MEM
|
||||
protected:
|
||||
static const std::string& s_class() {
|
||||
static const std::string s_v("tools::mpi::world");
|
||||
return s_v;
|
||||
}
|
||||
#endif
|
||||
public:
|
||||
virtual bool init(int* a_argc,char*** a_argv) {
|
||||
if(::MPI_Init(a_argc,a_argv)!=MPI_SUCCESS) return false;
|
||||
return true;
|
||||
}
|
||||
virtual bool rank(int& a_rank) const {
|
||||
if(::MPI_Comm_rank(MPI_COMM_WORLD,&a_rank)!=MPI_SUCCESS) {a_rank=-1;return false;}
|
||||
return true;
|
||||
}
|
||||
virtual bool size(int& a_size) const {
|
||||
if(::MPI_Comm_size(MPI_COMM_WORLD,&a_size)!=MPI_SUCCESS) {a_size=0;return false;}
|
||||
return true;
|
||||
}
|
||||
virtual bool processor_name(std::string& a_s) const {
|
||||
char name[MPI_MAX_PROCESSOR_NAME];
|
||||
int lname;
|
||||
if(::MPI_Get_processor_name(name,&lname)!=MPI_SUCCESS) {a_s.clear();return false;}
|
||||
a_s = std::string(name);
|
||||
return true;
|
||||
}
|
||||
public:
|
||||
world() {
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
virtual ~world(){
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
protected:
|
||||
world(const world& a_from):parent(a_from) {
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
world& operator=(const world&) {return *this;}
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
//exlib_build_use inlib mpi
|
||||
|
||||
#endif
|
||||
@@ -1,24 +0,0 @@
|
||||
// Copyright (C) 2010, Guy Barrand. All rights reserved.
|
||||
// See the file tools.license for terms.
|
||||
|
||||
#ifndef tools_zfunc
|
||||
#define tools_zfunc
|
||||
|
||||
#include <ostream>
|
||||
|
||||
namespace tools {
|
||||
|
||||
typedef bool (*unzip_func)(std::ostream&,
|
||||
unsigned int,const char*,
|
||||
unsigned int,char*,
|
||||
unsigned int&);
|
||||
|
||||
typedef bool (*zip_func)(std::ostream&,
|
||||
unsigned int,
|
||||
unsigned int,const char*,
|
||||
unsigned int,char*,
|
||||
unsigned int&);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,18 +0,0 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# CMakeLists.txt
|
||||
# Module : G4analysis
|
||||
# Package: Geant4.src.G4analysis.G4analysismng
|
||||
#
|
||||
# CMakeLists.txt for building a single granular library.
|
||||
#
|
||||
# Created on : 15/07/2013
|
||||
#
|
||||
# $Id: CMakeLists.txt 92606 2015-09-08 12:34:01Z ihrivnac $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
if(GEANT4_BUILD_GRANULAR_LIBS)
|
||||
include(Geant4MacroLibraryTargets)
|
||||
GEANT4_GRANULAR_LIBRARY_TARGET(COMPONENT sources.cmake)
|
||||
endif()
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
# $Id: GNUmakefile 66356 2012-12-18 09:02:32Z gcosmo $
|
||||
# --------------------------------------------------------------------
|
||||
# GNUmakefile for analysis/management sub-library.
|
||||
# --------------------------------------------------------------------
|
||||
|
||||
name := G4parameters
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include \
|
||||
-I$(G4BASE)/intercoms/include \
|
||||
-I$(G4BASE)/analysis/g4tools/include \
|
||||
-I$(G4BASE)/analysis/management/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
@@ -1,50 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
|
||||
// Author: Ivana Hrivnacova, 04/07/2012 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4MergeMode_h
|
||||
#define G4MergeMode_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
|
||||
// Enumeration for definition available binning schemes
|
||||
|
||||
enum class G4MergeMode {
|
||||
kAddition,
|
||||
kMultiplication,
|
||||
kUser
|
||||
};
|
||||
|
||||
// Utility function
|
||||
namespace G4Analysis {
|
||||
|
||||
G4MergeMode GetMergeMode(const G4String& mergeModeName);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,74 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
|
||||
// Class template for parameters handled by Geant4 analysis
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 07/09/2015 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4Parameter_h
|
||||
#define G4Parameter_h 1
|
||||
|
||||
#include "G4VParameter.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
template <typename T>
|
||||
class G4Parameter : public G4VParameter
|
||||
{
|
||||
public:
|
||||
G4Parameter(const G4String& name, T initValue,
|
||||
G4MergeMode mergeMode = G4MergeMode::kAddition);
|
||||
G4Parameter(const G4Parameter& rhs);
|
||||
G4Parameter() = delete;
|
||||
virtual ~G4Parameter();
|
||||
|
||||
// operators
|
||||
G4Parameter<T>& operator= (const G4Parameter<T>& rhs);
|
||||
G4Parameter<T>& operator+=(const G4Parameter<T>& rhs);
|
||||
G4Parameter<T>& operator*=(const G4Parameter<T>& rhs);
|
||||
|
||||
G4Parameter<T>& operator= (const T& rhs);
|
||||
G4Parameter<T>& operator+=(const T& rhs);
|
||||
G4Parameter<T>& operator*=(const T& rhs);
|
||||
|
||||
// methods
|
||||
virtual void Merge(const G4VParameter& other) final;
|
||||
virtual void Reset() final;
|
||||
|
||||
// get methods
|
||||
T GetValue() const;
|
||||
|
||||
private:
|
||||
// data members
|
||||
T fValue;
|
||||
T fInitValue;
|
||||
};
|
||||
|
||||
// inline functions
|
||||
|
||||
#include "G4Parameter.icc"
|
||||
|
||||
#endif
|
||||
@@ -1,146 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id$
|
||||
|
||||
//
|
||||
// public functions
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4Parameter<T>::G4Parameter(const G4String& name, T initValue, G4MergeMode mergeMode)
|
||||
: G4VParameter(name, mergeMode),
|
||||
fValue(initValue),
|
||||
fInitValue(initValue)
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4Parameter<T>::G4Parameter(const G4Parameter& rhs)
|
||||
: G4VParameter(rhs),
|
||||
fValue(rhs.fValue),
|
||||
fInitValue(rhs.fInitValue)
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4Parameter<T>::~G4Parameter()
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4Parameter<T>&
|
||||
G4Parameter<T>::operator=(const G4Parameter<T>& rhs)
|
||||
{
|
||||
// check assignment to self
|
||||
if (this == &rhs) return *this;
|
||||
|
||||
// base class assignment
|
||||
G4VParameter::operator=(rhs);
|
||||
|
||||
// this class data assignment
|
||||
fValue = rhs.fValue;
|
||||
fInitValue = rhs.fInitValue;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4Parameter<T>&
|
||||
G4Parameter<T>::operator+=(const G4Parameter<T>& rhs)
|
||||
{
|
||||
// only update the value from rhs
|
||||
fValue += rhs.fValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4Parameter<T>&
|
||||
G4Parameter<T>::operator*=(const G4Parameter<T>& rhs)
|
||||
{
|
||||
// only update the value from rhs
|
||||
fValue *= rhs.fValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4Parameter<T>&
|
||||
G4Parameter<T>::operator=(const T& value)
|
||||
{
|
||||
// only update the value
|
||||
fValue = value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4Parameter<T>&
|
||||
G4Parameter<T>::operator+=(const T& value)
|
||||
{
|
||||
// only update the value
|
||||
fValue += value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4Parameter<T>&
|
||||
G4Parameter<T>::operator*=(const T& value)
|
||||
{
|
||||
// only update the value from rhs
|
||||
fValue *= value;
|
||||
return *this;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
void G4Parameter<T>::Merge(const G4VParameter& other)
|
||||
{
|
||||
if ( fMergeMode == G4MergeMode::kAddition ) {
|
||||
fValue += static_cast<const G4Parameter<T>&>(other).fValue;
|
||||
}
|
||||
else if ( fMergeMode == G4MergeMode::kMultiplication ) {
|
||||
fValue *= static_cast<const G4Parameter<T>&>(other).fValue;
|
||||
}
|
||||
// no operation is performed if User merge mode
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
void G4Parameter<T>::Reset()
|
||||
{
|
||||
fValue = fInitValue;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
T G4Parameter<T>::GetValue() const
|
||||
{
|
||||
return fValue;
|
||||
}
|
||||
@@ -1,94 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ParameterManager.hh 91012 2015-06-15 10:38:07Z ihrivnac $
|
||||
|
||||
// The common implementation of analysis manager classes.
|
||||
|
||||
// Author: Ivana Hrivnacova, 07/09/2015 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4ParameterManager_h
|
||||
#define G4ParameterManager_h 1
|
||||
|
||||
#include "G4Parameter.hh"
|
||||
#include "G4AnalysisManagerState.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
class G4AnalysisManagerState;
|
||||
class G4VParameter;
|
||||
|
||||
class G4ParameterManager
|
||||
{
|
||||
public:
|
||||
G4ParameterManager(G4bool isMaster = true);
|
||||
virtual ~G4ParameterManager();
|
||||
|
||||
// static methods
|
||||
static G4ParameterManager* Instance();
|
||||
|
||||
// Methods
|
||||
|
||||
// Requirements for parameter type:
|
||||
// Must have defined operators: +, ==, +=, *=
|
||||
template <typename T>
|
||||
void CreateParameter(const G4String& name, T value,
|
||||
G4MergeMode mergeMode = G4MergeMode::kAddition);
|
||||
|
||||
template <typename T>
|
||||
void RegisterParameter(G4Parameter<T>& parameter);
|
||||
|
||||
template <typename T>
|
||||
G4Parameter<T>* GetParameter(const G4String& name, G4bool warn = true) const;
|
||||
|
||||
// Handling user defined parameters
|
||||
void RegisterParameter(G4VParameter* parameter);
|
||||
G4VParameter* GetParameter(const G4String& name, G4bool warn = true) const;
|
||||
|
||||
|
||||
// Iterators not (yet) provided
|
||||
|
||||
// Methods for merging
|
||||
//G4bool MergeImpl(tools::histo::hmpi* hmpi);
|
||||
void Merge();
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
// static data members
|
||||
static G4ParameterManager* fgMasterInstance;
|
||||
static G4ThreadLocal G4ParameterManager* fgInstance;
|
||||
|
||||
// data members
|
||||
const G4AnalysisManagerState fState;
|
||||
std::map<G4String, G4VParameter*> fMap;
|
||||
std::vector<G4VParameter*> fParametersToDelete;
|
||||
};
|
||||
|
||||
#include "G4ParameterManager.icc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ParameterManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
#include <tools/cids>
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
void G4ParameterManager::CreateParameter(
|
||||
const G4String& name, T value, G4MergeMode mergeMode)
|
||||
{
|
||||
G4VParameter* parameter = new G4Parameter<T>(name, value, mergeMode);
|
||||
fMap[name] = parameter;
|
||||
fParametersToDelete.push_back(parameter);
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
void G4ParameterManager::RegisterParameter(G4Parameter<T>& parameter)
|
||||
{
|
||||
fMap[parameter.GetName()] = ¶meter;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
template <typename T>
|
||||
G4Parameter<T>*
|
||||
G4ParameterManager::GetParameter(const G4String& name, G4bool warn) const
|
||||
{
|
||||
// get G4VParammeter from the map
|
||||
auto parameter = GetParameter(name, warn);
|
||||
if ( ! parameter ) return 0;
|
||||
|
||||
// check type
|
||||
G4Parameter<T>* tparameter = dynamic_cast<G4Parameter<T>*>(parameter);
|
||||
if ( ! tparameter ) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "parameter " << name << " has different type";
|
||||
G4Exception("G4ParameterManager::GetParameter<T>",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return tparameter;
|
||||
}
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4CsvNtupleManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
// Value type independent base class for parameters handled by Geant4 analysis
|
||||
//
|
||||
// Author: Ivana Hrivnacova, 04/09/2015 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#ifndef G4VParameter_h
|
||||
#define G4VParameter_h 1
|
||||
|
||||
#include "tools/cids"
|
||||
|
||||
#include "G4MergeMode.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
|
||||
class G4VParameter
|
||||
{
|
||||
public:
|
||||
G4VParameter(const G4String& name,
|
||||
G4MergeMode mergeMode = G4MergeMode::kAddition);
|
||||
G4VParameter(const G4VParameter& rhs);
|
||||
G4VParameter() = delete;
|
||||
virtual ~G4VParameter() {}
|
||||
|
||||
// operators
|
||||
G4VParameter& operator=(const G4VParameter& rhs);
|
||||
|
||||
// methods
|
||||
virtual void Merge(const G4VParameter& other) = 0;
|
||||
virtual void Reset() = 0;
|
||||
|
||||
// get methods
|
||||
G4String GetName() const;
|
||||
G4MergeMode GetMergeMode() const;
|
||||
|
||||
protected:
|
||||
G4String fName;
|
||||
G4MergeMode fMergeMode;
|
||||
};
|
||||
|
||||
#include "G4VParameter.icc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ParameterManager.hh 70604 2013-06-03 11:27:06Z ihrivnac $
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline G4VParameter::G4VParameter(const G4String& name, G4MergeMode mergeMode)
|
||||
: fName(name), fMergeMode(mergeMode)
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline G4VParameter::G4VParameter(const G4VParameter& rhs)
|
||||
: fName(rhs.fName), fMergeMode(rhs.fMergeMode)
|
||||
{}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline G4VParameter& G4VParameter::operator=(const G4VParameter& rhs)
|
||||
{
|
||||
fName = rhs.fName;
|
||||
fMergeMode = rhs.fMergeMode;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline G4String G4VParameter::GetName() const
|
||||
{
|
||||
return fName;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
inline G4MergeMode G4VParameter::GetMergeMode() const
|
||||
{
|
||||
return fMergeMode;
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# sources.cmake
|
||||
# Module : G4hntools
|
||||
# Package: Geant4.src.G4analysis.G4hntools
|
||||
#
|
||||
# Sources description for a library.
|
||||
# Lists the sources and headers of the code explicitely.
|
||||
# Lists include paths needed.
|
||||
# Lists the internal granular and global dependencies of the library.
|
||||
# Source specific properties should be added at the end.
|
||||
#
|
||||
# Generated on : 15/07/2013
|
||||
#
|
||||
# $Id: sources.cmake 91489 2015-07-20 12:53:29Z ihrivnac $
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
# List external includes needed.
|
||||
include_directories(${CLHEP_INCLUDE_DIRS})
|
||||
|
||||
# List internal includes needed.
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/global/management/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/intercoms/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/analysis/g4tools/include)
|
||||
include_directories(${CMAKE_SOURCE_DIR}/source/analysis/management/include)
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
#
|
||||
|
||||
include(Geant4MacroDefineModule)
|
||||
GEANT4_DEFINE_MODULE(NAME G4hntools
|
||||
HEADERS
|
||||
G4MergeMode.hh
|
||||
G4ParameterManager.hh
|
||||
G4ParameterManager.icc
|
||||
G4Parameter.hh
|
||||
G4Parameter.icc
|
||||
G4VParameter.hh
|
||||
G4VParameter.icc
|
||||
SOURCES
|
||||
G4MergeMode.cc
|
||||
G4ParameterManager.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4globman
|
||||
G4intercoms
|
||||
G4analysismng
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4global
|
||||
G4intercoms
|
||||
LINK_LIBRARIES
|
||||
)
|
||||
|
||||
# List any source specific properties here
|
||||
@@ -1,51 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id:$
|
||||
|
||||
// Author: Ivana Hrivnacova, 22/08/2013 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4MergeMode.hh"
|
||||
|
||||
namespace G4Analysis
|
||||
{
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4MergeMode GetMergeMode(const G4String& mergeModeName) {
|
||||
if ( mergeModeName == "+" ) { return G4MergeMode::kAddition; }
|
||||
else if ( mergeModeName == "*" ) { return G4MergeMode::kMultiplication; }
|
||||
else if ( mergeModeName == "user" ) { return G4MergeMode::kUser; }
|
||||
else {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " \"" << mergeModeName << "\" merge mode is not supported." << G4endl
|
||||
<< " " << "Addition will be applied.";
|
||||
G4Exception("G4Analysis::GetMergeMode",
|
||||
"Analysis_W013", JustWarning, description);
|
||||
return G4MergeMode::kAddition;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,163 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4ParameterManager.cc 91116 2015-06-20 12:33:45Z ihrivnac $
|
||||
|
||||
// Author: Ivana Hrivnacova, 18/06/2013 (ivana@ipno.in2p3.fr)
|
||||
|
||||
#include "G4ParameterManager.hh"
|
||||
#include "G4Threading.hh"
|
||||
#include "G4AutoLock.hh"
|
||||
|
||||
// mutex in a file scope
|
||||
|
||||
namespace {
|
||||
//Mutex to lock master manager when merging parameters
|
||||
G4Mutex mergeMutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
G4ParameterManager* G4ParameterManager::fgMasterInstance = nullptr;
|
||||
G4ThreadLocal G4ParameterManager* G4ParameterManager::fgInstance = nullptr;
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4ParameterManager* G4ParameterManager::Instance()
|
||||
{
|
||||
if ( fgInstance == nullptr ) {
|
||||
G4bool isMaster = ! G4Threading::IsWorkerThread();
|
||||
fgInstance = new G4ParameterManager(isMaster);
|
||||
}
|
||||
|
||||
return fgInstance;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4ParameterManager::G4ParameterManager(G4bool isMaster)
|
||||
: fState("Parameter", isMaster),
|
||||
fMap()
|
||||
{
|
||||
if ( ( isMaster && fgMasterInstance ) || ( fgInstance ) ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " "
|
||||
<< "G4ParameterAnalysisManager already exists."
|
||||
<< "Cannot create another instance.";
|
||||
G4Exception("G4ParameterAnalysisManager::G4ParameterAnalysisManager()",
|
||||
"Analysis_F001", FatalException, description);
|
||||
}
|
||||
if ( isMaster ) fgMasterInstance = this;
|
||||
fgInstance = this;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4ParameterManager::~G4ParameterManager()
|
||||
{
|
||||
// delete only parameters create by the mager itself
|
||||
for ( auto it : fParametersToDelete ) {
|
||||
delete it;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// public methods
|
||||
//
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4ParameterManager::RegisterParameter(G4VParameter* parameter)
|
||||
{
|
||||
fMap[parameter->GetName()] = parameter;
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
G4VParameter*
|
||||
G4ParameterManager::GetParameter(const G4String& name, G4bool warn) const
|
||||
{
|
||||
// get G4VParammeter from the map
|
||||
auto it = fMap.find(name);
|
||||
if ( it == fMap.end() ) {
|
||||
if ( warn) {
|
||||
G4ExceptionDescription description;
|
||||
description << " " << "parameter " << name << " does not exist.";
|
||||
G4Exception("G4ParameterManager::GetParameter",
|
||||
"Analysis_W011", JustWarning, description);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
return it->second;
|
||||
}
|
||||
|
||||
// //_____________________________________________________________________________
|
||||
// G4bool G4ParameterManager::MergeImpl(tools::histo::hmpi* hmpi)
|
||||
// {
|
||||
// // tbd
|
||||
// return false;
|
||||
// }
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4ParameterManager::Merge()
|
||||
{
|
||||
// Do nothing if there are no parameters registered
|
||||
// or if master thread
|
||||
if ( (! fMap.size()) || (! G4Threading::IsWorkerThread()) ) return;
|
||||
|
||||
// The manager on mastter must exist
|
||||
if ( ! fgMasterInstance ) {
|
||||
G4ExceptionDescription description;
|
||||
description
|
||||
<< " " << "No master G4ParameterManager instance exists."
|
||||
<< G4endl
|
||||
<< " " << "Parameters will not be merged.";
|
||||
G4Exception("G4ParameterManager::Merge()",
|
||||
"Analysis_W031", JustWarning, description);
|
||||
return;
|
||||
}
|
||||
|
||||
// The worker manager just merges its parameters to the master
|
||||
// This operation needs a lock
|
||||
G4cout << "Go to merge parameters" << G4endl;
|
||||
G4AutoLock lock(&mergeMutex);
|
||||
|
||||
// the other manager has the map with identical keys
|
||||
auto it = fMap.begin();
|
||||
for ( auto itMaster : fgMasterInstance->fMap ) {
|
||||
// G4VParameter* parameter = (it++)->second;
|
||||
// G4VParameter* masterParameter = itMaster->second;
|
||||
// masterParameter->Merge(*(parameter));
|
||||
itMaster.second->Merge(*((it++)->second));
|
||||
}
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
//_____________________________________________________________________________
|
||||
void G4ParameterManager::Reset()
|
||||
{
|
||||
// Reset histograms and profiles
|
||||
|
||||
for ( auto it : fMap ) {
|
||||
it.second->Reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user