Geant4 9.6.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 ()
 
G4int 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
 
G4int insert (T *aHit)
 
G4int 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 ()
 
G4int operator== (const G4HitsCollection &right) const
 
- Public Member Functions inherited from G4VHitsCollection
 G4VHitsCollection ()
 
 G4VHitsCollection (G4String detName, G4String colNam)
 
virtual ~G4VHitsCollection ()
 
G4int operator== (const G4VHitsCollection &right) const
 
virtual void DrawAllHits ()
 
virtual void PrintAllHits ()
 
G4String GetName ()
 
G4String GetSDname ()
 
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
 

Detailed Description

template<class T>
class G4THitsCollection< T >

Definition at line 67 of file G4THitsCollection.hh.

Constructor & Destructor Documentation

◆ G4THitsCollection() [1/2]

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

Definition at line 130 of file G4THitsCollection.hh.

131{
132 std::vector<T*> * theHitsCollection
133 = new std::vector<T*>;
134 theCollection = (void*)theHitsCollection;
135}

◆ G4THitsCollection() [2/2]

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

Definition at line 137 of file G4THitsCollection.hh.

138: G4HitsCollection(detName,colNam)
139{
140 std::vector<T*> * theHitsCollection
141 = new std::vector<T*>;
142 theCollection = (void*)theHitsCollection;
143}

◆ ~G4THitsCollection()

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

Definition at line 145 of file G4THitsCollection.hh.

146{
147 std::vector<T*> * theHitsCollection
148 = (std::vector<T*>*)theCollection;
149 //theHitsCollection->clearAndDestroy();
150 for(size_t i=0;i<theHitsCollection->size();i++)
151 { delete (*theHitsCollection)[i]; }
152 theHitsCollection->clear();
153 delete theHitsCollection;
154}

Member Function Documentation

◆ DrawAllHits()

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

Reimplemented from G4VHitsCollection.

Definition at line 159 of file G4THitsCollection.hh.

160{
161 std::vector<T*> * theHitsCollection
162 = (std::vector<T*>*)theCollection;
163 size_t n = theHitsCollection->size();
164 for(size_t i=0;i<n;i++)
165 { (*theHitsCollection)[i]->Draw(); }
166}

◆ entries()

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

Definition at line 102 of file G4THitsCollection.hh.

103 {
104 std::vector<T*>*theHitsCollection
105 = (std::vector<T*>*)theCollection;
106 return theHitsCollection->size();
107 }

◆ GetHit()

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

Reimplemented from G4VHitsCollection.

Definition at line 111 of file G4THitsCollection.hh.

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

◆ GetSize()

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

Reimplemented from G4VHitsCollection.

Definition at line 113 of file G4THitsCollection.hh.

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

◆ GetVector()

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

Definition at line 90 of file G4THitsCollection.hh.

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

◆ insert()

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

Definition at line 93 of file G4THitsCollection.hh.

94 {
95 std::vector<T*>*theHitsCollection
96 = (std::vector<T*>*)theCollection;
97 theHitsCollection->push_back(aHit);
98 return theHitsCollection->size();
99 }

◆ operator delete()

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

Definition at line 125 of file G4THitsCollection.hh.

126{
127 anHCAllocator.FreeSingle((G4HitsCollection*)anHC);
128}
G4DLLIMPORT G4Allocator< G4HitsCollection > anHCAllocator

◆ operator new()

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

Definition at line 118 of file G4THitsCollection.hh.

119{
120 void* anHC;
121 anHC = (void*)anHCAllocator.MallocSingle();
122 return anHC;
123}

◆ operator==()

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

Definition at line 156 of file G4THitsCollection.hh.

157{ return (collectionName==right.collectionName); }

◆ operator[]()

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

Definition at line 87 of file G4THitsCollection.hh.

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

◆ PrintAllHits()

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

Reimplemented from G4VHitsCollection.

Definition at line 168 of file G4THitsCollection.hh.

169{
170 std::vector<T*> * theHitsCollection
171 = (std::vector<T*>*)theCollection;
172 size_t n = theHitsCollection->size();
173 for(size_t i=0;i<n;i++)
174 { (*theHitsCollection)[i]->Print(); }
175}

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