Import Geant4 10.5.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2018-06-29 10:58:11 +02:00
parent fe81a77428
commit 6aa23be517
1581 changed files with 124288 additions and 83758 deletions
+8 -2
View File
@@ -1,4 +1,4 @@
$Id: History 108471 2018-02-15 14:12:06Z gcosmo $
$Id: History 110274 2018-05-17 14:44:24Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,10 +17,16 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
January 19, 2018 M. Asai (digits_hits-V10-03-03)
May 17th, 2018 J. Madsen (digits_hits-V10-04-01)
- updated "thread-local-static-var" model to
"function-returning-thread-local-static-reference" model
which fixes Windows DLL + MT
January 19, 2018 M. Asai (digits_hits-V10-04-00)
- G4ScoringMessenger G4ScoreQuantityMessenger:
- UI command returns an error message if a command is refused due
to incorrect parameter(s).
- This tag requires intercoms-V10-04-01 tag.
August 1, 2017 M. Asai (digits_hits-V10-03-02)
- G4SDStructure.cc : fix propagating warning flag. Addressing bug
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DCofThisEvent.hh 94771 2015-12-09 09:44:05Z gcosmo $
// $Id: G4DCofThisEvent.hh 110274 2018-05-17 14:44:24Z gcosmo $
//
#ifndef G4DCofThisEvent_h
@@ -87,21 +87,29 @@ class G4DCofThisEvent
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4ThreadLocal G4Allocator<G4DCofThisEvent> *anDCoTHAllocator_G4MT_TLS_;
extern G4DLLEXPORT G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4ThreadLocal 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
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TDigiCollection.hh 67992 2013-03-13 10:59:57Z gcosmo $
// $Id: G4TDigiCollection.hh 110274 2018-05-17 14:44:24Z gcosmo $
//
#ifndef G4TDigiCollection_h
@@ -58,9 +58,9 @@ class G4DigiCollection : public G4VDigiCollection
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4ThreadLocal G4Allocator<G4DigiCollection> *aDCAllocator_G4MT_TLS_;
extern G4DLLEXPORT G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4ThreadLocal G4Allocator<G4DigiCollection> *aDCAllocator_G4MT_TLS_;
extern G4DLLIMPORT G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_();
#endif
template <class T> class G4TDigiCollection : public G4DigiCollection
@@ -85,19 +85,19 @@ template <class T> class G4TDigiCollection : public G4DigiCollection
public: // with description
inline T* operator[](size_t i) const
{
if (!aDCAllocator_G4MT_TLS_) aDCAllocator_G4MT_TLS_ = new G4Allocator<G4DigiCollection>;
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>;
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return (std::vector<T*>*)theCollection;
}
// Returns a collection vector.
inline G4int insert(T* aHit)
{
if (!aDCAllocator_G4MT_TLS_) aDCAllocator_G4MT_TLS_ = new G4Allocator<G4DigiCollection>;
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>*theDigiCollection
= (std::vector<T*>*)theCollection;
theDigiCollection->push_back(aHit);
@@ -107,7 +107,7 @@ template <class T> class G4TDigiCollection : public G4DigiCollection
// collection is returned.
inline G4int entries() const
{
if (!aDCAllocator_G4MT_TLS_) aDCAllocator_G4MT_TLS_ = new G4Allocator<G4DigiCollection>;
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*>*theDigiCollection
= (std::vector<T*>*)theCollection;
return theDigiCollection->size();
@@ -117,12 +117,12 @@ template <class T> class G4TDigiCollection : public G4DigiCollection
public:
virtual G4VDigi* GetDigi(size_t i) const
{
if (!aDCAllocator_G4MT_TLS_) aDCAllocator_G4MT_TLS_ = new G4Allocator<G4DigiCollection>;
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>;
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
return ((std::vector<T*>*)theCollection)->size();
}
@@ -130,8 +130,8 @@ template <class T> class G4TDigiCollection : public G4DigiCollection
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_;
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
G4Allocator<G4DigiCollection> &aDCAllocator = *aDCAllocator_G4MT_TLS_();
void* aDC;
aDC = (void*)aDCAllocator.MallocSingle();
return aDC;
@@ -139,14 +139,14 @@ template <class T> inline void* G4TDigiCollection<T>::operator new(size_t)
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_; ;;;
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()
{
if (!aDCAllocator_G4MT_TLS_) aDCAllocator_G4MT_TLS_ = new G4Allocator<G4DigiCollection>;
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*> * theDigiCollection = new std::vector<T*>;
theCollection = (void*)theDigiCollection;
}
@@ -154,7 +154,7 @@ template <class T> G4TDigiCollection<T>::G4TDigiCollection()
template <class T> G4TDigiCollection<T>::G4TDigiCollection(G4String detName,G4String colNam)
: G4DigiCollection(detName,colNam)
{
if (!aDCAllocator_G4MT_TLS_) aDCAllocator_G4MT_TLS_ = new G4Allocator<G4DigiCollection>;
if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection>;
std::vector<T*> * theDigiCollection = new std::vector<T*>;
theCollection = (void*)theDigiCollection;
@@ -162,7 +162,7 @@ template <class T> G4TDigiCollection<T>::G4TDigiCollection(G4String detName,G4St
template <class T> G4TDigiCollection<T>::~G4TDigiCollection()
{
if (!aDCAllocator_G4MT_TLS_) aDCAllocator_G4MT_TLS_ = new G4Allocator<G4DigiCollection>;
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++)
@@ -173,13 +173,13 @@ template <class T> G4TDigiCollection<T>::~G4TDigiCollection()
template <class T> G4int G4TDigiCollection<T>::operator==(const G4TDigiCollection<T> &right) const
{
if (!aDCAllocator_G4MT_TLS_) aDCAllocator_G4MT_TLS_ = new G4Allocator<G4DigiCollection>;
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>;
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++)
@@ -188,7 +188,7 @@ template <class T> void G4TDigiCollection<T>::DrawAllDigi()
template <class T> void G4TDigiCollection<T>::PrintAllDigi()
{
if (!aDCAllocator_G4MT_TLS_) aDCAllocator_G4MT_TLS_ = new G4Allocator<G4DigiCollection>;
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++)
@@ -24,21 +24,25 @@
// ********************************************************************
//
//
// $Id: G4DCofThisEvent.cc 81087 2014-05-20 15:44:27Z gcosmo $
// $Id: G4DCofThisEvent.cc 110274 2018-05-17 14:44:24Z gcosmo $
//
#include "G4DCofThisEvent.hh"
#include <algorithm>
G4ThreadLocal G4Allocator<G4DCofThisEvent> *anDCoTHAllocator_G4MT_TLS_ = 0;
G4Allocator<G4DCofThisEvent>*& anDCoTHAllocator_G4MT_TLS_()
{
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++)
{
@@ -47,7 +51,7 @@ G4DCofThisEvent::G4DCofThisEvent(G4int cap)
}
G4DCofThisEvent::~G4DCofThisEvent()
{ if (!anDCoTHAllocator_G4MT_TLS_) anDCoTHAllocator_G4MT_TLS_ = new G4Allocator<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]; }
@@ -56,14 +60,14 @@ G4DCofThisEvent::~G4DCofThisEvent()
}
void G4DCofThisEvent::AddDigiCollection(G4int DCID,G4VDigiCollection * aDC)
{ if (!anDCoTHAllocator_G4MT_TLS_) anDCoTHAllocator_G4MT_TLS_ = new G4Allocator<G4DCofThisEvent> ;
{ 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>;
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));
@@ -72,7 +76,7 @@ G4DCofThisEvent::G4DCofThisEvent(const G4DCofThisEvent& rhs)
G4DCofThisEvent& G4DCofThisEvent::operator=(const G4DCofThisEvent& rhs)
{
if ( this == &rhs ) return *this;
if ( !anDCoTHAllocator_G4MT_TLS_ ) anDCoTHAllocator_G4MT_TLS_ = new G4Allocator<G4DCofThisEvent>;
if ( !anDCoTHAllocator_G4MT_TLS_() ) anDCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4DCofThisEvent>;
for ( std::vector<G4VDigiCollection*>::const_iterator it = DC->begin() ;
it != DC->end() ; ++it )
{
@@ -24,23 +24,27 @@
// ********************************************************************
//
//
// $Id: G4TDigiCollection.cc 67992 2013-03-13 10:59:57Z gcosmo $
// $Id: G4TDigiCollection.cc 110274 2018-05-17 14:44:24Z gcosmo $
//
#include "G4TDigiCollection.hh"
G4ThreadLocal G4Allocator<G4DigiCollection> *aDCAllocator_G4MT_TLS_ = 0;
G4Allocator<G4DigiCollection>*& aDCAllocator_G4MT_TLS_()
{
G4ThreadLocalStatic G4Allocator<G4DigiCollection>* _instance = nullptr;
return _instance;
}
G4DigiCollection::G4DigiCollection() : theCollection((void*)0)
{ if (!aDCAllocator_G4MT_TLS_) aDCAllocator_G4MT_TLS_ = new G4Allocator<G4DigiCollection> ;;}
{ 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> ;;}
{ if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection> ;;}
G4DigiCollection::~G4DigiCollection()
{ if (!aDCAllocator_G4MT_TLS_) aDCAllocator_G4MT_TLS_ = new G4Allocator<G4DigiCollection> ;;}
{ if (!aDCAllocator_G4MT_TLS_()) aDCAllocator_G4MT_TLS_() = new G4Allocator<G4DigiCollection> ;;}
G4int 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> ; return (collectionName==right.collectionName); }
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4HCofThisEvent.hh 81087 2014-05-20 15:44:27Z gcosmo $
// $Id: G4HCofThisEvent.hh 110274 2018-05-17 14:44:24Z gcosmo $
//
#ifndef G4HCofThisEvent_h
@@ -89,20 +89,20 @@ class G4HCofThisEvent
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4ThreadLocal G4Allocator<G4HCofThisEvent> *anHCoTHAllocator_G4MT_TLS_;
extern G4DLLEXPORT G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4ThreadLocal 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();
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_; ;;;
{ ;;; if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ; G4Allocator<G4HCofThisEvent> &anHCoTHAllocator = *anHCoTHAllocator_G4MT_TLS_(); ;;;
anHCoTHAllocator.FreeSingle((G4HCofThisEvent*)anHCoTH);
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4THitsCollection.hh 67992 2013-03-13 10:59:57Z gcosmo $
// $Id: G4THitsCollection.hh 110274 2018-05-17 14:44:24Z gcosmo $
//
#ifndef G4THitsCollection_h
@@ -59,9 +59,9 @@ class G4HitsCollection : public G4VHitsCollection
};
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4ThreadLocal G4Allocator<G4HitsCollection> *anHCAllocator_G4MT_TLS_;
extern G4DLLEXPORT G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_();
#else
extern G4DLLIMPORT G4ThreadLocal G4Allocator<G4HitsCollection> *anHCAllocator_G4MT_TLS_;
extern G4DLLIMPORT G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_();
#endif
template <class T> class G4THitsCollection : public G4HitsCollection
@@ -86,18 +86,18 @@ template <class T> class G4THitsCollection : public G4HitsCollection
public: // with description
inline T* operator[](size_t i) const
{
if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection>;
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>;
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (std::vector<T*>*)theCollection; }
// Returns a collection vector.
inline G4int insert(T* aHit)
{
if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection>;
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();
@@ -106,7 +106,7 @@ template <class T> class G4THitsCollection : public G4HitsCollection
// collection is returned.
inline G4int entries() const
{
if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection>;
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*>*theHitsCollection = (std::vector<T*>*)theCollection;
return theHitsCollection->size();
}
@@ -115,20 +115,20 @@ template <class T> class G4THitsCollection : public G4HitsCollection
public:
virtual G4VHit* GetHit(size_t i) const
{
if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection>;
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>;
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)
{
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();
return anHC;
@@ -136,14 +136,14 @@ template <class T> inline void* G4THitsCollection<T>::operator new(size_t)
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_; ;;;
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()
{
if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection>;
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection = new std::vector<T*>;
theCollection = (void*)theHitsCollection;
}
@@ -151,14 +151,14 @@ template <class T> G4THitsCollection<T>::G4THitsCollection()
template <class T> G4THitsCollection<T>::G4THitsCollection(G4String detName,G4String colNam)
: G4HitsCollection(detName,colNam)
{
if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection>;
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()
{
if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection>;
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++)
@@ -169,13 +169,13 @@ template <class T> G4THitsCollection<T>::~G4THitsCollection()
template <class T> G4int G4THitsCollection<T>::operator==(const G4THitsCollection<T> &right) const
{
if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection>;
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
return (collectionName==right.collectionName);
}
template <class T> void G4THitsCollection<T>::DrawAllHits()
{
if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection>;
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++)
@@ -184,7 +184,7 @@ template <class T> void G4THitsCollection<T>::DrawAllHits()
template <class T> void G4THitsCollection<T>::PrintAllHits()
{
if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection>;
if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection>;
std::vector<T*> * theHitsCollection
= (std::vector<T*>*)theCollection;
size_t n = theHitsCollection->size();
+12 -8
View File
@@ -24,20 +24,24 @@
// ********************************************************************
//
//
// $Id: G4HCofThisEvent.cc 94772 2015-12-09 09:46:45Z gcosmo $
// $Id: G4HCofThisEvent.cc 110274 2018-05-17 14:44:24Z gcosmo $
//
#include "G4HCofThisEvent.hh"
G4ThreadLocal G4Allocator<G4HCofThisEvent> *anHCoTHAllocator_G4MT_TLS_ = 0;
G4Allocator<G4HCofThisEvent>*& anHCoTHAllocator_G4MT_TLS_()
{
G4ThreadLocalStatic G4Allocator<G4HCofThisEvent>* _instance = nullptr;
return _instance;
}
G4HCofThisEvent::G4HCofThisEvent()
{ if (!anHCoTHAllocator_G4MT_TLS_) anHCoTHAllocator_G4MT_TLS_ = new G4Allocator<G4HCofThisEvent> ;
{ if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ;
HC = new std::vector<G4VHitsCollection*>;
}
G4HCofThisEvent::G4HCofThisEvent(G4int cap)
{ if (!anHCoTHAllocator_G4MT_TLS_) anHCoTHAllocator_G4MT_TLS_ = new G4Allocator<G4HCofThisEvent> ;
{ if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ;
HC = new std::vector<G4VHitsCollection*>;
for(G4int i=0;i<cap;i++)
{
@@ -46,7 +50,7 @@ G4HCofThisEvent::G4HCofThisEvent(G4int cap)
}
G4HCofThisEvent::~G4HCofThisEvent()
{ if (!anHCoTHAllocator_G4MT_TLS_) anHCoTHAllocator_G4MT_TLS_ = new G4Allocator<G4HCofThisEvent> ;
{ if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ;
//HC->clearAndDestroy();
for(size_t i=0;i<HC->size();i++)
{ delete (*HC)[i]; }
@@ -55,7 +59,7 @@ G4HCofThisEvent::~G4HCofThisEvent()
}
void G4HCofThisEvent::AddHitsCollection(G4int HCID,G4VHitsCollection * aHC)
{ if (!anHCoTHAllocator_G4MT_TLS_) anHCoTHAllocator_G4MT_TLS_ = new G4Allocator<G4HCofThisEvent> ;
{ if (!anHCoTHAllocator_G4MT_TLS_()) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent> ;
if(HCID>=0 && HCID<G4int(HC->size()))
{
aHC->SetColID(HCID);
@@ -66,7 +70,7 @@ void G4HCofThisEvent::AddHitsCollection(G4int HCID,G4VHitsCollection * aHC)
G4HCofThisEvent::G4HCofThisEvent(const G4HCofThisEvent& rhs)
{
if ( !anHCoTHAllocator_G4MT_TLS_ ) anHCoTHAllocator_G4MT_TLS_ = new G4Allocator<G4HCofThisEvent>;
if ( !anHCoTHAllocator_G4MT_TLS_() ) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
HC = new std::vector<G4VHitsCollection*>(rhs.HC->size());
for ( unsigned int i = 0 ; i<rhs.HC->size() ; ++i)
*(HC->at(i)) = *(rhs.HC->at(i));
@@ -75,7 +79,7 @@ G4HCofThisEvent::G4HCofThisEvent(const G4HCofThisEvent& rhs)
G4HCofThisEvent& G4HCofThisEvent::operator=(const G4HCofThisEvent& rhs)
{
if ( this == &rhs ) return *this;
if ( !anHCoTHAllocator_G4MT_TLS_ ) anHCoTHAllocator_G4MT_TLS_ = new G4Allocator<G4HCofThisEvent>;
if ( !anHCoTHAllocator_G4MT_TLS_() ) anHCoTHAllocator_G4MT_TLS_() = new G4Allocator<G4HCofThisEvent>;
for ( std::vector<G4VHitsCollection*>::const_iterator it = HC->begin() ;
it != HC->end() ; ++it )
{
@@ -24,23 +24,27 @@
// ********************************************************************
//
//
// $Id: G4THitsCollection.cc 67992 2013-03-13 10:59:57Z gcosmo $
// $Id: G4THitsCollection.cc 110274 2018-05-17 14:44:24Z gcosmo $
//
#include "G4THitsCollection.hh"
G4ThreadLocal G4Allocator<G4HitsCollection> *anHCAllocator_G4MT_TLS_ = 0;
G4Allocator<G4HitsCollection>*& anHCAllocator_G4MT_TLS_()
{
G4ThreadLocalStatic G4Allocator<G4HitsCollection>* _instance = nullptr;
return _instance;
}
G4HitsCollection::G4HitsCollection() : theCollection((void*)0)
{ if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection> ;;}
{ if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection> ;;}
G4HitsCollection::G4HitsCollection(G4String detName,G4String colNam)
: G4VHitsCollection(detName,colNam), theCollection((void*)0)
{ if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection> ;;}
{ if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection> ;;}
G4HitsCollection::~G4HitsCollection()
{ if (!anHCAllocator_G4MT_TLS_) anHCAllocator_G4MT_TLS_ = new G4Allocator<G4HitsCollection> ;;}
{ if (!anHCAllocator_G4MT_TLS_()) anHCAllocator_G4MT_TLS_() = new G4Allocator<G4HitsCollection> ;;}
int G4HitsCollection::operator==(const G4HitsCollection &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); }
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoreQuantityMessenger.hh 108471 2018-02-15 14:12:06Z gcosmo $
// $Id: G4ScoreQuantityMessenger.hh 108220 2018-01-19 15:06:38Z gcosmo $
//
// (HISTORY)
// 03-Sep-2007 T.Aso Command definitions are introduced.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoreQuantityMessenger.cc 108471 2018-02-15 14:12:06Z gcosmo $
// $Id: G4ScoreQuantityMessenger.cc 108220 2018-01-19 15:06:38Z gcosmo $
//
// ---------------------------------------------------------------------
// Modifications
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoringMessenger.cc 108471 2018-02-15 14:12:06Z gcosmo $
// $Id: G4ScoringMessenger.cc 108220 2018-01-19 15:06:38Z gcosmo $
//
// ---------------------------------------------------------------------