Import Geant4 10.5.0.beta source tree
This commit is contained in:
@@ -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); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user