30 #define G4THitsMap_h 1
61 template <
typename U = T,
62 typename std::enable_if<std::is_same<U,T>::value,
int>::type=0>
65 std::map<G4int,T*> * aHitsMap = right.
GetMap();
66 typename std::map<G4int,T*>::iterator itr = aHitsMap->begin();
67 for(; itr != aHitsMap->end(); itr++) {
68 add(itr->first, *(itr->second));
73 template <
typename U = T,
74 typename std::enable_if<std::is_same<U,G4double>::value &&
75 std::is_same<T,G4StatDouble>::value,
int>::type=0>
78 std::map<G4int,U*> * aHitsMap = right.
GetMap();
79 typename std::map<G4int,U*>::iterator itr = aHitsMap->begin();
80 for(; itr != aHitsMap->end(); itr++) {
81 typename std::map<G4int,T*>::iterator mapItr = this->
GetMap()->find(itr->first);
82 if(mapItr==this->
GetMap()->end())
83 { (*this->
GetMap())[itr->first] =
new T(0.); }
84 add(itr->first, *(itr->second));
99 inline std::map<G4int,T*>*
GetMap()
const
104 template <
typename U = T,
105 typename std::enable_if<std::is_same<U,T>::value,
int>::type=0>
108 typename std::map<G4int,T*> * theHitsMap =
GetMap();
109 if(theHitsMap->find(key) != theHitsMap->end()) {
110 *(*theHitsMap)[key] += *aHit;
112 (*theHitsMap)[key] = aHit;
114 return theHitsMap->size();
116 template <
typename U = T,
117 typename std::enable_if<std::is_same<U,T>::value,
int>::type=0>
120 typename std::map<G4int,T*> * theHitsMap =
GetMap();
121 if(theHitsMap->find(key) == theHitsMap->end()) {
122 (*theHitsMap)[key] =
new T(0.);
124 *(*theHitsMap)[key] += aHit;
125 return theHitsMap->size();
127 template <
typename U = T,
128 typename std::enable_if<std::is_same<U,G4double>::value &&
129 std::is_same<T,G4StatDouble>::value,
int>::type=0>
132 typename std::map<G4int,T*> * theHitsMap =
GetMap();
133 if(theHitsMap->find(key) == theHitsMap->end()) {
134 (*theHitsMap)[key] =
new T(0.);
136 *(*theHitsMap)[key] += *aHit;
137 return theHitsMap->size();
139 template <
typename U = T,
140 typename std::enable_if<std::is_same<U,G4double>::value &&
141 std::is_same<T,G4StatDouble>::value,
int>::type=0>
144 typename std::map<G4int,T*> * theHitsMap =
GetMap();
145 if(theHitsMap->find(key) == theHitsMap->end()) {
146 (*theHitsMap)[key] =
new T(0.);
148 *(*theHitsMap)[key] += aHit;
149 return theHitsMap->size();
154 template <
typename U = T,
155 typename std::enable_if<std::is_same<U,T>::value,
int>::type=0>
158 typename std::map<G4int,T*> * theHitsMap =
GetMap();
159 if(theHitsMap->find(key) != theHitsMap->end()) {
160 delete (*theHitsMap)[key]->second;
162 (*theHitsMap)[key] = aHit;
163 return theHitsMap->size();
165 template <
typename U = T,
166 typename std::enable_if<std::is_same<U,T>::value,
int>::type=0>
169 typename std::map<G4int,T*> * theHitsMap =
GetMap();
170 if(theHitsMap->find(key) == theHitsMap->end())
171 { (*theHitsMap)[key] =
new T(0.); }
172 *(*theHitsMap)[key] = aHit;
173 return theHitsMap->size();
175 template <
typename U = T,
176 typename std::enable_if<std::is_same<U,G4double>::value &&
177 std::is_same<T,G4StatDouble>::value,
int>::type=0>
180 typename std::map<G4int,T*> * theHitsMap =
GetMap();
181 if(theHitsMap->find(key) != theHitsMap->end()) {
182 delete (*theHitsMap)[key]->second;
184 (*theHitsMap)[key] = aHit;
185 return theHitsMap->size();
187 template <
typename U = T,
188 typename std::enable_if<std::is_same<U,G4double>::value &&
189 std::is_same<T,G4StatDouble>::value,
int>::type=0>
192 typename std::map<G4int,T*> * theHitsMap =
GetMap();
193 if(theHitsMap->find(key) == theHitsMap->end())
194 { (*theHitsMap)[key] =
new T(0.); }
195 *(*theHitsMap)[key] = aHit;
196 return theHitsMap->size();
215 theCollection = (
void*)
new std::map<G4int,T*>;
226 typename std::map<G4int,T*> * theHitsMap = GetMap();
227 typename std::map<G4int,T*>::iterator itr = theHitsMap->begin();
228 for(; itr != theHitsMap->end(); itr++) {
238 template <
typename T>
inline T*
240 std::map<G4int,T*> * theHitsMap = GetMap();
241 if(theHitsMap->find(key) != theHitsMap->end()) {
242 return theHitsMap->find(key)->second;
253 G4cout <<
"G4THitsMap " << SDname <<
" / " << collectionName <<
" --- " << entries() <<
" entries" <<
G4endl;
269 std::map<G4int,T*> * theHitsMap = GetMap();
270 typename std::map<G4int, T*>::iterator itr = theHitsMap->begin();
271 for(; itr != theHitsMap->end(); itr++) {
G4int set(const G4int &key, T *&aHit) const
G4int operator==(const G4THitsMap< T > &right) const
G4int add(const G4int &key, U &aHit) const
G4int set(const G4int &key, T &aHit) const
virtual void DrawAllHits()
T * operator[](G4int key) const
G4int add(const G4int &key, T &aHit) const
G4GLOB_DLL std::ostream G4cout
virtual size_t GetSize() const
G4THitsMap< T > & operator+=(const G4THitsMap< U > &right) const
G4int add(const G4int &key, T *&aHit) const
G4THitsMap< T > & operator+=(const G4THitsMap< T > &right) const
virtual void PrintAllHits()
G4int set(const G4int &key, U &aHit) const
std::map< G4int, T * > * GetMap() const
G4int add(const G4int &key, U *&aHit) const
virtual G4VHit * GetHit(size_t) const
G4int set(const G4int &key, U *&aHit) const