Geant4 11.3.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VTHitsVector< T, Vector_t > Class Template Reference

#include <G4THitsVector.hh>

+ Inheritance diagram for G4VTHitsVector< T, Vector_t >:

Public Types

using this_type = G4VTHitsVector<T, Vector_t>
 
using value_type = T
 
using vector_type = Vector_t
 
using iterator = typename vector_type::iterator
 
using const_iterator = typename vector_type::const_iterator
 
using store_type = typename Vector_t::value_type
 
using pair_t = std::pair<G4int, store_type>
 
using map_t = std::map<G4int, store_type>
 
using uomap_t = std::unordered_map<G4int, store_type>
 
using mmap_t = std::multimap<G4int, store_type>
 
using uommap_t = std::unordered_multimap<G4int, store_type>
 

Public Member Functions

 G4VTHitsVector (G4int init_size=0)
 
 G4VTHitsVector (const G4String &detName, const G4String &colNam, G4int init_size=0)
 
 ~G4VTHitsVector () override
 
G4bool operator== (const this_type &rhs) const
 
void DrawAllHits () override
 
void PrintAllHits () override
 
Vector_t * GetContainer () const
 
Vector_t::size_type size ()
 
Vector_t::size_type GetIndex (iterator itr)
 
Vector_t::size_type GetIndex (const_iterator itr) const
 
template<typename U = store_type, enable_if_t<(is_pointer_t(U)), G4int > = 0>
T * GetObject (G4int idx) const
 
template<typename U = store_type, enable_if_t<(is_pointer_t(U)), G4int > = 0>
T * GetObject (iterator itr) const
 
template<typename U = store_type, enable_if_t<(is_pointer_t(U)), G4int > = 0>
const T * GetObject (const_iterator itr) const
 
template<typename U = store_type, enable_if_t<(! is_pointer_t(U)), G4int > = 0>
T * GetObject (G4int idx) const
 
template<typename U = store_type, enable_if_t<(! is_pointer_t(U)), G4int > = 0>
T * GetObject (iterator itr) const
 
template<typename U = store_type, enable_if_t<(! is_pointer_t(U)), G4int > = 0>
const T * GetObject (const_iterator itr) const
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const_iterator cbegin () const
 
const_iterator cend () const
 
Vector_t * GetVector () const
 
std::size_t entries () const
 
void clear ()
 
G4VHitGetHit (std::size_t) const override
 
std::size_t GetSize () const override
 
map_tGetMap () const
 
template<typename U = T, typename V = store_type, enable_if_t<(is_fundamental_t(U) &&is_pointer_t(V)), G4int > = 0>
store_type allocate () const
 
template<typename U = T, typename V = store_type, enable_if_t<(! is_fundamental_t(U) &&is_pointer_t(V)), G4int > = 0>
store_type allocate () const
 
template<typename U = store_type, enable_if_t<(is_pointer_t(U)), G4int > = 0>
store_type null () const
 
template<typename U = T, typename V = store_type, enable_if_t<(is_fundamental_t(U) &&! is_pointer_t(V)), G4int > = 0>
store_type allocate () const
 
template<typename U = T, typename V = store_type, enable_if_t<(! is_fundamental_t(U) &&! is_pointer_t(V)), G4int > = 0>
store_type allocate () const
 
template<typename U = store_type, enable_if_t<(! is_pointer_t(U)), G4int > = 0>
store_type null () const
 
template<typename U, typename VectorU_t, enable_if_t<(is_pointer_t(typename VectorU_t::value_type)), G4int > = 0>
this_typeoperator+= (const G4VTHitsVector< U, VectorU_t > &right) const
 
template<typename U, typename VectorU_t, enable_if_t<(! is_pointer_t(typename VectorU_t::value_type)), G4int > = 0>
this_typeoperator+= (const G4VTHitsVector< U, VectorU_t > &right) const
 
template<typename U, typename MapU_t, enable_if_t<(is_pointer_t(typename MapU_t::mapped_type)), G4int > = 0>
this_typeoperator+= (const G4VTHitsMap< U, MapU_t > &right) const
 
template<typename U, typename MapU_t, enable_if_t<!(is_pointer_t(typename MapU_t::mapped_type)), G4int > = 0>
this_typeoperator+= (const G4VTHitsMap< U, MapU_t > &right) const
 
template<typename U = T, enable_if_t< is_same_t(U, T), G4int > = 0>
std::size_t add (const G4int &key, U *&aHit) const
 
template<typename U = T, enable_if_t<! is_same_t(U, T), G4int > = 0>
std::size_t add (const G4int &key, U *&aHit) const
 
template<typename U = T, enable_if_t< is_same_t(U, T), G4int > = 0>
std::size_t add (const G4int &key, U &aHit) const
 
template<typename U = T, enable_if_t<! is_same_t(U, T), G4int > = 0>
std::size_t add (const G4int &key, U &aHit) const
 
template<typename U = T, enable_if_t< is_same_t(U, T), G4int > = 0>
std::size_t set (const G4int &key, U *&aHit) const
 
template<typename U = T, enable_if_t<! is_same_t(U, T), G4int > = 0>
std::size_t set (const G4int &key, U *&aHit) const
 
template<typename U = T, enable_if_t< is_same_t(U, T), G4int > = 0>
std::size_t set (const G4int &key, U &aHit) const
 
template<typename U = T, enable_if_t<! is_same_t(U, T), G4int > = 0>
std::size_t set (const G4int &key, U &aHit) const
 
T * at (G4int key) const
 
T * operator[] (G4int key) const
 
- Public Member Functions inherited from G4HitsCollection
 ~G4HitsCollection () override=default
 
G4bool operator== (const G4HitsCollection &right) const
 
 G4VHitsCollection ()=default
 
 G4VHitsCollection (const G4String &detName, const G4String &colNam)
 
- Public Member Functions inherited from G4VHitsCollection
 G4VHitsCollection ()=default
 
 G4VHitsCollection (const G4String &detName, const G4String &colNam)
 
virtual ~G4VHitsCollection ()=default
 
G4bool operator== (const G4VHitsCollection &right) const
 
const G4StringGetName () const
 
const G4StringGetSDname () const
 
void SetColID (G4int i)
 
G4int GetColID () const
 

Protected Member Functions

template<typename U = store_type, enable_if_t<(is_pointer_t(U)), G4int > = 0>
void resize (vector_type *&theHitsVector, const G4int &key) const
 
template<typename U = store_type, enable_if_t<(! is_pointer_t(U)), G4int > = 0>
void resize (vector_type *&theHitsVector, const G4int &key) const
 
vector_typeGetVector (const G4int &key) const
 
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void _assign (vector_type *&theHitsVector, const G4int &key, T &val) const
 
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void _assign (vector_type *&theHitsVector, const G4int &key, T *&val) const
 
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void _add (vector_type *&theHitsVector, const G4int &key, T &val) const
 
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void _add (vector_type *&theHitsVector, const G4int &key, T *&val) const
 
template<typename V, typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void _add (vector_type *&theHitsVector, const G4int &key, V &val) const
 
template<typename V, typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void _add (vector_type *&theHitsVector, const G4int &key, V *&val) const
 
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
T & get (U &val) const
 
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void delete_contents (vector_type *&theHitsVector) const
 
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
T & get_reference (U &val) const
 
template<typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void _assign (vector_type *&theHitsVector, const G4int &key, T &val) const
 
template<typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void _assign (vector_type *&theHitsVector, const G4int &key, T *&val) const
 
template<typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void _add (vector_type *&theHitsVector, const G4int &key, T &val) const
 
template<typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void _add (vector_type *&theHitsVector, const G4int &key, T *&val) const
 
template<typename V, typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void _add (vector_type *&theHitsVector, const G4int &key, V &val) const
 
template<typename V, typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void _add (vector_type *&theHitsVector, const G4int &key, V *&val) const
 
template<typename U = store_type, 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), G4int > = 0>
T & get_reference (U &val) const
 

Additional Inherited Members

- Protected Attributes inherited from G4HitsCollection
void * theCollection = nullptr
 
- Protected Attributes inherited from G4VHitsCollection
G4String collectionName = "Unknown"
 
G4String SDname = "Unknown"
 
G4int colID = -1
 

Detailed Description

template<typename T, typename Vector_t = std::deque<T*>>
class G4VTHitsVector< T, Vector_t >

Definition at line 53 of file G4THitsVector.hh.

Member Typedef Documentation

◆ const_iterator

template<typename T, typename Vector_t = std::deque<T*>>
using G4VTHitsVector< T, Vector_t >::const_iterator = typename vector_type::const_iterator

Definition at line 61 of file G4THitsVector.hh.

◆ iterator

template<typename T, typename Vector_t = std::deque<T*>>
using G4VTHitsVector< T, Vector_t >::iterator = typename vector_type::iterator

Definition at line 60 of file G4THitsVector.hh.

◆ map_t

template<typename T, typename Vector_t = std::deque<T*>>
using G4VTHitsVector< T, Vector_t >::map_t = std::map<G4int, store_type>

Definition at line 65 of file G4THitsVector.hh.

◆ mmap_t

template<typename T, typename Vector_t = std::deque<T*>>
using G4VTHitsVector< T, Vector_t >::mmap_t = std::multimap<G4int, store_type>

Definition at line 67 of file G4THitsVector.hh.

◆ pair_t

template<typename T, typename Vector_t = std::deque<T*>>
using G4VTHitsVector< T, Vector_t >::pair_t = std::pair<G4int, store_type>

Definition at line 64 of file G4THitsVector.hh.

◆ store_type

template<typename T, typename Vector_t = std::deque<T*>>
using G4VTHitsVector< T, Vector_t >::store_type = typename Vector_t::value_type

Definition at line 63 of file G4THitsVector.hh.

◆ this_type

template<typename T, typename Vector_t = std::deque<T*>>
using G4VTHitsVector< T, Vector_t >::this_type = G4VTHitsVector<T, Vector_t>

Definition at line 57 of file G4THitsVector.hh.

◆ uomap_t

template<typename T, typename Vector_t = std::deque<T*>>
using G4VTHitsVector< T, Vector_t >::uomap_t = std::unordered_map<G4int, store_type>

Definition at line 66 of file G4THitsVector.hh.

◆ uommap_t

template<typename T, typename Vector_t = std::deque<T*>>
using G4VTHitsVector< T, Vector_t >::uommap_t = std::unordered_multimap<G4int, store_type>

Definition at line 68 of file G4THitsVector.hh.

◆ value_type

template<typename T, typename Vector_t = std::deque<T*>>
using G4VTHitsVector< T, Vector_t >::value_type = T

Definition at line 58 of file G4THitsVector.hh.

◆ vector_type

template<typename T, typename Vector_t = std::deque<T*>>
using G4VTHitsVector< T, Vector_t >::vector_type = Vector_t

Definition at line 59 of file G4THitsVector.hh.

Constructor & Destructor Documentation

◆ G4VTHitsVector() [1/2]

template<typename T, typename Vector_t>
G4VTHitsVector< T, Vector_t >::G4VTHitsVector ( G4int init_size = 0)

Definition at line 546 of file G4THitsVector.hh.

547{
548 theCollection = static_cast<void*>(new Vector_t);
549 if (init_size > 0) {
552 }
553}
void resize(vector_type *&theHitsVector, const G4int &key) const

Referenced by operator==().

◆ G4VTHitsVector() [2/2]

template<typename T, typename Vector_t>
G4VTHitsVector< T, Vector_t >::G4VTHitsVector ( const G4String & detName,
const G4String & colNam,
G4int init_size = 0 )

Definition at line 558 of file G4THitsVector.hh.

560{
561 theCollection = static_cast<void*>(new Vector_t);
562 if (init_size > 0) {
565 }
566}

◆ ~G4VTHitsVector()

template<typename T, typename Vector_t>
G4VTHitsVector< T, Vector_t >::~G4VTHitsVector ( )
override

Definition at line 571 of file G4THitsVector.hh.

572{
575 delete theHitsVector;
576}
void delete_contents(vector_type *&theHitsVector) const

Member Function Documentation

◆ _add() [1/8]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_add ( vector_type *& theHitsVector,
const G4int & key,
T & val ) const
inlineprotected

Definition at line 439 of file G4THitsVector.hh.

440 {
441 *(*theHitsVector)[key] += val;
442 }

Referenced by add(), and add().

◆ _add() [2/8]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_add ( vector_type *& theHitsVector,
const G4int & key,
T & val ) const
inlineprotected

Definition at line 499 of file G4THitsVector.hh.

500 {
501 (*theHitsVector)[key] += val;
502 }

◆ _add() [3/8]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_add ( vector_type *& theHitsVector,
const G4int & key,
T *& val ) const
inlineprotected

Definition at line 445 of file G4THitsVector.hh.

446 {
447 *(*theHitsVector)[key] += *val;
448 }

◆ _add() [4/8]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_add ( vector_type *& theHitsVector,
const G4int & key,
T *& val ) const
inlineprotected

Definition at line 505 of file G4THitsVector.hh.

506 {
507 (*theHitsVector)[key] += *val;
508 }

◆ _add() [5/8]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename V, typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_add ( vector_type *& theHitsVector,
const G4int & key,
V & val ) const
inlineprotected

Definition at line 451 of file G4THitsVector.hh.

452 {
453 *(*theHitsVector)[key] += val;
454 }

◆ _add() [6/8]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename V, typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_add ( vector_type *& theHitsVector,
const G4int & key,
V & val ) const
inlineprotected

Definition at line 511 of file G4THitsVector.hh.

512 {
513 (*theHitsVector)[key] += val;
514 }

◆ _add() [7/8]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename V, typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_add ( vector_type *& theHitsVector,
const G4int & key,
V *& val ) const
inlineprotected

Definition at line 457 of file G4THitsVector.hh.

458 {
459 *(*theHitsVector)[key] += *val;
460 }

◆ _add() [8/8]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename V, typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_add ( vector_type *& theHitsVector,
const G4int & key,
V *& val ) const
inlineprotected

Definition at line 517 of file G4THitsVector.hh.

518 {
519 (*theHitsVector)[key] += *val;
520 }

◆ _assign() [1/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_assign ( vector_type *& theHitsVector,
const G4int & key,
T & val ) const
inlineprotected

Definition at line 425 of file G4THitsVector.hh.

426 {
427 delete (*theHitsVector)[key];
428 *(*theHitsVector)[key] = val;
429 }

Referenced by resize(), set(), and set().

◆ _assign() [2/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_assign ( vector_type *& theHitsVector,
const G4int & key,
T & val ) const
inlineprotected

Definition at line 486 of file G4THitsVector.hh.

487 {
488 (*theHitsVector)[key] = val;
489 }

◆ _assign() [3/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_assign ( vector_type *& theHitsVector,
const G4int & key,
T *& val ) const
inlineprotected

Definition at line 432 of file G4THitsVector.hh.

433 {
434 delete (*theHitsVector)[key];
435 (*theHitsVector)[key] = val;
436 }

◆ _assign() [4/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::_assign ( vector_type *& theHitsVector,
const G4int & key,
T *& val ) const
inlineprotected

Definition at line 492 of file G4THitsVector.hh.

493 {
494 delete (*theHitsVector)[key];
495 (*theHitsVector)[key] = *val;
496 }

◆ add() [1/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, enable_if_t< is_same_t(U, T), G4int > = 0>
std::size_t G4VTHitsVector< T, Vector_t >::add ( const G4int & key,
U & aHit ) const
inline

Definition at line 304 of file G4THitsVector.hh.

305 {
308 return theHitsVector->size();
309 }
void _add(vector_type *&theHitsVector, const G4int &key, T &val) const
Vector_t::size_type size()

◆ add() [2/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, enable_if_t<! is_same_t(U, T), G4int > = 0>
std::size_t G4VTHitsVector< T, Vector_t >::add ( const G4int & key,
U & aHit ) const
inline

Definition at line 314 of file G4THitsVector.hh.

315 {
318 return theHitsVector->size();
319 }

◆ add() [3/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, enable_if_t< is_same_t(U, T), G4int > = 0>
std::size_t G4VTHitsVector< T, Vector_t >::add ( const G4int & key,
U *& aHit ) const
inline

Definition at line 282 of file G4THitsVector.hh.

283 {
286 return theHitsVector->size();
287 }

Referenced by operator+=(), and operator+=().

◆ add() [4/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, enable_if_t<! is_same_t(U, T), G4int > = 0>
std::size_t G4VTHitsVector< T, Vector_t >::add ( const G4int & key,
U *& aHit ) const
inline

Definition at line 292 of file G4THitsVector.hh.

293 {
298 return theHitsVector->size();
299 }
typename Vector_t::value_type store_type

◆ allocate() [1/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, typename V = store_type, enable_if_t<(is_fundamental_t(U) &&is_pointer_t(V)), G4int > = 0>
store_type G4VTHitsVector< T, Vector_t >::allocate ( ) const
inline

Definition at line 178 of file G4THitsVector.hh.

179 {
180 return new T(0.);
181 }

Referenced by add(), operator+=(), resize(), set(), and set().

◆ allocate() [2/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, typename V = store_type, enable_if_t<(! is_fundamental_t(U) &&is_pointer_t(V)), G4int > = 0>
store_type G4VTHitsVector< T, Vector_t >::allocate ( ) const
inline

Definition at line 187 of file G4THitsVector.hh.

188 {
189 return new T();
190 }

◆ allocate() [3/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, typename V = store_type, enable_if_t<(is_fundamental_t(U) &&! is_pointer_t(V)), G4int > = 0>
store_type G4VTHitsVector< T, Vector_t >::allocate ( ) const
inline

Definition at line 205 of file G4THitsVector.hh.

206 {
207 return T(0.);
208 }

◆ allocate() [4/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, typename V = store_type, enable_if_t<(! is_fundamental_t(U) &&! is_pointer_t(V)), G4int > = 0>
store_type G4VTHitsVector< T, Vector_t >::allocate ( ) const
inline

Definition at line 213 of file G4THitsVector.hh.

214 {
215 return T();
216 }

◆ at()

template<typename T, typename Vector_t = std::deque<T*>>
T * G4VTHitsVector< T, Vector_t >::at ( G4int key) const
inline

Definition at line 376 of file G4THitsVector.hh.

377 {
380 return &get_reference((*theHitsVector)[key]);
381 }

◆ begin() [1/2]

template<typename T, typename Vector_t = std::deque<T*>>
iterator G4VTHitsVector< T, Vector_t >::begin ( )
inline

Definition at line 150 of file G4THitsVector.hh.

150{ return GetContainer()->begin(); }
Vector_t * GetContainer() const

Referenced by GetIndex(), and GetIndex().

◆ begin() [2/2]

template<typename T, typename Vector_t = std::deque<T*>>
const_iterator G4VTHitsVector< T, Vector_t >::begin ( ) const
inline

Definition at line 152 of file G4THitsVector.hh.

152{ return GetContainer()->begin(); }

◆ cbegin()

template<typename T, typename Vector_t = std::deque<T*>>
const_iterator G4VTHitsVector< T, Vector_t >::cbegin ( ) const
inline

Definition at line 154 of file G4THitsVector.hh.

154{ return GetContainer()->cbegin(); }

◆ cend()

template<typename T, typename Vector_t = std::deque<T*>>
const_iterator G4VTHitsVector< T, Vector_t >::cend ( ) const
inline

Definition at line 155 of file G4THitsVector.hh.

155{ return GetContainer()->cend(); }

◆ clear()

template<typename T, typename Vector_t>
void G4VTHitsVector< T, Vector_t >::clear ( )
inline

Definition at line 632 of file G4THitsVector.hh.

◆ delete_contents() [1/2]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::delete_contents ( vector_type *& ) const
inlineprotected

Definition at line 523 of file G4THitsVector.hh.

524 {}

◆ delete_contents() [2/2]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::delete_contents ( vector_type *& theHitsVector) const
inlineprotected

Definition at line 469 of file G4THitsVector.hh.

470 {
471 for (auto itr = theHitsVector->begin(); itr != theHitsVector->end(); ++itr)
472 delete *itr;
473 }

Referenced by clear(), and ~G4VTHitsVector().

◆ DrawAllHits()

template<typename T, typename Vector_t>
void G4VTHitsVector< T, Vector_t >::DrawAllHits ( )
overridevirtual

Reimplemented from G4VHitsCollection.

Definition at line 603 of file G4THitsVector.hh.

604{
605 ;
606}

◆ end() [1/2]

template<typename T, typename Vector_t = std::deque<T*>>
iterator G4VTHitsVector< T, Vector_t >::end ( )
inline

Definition at line 151 of file G4THitsVector.hh.

151{ return GetContainer()->end(); }

◆ end() [2/2]

template<typename T, typename Vector_t = std::deque<T*>>
const_iterator G4VTHitsVector< T, Vector_t >::end ( ) const
inline

Definition at line 153 of file G4THitsVector.hh.

153{ return GetContainer()->end(); }

◆ entries()

template<typename T, typename Vector_t = std::deque<T*>>
std::size_t G4VTHitsVector< T, Vector_t >::entries ( ) const
inline

Definition at line 162 of file G4THitsVector.hh.

162{ return (scast(Vector_t*)(theCollection))->size(); }
#define scast(_Tp)

Referenced by PrintAllHits().

◆ get()

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
T & G4VTHitsVector< T, Vector_t >::get ( U & val) const
inlineprotected

Definition at line 463 of file G4THitsVector.hh.

464 {
465 return *val;
466 }

◆ get_reference() [1/2]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t< is_pointer_t(U), G4int > = 0>
T & G4VTHitsVector< T, Vector_t >::get_reference ( U & val) const
inlineprotected

Definition at line 476 of file G4THitsVector.hh.

477 {
478 return *val;
479 }

Referenced by add(), at(), operator[](), set(), and set().

◆ get_reference() [2/2]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<! is_pointer_t(U), G4int > = 0>
T & G4VTHitsVector< T, Vector_t >::get_reference ( U & val) const
inlineprotected

Definition at line 527 of file G4THitsVector.hh.

528 {
529 return val;
530 }

◆ GetContainer()

template<typename T, typename Vector_t = std::deque<T*>>
Vector_t * G4VTHitsVector< T, Vector_t >::GetContainer ( ) const
inline

Definition at line 103 of file G4THitsVector.hh.

103{ return scast(Vector_t*)(theCollection); }

Referenced by begin(), begin(), cbegin(), cend(), end(), end(), GetObject(), and size().

◆ GetHit()

template<typename T, typename Vector_t = std::deque<T*>>
G4VHit * G4VTHitsVector< T, Vector_t >::GetHit ( std::size_t ) const
inlineoverridevirtual

Reimplemented from G4VHitsCollection.

Definition at line 167 of file G4THitsVector.hh.

167{ return nullptr; }

◆ GetIndex() [1/2]

template<typename T, typename Vector_t = std::deque<T*>>
Vector_t::size_type G4VTHitsVector< T, Vector_t >::GetIndex ( const_iterator itr) const
inline

Definition at line 109 of file G4THitsVector.hh.

110 {
111 return std::distance(begin(), itr);
112 }

◆ GetIndex() [2/2]

template<typename T, typename Vector_t = std::deque<T*>>
Vector_t::size_type G4VTHitsVector< T, Vector_t >::GetIndex ( iterator itr)
inline

Definition at line 107 of file G4THitsVector.hh.

107{ return std::distance(begin(), itr); }

◆ GetMap()

template<typename T, typename Vector_t>
G4VTHitsVector< T, Vector_t >::map_t * G4VTHitsVector< T, Vector_t >::GetMap ( ) const
inline

Definition at line 589 of file G4THitsVector.hh.

590{
592 theHitsMap->clear();
594 for (std::size_t i = 0; i < theHitsVector->size(); ++i) {
595 store_type& _obj = (*theHitsVector)[i];
596 if (_obj) (*theHitsMap)[i] = _obj;
597 }
598 return theHitsMap;
599}
std::map< G4int, store_type > map_t

◆ GetObject() [1/6]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<(is_pointer_t(U)), G4int > = 0>
const T * G4VTHitsVector< T, Vector_t >::GetObject ( const_iterator itr) const
inline

Definition at line 127 of file G4THitsVector.hh.

128 {
129 return (*itr);
130 }

◆ GetObject() [2/6]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<(! is_pointer_t(U)), G4int > = 0>
const T * G4VTHitsVector< T, Vector_t >::GetObject ( const_iterator itr) const
inline

Definition at line 145 of file G4THitsVector.hh.

146 {
147 return &(*itr);
148 }

◆ GetObject() [3/6]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<(is_pointer_t(U)), G4int > = 0>
T * G4VTHitsVector< T, Vector_t >::GetObject ( G4int idx) const
inline

Definition at line 115 of file G4THitsVector.hh.

116 {
117 return (idx < (G4int)GetContainer()->size()) ? (*GetContainer())[idx] : nullptr;
118 }

◆ GetObject() [4/6]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<(! is_pointer_t(U)), G4int > = 0>
T * G4VTHitsVector< T, Vector_t >::GetObject ( G4int idx) const
inline

Definition at line 133 of file G4THitsVector.hh.

134 {
135 return (idx < (G4int)GetContainer()->size()) ? &(*GetContainer())[idx] : nullptr;
136 }

◆ GetObject() [5/6]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<(is_pointer_t(U)), G4int > = 0>
T * G4VTHitsVector< T, Vector_t >::GetObject ( iterator itr) const
inline

Definition at line 121 of file G4THitsVector.hh.

122 {
123 return (*itr);
124 }

◆ GetObject() [6/6]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<(! is_pointer_t(U)), G4int > = 0>
T * G4VTHitsVector< T, Vector_t >::GetObject ( iterator itr) const
inline

Definition at line 139 of file G4THitsVector.hh.

140 {
141 return &(*itr);
142 }

◆ GetSize()

template<typename T, typename Vector_t = std::deque<T*>>
std::size_t G4VTHitsVector< T, Vector_t >::GetSize ( ) const
inlineoverridevirtual

Reimplemented from G4VHitsCollection.

Definition at line 168 of file G4THitsVector.hh.

168{ return (scast(Vector_t*)(theCollection))->size(); }

◆ GetVector() [1/2]

template<typename T, typename Vector_t = std::deque<T*>>
Vector_t * G4VTHitsVector< T, Vector_t >::GetVector ( ) const
inline

◆ GetVector() [2/2]

template<typename T, typename Vector_t = std::deque<T*>>
vector_type * G4VTHitsVector< T, Vector_t >::GetVector ( const G4int & key) const
inlineprotected

Definition at line 413 of file G4THitsVector.hh.

414 {
417 return theHitsVector;
418 }

◆ null() [1/2]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<(is_pointer_t(U)), G4int > = 0>
store_type G4VTHitsVector< T, Vector_t >::null ( ) const
inline

Definition at line 194 of file G4THitsVector.hh.

195 {
196 return nullptr;
197 }

Referenced by operator+=(), and resize().

◆ null() [2/2]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<(! is_pointer_t(U)), G4int > = 0>
store_type G4VTHitsVector< T, Vector_t >::null ( ) const
inline

Definition at line 220 of file G4THitsVector.hh.

221 {
222 return store_type();
223 }

◆ operator+=() [1/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U, typename MapU_t, enable_if_t<(is_pointer_t(typename MapU_t::mapped_type)), G4int > = 0>
this_type & G4VTHitsVector< T, Vector_t >::operator+= ( const G4VTHitsMap< U, MapU_t > & right) const
inline

Definition at line 255 of file G4THitsVector.hh.

256 {
258 for (auto itr = aHitsMap->begin(); itr != aHitsMap->end(); ++itr)
259 add<U>(itr->first, *(itr->second));
260 return static_cast<this_type&>(*(const_cast<this_type*>(this)));
261 }
G4VTHitsVector< T, Vector_t > this_type
map_t * GetMap() const
std::size_t add(const G4int &key, U *&aHit) const

◆ operator+=() [2/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U, typename MapU_t, enable_if_t<!(is_pointer_t(typename MapU_t::mapped_type)), G4int > = 0>
this_type & G4VTHitsVector< T, Vector_t >::operator+= ( const G4VTHitsMap< U, MapU_t > & right) const
inline

Definition at line 265 of file G4THitsVector.hh.

266 {
268 for (auto itr = aHitsMap->begin(); itr != aHitsMap->end(); ++itr)
269 add<U>(itr->first, itr->second);
270 return static_cast<this_type&>(*(const_cast<this_type*>(this)));
271 }

◆ operator+=() [3/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U, typename VectorU_t, enable_if_t<(is_pointer_t(typename VectorU_t::value_type)), G4int > = 0>
this_type & G4VTHitsVector< T, Vector_t >::operator+= ( const G4VTHitsVector< U, VectorU_t > & right) const
inline

Definition at line 231 of file G4THitsVector.hh.

232 {
234 for (auto itr = aHitsVector->begin(); itr != aHitsVector->end(); ++itr) {
235 auto _ptr = (*itr) ? (*itr) : null();
237 }
238 return static_cast<this_type&>(*(const_cast<this_type*>(this)));
239 }

◆ operator+=() [4/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U, typename VectorU_t, enable_if_t<(! is_pointer_t(typename VectorU_t::value_type)), G4int > = 0>
this_type & G4VTHitsVector< T, Vector_t >::operator+= ( const G4VTHitsVector< U, VectorU_t > & right) const
inline

Definition at line 243 of file G4THitsVector.hh.

244 {
246 for (auto itr = aHitsVector->begin(); itr != aHitsVector->end(); ++itr) {
247 auto _ptr = (*itr) ? (*itr) : allocate();
249 }
250 return static_cast<this_type&>(*(const_cast<this_type*>(this)));
251 }

◆ operator==()

template<typename T, typename Vector_t>
G4bool G4VTHitsVector< T, Vector_t >::operator== ( const this_type & rhs) const

Definition at line 581 of file G4THitsVector.hh.

582{
584}

◆ operator[]()

template<typename T, typename Vector_t = std::deque<T*>>
T * G4VTHitsVector< T, Vector_t >::operator[] ( G4int key) const
inline

Definition at line 383 of file G4THitsVector.hh.

384 {
387 return &get_reference((*theHitsVector)[key]);
388 }

◆ PrintAllHits()

template<typename T, typename Vector_t>
void G4VTHitsVector< T, Vector_t >::PrintAllHits ( )
overridevirtual

Reimplemented from G4VHitsCollection.

Definition at line 611 of file G4THitsVector.hh.

612{
613 G4cout << "G4THitsVector " << SDname << " / " << collectionName << " --- " << entries()
614 << " entries" << G4endl;
615 /*----- commented out for the use-case where <T> cannot be initialized
616 to be zero or does not support += operator.
617 Vector_t * theHitsVector = GetVector();
618 typename Vector_t::iterator itr = theHitsVector->begin();
619 T sum = 0.;
620 for(; itr != theHitsVector->end(); ++itr) {
621 G4cout << " " << itr->first << " : "
622 << *(itr->second) << G4endl;
623 sum += *(itr->second);
624 }
625 G4cout << " Total : " << sum << G4endl;
626 ----------------------------------------------------------------------*/
627}

◆ resize() [1/2]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<(is_pointer_t(U)), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::resize ( vector_type *& theHitsVector,
const G4int & key ) const
inlineprotected

Definition at line 394 of file G4THitsVector.hh.

395 {
396 // ensure the proper size
397 if (key >= (G4int)theHitsVector->size()) theHitsVector->resize(key + 1, null());
398
399 // if null pointer for vector entry: allocate
400 if (! theHitsVector->at(key)) {
403 }
404 }
void _assign(vector_type *&theHitsVector, const G4int &key, T &val) const
T * at(G4int key) const

Referenced by at(), G4VTHitsVector(), G4VTHitsVector(), GetVector(), and operator[]().

◆ resize() [2/2]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = store_type, enable_if_t<(! is_pointer_t(U)), G4int > = 0>
void G4VTHitsVector< T, Vector_t >::resize ( vector_type *& theHitsVector,
const G4int & key ) const
inlineprotected

Definition at line 407 of file G4THitsVector.hh.

408 {
409 // ensure the proper size
410 if (key >= (G4int)theHitsVector->size()) theHitsVector->resize(key + 1, null());
411 }

◆ set() [1/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, enable_if_t< is_same_t(U, T), G4int > = 0>
std::size_t G4VTHitsVector< T, Vector_t >::set ( const G4int & key,
U & aHit ) const
inline

Definition at line 356 of file G4THitsVector.hh.

357 {
360 return theHitsVector->size();
361 }

◆ set() [2/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, enable_if_t<! is_same_t(U, T), G4int > = 0>
std::size_t G4VTHitsVector< T, Vector_t >::set ( const G4int & key,
U & aHit ) const
inline

Definition at line 366 of file G4THitsVector.hh.

◆ set() [3/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, enable_if_t< is_same_t(U, T), G4int > = 0>
std::size_t G4VTHitsVector< T, Vector_t >::set ( const G4int & key,
U *& aHit ) const
inline

Definition at line 329 of file G4THitsVector.hh.

330 {
333 return theHitsVector->size();
334 }

◆ set() [4/4]

template<typename T, typename Vector_t = std::deque<T*>>
template<typename U = T, enable_if_t<! is_same_t(U, T), G4int > = 0>
std::size_t G4VTHitsVector< T, Vector_t >::set ( const G4int & key,
U *& aHit ) const
inline

Definition at line 339 of file G4THitsVector.hh.

340 {
345 return theHitsVector->size();
346 }

◆ size()

template<typename T, typename Vector_t = std::deque<T*>>
Vector_t::size_type G4VTHitsVector< T, Vector_t >::size ( )
inline

Definition at line 105 of file G4THitsVector.hh.

105{ return GetContainer()->size(); }

Referenced by GetObject().


The documentation for this class was generated from the following file: