Geant4-11
Public Member Functions | Protected Attributes
G4THitsCollection< T > Class Template Reference

#include <G4THitsCollection.hh>

Inheritance diagram for G4THitsCollection< T >:
G4HitsCollection G4VHitsCollection

Public Member Functions

virtual void DrawAllHits ()
 
size_t entries () const
 
 G4THitsCollection ()
 
 G4THitsCollection (G4String detName, G4String colNam)
 
G4int GetColID () const
 
virtual G4VHitGetHit (size_t i) const
 
const G4StringGetName () const
 
const G4StringGetSDname () const
 
virtual size_t GetSize () const
 
std::vector< T * > * GetVector () const
 
size_t insert (T *aHit)
 
void operator delete (void *anHC)
 
void * operator new (size_t)
 
G4bool operator== (const G4HitsCollection &right) const
 
G4bool operator== (const G4THitsCollection< T > &right) const
 
G4bool operator== (const G4VHitsCollection &right) const
 
T * operator[] (size_t i) const
 
virtual void PrintAllHits ()
 
void SetColID (G4int i)
 
virtual ~G4THitsCollection ()
 

Protected Attributes

G4int colID
 
G4String collectionName
 
G4String SDname
 
void * theCollection
 

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

165{
168 std::vector<T*>* theHitsCollection = new std::vector<T*>;
169 theCollection = (void*) theHitsCollection;
170}
G4DLLIMPORT G4Allocator< G4HitsCollection > *& anHCAllocator_G4MT_TLS_()

References anHCAllocator_G4MT_TLS_().

◆ G4THitsCollection() [2/2]

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

Definition at line 173 of file G4THitsCollection.hh.

174 : G4HitsCollection(detName, colNam)
175{
178 std::vector<T*>* theHitsCollection = new std::vector<T*>;
179 theCollection = (void*) theHitsCollection;
180}

References anHCAllocator_G4MT_TLS_(), and G4HitsCollection::theCollection.

◆ ~G4THitsCollection()

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

Definition at line 183 of file G4THitsCollection.hh.

184{
187 std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
188 // theHitsCollection->clearAndDestroy();
189 for(size_t i = 0; i < theHitsCollection->size(); ++i)
190 {
191 delete(*theHitsCollection)[i];
192 }
193 theHitsCollection->clear();
194 delete theHitsCollection;
195}

References anHCAllocator_G4MT_TLS_().

Member Function Documentation

◆ DrawAllHits()

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

Reimplemented from G4VHitsCollection.

Definition at line 206 of file G4THitsCollection.hh.

207{
210 std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
211 size_t n = theHitsCollection->size();
212 for(size_t i = 0; i < n; ++i)
213 {
214 (*theHitsCollection)[i]->Draw();
215 }
216}

References anHCAllocator_G4MT_TLS_(), and CLHEP::detail::n.

◆ entries()

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

Definition at line 113 of file G4THitsCollection.hh.

114 {
117 std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
118 return theHitsCollection->size();
119 }

References anHCAllocator_G4MT_TLS_(), and G4HitsCollection::theCollection.

◆ GetColID()

G4int G4VHitsCollection::GetColID ( ) const
inlineinherited

Definition at line 66 of file G4VHitsCollection.hh.

66{ return colID; }

References G4VHitsCollection::colID.

◆ GetHit()

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

Reimplemented from G4VHitsCollection.

Definition at line 123 of file G4THitsCollection.hh.

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

References anHCAllocator_G4MT_TLS_(), and G4HitsCollection::theCollection.

◆ GetName()

const G4String & G4VHitsCollection::GetName ( ) const
inlineinherited

Definition at line 63 of file G4VHitsCollection.hh.

63{ return collectionName; }

References G4VHitsCollection::collectionName.

Referenced by G4SDManager::GetCollectionID().

◆ GetSDname()

const G4String & G4VHitsCollection::GetSDname ( ) const
inlineinherited

Definition at line 64 of file G4VHitsCollection.hh.

64{ return SDname; }

References G4VHitsCollection::SDname.

Referenced by G4SDManager::GetCollectionID().

◆ GetSize()

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

Reimplemented from G4VHitsCollection.

Definition at line 129 of file G4THitsCollection.hh.

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

References anHCAllocator_G4MT_TLS_(), and G4HitsCollection::theCollection.

◆ GetVector()

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

Definition at line 96 of file G4THitsCollection.hh.

97 {
100 return (std::vector<T*>*) theCollection;
101 }

References anHCAllocator_G4MT_TLS_(), and G4HitsCollection::theCollection.

◆ insert()

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

Definition at line 103 of file G4THitsCollection.hh.

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

References anHCAllocator_G4MT_TLS_(), and G4HitsCollection::theCollection.

◆ operator delete()

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

Definition at line 152 of file G4THitsCollection.hh.

153{
157 ;
158 ;
159 ;
160 anHCAllocator.FreeSingle((G4HitsCollection*) anHC);
161}
void FreeSingle(Type *anElement)
Definition: G4Allocator.hh:206

References anHCAllocator_G4MT_TLS_(), and G4Allocator< Type >::FreeSingle().

◆ operator new()

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

Definition at line 138 of file G4THitsCollection.hh.

139{
143 ;
144 ;
145 ;
146 void* anHC;
147 anHC = (void*) anHCAllocator.MallocSingle();
148 return anHC;
149}
Type * MallocSingle()
Definition: G4Allocator.hh:196

References anHCAllocator_G4MT_TLS_(), and G4Allocator< Type >::MallocSingle().

◆ operator==() [1/3]

G4bool G4HitsCollection::operator== ( const G4HitsCollection right) const
inherited

Definition at line 61 of file G4THitsCollection.cc.

62{
65 return (collectionName == right.collectionName);
66}
G4Allocator< G4HitsCollection > *& anHCAllocator_G4MT_TLS_()

References anHCAllocator_G4MT_TLS_(), and G4VHitsCollection::collectionName.

◆ operator==() [2/3]

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

◆ operator==() [3/3]

G4bool G4VHitsCollection::operator== ( const G4VHitsCollection right) const
inherited

Definition at line 49 of file G4VHitsCollection.cc.

50{
51 return ((collectionName == right.collectionName) && (SDname == right.SDname));
52}

References G4VHitsCollection::collectionName, and G4VHitsCollection::SDname.

◆ operator[]()

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

Definition at line 89 of file G4THitsCollection.hh.

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

References anHCAllocator_G4MT_TLS_(), and G4HitsCollection::theCollection.

◆ PrintAllHits()

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

Reimplemented from G4VHitsCollection.

Definition at line 219 of file G4THitsCollection.hh.

220{
223 std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
224 size_t n = theHitsCollection->size();
225 for(size_t i = 0; i < n; ++i)
226 {
227 (*theHitsCollection)[i]->Print();
228 }
229}

References anHCAllocator_G4MT_TLS_(), and CLHEP::detail::n.

◆ SetColID()

void G4VHitsCollection::SetColID ( G4int  i)
inlineinherited

Definition at line 65 of file G4VHitsCollection.hh.

65{ colID = i; }

References G4VHitsCollection::colID.

Referenced by G4HCofThisEvent::AddHitsCollection().

Field Documentation

◆ colID

G4int G4VHitsCollection::colID
protectedinherited

◆ collectionName

G4String G4VHitsCollection::collectionName
protectedinherited

◆ SDname

G4String G4VHitsCollection::SDname
protectedinherited

◆ theCollection

void* G4HitsCollection::theCollection
protectedinherited

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