Geant4  10.03.p01
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
G4THitsCollection< T > Class Template Reference

#include <G4THitsCollection.hh>

Inheritance diagram for G4THitsCollection< T >:
Collaboration diagram for G4THitsCollection< T >:

Public Member Functions

 G4THitsCollection ()
 
 G4THitsCollection (G4String detName, G4String colNam)
 
virtual ~G4THitsCollection ()
 
G4int operator== (const G4THitsCollection< T > &right) const
 
voidoperator 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
 
G4StringGetName ()
 
G4StringGetSDname ()
 
void SetColID (G4int i)
 
G4int GetColID () const
 

Additional Inherited Members

- Protected Attributes inherited from G4HitsCollection
voidtheCollection
 
- Protected Attributes inherited from G4VHitsCollection
G4String collectionName
 
G4String SDname
 
G4int colID
 

Detailed Description

template<class T>
class G4THitsCollection< T >

Definition at line 67 of file G4THitsCollection.hh.

Constructor & Destructor Documentation

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

Definition at line 144 of file G4THitsCollection.hh.

145 {
147  std::vector<T*> * theHitsCollection = new std::vector<T*>;
148  theCollection = (void*)theHitsCollection;
149 }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_
template<class T >
G4THitsCollection< T >::G4THitsCollection ( G4String  detName,
G4String  colNam 
)

Definition at line 151 of file G4THitsCollection.hh.

152 : G4HitsCollection(detName,colNam)
153 {
155  std::vector<T*> * theHitsCollection = new std::vector<T*>;
156  theCollection = (void*)theHitsCollection;
157 }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_
template<class T >
G4THitsCollection< T >::~G4THitsCollection ( )
virtual

Definition at line 159 of file G4THitsCollection.hh.

160 {
162  std::vector<T*> * theHitsCollection = (std::vector<T*>*)theCollection;
163  //theHitsCollection->clearAndDestroy();
164  for(size_t i=0;i<theHitsCollection->size();i++)
165  { delete (*theHitsCollection)[i]; }
166  theHitsCollection->clear();
167  delete theHitsCollection;
168 }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_

Member Function Documentation

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

Reimplemented from G4VHitsCollection.

Definition at line 176 of file G4THitsCollection.hh.

177 {
179  std::vector<T*> * theHitsCollection = (std::vector<T*>*)theCollection;
180  size_t n = theHitsCollection->size();
181  for(size_t i=0;i<n;i++)
182  { (*theHitsCollection)[i]->Draw(); }
183 }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_
template<class T>
G4int G4THitsCollection< T >::entries ( ) const
inline

Definition at line 107 of file G4THitsCollection.hh.

108  {
110  std::vector<T*>*theHitsCollection = (std::vector<T*>*)theCollection;
111  return theHitsCollection->size();
112  }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_
template<class T>
virtual G4VHit* G4THitsCollection< T >::GetHit ( size_t  i) const
inlinevirtual

Reimplemented from G4VHitsCollection.

Definition at line 116 of file G4THitsCollection.hh.

117  {
119  return (*((std::vector<T*>*)theCollection))[i];
120  }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_
template<class T>
virtual size_t G4THitsCollection< T >::GetSize ( ) const
inlinevirtual

Reimplemented from G4VHitsCollection.

Definition at line 121 of file G4THitsCollection.hh.

122  {
124  return ((std::vector<T*>*)theCollection)->size(); }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_
template<class T>
std::vector<T*>* G4THitsCollection< T >::GetVector ( ) const
inline

Definition at line 93 of file G4THitsCollection.hh.

94  {
96  return (std::vector<T*>*)theCollection; }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_
template<class T>
G4int G4THitsCollection< T >::insert ( T *  aHit)
inline

Definition at line 98 of file G4THitsCollection.hh.

99  {
101  std::vector<T*>*theHitsCollection = (std::vector<T*>*)theCollection;
102  theHitsCollection->push_back(aHit);
103  return theHitsCollection->size();
104  }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_
template<class T >
void G4THitsCollection< T >::operator delete ( void anHC)
inline

Definition at line 137 of file G4THitsCollection.hh.

138 {
141  anHCAllocator.FreeSingle((G4HitsCollection*)anHC);
142 }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_
void FreeSingle(Type *anElement)
Definition: G4Allocator.hh:212

Here is the call graph for this function:

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

Definition at line 128 of file G4THitsCollection.hh.

129 {
132  void* anHC;
133  anHC = (void*)anHCAllocator.MallocSingle();
134  return anHC;
135 }
Type * MallocSingle()
Definition: G4Allocator.hh:202
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_

Here is the call graph for this function:

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

Definition at line 170 of file G4THitsCollection.hh.

171 {
173  return (collectionName==right.collectionName);
174 }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_
template<class T>
T* G4THitsCollection< T >::operator[] ( size_t  i) const
inline

Definition at line 87 of file G4THitsCollection.hh.

88  {
90  return (*((std::vector<T*>*)theCollection))[i];
91  }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_
template<class T >
void G4THitsCollection< T >::PrintAllHits ( )
virtual

Reimplemented from G4VHitsCollection.

Definition at line 185 of file G4THitsCollection.hh.

186 {
188  std::vector<T*> * theHitsCollection
189  = (std::vector<T*>*)theCollection;
190  size_t n = theHitsCollection->size();
191  for(size_t i=0;i<n;i++)
192  { (*theHitsCollection)[i]->Print(); }
193 }
G4DLLIMPORT G4ThreadLocal G4Allocator< G4HitsCollection > * anHCAllocator_G4MT_TLS_

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