48 #ifndef G4TAtomicHitsMap_h
49 #define G4TAtomicHitsMap_h 1
51 #include "G4THitsCollection.hh"
59 #include <type_traits>
76 "G4TAtomicHitsMap must use fundamental type");
82 typedef typename container_type::iterator
iterator;
116 inline G4int set(
const G4int & key,
T& aHit)
const;
155 template <
typename T>
160 template <
typename T>
167 template <
typename T>
170 for(
auto itr = theCollection->begin(); itr != theCollection->end(); itr++)
173 delete theCollection;
176 template <
typename T>
182 template <
typename T>
186 for(
auto itr = rhs.
GetMap()->begin(); itr != rhs.
GetMap()->end(); itr++)
187 add(itr->first, *(itr->second));
192 template <
typename T>
196 for(
auto itr = rhs.
GetMap()->begin(); itr != rhs.
GetMap()->end(); itr++)
197 add(itr->first, *(itr->second));
202 template <
typename T>
206 if(theCollection->find(key) != theCollection->end())
207 return theCollection->find(key)->second;
211 if(theCollection->find(key) == theCollection->end())
214 (*theCollection)[key] = ptr;
217 return theCollection->find(key)->second;
221 template <
typename T>
225 if(theCollection->find(key) != theCollection->end())
226 *(*theCollection)[key] += *aHit;
230 (*theCollection)[key] = aHit;
233 return theCollection->size();
236 template <
typename T>
241 if(theCollection->find(key) != theCollection->end())
242 *(*theCollection)[key] += aHit;
248 (*theCollection)[key] = hit;
251 return theCollection->size();
254 template <
typename T>
258 if(theCollection->find(key) != theCollection->end())
259 delete (*theCollection)[key]->second;
261 (*theCollection)[key] = aHit;
263 return theCollection->size();
266 template <
typename T>
270 if(theCollection->find(key) != theCollection->end())
271 *(*theCollection)[key] = aHit;
276 (*theCollection)[key] = hit;
279 return theCollection->size();
282 template <
typename T>
286 template <
typename T>
289 G4cout <<
"G4TAtomicHitsMap " << SDname <<
" / " << collectionName <<
" --- "
290 << entries() <<
" entries" <<
G4endl;
293 template <
typename T>
298 for(
auto itr = theCollection->begin(); itr != theCollection->end(); itr++)
301 theCollection->clear();