Geant4 11.1.1
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 84 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 83 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 82 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 80 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 81 of file G4THitsMap.hh.

Constructor & Destructor Documentation

◆ G4VTHitsMap() [1/2]

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

Definition at line 458 of file G4THitsMap.hh.

459{
460 theCollection = (void*) new Map_t;
461}

◆ G4VTHitsMap() [2/2]

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

Definition at line 466 of file G4THitsMap.hh.

467 : G4HitsCollection(detName, colNam)
468{
469 theCollection = (void*) new Map_t;
470}

◆ ~G4VTHitsMap()

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

Definition at line 475 of file G4THitsMap.hh.

476{
477 map_type* theHitsMap = GetMap();
478 for(iterator itr = theHitsMap->begin(); itr != theHitsMap->end(); ++itr)
479 delete itr->second;
480 delete theHitsMap;
481}
map_type::iterator iterator
Definition: G4THitsMap.hh:83
Map_t * GetMap() const
Definition: G4THitsMap.hh:155
Map_t map_type
Definition: G4THitsMap.hh:82

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 221 of file G4THitsMap.hh.

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

◆ 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 236 of file G4THitsMap.hh.

237 {
238 map_type* theHitsMap = GetMap();
239 if(theHitsMap->find(key) == theHitsMap->end())
240 theHitsMap->insert(pair_t(key, allocate()));
241 *theHitsMap->find(key)->second += aHit;
242 return theHitsMap->size();
243 }

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

250 {
251 map_type* theHitsMap = GetMap();
252 theHitsMap->insert(pair_t(key, new T(aHit)));
253 return theHitsMap->size();
254 }

◆ 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 261 of file G4THitsMap.hh.

262 {
263 map_type* theHitsMap = GetMap();
264 T* hit = allocate();
265 *hit += aHit;
266 theHitsMap->insert(pair_t(key, hit));
267 return theHitsMap->size();
268 }

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

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

◆ 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 203 of file G4THitsMap.hh.

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

◆ begin() [1/2]

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

Definition at line 146 of file G4THitsMap.hh.

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

◆ 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 148 of file G4THitsMap.hh.

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

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

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

◆ clear()

◆ DrawAllHits()

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

Reimplemented from G4VHitsCollection.

Definition at line 495 of file G4THitsMap.hh.

496{
497 ;
498}

◆ end() [1/2]

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

Definition at line 147 of file G4THitsMap.hh.

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

149{ 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 163 of file G4THitsMap.hh.

163{ 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 124 of file G4THitsMap.hh.

125 {
126 return itr->first;
127 }

◆ 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 122 of file G4THitsMap.hh.

122{ 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 144 of file G4THitsMap.hh.

144{ 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 130 of file G4THitsMap.hh.

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

◆ 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 136 of file G4THitsMap.hh.

137 {
138 return (GetContainer()->count(idx) != 0) ? GetContainer()->find(idx)->second
139 : nullptr;
140 }

◆ 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 142 of file G4THitsMap.hh.

142{ 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 164 of file G4THitsMap.hh.

164{ 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 101 of file G4THitsMap.hh.

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

◆ operator==()

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

Definition at line 486 of file G4THitsMap.hh.

488{
489 return (collectionName == right.collectionName);
490}

◆ 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 417 of file G4THitsMap.hh.

418 {
419 map_type* theHitsMap = GetMap();
420 if(theHitsMap->find(key) != theHitsMap->end())
421 return theHitsMap->find(key)->second;
422 return nullptr;
423 }

◆ 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 426 of file G4THitsMap.hh.

427 {
428#ifdef G4VERBOSE
429 static bool _first = true;
430 if(_first)
431 {
432 _first = false;
433 G4Exception("G4THitsMap operator[]", "calling [] on multimap",
434 JustWarning, "Returning the last matching entry");
435 }
436#endif
437 map_type* theHitsMap = GetMap();
438 iterator itr = theHitsMap->find(key);
439 if(itr != theHitsMap->end())
440 {
441 std::advance(itr, theHitsMap->count(key) - 1);
442 return itr->second;
443 }
444 return nullptr;
445 }
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:59

◆ PrintAllHits()

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

Reimplemented from G4VHitsCollection.

Definition at line 503 of file G4THitsMap.hh.

504{
505 G4cout << "G4THitsMap " << SDname << " / " << collectionName << " --- "
506 << entries() << " entries" << G4endl;
507 /*----- commented out for the use-case where <T> cannot be initialized
508 to be zero or does not support += operator.
509 Map_t * theHitsMap = GetMap();
510 typename Map_t::iterator itr = theHitsMap->begin();
511 T sum = 0.;
512 for(; itr != theHitsMap->end(); ++itr) {
513 G4cout << " " << itr->first << " : "
514 << *(itr->second) << G4endl;
515 sum += *(itr->second);
516 }
517 G4cout << " Total : " << sum << G4endl;
518 ----------------------------------------------------------------------*/
519}
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
size_t entries() const
Definition: G4THitsMap.hh:158

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 351 of file G4THitsMap.hh.

352 {
353 map_type* theHitsMap = GetMap();
354 T* hit = nullptr;
355 if(theHitsMap->find(key) != theHitsMap->end())
356 hit = theHitsMap->find(key)->second;
357 else
358 theHitsMap->insert(pair_t(key, hit = allocate()));
359 *hit = aHit;
360 return theHitsMap->size();
361 }

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

368 {
369 map_type* theHitsMap = GetMap();
370 if(theHitsMap->find(key) != theHitsMap->end())
371 *theHitsMap->find(key)->second = aHit;
372 else
373 theHitsMap->insert(pair_t(key, new T(aHit)));
374 return theHitsMap->size();
375 }

◆ 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 381 of file G4THitsMap.hh.

382 {
383 map_type* theHitsMap = GetMap();
384 T* hit = nullptr;
385 if(theHitsMap->find(key) == theHitsMap->end())
386 theHitsMap->insert(std::make_pair(key, hit = allocate()));
387 else
388 hit = theHitsMap->find(key)->second;
389 *hit += aHit;
390 return theHitsMap->size();
391 }

◆ 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 397 of file G4THitsMap.hh.

398 {
399 map_type* theHitsMap = GetMap();
400 T* hit = allocate();
401 *hit += aHit;
402 if(theHitsMap->find(key) != theHitsMap->end())
403 *theHitsMap->find(key)->second = *hit;
404 else
405 theHitsMap->insert(pair_t(key, hit));
406 return theHitsMap->size();
407 }

◆ 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 280 of file G4THitsMap.hh.

281 {
282 map_type* theHitsMap = GetMap();
283 if(theHitsMap->find(key) != theHitsMap->end())
284 delete theHitsMap->find(key)->second;
285 theHitsMap->find(key)->second = aHit;
286 return theHitsMap->size();
287 }

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 293 of file G4THitsMap.hh.

294 {
295 map_type* theHitsMap = GetMap();
296 if(theHitsMap->find(key) != theHitsMap->end())
297 theHitsMap->insert(pair_t(key, aHit));
298 else
299 {
300 delete theHitsMap->find(key)->second;
301 theHitsMap->find(key)->second = aHit;
302 }
303 return theHitsMap->size();
304 }

◆ 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 310 of file G4THitsMap.hh.

311 {
312 map_type* theHitsMap = GetMap();
313 T* hit = nullptr;
314 if(theHitsMap->find(key) == theHitsMap->end())
315 theHitsMap->insert(std::make_pair(key, hit = allocate()));
316 else
317 hit = theHitsMap->find(key)->second;
318 *hit += *aHit;
319 return theHitsMap->size();
320 }

◆ 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 326 of file G4THitsMap.hh.

327 {
328 map_type* theHitsMap = GetMap();
329 T* hit = allocate();
330 *hit += *aHit;
331 if(theHitsMap->find(key) != theHitsMap->end())
332 theHitsMap->insert(pair_t(key, hit));
333 else
334 {
335 delete theHitsMap->find(key)->second;
336 theHitsMap->find(key)->second = hit;
337 }
338 return theHitsMap->size();
339 }

◆ size()

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

Definition at line 120 of file G4THitsMap.hh.

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

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