Import Geant4 3.1.0 source tree
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// based on the Program) you indicate your acceptance of this statement,
|
||||
// and all its terms.
|
||||
//
|
||||
// $Id: G4TDigiCollection.hh,v 1.5.2.1.2.1 1999/12/07 20:47:46 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-03-00 $
|
||||
// $Id: G4TDigiCollection.hh,v 1.8 2001/02/08 06:07:13 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-03-01 $
|
||||
//
|
||||
|
||||
#ifndef G4TDigiCollection_h
|
||||
@@ -15,7 +15,8 @@
|
||||
#include "G4VDigiCollection.hh"
|
||||
#include "G4Allocator.hh"
|
||||
#include "globals.hh"
|
||||
#include "g4rw/tpordvec.h"
|
||||
//#include "g4rw/tpordvec.h"
|
||||
#include "g4std/vector"
|
||||
|
||||
// class description:
|
||||
//
|
||||
@@ -62,25 +63,25 @@ template <class T> class G4TDigiCollection : public G4DigiCollection
|
||||
|
||||
public: // with description
|
||||
inline T* operator[](size_t i) const
|
||||
{ return (*((G4RWTPtrOrderedVector<T>*)theCollection))[i]; }
|
||||
{ return (*((G4std::vector<T*>*)theCollection))[i]; }
|
||||
// Returns a pointer to a concrete digi object.
|
||||
inline G4RWTPtrOrderedVector<T>* GetVector() const
|
||||
{ return (G4RWTPtrOrderedVector<T>*)theCollection; }
|
||||
inline G4std::vector<T*>* GetVector() const
|
||||
{ return (G4std::vector<T*>*)theCollection; }
|
||||
// Returns a collection vector.
|
||||
inline int insert(T* aHit)
|
||||
{
|
||||
G4RWTPtrOrderedVector<T>*theDigiCollection
|
||||
= (G4RWTPtrOrderedVector<T>*)theCollection;
|
||||
theDigiCollection->insert(aHit);
|
||||
return theDigiCollection->entries();
|
||||
G4std::vector<T*>*theDigiCollection
|
||||
= (G4std::vector<T*>*)theCollection;
|
||||
theDigiCollection->push_back(aHit);
|
||||
return theDigiCollection->size();
|
||||
}
|
||||
// Insert a digi object. Total number of digi objects stored in this
|
||||
// collection is returned.
|
||||
inline int entries() const
|
||||
{
|
||||
G4RWTPtrOrderedVector<T>*theDigiCollection
|
||||
= (G4RWTPtrOrderedVector<T>*)theCollection;
|
||||
return theDigiCollection->entries();
|
||||
G4std::vector<T*>*theDigiCollection
|
||||
= (G4std::vector<T*>*)theCollection;
|
||||
return theDigiCollection->size();
|
||||
}
|
||||
// Returns the number of digi objcets stored in this collection.
|
||||
};
|
||||
@@ -99,24 +100,27 @@ template <class T> inline void G4TDigiCollection<T>::operator delete(void* aDC)
|
||||
|
||||
template <class T> G4TDigiCollection<T>::G4TDigiCollection()
|
||||
{
|
||||
G4RWTPtrOrderedVector<T> * theDigiCollection
|
||||
= new G4RWTPtrOrderedVector<T>;
|
||||
G4std::vector<T*> * theDigiCollection
|
||||
= new G4std::vector<T*>;
|
||||
theCollection = (void*)theDigiCollection;
|
||||
}
|
||||
|
||||
template <class T> G4TDigiCollection<T>::G4TDigiCollection(G4String detName,G4String colNam)
|
||||
: G4DigiCollection(detName,colNam)
|
||||
{
|
||||
G4RWTPtrOrderedVector<T> * theDigiCollection
|
||||
= new G4RWTPtrOrderedVector<T>;
|
||||
G4std::vector<T*> * theDigiCollection
|
||||
= new G4std::vector<T*>;
|
||||
theCollection = (void*)theDigiCollection;
|
||||
}
|
||||
|
||||
template <class T> G4TDigiCollection<T>::~G4TDigiCollection()
|
||||
{
|
||||
G4RWTPtrOrderedVector<T> * theDigiCollection
|
||||
= (G4RWTPtrOrderedVector<T>*)theCollection;
|
||||
theDigiCollection->clearAndDestroy();
|
||||
G4std::vector<T*> * theDigiCollection
|
||||
= (G4std::vector<T*>*)theCollection;
|
||||
//theDigiCollection->clearAndDestroy();
|
||||
for(int i=0;i<theDigiCollection->size();i++)
|
||||
{ delete (*theDigiCollection)[i]; }
|
||||
theDigiCollection->clear();
|
||||
delete theDigiCollection;
|
||||
}
|
||||
|
||||
@@ -125,18 +129,18 @@ template <class T> int G4TDigiCollection<T>::operator==(const G4TDigiCollection<
|
||||
|
||||
template <class T> void G4TDigiCollection<T>::DrawAllDigi()
|
||||
{
|
||||
G4RWTPtrOrderedVector<T> * theDigiCollection
|
||||
= (G4RWTPtrOrderedVector<T>*)theCollection;
|
||||
int n = theDigiCollection->entries();
|
||||
G4std::vector<T*> * theDigiCollection
|
||||
= (G4std::vector<T*>*)theCollection;
|
||||
int n = theDigiCollection->size();
|
||||
for(int i=0;i<n;i++)
|
||||
{ (*theDigiCollection)[i]->Draw(); }
|
||||
}
|
||||
|
||||
template <class T> void G4TDigiCollection<T>::PrintAllDigi()
|
||||
{
|
||||
G4RWTPtrOrderedVector<T> * theDigiCollection
|
||||
= (G4RWTPtrOrderedVector<T>*)theCollection;
|
||||
int n = theDigiCollection->entries();
|
||||
G4std::vector<T*> * theDigiCollection
|
||||
= (G4std::vector<T*>*)theCollection;
|
||||
int n = theDigiCollection->size();
|
||||
for(int i=0;i<n;i++)
|
||||
{ (*theDigiCollection)[i]->Print(); }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user