Import Geant4 10.3.0.beta source tree

This commit is contained in:
Gabriele Cosmo
2016-06-30 14:12:05 +02:00
parent a654a7ab1f
commit 4ec577e5c4
2021 changed files with 100995 additions and 78277 deletions
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoreQuantityMessenger.cc 73819 2013-09-12 15:52:52Z gcosmo $
// $Id: G4ScoreQuantityMessenger.cc 94951 2016-01-07 11:58:57Z gcosmo $
//
// ---------------------------------------------------------------------
// Modifications
@@ -502,7 +502,7 @@ void G4ScoreQuantityMessenger::FillTokenVec(G4String newValues, G4TokenVec& toke
G4Tokenizer next(newValues);
G4String val;
while ( !(val = next()).isNull() ) {
while ( !(val = next()).isNull() ) { // Loop checking 12.18.2015 M.Asai
token.push_back(val);
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoringManager.cc 78004 2013-12-02 08:28:23Z gcosmo $
// $Id: G4ScoringManager.cc 94772 2015-12-09 09:46:45Z gcosmo $
//
#include "G4ScoringManager.hh"
@@ -36,7 +36,7 @@
#include "G4DefaultLinearColorMap.hh"
#include "G4ScoreLogColorMap.hh"
G4ThreadLocal G4ScoringManager* G4ScoringManager::fSManager = 0;
G4ThreadLocal G4ScoringManager* G4ScoringManager::fSManager = nullptr;
G4ThreadLocal G4int G4ScoringManager::replicaLevel = 3;
@@ -53,7 +53,7 @@ G4ScoringManager* G4ScoringManager::GetScoringManagerIfExist()
{ return fSManager; }
G4ScoringManager::G4ScoringManager()
: verboseLevel(0),fCurrentMesh(0)
: verboseLevel(0),fCurrentMesh(nullptr)
{
fMessenger = new G4ScoringMessenger(this);
fQuantityMessenger = new G4ScoreQuantityMessenger(this);
@@ -72,7 +72,7 @@ G4ScoringManager::~G4ScoringManager()
delete fColorMapDict;
delete fQuantityMessenger;
delete fMessenger;
fSManager = 0;
fSManager = nullptr;
}
void G4ScoringManager::SetReplicaLevel(G4int lvl)
@@ -82,44 +82,49 @@ G4int G4ScoringManager::GetReplicaLevel()
void G4ScoringManager::Accumulate(G4VHitsCollection* map)
{
G4String wName = map->GetSDname();
G4VScoringMesh* sm = FindMesh(wName);
if(sm == 0) return;
auto sm = FindMesh(map);
if(!sm) return;
if(verboseLevel>9)
{ G4cout << "G4ScoringManager::Accumulate() for " << map->GetSDname() << " / " << map->GetName() << G4endl;
G4cout << " is calling G4VScoringMesh::Accumulate() of " << sm->GetWorldName() << G4endl; }
sm->Accumulate(static_cast<G4THitsMap<double>*>(map));
}
G4VScoringMesh* G4ScoringManager::FindMesh(G4VHitsCollection* map)
{
auto colID = map->GetColID();
G4VScoringMesh* sm = nullptr;
auto msh = fMeshMap.find(colID);
if(msh==fMeshMap.end())
{
auto wName = map->GetSDname();
sm = FindMesh(wName);
fMeshMap[colID] = sm;
}
else
{ sm = (*msh).second; }
return sm;
}
G4VScoringMesh* G4ScoringManager::FindMesh(const G4String& wName)
{
G4VScoringMesh* sm = 0;
for(MeshVecItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
G4String smName = (*itr)->GetWorldName();
if(wName == smName) {
sm = *itr;
break;
}
}
G4VScoringMesh* sm = nullptr;
for(auto msh : fMeshVec)
{ if(msh->GetWorldName()==wName) return msh; }
if(!sm && verboseLevel>9)
{ G4cout << "WARNING : G4ScoringManager::FindMesh() --- <" << wName << "> is not found. Null returned." << G4endl; }
return sm;
return nullptr;
}
void G4ScoringManager::List() const
{
G4cout << "G4ScoringManager has " << GetNumberOfMesh() << " scoring meshes." << G4endl;
for(MeshVecConstItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
(*itr)->List();
}
for(auto msh : fMeshVec) msh->List();
}
void G4ScoringManager::Dump() const
{
for(MeshVecConstItr itr = fMeshVec.begin(); itr != fMeshVec.end(); itr++) {
(*itr)->Dump();
}
for(auto msh : fMeshVec) msh->Dump();
}
void G4ScoringManager::DrawMesh(const G4String& meshName,
@@ -208,7 +213,7 @@ void G4ScoringManager::RegisterScoreColorMap(G4VScoreColorMap* colorMap)
G4VScoreColorMap* G4ScoringManager::GetScoreColorMap(const G4String& mapName)
{
ColorMapDictItr mItr = fColorMapDict->find(mapName);
if(mItr == fColorMapDict->end()) { return 0; }
if(mItr == fColorMapDict->end()) { return nullptr; }
return (mItr->second);
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoringMessenger.cc 81308 2014-05-26 14:28:07Z gcosmo $
// $Id: G4ScoringMessenger.cc 94951 2016-01-07 11:58:57Z gcosmo $
//
// ---------------------------------------------------------------------
@@ -539,7 +539,7 @@ void G4ScoringMessenger::FillTokenVec(G4String newValues, G4TokenVec& token){
G4Tokenizer next(newValues);
G4String val;
while ( !(val = next()).isNull() ) {
while ( !(val = next()).isNull() ) { // Loop checking 12.18.2015 M.Asai
token.push_back(val);
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VScoreColorMap.cc 89185 2015-03-23 16:11:02Z gcosmo $
// $Id: G4VScoreColorMap.cc 94772 2015-12-09 09:46:45Z gcosmo $
//
#include "G4VScoreColorMap.hh"
@@ -41,7 +41,7 @@
#include "G4Polyhedron.hh"
G4VScoreColorMap::G4VScoreColorMap(G4String mName)
:fName(mName),ifFloat(true),fMinVal(0.),fMaxVal(DBL_MAX),fVisManager(0)
:fName(mName),ifFloat(true),fMinVal(0.),fMaxVal(DBL_MAX),fVisManager(nullptr)
{;}
G4VScoreColorMap::~G4VScoreColorMap()
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VScoreWriter.cc 67992 2013-03-13 10:59:57Z gcosmo $
// $Id: G4VScoreWriter.cc 94772 2015-12-09 09:46:45Z gcosmo $
//
#include "G4VScoreWriter.hh"
@@ -38,7 +38,7 @@
#include <fstream>
G4VScoreWriter::G4VScoreWriter()
: fScoringMesh(0), verboseLevel(0) {
: fScoringMesh(nullptr), verboseLevel(0) {
fNMeshSegments[0] = fNMeshSegments[1] = fNMeshSegments[2] = 0;
}
+40 -42
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VScoringMesh.cc 83518 2014-08-27 12:57:10Z gcosmo $
// $Id: G4VScoringMesh.cc 96535 2016-04-20 12:14:15Z gcosmo $
//
// ---------------------------------------------------------------------
// Modifications
@@ -44,11 +44,11 @@
#include "G4SDManager.hh"
G4VScoringMesh::G4VScoringMesh(const G4String& wName)
: fWorldName(wName),fCurrentPS(0),fConstructed(false),fActive(true),fShape(undefinedMesh),
fRotationMatrix(0), fMFD(new G4MultiFunctionalDetector(wName)),
: fWorldName(wName),fCurrentPS(nullptr),fConstructed(false),fActive(true),fShape(undefinedMesh),
fRotationMatrix(nullptr), fMFD(new G4MultiFunctionalDetector(wName)),
verboseLevel(0),sizeIsSet(false),nMeshIsSet(false),
fDrawUnit(""), fDrawUnitValue(1.), fMeshElementLogical(0),
fParallelWorldProcess(0), fGeometryHasBeenDestroyed(false)
fDrawUnit(""), fDrawUnitValue(1.), fMeshElementLogical(nullptr),
fParallelWorldProcess(nullptr), fGeometryHasBeenDestroyed(false)
{
G4SDManager::GetSDMpointer()->AddNewDetector(fMFD);
@@ -57,19 +57,19 @@ G4VScoringMesh::G4VScoringMesh(const G4String& wName)
fDivisionAxisNames[0] = fDivisionAxisNames[1] = fDivisionAxisNames[2] = "";
}
G4VScoringMesh::~G4VScoringMesh()
{
G4VScoringMesh::~G4VScoringMesh() {
;
}
void G4VScoringMesh::ResetScore() {
if(verboseLevel > 9) G4cout << "G4VScoringMesh::ResetScore() is called." << G4endl;
std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.begin();
for(; itr != fMap.end(); itr++) {
if(verboseLevel > 9) G4cout << "G4VScoringMesh::ResetScore()" << itr->first << G4endl;
itr->second->clear();
for(auto mp : fMap)
{
if(verboseLevel > 9) G4cout << "G4VScoringMesh::ResetScore()" << mp.first << G4endl;
mp.second->clear();
}
}
void G4VScoringMesh::SetSize(G4double size[3]) {
if ( !sizeIsSet ){
for(int i = 0; i < 3; i++) fSize[i] = size[i];
@@ -105,46 +105,47 @@ void G4VScoringMesh::GetNumberOfSegments(G4int nSegment[3]) {
for(int i = 0; i < 3; i++) nSegment[i] = fNSegment[i];
}
void G4VScoringMesh::RotateX(G4double delta) {
if(fRotationMatrix == 0) fRotationMatrix = new G4RotationMatrix();
if(!fRotationMatrix) fRotationMatrix = new G4RotationMatrix();
fRotationMatrix->rotateX(delta);
}
void G4VScoringMesh::RotateY(G4double delta) {
if(fRotationMatrix == 0) fRotationMatrix = new G4RotationMatrix();
if(!fRotationMatrix) fRotationMatrix = new G4RotationMatrix();
fRotationMatrix->rotateY(delta);
}
void G4VScoringMesh::RotateZ(G4double delta) {
if(fRotationMatrix == 0) fRotationMatrix = new G4RotationMatrix();
if(!fRotationMatrix) fRotationMatrix = new G4RotationMatrix();
fRotationMatrix->rotateZ(delta);
}
void G4VScoringMesh::SetPrimitiveScorer(G4VPrimitiveScorer * ps) {
void G4VScoringMesh::SetPrimitiveScorer(G4VPrimitiveScorer * prs) {
if(!ReadyForQuantity())
{
G4cerr << "ERROR : G4VScoringMesh::SetPrimitiveScorer() : " << ps->GetName()
G4cerr << "ERROR : G4VScoringMesh::SetPrimitiveScorer() : "
<< prs->GetName()
<< " does not yet have mesh size or number of bins. Set them first." << G4endl
<< "This Method is ignored." << G4endl;
return;
}
if(verboseLevel > 0) G4cout << "G4VScoringMesh::SetPrimitiveScorer() : "
<< ps->GetName() << " is registered."
<< prs->GetName() << " is registered."
<< " 3D size: ("
<< fNSegment[0] << ", "
<< fNSegment[1] << ", "
<< fNSegment[2] << ")" << G4endl;
ps->SetNijk(fNSegment[0], fNSegment[1], fNSegment[2]);
fCurrentPS = ps;
fMFD->RegisterPrimitive(ps);
G4THitsMap<G4double> * map = new G4THitsMap<G4double>(fWorldName, ps->GetName());
fMap[ps->GetName()] = map;
prs->SetNijk(fNSegment[0], fNSegment[1], fNSegment[2]);
fCurrentPS = prs;
fMFD->RegisterPrimitive(prs);
G4THitsMap<G4double> * map = new G4THitsMap<G4double>(fWorldName, prs->GetName());
fMap[prs->GetName()] = map;
}
void G4VScoringMesh::SetFilter(G4VSDFilter * filter) {
if(fCurrentPS == 0) {
if(!fCurrentPS) {
G4cerr << "ERROR : G4VScoringMesh::SetSDFilter() : a quantity must be defined first. This method is ignored." << G4endl;
return;
}
@@ -164,7 +165,7 @@ void G4VScoringMesh::SetFilter(G4VSDFilter * filter) {
void G4VScoringMesh::SetCurrentPrimitiveScorer(const G4String & name) {
fCurrentPS = GetPrimitiveScorer(name);
if(fCurrentPS == 0) {
if(!fCurrentPS) {
G4cerr << "ERROR : G4VScoringMesh::SetCurrentPrimitiveScorer() : The primitive scorer <"
<< name << "> does not found." << G4endl;
}
@@ -186,8 +187,8 @@ G4String G4VScoringMesh::GetPSUnit(const G4String & psname) {
}
G4String G4VScoringMesh::GetCurrentPSUnit(){
G4String unit = "";
if(fCurrentPS == 0) {
G4String unit = "";
if(!fCurrentPS) {
G4String msg = "ERROR : G4VScoringMesh::GetCurrentPSUnit() : ";
msg += " Current primitive scorer is null.";
G4cerr << msg << G4endl;
@@ -198,7 +199,7 @@ G4String G4VScoringMesh::GetCurrentPSUnit(){
}
void G4VScoringMesh::SetCurrentPSUnit(const G4String& unit){
if(fCurrentPS == 0) {
if(!fCurrentPS) {
G4String msg = "ERROR : G4VScoringMesh::GetCurrentPSUnit() : ";
msg += " Current primitive scorer is null.";
G4cerr << msg << G4endl;
@@ -221,15 +222,15 @@ void G4VScoringMesh::GetDivisionAxisNames(G4String divisionAxisNames[3]) {
}
G4VPrimitiveScorer * G4VScoringMesh::GetPrimitiveScorer(const G4String & name) {
if(fMFD == 0) return 0;
if(!fMFD) return nullptr;
G4int nps = fMFD->GetNumberOfPrimitives();
for(G4int i = 0; i < nps; i++) {
G4VPrimitiveScorer * ps = fMFD->GetPrimitive(i);
if(name == ps->GetName()) return ps;
G4VPrimitiveScorer * prs = fMFD->GetPrimitive(i);
if(name == prs->GetName()) return prs;
}
return 0;
return nullptr;
}
void G4VScoringMesh::List() const {
@@ -261,25 +262,22 @@ void G4VScoringMesh::List() const {
G4cout << " registered primitve scorers : " << G4endl;
G4int nps = fMFD->GetNumberOfPrimitives();
G4VPrimitiveScorer * ps;
G4VPrimitiveScorer * prs;
for(int i = 0; i < nps; i++) {
ps = fMFD->GetPrimitive(i);
G4cout << " " << i << " " << ps->GetName();
if(ps->GetFilter() != 0) G4cout << " with " << ps->GetFilter()->GetName();
prs = fMFD->GetPrimitive(i);
G4cout << " " << i << " " << prs->GetName();
if(prs->GetFilter() != 0) G4cout << " with " << prs->GetFilter()->GetName();
G4cout << G4endl;
}
}
void G4VScoringMesh::Dump() {
G4cout << "scoring mesh name: " << fWorldName << G4endl;
G4cout << "# of G4THitsMap : " << fMap.size() << G4endl;
std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.begin();
for(; itr != fMap.end(); itr++) {
G4cout << "[" << itr->first << "]" << G4endl;
itr->second->PrintAllHits();
for(auto mp : fMap)
{
G4cout << "[" << mp.first << "]" << G4endl;
mp.second->PrintAllHits();
}
G4cout << G4endl;