Geant4 11.2.2
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)
 
 ~G4THitsCollection () override
 
G4bool operator== (const G4THitsCollection< T > &right) const
 
void * operator new (size_t)
 
void operator delete (void *anHC)
 
void DrawAllHits () override
 
void PrintAllHits () override
 
T * operator[] (size_t i) const
 
std::vector< T * > * GetVector () const
 
size_t insert (T *aHit)
 
size_t entries () const
 
G4VHitGetHit (size_t i) const override
 
size_t GetSize () const override
 
- Public Member Functions inherited from G4HitsCollection
 ~G4HitsCollection () override=default
 
G4bool operator== (const G4HitsCollection &right) const
 
 G4VHitsCollection ()=default
 
 G4VHitsCollection (G4String detName, G4String colNam)
 
- Public Member Functions inherited from G4VHitsCollection
 G4VHitsCollection ()=default
 
 G4VHitsCollection (G4String detName, G4String colNam)
 
virtual ~G4VHitsCollection ()=default
 
G4bool operator== (const G4VHitsCollection &right) const
 
const G4StringGetName () const
 
const G4StringGetSDname () const
 
void SetColID (G4int i)
 
G4int GetColID () const
 

Additional Inherited Members

- Protected Attributes inherited from G4HitsCollection
void * theCollection = nullptr
 
- Protected Attributes inherited from G4VHitsCollection
G4String collectionName = "Unknown"
 
G4String SDname = "Unknown"
 
G4int colID = -1
 

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 129 of file G4THitsCollection.hh.

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

◆ G4THitsCollection() [2/2]

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

Definition at line 136 of file G4THitsCollection.hh.

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

◆ ~G4THitsCollection()

template<class T >
G4THitsCollection< T >::~G4THitsCollection ( )
override

Definition at line 144 of file G4THitsCollection.hh.

145{
146 auto theHitsCollection = (std::vector<T*>*)theCollection;
147 for (const auto* hit : *theHitsCollection) {
148 delete hit;
149 }
150 theHitsCollection->clear();
151 delete theHitsCollection;
152}

Member Function Documentation

◆ DrawAllHits()

template<class T >
void G4THitsCollection< T >::DrawAllHits ( )
overridevirtual

Reimplemented from G4VHitsCollection.

Definition at line 161 of file G4THitsCollection.hh.

162{
163 auto theHitsCollection = (std::vector<T*>*)theCollection;
164 for (auto* hit : *theHitsCollection) {
165 hit->Draw();
166 }
167}

◆ entries()

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

Definition at line 102 of file G4THitsCollection.hh.

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

◆ GetHit()

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

Reimplemented from G4VHitsCollection.

Definition at line 108 of file G4THitsCollection.hh.

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

◆ GetSize()

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

Reimplemented from G4VHitsCollection.

Definition at line 110 of file G4THitsCollection.hh.

110{ 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.

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

◆ insert()

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

Definition at line 94 of file G4THitsCollection.hh.

95 {
96 auto theHitsCollection = (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 123 of file G4THitsCollection.hh.

124{
125 anHCAllocator_G4MT_TLS_()->FreeSingle((G4HitsCollection*)anHC);
126}
G4DLLIMPORT G4Allocator< G4HitsCollection > *& anHCAllocator_G4MT_TLS_()

◆ operator new()

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

Definition at line 114 of file G4THitsCollection.hh.

115{
116 if (anHCAllocator_G4MT_TLS_() == nullptr) {
118 }
119 return (void*)anHCAllocator_G4MT_TLS_()->MallocSingle();
120}

◆ operator==()

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

Definition at line 155 of file G4THitsCollection.hh.

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

◆ operator[]()

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

Definition at line 87 of file G4THitsCollection.hh.

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

◆ PrintAllHits()

template<class T >
void G4THitsCollection< T >::PrintAllHits ( )
overridevirtual

Reimplemented from G4VHitsCollection.

Definition at line 170 of file G4THitsCollection.hh.

171{
172 auto theHitsCollection = (std::vector<T*>*)theCollection;
173 for (auto* hit : *theHitsCollection) {
174 hit->Print();
175 }
176}

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