Geant4 10.7.0
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4THitsCollection< T > Class Template Reference

#include <G4THitsCollection.hh>

+ Inheritance diagram for G4THitsCollection< T >:

Public Member Functions

 G4THitsCollection ()
 
 G4THitsCollection (G4String detName, G4String colNam)
 
virtual ~G4THitsCollection ()
 
G4bool operator== (const G4THitsCollection< T > &right) const
 
void * operator new (size_t)
 
void operator delete (void *anHC)
 
virtual void DrawAllHits ()
 
virtual void PrintAllHits ()
 
T * operator[] (size_t i) const
 
std::vector< T * > * GetVector () const
 
size_t insert (T *aHit)
 
size_t entries () const
 
virtual G4VHitGetHit (size_t i) const
 
virtual size_t GetSize () 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<class T>
class G4THitsCollection< T >

Definition at line 66 of file G4THitsCollection.hh.

Constructor & Destructor Documentation

◆ G4THitsCollection() [1/2]

template<class T >
G4THitsCollection< T >::G4THitsCollection

Definition at line 143 of file G4THitsCollection.hh.

144{
146 std::vector<T*> * theHitsCollection = new std::vector<T*>;
147 theCollection = (void*)theHitsCollection;
148}
G4DLLIMPORT G4Allocator< G4HitsCollection > *& anHCAllocator_G4MT_TLS_()

◆ G4THitsCollection() [2/2]

template<class T >
G4THitsCollection< T >::G4THitsCollection ( G4String  detName,
G4String  colNam 
)

Definition at line 150 of file G4THitsCollection.hh.

151: G4HitsCollection(detName,colNam)
152{
154 std::vector<T*> * theHitsCollection = new std::vector<T*>;
155 theCollection = (void*)theHitsCollection;
156}

◆ ~G4THitsCollection()

template<class T >
G4THitsCollection< T >::~G4THitsCollection
virtual

Definition at line 158 of file G4THitsCollection.hh.

159{
161 std::vector<T*> * theHitsCollection = (std::vector<T*>*)theCollection;
162 //theHitsCollection->clearAndDestroy();
163 for(size_t i=0;i<theHitsCollection->size();++i)
164 { delete (*theHitsCollection)[i]; }
165 theHitsCollection->clear();
166 delete theHitsCollection;
167}

Member Function Documentation

◆ DrawAllHits()

template<class T >
void G4THitsCollection< T >::DrawAllHits
virtual

Reimplemented from G4VHitsCollection.

Definition at line 175 of file G4THitsCollection.hh.

176{
178 std::vector<T*> * theHitsCollection = (std::vector<T*>*)theCollection;
179 size_t n = theHitsCollection->size();
180 for(size_t i=0;i<n;++i)
181 { (*theHitsCollection)[i]->Draw(); }
182}

◆ entries()

template<class T >
size_t G4THitsCollection< T >::entries ( ) const
inline

Definition at line 106 of file G4THitsCollection.hh.

107 {
109 std::vector<T*>*theHitsCollection = (std::vector<T*>*)theCollection;
110 return theHitsCollection->size();
111 }

◆ GetHit()

template<class T >
virtual G4VHit * G4THitsCollection< T >::GetHit ( size_t  i) const
inlinevirtual

Reimplemented from G4VHitsCollection.

Definition at line 115 of file G4THitsCollection.hh.

116 {
118 return (*((std::vector<T*>*)theCollection))[i];
119 }

◆ GetSize()

template<class T >
virtual size_t G4THitsCollection< T >::GetSize ( ) const
inlinevirtual

Reimplemented from G4VHitsCollection.

Definition at line 120 of file G4THitsCollection.hh.

121 {
123 return ((std::vector<T*>*)theCollection)->size();
124 }

◆ GetVector()

template<class T >
std::vector< T * > * G4THitsCollection< T >::GetVector ( ) const
inline

Definition at line 92 of file G4THitsCollection.hh.

93 {
95 return (std::vector<T*>*)theCollection; }

◆ insert()

template<class T >
size_t G4THitsCollection< T >::insert ( T *  aHit)
inline

Definition at line 97 of file G4THitsCollection.hh.

98 {
100 std::vector<T*>*theHitsCollection = (std::vector<T*>*)theCollection;
101 theHitsCollection->push_back(aHit);
102 return theHitsCollection->size();
103 }

◆ operator delete()

template<class T >
void G4THitsCollection< T >::operator delete ( void *  anHC)
inline

Definition at line 136 of file G4THitsCollection.hh.

◆ operator new()

template<class T >
void * G4THitsCollection< T >::operator new ( size_t  )
inline

Definition at line 127 of file G4THitsCollection.hh.

128{
131 void* anHC;
132 anHC = (void*)anHCAllocator.MallocSingle();
133 return anHC;
134}
Type * MallocSingle()
Definition: G4Allocator.hh:196

◆ operator==()

template<class T >
G4bool G4THitsCollection< T >::operator== ( const G4THitsCollection< T > &  right) const

Definition at line 169 of file G4THitsCollection.hh.

◆ operator[]()

template<class T >
T * G4THitsCollection< T >::operator[] ( size_t  i) const
inline

Definition at line 86 of file G4THitsCollection.hh.

87 {
89 return (*((std::vector<T*>*)theCollection))[i];
90 }

◆ PrintAllHits()

template<class T >
void G4THitsCollection< T >::PrintAllHits
virtual

Reimplemented from G4VHitsCollection.

Definition at line 184 of file G4THitsCollection.hh.

185{
187 std::vector<T*> * theHitsCollection
188 = (std::vector<T*>*)theCollection;
189 size_t n = theHitsCollection->size();
190 for(size_t i=0;i<n;++i)
191 { (*theHitsCollection)[i]->Print(); }
192}

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