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
@@ -45,66 +45,82 @@
// GetHC() and GetNumberOfCollections() for accessing to the stored hits
// collection(s).
class G4HCofThisEvent
class G4HCofThisEvent
{
public:
G4HCofThisEvent();
G4HCofThisEvent(G4int cap);
~G4HCofThisEvent();
inline void *operator new(size_t);
inline void operator delete(void* anHCoTE);
public:
G4HCofThisEvent();
G4HCofThisEvent(G4int cap);
~G4HCofThisEvent();
inline void* operator new(size_t);
inline void operator delete(void* anHCoTE);
void AddHitsCollection(G4int HCID,G4VHitsCollection * aHC);
void AddHitsCollection(G4int HCID, G4VHitsCollection* aHC);
G4HCofThisEvent(const G4HCofThisEvent&);
G4HCofThisEvent& operator=(const G4HCofThisEvent&);
private:
std::vector<G4VHitsCollection*> * HC;
G4HCofThisEvent(const G4HCofThisEvent&);
G4HCofThisEvent& operator=(const G4HCofThisEvent&);
public: // with description
inline G4VHitsCollection* GetHC(G4int i)
{ return (*HC)[i]; }
// Returns a pointer to a hits 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 G4SDManager
// and the number can be obtained by G4SDManager::GetHitsCollectionID()
// method.
inline G4int GetNumberOfCollections()
{
G4int n = 0;
for(size_t i=0;i<HC->size();i++)
{
if((*HC)[i]) n++;
}
return n;
}
// Returns the number of hits collections which are stored in this class
// object.
public:
inline size_t GetCapacity()
{
return HC->size();
}
private:
std::vector<G4VHitsCollection*>* HC;
public: // with description
inline G4VHitsCollection* GetHC(G4int i) { return (*HC)[i]; }
// Returns a pointer to a hits 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 G4SDManager
// and the number can be obtained by G4SDManager::GetHitsCollectionID()
// method.
inline G4int GetNumberOfCollections()
{
G4int n = 0;
for(size_t i = 0; i < HC->size(); i++)
{
if((*HC)[i])
n++;
}
return n;
}
// Returns the number of hits collections which are stored in this class
// object.
public:
inline size_t GetCapacity() { return HC->size(); }
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
extern G4DLLEXPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
extern G4DLLIMPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
#endif
inline void* G4HCofThisEvent::operator new(size_t)
{ ;;; if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ; G4Allocator<G4HCofThisEvent> &anHCoTHAllocator = *anHCoTHAllocator_G4MT_TLS_(); ;;;
{
;
;
;
if(!anHCoTHAllocator_G4MT_TLS_())
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
G4Allocator<G4HCofThisEvent>& anHCoTHAllocator =
*anHCoTHAllocator_G4MT_TLS_();
;
;
;
void* anHCoTH;
anHCoTH = (void*)anHCoTHAllocator.MallocSingle();
anHCoTH = (void*) anHCoTHAllocator.MallocSingle();
return anHCoTH;
}
inline void G4HCofThisEvent::operator delete(void* anHCoTH)
{ ;;; if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ; G4Allocator<G4HCofThisEvent> &anHCoTHAllocator = *anHCoTHAllocator_G4MT_TLS_(); ;;;
anHCoTHAllocator.FreeSingle((G4HCofThisEvent*)anHCoTH);
{
;
;
;
if(!anHCoTHAllocator_G4MT_TLS_())
anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
G4Allocator<G4HCofThisEvent>& anHCoTHAllocator =
*anHCoTHAllocator_G4MT_TLS_();
;
;
;
anHCoTHAllocator.FreeSingle((G4HCofThisEvent*) anHCoTH);
}
#endif
@@ -47,149 +47,185 @@
class G4HitsCollection : public G4VHitsCollection
{
public:
G4HitsCollection();
G4HitsCollection(G4String detName,G4String colNam);
virtual ~G4HitsCollection();
G4bool operator==(const G4HitsCollection &right) const;
public:
G4HitsCollection();
G4HitsCollection(G4String detName, G4String colNam);
virtual ~G4HitsCollection();
G4bool operator==(const G4HitsCollection& right) const;
protected:
void* theCollection;
protected:
void* theCollection;
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_();
extern G4DLLEXPORT G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_();
extern G4DLLIMPORT G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_();
#endif
template <class T> class G4THitsCollection : public G4HitsCollection
template <class T>
class G4THitsCollection : public G4HitsCollection
{
public:
G4THitsCollection();
public: // with description
G4THitsCollection(G4String detName,G4String colNam);
// constructor.
public:
virtual ~G4THitsCollection();
G4bool operator==(const G4THitsCollection<T> &right) const;
inline void *operator new(size_t);
inline void operator delete(void* anHC);
public: // with description
virtual void DrawAllHits();
virtual void PrintAllHits();
// These two methods invokes Draw() and Print() methods of all of
// hit objects stored in this collection, respectively.
public:
G4THitsCollection();
public: // with description
inline T* operator[](size_t i) const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (*((std::vector<T*>*)theCollection))[i];
}
// Returns a pointer to a concrete hit object.
inline std::vector<T*>* GetVector() const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (std::vector<T*>*)theCollection; }
// Returns a collection vector.
inline size_t insert(T* aHit)
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>*theHitsCollection = (std::vector<T*>*)theCollection;
theHitsCollection->push_back(aHit);
return theHitsCollection->size();
}
// Insert a hit object. Total number of hit objects stored in this
// collection is returned.
inline size_t entries() const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>*theHitsCollection = (std::vector<T*>*)theCollection;
return theHitsCollection->size();
}
// Returns the number of hit objects stored in this collection
public: // with description
G4THitsCollection(G4String detName, G4String colNam);
// constructor.
public:
virtual ~G4THitsCollection();
G4bool operator==(const G4THitsCollection<T>& right) const;
public:
virtual G4VHit* GetHit(size_t i) const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (*((std::vector<T*>*)theCollection))[i];
}
virtual size_t GetSize() const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return ((std::vector<T*>*)theCollection)->size();
}
inline void* operator new(size_t);
inline void operator delete(void* anHC);
public: // with description
virtual void DrawAllHits();
virtual void PrintAllHits();
// These two methods invokes Draw() and Print() methods of all of
// hit objects stored in this collection, respectively.
public: // with description
inline T* operator[](size_t i) const
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (*((std::vector<T*>*) theCollection))[i];
}
// Returns a pointer to a concrete hit object.
inline std::vector<T*>* GetVector() const
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (std::vector<T*>*) theCollection;
}
// Returns a collection vector.
inline size_t insert(T* aHit)
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
theHitsCollection->push_back(aHit);
return theHitsCollection->size();
}
// Insert a hit object. Total number of hit objects stored in this
// collection is returned.
inline size_t entries() const
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
return theHitsCollection->size();
}
// Returns the number of hit objects stored in this collection
public:
virtual G4VHit* GetHit(size_t i) const
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (*((std::vector<T*>*) theCollection))[i];
}
virtual size_t GetSize() const
{
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return ((std::vector<T*>*) theCollection)->size();
}
};
template <class T> inline void* G4THitsCollection<T>::operator new(size_t)
template <class T>
inline void* G4THitsCollection<T>::operator new(size_t)
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
G4Allocator<G4HitsCollection> &anHCAllocator = *anHCAllocator_G4MT_TLS_(); ;;;
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
G4Allocator<G4HitsCollection>& anHCAllocator = *anHCAllocator_G4MT_TLS_();
;
;
;
void* anHC;
anHC = (void*)anHCAllocator.MallocSingle();
anHC = (void*) anHCAllocator.MallocSingle();
return anHC;
}
template <class T> inline void G4THitsCollection<T>::operator delete(void* anHC)
template <class T>
inline void G4THitsCollection<T>::operator delete(void* anHC)
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
G4Allocator<G4HitsCollection> &anHCAllocator = *anHCAllocator_G4MT_TLS_(); ;;;
anHCAllocator.FreeSingle((G4HitsCollection*)anHC);
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
G4Allocator<G4HitsCollection>& anHCAllocator = *anHCAllocator_G4MT_TLS_();
;
;
;
anHCAllocator.FreeSingle((G4HitsCollection*) anHC);
}
template <class T> G4THitsCollection<T>::G4THitsCollection()
template <class T>
G4THitsCollection<T>::G4THitsCollection()
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection = new std::vector<T*>;
theCollection = (void*)theHitsCollection;
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = new std::vector<T*>;
theCollection = (void*) theHitsCollection;
}
template <class T> G4THitsCollection<T>::G4THitsCollection(G4String detName,G4String colNam)
: G4HitsCollection(detName,colNam)
template <class T>
G4THitsCollection<T>::G4THitsCollection(G4String detName, G4String colNam)
: G4HitsCollection(detName, colNam)
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection = new std::vector<T*>;
theCollection = (void*)theHitsCollection;
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = new std::vector<T*>;
theCollection = (void*) theHitsCollection;
}
template <class T> G4THitsCollection<T>::~G4THitsCollection()
template <class T>
G4THitsCollection<T>::~G4THitsCollection()
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection = (std::vector<T*>*)theCollection;
//theHitsCollection->clearAndDestroy();
for(size_t i=0;i<theHitsCollection->size();++i)
{ delete (*theHitsCollection)[i]; }
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
// theHitsCollection->clearAndDestroy();
for(size_t i = 0; i < theHitsCollection->size(); ++i)
{
delete(*theHitsCollection)[i];
}
theHitsCollection->clear();
delete theHitsCollection;
}
template <class T> G4bool G4THitsCollection<T>::operator==(const G4THitsCollection<T> &right) const
template <class T>
G4bool G4THitsCollection<T>::operator==(const G4THitsCollection<T>& right) const
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (collectionName==right.collectionName);
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (collectionName == right.collectionName);
}
template <class T> void G4THitsCollection<T>::DrawAllHits()
template <class T>
void G4THitsCollection<T>::DrawAllHits()
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection = (std::vector<T*>*)theCollection;
size_t n = theHitsCollection->size();
for(size_t i=0;i<n;++i)
{ (*theHitsCollection)[i]->Draw(); }
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
size_t n = theHitsCollection->size();
for(size_t i = 0; i < n; ++i)
{
(*theHitsCollection)[i]->Draw();
}
}
template <class T> void G4THitsCollection<T>::PrintAllHits()
template <class T>
void G4THitsCollection<T>::PrintAllHits()
{
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection
= (std::vector<T*>*)theCollection;
size_t n = theHitsCollection->size();
for(size_t i=0;i<n;++i)
{ (*theHitsCollection)[i]->Print(); }
if(!anHCAllocator_G4MT_TLS_())
anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>* theHitsCollection = (std::vector<T*>*) theCollection;
size_t n = theHitsCollection->size();
for(size_t i = 0; i < n; ++i)
{
(*theHitsCollection)[i]->Print();
}
}
#endif
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+23 -27
View File
@@ -44,37 +44,33 @@ class G4AttValue;
// If a concrete hit class is used as a transient class, G4Allocator
// must be used.
class G4VHit
class G4VHit
{
public:
G4VHit();
virtual ~G4VHit();
public:
G4VHit();
virtual ~G4VHit();
G4bool operator==(const G4VHit& right) const;
G4bool operator==(const G4VHit &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,43 +41,36 @@ class G4VHit;
// class.
// Geant4 kernel will use this class methods.
class G4VHitsCollection
class G4VHitsCollection
{
public:
G4VHitsCollection();
G4VHitsCollection(G4String detName,G4String colNam);
virtual ~G4VHitsCollection();
G4bool operator==(const G4VHitsCollection &right) const;
public:
G4VHitsCollection();
G4VHitsCollection(G4String detName, G4String colNam);
virtual ~G4VHitsCollection();
G4bool operator==(const G4VHitsCollection& right) const;
virtual void DrawAllHits();
virtual void PrintAllHits();
virtual void DrawAllHits();
virtual void PrintAllHits();
protected:
protected:
// Collection name
G4String collectionName;
G4String SDname;
// Collection ID
G4int colID;
// Collection name
G4String collectionName;
G4String SDname;
// Collection ID
G4int colID;
public:
inline const G4String& GetName() const
{ return collectionName; }
inline const G4String& GetSDname() const
{ return SDname; }
inline void SetColID(G4int i)
{ colID = i; }
inline G4int GetColID() const
{ return colID; }
public:
// GetHit and GetSize are given a default implementation here so
// that the template G4THitsCollection can be used, but they
// are re-implemented G4THitsCollection.
virtual G4VHit* GetHit(size_t) const { return nullptr; }
virtual size_t GetSize() const { return 0; };
public:
inline const G4String& GetName() const { return collectionName; }
inline const G4String& GetSDname() const { return SDname; }
inline void SetColID(G4int i) { colID = i; }
inline G4int GetColID() const { return colID; }
public:
// GetHit and GetSize are given a default implementation here so
// that the template G4THitsCollection can be used, but they
// are re-implemented G4THitsCollection.
virtual G4VHit* GetHit(size_t) const { return nullptr; }
virtual size_t GetSize() const { return 0; };
};
#endif