Import Geant4 11.1.0.beta source tree
This commit is contained in:
@@ -92,22 +92,16 @@ extern G4DLLIMPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
|
||||
|
||||
inline void* G4DCofThisEvent::operator new(size_t)
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
if(anDCoTHAllocator_G4MT_TLS_() == nullptr)
|
||||
{
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
G4Allocator<G4DCofThisEvent>& anDCoTHAllocator =
|
||||
*anDCoTHAllocator_G4MT_TLS_();
|
||||
void* anDCoTH;
|
||||
anDCoTH = (void*) anDCoTHAllocator.MallocSingle();
|
||||
return anDCoTH;
|
||||
}
|
||||
return (void*) anDCoTHAllocator_G4MT_TLS_()->MallocSingle();
|
||||
}
|
||||
|
||||
inline void G4DCofThisEvent::operator delete(void* anDCoTH)
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
G4Allocator<G4DCofThisEvent>& anDCoTHAllocator =
|
||||
*anDCoTHAllocator_G4MT_TLS_();
|
||||
anDCoTHAllocator.FreeSingle((G4DCofThisEvent*) anDCoTH);
|
||||
anDCoTHAllocator_G4MT_TLS_()->FreeSingle((G4DCofThisEvent*) anDCoTH);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -87,22 +87,16 @@ class G4TDigiCollection : public G4DigiCollection
|
||||
public: // with description
|
||||
inline T* operator[](size_t i) const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return (*((std::vector<T*>*) theCollection))[i];
|
||||
}
|
||||
// Returns a pointer to a concrete digi object.
|
||||
inline std::vector<T*>* GetVector() const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return (std::vector<T*>*) theCollection;
|
||||
}
|
||||
// Returns a collection vector.
|
||||
inline size_t insert(T* aHit)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
|
||||
theDigiCollection->push_back(aHit);
|
||||
return theDigiCollection->size();
|
||||
@@ -111,8 +105,6 @@ class G4TDigiCollection : public G4DigiCollection
|
||||
// collection is returned.
|
||||
inline size_t entries() const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
|
||||
return theDigiCollection->size();
|
||||
}
|
||||
@@ -121,14 +113,10 @@ class G4TDigiCollection : public G4DigiCollection
|
||||
public:
|
||||
virtual G4VDigi* GetDigi(size_t i) const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return (*((std::vector<T*>*) theCollection))[i];
|
||||
}
|
||||
virtual size_t GetSize() const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return ((std::vector<T*>*) theCollection)->size();
|
||||
}
|
||||
};
|
||||
@@ -136,31 +124,22 @@ class G4TDigiCollection : public G4DigiCollection
|
||||
template <class T>
|
||||
inline void* G4TDigiCollection<T>::operator new(size_t)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
if(aDCAllocator_G4MT_TLS_() == nullptr)
|
||||
{
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
G4Allocator<G4DigiCollection>& aDCAllocator = *aDCAllocator_G4MT_TLS_();
|
||||
void* aDC;
|
||||
aDC = (void*) aDCAllocator.MallocSingle();
|
||||
return aDC;
|
||||
}
|
||||
return (void*) aDCAllocator_G4MT_TLS_()->MallocSingle();
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline void G4TDigiCollection<T>::operator delete(void* aDC)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
G4Allocator<G4DigiCollection>& aDCAllocator = *aDCAllocator_G4MT_TLS_();
|
||||
;
|
||||
;
|
||||
;
|
||||
aDCAllocator.FreeSingle((G4DigiCollection*) aDC);
|
||||
aDCAllocator_G4MT_TLS_()->FreeSingle((G4DigiCollection*) aDC);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
G4TDigiCollection<T>::G4TDigiCollection()
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = new std::vector<T*>;
|
||||
theCollection = (void*) theDigiCollection;
|
||||
}
|
||||
@@ -169,9 +148,6 @@ template <class T>
|
||||
G4TDigiCollection<T>::G4TDigiCollection(G4String detName, G4String colNam)
|
||||
: G4DigiCollection(detName, colNam)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
|
||||
std::vector<T*>* theDigiCollection = new std::vector<T*>;
|
||||
theCollection = (void*) theDigiCollection;
|
||||
}
|
||||
@@ -179,10 +155,8 @@ G4TDigiCollection<T>::G4TDigiCollection(G4String detName, G4String colNam)
|
||||
template <class T>
|
||||
G4TDigiCollection<T>::~G4TDigiCollection()
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
|
||||
// theDigiCollection->clearAndDestroy();
|
||||
|
||||
for(size_t i = 0; i < theDigiCollection->size(); i++)
|
||||
{
|
||||
delete(*theDigiCollection)[i];
|
||||
@@ -194,16 +168,12 @@ G4TDigiCollection<T>::~G4TDigiCollection()
|
||||
template <class T>
|
||||
G4bool G4TDigiCollection<T>::operator==(const G4TDigiCollection<T>& right) const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return (collectionName == right.collectionName);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
void G4TDigiCollection<T>::DrawAllDigi()
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
|
||||
size_t n = theDigiCollection->size();
|
||||
for(size_t i = 0; i < n; i++)
|
||||
@@ -215,8 +185,6 @@ void G4TDigiCollection<T>::DrawAllDigi()
|
||||
template <class T>
|
||||
void G4TDigiCollection<T>::PrintAllDigi()
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
std::vector<T*>* theDigiCollection = (std::vector<T*>*) theCollection;
|
||||
size_t n = theDigiCollection->size();
|
||||
for(size_t i = 0; i < n; i++)
|
||||
|
||||
Reference in New Issue
Block a user