Import Geant4 11.2.0 source tree
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4NavigationHistory Implementation
|
||||
//
|
||||
// Author: P.Kent, August 96
|
||||
//
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "G4NavigationHistory.hh"
|
||||
|
||||
G4Allocator<G4NavigationHistory>*& aNavigHistoryAllocator()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4NavigationHistory>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4NavigationHistory::G4NavigationHistory()
|
||||
{
|
||||
fNavHistory = G4NavigationHistoryPool::GetInstance()->GetLevels();
|
||||
Clear();
|
||||
}
|
||||
|
||||
G4NavigationHistory::G4NavigationHistory(const G4NavigationHistory &h)
|
||||
{
|
||||
fNavHistory = G4NavigationHistoryPool::GetInstance()->GetLevels();
|
||||
if( GetMaxDepth() != h.GetMaxDepth() )
|
||||
{
|
||||
fNavHistory->resize( h.GetMaxDepth() );
|
||||
}
|
||||
|
||||
for ( auto ilev=G4long(h.fStackDepth); ilev>=0; --ilev )
|
||||
{
|
||||
(*fNavHistory)[ilev] = (*h.fNavHistory)[ilev];
|
||||
}
|
||||
fStackDepth = h.fStackDepth;
|
||||
}
|
||||
|
||||
G4NavigationHistory::~G4NavigationHistory()
|
||||
{
|
||||
G4NavigationHistoryPool::GetInstance()->DeRegister(fNavHistory);
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
operator << (std::ostream& os, const G4NavigationHistory& nav)
|
||||
{
|
||||
os << "History depth=" << nav.GetDepth() << G4endl;
|
||||
for ( G4int i=0; i<=(G4int)nav.GetDepth(); ++i )
|
||||
{
|
||||
os << "Level=["<<i<<"]: ";
|
||||
if( nav.GetVolume(i) != nullptr )
|
||||
{
|
||||
os << "Phys Name=["<< nav.GetVolume(i)->GetName()
|
||||
<< "] Type=[";
|
||||
switch(nav.GetVolumeType(i))
|
||||
{
|
||||
case kNormal:
|
||||
os << "N";
|
||||
break;
|
||||
case kReplica:
|
||||
os << "R" << nav.GetReplicaNo(i);
|
||||
break;
|
||||
case kParameterised:
|
||||
os << "P" << nav.GetReplicaNo(i);
|
||||
break;
|
||||
case kExternal:
|
||||
os << "E" << nav.GetReplicaNo(i);
|
||||
break;
|
||||
}
|
||||
os << "]";
|
||||
}
|
||||
else
|
||||
{
|
||||
os << "Phys = <Null>";
|
||||
}
|
||||
os << G4endl;
|
||||
}
|
||||
return os;
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4NavigationHistoryPool
|
||||
//
|
||||
// Implementation for singleton container
|
||||
//
|
||||
// 07.05.14 G.Cosmo Initial version
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4NavigationHistoryPool.hh"
|
||||
|
||||
// ***************************************************************************
|
||||
// Static class variables
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4ThreadLocal G4NavigationHistoryPool*
|
||||
G4NavigationHistoryPool::fgInstance = nullptr;
|
||||
|
||||
// ***************************************************************************
|
||||
// Private constructor: Construct underlying containers
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4NavigationHistoryPool::G4NavigationHistoryPool()
|
||||
{
|
||||
fPool.reserve(512);
|
||||
fFree.reserve(512);
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Destructor
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4NavigationHistoryPool::~G4NavigationHistoryPool()
|
||||
{
|
||||
Clean(); fgInstance = nullptr;
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Delete all elements from the pool
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4NavigationHistoryPool::Clean()
|
||||
{
|
||||
for(auto & i : fPool)
|
||||
{
|
||||
delete i;
|
||||
}
|
||||
fPool.clear();
|
||||
fFree.clear();
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Print number of entries
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4NavigationHistoryPool::Print() const
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
G4cout << "Total navigation history collections cleaned: "
|
||||
<< fPool.size() << G4endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Delete all elements from the pool
|
||||
// ***************************************************************************
|
||||
//
|
||||
void G4NavigationHistoryPool::Reset()
|
||||
{
|
||||
for(auto & i : fPool)
|
||||
{
|
||||
i = nullptr;
|
||||
}
|
||||
for(auto & j : fFree)
|
||||
{
|
||||
j = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// ***************************************************************************
|
||||
// Return ptr to Store, setting if necessary
|
||||
// ***************************************************************************
|
||||
//
|
||||
G4NavigationHistoryPool* G4NavigationHistoryPool::GetInstance()
|
||||
{
|
||||
if (fgInstance == nullptr)
|
||||
{
|
||||
fgInstance = new G4NavigationHistoryPool;
|
||||
}
|
||||
return fgInstance;
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4NavigationLevel implementation
|
||||
//
|
||||
// 30.09.97 J.Apostolakis Initial version
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4NavigationLevel.hh"
|
||||
|
||||
G4Allocator<G4NavigationLevel>*& aNavigationLevelAllocator()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4NavigationLevel>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4NavigationLevel::G4NavigationLevel( G4VPhysicalVolume* pPhysVol,
|
||||
const G4AffineTransform& afTransform,
|
||||
EVolume volTp,
|
||||
G4int repNo )
|
||||
{
|
||||
fLevelRep = new G4NavigationLevelRep( pPhysVol, afTransform, volTp, repNo );
|
||||
}
|
||||
|
||||
G4NavigationLevel::G4NavigationLevel( G4VPhysicalVolume* pPhysVol,
|
||||
const G4AffineTransform& levelAbove,
|
||||
const G4AffineTransform& relativeCurrent,
|
||||
EVolume volTp,
|
||||
G4int repNo )
|
||||
{
|
||||
fLevelRep = new G4NavigationLevelRep( pPhysVol,
|
||||
levelAbove,
|
||||
relativeCurrent,
|
||||
volTp,
|
||||
repNo );
|
||||
}
|
||||
|
||||
G4NavigationLevel::G4NavigationLevel()
|
||||
{
|
||||
fLevelRep = new G4NavigationLevelRep();
|
||||
}
|
||||
|
||||
G4NavigationLevel::G4NavigationLevel(const G4NavigationLevel& right)
|
||||
: fLevelRep( right.fLevelRep )
|
||||
{
|
||||
fLevelRep->AddAReference();
|
||||
}
|
||||
|
||||
G4NavigationLevel::~G4NavigationLevel()
|
||||
{
|
||||
if( fLevelRep->RemoveAReference() ) { delete fLevelRep; }
|
||||
}
|
||||
|
||||
G4NavigationLevel& G4NavigationLevel::operator=(const G4NavigationLevel &right)
|
||||
{
|
||||
if ( &right != this )
|
||||
{
|
||||
right.fLevelRep->AddAReference();
|
||||
if( fLevelRep->RemoveAReference() ) { delete fLevelRep; }
|
||||
fLevelRep = right.fLevelRep;
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// G4NavigationLevelRep implementation
|
||||
//
|
||||
// 1 October 1997, J.Apostolakis Initial version
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4NavigationLevelRep.hh"
|
||||
|
||||
G4Allocator<G4NavigationLevelRep>*& aNavigLevelRepAllocator()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4NavigationLevelRep>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// class G4TouchableHistory Implementation
|
||||
//
|
||||
// Created: Paul Kent, August 1996
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
#include "G4TouchableHistory.hh"
|
||||
|
||||
G4Allocator<G4TouchableHistory>*& aTouchableHistoryAllocator()
|
||||
{
|
||||
G4ThreadLocalStatic G4Allocator<G4TouchableHistory>* _instance = nullptr;
|
||||
return _instance;
|
||||
}
|
||||
|
||||
G4TouchableHistory::G4TouchableHistory()
|
||||
: ftlate(G4ThreeVector(0.,0.,0.))
|
||||
|
||||
{
|
||||
fhistory.SetFirstEntry(nullptr);
|
||||
}
|
||||
|
||||
G4TouchableHistory::G4TouchableHistory( const G4NavigationHistory& history )
|
||||
: fhistory(history)
|
||||
{
|
||||
const G4AffineTransform& tf = fhistory.GetTopTransform();
|
||||
ftlate = tf.InverseNetTranslation();
|
||||
frot = tf.InverseNetRotation();
|
||||
}
|
||||
|
||||
G4TouchableHistory::~G4TouchableHistory() = default;
|
||||
|
||||
const G4ThreeVector&
|
||||
G4TouchableHistory::GetTranslation(G4int depth) const
|
||||
{
|
||||
// The value returned will change at the next call
|
||||
// Copy it if you want to use it!
|
||||
//
|
||||
static G4ThreadLocal G4ThreeVector* ctrans = nullptr;
|
||||
if ( ctrans == nullptr ) { ctrans = new G4ThreeVector; }
|
||||
if(depth==0.0)
|
||||
{
|
||||
return ftlate;
|
||||
}
|
||||
else
|
||||
{
|
||||
*ctrans =
|
||||
fhistory.GetTransform(CalculateHistoryIndex(depth)).NetTranslation();
|
||||
return *ctrans;
|
||||
}
|
||||
}
|
||||
|
||||
const G4RotationMatrix*
|
||||
G4TouchableHistory::GetRotation(G4int depth) const
|
||||
{
|
||||
// The value returned will change at the next call
|
||||
// Copy it if you want to use it!
|
||||
//
|
||||
static G4ThreadLocal G4RotationMatrix* rotM = nullptr;
|
||||
if ( rotM == nullptr ) { rotM = new G4RotationMatrix; }
|
||||
|
||||
if(depth==0.0)
|
||||
{
|
||||
return &frot;
|
||||
}
|
||||
else
|
||||
{
|
||||
*rotM = fhistory.GetTransform(CalculateHistoryIndex(depth)).NetRotation();
|
||||
return rotM;
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,6 @@
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4VSolid* G4VNestedParameterisation::ComputeSolid(const G4int,
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// class G4VTouchable implementation
|
||||
//
|
||||
// Created: Paul Kent, August 1996
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
#include "G4VTouchable.hh"
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4VPhysicalVolume* G4VTouchable::GetVolume(G4int) const
|
||||
{
|
||||
G4Exception("G4VTouchable::GetVolume()", "GeomMgt0001",
|
||||
FatalException, "Undefined call to base class.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4VSolid* G4VTouchable::GetSolid(G4int) const
|
||||
{
|
||||
G4Exception("G4VTouchable::GetSolid()", "GeomMgt0001",
|
||||
FatalException, "Undefined call to base class.");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4int G4VTouchable::GetReplicaNumber(G4int) const
|
||||
{
|
||||
G4Exception("G4VTouchable::GetReplicaNumber()", "GeomMgt0001",
|
||||
FatalException, "Undefined call to base class.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4int G4VTouchable::MoveUpHistory(G4int)
|
||||
{
|
||||
G4Exception("G4VTouchable::MoveUpHistory()", "GeomMgt0001",
|
||||
FatalException, "Undefined call to base class.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
void G4VTouchable::UpdateYourself(G4VPhysicalVolume*,
|
||||
const G4NavigationHistory* )
|
||||
{
|
||||
G4Exception("G4VTouchable::UpdateYourself()", "GeomMgt0001",
|
||||
FatalException, "Undefined call to base class.");
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
G4int G4VTouchable::GetHistoryDepth() const
|
||||
{
|
||||
G4Exception("G4VTouchable::GetHistoryDepth()", "GeomMgt0001",
|
||||
FatalException, "Undefined call to base class.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
const G4NavigationHistory* G4VTouchable::GetHistory() const
|
||||
{
|
||||
G4Exception("G4VTouchable::GetHistory()", "GeomMgt0001",
|
||||
FatalException, "Undefined call to base class.");
|
||||
return nullptr;
|
||||
}
|
||||
Reference in New Issue
Block a user