Import Geant4 11.0.0.beta source tree
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
#------------------------------------------------------------------------------
|
||||
# Module : G4digits
|
||||
# Package: Geant4.src.G4digits_hits.G4digits
|
||||
#------------------------------------------------------------------------------
|
||||
# - G4digits module build definition
|
||||
|
||||
#
|
||||
# Define the Geant4 Module.
|
||||
#
|
||||
geant4_define_module(NAME G4digits
|
||||
HEADERS
|
||||
geant4_add_module(G4digits
|
||||
PUBLIC_HEADERS
|
||||
G4DCofThisEvent.hh
|
||||
G4TDigiCollection.hh
|
||||
G4VDigi.hh
|
||||
@@ -16,11 +11,6 @@ geant4_define_module(NAME G4digits
|
||||
G4DCofThisEvent.cc
|
||||
G4TDigiCollection.cc
|
||||
G4VDigi.cc
|
||||
G4VDigiCollection.cc
|
||||
GRANULAR_DEPENDENCIES
|
||||
G4globman
|
||||
GLOBAL_DEPENDENCIES
|
||||
G4global
|
||||
)
|
||||
G4VDigiCollection.cc)
|
||||
|
||||
# List any source specific properties here
|
||||
geant4_module_link_libraries(G4digits PUBLIC G4globman)
|
||||
|
||||
@@ -31,59 +31,73 @@
|
||||
|
||||
G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4DCofThisEvent>* _instance = nullptr;
|
||||
return _instance;
|
||||
G4ThreadLocalStatic G4Allocator<G4DCofThisEvent>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4DCofThisEvent::G4DCofThisEvent()
|
||||
{ if (!anDCoTHAllocator_G4MT_TLS_()) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent> ;
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
DC = new std::vector<G4VDigiCollection*>;
|
||||
}
|
||||
|
||||
G4DCofThisEvent::G4DCofThisEvent(G4int cap)
|
||||
{ if (!anDCoTHAllocator_G4MT_TLS_()) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent> ;
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
DC = new std::vector<G4VDigiCollection*>;
|
||||
for(G4int i=0;i<cap;i++)
|
||||
for(G4int i = 0; i < cap; i++)
|
||||
{
|
||||
DC->push_back((G4VDigiCollection*)0);
|
||||
DC->push_back((G4VDigiCollection*) 0);
|
||||
}
|
||||
}
|
||||
|
||||
G4DCofThisEvent::~G4DCofThisEvent()
|
||||
{ if (!anDCoTHAllocator_G4MT_TLS_()) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent> ;
|
||||
//DC->clearAndDestroy();
|
||||
for(size_t i=0;i<DC->size();i++)
|
||||
{ delete (*DC)[i]; }
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
// DC->clearAndDestroy();
|
||||
for(size_t i = 0; i < DC->size(); i++)
|
||||
{
|
||||
delete(*DC)[i];
|
||||
}
|
||||
DC->clear();
|
||||
delete DC;
|
||||
}
|
||||
|
||||
void G4DCofThisEvent::AddDigiCollection(G4int DCID,G4VDigiCollection * aDC)
|
||||
{ if (!anDCoTHAllocator_G4MT_TLS_()) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent> ;
|
||||
if(DCID>=0 && DCID<G4int(DC->size()))
|
||||
{ (*DC)[DCID] = aDC; }
|
||||
void G4DCofThisEvent::AddDigiCollection(G4int DCID, G4VDigiCollection* aDC)
|
||||
{
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
if(DCID >= 0 && DCID < G4int(DC->size()))
|
||||
{
|
||||
(*DC)[DCID] = aDC;
|
||||
}
|
||||
}
|
||||
|
||||
G4DCofThisEvent::G4DCofThisEvent(const G4DCofThisEvent& rhs)
|
||||
{
|
||||
if ( !anDCoTHAllocator_G4MT_TLS_() ) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
DC = new std::vector<G4VDigiCollection*>(rhs.DC->size());
|
||||
for ( unsigned int i = 0 ; i < rhs.DC->size() ; ++i )
|
||||
*(DC->at(i)) = *(rhs.DC->at(i));
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
DC = new std::vector<G4VDigiCollection*>(rhs.DC->size());
|
||||
for(unsigned int i = 0; i < rhs.DC->size(); ++i)
|
||||
*(DC->at(i)) = *(rhs.DC->at(i));
|
||||
}
|
||||
|
||||
G4DCofThisEvent& G4DCofThisEvent::operator=(const G4DCofThisEvent& rhs)
|
||||
{
|
||||
if ( this == &rhs ) return *this;
|
||||
if ( !anDCoTHAllocator_G4MT_TLS_() ) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
for ( std::vector<G4VDigiCollection*>::const_iterator it = DC->begin() ;
|
||||
it != DC->end() ; ++it )
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
DC->resize(rhs.DC->size());
|
||||
for ( unsigned int i = 0 ; i < rhs.DC->size() ; ++i )
|
||||
*(DC->at(i)) = *(rhs.DC->at(i));
|
||||
if(this == &rhs)
|
||||
return *this;
|
||||
if(!anDCoTHAllocator_G4MT_TLS_())
|
||||
anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
|
||||
for(std::vector<G4VDigiCollection*>::const_iterator it = DC->begin();
|
||||
it != DC->end(); ++it)
|
||||
{
|
||||
delete *it;
|
||||
}
|
||||
DC->resize(rhs.DC->size());
|
||||
for(unsigned int i = 0; i < rhs.DC->size(); ++i)
|
||||
*(DC->at(i)) = *(rhs.DC->at(i));
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,20 +30,37 @@
|
||||
|
||||
G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4DigiCollection>* _instance = nullptr;
|
||||
return _instance;
|
||||
G4ThreadLocalStatic G4Allocator<G4DigiCollection>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4DigiCollection::G4DigiCollection() : theCollection((void*)0)
|
||||
{ if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection> ;;}
|
||||
G4DigiCollection::G4DigiCollection()
|
||||
: theCollection((void*) 0)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
;
|
||||
}
|
||||
|
||||
G4DigiCollection::G4DigiCollection(G4String detName,G4String colNam)
|
||||
: G4VDigiCollection(detName,colNam), theCollection((void*)0)
|
||||
{ if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection> ;;}
|
||||
G4DigiCollection::G4DigiCollection(G4String detName, G4String colNam)
|
||||
: G4VDigiCollection(detName, colNam)
|
||||
, theCollection((void*) 0)
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
;
|
||||
}
|
||||
|
||||
G4DigiCollection::~G4DigiCollection()
|
||||
{ if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection> ;;}
|
||||
|
||||
G4bool G4DigiCollection::operator==(const G4DigiCollection &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>;
|
||||
;
|
||||
}
|
||||
|
||||
G4bool G4DigiCollection::operator==(const G4DigiCollection& right) const
|
||||
{
|
||||
if(!aDCAllocator_G4MT_TLS_())
|
||||
aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
|
||||
return (collectionName == right.collectionName);
|
||||
}
|
||||
|
||||
@@ -30,18 +30,15 @@
|
||||
#include "G4VDigi.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
G4VDigi::G4VDigi()
|
||||
{;}
|
||||
G4VDigi::G4VDigi() { ; }
|
||||
|
||||
G4VDigi::~G4VDigi()
|
||||
{;}
|
||||
G4VDigi::~G4VDigi() { ; }
|
||||
|
||||
G4bool G4VDigi::operator==(const G4VDigi &right) const
|
||||
{ return (this==&right); }
|
||||
G4bool G4VDigi::operator==(const G4VDigi& right) const
|
||||
{
|
||||
return (this == &right);
|
||||
}
|
||||
|
||||
void G4VDigi::Draw()
|
||||
{;}
|
||||
|
||||
void G4VDigi::Print()
|
||||
{;}
|
||||
void G4VDigi::Draw() { ; }
|
||||
|
||||
void G4VDigi::Print() { ; }
|
||||
|
||||
@@ -33,27 +33,22 @@
|
||||
G4VDigiCollection::G4VDigiCollection()
|
||||
{
|
||||
collectionName = "Unknown";
|
||||
DMname = "Unknown";
|
||||
DMname = "Unknown";
|
||||
}
|
||||
|
||||
G4VDigiCollection::G4VDigiCollection(G4String DMnam,G4String colNam)
|
||||
G4VDigiCollection::G4VDigiCollection(G4String DMnam, G4String colNam)
|
||||
{
|
||||
collectionName = colNam;
|
||||
DMname = DMnam;
|
||||
DMname = DMnam;
|
||||
}
|
||||
|
||||
G4VDigiCollection::~G4VDigiCollection()
|
||||
{ ; }
|
||||
G4VDigiCollection::~G4VDigiCollection() { ; }
|
||||
|
||||
G4bool G4VDigiCollection::operator==(const G4VDigiCollection &right) const
|
||||
{
|
||||
return ((collectionName==right.collectionName)
|
||||
&&(DMname==right.DMname));
|
||||
G4bool G4VDigiCollection::operator==(const G4VDigiCollection& right) const
|
||||
{
|
||||
return ((collectionName == right.collectionName) && (DMname == right.DMname));
|
||||
}
|
||||
|
||||
void G4VDigiCollection::DrawAllDigi()
|
||||
{;}
|
||||
|
||||
void G4VDigiCollection::PrintAllDigi()
|
||||
{;}
|
||||
void G4VDigiCollection::DrawAllDigi() { ; }
|
||||
|
||||
void G4VDigiCollection::PrintAllDigi() { ; }
|
||||
|
||||
Reference in New Issue
Block a user