#include <G4THitsMap.hh>
Inheritance diagram for G4THitsMap< T >:
Public Member Functions | |
G4THitsMap () | |
G4THitsMap (G4String detName, G4String colNam) | |
virtual | ~G4THitsMap () |
G4int | operator== (const G4THitsMap< T > &right) const |
G4THitsMap< T > & | operator+= (const G4THitsMap< T > &right) const |
virtual void | DrawAllHits () |
virtual void | PrintAllHits () |
T * | operator[] (G4int key) const |
std::map< G4int, T * > * | GetMap () const |
G4int | add (const G4int &key, T *&aHit) const |
G4int | add (const G4int &key, T &aHit) const |
G4int | set (const G4int &key, T *&aHit) const |
G4int | set (const G4int &key, T &aHit) const |
G4int | entries () const |
void | clear () |
virtual G4VHit * | GetHit (size_t) const |
virtual size_t | GetSize () const |
Definition at line 46 of file G4THitsMap.hh.
G4THitsMap< T >::G4THitsMap | ( | ) |
Definition at line 91 of file G4THitsMap.hh.
References G4HitsCollection::theCollection.
00092 { 00093 theCollection = (void*)new std::map<G4int,T*>; 00094 }
G4THitsMap< T >::G4THitsMap | ( | G4String | detName, | |
G4String | colNam | |||
) |
Definition at line 96 of file G4THitsMap.hh.
References G4HitsCollection::theCollection.
00097 : G4HitsCollection(detName,colNam) 00098 { 00099 theCollection = (void*)new std::map<G4int,T*>; 00100 }
G4THitsMap< T >::~G4THitsMap | ( | ) | [virtual] |
Definition at line 102 of file G4THitsMap.hh.
References G4THitsMap< T >::GetMap().
00103 { 00104 typename std::map<G4int,T*> * theHitsMap = GetMap(); 00105 typename std::map<G4int,T*>::iterator itr = theHitsMap->begin(); 00106 for(; itr != theHitsMap->end(); itr++) { 00107 delete itr->second; 00108 } 00109 00110 delete theHitsMap; 00111 }
G4int G4THitsMap< T >::add | ( | const G4int & | key, | |
T & | aHit | |||
) | const [inline] |
Definition at line 150 of file G4THitsMap.hh.
References G4THitsMap< T >::GetMap().
00150 { 00151 00152 typename std::map<G4int,T*> * theHitsMap = GetMap(); 00153 if(theHitsMap->find(key) != theHitsMap->end()) { 00154 *(*theHitsMap)[key] += aHit; 00155 } else { 00156 T * hit = new T; 00157 *hit = aHit; 00158 (*theHitsMap)[key] = hit; 00159 } 00160 00161 return theHitsMap->size(); 00162 }
G4int G4THitsMap< T >::add | ( | const G4int & | key, | |
T *& | aHit | |||
) | const [inline] |
Definition at line 138 of file G4THitsMap.hh.
References G4THitsMap< T >::GetMap().
Referenced by G4THitsMap< T >::operator+=().
00138 { 00139 00140 typename std::map<G4int,T*> * theHitsMap = GetMap(); 00141 if(theHitsMap->find(key) != theHitsMap->end()) { 00142 *(*theHitsMap)[key] += *aHit; 00143 } else { 00144 (*theHitsMap)[key] = aHit; 00145 } 00146 return theHitsMap->size(); 00147 }
void G4THitsMap< T >::clear | ( | ) | [inline] |
Definition at line 209 of file G4THitsMap.hh.
References G4THitsMap< T >::GetMap().
00209 { 00210 00211 std::map<G4int,T*> * theHitsMap = GetMap(); 00212 typename std::map<G4int, T*>::iterator itr = theHitsMap->begin(); 00213 for(; itr != theHitsMap->end(); itr++) { 00214 delete itr->second; 00215 } 00216 theHitsMap->clear(); 00217 00218 }
void G4THitsMap< T >::DrawAllHits | ( | ) | [virtual] |
G4int G4THitsMap< T >::entries | ( | ) | const [inline] |
Definition at line 79 of file G4THitsMap.hh.
Referenced by G4THitsMap< T >::PrintAllHits().
00080 { return ((std::map<G4int,T*>*)theCollection)->size(); }
virtual G4VHit* G4THitsMap< T >::GetHit | ( | size_t | ) | const [inline, virtual] |
std::map<G4int,T*>* G4THitsMap< T >::GetMap | ( | ) | const [inline] |
Definition at line 68 of file G4THitsMap.hh.
Referenced by G4THitsMap< T >::add(), G4GMocrenFileSceneHandler::AddCompound(), G4THitsMap< T >::clear(), G4THitsMap< T >::operator+=(), G4THitsMap< T >::operator[](), G4THitsMap< T >::set(), and G4THitsMap< T >::~G4THitsMap().
00069 { return (std::map<G4int,T*>*)theCollection; }
virtual size_t G4THitsMap< T >::GetSize | ( | ) | const [inline, virtual] |
Reimplemented from G4VHitsCollection.
Definition at line 86 of file G4THitsMap.hh.
Referenced by G4VScoringMesh::Accumulate().
00087 { return ((std::map<G4int,T*>*)theCollection)->size(); }
G4THitsMap< T > & G4THitsMap< T >::operator+= | ( | const G4THitsMap< T > & | right | ) | const |
Definition at line 117 of file G4THitsMap.hh.
References G4THitsMap< T >::add(), and G4THitsMap< T >::GetMap().
00118 { 00119 std::map<G4int,T*> * aHitsMap = right.GetMap(); 00120 typename std::map<G4int,T*>::iterator itr = aHitsMap->begin(); 00121 for(; itr != aHitsMap->end(); itr++) { 00122 add(itr->first, *(itr->second)); 00123 } 00124 return (G4THitsMap<T>&)(*this); 00125 }
G4int G4THitsMap< T >::operator== | ( | const G4THitsMap< T > & | right | ) | const |
Definition at line 113 of file G4THitsMap.hh.
References G4VHitsCollection::collectionName.
00114 { return (collectionName==right.collectionName); }
T * G4THitsMap< T >::operator[] | ( | G4int | key | ) | const [inline] |
Definition at line 128 of file G4THitsMap.hh.
References G4THitsMap< T >::GetMap().
00128 { 00129 std::map<G4int,T*> * theHitsMap = GetMap(); 00130 if(theHitsMap->find(key) != theHitsMap->end()) { 00131 return theHitsMap->find(key)->second; 00132 } else { 00133 return 0; 00134 } 00135 }
void G4THitsMap< T >::PrintAllHits | ( | ) | [virtual] |
Reimplemented from G4VHitsCollection.
Definition at line 193 of file G4THitsMap.hh.
References G4VHitsCollection::collectionName, G4THitsMap< T >::entries(), G4cout, G4endl, and G4VHitsCollection::SDname.
Referenced by G4VScoringMesh::Accumulate().
00194 { 00195 G4cout << "G4THitsMap " << SDname << " / " << collectionName << " --- " << entries() << " entries" << G4endl; 00196 /*----- commented out for the use-case where <T> cannot be initialized 00197 to be zero or does not support += operator. 00198 std::map<G4int,T*> * theHitsMap = GetMap(); 00199 typename std::map<G4int, T*>::iterator itr = theHitsMap->begin(); 00200 T sum = 0.; 00201 for(; itr != theHitsMap->end(); itr++) { 00203 sum += *(itr->second); 00204 } 00205 G4cout << " Total : " << sum << G4endl; 00206 ----------------------------------------------------------------------*/ 00207 }
G4int G4THitsMap< T >::set | ( | const G4int & | key, | |
T & | aHit | |||
) | const [inline] |
Definition at line 176 of file G4THitsMap.hh.
References G4THitsMap< T >::GetMap().
00176 { 00177 00178 typename std::map<G4int,T*> * theHitsMap = GetMap(); 00179 if(theHitsMap->find(key) != theHitsMap->end()) { 00180 *(*theHitsMap)[key] = aHit; 00181 } else { 00182 T * hit = new T; 00183 *hit = aHit; 00184 (*theHitsMap)[key] = hit; 00185 } 00186 00187 return theHitsMap->size(); 00188 }
G4int G4THitsMap< T >::set | ( | const G4int & | key, | |
T *& | aHit | |||
) | const [inline] |
Definition at line 165 of file G4THitsMap.hh.
References G4THitsMap< T >::GetMap().
00165 { 00166 00167 typename std::map<G4int,T*> * theHitsMap = GetMap(); 00168 if(theHitsMap->find(key) != theHitsMap->end()) { 00169 delete (*theHitsMap)[key]->second; 00170 } 00171 (*theHitsMap)[key] = aHit; 00172 return theHitsMap->size(); 00173 }