Import Geant4 10.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-12-09 12:35:28 +01:00
parent 4ec577e5c4
commit a3452e42ac
3514 changed files with 210500 additions and 89628 deletions
+14 -13
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoringBox.cc 89031 2015-03-18 08:40:48Z gcosmo $
// $Id: G4ScoringBox.cc 99154 2016-09-07 08:06:30Z gcosmo $
//
#include "G4ScoringBox.hh"
@@ -46,6 +46,7 @@
#include "G4Polyhedron.hh"
#include "G4ScoringManager.hh"
#include "G4StatDouble.hh"
#include <map>
#include <fstream>
@@ -236,7 +237,7 @@ void G4ScoringBox::List() const {
G4VScoringMesh::List();
}
void G4ScoringBox::Draw(std::map<G4int, G4double*> * map,
void G4ScoringBox::Draw(RunScore * map,
G4VScoreColorMap* colorMap, G4int axflg) {
G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance();
@@ -263,13 +264,13 @@ void G4ScoringBox::Draw(std::map<G4int, G4double*> * map,
// projections
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->end(); itr++) {
std::map<G4int, G4StatDouble*>::iterator itr = map->GetMap()->begin();
for(; itr != map->GetMap()->end(); itr++) {
GetXYZ(itr->first, q);
xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
xycell[q[0]][q[1]] += (itr->second->sum_wx())/fDrawUnitValue;
yzcell[q[1]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
xzcell[q[0]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
}
// search max. & min. values in each slice
@@ -518,7 +519,7 @@ G4int G4ScoringBox::GetIndex(G4int x, G4int y, G4int z) const {
return x + y*fNSegment[0] + z*fNSegment[0]*fNSegment[1];
}
void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map,
void G4ScoringBox::DrawColumn(RunScore * map,
G4VScoreColorMap* colorMap,
G4int idxProj, G4int idxColumn)
{
@@ -555,18 +556,18 @@ void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map,
// projections
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->end(); itr++) {
std::map<G4int, G4StatDouble*>::iterator itr = map->GetMap()->begin();
for(; itr != map->GetMap()->end(); itr++) {
GetXYZ(itr->first, q);
if(idxProj == 0 && q[2] == idxColumn) { // xy plane
xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
xycell[q[0]][q[1]] += (itr->second->sum_wx())/fDrawUnitValue;
}
if(idxProj == 1 && q[0] == idxColumn) { // yz plane
yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
yzcell[q[1]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
}
if(idxProj == 2 && q[1] == idxColumn) { // zx plane
xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
xzcell[q[0]][q[2]] += (itr->second->sum_wx())/fDrawUnitValue;
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScoringCylinder.cc 89031 2015-03-18 08:40:48Z gcosmo $
// $Id: G4ScoringCylinder.cc 99154 2016-09-07 08:06:30Z gcosmo $
//
#include "G4ScoringCylinder.hh"
@@ -50,6 +50,7 @@
#include "G4PSTrackLength.hh"
#include "G4PSNofStep.hh"
#include "G4ScoringManager.hh"
#include "G4StatDouble.hh"
G4ScoringCylinder::G4ScoringCylinder(G4String wName)
@@ -206,7 +207,7 @@ void G4ScoringCylinder::List() const {
}
void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map,
void G4ScoringCylinder::Draw(RunScore * map,
G4VScoreColorMap* colorMap, G4int axflg) {
G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance();
@@ -224,16 +225,16 @@ void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map,
// projections
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->end(); itr++) {
std::map<G4int, G4StatDouble*>::iterator itr = map->GetMap()->begin();
for(; itr != map->GetMap()->end(); itr++) {
if(itr->first < 0) {
G4cout << itr->first << G4endl;
continue;
}
GetRZPhi(itr->first, q);
zphicell[q[IZ]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
rphicell[q[IR]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
zphicell[q[IZ]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue;
rphicell[q[IR]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue;
}
// search min./max. values
@@ -353,7 +354,7 @@ void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map,
}
}
void G4ScoringCylinder::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
void G4ScoringCylinder::DrawColumn(RunScore * map, G4VScoreColorMap* colorMap,
G4int idxProj, G4int idxColumn)
{
G4int projAxis = 0;
@@ -399,8 +400,8 @@ void G4ScoringCylinder::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreCol
// projections
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->end(); itr++) {
std::map<G4int,G4StatDouble*>::iterator itr = map->GetMap()->begin();
for(; itr != map->GetMap()->end(); itr++) {
if(itr->first < 0) {
G4cout << itr->first << G4endl;
continue;
@@ -408,13 +409,13 @@ void G4ScoringCylinder::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreCol
GetRZPhi(itr->first, q);
if(projAxis == IR && q[IR] == idxColumn) { // zphi plane
zphicell[q[IZ]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
zphicell[q[IZ]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue;
}
if(projAxis == IZ && q[IZ] == idxColumn) { // rphi plane
rphicell[q[IR]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
rphicell[q[IR]][q[IPHI]] += (itr->second->sum_wx())/fDrawUnitValue;
}
if(projAxis == IPHI && q[IPHI] == idxColumn) { // rz plane
rzcell[q[IR]][q[IZ]] += *(itr->second)/fDrawUnitValue;
rzcell[q[IR]][q[IZ]] += (itr->second->sum_wx())/fDrawUnitValue;
}
}
+18 -14
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VScoreWriter.cc 94772 2015-12-09 09:46:45Z gcosmo $
// $Id: G4VScoreWriter.cc 99154 2016-09-07 08:06:30Z gcosmo $
//
#include "G4VScoreWriter.hh"
@@ -89,7 +89,7 @@ void G4VScoreWriter::DumpQuantityToFile(const G4String& psName,
}
std::map<G4int, G4double*> * score = msMapItr->second->GetMap();
std::map<G4int, G4StatDouble*> * score = msMapItr->second->GetMap();
ofile << "# primitive scorer name: " << msMapItr->first << std::endl;
@@ -102,9 +102,9 @@ void G4VScoreWriter::DumpQuantityToFile(const G4String& psName,
<< ", i" << divisionAxisNames[1]
<< ", i" << divisionAxisNames[2];
// unit of scored value
ofile << ", value ";
ofile << ", total(value) ";
if(unit.size() > 0) ofile << "[" << unit << "]";
ofile << G4endl;
ofile << ", total(val^2), entry" << G4endl;
// "sequence" option: write header info
if(opt.find("sequence") != std::string::npos) {
@@ -123,11 +123,13 @@ void G4VScoreWriter::DumpQuantityToFile(const G4String& psName,
if(opt.find("csv") != std::string::npos)
ofile << x << "," << y << "," << z << ",";
std::map<G4int, G4double*>::iterator value = score->find(idx);
std::map<G4int, G4StatDouble*>::iterator value = score->find(idx);
if(value == score->end()) {
ofile << 0.;
ofile << 0. << "," << 0. << "," << 0;
} else {
ofile << *(value->second)/unitValue;
ofile << (value->second->sum_wx())/unitValue << ","
<< (value->second->sum_wx2())/unitValue/unitValue << ","
<< value->second->n();
}
if(opt.find("csv") != std::string::npos) {
@@ -175,7 +177,7 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName,
// retrieve the map
MeshScoreMap fSMap = fScoringMesh->GetScoreMap();
MeshScoreMap::const_iterator msMapItr = fSMap.begin();
std::map<G4int, G4double*> * score;
std::map<G4int, G4StatDouble*> * score;
for(; msMapItr != fSMap.end(); msMapItr++) {
G4String psname = msMapItr->first;
@@ -192,9 +194,9 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName,
<< ", i" << divisionAxisNames[1]
<< ", i" << divisionAxisNames[2];
// unit of scored value
ofile << ", value ";
ofile << ", total(value) ";
if(unit.size() > 0) ofile << "[" << unit << "]";
ofile << G4endl;
ofile << ", total(val^2), entry" << G4endl;
// "sequence" option: write header info
@@ -214,11 +216,13 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(const G4String& fileName,
if(opt.find("csv") != std::string::npos)
ofile << x << "," << y << "," << z << ",";
std::map<G4int, G4double*>::iterator value = score->find(idx);
if(value == score->end()) {
ofile << 0.;
std::map<G4int, G4StatDouble*>::iterator value = score->find(idx);
if(value == score->end()) {
ofile << 0. << "," << 0. << "," << 0;
} else {
ofile << *(value->second)/unitValue;
ofile << (value->second->sum_wx())/unitValue << ","
<< (value->second->sum_wx2())/unitValue/unitValue << ","
<< value->second->n();
}
if(opt.find("csv") != std::string::npos) {
+32 -13
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VScoringMesh.cc 96535 2016-04-20 12:14:15Z gcosmo $
// $Id: G4VScoringMesh.cc 99262 2016-09-09 13:18:19Z gcosmo $
//
// ---------------------------------------------------------------------
// Modifications
@@ -35,7 +35,7 @@
// ---------------------------------------------------------------------
#include "G4VScoringMesh.hh"
#include "G4THitsMap.hh"
#include "G4SystemOfUnits.hh"
#include "G4VPhysicalVolume.hh"
#include "G4MultiFunctionalDetector.hh"
@@ -139,7 +139,7 @@ void G4VScoringMesh::SetPrimitiveScorer(G4VPrimitiveScorer * prs) {
prs->SetNijk(fNSegment[0], fNSegment[1], fNSegment[2]);
fCurrentPS = prs;
fMFD->RegisterPrimitive(prs);
G4THitsMap<G4double> * map = new G4THitsMap<G4double>(fWorldName, prs->GetName());
G4THitsMap<G4StatDouble> * map = new G4THitsMap<G4StatDouble>(fWorldName, prs->GetName());
fMap[prs->GetName()] = map;
}
@@ -172,13 +172,13 @@ void G4VScoringMesh::SetCurrentPrimitiveScorer(const G4String & name) {
}
G4bool G4VScoringMesh::FindPrimitiveScorer(const G4String & psname) {
std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.find(psname);;
MeshScoreMap::iterator itr = fMap.find(psname);
if(itr == fMap.end()) return false;
return true;
}
G4String G4VScoringMesh::GetPSUnit(const G4String & psname) {
std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.find(psname);;
MeshScoreMap::iterator itr = fMap.find(psname);
if(itr == fMap.end()) {
return G4String("");
} else {
@@ -209,7 +209,7 @@ void G4VScoringMesh::SetCurrentPSUnit(const G4String& unit){
}
G4double G4VScoringMesh::GetPSUnitValue(const G4String & psname) {
std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.find(psname);;
MeshScoreMap::iterator itr = fMap.find(psname);
if(itr == fMap.end()) {
return 1.;
} else {
@@ -287,11 +287,11 @@ void G4VScoringMesh::Dump() {
void G4VScoringMesh::DrawMesh(const G4String& psName,G4VScoreColorMap* colorMap,G4int axflg)
{
fDrawPSName = psName;
std::map<G4String, G4THitsMap<G4double>* >::const_iterator fMapItr = fMap.find(psName);
MeshScoreMap::const_iterator fMapItr = fMap.find(psName);
if(fMapItr!=fMap.end()) {
fDrawUnit = GetPSUnit(psName);
fDrawUnitValue = GetPSUnitValue(psName);
Draw(fMapItr->second->GetMap(), colorMap,axflg);
Draw(fMapItr->second, colorMap,axflg);
} else {
G4cerr << "Scorer <" << psName << "> is not defined. Method ignored." << G4endl;
}
@@ -300,11 +300,11 @@ void G4VScoringMesh::DrawMesh(const G4String& psName,G4VScoreColorMap* colorMap,
void G4VScoringMesh::DrawMesh(const G4String& psName,G4int idxPlane,G4int iColumn,G4VScoreColorMap* colorMap)
{
fDrawPSName = psName;
std::map<G4String, G4THitsMap<G4double>* >::const_iterator fMapItr = fMap.find(psName);
MeshScoreMap::const_iterator fMapItr = fMap.find(psName);
if(fMapItr!=fMap.end()) {
fDrawUnit = GetPSUnit(psName);
fDrawUnitValue = GetPSUnitValue(psName);
DrawColumn(fMapItr->second->GetMap(),colorMap,idxPlane,iColumn);
DrawColumn(fMapItr->second,colorMap,idxPlane,iColumn);
} else {
G4cerr << "Scorer <" << psName << "> is not defined. Method ignored." << G4endl;
}
@@ -313,7 +313,7 @@ void G4VScoringMesh::DrawMesh(const G4String& psName,G4int idxPlane,G4int iColum
void G4VScoringMesh::Accumulate(G4THitsMap<G4double> * map)
{
G4String psName = map->GetName();
std::map<G4String, G4THitsMap<G4double>* >::const_iterator fMapItr = fMap.find(psName);
MeshScoreMap::const_iterator fMapItr = fMap.find(psName);
*(fMapItr->second) += *map;
if(verboseLevel > 9) {
@@ -321,8 +321,27 @@ void G4VScoringMesh::Accumulate(G4THitsMap<G4double> * map)
G4cout << "G4VScoringMesh::Accumulate()" << G4endl;
G4cout << " PS name : " << psName << G4endl;
if(fMapItr == fMap.end()) {
G4cout << " "
<< psName << " was not found." << G4endl;
G4cout << " " << psName << " was not found." << G4endl;
} else {
G4cout << " map size : " << map->GetSize() << G4endl;
map->PrintAllHits();
}
G4cout << G4endl;
}
}
void G4VScoringMesh::Accumulate(G4THitsMap<G4StatDouble> * map)
{
G4String psName = map->GetName();
MeshScoreMap::const_iterator fMapItr = fMap.find(psName);
*(fMapItr->second) += *map;
if(verboseLevel > 9) {
G4cout << G4endl;
G4cout << "G4VScoringMesh::Accumulate()" << G4endl;
G4cout << " PS name : " << psName << G4endl;
if(fMapItr == fMap.end()) {
G4cout << " " << psName << " was not found." << G4endl;
} else {
G4cout << " map size : " << map->GetSize() << G4endl;
map->PrintAllHits();