Import Geant4 11.0.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2021-06-25 16:12:29 +02:00
parent c968e26a39
commit 6399a014b6
4200 changed files with 207479 additions and 237366 deletions
@@ -46,70 +46,68 @@
// GetDC() and GetNumberOfCollections() for accessing to the stored digi
// collection(s).
class G4DCofThisEvent
class G4DCofThisEvent
{
public:
G4DCofThisEvent();
G4DCofThisEvent(G4int cap);
~G4DCofThisEvent();
inline void *operator new(size_t);
inline void operator delete(void* anDCoTE);
public:
G4DCofThisEvent();
G4DCofThisEvent(G4int cap);
~G4DCofThisEvent();
inline void* operator new(size_t);
inline void operator delete(void* anDCoTE);
void AddDigiCollection(G4int DCID,G4VDigiCollection * aDC);
void AddDigiCollection(G4int DCID, G4VDigiCollection* aDC);
G4DCofThisEvent(const G4DCofThisEvent&);
G4DCofThisEvent& operator=(const G4DCofThisEvent&);
private:
std::vector<G4VDigiCollection*> * DC;
G4DCofThisEvent(const G4DCofThisEvent&);
G4DCofThisEvent& operator=(const G4DCofThisEvent&);
public: // with description
inline G4VDigiCollection* GetDC(G4int i) const
{ return (*DC)[i]; }
// Returns a pointer to a digi collection. Null will be returned
// if the particular collection is not stored at the current event.
// The integer argument is ID number which is assigned by G4DigiManager
// and the number can be obtained by G4DigiManager::GetDigiCollectionID()
// method.
inline G4int GetNumberOfCollections() const
{
G4int n = 0;
for(auto dc : *DC) if(dc) n++;
return n;
}
// Returns the number of digi collections which are stored in this class
// object.
public:
inline size_t GetCapacity() const
{
return DC->size();
}
private:
std::vector<G4VDigiCollection*>* DC;
public: // with description
inline G4VDigiCollection* GetDC(G4int i) const { return (*DC)[i]; }
// Returns a pointer to a digi collection. Null will be returned
// if the particular collection is not stored at the current event.
// The integer argument is ID number which is assigned by G4DigiManager
// and the number can be obtained by G4DigiManager::GetDigiCollectionID()
// method.
inline G4int GetNumberOfCollections() const
{
G4int n = 0;
for(auto dc : *DC)
if(dc)
n++;
return n;
}
// Returns the number of digi collections which are stored in this class
// object.
public:
inline size_t GetCapacity() const { return DC->size(); }
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
extern G4DLLEXPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
extern G4DLLIMPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
#endif
inline void* G4DCofThisEvent::operator new(size_t)
{
if (!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
G4Allocator<G4DCofThisEvent>& anDCoTHAllocator =
*anDCoTHAllocator_G4MT_TLS_();
void* anDCoTH;
anDCoTH = (void*)anDCoTHAllocator.MallocSingle();
return anDCoTH;
if(!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
G4Allocator<G4DCofThisEvent>& anDCoTHAllocator =
*anDCoTHAllocator_G4MT_TLS_();
void* anDCoTH;
anDCoTH = (void*) anDCoTHAllocator.MallocSingle();
return anDCoTH;
}
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);
if(!anDCoTHAllocator_G4MT_TLS_())
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
G4Allocator<G4DCofThisEvent>& anDCoTHAllocator =
*anDCoTHAllocator_G4MT_TLS_();
anDCoTHAllocator.FreeSingle((G4DCofThisEvent*) anDCoTH);
}
#endif
@@ -46,153 +46,183 @@
class G4DigiCollection : public G4VDigiCollection
{
public:
G4DigiCollection();
G4DigiCollection(G4String detName,G4String colNam);
virtual ~G4DigiCollection();
G4bool operator==(const G4DigiCollection &right) const;
public:
G4DigiCollection();
G4DigiCollection(G4String detName, G4String colNam);
virtual ~G4DigiCollection();
G4bool operator==(const G4DigiCollection& right) const;
protected:
void* theCollection;
protected:
void* theCollection;
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_();
extern G4DLLEXPORT G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_();
extern G4DLLIMPORT G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_();
#endif
template <class T> class G4TDigiCollection : public G4DigiCollection
template <class T>
class G4TDigiCollection : public G4DigiCollection
{
public:
G4TDigiCollection();
public: // with description
G4TDigiCollection(G4String detName,G4String colNam);
// Constructor.
public:
virtual ~G4TDigiCollection();
G4bool operator==(const G4TDigiCollection &right) const;
inline void *operator new(size_t);
inline void operator delete(void* aDC);
public: // with description
virtual void DrawAllDigi();
virtual void PrintAllDigi();
// These two methods invokes Draw() and Print() methods of all of
// digit objects stored in this collection, respectively.
public:
G4TDigiCollection();
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();
}
// Insert a digi object. Total number of digi objects stored in this
// 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();
}
// Returns the number of digi objcets stored in this collection.
public: // with description
G4TDigiCollection(G4String detName, G4String colNam);
// Constructor.
public:
virtual ~G4TDigiCollection();
G4bool operator==(const G4TDigiCollection& right) const;
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();
}
inline void* operator new(size_t);
inline void operator delete(void* aDC);
public: // with description
virtual void DrawAllDigi();
virtual void PrintAllDigi();
// These two methods invokes Draw() and Print() methods of all of
// digit objects stored in this collection, respectively.
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();
}
// Insert a digi object. Total number of digi objects stored in this
// 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();
}
// Returns the number of digi objcets stored in this collection.
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();
}
};
template <class T> inline void* G4TDigiCollection<T>::operator new(size_t)
template <class T>
inline void* G4TDigiCollection<T>::operator new(size_t)
{
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
G4Allocator<G4DigiCollection> &aDCAllocator = *aDCAllocator_G4MT_TLS_();
void* aDC;
aDC = (void*)aDCAllocator.MallocSingle();
return aDC;
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
G4Allocator<G4DigiCollection>& aDCAllocator = *aDCAllocator_G4MT_TLS_();
void* aDC;
aDC = (void*) aDCAllocator.MallocSingle();
return aDC;
}
template <class T> inline void G4TDigiCollection<T>::operator delete(void* aDC)
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);
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
G4Allocator<G4DigiCollection>& aDCAllocator = *aDCAllocator_G4MT_TLS_();
;
;
;
aDCAllocator.FreeSingle((G4DigiCollection*) aDC);
}
template <class T> G4TDigiCollection<T>::G4TDigiCollection()
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;
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>* theDigiCollection = new std::vector<T*>;
theCollection = (void*) theDigiCollection;
}
template <class T> G4TDigiCollection<T>::G4TDigiCollection(G4String detName,G4String colNam)
: G4DigiCollection(detName,colNam)
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;
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>* theDigiCollection = new std::vector<T*>;
theCollection = (void*) theDigiCollection;
}
template <class T> G4TDigiCollection<T>::~G4TDigiCollection()
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]; }
theDigiCollection->clear();
delete theDigiCollection;
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];
}
theDigiCollection->clear();
delete theDigiCollection;
}
template <class T> G4bool G4TDigiCollection<T>::operator==(const G4TDigiCollection<T> &right) const
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);
if(!aDCAllocator_G4MT_TLS_())
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return (collectionName == right.collectionName);
}
template <class T> void G4TDigiCollection<T>::DrawAllDigi()
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++)
{ (*theDigiCollection)[i]->Draw(); }
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++)
{
(*theDigiCollection)[i]->Draw();
}
}
template <class T> void G4TDigiCollection<T>::PrintAllDigi()
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++)
{ (*theDigiCollection)[i]->Print(); }
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++)
{
(*theDigiCollection)[i]->Print();
}
}
#endif
+23 -28
View File
@@ -44,38 +44,33 @@ class G4AttValue;
// If a concrete digi class is used as a transient class, G4Allocator
// must be used.
class G4VDigi
class G4VDigi
{
public:
G4VDigi();
virtual ~G4VDigi();
public:
G4VDigi();
virtual ~G4VDigi();
G4bool operator==(const G4VDigi& right) const;
G4bool operator==(const G4VDigi &right) const;
virtual void Draw();
virtual void Print();
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const
{ return 0; }
// If implemented by a derived class, returns a pointer to a map
// of attribute definitions for the attribute values below. The
// user must test the validity of this pointer. See
// G4Trajectory for an example of a concrete implementation of
// this method.
virtual std::vector<G4AttValue>* CreateAttValues() const
{ return 0; }
// If implemented by a derived class, returns a pointer to a
// list of attribute values suitable, e.g., for picking. Each
// must refer to an attribute definition in the above map; its
// name is the key. The user must test the validity of this
// pointer (it must be non-zero and conform to the G4AttDefs,
// which may be checked with G4AttCheck) and delete the list
// after use. See G4Trajectory for an example of a concrete
// implementation of this method and
// G4VTrajectory::ShowTrajectory for an example of its use.
virtual void Draw();
virtual void Print();
virtual const std::map<G4String, G4AttDef>* GetAttDefs() const { return 0; }
// If implemented by a derived class, returns a pointer to a map
// of attribute definitions for the attribute values below. The
// user must test the validity of this pointer. See
// G4Trajectory for an example of a concrete implementation of
// this method.
virtual std::vector<G4AttValue>* CreateAttValues() const { return 0; }
// If implemented by a derived class, returns a pointer to a
// list of attribute values suitable, e.g., for picking. Each
// must refer to an attribute definition in the above map; its
// name is the key. The user must test the validity of this
// pointer (it must be non-zero and conform to the G4AttDefs,
// which may be checked with G4AttCheck) and delete the list
// after use. See G4Trajectory for an example of a concrete
// implementation of this method and
// G4VTrajectory::ShowTrajectory for an example of its use.
};
#endif
@@ -41,37 +41,32 @@ class G4VDigi;
// class.
// Geant4 kernel will use this class methods.
class G4VDigiCollection
class G4VDigiCollection
{
public:
G4VDigiCollection();
G4VDigiCollection(G4String DMnam,G4String colNam);
virtual ~G4VDigiCollection();
G4bool operator==(const G4VDigiCollection &right) const;
public:
G4VDigiCollection();
G4VDigiCollection(G4String DMnam, G4String colNam);
virtual ~G4VDigiCollection();
G4bool operator==(const G4VDigiCollection& right) const;
virtual void DrawAllDigi();
virtual void PrintAllDigi();
virtual void DrawAllDigi();
virtual void PrintAllDigi();
protected:
protected:
// Collection name
G4String collectionName;
G4String DMname;
// Collection name
G4String collectionName;
G4String DMname;
public:
inline const G4String& GetName() const
{ return collectionName; }
inline const G4String& GetDMname() const
{ return DMname; }
public:
// GetDigi and GetSize are given a default implementation here so
// that the template G4TDigiCollection can be used, but they
// are re-implemented in G4TDigiCollection.
virtual G4VDigi* GetDigi(size_t) const { return 0; }
virtual size_t GetSize() const { return 0; }
public:
inline const G4String& GetName() const { return collectionName; }
inline const G4String& GetDMname() const { return DMname; }
public:
// GetDigi and GetSize are given a default implementation here so
// that the template G4TDigiCollection can be used, but they
// are re-implemented in G4TDigiCollection.
virtual G4VDigi* GetDigi(size_t) const { return 0; }
virtual size_t GetSize() const { return 0; }
};
#endif