Geant4 11.2.2
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 (G4String detName, 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 (G4String detName, G4String colNam)
 
- Public Member Functions inherited from G4VHitsCollection
 G4VHitsCollection ()=default
 
 G4VHitsCollection (G4String detName, G4String colNam)
 
virtual ~G4VHitsCollection ()=default
 
G4bool operator== (const G4VHitsCollection &right) const
 
const G4StringGetName () const
 
const G4StringGetSDname () const
 
void SetColID (G4int i)
 
G4int GetColID () const
 
virtual G4VHitGetHit (size_t) 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 51 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 58 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 57 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 62 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 64 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 61 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 60 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 54 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 63 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 65 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 55 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 56 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 548 of file G4THitsVector.hh.

549{
550 theCollection = static_cast<void*>(new Vector_t);
551 if (init_size > 0) {
552 vector_type* theHitsVector = GetVector();
553 resize(theHitsVector, init_size - 1);
554 }
555}
Vector_t * GetVector() const
Vector_t vector_type
void resize(vector_type *&theHitsVector, const G4int &key) const

◆ G4VTHitsVector() [2/2]

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

Definition at line 560 of file G4THitsVector.hh.

561 : G4HitsCollection(detName, colNam)
562{
563 theCollection = static_cast<void*>(new Vector_t);
564 if (init_size > 0) {
565 vector_type* theHitsVector = GetVector();
566 resize(theHitsVector, init_size - 1);
567 }
568}

◆ ~G4VTHitsVector()

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

Definition at line 573 of file G4THitsVector.hh.

574{
575 vector_type* theHitsVector = GetVector();
576 delete_contents(theHitsVector);
577 delete theHitsVector;
578}
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 441 of file G4THitsVector.hh.

442 {
443 *(*theHitsVector)[key] += val;
444 }

Referenced by G4VTHitsVector< T, Vector_t >::add(), and G4VTHitsVector< T, Vector_t >::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 501 of file G4THitsVector.hh.

502 {
503 (*theHitsVector)[key] += val;
504 }

◆ _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 447 of file G4THitsVector.hh.

448 {
449 *(*theHitsVector)[key] += *val;
450 }

◆ _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 507 of file G4THitsVector.hh.

508 {
509 (*theHitsVector)[key] += *val;
510 }

◆ _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 453 of file G4THitsVector.hh.

454 {
455 *(*theHitsVector)[key] += val;
456 }

◆ _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 513 of file G4THitsVector.hh.

514 {
515 (*theHitsVector)[key] += val;
516 }

◆ _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 459 of file G4THitsVector.hh.

460 {
461 *(*theHitsVector)[key] += *val;
462 }

◆ _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 519 of file G4THitsVector.hh.

520 {
521 (*theHitsVector)[key] += *val;
522 }

◆ _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 427 of file G4THitsVector.hh.

428 {
429 delete (*theHitsVector)[key];
430 *(*theHitsVector)[key] = val;
431 }

Referenced by G4VTHitsVector< T, Vector_t >::resize(), G4VTHitsVector< T, Vector_t >::set(), and G4VTHitsVector< T, Vector_t >::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 488 of file G4THitsVector.hh.

489 {
490 (*theHitsVector)[key] = val;
491 }

◆ _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 434 of file G4THitsVector.hh.

435 {
436 delete (*theHitsVector)[key];
437 (*theHitsVector)[key] = val;
438 }

◆ _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 494 of file G4THitsVector.hh.

495 {
496 delete (*theHitsVector)[key];
497 (*theHitsVector)[key] = *val;
498 }

◆ 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 303 of file G4THitsVector.hh.

304 {
305 vector_type* theHitsVector = GetVector(key);
306 _add(theHitsVector, key, aHit);
307 return theHitsVector->size();
308 }
void _add(vector_type *&theHitsVector, const G4int &key, T &val) const

◆ 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 313 of file G4THitsVector.hh.

314 {
315 vector_type* theHitsVector = GetVector(key);
316 _add(theHitsVector, key, aHit);
317 return theHitsVector->size();
318 }

◆ 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 281 of file G4THitsVector.hh.

282 {
283 vector_type* theHitsVector = GetVector(key);
284 _add(theHitsVector, key, *aHit);
285 return theHitsVector->size();
286 }

Referenced by G4VTHitsVector< T, Vector_t >::operator+=(), and G4VTHitsVector< T, Vector_t >::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 291 of file G4THitsVector.hh.

292 {
293 vector_type* theHitsVector = GetVector(key);
294 store_type hit = allocate();
295 get_reference(hit) += *aHit;
296 _add(theHitsVector, key, *hit);
297 return theHitsVector->size();
298 }
typename Vector_t::value_type store_type
store_type allocate() const
T & get_reference(U &val) const

◆ 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

◆ 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 184 of file G4THitsVector.hh.

185 {
186 return new T();
187 }

◆ 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 202 of file G4THitsVector.hh.

203 {
204 return T(0.);
205 }

◆ 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 210 of file G4THitsVector.hh.

211 {
212 return T();
213 }

◆ at()

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

Definition at line 379 of file G4THitsVector.hh.

380 {
381 vector_type* theHitsVector = GetVector();
382 resize(theHitsVector, key);
383 return &get_reference((*theHitsVector)[key]);
384 }

◆ begin() [1/2]

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

Definition at line 146 of file G4THitsVector.hh.

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

Referenced by G4VTHitsVector< T, Vector_t >::GetIndex(), and G4VTHitsVector< T, Vector_t >::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 148 of file G4THitsVector.hh.

148{ 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 150 of file G4THitsVector.hh.

150{ 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 151 of file G4THitsVector.hh.

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

◆ clear()

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

Definition at line 634 of file G4THitsVector.hh.

635{
636 vector_type* theHitsVector = GetVector();
637 delete_contents(theHitsVector);
638 theHitsVector->clear();
639}

◆ 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 525 of file G4THitsVector.hh.

526 {}

◆ 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 471 of file G4THitsVector.hh.

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

◆ DrawAllHits()

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

Reimplemented from G4VHitsCollection.

Definition at line 605 of file G4THitsVector.hh.

606{
607 ;
608}

◆ end() [1/2]

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

Definition at line 147 of file G4THitsVector.hh.

147{ 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 149 of file G4THitsVector.hh.

149{ 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 158 of file G4THitsVector.hh.

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

◆ 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 465 of file G4THitsVector.hh.

466 {
467 return *val;
468 }

◆ 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

◆ 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 529 of file G4THitsVector.hh.

530 {
531 return val;
532 }

◆ GetContainer()

◆ GetHit()

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

Definition at line 163 of file G4THitsVector.hh.

163{ 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 105 of file G4THitsVector.hh.

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

◆ 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 103 of file G4THitsVector.hh.

103{ 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 591 of file G4THitsVector.hh.

592{
593 G4ThreadLocalStatic auto theHitsMap = new map_t();
594 theHitsMap->clear();
595 vector_type* theHitsVector = GetVector();
596 for (std::size_t i = 0; i < theHitsVector->size(); ++i) {
597 store_type& _obj = (*theHitsVector)[i];
598 if (_obj) (*theHitsMap)[i] = _obj;
599 }
600 return theHitsMap;
601}
std::map< G4int, store_type > map_t
#define G4ThreadLocalStatic
Definition tls.hh:76

◆ 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 123 of file G4THitsVector.hh.

124 {
125 return (*itr);
126 }

◆ 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 141 of file G4THitsVector.hh.

142 {
143 return &(*itr);
144 }

◆ 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 111 of file G4THitsVector.hh.

112 {
113 return (idx < (G4int)GetContainer()->size()) ? (*GetContainer())[idx] : nullptr;
114 }
int G4int
Definition G4Types.hh:85
Vector_t::size_type size()

◆ 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 129 of file G4THitsVector.hh.

130 {
131 return (idx < (G4int)GetContainer()->size()) ? &(*GetContainer())[idx] : nullptr;
132 }

◆ 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 117 of file G4THitsVector.hh.

118 {
119 return (*itr);
120 }

◆ 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 135 of file G4THitsVector.hh.

136 {
137 return &(*itr);
138 }

◆ 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 164 of file G4THitsVector.hh.

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

◆ GetVector() [1/2]

◆ 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 415 of file G4THitsVector.hh.

416 {
417 vector_type* theHitsVector = GetVector();
418 resize(theHitsVector, key);
419 return theHitsVector;
420 }

◆ 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 191 of file G4THitsVector.hh.

192 {
193 return nullptr;
194 }

Referenced by G4VTHitsVector< T, Vector_t >::operator+=(), and G4VTHitsVector< T, Vector_t >::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 217 of file G4THitsVector.hh.

218 {
219 return store_type();
220 }

◆ 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 253 of file G4THitsVector.hh.

254 {
255 MapU_t* aHitsMap = right.GetMap();
256 for (auto itr = aHitsMap->begin(); itr != aHitsMap->end(); ++itr)
257 add<U>(itr->first, *(itr->second));
258 return static_cast<this_type&>(*(const_cast<this_type*>(this)));
259 }
Map_t * GetMap() const
G4VTHitsVector< T, Vector_t > this_type
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 263 of file G4THitsVector.hh.

264 {
265 MapU_t* aHitsMap = right.GetMap();
266 for (auto itr = aHitsMap->begin(); itr != aHitsMap->end(); ++itr)
267 add<U>(itr->first, itr->second);
268 return static_cast<this_type&>(*(const_cast<this_type*>(this)));
269 }

◆ 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 229 of file G4THitsVector.hh.

230 {
231 VectorU_t* aHitsVector = right.GetVector();
232 for (auto itr = aHitsVector->begin(); itr != aHitsVector->end(); ++itr) {
233 auto _ptr = (*itr) ? (*itr) : null();
234 if (_ptr) add<U>(std::distance(aHitsVector->begin(), itr), *_ptr);
235 }
236 return static_cast<this_type&>(*(const_cast<this_type*>(this)));
237 }
store_type null() const

◆ 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 241 of file G4THitsVector.hh.

242 {
243 VectorU_t* aHitsVector = right.GetVector();
244 for (auto itr = aHitsVector->begin(); itr != aHitsVector->end(); ++itr) {
245 auto _ptr = (*itr) ? (*itr) : allocate();
246 add<U>(std::distance(aHitsVector->begin(), itr), _ptr);
247 }
248 return static_cast<this_type&>(*(const_cast<this_type*>(this)));
249 }

◆ operator==()

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

Definition at line 583 of file G4THitsVector.hh.

584{
585 return (collectionName == right.collectionName);
586}

◆ operator[]()

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

Definition at line 386 of file G4THitsVector.hh.

387 {
388 vector_type* theHitsVector = GetVector();
389 resize(theHitsVector, key);
390 return &get_reference((*theHitsVector)[key]);
391 }

◆ PrintAllHits()

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

Reimplemented from G4VHitsCollection.

Definition at line 613 of file G4THitsVector.hh.

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

◆ 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 396 of file G4THitsVector.hh.

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

Referenced by G4VTHitsVector< T, Vector_t >::at(), G4VTHitsVector< T, Vector_t >::G4VTHitsVector(), G4VTHitsVector< T, Vector_t >::GetVector(), and G4VTHitsVector< T, Vector_t >::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 409 of file G4THitsVector.hh.

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

◆ 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 357 of file G4THitsVector.hh.

358 {
359 vector_type* theHitsVector = GetVector(key);
360 _assign(theHitsVector, key, &aHit);
361 return theHitsVector->size();
362 }

◆ 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 367 of file G4THitsVector.hh.

368 {
369 vector_type* theHitsVector = GetVector(key);
370 store_type hit = allocate();
371 get_reference(hit) += aHit;
372 _assign(theHitsVector, key, &aHit);
373 return theHitsVector->size();
374 }

◆ 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 {
331 vector_type* theHitsVector = GetVector(key);
332 _assign(theHitsVector, key, aHit);
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 {
341 vector_type* theHitsVector = GetVector(key);
342 store_type hit = allocate();
343 get_reference(hit) += *aHit;
344 _assign(theHitsVector, key, hit);
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 101 of file G4THitsVector.hh.

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

Referenced by G4VTHitsVector< T, Vector_t >::GetObject().


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