Import Geant4 10.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 12:08:39 +02:00
parent 286caacf06
commit c9b32a6c0a
5770 changed files with 1050949 additions and 367105 deletions
+106 -70
View File
@@ -10,24 +10,22 @@
namespace tools {
namespace histo {
template <class TC,class TN,class TW,class TH,class TV>
class p2 : public b2<TC,TN,TW,TH> {
typedef b2<TC,TN,TW,TH> parent;
template <class TC,class TO,class TN,class TW,class TH,class TV>
class p2 : public b2<TC,TO,TN,TW,TH> {
typedef b2<TC,TO,TN,TW,TH> parent;
public:
typedef typename base_histo<TC,TN,TW,TH>::bn_t bn_t;
typedef profile_data<TC,TO,TN,TW,TV> pd_t;
typedef typename parent::bn_t bn_t;
typedef std::vector<TV> vs_t;
protected:
virtual TH get_bin_height(int a_offset) const {
virtual TH get_bin_height(TO a_offset) const {
return (parent::m_bin_Sw[a_offset] ? (m_bin_Svw[a_offset]/parent::m_bin_Sw[a_offset]):0);
}
public:
virtual TH bin_error(int aI,int aJ) const { //TH should be the same as TV
if(parent::m_bin_number==0) return 0;
bn_t ibin;
if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) return 0;
bn_t jbin;
if(!parent::m_axes[1].in_range_to_absolute_index(aJ,jbin)) return 0;
bn_t offset = ibin + jbin * parent::m_axes[1].m_offset;
TO offset;
if(!parent::_find_offset(aI,aJ,offset)) return 0;
//FIXME Is it correct ?
// TProfile::GetBinError with kERRORMEAN mode does :
@@ -53,32 +51,23 @@ public:
}
public:
bool multiply(TW aFactor){
if(!parent::base_multiply(aFactor)) return false;
bool multiply(TW a_factor){
if(!parent::base_multiply(a_factor)) return false;
for(bn_t ibin=0;ibin<parent::m_bin_number;ibin++) {
m_bin_Svw[ibin] *= aFactor;
m_bin_Svw[ibin] *= a_factor;
}
parent::update_fast_getters();
return true;
}
bool scale(TW aFactor) {return multiply(aFactor);}
bool scale(TW a_factor) {return multiply(a_factor);}
TV bin_Svw(int aI,int aJ) const {
if(parent::m_bin_number==0) return 0;
bn_t ibin;
if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) return 0;
bn_t jbin;
if(!parent::m_axes[1].in_range_to_absolute_index(aJ,jbin)) return 0;
bn_t offset = ibin + jbin * parent::m_axes[1].m_offset;
TO offset;
if(!parent::_find_offset(aI,aJ,offset)) return 0;
return m_bin_Svw[offset];
}
TV bin_Sv2w(int aI,int aJ) const {
if(parent::m_bin_number==0) return 0;
bn_t ibin;
if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) return 0;
bn_t jbin;
if(!parent::m_axes[1].in_range_to_absolute_index(aJ,jbin)) return 0;
bn_t offset = ibin + jbin * parent::m_axes[1].m_offset;
TO offset;
if(!parent::_find_offset(aI,aJ,offset)) return 0;
return m_bin_Sv2w[offset];
}
@@ -88,11 +77,10 @@ public:
m_bin_Svw[ibin] = 0;
m_bin_Sv2w[ibin] = 0;
}
parent::update_fast_getters();
return true;
}
void copy_from_data(const profile_data<TC,TN,TW,TV>& a_from) {
void copy_from_data(const pd_t& a_from) {
parent::base_from_data(a_from);
m_bin_Svw = a_from.m_bin_Svw;
m_bin_Sv2w = a_from.m_bin_Sv2w;
@@ -100,8 +88,8 @@ public:
m_min_v = a_from.m_min_v;
m_max_v = a_from.m_max_v;
}
profile_data<TC,TN,TW,TV> get_histo_data() const {
profile_data<TC,TN,TW,TV> hd(parent::base_get_data());
pd_t get_histo_data() const {
pd_t hd(parent::base_get_data());
hd.m_is_profile = true;
hd.m_bin_Svw = m_bin_Svw;
hd.m_bin_Sv2w = m_bin_Sv2w;
@@ -112,18 +100,14 @@ public:
}
bool fill(TC aX,TC aY,TV aV,TW aWeight = 1) {
//m_coords[0] = aX;
//m_coords[1] = aY;
//return fill_bin(m_coords,aV,aWeight);
if(parent::m_dimension!=2) return false;
if(m_cut_v) {
if( (aV<m_min_v) || (aV>=m_max_v) ) {
return true;
}
}
if(parent::m_dimension<=0) return false;
bn_t ibin,jbin;
if(!parent::m_axes[0].coord_to_absolute_index(aX,ibin)) return false;
if(!parent::m_axes[1].coord_to_absolute_index(aY,jbin)) return false;
@@ -150,15 +134,17 @@ public:
if(jbin==0) inRange = false;
else if(jbin==(parent::m_axes[1].m_number_of_bins+1)) inRange = false;
parent::m_all_entries++;
if(inRange) {
parent::m_in_range_entries++;
parent::m_in_range_Sw += aWeight;
parent::m_in_range_Sw2 += aWeight*aWeight;
parent::m_in_range_Sxw += xw;
parent::m_in_range_Sx2w += x2w;
parent::m_in_range_Syw += yw;
parent::m_in_range_Sy2w += y2w;
parent::m_in_range_Sxw[0] += xw;
parent::m_in_range_Sx2w[0] += x2w;
parent::m_in_range_Sxw[1] += yw;
parent::m_in_range_Sx2w[1] += y2w;
}
// Profile part :
@@ -170,12 +156,8 @@ public:
}
TV bin_rms_value(int aI,int aJ) const {
if(parent::m_bin_number==0) return 0;
bn_t ibin;
if(!parent::m_axes[0].in_range_to_absolute_index(aI,ibin)) return 0;
bn_t jbin;
if(!parent::m_axes[1].in_range_to_absolute_index(aJ,jbin)) return 0;
bn_t offset = ibin + jbin * parent::m_axes[1].m_offset;
TO offset;
if(!parent::_find_offset(aI,aJ,offset)) return 0;
TW sw = parent::m_bin_Sw[offset];
if(sw==0) return 0;
@@ -191,7 +173,6 @@ public:
m_bin_Svw[ibin] += a_histo.m_bin_Svw[ibin];
m_bin_Sv2w[ibin] += a_histo.m_bin_Sv2w[ibin];
}
parent::update_fast_getters();
return true;
}
bool subtract(const p2& a_histo){
@@ -200,7 +181,6 @@ public:
m_bin_Svw[ibin] -= a_histo.m_bin_Svw[ibin];
m_bin_Sv2w[ibin] -= a_histo.m_bin_Sv2w[ibin];
}
parent::update_fast_getters();
return true;
}
@@ -209,9 +189,9 @@ public:
TV max_v() const {return m_max_v;}
public:
p2(const std::string& a_title,
bn_t aXnumber,TC aXmin,TC aXmax,
bn_t aYnumber,TC aYmin,TC aYmax)
: parent(a_title,aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)
bn_t aXnumber,TC aXmin,TC aXmax,
bn_t aYnumber,TC aYmin,TC aYmax)
:parent(a_title,aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)
,m_cut_v(false)
,m_min_v(0)
,m_max_v(0)
@@ -221,10 +201,10 @@ public:
}
p2(const std::string& a_title,
bn_t aXnumber,TC aXmin,TC aXmax,
bn_t aYnumber,TC aYmin,TC aYmax,
TV aVmin,TV aVmax)
: parent(a_title,aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)
bn_t aXnumber,TC aXmin,TC aXmax,
bn_t aYnumber,TC aYmin,TC aYmax,
TV aVmin,TV aVmax)
:parent(a_title,aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)
,m_cut_v(true)
,m_min_v(aVmin)
,m_max_v(aVmax)
@@ -234,9 +214,9 @@ public:
}
p2(const std::string& a_title,
const std::vector<TC>& aEdgesX,
const std::vector<TC>& aEdgesY)
: parent(a_title,aEdgesX,aEdgesY)
const std::vector<TC>& aEdgesX,
const std::vector<TC>& aEdgesY)
:parent(a_title,aEdgesX,aEdgesY)
,m_cut_v(false)
,m_min_v(0)
,m_max_v(0)
@@ -246,10 +226,10 @@ public:
}
p2(const std::string& a_title,
const std::vector<TC>& aEdgesX,
const std::vector<TC>& aEdgesY,
TV aVmin,TV aVmax)
: parent(a_title,aEdgesX,aEdgesY)
const std::vector<TC>& aEdgesX,
const std::vector<TC>& aEdgesY,
TV aVmin,TV aVmax)
:parent(a_title,aEdgesX,aEdgesY)
,m_cut_v(true)
,m_min_v(aVmin)
,m_max_v(aVmax)
@@ -261,7 +241,7 @@ public:
virtual ~p2(){}
public:
p2(const p2& a_from)
: parent(a_from)
:parent(a_from)
,m_cut_v(a_from.m_cut_v)
,m_min_v(a_from.m_min_v)
,m_max_v(a_from.m_max_v)
@@ -278,14 +258,70 @@ public:
return *this;
}
public:
const std::vector<TV>& bins_sum_vw() const {return m_bin_Svw;}
const std::vector<TV>& bins_sum_v2w() const {return m_bin_Sv2w;}
bool configure(bn_t aXnumber,TC aXmin,TC aXmax,bn_t aYnumber,TC aYmin,TC aYmax){
if(!parent::configure(aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)) return false;
m_bin_Svw.resize(parent::m_bin_number,0);
m_bin_Sv2w.resize(parent::m_bin_number,0);
m_cut_v = false;
m_min_v = 0;
m_max_v = 0;
return true;
}
bool configure(const std::vector<TC>& aEdgesX,const std::vector<TC>& aEdgesY) {
if(!parent::configure(aEdgesX,aEdgesY)) return false;
m_bin_Svw.resize(parent::m_bin_number,0);
m_bin_Sv2w.resize(parent::m_bin_number,0);
m_cut_v = false;
m_min_v = 0;
m_max_v = 0;
return true;
}
bool configure(bn_t aXnumber,TC aXmin,TC aXmax,bn_t aYnumber,TC aYmin,TC aYmax,TV aVmin,TV aVmax){
if(!parent::configure(aXnumber,aXmin,aXmax,aYnumber,aYmin,aYmax)) return false;
m_bin_Svw.resize(parent::m_bin_number,0);
m_bin_Sv2w.resize(parent::m_bin_number,0);
m_cut_v = true;
m_min_v = aVmin;
m_max_v = aVmax;
return true;
}
bool configure(const std::vector<TC>& aEdgesX,const std::vector<TC>& aEdgesY,TV aVmin,TV aVmax) {
if(!parent::configure(aEdgesX,aEdgesY)) return false;
m_bin_Svw.resize(parent::m_bin_number,0);
m_bin_Sv2w.resize(parent::m_bin_number,0);
m_cut_v = true;
m_min_v = aVmin;
m_max_v = aVmax;
return true;
}
public:
const vs_t& bins_sum_vw() const {return m_bin_Svw;}
const vs_t& bins_sum_v2w() const {return m_bin_Sv2w;}
TW get_Svw() const {
TW sw = 0;
for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
if(!histo::is_out(parent::m_axes,ibin)) {
sw += m_bin_Svw[ibin];
}
}
return sw;
}
TW get_Sv2w() const {
TW sw = 0;
for(TO ibin=0;ibin<parent::m_bin_number;ibin++) {
if(!histo::is_out(parent::m_axes,ibin)) {
sw += m_bin_Sv2w[ibin];
}
}
return sw;
}
protected:
bool m_cut_v;
TV m_min_v;
TV m_max_v;
std::vector<TV> m_bin_Svw;
std::vector<TV> m_bin_Sv2w;
vs_t m_bin_Svw;
vs_t m_bin_Sv2w;
};
}}