Import Geant4 10.7.0.beta source tree
This commit is contained in:
@@ -160,7 +160,7 @@ template <class T> G4THitsCollection<T>::~G4THitsCollection()
|
||||
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
std::vector<T*> * theHitsCollection = (std::vector<T*>*)theCollection;
|
||||
//theHitsCollection->clearAndDestroy();
|
||||
for(size_t i=0;i<theHitsCollection->size();i++)
|
||||
for(size_t i=0;i<theHitsCollection->size();++i)
|
||||
{ delete (*theHitsCollection)[i]; }
|
||||
theHitsCollection->clear();
|
||||
delete theHitsCollection;
|
||||
@@ -177,7 +177,7 @@ template <class T> void G4THitsCollection<T>::DrawAllHits()
|
||||
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
|
||||
std::vector<T*> * theHitsCollection = (std::vector<T*>*)theCollection;
|
||||
size_t n = theHitsCollection->size();
|
||||
for(size_t i=0;i<n;i++)
|
||||
for(size_t i=0;i<n;++i)
|
||||
{ (*theHitsCollection)[i]->Draw(); }
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ template <class T> void G4THitsCollection<T>::PrintAllHits()
|
||||
std::vector<T*> * theHitsCollection
|
||||
= (std::vector<T*>*)theCollection;
|
||||
size_t n = theHitsCollection->size();
|
||||
for(size_t i=0;i<n;i++)
|
||||
for(size_t i=0;i<n;++i)
|
||||
{ (*theHitsCollection)[i]->Print(); }
|
||||
}
|
||||
|
||||
|
||||
@@ -62,13 +62,13 @@ private:
|
||||
using enable_if_t = typename std::enable_if<_Bp, _Tp>::type;
|
||||
|
||||
// ensure fundamental types are initialized to zero
|
||||
template <typename U = T, enable_if_t<is_fundamental_t(U), int> = 0>
|
||||
template <typename U = T, enable_if_t<is_fundamental_t(U), G4int> = 0>
|
||||
T* allocate() const
|
||||
{ return new T(0.); }
|
||||
// non-fundamental types should set values to appropriate values
|
||||
// and avoid issues such as:
|
||||
// G4StatDouble stat(0.); stat += 1.0; gives n == 2;
|
||||
template <typename U = T, enable_if_t<! is_fundamental_t(U), int> = 0>
|
||||
template <typename U = T, enable_if_t<! is_fundamental_t(U), G4int> = 0>
|
||||
T* allocate() const
|
||||
{ return new T(); }
|
||||
|
||||
@@ -123,11 +123,11 @@ public:
|
||||
inline typename Map_t::size_type GetIndex(const_iterator itr) const
|
||||
{ return itr->first; }
|
||||
|
||||
template <typename MapU_t = Map_t, enable_if_t< !is_mmap_t(MapU_t), int> = 0>
|
||||
template <typename MapU_t = Map_t, enable_if_t< !is_mmap_t(MapU_t), G4int> = 0>
|
||||
inline T* GetObject(G4int idx) const
|
||||
{ return (GetContainer()->count(idx) != 0) ? (*GetContainer())[idx] : nullptr; }
|
||||
|
||||
template <typename MapU_t = Map_t, enable_if_t< is_mmap_t(MapU_t), int> = 0>
|
||||
template <typename MapU_t = Map_t, enable_if_t< is_mmap_t(MapU_t), G4int> = 0>
|
||||
inline T* GetObject(G4int idx) const
|
||||
{
|
||||
return (GetContainer()->count(idx) != 0) ? GetContainer()->find(idx)->second : nullptr;
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
// and += adds to white (not correct)
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<is_same_t(U, T) && ! is_mmap_t(MapU_t), int> = 0>
|
||||
enable_if_t<is_same_t(U, T) && ! is_mmap_t(MapU_t), G4int> = 0>
|
||||
size_t add(const G4int& key, U*& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -188,7 +188,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
|
||||
size_t add(const G4int& key, U*& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
|
||||
size_t add(const G4int& key, U*& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
// and += adds to white (not correct)
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(is_same_t(U, T) && ! is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
|
||||
size_t add(const G4int& key, U& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -236,7 +236,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(! is_same_t(U, T) && ! is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(! is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
|
||||
size_t add(const G4int& key, U& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -250,7 +250,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
|
||||
size_t add(const G4int& key, U& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -263,7 +263,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
|
||||
size_t add(const G4int& key, U& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -283,7 +283,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(is_same_t(U, T) && ! is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
|
||||
inline size_t set(const G4int& key, U*& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -297,7 +297,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
|
||||
inline size_t set(const G4int& key, U*& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -315,7 +315,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(!is_same_t(U, T) && ! is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(!is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
|
||||
inline size_t set(const G4int & key, U*& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -332,7 +332,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
|
||||
inline size_t set(const G4int& key, U*& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -358,7 +358,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(is_same_t(U, T) && ! is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
|
||||
inline size_t set(const G4int& key, U& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -375,7 +375,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
|
||||
inline size_t set(const G4int& key, U& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -390,7 +390,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(!is_same_t(U, T) && ! is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(!is_same_t(U, T) && ! is_mmap_t(MapU_t)), G4int> = 0>
|
||||
inline size_t set(const G4int & key, U& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -407,7 +407,7 @@ public:
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
typename MapU_t = Map_t,
|
||||
enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), int> = 0>
|
||||
enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
|
||||
inline size_t set(const G4int& key, U& aHit) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -428,7 +428,7 @@ public:
|
||||
// case of a multimap
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename MapU_t = Map_t,
|
||||
enable_if_t<! is_mmap_t(MapU_t), int> = 0>
|
||||
enable_if_t<! is_mmap_t(MapU_t), G4int> = 0>
|
||||
T* operator[](G4int key) const
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
@@ -438,7 +438,7 @@ public:
|
||||
}
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename MapU_t = Map_t,
|
||||
enable_if_t<is_mmap_t(MapU_t), int> = 0>
|
||||
enable_if_t<is_mmap_t(MapU_t), G4int> = 0>
|
||||
T* operator[](G4int key) const
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
@@ -491,7 +491,7 @@ template <typename T, typename Map_t>
|
||||
G4VTHitsMap<T, Map_t>::~G4VTHitsMap()
|
||||
{
|
||||
map_type* theHitsMap = GetMap();
|
||||
for(iterator itr = theHitsMap->begin(); itr != theHitsMap->end(); itr++)
|
||||
for(iterator itr = theHitsMap->begin(); itr != theHitsMap->end(); ++itr)
|
||||
delete itr->second;
|
||||
delete theHitsMap;
|
||||
}
|
||||
@@ -522,7 +522,7 @@ void G4VTHitsMap<T, Map_t>::PrintAllHits()
|
||||
Map_t * theHitsMap = GetMap();
|
||||
typename Map_t::iterator itr = theHitsMap->begin();
|
||||
T sum = 0.;
|
||||
for(; itr != theHitsMap->end(); itr++) {
|
||||
for(; itr != theHitsMap->end(); ++itr) {
|
||||
G4cout << " " << itr->first << " : "
|
||||
<< *(itr->second) << G4endl;
|
||||
sum += *(itr->second);
|
||||
@@ -537,7 +537,7 @@ template <typename T, typename Map_t>
|
||||
void G4VTHitsMap<T, Map_t>::clear()
|
||||
{
|
||||
Map_t * theHitsMap = GetMap();
|
||||
for(iterator itr = theHitsMap->begin(); itr != theHitsMap->end(); itr++)
|
||||
for(iterator itr = theHitsMap->begin(); itr != theHitsMap->end(); ++itr)
|
||||
delete itr->second;
|
||||
theHitsMap->clear();
|
||||
}
|
||||
|
||||
@@ -111,27 +111,27 @@ public:
|
||||
inline typename Vector_t::size_type GetIndex(const_iterator itr) const
|
||||
{ return std::distance(begin(), itr); }
|
||||
|
||||
template <typename U = store_type, enable_if_t< (is_pointer_t(U)), int> = 0>
|
||||
template <typename U = store_type, enable_if_t< (is_pointer_t(U)), G4int> = 0>
|
||||
inline T* GetObject(G4int idx) const
|
||||
{ return (idx < GetContainer()->size()) ? (*GetContainer())[idx] : nullptr; }
|
||||
{ return (idx < (G4int)GetContainer()->size()) ? (*GetContainer())[idx] : nullptr; }
|
||||
|
||||
template <typename U = store_type, enable_if_t< (is_pointer_t(U)), int> = 0>
|
||||
template <typename U = store_type, enable_if_t< (is_pointer_t(U)), G4int> = 0>
|
||||
inline T* GetObject(iterator itr) const
|
||||
{ return (*itr); }
|
||||
|
||||
template <typename U = store_type, enable_if_t< (is_pointer_t(U)), int> = 0>
|
||||
template <typename U = store_type, enable_if_t< (is_pointer_t(U)), G4int> = 0>
|
||||
inline const T* GetObject(const_iterator itr) const
|
||||
{ return (*itr); }
|
||||
|
||||
template <typename U = store_type, enable_if_t< (!is_pointer_t(U)), int> = 0>
|
||||
template <typename U = store_type, enable_if_t< (!is_pointer_t(U)), G4int> = 0>
|
||||
inline T* GetObject(G4int idx) const
|
||||
{ return (idx < GetContainer()->size()) ? &(*GetContainer())[idx] : nullptr; }
|
||||
{ return (idx < (G4int)GetContainer()->size()) ? &(*GetContainer())[idx] : nullptr; }
|
||||
|
||||
template <typename U = store_type, enable_if_t< (!is_pointer_t(U)), int> = 0>
|
||||
template <typename U = store_type, enable_if_t< (!is_pointer_t(U)), G4int> = 0>
|
||||
inline T* GetObject(iterator itr) const
|
||||
{ return &(*itr); }
|
||||
|
||||
template <typename U = store_type, enable_if_t< (!is_pointer_t(U)), int> = 0>
|
||||
template <typename U = store_type, enable_if_t< (!is_pointer_t(U)), G4int> = 0>
|
||||
inline const T* GetObject(const_iterator itr) const
|
||||
{ return &(*itr); }
|
||||
|
||||
@@ -168,7 +168,7 @@ public:
|
||||
template <typename U = T,
|
||||
typename V = store_type,
|
||||
enable_if_t< (is_fundamental_t(U) &&
|
||||
is_pointer_t(V)), int> = 0>
|
||||
is_pointer_t(V)), G4int> = 0>
|
||||
store_type allocate() const
|
||||
{ return new T(0.); }
|
||||
|
||||
@@ -177,13 +177,13 @@ public:
|
||||
template <typename U = T,
|
||||
typename V = store_type,
|
||||
enable_if_t< (!is_fundamental_t(U) &&
|
||||
is_pointer_t(V)), int> = 0>
|
||||
is_pointer_t(V)), G4int> = 0>
|
||||
store_type allocate() const
|
||||
{ return new T(); }
|
||||
|
||||
// ensure fundamental types are initialized to zero
|
||||
template <typename U = store_type,
|
||||
enable_if_t< (is_pointer_t(U)), int> = 0>
|
||||
enable_if_t< (is_pointer_t(U)), G4int> = 0>
|
||||
store_type null() const
|
||||
{ return nullptr; }
|
||||
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
template <typename U = T,
|
||||
typename V = store_type,
|
||||
enable_if_t< (is_fundamental_t(U) &&
|
||||
!is_pointer_t(V)), int> = 0>
|
||||
!is_pointer_t(V)), G4int> = 0>
|
||||
store_type allocate() const
|
||||
{ return T(0.); }
|
||||
// non-fundamental types should set values to appropriate values
|
||||
@@ -202,13 +202,13 @@ public:
|
||||
template <typename U = T,
|
||||
typename V = store_type,
|
||||
enable_if_t< (!is_fundamental_t(U) &&
|
||||
!is_pointer_t(V)), int> = 0>
|
||||
!is_pointer_t(V)), G4int> = 0>
|
||||
store_type allocate() const
|
||||
{ return T(); }
|
||||
|
||||
// ensure fundamental types are initialized to zero
|
||||
template <typename U = store_type,
|
||||
enable_if_t< (!is_pointer_t(U)), int> = 0>
|
||||
enable_if_t< (!is_pointer_t(U)), G4int> = 0>
|
||||
store_type null() const
|
||||
{ return store_type(); }
|
||||
|
||||
@@ -218,7 +218,7 @@ public:
|
||||
// U and VectorU_t types
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U, typename VectorU_t,
|
||||
enable_if_t< (is_pointer_t(typename VectorU_t::value_type)), int> = 0>
|
||||
enable_if_t< (is_pointer_t(typename VectorU_t::value_type)), G4int> = 0>
|
||||
this_type& operator+=(const G4VTHitsVector<U, VectorU_t>& right) const
|
||||
{
|
||||
VectorU_t* aHitsVector = right.GetVector();
|
||||
@@ -232,7 +232,7 @@ public:
|
||||
}
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U, typename VectorU_t,
|
||||
enable_if_t< (!is_pointer_t(typename VectorU_t::value_type)), int> = 0>
|
||||
enable_if_t< (!is_pointer_t(typename VectorU_t::value_type)), G4int> = 0>
|
||||
this_type& operator+=(const G4VTHitsVector<U, VectorU_t>& right) const
|
||||
{
|
||||
VectorU_t* aHitsVector = right.GetVector();
|
||||
@@ -245,7 +245,7 @@ public:
|
||||
}
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U, typename MapU_t,
|
||||
enable_if_t< (is_pointer_t(typename MapU_t::mapped_type)), int> = 0>
|
||||
enable_if_t< (is_pointer_t(typename MapU_t::mapped_type)), G4int> = 0>
|
||||
this_type& operator+=(const G4VTHitsMap<U, MapU_t>& right) const
|
||||
{
|
||||
MapU_t* aHitsMap = right.GetMap();
|
||||
@@ -255,7 +255,7 @@ public:
|
||||
}
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U, typename MapU_t,
|
||||
enable_if_t< !(is_pointer_t(typename MapU_t::mapped_type)), int> = 0>
|
||||
enable_if_t< !(is_pointer_t(typename MapU_t::mapped_type)), G4int> = 0>
|
||||
this_type& operator+=(const G4VTHitsMap<U, MapU_t>& right) const
|
||||
{
|
||||
MapU_t* aHitsMap = right.GetMap();
|
||||
@@ -274,7 +274,7 @@ public:
|
||||
// assumes type T has overload of += operator for U
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
enable_if_t< is_same_t(U, T), int> = 0>
|
||||
enable_if_t< is_same_t(U, T), G4int> = 0>
|
||||
std::size_t add(const G4int& key, U*& aHit) const
|
||||
{
|
||||
vector_type* theHitsVector = GetVector(key);
|
||||
@@ -285,7 +285,7 @@ public:
|
||||
// Overload for different types
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
enable_if_t< !is_same_t(U, T), int> = 0>
|
||||
enable_if_t< !is_same_t(U, T), G4int> = 0>
|
||||
std::size_t add(const G4int& key, U*& aHit) const
|
||||
{
|
||||
vector_type* theHitsVector = GetVector(key);
|
||||
@@ -298,7 +298,7 @@ public:
|
||||
// Overload for same type
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
enable_if_t< is_same_t(U, T), int> = 0>
|
||||
enable_if_t< is_same_t(U, T), G4int> = 0>
|
||||
std::size_t add(const G4int& key, U& aHit) const
|
||||
{
|
||||
vector_type* theHitsVector = GetVector(key);
|
||||
@@ -309,7 +309,7 @@ public:
|
||||
// Overload for different types
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
enable_if_t< !is_same_t(U, T), int> = 0>
|
||||
enable_if_t< !is_same_t(U, T), G4int> = 0>
|
||||
std::size_t add(const G4int& key, U& aHit) const
|
||||
{
|
||||
vector_type* theHitsVector = GetVector(key);
|
||||
@@ -326,7 +326,7 @@ public:
|
||||
// Overload for same type T
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
enable_if_t< is_same_t(U, T), int> = 0>
|
||||
enable_if_t< is_same_t(U, T), G4int> = 0>
|
||||
inline std::size_t set(const G4int& key, U*& aHit) const
|
||||
{
|
||||
vector_type* theHitsVector = GetVector(key);
|
||||
@@ -337,7 +337,7 @@ public:
|
||||
// Overload for different types
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
enable_if_t< !is_same_t(U, T), int> = 0>
|
||||
enable_if_t< !is_same_t(U, T), G4int> = 0>
|
||||
inline std::size_t set(const G4int & key, U*& aHit) const
|
||||
{
|
||||
vector_type* theHitsVector = GetVector(key);
|
||||
@@ -356,7 +356,7 @@ public:
|
||||
// Overload for same type T
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
enable_if_t< is_same_t(U, T), int> = 0>
|
||||
enable_if_t< is_same_t(U, T), G4int> = 0>
|
||||
inline std::size_t set(const G4int& key, U& aHit) const
|
||||
{
|
||||
vector_type* theHitsVector = GetVector(key);
|
||||
@@ -367,7 +367,7 @@ public:
|
||||
// Overload for different types
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = T,
|
||||
enable_if_t< !is_same_t(U, T), int> = 0>
|
||||
enable_if_t< !is_same_t(U, T), G4int> = 0>
|
||||
inline std::size_t set(const G4int & key, U& aHit) const
|
||||
{
|
||||
vector_type* theHitsVector = GetVector(key);
|
||||
@@ -397,12 +397,12 @@ public:
|
||||
|
||||
protected:
|
||||
template <typename U = store_type,
|
||||
enable_if_t< (is_pointer_t(U)), int> = 0>
|
||||
enable_if_t< (is_pointer_t(U)), G4int> = 0>
|
||||
void resize(vector_type*& theHitsVector,
|
||||
const G4int& key) const
|
||||
{
|
||||
// ensure the proper size
|
||||
if(key >= theHitsVector->size())
|
||||
if(key >= (G4int)theHitsVector->size())
|
||||
theHitsVector->resize(key+1, null());
|
||||
|
||||
// if null pointer for vector entry: allocate
|
||||
@@ -414,12 +414,12 @@ protected:
|
||||
}
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< (!is_pointer_t(U)), int> = 0>
|
||||
enable_if_t< (!is_pointer_t(U)), G4int> = 0>
|
||||
void resize(vector_type*& theHitsVector,
|
||||
const G4int& key) const
|
||||
{
|
||||
// ensure the proper size
|
||||
if(key >= theHitsVector->size())
|
||||
if(key >= (G4int)theHitsVector->size())
|
||||
theHitsVector->resize(key+1, null());
|
||||
}
|
||||
|
||||
@@ -435,7 +435,7 @@ protected:
|
||||
// assumes type T has overload of += operator for U
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = store_type,
|
||||
enable_if_t< is_pointer_t(U), int> = 0>
|
||||
enable_if_t< is_pointer_t(U), G4int> = 0>
|
||||
void _assign(vector_type*& theHitsVector, const G4int& key, T& val) const
|
||||
{
|
||||
delete (*theHitsVector)[key];
|
||||
@@ -443,7 +443,7 @@ protected:
|
||||
}
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< is_pointer_t(U), int> = 0>
|
||||
enable_if_t< is_pointer_t(U), G4int> = 0>
|
||||
void _assign(vector_type*& theHitsVector, const G4int& key, T*& val) const
|
||||
{
|
||||
delete (*theHitsVector)[key];
|
||||
@@ -451,42 +451,42 @@ protected:
|
||||
}
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< is_pointer_t(U), int> = 0>
|
||||
enable_if_t< is_pointer_t(U), G4int> = 0>
|
||||
void _add(vector_type*& theHitsVector, const G4int& key, T& val) const
|
||||
{
|
||||
*(*theHitsVector)[key] += val;
|
||||
}
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< is_pointer_t(U), int> = 0>
|
||||
enable_if_t< is_pointer_t(U), G4int> = 0>
|
||||
void _add(vector_type*& theHitsVector, const G4int& key, T*& val) const
|
||||
{
|
||||
*(*theHitsVector)[key] += *val;
|
||||
}
|
||||
|
||||
template <typename V, typename U = store_type,
|
||||
enable_if_t< is_pointer_t(U), int> = 0>
|
||||
enable_if_t< is_pointer_t(U), G4int> = 0>
|
||||
void _add(vector_type*& theHitsVector, const G4int& key, V& val) const
|
||||
{
|
||||
*(*theHitsVector)[key] += val;
|
||||
}
|
||||
|
||||
template <typename V, typename U = store_type,
|
||||
enable_if_t< is_pointer_t(U), int> = 0>
|
||||
enable_if_t< is_pointer_t(U), G4int> = 0>
|
||||
void _add(vector_type*& theHitsVector, const G4int& key, V*& val) const
|
||||
{
|
||||
*(*theHitsVector)[key] += *val;
|
||||
}
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< is_pointer_t(U), int> = 0>
|
||||
enable_if_t< is_pointer_t(U), G4int> = 0>
|
||||
T& get(U& val) const
|
||||
{
|
||||
return *val;
|
||||
}
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< is_pointer_t(U), int> = 0>
|
||||
enable_if_t< is_pointer_t(U), G4int> = 0>
|
||||
void delete_contents(vector_type*& theHitsVector) const
|
||||
{
|
||||
for(iterator itr = theHitsVector->begin(); itr != theHitsVector->end(); ++itr)
|
||||
@@ -494,7 +494,7 @@ protected:
|
||||
}
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< is_pointer_t(U), int> = 0>
|
||||
enable_if_t< is_pointer_t(U), G4int> = 0>
|
||||
T& get_reference(U& val) const
|
||||
{
|
||||
return *val;
|
||||
@@ -505,14 +505,14 @@ protected:
|
||||
// assumes type T has overload of += operator for U
|
||||
//------------------------------------------------------------------------//
|
||||
template <typename U = store_type,
|
||||
enable_if_t< !is_pointer_t(U), int> = 0>
|
||||
enable_if_t< !is_pointer_t(U), G4int> = 0>
|
||||
void _assign(vector_type*& theHitsVector, const G4int& key, T& val) const
|
||||
{
|
||||
(*theHitsVector)[key] = val;
|
||||
}
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< !is_pointer_t(U), int> = 0>
|
||||
enable_if_t< !is_pointer_t(U), G4int> = 0>
|
||||
void _assign(vector_type*& theHitsVector, const G4int& key, T*& val) const
|
||||
{
|
||||
delete (*theHitsVector)[key];
|
||||
@@ -520,14 +520,14 @@ protected:
|
||||
}
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< !is_pointer_t(U), int> = 0>
|
||||
enable_if_t< !is_pointer_t(U), G4int> = 0>
|
||||
void _add(vector_type*& theHitsVector, const G4int& key, T& val) const
|
||||
{
|
||||
(*theHitsVector)[key] += val;
|
||||
}
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< !is_pointer_t(U), int> = 0>
|
||||
enable_if_t< !is_pointer_t(U), G4int> = 0>
|
||||
void _add(vector_type*& theHitsVector, const G4int& key, T*& val) const
|
||||
{
|
||||
(*theHitsVector)[key] += *val;
|
||||
@@ -535,7 +535,7 @@ protected:
|
||||
|
||||
template <typename V,
|
||||
typename U = store_type,
|
||||
enable_if_t< !is_pointer_t(U), int> = 0>
|
||||
enable_if_t< !is_pointer_t(U), G4int> = 0>
|
||||
void _add(vector_type*& theHitsVector, const G4int& key, V& val) const
|
||||
{
|
||||
(*theHitsVector)[key] += val;
|
||||
@@ -543,19 +543,19 @@ protected:
|
||||
|
||||
template <typename V,
|
||||
typename U = store_type,
|
||||
enable_if_t< !is_pointer_t(U), int> = 0>
|
||||
enable_if_t< !is_pointer_t(U), G4int> = 0>
|
||||
void _add(vector_type*& theHitsVector, const G4int& key, V*& val) const
|
||||
{
|
||||
(*theHitsVector)[key] += *val;
|
||||
}
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< !is_pointer_t(U), int> = 0>
|
||||
enable_if_t< !is_pointer_t(U), G4int> = 0>
|
||||
void delete_contents(vector_type*&) const
|
||||
{ }
|
||||
|
||||
template <typename U = store_type,
|
||||
enable_if_t< !is_pointer_t(U), int> = 0>
|
||||
enable_if_t< !is_pointer_t(U), G4int> = 0>
|
||||
T& get_reference(U& val) const
|
||||
{
|
||||
return val;
|
||||
@@ -653,7 +653,7 @@ void G4VTHitsVector<T, Vector_t>::PrintAllHits()
|
||||
Vector_t * theHitsVector = GetVector();
|
||||
typename Vector_t::iterator itr = theHitsVector->begin();
|
||||
T sum = 0.;
|
||||
for(; itr != theHitsVector->end(); itr++) {
|
||||
for(; itr != theHitsVector->end(); ++itr) {
|
||||
G4cout << " " << itr->first << " : "
|
||||
<< *(itr->second) << G4endl;
|
||||
sum += *(itr->second);
|
||||
|
||||
Reference in New Issue
Block a user