Geant4-11
G4THitsMap.hh
Go to the documentation of this file.
1//
2// ********************************************************************
3// * License and Disclaimer *
4// * *
5// * The Geant4 software is copyright of the Copyright Holders of *
6// * the Geant4 Collaboration. It is provided under the terms and *
7// * conditions of the Geant4 Software License, included in the file *
8// * LICENSE and available at http://cern.ch/geant4/license . These *
9// * include a list of copyright holders. *
10// * *
11// * Neither the authors of this software system, nor their employing *
12// * institutes,nor the agencies providing financial support for this *
13// * work make any representation or warranty, express or implied, *
14// * regarding this software system or assume any liability for its *
15// * use. Please see the license in the file LICENSE and URL above *
16// * for the full disclaimer and the limitation of liability. *
17// * *
18// * This code implementation is the result of the scientific and *
19// * technical work of the GEANT4 collaboration. *
20// * By using, copying, modifying or distributing the software (or *
21// * any work based on the software) you agree to acknowledge its *
22// * use in resulting scientific publications, and indicate your *
23// * acceptance of all terms of the Geant4 Software license. *
24// ********************************************************************
25//
26//
27//
28#ifndef G4THitsMap_h
29#define G4THitsMap_h 1
30
31#include "G4THitsCollection.hh"
32#include "globals.hh"
33
34#include <map>
35#include <unordered_map>
36
37// class description:
38//
39// This is a template class of hits map and parametrized by
40// The concrete class of G4VHit. This is a uniform collection for
41// a particular concrete hit class objects.
42// An intermediate layer class G4HitsMap appeared in this
43// header file is used just for G4Allocator, because G4Allocator
44// cannot be instansiated with a template class. Thus G4HitsMap
45// class MUST NOT be directly used by the user.
46
47template <typename T, typename Map_t = std::map<G4int, T*>>
49{
50 private:
51 typedef std::multimap<G4int, T*> mmap_t;
52 typedef std::pair<G4int, T*> pair_t;
53 typedef std::unordered_multimap<G4int, T*> uommap_t;
54
55#define is_same_t(_Tp, _Up) std::is_same<_Tp, _Up>::value
56#define is_multimap_t(_Mp) std::is_same<_Mp, mmap_t>::value
57#define is_uommap_t(_Mp) std::is_same<_Mp, uommap_t>::value
58#define is_mmap_t(_Mp) (is_multimap_t(_Mp) || is_uommap_t(_Mp))
59#define is_fundamental_t(_Tp) std::is_fundamental<_Tp>::value
60
61 template <bool _Bp, typename _Tp = void>
62 using enable_if_t = typename std::enable_if<_Bp, _Tp>::type;
63
64 // ensure fundamental types are initialized to zero
65 template <typename U = T, enable_if_t<is_fundamental_t(U), G4int> = 0>
66 T* allocate() const
67 {
68 return new T(0.);
69 }
70 // non-fundamental types should set values to appropriate values
71 // and avoid issues such as:
72 // G4StatDouble stat(0.); stat += 1.0; gives n == 2;
73 template <typename U = T, enable_if_t<!is_fundamental_t(U), G4int> = 0>
74 T* allocate() const
75 {
76 return new T();
77 }
78
79 public:
81 typedef T value_type;
82 typedef Map_t map_type;
83 typedef typename map_type::iterator iterator;
84 typedef typename map_type::const_iterator const_iterator;
85
86 public: // with description
87 // generic constructor
89 // det + collection description constructor
90 G4VTHitsMap(G4String detName, G4String colNam);
91 // destructor
92 virtual ~G4VTHitsMap();
93 // equivalence operator
95
96 //------------------------------------------------------------------------//
97 // Generic operator += where add(...) overloads handle various
98 // U and MapU_t types
99 //------------------------------------------------------------------------//
100 template <typename U, typename MapU_t>
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 }
108 //------------------------------------------------------------------------//
109
110 public: // with description
111 virtual void DrawAllHits();
112 virtual void PrintAllHits();
113 // These two methods invokes Draw() and Print() methods of all of
114 // hit objects stored in this map, respectively.
115
116 public:
117 // Generic iteration
118 inline Map_t* GetContainer() const { return (Map_t*) theCollection; }
119
120 inline typename Map_t::size_type size() { return GetContainer()->size(); }
121
122 inline typename Map_t::size_type GetIndex(iterator itr) { return itr->first; }
123
124 inline typename Map_t::size_type GetIndex(const_iterator itr) const
125 {
126 return itr->first;
127 }
128
129 template <typename MapU_t = Map_t, enable_if_t<!is_mmap_t(MapU_t), G4int> = 0>
130 inline T* GetObject(G4int idx) const
131 {
132 return (GetContainer()->count(idx) != 0) ? (*GetContainer())[idx] : nullptr;
133 }
134
135 template <typename MapU_t = Map_t, enable_if_t<is_mmap_t(MapU_t), G4int> = 0>
136 inline T* GetObject(G4int idx) const
137 {
138 return (GetContainer()->count(idx) != 0) ? GetContainer()->find(idx)->second
139 : nullptr;
140 }
141
142 inline T* GetObject(iterator itr) const { return itr->second; }
143
144 inline const T* GetObject(const_iterator itr) const { return itr->second; }
145
146 iterator begin() { return GetContainer()->begin(); }
147 iterator end() { return GetContainer()->end(); }
148 const_iterator begin() const { return GetContainer()->begin(); }
149 const_iterator end() const { return GetContainer()->end(); }
150 const_iterator cbegin() const { return GetContainer()->cbegin(); }
151 const_iterator cend() const { return GetContainer()->cend(); }
152
153 public: // with description
154 // Returns a pointer to a concrete hit object.
155 inline Map_t* GetMap() const { return (Map_t*) theCollection; }
156 // Overwrite a hit object. Total number of hit objects stored in this
157 // map is returned.
158 inline size_t entries() const { return ((Map_t*) theCollection)->size(); }
159 // Returns the number of hit objects stored in this map
160 inline void clear();
161
162 public:
163 virtual G4VHit* GetHit(size_t) const { return 0; }
164 virtual size_t GetSize() const { return ((Map_t*) theCollection)->size(); }
165
166 public:
167 //------------------------------------------------------------------------//
168 // Add/Insert a hit object. Total number of hit objects stored in this
169 // map is returned.
170 //------------------------------------------------------------------------//
171 // Standard map overload for same type
172 //------------------------------------------------------------------------//
173 // here we don't use allocate() since instances like G4Colour() == white
174 // and += adds to white (not correct)
175 template <typename U = T, typename MapU_t = Map_t,
176 enable_if_t<is_same_t(U, T) && !is_mmap_t(MapU_t), G4int> = 0>
177 size_t add(const G4int& key, U*& aHit) const
178 {
179 map_type* theHitsMap = GetMap();
180 if(theHitsMap->find(key) == theHitsMap->end())
181 theHitsMap->insert(pair_t(key, new T(*aHit)));
182 else
183 *theHitsMap->find(key)->second += *aHit;
184 return theHitsMap->size();
185 }
186 //------------------------------------------------------------------------//
187 // Multimap overload for same type T
188 //------------------------------------------------------------------------//
189 template <typename U = T, typename MapU_t = Map_t,
190 enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
191 size_t add(const G4int& key, U*& aHit) const
192 {
193 map_type* theHitsMap = GetMap();
194 theHitsMap->insert(pair_t(key, aHit));
195 return theHitsMap->size();
196 }
197 //------------------------------------------------------------------------//
198 // Multimap overload for different types
199 // assumes type T has overload of += operator for U
200 //------------------------------------------------------------------------//
201 template <typename U = T, typename MapU_t = Map_t,
202 enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
203 size_t add(const G4int& key, U*& aHit) const
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 }
211
212 public:
213 //------------------------------------------------------------------------//
214 // Standard map overload for same type
215 // assumes type T has overload of += operator for U
216 //------------------------------------------------------------------------//
217 // here we don't use allocate() since instances like G4Colour() == white
218 // and += adds to white (not correct)
219 template <typename U = T, typename MapU_t = Map_t,
220 enable_if_t<(is_same_t(U, T) && !is_mmap_t(MapU_t)), G4int> = 0>
221 size_t add(const G4int& key, U& aHit) const
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 }
230 //------------------------------------------------------------------------//
231 // Standard map overload for different type
232 // assumes type T has overload of += operator for U
233 //------------------------------------------------------------------------//
234 template <typename U = T, typename MapU_t = Map_t,
235 enable_if_t<(!is_same_t(U, T) && !is_mmap_t(MapU_t)), G4int> = 0>
236 size_t add(const G4int& key, U& aHit) const
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 }
244 //------------------------------------------------------------------------//
245 // Multimap overload for same type T
246 //------------------------------------------------------------------------//
247 template <typename U = T, typename MapU_t = Map_t,
248 enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
249 size_t add(const G4int& key, U& aHit) const
250 {
251 map_type* theHitsMap = GetMap();
252 theHitsMap->insert(pair_t(key, new T(aHit)));
253 return theHitsMap->size();
254 }
255 //------------------------------------------------------------------------//
256 // Multimap overload for different types
257 // assumes type T has overload of += operator for U
258 //------------------------------------------------------------------------//
259 template <typename U = T, typename MapU_t = Map_t,
260 enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
261 size_t add(const G4int& key, U& aHit) const
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 }
269 //------------------------------------------------------------------------//
270
271 public:
272 //------------------------------------------------------------------------//
273 // Set a hit object. Total number of hit objects stored in this
274 // map is returned.
275 //------------------------------------------------------------------------//
276 // Standard overload for same type T
277 //------------------------------------------------------------------------//
278 template <typename U = T, typename MapU_t = Map_t,
279 enable_if_t<(is_same_t(U, T) && !is_mmap_t(MapU_t)), G4int> = 0>
280 inline size_t set(const G4int& key, U*& aHit) const
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 }
288 //------------------------------------------------------------------------//
289 // Multimap overload for same type T
290 //------------------------------------------------------------------------//
291 template <typename U = T, typename MapU_t = Map_t,
292 enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
293 inline size_t set(const G4int& key, U*& aHit) const
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 }
305 //------------------------------------------------------------------------//
306 // Standard map overload for different types
307 //------------------------------------------------------------------------//
308 template <typename U = T, typename MapU_t = Map_t,
309 enable_if_t<(!is_same_t(U, T) && !is_mmap_t(MapU_t)), G4int> = 0>
310 inline size_t set(const G4int& key, U*& aHit) const
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 }
321 //------------------------------------------------------------------------//
322 // Multimap overload for different types
323 //------------------------------------------------------------------------//
324 template <typename U = T, typename MapU_t = Map_t,
325 enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
326 inline size_t set(const G4int& key, U*& aHit) const
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 }
340 //------------------------------------------------------------------------//
341
342 public:
343 //------------------------------------------------------------------------//
344 // Set a hit object. Total number of hit objects stored in this
345 // map is returned.
346 //------------------------------------------------------------------------//
347 // Standard overload for same type T
348 //------------------------------------------------------------------------//
349 template <typename U = T, typename MapU_t = Map_t,
350 enable_if_t<(is_same_t(U, T) && !is_mmap_t(MapU_t)), G4int> = 0>
351 inline size_t set(const G4int& key, U& aHit) const
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 }
362 //------------------------------------------------------------------------//
363 // Multimap overload for same type T
364 //------------------------------------------------------------------------//
365 template <typename U = T, typename MapU_t = Map_t,
366 enable_if_t<(is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
367 inline size_t set(const G4int& key, U& aHit) const
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 }
376 //------------------------------------------------------------------------//
377 // Standard map overload for different types
378 //------------------------------------------------------------------------//
379 template <typename U = T, typename MapU_t = Map_t,
380 enable_if_t<(!is_same_t(U, T) && !is_mmap_t(MapU_t)), G4int> = 0>
381 inline size_t set(const G4int& key, U& aHit) const
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 }
392 //------------------------------------------------------------------------//
393 // Multimap overload for different types
394 //------------------------------------------------------------------------//
395 template <typename U = T, typename MapU_t = Map_t,
396 enable_if_t<(!is_same_t(U, T) && is_mmap_t(MapU_t)), G4int> = 0>
397 inline size_t set(const G4int& key, U& aHit) const
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 }
408 //------------------------------------------------------------------------//
409
410 public:
411 //------------------------------------------------------------------------//
412 // Enable bracket operator. Return pointer to data indexed by key or
413 // last occurring instance of pointer to data index by key in the
414 // case of a multimap
415 //------------------------------------------------------------------------//
416 template <typename MapU_t = Map_t, enable_if_t<!is_mmap_t(MapU_t), G4int> = 0>
417 T* operator[](G4int key) const
418 {
419 map_type* theHitsMap = GetMap();
420 if(theHitsMap->find(key) != theHitsMap->end())
421 return theHitsMap->find(key)->second;
422 return nullptr;
423 }
424 //------------------------------------------------------------------------//
425 template <typename MapU_t = Map_t, enable_if_t<is_mmap_t(MapU_t), G4int> = 0>
426 T* operator[](G4int key) const
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 }
446 //------------------------------------------------------------------------//
447
448#undef is_same_t
449#undef is_multimap_t
450#undef is_uommap_t
451#undef is_mmap_t
452#undef is_fundamental_t
453};
454
455//============================================================================//
456
457template <typename T, typename Map_t>
459{
460 theCollection = (void*) new Map_t;
461}
462
463//============================================================================//
464
465template <typename T, typename Map_t>
467 : G4HitsCollection(detName, colNam)
468{
469 theCollection = (void*) new Map_t;
470}
471
472//============================================================================//
473
474template <typename T, typename Map_t>
476{
477 map_type* theHitsMap = GetMap();
478 for(iterator itr = theHitsMap->begin(); itr != theHitsMap->end(); ++itr)
479 delete itr->second;
480 delete theHitsMap;
481}
482
483//============================================================================//
484
485template <typename T, typename Map_t>
487 const G4VTHitsMap<T, Map_t>& right) const
488{
489 return (collectionName == right.collectionName);
490}
491
492//============================================================================//
493
494template <typename T, typename Map_t>
496{
497 ;
498}
499
500//============================================================================//
501
502template <typename T, typename Map_t>
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}
520
521//============================================================================//
522
523template <typename T, typename Map_t>
525{
526 Map_t* theHitsMap = GetMap();
527 for(iterator itr = theHitsMap->begin(); itr != theHitsMap->end(); ++itr)
528 delete itr->second;
529 theHitsMap->clear();
530}
531
532//============================================================================//
533// //
534// //
535// Helpers for different map types //
536// //
537// //
538//============================================================================//
539
540template <typename _Tp>
542{
543 public:
545
546 public:
548 : parent_type()
549 {}
550 G4THitsMap(G4String detName, G4String colName)
551 : parent_type(detName, colName)
552 {}
553
554 using parent_type::operator+=;
555 using parent_type::operator==;
556 using parent_type::operator[];
557 using parent_type::add;
558 using parent_type::begin;
559 using parent_type::cbegin;
560 using parent_type::cend;
561 using parent_type::clear;
562 using parent_type::DrawAllHits;
563 using parent_type::end;
564 using parent_type::entries;
565 using parent_type::GetHit;
566 using parent_type::GetMap;
567 using parent_type::GetSize;
568 using parent_type::PrintAllHits;
569 using parent_type::set;
570};
571
572//============================================================================//
573
574template <typename _Tp>
575class G4THitsMultiMap : public G4VTHitsMap<_Tp, std::multimap<G4int, _Tp*>>
576{
577 public:
579
580 public:
582 : parent_type()
583 {}
585 : parent_type(detName, colName)
586 {}
587
588 using parent_type::operator+=;
589 using parent_type::operator==;
590 using parent_type::operator[];
591 using parent_type::add;
592 using parent_type::begin;
594 using parent_type::cend;
595 using parent_type::clear;
597 using parent_type::end;
603 using parent_type::set;
604};
605
606//============================================================================//
607
608template <typename _Tp>
610 : public G4VTHitsMap<_Tp, std::unordered_map<G4int, _Tp*>>
611{
612 public:
614
615 public:
617 : parent_type()
618 {}
620 : parent_type(detName, colName)
621 {}
622
623 using parent_type::operator+=;
624 using parent_type::operator==;
625 using parent_type::operator[];
626 using parent_type::add;
627 using parent_type::begin;
629 using parent_type::cend;
630 using parent_type::clear;
632 using parent_type::end;
638 using parent_type::set;
639};
640
641//============================================================================//
642
643template <typename _Tp>
645 : public G4VTHitsMap<_Tp, std::unordered_multimap<G4int, _Tp*>>
646{
647 public:
649
650 public:
652 : parent_type()
653 {}
655 : parent_type(detName, colName)
656 {}
657
658 using parent_type::operator+=;
659 using parent_type::operator==;
660 using parent_type::operator[];
661 using parent_type::add;
662 using parent_type::begin;
664 using parent_type::cend;
665 using parent_type::clear;
667 using parent_type::end;
673 using parent_type::set;
674};
675
676//============================================================================//
677
678#endif
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
#define is_mmap_t(_Mp)
Definition: G4THitsMap.hh:58
#define is_same_t(_Tp, _Up)
Definition: G4THitsMap.hh:55
bool G4bool
Definition: G4Types.hh:86
int G4int
Definition: G4Types.hh:85
#define G4endl
Definition: G4ios.hh:57
G4GLOB_DLL std::ostream G4cout
G4VTHitsMap< _Tp, std::map< G4int, _Tp * > > parent_type
Definition: G4THitsMap.hh:544
G4THitsMap(G4String detName, G4String colName)
Definition: G4THitsMap.hh:550
G4VTHitsMap< _Tp, std::multimap< G4int, _Tp * > > parent_type
Definition: G4THitsMap.hh:578
G4THitsMultiMap(G4String detName, G4String colName)
Definition: G4THitsMap.hh:584
G4THitsUnorderedMap(G4String detName, G4String colName)
Definition: G4THitsMap.hh:619
G4VTHitsMap< _Tp, std::unordered_map< G4int, _Tp * > > parent_type
Definition: G4THitsMap.hh:613
G4THitsUnorderedMultiMap(G4String detName, G4String colName)
Definition: G4THitsMap.hh:654
G4VTHitsMap< _Tp, std::unordered_multimap< G4int, _Tp * > > parent_type
Definition: G4THitsMap.hh:648
Definition: G4VHit.hh:48
map_type::iterator iterator
Definition: G4THitsMap.hh:83
Map_t * GetMap() const
Definition: G4THitsMap.hh:155
std::unordered_multimap< G4int, T * > uommap_t
Definition: G4THitsMap.hh:53
Map_t map_type
Definition: G4THitsMap.hh:82
const_iterator cbegin() const
Definition: G4THitsMap.hh:150
this_type & operator+=(const G4VTHitsMap< U, MapU_t > &right) const
Definition: G4THitsMap.hh:101
std::pair< G4int, T * > pair_t
Definition: G4THitsMap.hh:52
std::multimap< G4int, T * > mmap_t
Definition: G4THitsMap.hh:51
const T * GetObject(const_iterator itr) const
Definition: G4THitsMap.hh:144
size_t set(const G4int &key, U *&aHit) const
Definition: G4THitsMap.hh:280
T * allocate() const
Definition: G4THitsMap.hh:66
virtual size_t GetSize() const
Definition: G4THitsMap.hh:164
virtual void PrintAllHits()
Definition: G4THitsMap.hh:503
G4bool operator==(const G4VTHitsMap< T, Map_t > &right) const
Definition: G4THitsMap.hh:486
size_t set(const G4int &key, U &aHit) const
Definition: G4THitsMap.hh:351
Map_t * GetContainer() const
Definition: G4THitsMap.hh:118
Map_t::size_type GetIndex(iterator itr)
Definition: G4THitsMap.hh:122
const_iterator end() const
Definition: G4THitsMap.hh:149
virtual void DrawAllHits()
Definition: G4THitsMap.hh:495
size_t entries() const
Definition: G4THitsMap.hh:158
virtual G4VHit * GetHit(size_t) const
Definition: G4THitsMap.hh:163
iterator end()
Definition: G4THitsMap.hh:147
G4VTHitsMap(G4String detName, G4String colNam)
Definition: G4THitsMap.hh:466
map_type::const_iterator const_iterator
Definition: G4THitsMap.hh:84
Map_t::size_type size()
Definition: G4THitsMap.hh:120
const_iterator begin() const
Definition: G4THitsMap.hh:148
T * operator[](G4int key) const
Definition: G4THitsMap.hh:417
const_iterator cend() const
Definition: G4THitsMap.hh:151
typename std::enable_if< _Bp, _Tp >::type enable_if_t
Definition: G4THitsMap.hh:62
T * GetObject(iterator itr) const
Definition: G4THitsMap.hh:142
virtual ~G4VTHitsMap()
Definition: G4THitsMap.hh:475
G4VTHitsMap< T, Map_t > this_type
Definition: G4THitsMap.hh:80
void clear()
Definition: G4THitsMap.hh:524
Map_t::size_type GetIndex(const_iterator itr) const
Definition: G4THitsMap.hh:124
size_t add(const G4int &key, U &aHit) const
Definition: G4THitsMap.hh:221
iterator begin()
Definition: G4THitsMap.hh:146
size_t add(const G4int &key, U *&aHit) const
Definition: G4THitsMap.hh:177
T * GetObject(G4int idx) const
Definition: G4THitsMap.hh:130