Geant4 10.7.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

typedef G4VTHitsVector< T, Vector_t > this_type
 
typedef T value_type
 
typedef Vector_t vector_type
 
typedef vector_type::iterator iterator
 
typedef vector_type::const_iterator const_iterator
 
typedef Vector_t::value_type store_type
 
typedef std::pair< G4int, store_typepair_t
 
typedef std::map< G4int, store_typemap_t
 
typedef std::unordered_map< G4int, store_typeuomap_t
 
typedef std::multimap< G4int, store_typemmap_t
 
typedef std::unordered_multimap< G4int, store_typeuommap_t
 

Public Member Functions

 G4VTHitsVector (G4int init_size=0)
 
 G4VTHitsVector (G4String detName, G4String colNam, G4int init_size=0)
 
virtual ~G4VTHitsVector ()
 
G4bool operator== (const this_type &rhs) const
 
virtual void DrawAllHits ()
 
virtual void PrintAllHits ()
 
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 ()
 
virtual G4VHitGetHit (std::size_t) const
 
virtual std::size_t GetSize () const
 
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 ()
 
 G4HitsCollection (G4String detName, G4String colNam)
 
virtual ~G4HitsCollection ()
 
G4bool operator== (const G4HitsCollection &right) const
 
- Public Member Functions inherited from G4VHitsCollection
 G4VHitsCollection ()
 
 G4VHitsCollection (G4String detName, G4String colNam)
 
virtual ~G4VHitsCollection ()
 
G4bool operator== (const G4VHitsCollection &right) const
 
virtual void DrawAllHits ()
 
virtual void PrintAllHits ()
 
const G4StringGetName () const
 
const G4StringGetSDname () const
 
void SetColID (G4int i)
 
G4int GetColID () const
 
virtual G4VHitGetHit (size_t) const
 
virtual size_t GetSize () 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
 
- Protected Attributes inherited from G4VHitsCollection
G4String collectionName
 
G4String SDname
 
G4int colID
 

Detailed Description

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

Definition at line 52 of file G4THitsVector.hh.

Member Typedef Documentation

◆ const_iterator

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

Definition at line 59 of file G4THitsVector.hh.

◆ iterator

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

Definition at line 58 of file G4THitsVector.hh.

◆ map_t

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

Definition at line 63 of file G4THitsVector.hh.

◆ mmap_t

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

Definition at line 65 of file G4THitsVector.hh.

◆ pair_t

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

Definition at line 62 of file G4THitsVector.hh.

◆ store_type

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

Definition at line 61 of file G4THitsVector.hh.

◆ this_type

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

Definition at line 55 of file G4THitsVector.hh.

◆ uomap_t

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

Definition at line 64 of file G4THitsVector.hh.

◆ uommap_t

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

Definition at line 66 of file G4THitsVector.hh.

◆ value_type

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

Definition at line 56 of file G4THitsVector.hh.

◆ vector_type

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

Definition at line 57 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 578 of file G4THitsVector.hh.

579{
580 theCollection = static_cast<void*>(new Vector_t);
581 if(init_size > 0)
582 {
583 vector_type* theHitsVector = GetVector();
584 resize(theHitsVector, init_size-1);
585 }
586}
Vector_t * GetVector() const
void resize(vector_type *&theHitsVector, const G4int &key) const
Vector_t vector_type

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

593: G4HitsCollection(detName, colNam)
594{
595 theCollection = static_cast<void*>(new Vector_t);
596 if(init_size > 0)
597 {
598 vector_type* theHitsVector = GetVector();
599 resize(theHitsVector, init_size-1);
600 }
601}

◆ ~G4VTHitsVector()

template<typename T , typename Vector_t >
G4VTHitsVector< T, Vector_t >::~G4VTHitsVector
virtual

Definition at line 606 of file G4THitsVector.hh.

607{
608 vector_type* theHitsVector = GetVector();
609 delete_contents(theHitsVector);
610 delete theHitsVector;
611}
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 455 of file G4THitsVector.hh.

456 {
457 *(*theHitsVector)[key] += val;
458 }

Referenced by 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 524 of file G4THitsVector.hh.

525 {
526 (*theHitsVector)[key] += val;
527 }

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

463 {
464 *(*theHitsVector)[key] += *val;
465 }

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

532 {
533 (*theHitsVector)[key] += *val;
534 }

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

470 {
471 *(*theHitsVector)[key] += val;
472 }

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

540 {
541 (*theHitsVector)[key] += val;
542 }

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

477 {
478 *(*theHitsVector)[key] += *val;
479 }

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

548 {
549 (*theHitsVector)[key] += *val;
550 }

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

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

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

510 {
511 (*theHitsVector)[key] = val;
512 }

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

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

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

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

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

303 {
304 vector_type* theHitsVector = GetVector(key);
305 _add(theHitsVector, key, aHit);
306 return theHitsVector->size();
307 }
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 278 of file G4THitsVector.hh.

279 {
280 vector_type* theHitsVector = GetVector(key);
281 _add(theHitsVector, key, *aHit);
282 return theHitsVector->size();
283 }

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

290 {
291 vector_type* theHitsVector = GetVector(key);
292 store_type hit = allocate();
293 get_reference(hit) += *aHit;
294 _add(theHitsVector, key, *hit);
295 return theHitsVector->size();
296 }
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 181 of file G4THitsVector.hh.

182 { return new T(); }

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

199 { return T(0.); }

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

207 { return T(); }

◆ at()

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

Definition at line 383 of file G4THitsVector.hh.

384 {
385 vector_type* theHitsVector = GetVector();
386 resize(theHitsVector, key);
387 return &get_reference((*theHitsVector)[key]);
388 }

◆ begin() [1/2]

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

Definition at line 138 of file G4THitsVector.hh.

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

Referenced by 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 140 of file G4THitsVector.hh.

140{ 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 142 of file G4THitsVector.hh.

142{ 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 143 of file G4THitsVector.hh.

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

◆ clear()

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

Definition at line 668 of file G4THitsVector.hh.

669{
670 vector_type* theHitsVector = GetVector();
671 delete_contents(theHitsVector);
672 theHitsVector->clear();
673}

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

555 { }

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

491 {
492 for(iterator itr = theHitsVector->begin(); itr != theHitsVector->end(); ++itr)
493 delete *itr;
494 }
vector_type::iterator iterator

◆ DrawAllHits()

template<typename T , typename Vector_t >
void G4VTHitsVector< T, Vector_t >::DrawAllHits
virtual

Reimplemented from G4VHitsCollection.

Definition at line 641 of file G4THitsVector.hh.

642{;}

◆ end() [1/2]

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

Definition at line 139 of file G4THitsVector.hh.

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

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

152 { 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 483 of file G4THitsVector.hh.

484 {
485 return *val;
486 }

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

560 {
561 return val;
562 }

◆ GetContainer()

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

◆ GetHit()

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

Definition at line 157 of file G4THitsVector.hh.

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

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

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

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

◆ GetMap()

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

Definition at line 625 of file G4THitsVector.hh.

626{
627 G4ThreadLocalStatic map_t* theHitsMap = new map_t();
628 theHitsMap->clear();
629 vector_type* theHitsVector = GetVector();
630 for(std::size_t i = 0; i < theHitsVector->size(); ++i)
631 {
632 store_type& _obj = (*theHitsVector)[i];
633 if(_obj)
634 (*theHitsMap)[i] = _obj;
635 }
636 return theHitsMap;
637}
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 { return (*itr); }

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

136 { return &(*itr); }

◆ 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 { return (idx < (G4int)GetContainer()->size()) ? (*GetContainer())[idx] : nullptr; }
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 127 of file G4THitsVector.hh.

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

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

120 { return (*itr); }

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

132 { return &(*itr); }

◆ GetSize()

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

Reimplemented from G4VHitsCollection.

Definition at line 158 of file G4THitsVector.hh.

159 { 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 426 of file G4THitsVector.hh.

427 {
428 vector_type* theHitsVector = GetVector();
429 resize(theHitsVector, key);
430 return theHitsVector;
431 }

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

188 { return nullptr; }

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

213 { return store_type(); }

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

250 {
251 MapU_t* aHitsMap = right.GetMap();
252 for(auto itr = aHitsMap->begin(); itr != aHitsMap->end(); ++itr)
253 add<U>(itr->first, *(itr->second));
254 return static_cast<this_type&>(*(const_cast<this_type*>(this)));
255 }
Map_t * GetMap() const
Definition: G4THitsMap.hh:151
G4VTHitsVector< T, Vector_t > this_type

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

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

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

223 {
224 VectorU_t* aHitsVector = right.GetVector();
225 for(auto itr = aHitsVector->begin(); itr != aHitsVector->end(); ++itr)
226 {
227 auto _ptr = (*itr) ? (*itr) : null();
228 if(_ptr)
229 add<U>(std::distance(aHitsVector->begin(), itr), *_ptr);
230 }
231 return static_cast<this_type&>(*(const_cast<this_type*>(this)));
232 }
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 236 of file G4THitsVector.hh.

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

◆ operator==()

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

Definition at line 616 of file G4THitsVector.hh.

617{
618 return (collectionName==right.collectionName);
619}

◆ operator[]()

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

Definition at line 390 of file G4THitsVector.hh.

391 {
392 vector_type* theHitsVector = GetVector();
393 resize(theHitsVector, key);
394 return &get_reference((*theHitsVector)[key]);
395 }

◆ PrintAllHits()

template<typename T , typename Vector_t >
void G4VTHitsVector< T, Vector_t >::PrintAllHits
virtual

Reimplemented from G4VHitsCollection.

Definition at line 647 of file G4THitsVector.hh.

648{
649 G4cout << "G4THitsVector " << SDname << " / " << collectionName << " --- "
650 << entries() << " entries" << G4endl;
651 /*----- commented out for the use-case where <T> cannot be initialized
652 to be zero or does not support += operator.
653 Vector_t * theHitsVector = GetVector();
654 typename Vector_t::iterator itr = theHitsVector->begin();
655 T sum = 0.;
656 for(; itr != theHitsVector->end(); ++itr) {
657 G4cout << " " << itr->first << " : "
658 << *(itr->second) << G4endl;
659 sum += *(itr->second);
660 }
661 G4cout << " Total : " << sum << G4endl;
662 ----------------------------------------------------------------------*/
663}
#define G4endl
Definition: G4ios.hh:57
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 401 of file G4THitsVector.hh.

403 {
404 // ensure the proper size
405 if(key >= (G4int)theHitsVector->size())
406 theHitsVector->resize(key+1, null());
407
408 // if null pointer for vector entry: allocate
409 if(!theHitsVector->at(key))
410 {
411 store_type init = allocate();
412 _assign(theHitsVector, key, init);
413 }
414 }
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 418 of file G4THitsVector.hh.

420 {
421 // ensure the proper size
422 if(key >= (G4int)theHitsVector->size())
423 theHitsVector->resize(key+1, null());
424 }

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

361 {
362 vector_type* theHitsVector = GetVector(key);
363 _assign(theHitsVector, key, &aHit);
364 return theHitsVector->size();
365 }

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

372 {
373 vector_type* theHitsVector = GetVector(key);
374 store_type hit = allocate();
375 get_reference(hit) += aHit;
376 _assign(theHitsVector, key, &aHit);
377 return theHitsVector->size();
378 }

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

331 {
332 vector_type* theHitsVector = GetVector(key);
333 _assign(theHitsVector, key, aHit);
334 return theHitsVector->size();
335 }

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

342 {
343 vector_type* theHitsVector = GetVector(key);
344 store_type hit = allocate();
345 get_reference(hit) += *aHit;
346 _assign(theHitsVector, key, hit);
347 return theHitsVector->size();
348 }

◆ 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.

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

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


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