Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4VTHitsMap< T, Map_t > Class Template Reference

#include <G4THitsMap.hh>

+ Inheritance diagram for G4VTHitsMap< T, Map_t >:

Public Types

typedef G4VTHitsMap< T, Map_t > this_type
 
typedef T value_type
 
typedef Map_t map_type
 
typedef map_type::iterator iterator
 
typedef map_type::const_iterator const_iterator
 

Public Member Functions

 G4VTHitsMap ()
 
 G4VTHitsMap (G4String detName, G4String colNam)
 
virtual ~G4VTHitsMap ()
 
G4bool operator== (const G4VTHitsMap< T, Map_t > &right) const
 
template<typename U , typename MapU_t >
this_typeoperator+= (const G4VTHitsMap< U, MapU_t > &right) const
 
virtual void DrawAllHits ()
 
virtual void PrintAllHits ()
 
Map_t * GetContainer () const
 
Map_t::size_type size ()
 
Map_t::size_type GetIndex (iterator itr)
 
Map_t::size_type GetIndex (const_iterator itr) const
 
template<typename MapU_t = Map_t, enable_if_t< !is_mmap_t(MapU_t), G4int > = 0>
T * GetObject (G4int idx) const
 
template<typename MapU_t = Map_t, enable_if_t< is_mmap_t(MapU_t), G4int > = 0>
T * GetObject (G4int idx) const
 
T * GetObject (iterator itr) const
 
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
 
Map_t * GetMap () const
 
size_t entries () const
 
void clear ()
 
virtual G4VHitGetHit (size_t) const
 
virtual size_t GetSize () const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t< is_same_t(U, T) &&! is_mmap_t(MapU_t), G4int > = 0>
size_t add (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t add (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t add (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t add (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t add (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t add (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t add (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t set (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t set (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t set (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t set (const G4int &key, U *&aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t set (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t set (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t set (const G4int &key, U &aHit) const
 
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t set (const G4int &key, U &aHit) const
 
template<typename MapU_t = Map_t, enable_if_t<! is_mmap_t(MapU_t), G4int > = 0>
T * operator[] (G4int key) const
 
template<typename MapU_t = Map_t, enable_if_t< is_mmap_t(MapU_t), G4int > = 0>
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
 

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 Map_t = std::map<G4int, T*>>
class G4VTHitsMap< T, Map_t >

Definition at line 48 of file G4THitsMap.hh.

Member Typedef Documentation

◆ const_iterator

template<typename T , typename Map_t = std::map<G4int, T*>>
typedef map_type::const_iterator G4VTHitsMap< T, Map_t >::const_iterator

Definition at line 80 of file G4THitsMap.hh.

◆ iterator

template<typename T , typename Map_t = std::map<G4int, T*>>
typedef map_type::iterator G4VTHitsMap< T, Map_t >::iterator

Definition at line 79 of file G4THitsMap.hh.

◆ map_type

template<typename T , typename Map_t = std::map<G4int, T*>>
typedef Map_t G4VTHitsMap< T, Map_t >::map_type

Definition at line 78 of file G4THitsMap.hh.

◆ this_type

template<typename T , typename Map_t = std::map<G4int, T*>>
typedef G4VTHitsMap<T, Map_t> G4VTHitsMap< T, Map_t >::this_type

Definition at line 76 of file G4THitsMap.hh.

◆ value_type

template<typename T , typename Map_t = std::map<G4int, T*>>
typedef T G4VTHitsMap< T, Map_t >::value_type

Definition at line 77 of file G4THitsMap.hh.

Constructor & Destructor Documentation

◆ G4VTHitsMap() [1/2]

template<typename T , typename Map_t >
G4VTHitsMap< T, Map_t >::G4VTHitsMap

Definition at line 474 of file G4THitsMap.hh.

475{
476 theCollection = (void*)new Map_t;
477}

◆ G4VTHitsMap() [2/2]

template<typename T , typename Map_t >
G4VTHitsMap< T, Map_t >::G4VTHitsMap ( G4String  detName,
G4String  colNam 
)

Definition at line 482 of file G4THitsMap.hh.

483 : G4HitsCollection(detName,colNam)
484{
485 theCollection = (void*)new Map_t;
486}

◆ ~G4VTHitsMap()

template<typename T , typename Map_t >
G4VTHitsMap< T, Map_t >::~G4VTHitsMap
virtual

Definition at line 491 of file G4THitsMap.hh.

492{
493 map_type* theHitsMap = GetMap();
494 for(iterator itr = theHitsMap->begin(); itr != theHitsMap->end(); ++itr)
495 delete itr->second;
496 delete theHitsMap;
497}
map_type::iterator iterator
Definition: G4THitsMap.hh:79
Map_t * GetMap() const
Definition: G4THitsMap.hh:151
Map_t map_type
Definition: G4THitsMap.hh:78

Member Function Documentation

◆ add() [1/7]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int key,
U &  aHit 
) const
inline

Definition at line 224 of file G4THitsMap.hh.

225 {
226 map_type* theHitsMap = GetMap();
227 if(theHitsMap->find(key) == theHitsMap->end())
228 theHitsMap->insert(pair_t(key, new T(aHit)));
229 else
230 *theHitsMap->find(key)->second += aHit;
231 return theHitsMap->size();
232 }

◆ add() [2/7]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(! is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int key,
U &  aHit 
) const
inline

Definition at line 240 of file G4THitsMap.hh.

241 {
242 map_type* theHitsMap = GetMap();
243 if(theHitsMap->find(key) == theHitsMap->end())
244 theHitsMap->insert(pair_t(key, allocate()));
245 *theHitsMap->find(key)->second += aHit;
246 return theHitsMap->size();
247 }

◆ add() [3/7]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int key,
U &  aHit 
) const
inline

Definition at line 254 of file G4THitsMap.hh.

255 {
256 map_type* theHitsMap = GetMap();
257 theHitsMap->insert(pair_t(key, new T(aHit)));
258 return theHitsMap->size();
259 }

◆ add() [4/7]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int key,
U &  aHit 
) const
inline

Definition at line 267 of file G4THitsMap.hh.

268 {
269 map_type* theHitsMap = GetMap();
270 T* hit = allocate();
271 *hit += aHit;
272 theHitsMap->insert(pair_t(key, hit));
273 return theHitsMap->size();
274 }

◆ add() [5/7]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t< is_same_t(U, T) &&! is_mmap_t(MapU_t), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int key,
U *&  aHit 
) const
inline

◆ add() [6/7]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int key,
U *&  aHit 
) const
inline

Definition at line 192 of file G4THitsMap.hh.

193 {
194 map_type* theHitsMap = GetMap();
195 theHitsMap->insert(pair_t(key, aHit));
196 return theHitsMap->size();
197 }

◆ add() [7/7]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::add ( const G4int key,
U *&  aHit 
) const
inline

Definition at line 205 of file G4THitsMap.hh.

206 {
207 map_type* theHitsMap = GetMap();
208 T* hit = allocate();
209 *hit += *aHit;
210 theHitsMap->insert(pair_t(key, hit));
211 return theHitsMap->size();
212 }

◆ begin() [1/2]

template<typename T , typename Map_t = std::map<G4int, T*>>
iterator G4VTHitsMap< T, Map_t >::begin ( )
inline

Definition at line 142 of file G4THitsMap.hh.

142{ return GetContainer()->begin(); }
Map_t * GetContainer() const
Definition: G4THitsMap.hh:114

◆ begin() [2/2]

template<typename T , typename Map_t = std::map<G4int, T*>>
const_iterator G4VTHitsMap< T, Map_t >::begin ( ) const
inline

Definition at line 144 of file G4THitsMap.hh.

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

◆ cbegin()

template<typename T , typename Map_t = std::map<G4int, T*>>
const_iterator G4VTHitsMap< T, Map_t >::cbegin ( ) const
inline

Definition at line 146 of file G4THitsMap.hh.

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

◆ cend()

template<typename T , typename Map_t = std::map<G4int, T*>>
const_iterator G4VTHitsMap< T, Map_t >::cend ( ) const
inline

Definition at line 147 of file G4THitsMap.hh.

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

◆ clear()

◆ DrawAllHits()

template<typename T , typename Map_t >
void G4VTHitsMap< T, Map_t >::DrawAllHits
virtual

Reimplemented from G4VHitsCollection.

Definition at line 510 of file G4THitsMap.hh.

511{;}

◆ end() [1/2]

template<typename T , typename Map_t = std::map<G4int, T*>>
iterator G4VTHitsMap< T, Map_t >::end ( )
inline

Definition at line 143 of file G4THitsMap.hh.

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

◆ end() [2/2]

template<typename T , typename Map_t = std::map<G4int, T*>>
const_iterator G4VTHitsMap< T, Map_t >::end ( ) const
inline

Definition at line 145 of file G4THitsMap.hh.

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

◆ entries()

◆ GetContainer()

template<typename T , typename Map_t = std::map<G4int, T*>>
Map_t * G4VTHitsMap< T, Map_t >::GetContainer ( ) const
inline

◆ GetHit()

template<typename T , typename Map_t = std::map<G4int, T*>>
virtual G4VHit * G4VTHitsMap< T, Map_t >::GetHit ( size_t  ) const
inlinevirtual

Reimplemented from G4VHitsCollection.

Definition at line 161 of file G4THitsMap.hh.

161{return 0;}

◆ GetIndex() [1/2]

template<typename T , typename Map_t = std::map<G4int, T*>>
Map_t::size_type G4VTHitsMap< T, Map_t >::GetIndex ( const_iterator  itr) const
inline

Definition at line 123 of file G4THitsMap.hh.

124 { return itr->first; }

◆ GetIndex() [2/2]

template<typename T , typename Map_t = std::map<G4int, T*>>
Map_t::size_type G4VTHitsMap< T, Map_t >::GetIndex ( iterator  itr)
inline

Definition at line 120 of file G4THitsMap.hh.

121 { return itr->first; }

◆ GetMap()

◆ GetObject() [1/4]

template<typename T , typename Map_t = std::map<G4int, T*>>
const T * G4VTHitsMap< T, Map_t >::GetObject ( const_iterator  itr) const
inline

Definition at line 139 of file G4THitsMap.hh.

140 { return itr->second; }

◆ GetObject() [2/4]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename MapU_t = Map_t, enable_if_t< !is_mmap_t(MapU_t), G4int > = 0>
T * G4VTHitsMap< T, Map_t >::GetObject ( G4int  idx) const
inline

Definition at line 127 of file G4THitsMap.hh.

128 { return (GetContainer()->count(idx) != 0) ? (*GetContainer())[idx] : nullptr; }

◆ GetObject() [3/4]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename MapU_t = Map_t, enable_if_t< is_mmap_t(MapU_t), G4int > = 0>
T * G4VTHitsMap< T, Map_t >::GetObject ( G4int  idx) const
inline

Definition at line 131 of file G4THitsMap.hh.

132 {
133 return (GetContainer()->count(idx) != 0) ? GetContainer()->find(idx)->second : nullptr;
134 }

◆ GetObject() [4/4]

template<typename T , typename Map_t = std::map<G4int, T*>>
T * G4VTHitsMap< T, Map_t >::GetObject ( iterator  itr) const
inline

Definition at line 136 of file G4THitsMap.hh.

137 { return itr->second; }

◆ GetSize()

template<typename T , typename Map_t = std::map<G4int, T*>>
virtual size_t G4VTHitsMap< T, Map_t >::GetSize ( ) const
inlinevirtual

Reimplemented from G4VHitsCollection.

Definition at line 162 of file G4THitsMap.hh.

163 { return ((Map_t*)theCollection)->size(); }

Referenced by G4VScoringMesh::Accumulate().

◆ operator+=()

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U , typename MapU_t >
this_type & G4VTHitsMap< T, Map_t >::operator+= ( const G4VTHitsMap< U, MapU_t > &  right) const
inline

Definition at line 97 of file G4THitsMap.hh.

98 {
99 MapU_t* aHitsMap = right.GetMap();
100 for(auto itr = aHitsMap->begin(); itr != aHitsMap->end(); ++itr)
101 add<U, map_type>(itr->first, *(itr->second));
102 return (this_type&)(*this);
103 }
G4VTHitsMap< T, Map_t > this_type
Definition: G4THitsMap.hh:76

◆ operator==()

template<typename T , typename Map_t >
G4bool G4VTHitsMap< T, Map_t >::operator== ( const G4VTHitsMap< T, Map_t > &  right) const

Definition at line 502 of file G4THitsMap.hh.

503{
504 return (collectionName==right.collectionName);
505}

◆ operator[]() [1/2]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename MapU_t = Map_t, enable_if_t<! is_mmap_t(MapU_t), G4int > = 0>
T * G4VTHitsMap< T, Map_t >::operator[] ( G4int  key) const
inline

Definition at line 432 of file G4THitsMap.hh.

433 {
434 map_type* theHitsMap = GetMap();
435 if(theHitsMap->find(key) != theHitsMap->end())
436 return theHitsMap->find(key)->second;
437 return nullptr;
438 }

◆ operator[]() [2/2]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename MapU_t = Map_t, enable_if_t< is_mmap_t(MapU_t), G4int > = 0>
T * G4VTHitsMap< T, Map_t >::operator[] ( G4int  key) const
inline

Definition at line 442 of file G4THitsMap.hh.

443 {
444#ifdef G4VERBOSE
445 static bool _first = true;
446 if(_first)
447 {
448 _first = false;
449 G4Exception("G4THitsMap operator[]", "calling [] on multimap",
450 JustWarning, "Returning the last matching entry");
451 }
452#endif
453 map_type* theHitsMap = GetMap();
454 iterator itr = theHitsMap->find(key);
455 if(itr != theHitsMap->end())
456 {
457 std::advance(itr, theHitsMap->count(key)-1);
458 return itr->second;
459 }
460 return nullptr;
461 }
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35

◆ PrintAllHits()

template<typename T , typename Map_t >
void G4VTHitsMap< T, Map_t >::PrintAllHits
virtual

Reimplemented from G4VHitsCollection.

Definition at line 516 of file G4THitsMap.hh.

517{
518 G4cout << "G4THitsMap " << SDname << " / " << collectionName << " --- "
519 << entries() << " entries" << G4endl;
520 /*----- commented out for the use-case where <T> cannot be initialized
521 to be zero or does not support += operator.
522 Map_t * theHitsMap = GetMap();
523 typename Map_t::iterator itr = theHitsMap->begin();
524 T sum = 0.;
525 for(; itr != theHitsMap->end(); ++itr) {
526 G4cout << " " << itr->first << " : "
527 << *(itr->second) << G4endl;
528 sum += *(itr->second);
529 }
530 G4cout << " Total : " << sum << G4endl;
531 ----------------------------------------------------------------------*/
532}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
size_t entries() const
Definition: G4THitsMap.hh:155

Referenced by G4VScoringMesh::Accumulate().

◆ set() [1/8]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int key,
U &  aHit 
) const
inline

Definition at line 362 of file G4THitsMap.hh.

363 {
364 map_type* theHitsMap = GetMap();
365 T* hit = nullptr;
366 if(theHitsMap->find(key) != theHitsMap->end())
367 hit = theHitsMap->find(key)->second;
368 else
369 theHitsMap->insert(pair_t(key, hit = allocate()));
370 *hit = aHit;
371 return theHitsMap->size();
372 }

◆ set() [2/8]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int key,
U &  aHit 
) const
inline

Definition at line 379 of file G4THitsMap.hh.

380 {
381 map_type* theHitsMap = GetMap();
382 if(theHitsMap->find(key) != theHitsMap->end())
383 *theHitsMap->find(key)->second = aHit;
384 else
385 theHitsMap->insert(pair_t(key, new T(aHit)));
386 return theHitsMap->size();
387 }

◆ set() [3/8]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int key,
U &  aHit 
) const
inline

Definition at line 394 of file G4THitsMap.hh.

395 {
396 map_type* theHitsMap = GetMap();
397 T* hit = nullptr;
398 if(theHitsMap->find(key) == theHitsMap->end())
399 theHitsMap->insert(std::make_pair(key, hit = allocate()));
400 else
401 hit = theHitsMap->find(key)->second;
402 *hit += aHit;
403 return theHitsMap->size();
404 }

◆ set() [4/8]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int key,
U &  aHit 
) const
inline

Definition at line 411 of file G4THitsMap.hh.

412 {
413 map_type* theHitsMap = GetMap();
414 T* hit = allocate();
415 *hit += aHit;
416 if(theHitsMap->find(key) != theHitsMap->end())
417 *theHitsMap->find(key)->second = *hit;
418 else
419 theHitsMap->insert(pair_t(key, hit));
420 return theHitsMap->size();
421 }

◆ set() [5/8]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int key,
U *&  aHit 
) const
inline

Definition at line 287 of file G4THitsMap.hh.

288 {
289 map_type* theHitsMap = GetMap();
290 if(theHitsMap->find(key) != theHitsMap->end())
291 delete theHitsMap->find(key)->second;
292 theHitsMap->find(key)->second = aHit;
293 return theHitsMap->size();
294 }

Referenced by G4PSMinKinEAtGeneration::ProcessHits().

◆ set() [6/8]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int key,
U *&  aHit 
) const
inline

Definition at line 301 of file G4THitsMap.hh.

302 {
303 map_type* theHitsMap = GetMap();
304 if(theHitsMap->find(key) != theHitsMap->end())
305 theHitsMap->insert(pair_t(key, aHit));
306 else
307 {
308 delete theHitsMap->find(key)->second;
309 theHitsMap->find(key)->second = aHit;
310 }
311 return theHitsMap->size();
312 }

◆ set() [7/8]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&! is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int key,
U *&  aHit 
) const
inline

Definition at line 319 of file G4THitsMap.hh.

320 {
321 map_type* theHitsMap = GetMap();
322 T* hit = nullptr;
323 if(theHitsMap->find(key) == theHitsMap->end())
324 theHitsMap->insert(std::make_pair(key, hit = allocate()));
325 else
326 hit = theHitsMap->find(key)->second;
327 *hit += *aHit;
328 return theHitsMap->size();
329 }

◆ set() [8/8]

template<typename T , typename Map_t = std::map<G4int, T*>>
template<typename U = T, typename MapU_t = Map_t, enable_if_t<(!is_same_t(U, T) &&is_mmap_t(MapU_t)), G4int > = 0>
size_t G4VTHitsMap< T, Map_t >::set ( const G4int key,
U *&  aHit 
) const
inline

Definition at line 336 of file G4THitsMap.hh.

337 {
338 map_type* theHitsMap = GetMap();
339 T* hit = allocate();
340 *hit += *aHit;
341 if(theHitsMap->find(key) != theHitsMap->end())
342 theHitsMap->insert(pair_t(key, hit));
343 else
344 {
345 delete theHitsMap->find(key)->second;
346 theHitsMap->find(key)->second = hit;
347 }
348 return theHitsMap->size();
349 }

◆ size()

template<typename T , typename Map_t = std::map<G4int, T*>>
Map_t::size_type G4VTHitsMap< T, Map_t >::size ( )
inline

Definition at line 117 of file G4THitsMap.hh.

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

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