Import Geant4 9.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:25:56 +02:00
parent 74cad5e589
commit 89a9605df1
4440 changed files with 379508 additions and 189225 deletions
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ScoreLogColorMap.cc,v 1.3 2009/05/04 15:57:33 akimura Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4ScoreLogColorMap.cc,v 1.10 2010/11/03 19:31:36 asaim Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
#include "G4ScoreLogColorMap.hh"
@@ -49,12 +49,50 @@ G4ScoreLogColorMap::G4ScoreLogColorMap(G4String mName)
G4ScoreLogColorMap::~G4ScoreLogColorMap()
{;}
#include "G4UIcommand.hh"
void G4ScoreLogColorMap::GetMapColor(G4double val, G4double color[4])
{
G4bool lmin = true, lmax = true, lval = true;
if(fMinVal <= 0.) lmin = false;
if(fMaxVal <= 0.) lmax = false;
if(val <= 0.) lval = false;
if(fMinVal < 0.) {
lmin = false;
G4String message = " The min. value (fMinVal) is negative. : ";
message += G4UIcommand::ConvertToString(fMinVal);
G4Exception("G4ScoreLogColorMap::GetMapColor()",
"DigiHitsUtilsScoreLogColorMap000", JustWarning,
message);
}
if(fMaxVal < 0.) {
lmax = false;
G4String message = " The max. value (fMaxVal) is negative. : ";
message += G4UIcommand::ConvertToString(fMaxVal);
G4Exception("G4ScoreLogColorMap::GetMapColor()",
"DigiHitsUtilsScoreLogColorMap001", JustWarning,
message);
}
if(!lmin || !lmax) {
color[0] = 0.;
color[1] = 0.;
color[2] = 0.;
color[3] = 0.;
return;
}
if(val < 0.) {
lval = false;
G4String message = " 'val' (first argument) is negative : ";
message += G4UIcommand::ConvertToString(fMaxVal);
G4Exception("G4ScoreLogColorMap::GetMapColor()",
"DigiHitsUtilsScoreLogColorMap002", JustWarning,
message);
}
if(!lval) {
color[0] = 0.;
color[1] = 0.;
color[2] = 0.;
color[3] = -1.;
return;
}
G4double logmin = 0., logmax = 0., logval = 0.;
if(lmin) logmin = std::log10(fMinVal);
if(lmax) logmax = std::log10(fMaxVal);
@@ -100,6 +138,7 @@ void G4ScoreLogColorMap::GetMapColor(G4double val, G4double color[4])
void G4ScoreLogColorMap::DrawColorChartBar(G4int _nPoint) {
G4cout << "++++++ " << fMinVal << " - " << fMaxVal << G4endl;
G4bool lmin = true, lmax = true;
if(fMinVal <= 0.) lmin = false;
if(fMaxVal <= 0.) lmax = false;
@@ -117,6 +156,8 @@ void G4ScoreLogColorMap::DrawColorChartBar(G4int _nPoint) {
line.push_back(G4Point3D(-0.91, y, 0.));
G4double val = std::pow(10., (ra*max+rb*min)/(ra+rb));
this->GetMapColor(val, c);
if(c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == 0) return;
if(c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == -1.) continue;
G4Colour col(c[0], c[1], c[2]);
G4VisAttributes att(col);
line.SetVisAttributes(&att);
@@ -131,19 +172,24 @@ void G4ScoreLogColorMap::DrawColorChartText(G4int _nPoint) {
G4double min = 0.;
if(lmin) min = std::log10(fMinVal);
if(min > 0.) min = std::floor(min);
else min = std::ceil(min);
//if(min > 0.) min = std::floor(min);
//else min = std::ceil(min);
G4double max = 0.;
if(lmax) max = std::log10(fMaxVal);
if(max > 0.) max = std::floor(max);
else max = std::ceil(max);
//if(max > 0.) max = std::ceil(max);
//else max = std::floor(max);
G4double c[4];
G4Colour black(0., 0., 0.);
for(int n = 0; n < _nPoint; n++) {
G4double a = n/(_nPoint-1.), b = 1.-a;
G4double v = (a*max + b*min)/(a+b);
this->GetMapColor(std::pow(10., v), c);
if(c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == 0) return;
if(c[0] == 0 && c[1] == 0 && c[2] == 0 && c[3] == -1.) continue;
// background color
for(int l = 0; l < 21; l++) {
G4Polyline line;
@@ -164,11 +210,62 @@ void G4ScoreLogColorMap::DrawColorChartText(G4int _nPoint) {
G4Text text(value, G4Point3D(-0.9, -0.9+0.05*n, 0));
G4double size = 12.;
text.SetScreenSize(size);
this->GetMapColor(std::pow(10., v), c);
//this->GetMapColor(std::pow(10., v), c);
G4Colour color(c[0], c[1], c[2]);
G4VisAttributes att(color);
text.SetVisAttributes(&att);
fVisManager->Draw2D(text);
}
// draw ps name
// background
G4int lpsname = 20;// fPSName.size();
if(lpsname > 0) {
for(int l = 0; l < 22; l++) {
G4Polyline line;
line.push_back(G4Point3D(-0.9, -0.965+0.002*l, 0.));
line.push_back(G4Point3D(-0.9+0.025*lpsname, -0.965+0.002*l, 0.));
G4VisAttributes attblack(black);
//G4VisAttributes attblack(G4Colour(.0, .5, .0));
line.SetVisAttributes(&attblack);
fVisManager->Draw2D(line);
}
// ps name
G4Text txtpsname(fPSName, G4Point3D(-0.9, -0.96, 0.));
G4double size = 12.;
txtpsname.SetScreenSize(size);
G4Colour color(1., 1., 1.);
G4VisAttributes att(color);
txtpsname.SetVisAttributes(&att);
fVisManager->Draw2D(txtpsname);
}
// draw unit
// background
G4int len = fPSUnit.size();
if(len > 0) {
for(int l = 0; l < 21; l++) {
G4Polyline line;
line.push_back(G4Point3D(-0.7, -0.9+0.002*l, 0.));
line.push_back(G4Point3D(-0.7+0.3, -0.9+0.002*l, 0.));
G4VisAttributes attblack(black);
//G4VisAttributes attblack(G4Colour(.5, .0, .0));
line.SetVisAttributes(&attblack);
fVisManager->Draw2D(line);
}
// unit
G4String psunit = "[" + fPSUnit + "]";
G4Text txtunit(psunit, G4Point3D(-0.69, -0.9, 0.));
G4double size = 12.;
txtunit.SetScreenSize(size);
G4Colour color(1., 1., 1.);
G4VisAttributes att(color);
txtunit.SetVisAttributes(&att);
fVisManager->Draw2D(txtunit);
}
}
@@ -24,10 +24,13 @@
// ********************************************************************
//
//
// $Id: G4ScoreQuantityMessenger.cc,v 1.8 2007/11/07 04:12:07 akimura Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ScoreQuantityMessenger.cc,v 1.10 2010/11/03 08:28:42 taso Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// ---------------------------------------------------------------------
// Modifications
// 08-Oct-2010 T.Aso remove unit of G4PSPassageCellCurrent.
// ---------------------------------------------------------------------
#include "G4ScoreQuantityMessenger.hh"
#include "G4ScoringManager.hh"
@@ -54,6 +57,7 @@
#include "G4PSPopulation3D.hh"
#include "G4PSTrackCounter3D.hh"
#include "G4PSTermination3D.hh"
#include "G4PSMinKinEAtGeneration3D.hh"
#include "G4SDChargedFilter.hh"
#include "G4SDNeutralFilter.hh"
@@ -159,6 +163,9 @@ G4ScoreQuantityMessenger::~G4ScoreQuantityMessenger()
{
delete quantityDir;
delete qTouchCmd;
delete qGetUnitCmd;
delete qSetUnitCmd;
//
delete qCellChgCmd;
delete qCellFluxCmd;
@@ -181,6 +188,7 @@ G4ScoreQuantityMessenger::~G4ScoreQuantityMessenger()
delete qPopulationCmd;
delete qTrackCountCmd;
delete qTerminationCmd;
delete qMinKinEAtGeneCmd;
//
delete filterDir;
delete fchargedCmd;
@@ -208,196 +216,147 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
// Commands for Current Mesh
if(command==qTouchCmd) {
mesh->SetCurrentPrimitiveScorer(newVal);
} else if(command == qGetUnitCmd ){
G4cout << "Unit: "<< mesh->GetCurrentPSUnit() <<G4endl;
} else if(command == qSetUnitCmd ){
mesh->SetCurrentPSUnit(newVal);
} else if(command== qCellChgCmd) {
if(!mesh->FindPrimitiveScorer(newVal)) {
mesh->SetPrimitiveScorer(new G4PSCellCharge3D(newVal));
} else {
G4cout << "WARNING[" << qTouchCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
if ( CheckMeshPS(mesh,token[0]) ){
G4PSCellCharge3D* ps = new G4PSCellCharge3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qCellFluxCmd) {
if(!mesh->FindPrimitiveScorer(newVal)) {
mesh->SetPrimitiveScorer(new G4PSCellFlux3D(newVal));
} else {
G4cout << "WARNING[" << qCellFluxCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
if ( CheckMeshPS(mesh,token[0]) ){
G4PSCellFlux3D* ps = new G4PSCellFlux3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qPassCellFluxCmd) {
if(!mesh->FindPrimitiveScorer(newVal)) {
mesh->SetPrimitiveScorer(new G4PSPassageCellFlux3D(newVal));
} else {
G4cout << "WARNING[" << qPassCellFluxCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
if ( CheckMeshPS(mesh,token[0]) ){
G4PSPassageCellFlux3D* ps = new G4PSPassageCellFlux3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command==qeDepCmd) {
if(!mesh->FindPrimitiveScorer(newVal)) {
mesh->SetPrimitiveScorer(new G4PSEnergyDeposit3D(newVal));
} else {
G4cout << "WARNING[" << qeDepCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
if ( CheckMeshPS(mesh,token[0]) ){
G4PSEnergyDeposit3D* ps =new G4PSEnergyDeposit3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qdoseDepCmd) {
if(!mesh->FindPrimitiveScorer(newVal)) {
mesh->SetPrimitiveScorer(new G4PSDoseDeposit3D(newVal));
} else {
G4cout << "WARNING[" << qdoseDepCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
if ( CheckMeshPS(mesh,token[0]) ){
G4PSDoseDeposit3D* ps = new G4PSDoseDeposit3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qnOfStepCmd) {
if(!mesh->FindPrimitiveScorer(newVal)) {
mesh->SetPrimitiveScorer(new G4PSNofStep3D(newVal));
} else {
G4cout << "WARNING[" << qnOfStepCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
if ( CheckMeshPS(mesh,token[0]) ){
G4PSNofStep3D* ps = new G4PSNofStep3D(token[0]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qnOfSecondaryCmd) {
if(!mesh->FindPrimitiveScorer(newVal)) {
mesh->SetPrimitiveScorer(new G4PSNofSecondary3D(newVal));
} else {
G4cout << "WARNING[" << qnOfSecondaryCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
if ( CheckMeshPS(mesh,token[0]) ){
G4PSNofSecondary3D* ps =new G4PSNofSecondary3D(token[0]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qTrackLengthCmd) {
if(!mesh->FindPrimitiveScorer(newVal)) {
if ( CheckMeshPS(mesh,token[0]) ){
G4PSTrackLength3D* ps = new G4PSTrackLength3D(token[0]);
ps->Weighted(StoB(token[1]));
ps->MultiplyKineticEnergy(StoB(token[2]));
ps->DivideByVelocity(StoB(token[3]));
ps->SetUnit(token[4]);
mesh->SetPrimitiveScorer(ps);
} else {
G4cout << "WARNING[" << qTrackLengthCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
}
} else if(command== qPassCellCurrCmd){
if(!mesh->FindPrimitiveScorer(newVal)) {
if( CheckMeshPS(mesh,token[0]) ) {
G4PSPassageCellCurrent* ps = new G4PSPassageCellCurrent3D(token[0]);
ps->Weighted(StoB(token[1]));
//ps->SetUnit(token[2]);
mesh->SetPrimitiveScorer(ps);
} else {
G4cout << "WARNING[" << qPassCellCurrCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
}
} else if(command== qPassTrackLengthCmd){
if(!mesh->FindPrimitiveScorer(newVal)) {
if( CheckMeshPS(mesh,token[0]) ) {
G4PSPassageTrackLength* ps = new G4PSPassageTrackLength3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
} else {
G4cout << "WARNING[" << qPassTrackLengthCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
}
} else if(command== qFlatSurfCurrCmd){
if(!mesh->FindPrimitiveScorer(newVal)) {
if( CheckMeshPS(mesh,token[0])) {
G4PSFlatSurfaceCurrent3D* ps =
new G4PSFlatSurfaceCurrent3D(token[0],StoI(token[1]));
ps->Weighted(StoB(token[2]));
ps->DivideByArea(StoB(token[3]));
ps->SetUnit(token[4]);
mesh->SetPrimitiveScorer(ps);
} else {
G4cout << "WARNING[" << qFlatSurfCurrCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
}
} else if(command== qFlatSurfFluxCmd){
if(!mesh->FindPrimitiveScorer(newVal)) {
mesh->SetPrimitiveScorer(
new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1])));
} else {
G4cout << "WARNING[" << qFlatSurfFluxCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
// } else if(command== qSphereSurfCurrCmd){
// if(!mesh->FindPrimitiveScorer(newVal)) {
if( CheckMeshPS(mesh, token[0] )) {
G4PSFlatSurfaceFlux3D* ps = new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1]));
ps->SetUnit(token[2]);
mesh->SetPrimitiveScorer(ps);
}
// } else if(command== qSphereSurfCurrCmd){
// if( CheckMeshPS(mesh, token[0] )) {
// G4PSSphereSurfaceCurrent3D* ps =
// new G4PSSphereSurfaceCurrent3D(token[0],StoI(token[1]));
// ps->Weighted(StoB(token[2]));
// ps->DivideByArea(StoB(token[3]));
// ps->SetUnit(token[4]);
// mesh->SetPrimitiveScorer(ps);
// } else {
// G4cout << "WARNING[" << qSphereSurfCurrCmd->GetCommandPath()
// << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
// mesh->SetNullToCurrentPrimitiveScorer();
// }
// } else if(command== qSphereSurfFluxCmd){
// if(!mesh->FindPrimitiveScorer(newVal)) {
// mesh->SetPrimitiveScorer(
// new G4PSSphereSurfaceFlux3D(token[0], StoI(token[1])));
// } else {
// G4cout << "WARNING[" << qSphereSurfFluxCmd->GetCommandPath()
// << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
// mesh->SetNullToCurrentPrimitiveScorer();
// }
// } else if(command== qCylSurfCurrCmd){
// if(!mesh->FindPrimitiveScorer(newVal)) {
// }
// } else if(command== qSphereSurfFluxCmd){
// if( CheckMeshPS(mesh,token[0])) {
// G4PSSphereSurfaceFlux3D* ps = new G4PSSphereSurfaceFlux3D(token[0], StoI(token[1]));
// ps->SetUnit(token[2]);
// mesh->SetPrimitiveScorer(ps);
// }
// } else if(command== qCylSurfCurrCmd){
// if( CheckMeshPS(mesh, token[0] ) ) {
// G4PSCylinderSurfaceCurrent3D* ps =
// new G4PSCylinderSurfaceCurrent3D(token[0],StoI(token[1]));
// ps->Weighted(StoB(token[2]));
// ps->DivideByArea(StoB(token[3]));
// ps->SetUnit(token[4]);
// mesh->SetPrimitiveScorer(ps);
// } else {
// G4cout << "WARNING[" << qCylSurfCurrCmd->GetCommandPath()
// << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
// mesh->SetNullToCurrentPrimitiveScorer();
// }
// } else if(command== qCylSurfFluxCmd){
// if(!mesh->FindPrimitiveScorer(newVal)) {
// mesh->SetPrimitiveScorer(
// new G4PSCylinderSurfaceFlux3D(token[0], StoI(token[1])));
// } else {
// G4cout << "WARNING[" << qCylSurfFluxCmd->GetCommandPath()
// << "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
// mesh->SetNullToCurrentPrimitiveScorer();
// }
// }
// } else if(command== qCylSurfFluxCmd){
// if( CheckMeshPS(mesh, token[0] ) {
// G4PSCylinerSurfaceFlux3D* ps =new G4PSCylinderSurfaceFlux3D(token[0], StoI(token[1]));
// ps->SetUnit(token[2]);
// mesh->SetPrimitiveScorer(ps);
// }
} else if(command== qNofCollisionCmd){
if(!mesh->FindPrimitiveScorer(newVal)) {
if( CheckMeshPS(mesh,token[0])) {
G4PSNofCollision3D* ps =new G4PSNofCollision3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
} else {
G4cout << "WARNING[" << qNofCollisionCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
}
} else if(command== qPopulationCmd){
if(!mesh->FindPrimitiveScorer(newVal)) {
if( CheckMeshPS(mesh,token[0]) ) {
G4PSPopulation3D* ps =new G4PSPopulation3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
} else {
G4cout << "WARNING[" << qPopulationCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
}
} else if(command== qTrackCountCmd){
if(!mesh->FindPrimitiveScorer(newVal)) {
if( CheckMeshPS(mesh,token[0])) {
G4PSTrackCounter3D* ps =new G4PSTrackCounter3D(token[0],StoI(token[1]));
mesh->SetPrimitiveScorer(ps);
} else {
G4cout << "WARNING[" << qTrackCountCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
}
} else if(command== qTerminationCmd){
if(!mesh->FindPrimitiveScorer(newVal)) {
if( CheckMeshPS(mesh,token[0])) {
G4PSTermination3D* ps =new G4PSTermination3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
} else {
G4cout << "WARNING[" << qTerminationCmd->GetCommandPath()
<< "] : Quantity name, \"" << newVal << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
}
}
} else if(command== qMinKinEAtGeneCmd){
if( CheckMeshPS(mesh,token[0]) ){
G4PSMinKinEAtGeneration3D* ps =new G4PSMinKinEAtGeneration3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
//
// Filters
@@ -487,4 +446,14 @@ void G4ScoreQuantityMessenger::FParticleWithEnergyCommand(G4VScoringMesh* mesh,G
}
mesh->SetFilter(filter);
}
G4bool G4ScoreQuantityMessenger::CheckMeshPS(G4VScoringMesh* mesh, G4String& psname){
if(!mesh->FindPrimitiveScorer(psname)) {
return true;
} else {
G4cout << "WARNING[" << qTouchCmd->GetCommandPath()
<< "] : Quantity name, \"" << psname << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
return false;
}
}
@@ -24,10 +24,13 @@
// ********************************************************************
//
//
// $Id: G4ScoreQuantityMessengerQCmd.cc,v 1.6 2007/11/07 04:12:07 akimura Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ScoreQuantityMessengerQCmd.cc,v 1.8 2010/11/03 08:29:02 taso Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// ---------------------------------------------------------------------
// Modifications
// 08-Oct-2010 T.Aso remove unit of G4PSPassageCellCurrent.
// ---------------------------------------------------------------------
#include "G4ScoreQuantityMessenger.hh"
#include "G4ScoringManager.hh"
@@ -85,42 +88,99 @@ void G4ScoreQuantityMessenger::QuantityCommands()
qTouchCmd->SetGuidance("Assign previously defined quantity to the current quantity.");
qTouchCmd->SetParameterName("qname",false);
//
qeDepCmd = new G4UIcmdWithAString("/score/quantity/energyDeposit",this);
qGetUnitCmd = new G4UIcmdWithoutParameter("/score/quantity/get/unit",this);
qGetUnitCmd->SetGuidance("Print output unit of the current quantity.");
//
qSetUnitCmd = new G4UIcmdWithAString("/score/quantity/set/unit",this);
qSetUnitCmd->SetGuidance("Set output unit of the current quantity.");
qSetUnitCmd->SetParameterName("unit",false);
// Primitive Scorers
qeDepCmd = new G4UIcommand("/score/quantity/energyDeposit",this);
qeDepCmd->SetGuidance("Energy deposit scorer.");
qeDepCmd->SetParameterName("qname",false);
qeDepCmd->
SetGuidance("[usage] /score/quantiy/energyDeposit qname unit");
qeDepCmd->SetGuidance(" qname :(String) scorer name");
qeDepCmd->SetGuidance(" unit :(String) unit");
param = new G4UIparameter("qname",'s',false);
qeDepCmd->SetParameter(param);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultValue("MeV");
qeDepCmd->SetParameter(param);
//
qCellChgCmd = new G4UIcmdWithAString("/score/quantity/cellCharge",this);
qCellChgCmd = new G4UIcommand("/score/quantity/cellCharge",this);
qCellChgCmd->SetGuidance("Cell charge scorer.");
qCellChgCmd->SetParameterName("qname",false);
qCellChgCmd->
SetGuidance("[usage] /score/quantiy/cellCharge qname unit");
qCellChgCmd->SetGuidance(" qname :(String) scorer name");
qCellChgCmd->SetGuidance(" unit :(String) unit");
param = new G4UIparameter("qname",'s',false);
qCellChgCmd->SetParameter(param);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultValue("e+");
qCellChgCmd->SetParameter(param);
//
qCellFluxCmd = new G4UIcmdWithAString("/score/quantity/cellFlux",this);
qCellFluxCmd = new G4UIcommand("/score/quantity/cellFlux",this);
qCellFluxCmd->SetGuidance("Cell flux scorer.");
qCellFluxCmd->SetParameterName("qname",false);
qCellFluxCmd->
SetGuidance("[usage] /score/quantiy/cellFlux qname unit");
qCellFluxCmd->SetGuidance(" qname :(String) scorer name");
qCellFluxCmd->SetGuidance(" unit :(String) unit");
param = new G4UIparameter("qname",'s',false);
qCellFluxCmd->SetParameter(param);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultValue("percm2");
qCellFluxCmd->SetParameter(param);
//
qPassCellFluxCmd = new G4UIcmdWithAString("/score/quantity/passageCellFlux",this);
qPassCellFluxCmd = new G4UIcommand("/score/quantity/passageCellFlux",this);
qPassCellFluxCmd->SetGuidance("Passage cell flux scorer");
qPassCellFluxCmd->SetParameterName("qname",false);
qPassCellFluxCmd->
SetGuidance("[usage] /score/quantiy/passageCellFlux qname unit");
qPassCellFluxCmd->SetGuidance(" qname :(String) scorer name");
qPassCellFluxCmd->SetGuidance(" unit :(String) unit");
param = new G4UIparameter("qname",'s',false);
qPassCellFluxCmd->SetParameter(param);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultValue("percm2");
qPassCellFluxCmd->SetParameter(param);
//
qdoseDepCmd = new G4UIcmdWithAString("/score/quantity/doseDeposit",this);
qdoseDepCmd = new G4UIcommand("/score/quantity/doseDeposit",this);
qdoseDepCmd->SetGuidance("Dose deposit scorer.");
qdoseDepCmd->SetParameterName("qname",false);
qdoseDepCmd->
SetGuidance("[usage] /score/quantiy/doseDeposit qname unit");
qdoseDepCmd->SetGuidance(" qname :(String) scorer name");
qdoseDepCmd->SetGuidance(" unit :(String) unit");
param = new G4UIparameter("qname",'s',false);
qdoseDepCmd->SetParameter(param);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultValue("Gy");
qdoseDepCmd->SetParameter(param);
//
qnOfStepCmd = new G4UIcmdWithAString("/score/quantity/nOfStep",this);
qnOfStepCmd = new G4UIcommand("/score/quantity/nOfStep",this);
qnOfStepCmd->SetGuidance("Number of step scorer.");
qnOfStepCmd->SetParameterName("qname",false);
qnOfStepCmd->
SetGuidance("[usage] /score/quantiy/nOfStep qname");
qnOfStepCmd->SetGuidance(" qname :(String) scorer name");
param = new G4UIparameter("qname",'s',false);
qnOfStepCmd->SetParameter(param);
//
qnOfSecondaryCmd = new G4UIcmdWithAString("/score/quantity/nOfSecondary",this);
qnOfSecondaryCmd = new G4UIcommand("/score/quantity/nOfSecondary",this);
qnOfSecondaryCmd->SetGuidance("Number of secondary scorer.");
qnOfSecondaryCmd->SetParameterName("qname",false);
qnOfSecondaryCmd->
SetGuidance("[usage] /score/quantiy/nOfSecondary qname");
qnOfSecondaryCmd->SetGuidance(" qname :(String) scorer name");
param = new G4UIparameter("qname",'s',false);
qnOfSecondaryCmd->SetParameter(param);
//
qTrackLengthCmd = new G4UIcommand("/score/quantity/trackLength",this);
qTrackLengthCmd->SetGuidance("Track length scorer.");
qTrackLengthCmd->
SetGuidance("[usage] /score/quantiy/trackLength qname wflag kflag vflag ");
SetGuidance("[usage] /score/quantiy/trackLength qname wflag kflag vflag unit");
qTrackLengthCmd->SetGuidance(" qname :(String) scorer name");
qTrackLengthCmd->SetGuidance(" wflag :(Bool) weighted");
qTrackLengthCmd->SetGuidance(" kflag :(Bool) multiply kinetic energy");
qTrackLengthCmd->SetGuidance(" vflag :(Bool) divide by velocity");
qTrackLengthCmd->SetGuidance(" unit :(String) unit");
param = new G4UIparameter("qname",'s',false);
qTrackLengthCmd->SetParameter(param);
param = new G4UIparameter("wflag",'b',true);
@@ -132,35 +192,47 @@ void G4ScoreQuantityMessenger::QuantityCommands()
param = new G4UIparameter("vflag",'b',true);
param->SetDefaultValue("false");
qTrackLengthCmd->SetParameter(param);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultValue("mm");
qTrackLengthCmd->SetParameter(param);
//
qPassCellCurrCmd = new G4UIcommand("/score/quantity/passageCellCurrent",this);
qPassCellCurrCmd->SetGuidance("Passage cell current scorer.");
qPassCellCurrCmd->
SetGuidance("[usage] /score/quantiy/passageCellCurrent qname wflag");
SetGuidance("[usage] /score/quantiy/passageCellCurrent qname wflag");
//SetGuidance("[usage] /score/quantiy/passageCellCurrent qname wflag unit");
qPassCellCurrCmd->SetGuidance(" qname :(String) scorer name");
qPassCellCurrCmd->SetGuidance(" wflag :(Bool) weighted");
//qPassCellCurrCmd->SetGuidance(" unit :(Bool) unit");
param = new G4UIparameter("qname",'s',false);
qPassCellCurrCmd->SetParameter(param);
param = new G4UIparameter("wflag",'b',true);
param->SetDefaultValue("true");
qPassCellCurrCmd->SetParameter(param);
//param = new G4UIparameter("unit",'s',true);
//param->SetDefaultValue("parcm2");
//qPassCellCurrCmd->SetParameter(param);
//
qPassTrackLengthCmd = new G4UIcommand("/score/quantity/passageTrackLength",this);
qPassTrackLengthCmd->SetGuidance("Passage track length scorer.");
qPassTrackLengthCmd->
SetGuidance("[usage] /score/quantiy/passageTrackLength qname wflag");
SetGuidance("[usage] /score/quantiy/passageTrackLength qname wflag unit");
qPassTrackLengthCmd->SetGuidance(" qname :(String) scorer name");
qPassTrackLengthCmd->SetGuidance(" wflag :(Bool) weighted");
qPassTrackLengthCmd->SetGuidance(" unit :(Bool) unit");
param = new G4UIparameter("qname",'s',false);
qPassTrackLengthCmd->SetParameter(param);
param = new G4UIparameter("wflag",'b',true);
param->SetDefaultValue("true");
qPassTrackLengthCmd->SetParameter(param);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultValue("mm");
qPassTrackLengthCmd->SetParameter(param);
//
qFlatSurfCurrCmd = new G4UIcommand("/score/quantity/flatSurfaceCurrent",this);
qFlatSurfCurrCmd->SetGuidance("Flat surface current Scorer.");
qFlatSurfCurrCmd->
SetGuidance("[usage] /score/quantiy/flatSurfaceCurrent qname dflag wflag aflag");
SetGuidance("[usage] /score/quantiy/flatSurfaceCurrent qname dflag wflag aflag unit");
qFlatSurfCurrCmd->SetGuidance(" qname :(String) scorer name");
qFlatSurfCurrCmd->SetGuidance(" dflag :(Int) direction flag");
qFlatSurfCurrCmd->SetGuidance(" : 0 = Both In and Out");
@@ -168,6 +240,7 @@ void G4ScoreQuantityMessenger::QuantityCommands()
qFlatSurfCurrCmd->SetGuidance(" : 2 = Out only");
qFlatSurfCurrCmd->SetGuidance(" wflag :(Bool) weighted");
qFlatSurfCurrCmd->SetGuidance(" aflag :(Bool) divide by area");
qFlatSurfCurrCmd->SetGuidance(" unit :(Bool) unit");
param = new G4UIparameter("qname",'s',false);
qFlatSurfCurrCmd->SetParameter(param);
param = new G4UIparameter("dflag",'i',true);
@@ -179,26 +252,33 @@ void G4ScoreQuantityMessenger::QuantityCommands()
param = new G4UIparameter("aflag",'b',true);
param->SetDefaultValue("true");
qFlatSurfCurrCmd->SetParameter(param);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultValue("percm2");
qFlatSurfCurrCmd->SetParameter(param);
//
qFlatSurfFluxCmd = new G4UIcommand("/score/quantity/flatSurfaceFlux",this);
qFlatSurfFluxCmd->SetGuidance("Flat surface flux scorer.");
qFlatSurfFluxCmd->
SetGuidance("[usage] /score/quantiy/flatSurfaceFlux qname dflag");
SetGuidance("[usage] /score/quantiy/flatSurfaceFlux qname dflag unit");
qFlatSurfFluxCmd->SetGuidance(" qname :(String) scorer name");
qFlatSurfFluxCmd->SetGuidance(" dflag :(Int) direction flag");
qFlatSurfFluxCmd->SetGuidance(" : 0 = Both In and Out");
qFlatSurfFluxCmd->SetGuidance(" : 1 = In only");
qFlatSurfFluxCmd->SetGuidance(" : 2 = Out only");
qFlatSurfFluxCmd->SetGuidance(" unit :(String) unit");
param = new G4UIparameter("qname",'s',false);
qFlatSurfFluxCmd->SetParameter(param);
param = new G4UIparameter("dflag",'i',true);
param->SetDefaultValue("0");
qFlatSurfFluxCmd->SetParameter(param);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultValue("percm2");
qFlatSurfFluxCmd->SetParameter(param);
//
// qSphereSurfCurrCmd = new G4UIcommand("/score/quantity/sphereSurfaceCurrent",this);
// qSphereSurfCurrCmd->SetGuidance("Sphere surface current Scorer.");
// qSphereSurfCurrCmd->
// SetGuidance("[usage] /score/quantiy/sphereSurfaceCurrent qname dflag wflag aflag");
// SetGuidance("[usage] /score/quantiy/sphereSurfaceCurrent qname dflag wflag aflag unit");
// qSphereSurfCurrCmd->SetGuidance(" qname :(String) scorer name");
// qSphereSurfCurrCmd->SetGuidance(" dflag :(Int) direction flag");
// qSphereSurfCurrCmd->SetGuidance(" : 0 = Both In and Out");
@@ -206,6 +286,7 @@ void G4ScoreQuantityMessenger::QuantityCommands()
// qSphereSurfCurrCmd->SetGuidance(" : 2 = Out only");
// qSphereSurfCurrCmd->SetGuidance(" wflag :(Bool) Weighted");
// qSphereSurfCurrCmd->SetGuidance(" aflag :(Bool) DivideByArea");
// qSphereSurfCurrCmd->SetGuidance(" unit :(String) unit");
// param = new G4UIparameter("qname",'s',false);
// qSphereSurfCurrCmd->SetParameter(param);
// param = new G4UIparameter("dflag",'i',true);
@@ -216,29 +297,36 @@ void G4ScoreQuantityMessenger::QuantityCommands()
// qSphereSurfCurrCmd->SetParameter(param);
// param = new G4UIparameter("aflag",'b',true);
// param->SetDefaultValue("true");
// qSphereSurfCurrCmd->SetParameter(param);
// param = new G4UIparameter("unit",'s',true);
// param->SetDefaultValue("percm2");
// qSphereSurfCurrCmd->SetParameter(param);
//
// qSphereSurfFluxCmd = new G4UIcommand("/score/quantity/sphereSurfaceFlux",this);
// qSphereSurfFluxCmd->SetGuidance("Sphere surface Flux Scorer.");
// qSphereSurfFluxCmd->
// SetGuidance("[usage] /score/quantiy/sphereSurfaceFlux qname dflag");
// SetGuidance("[usage] /score/quantiy/sphereSurfaceFlux qname dflag unit");
// qSphereSurfFluxCmd->SetGuidance(" qname :(String) scorer name");
// qSphereSurfFluxCmd->SetGuidance(" dflag :(Int) direction flag");
// qSphereSurfFluxCmd->SetGuidance(" : 0 = Both In and Out");
// qSphereSurfFluxCmd->SetGuidance(" : 1 = In only");
// qSphereSurfFluxCmd->SetGuidance(" : 2 = Out only");
// qSphereSurfFluxCmd->SetGuidance(" unit :(String) unit");
// param = new G4UIparameter("qname",'s',false);
// qSphereSurfFluxCmd->SetParameter(param);
// param = new G4UIparameter("dflag",'i',true);
// param->SetDefaultValue("0");
// qSphereSurfFluxCmd->SetParameter(param);
// param = new G4UIparameter("unit",'s',true);
// param->SetDefaultValue("percm2");
// qSphereSurfFluxCmd->SetParameter(param);
//
// qCylSurfCurrCmd = new G4UIcommand("/score/quantity/cylinderSurfaceCurrent",this);
// qCylSurfCurrCmd->SetGuidance("Cylinder surface current Scorer.");
// qCylSurfCurrCmd->
// SetGuidance("[usage] /score/quantiy/cylinderSurfaceCurrent qname dflag wflag aflag");
// SetGuidance("[usage] /score/quantiy/cylinderSurfaceCurrent qname dflag wflag aflag unit");
// qCylSurfCurrCmd->SetGuidance(" qname :(String) scorer name");
// qCylSurfCurrCmd->SetGuidance(" dflag :(Int) direction flag");
// qCylSurfCurrCmd->SetGuidance(" : 0 = Both In and Out");
@@ -246,6 +334,7 @@ void G4ScoreQuantityMessenger::QuantityCommands()
// qCylSurfCurrCmd->SetGuidance(" : 2 = Out only");
// qCylSurfCurrCmd->SetGuidance(" wflag :(Bool) Weighted");
// qCylSurfCurrCmd->SetGuidance(" aflag :(Bool) DivideByArea");
// qCylSurfCurrCmd->SetGuidance(" unit :(String) unit");
// param = new G4UIparameter("qname",'s',false);
// qCylSurfCurrCmd->SetParameter(param);
// param = new G4UIparameter("dflag",'i',true);
@@ -256,29 +345,36 @@ void G4ScoreQuantityMessenger::QuantityCommands()
// qCylSurfCurrCmd->SetParameter(param);
// param = new G4UIparameter("aflag",'b',true);
// param->SetDefaultValue("true");
// qCylSurfCurrCmd->SetParameter(param);
// param = new G4UIparameter("unit",'s',true);
// param->SetDefaultValue("percm2");
// qCylSurfCurrCmd->SetParameter(param);
//
// qCylSurfFluxCmd = new G4UIcommand("/score/quantity/cylinderSurfaceFlux",this);
// qCylSurfFluxCmd->SetGuidance("Cylinder surface Flux Scorer.");
// qCylSurfFluxCmd->
// SetGuidance("[usage] /score/quantiy/cylinderSurfaceFlux qname dflag");
// SetGuidance("[usage] /score/quantiy/cylinderSurfaceFlux qname dflag unit");
// qCylSurfFluxCmd->SetGuidance(" qname :(String) scorer name");
// qCylSurfFluxCmd->SetGuidance(" dflag :(Int) direction flag");
// qCylSurfFluxCmd->SetGuidance(" : 0 = Both In and Out");
// qCylSurfFluxCmd->SetGuidance(" : 1 = In only");
// qCylSurfFluxCmd->SetGuidance(" : 2 = Out only");
// qCylSurfFluxCmd->SetGuidance(" unit :(String) unit");
// param = new G4UIparameter("qname",'s',false);
// qCylSurfFluxCmd->SetParameter(param);
// param = new G4UIparameter("dflag",'i',true);
// param->SetDefaultValue("0");
// qCylSurfFluxCmd->SetParameter(param);
// param = new G4UIparameter("unit",'s',true);
// param->SetDefaultValue("percm2");
// qCylSurfFluxCmd->SetParameter(param);
//
//
qNofCollisionCmd = new G4UIcommand("/score/quantity/nOfCollision",this);
qNofCollisionCmd->SetGuidance("Number of collision scorer.");
qNofCollisionCmd->
SetGuidance("[usage] /score/quantiy/nOfCollision qname wflag");
SetGuidance("[usage] /score/quantiy/nOfCollision qname wflag");
qNofCollisionCmd->SetGuidance(" qname :(String) scorer name");
qNofCollisionCmd->SetGuidance(" wflag :(Bool) weighted");
param = new G4UIparameter("qname",'s',false);
qNofCollisionCmd->SetParameter(param);
param = new G4UIparameter("wflag",'b',true);
@@ -288,7 +384,7 @@ void G4ScoreQuantityMessenger::QuantityCommands()
qPopulationCmd = new G4UIcommand("/score/quantity/population",this);
qPopulationCmd->SetGuidance("Population scorer.");
qPopulationCmd->
SetGuidance("[usage] /score/quantiy/population qname wflag");
SetGuidance("[usage] /score/quantiy/population qname wflag");
qPopulationCmd->SetGuidance(" qname :(String) scorer name");
qPopulationCmd->SetGuidance(" wflag :(Bool) weighted");
param = new G4UIparameter("qname",'s',false);
@@ -301,7 +397,7 @@ void G4ScoreQuantityMessenger::QuantityCommands()
qTrackCountCmd = new G4UIcommand("/score/quantity/nOfTrack",this);
qTrackCountCmd->SetGuidance("Number of track scorer.");
qTrackCountCmd->
SetGuidance("[usage] /score/quantiy/nOfTrack qname dflag wflag");
SetGuidance("[usage] /score/quantiy/nOfTrack qname dflag wflag");
qTrackCountCmd->SetGuidance(" qname :(String) scorer name");
qTrackCountCmd->SetGuidance(" dflag :(Int) direction");
qTrackCountCmd->SetGuidance(" : 0 = Both In and Out");
@@ -329,5 +425,14 @@ void G4ScoreQuantityMessenger::QuantityCommands()
param = new G4UIparameter("wflag",'b',true);
param->SetDefaultValue("false");
qTerminationCmd->SetParameter(param);
//
qMinKinEAtGeneCmd = new G4UIcommand("/score/quantity/minKinEAtGeneration",this);
qMinKinEAtGeneCmd->SetGuidance("Min Kinetic Energy at Generation");
qMinKinEAtGeneCmd->
SetGuidance("[usage] /score/quantiy/minKinEAtGeneration qname");
qMinKinEAtGeneCmd->SetGuidance(" qname :(String) scorer name");
param = new G4UIparameter("qname",'s',false);
qMinKinEAtGeneCmd->SetParameter(param);
}
+30 -49
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ScoringBox.cc,v 1.54 2008/08/29 02:50:05 akimura Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ScoringBox.cc,v 1.61 2010/07/27 01:44:54 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
#include "G4ScoringBox.hh"
@@ -36,9 +36,7 @@
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4PVDivision.hh"
#include "G4PVParameterised.hh"
#include "G4VisAttributes.hh"
#include "G4ScoringBoxParameterisation.hh"
#include "G4VVisManager.hh"
#include "G4VScoreColorMap.hh"
@@ -56,6 +54,9 @@ G4ScoringBox::G4ScoringBox(G4String wName)
fMeshElementLogical(0)
{
fShape = boxMesh;
fDivisionAxisNames[0] = "X";
fDivisionAxisNames[1] = "Y";
fDivisionAxisNames[2] = "Z";
}
G4ScoringBox::~G4ScoringBox()
@@ -185,46 +186,20 @@ void G4ScoringBox::SetupGeometry(G4VPhysicalVolume * fWorldPhys) {
fSize[1]/fNSegment[1],
fSize[2]/fNSegment[2]);
fMeshElementLogical = new G4LogicalVolume(elementSolid, 0, elementName);
if(fNSegment[2] > 1)
if(fSegmentPositions.size() > 0) {
if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Parameterise to z direction" << G4endl;
G4double motherDims[3] ={fSize[0]/fNSegment[0],
fSize[1]/fNSegment[1],
fSize[2]/fNSegment[2]};
G4int nelement = fNSegment[2];
fSegmentPositions.push_back(fSize[2]*2.);
//G4ScoringBoxParameterisation * param =
G4VPVParameterisation * param =
new G4ScoringBoxParameterisation(kZAxis, motherDims, fSegmentPositions);
new G4PVParameterised(elementName,
fMeshElementLogical,
layerLogical[1],
kZAxis,
nelement,
param);
if(fNSegment[2] > 1) {
if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Replicate to z direction" << G4endl;
if(verboseLevel > 9) {
G4cout << motherDims[0] << ", " << motherDims[1] << ", " << motherDims[2] << G4endl;
for(int i = 0; i < (int)fSegmentPositions.size(); i++)
G4cout << fSegmentPositions[i] << ", ";
G4cout << G4endl;
}
} else {
if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Replicate to z direction" << G4endl;
if(G4ScoringManager::GetReplicaLevel()>2)
{
new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
if(G4ScoringManager::GetReplicaLevel()>2)
{
new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
fNSegment[2], 2.*fSize[2]/fNSegment[2]);
}
else
{
new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
fNSegment[2], 0.);
}
}
else if(fNSegment[2] == 1) {
else
{
new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
fNSegment[2], 0.);
}
} else if(fNSegment[2] == 1) {
if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), fMeshElementLogical, elementName, layerLogical[1], false, 0);
} else
@@ -291,6 +266,7 @@ void G4ScoringBox::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colo
std::vector<std::vector<double> > xzcell; // xzcell[X][Z]
for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
// search max. & min. values in each slice
G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
G4double xymax = 0., yzmax = 0., xzmax = 0.;
G4int q[3];
@@ -298,15 +274,15 @@ void G4ScoringBox::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colo
for(; itr != map->end(); itr++) {
GetXYZ(itr->first, q);
xycell[q[0]][q[1]] += *(itr->second);
xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
if(xymin > xycell[q[0]][q[1]]) xymin = xycell[q[0]][q[1]];
if(xymax < xycell[q[0]][q[1]]) xymax = xycell[q[0]][q[1]];
yzcell[q[1]][q[2]] += *(itr->second);
yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
if(yzmin > yzcell[q[1]][q[2]]) yzmin = yzcell[q[1]][q[2]];
if(yzmax < yzcell[q[1]][q[2]]) yzmax = yzcell[q[1]][q[2]];
xzcell[q[0]][q[2]] += *(itr->second);
xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
if(xzmin > xzcell[q[0]][q[2]]) xzmin = xzcell[q[0]][q[2]];
if(xzmax < xzcell[q[0]][q[2]]) xzmax = xzcell[q[0]][q[2]];
}
@@ -403,6 +379,8 @@ void G4ScoringBox::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colo
}
}
}
colorMap->SetPSUnit(fDrawUnit);
colorMap->SetPSName(fDrawPSName);
colorMap->DrawColorChart();
}
@@ -428,8 +406,8 @@ 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, G4VScoreColorMap* colorMap,
G4int idxProj, G4int idxColumn)
void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
G4int idxProj, G4int idxColumn)
{
if(idxColumn<0 || idxColumn>=fNSegment[idxProj])
{
@@ -459,6 +437,7 @@ void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap
std::vector<std::vector<double> > xzcell; // xzcell[X][Z]
for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
// search max. & min. values in each slice
G4double xymax = 0., yzmax = 0., xzmax = 0.;
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
@@ -466,15 +445,15 @@ void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap
GetXYZ(itr->first, q);
if(idxProj == 0 && q[2] == idxColumn) { // xy plane
xycell[q[0]][q[1]] += *(itr->second);
xycell[q[0]][q[1]] += *(itr->second)/fDrawUnitValue;
if(xymax < xycell[q[0]][q[1]]) xymax = xycell[q[0]][q[1]];
}
if(idxProj == 1 && q[0] == idxColumn) { // yz plane
yzcell[q[1]][q[2]] += *(itr->second);
yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
if(yzmax < yzcell[q[1]][q[2]]) yzmax = yzcell[q[1]][q[2]];
}
if(idxProj == 2 && q[1] == idxColumn) { // zx plane
xzcell[q[0]][q[2]] += *(itr->second);
xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
if(xzmax < xzcell[q[0]][q[2]]) xzmax = xzcell[q[0]][q[2]];
}
}
@@ -551,6 +530,8 @@ void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap
}
}
colorMap->SetPSUnit(fDrawUnit);
colorMap->SetPSName(fDrawPSName);
colorMap->DrawColorChart();
}
@@ -1,94 +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. *
// ********************************************************************
//
#include "G4ScoringBoxParameterisation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4Box.hh"
G4ScoringBoxParameterisation::G4ScoringBoxParameterisation(EAxis segaxis,
G4double motherDimension[3],
std::vector<G4double> & segpos)
: fSegmentAxis(segaxis), fSegmentPositions(segpos) {
for(int i = 0; i < 3; i++) fMotherDimensions[i] = motherDimension[i];
}
G4ScoringBoxParameterisation::~G4ScoringBoxParameterisation() {
;
}
void G4ScoringBoxParameterisation::ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const {
G4ThreeVector trans;
G4double pos;
if(copyNo == 0)
pos = fSegmentPositions[copyNo]/2.;
else
pos = (fSegmentPositions[copyNo-1] + fSegmentPositions[copyNo])/2.;
if(fSegmentAxis == kXAxis) {
trans[0] = pos - fMotherDimensions[0];
}
if(fSegmentAxis == kYAxis) {
trans[1] = pos - fMotherDimensions[1];
}
if(fSegmentAxis == kZAxis) {
trans[2] = pos - fMotherDimensions[2];
}
physVol->SetTranslation(trans);
}
void G4ScoringBoxParameterisation::ComputeDimensions(G4Box & meshElement,
const G4int copyNo,
const G4VPhysicalVolume*) const {
G4double dims[3] = {fMotherDimensions[0],fMotherDimensions[1],fMotherDimensions[2]};
G4double dim;
if(copyNo == 0)
dim = fSegmentPositions[copyNo]/2.;
else
dim = (fSegmentPositions[copyNo] - fSegmentPositions[copyNo-1])/2.;
if(fSegmentAxis == kXAxis) {
dims[0] = dim;
}
if(fSegmentAxis == kYAxis) {
dims[1] = dim;
}
if(fSegmentAxis == kZAxis) {
dims[2] = dim;
}
meshElement.SetXHalfLength(dims[0]);
meshElement.SetYHalfLength(dims[1]);
meshElement.SetZHalfLength(dims[2]);
}
+169 -206
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ScoringCylinder.cc,v 1.6 2008/08/29 02:50:05 akimura Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ScoringCylinder.cc,v 1.16 2010/08/30 08:15:20 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
#include "G4ScoringCylinder.hh"
@@ -37,9 +37,7 @@
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4PVDivision.hh"
#include "G4PVParameterised.hh"
#include "G4VisAttributes.hh"
//#include "G4ScoringCylinderParameterisation.hh"
#include "G4VVisManager.hh"
#include "G4VScoreColorMap.hh"
@@ -54,15 +52,17 @@
G4ScoringCylinder::G4ScoringCylinder(G4String wName)
:G4VScoringMesh(wName), fSegmentDirection(-1),
fMeshElementLogical(0)
:G4VScoringMesh(wName), fMeshElementLogical(0)
{
fShape = cylinderMesh;
fDivisionAxisNames[0] = "Z";
fDivisionAxisNames[1] = "PHI";
fDivisionAxisNames[2] = "R";
}
G4ScoringCylinder::~G4ScoringCylinder()
{
}
{;}
void G4ScoringCylinder::Construct(G4VPhysicalVolume* fWorldPhys)
{
@@ -90,168 +90,120 @@ void G4ScoringCylinder::SetupGeometry(G4VPhysicalVolume * fWorldPhys) {
// Scoring Mesh
if(verboseLevel > 9) G4cout << fWorldName << G4endl;
G4String tubsName = fWorldName;
G4String tubsName = fWorldName+"_mesh";
if(verboseLevel > 9) G4cout << fSize[0] << ", " << fSize[1] << G4endl;
if(verboseLevel > 9) G4cout << "R max., Dz =: " << fSize[0] << ", " << fSize[1] << G4endl;
G4VSolid * tubsSolid = new G4Tubs(tubsName+"0", // name
0., // R min
fSize[0], // R max
fSize[1], // dZ
fSize[1], // Dz
0., // starting phi
twopi*rad); // segment phi
twopi*rad); // segment phi
G4LogicalVolume * tubsLogical = new G4LogicalVolume(tubsSolid, 0, tubsName);
new G4PVPlacement(fRotationMatrix, fCenterPosition,
tubsLogical, tubsName+"0", worldLogical, false, 0);
if(verboseLevel > 9) G4cout << " # of segments : r, phi, z =: "
<< fNSegment[IR] << ", " << fNSegment[IPHI] << ", " << fNSegment[IZ] << G4endl;
G4String layerName[2] = {tubsName + "1", tubsName + "2"};
G4VSolid * layerSolid[2];
G4LogicalVolume * layerLogical[2];
//-- fisrt nested layer (replicated along r direction)
//-- fisrt nested layer (replicated along z direction)
if(verboseLevel > 9) G4cout << "layer 1 :" << G4endl;
layerSolid[0] = new G4Tubs(layerName[0],
0.,
fSize[0]/fNSegment[0],
fSize[1],
0., twopi*rad);
layerSolid[0] = new G4Tubs(layerName[0], // name
0., // inner radius
fSize[0], // outer radius
fSize[1]/fNSegment[IZ], // half len. in z
0., // starting phi angle
twopi*rad); // delta angle of the segment
layerLogical[0] = new G4LogicalVolume(layerSolid[0], 0, layerName[0]);
if(fNSegment[0] > 1) {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along r direction" << G4endl;
G4double r = fSize[0]/fNSegment[0];
//if(G4ScoringManager::GetReplicaLevel()>0) {
if(false) { // always use G4PVDivision
if(fNSegment[IZ] > 1) {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along z direction" << G4endl;
if(G4ScoringManager::GetReplicaLevel()>0) {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replica" << G4endl;
new G4PVReplica(layerName[0], layerLogical[0], tubsLogical, kRho,
fNSegment[0], r, 0.);
new G4PVReplica(layerName[0], layerLogical[0], tubsLogical, kZAxis, fNSegment[IZ], 2.*fSize[1]/fNSegment[IZ]);
} else {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Division" << G4endl;
new G4PVDivision(layerName[0], layerLogical[0], tubsLogical, kRho,
fNSegment[0], 0.);
new G4PVDivision(layerName[0], layerLogical[0], tubsLogical, kZAxis, fNSegment[IZ], 0.);
}
} else if(fNSegment[0] == 1) {
} else if(fNSegment[IZ] == 1) {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Placement" << G4endl;
new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[0], layerName[0], tubsLogical, false, 0);
} else {
G4cerr << "G4ScoringCylinder::SetupGeometry() : invalid parameter ("
<< fNSegment[0] << ") "
<< fNSegment[IZ] << ") "
<< "in placement of the first nested layer." << G4endl;
}
if(verboseLevel > 9) {
G4cout << fSize[0] << ", "
<< fSize[1]
<< G4endl;
G4cout << layerName[0] << ": kRho, "
<< fNSegment[0] << ", "
<< fSize[0]/fNSegment[0] << G4endl;
}
// second nested layer (replicated along z direction)
// second nested layer (replicated along phi direction)
if(verboseLevel > 9) G4cout << "layer 2 :" << G4endl;
layerSolid[1] = new G4Tubs(layerName[1],
0.,
fSize[0],///fNSegment[0],
fSize[1]/fNSegment[1],
0., twopi*rad);
fSize[0],
fSize[1]/fNSegment[IZ],
0.,
twopi*rad/fNSegment[IPHI]);
layerLogical[1] = new G4LogicalVolume(layerSolid[1], 0, layerName[1]);
if(fNSegment[1] > 1) {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along z direction" << G4endl;
G4double width = fSize[1]/fNSegment[1]*2.;
//if(G4ScoringManager::GetReplicaLevel()>1) {
if(false) { // always use G4PVDivision
if(fNSegment[IPHI] > 1) {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along phi direction" << G4endl;
if(G4ScoringManager::GetReplicaLevel()>1) {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replica" << G4endl;
new G4PVReplica(layerName[1], layerLogical[1], layerLogical[0], kZAxis,
fNSegment[1], width);
new G4PVReplica(layerName[1], layerLogical[1], layerLogical[0], kPhi,
fNSegment[IPHI], twopi*rad/fNSegment[IPHI]);
} else {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Division" << G4endl;
new G4PVDivision(layerName[1], layerLogical[1], layerLogical[0], kZAxis,
fNSegment[1], 0.);
new G4PVDivision(layerName[1], layerLogical[1], layerLogical[0], kPhi, fNSegment[IPHI], 0.);
}
} else if(fNSegment[1] == 1) {
} else if(fNSegment[IPHI] == 1) {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Placement" << G4endl;
new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[1], layerName[1], layerLogical[0], false, 0);
} else
G4cerr << "ERROR : G4ScoringCylinder::SetupGeometry() : invalid parameter ("
<< fNSegment[1] << ") "
<< fNSegment[IPHI] << ") "
<< "in placement of the second nested layer." << G4endl;
if(verboseLevel > 9) {
G4cout << fSize[0]/fNSegment[0] << ", "
<< fSize[1]/fNSegment[1] << G4endl;
G4cout << layerName[1] << ": kZAxis, "
<< fNSegment[1] << ", "
<< fSize[1]/fNSegment[1] << G4endl;
}
// mesh elements
if(verboseLevel > 9) G4cout << "mesh elements :" << G4endl;
G4String elementName = tubsName +"3";
G4VSolid * elementSolid = new G4Tubs(elementName,
0.,
fSize[0],//fNSegment[0],
fSize[1]/fNSegment[1],
0., twopi*rad/fNSegment[2]);
fSize[0]/fNSegment[IR],
fSize[1]/fNSegment[IZ],
0.,
twopi*rad/fNSegment[IPHI]);
fMeshElementLogical = new G4LogicalVolume(elementSolid, 0, elementName);
if(fNSegment[2] > 1) {
if(fNSegment[IR] > 1) {
/*
if(fSegmentPositions.size() > 0) {
G4double motherDims[3] ={fSize[0]/fsegParam[2][0],
fSize[1]/fsegParam[2][1],
fSize[2]/fsegParam[2][2]};
G4int nelement = fSegmentPositions.size() + 1;
//G4ScoringCylinderParameterisation * param =
G4VPVParameterisation * param =
new G4ScoringCylinderParameterisation(axis[2], motherDims, fSegmentPositions);
new G4PVParameterised(elementName,
fMeshElementLogical,
layerLogical[1],
axis[2],
nelement,
param);
} else {
*/
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along phi direction" << G4endl;
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replicate along r direction" << G4endl;
G4double angle = twopi*rad/fNSegment[2];
//if(G4ScoringManager::GetReplicaLevel()>2) {
if(false) { // always use G4PVDivision
if(G4ScoringManager::GetReplicaLevel()>2) {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Replica" << G4endl;
new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kPhi,
fNSegment[2], angle, 0.);
new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kRho,
fNSegment[IR], fSize[0]/fNSegment[IR]);
} else {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Division" << G4endl;
new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kPhi,
fNSegment[2], 0.);
new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kRho, fNSegment[IR], 0.);
}
//}
} else if(fNSegment[2] == 1) {
} else if(fNSegment[IR] == 1) {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::Construct() : Placement" << G4endl;
new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), fMeshElementLogical, elementName, layerLogical[1], false, 0);
} else {
G4cerr << "G4ScoringCylinder::SetupGeometry() : "
<< "invalid parameter (" << fNSegment[2] << ") "
<< "invalid parameter (" << fNSegment[IR] << ") "
<< "in mesh element placement." << G4endl;
}
if(verboseLevel > 9) {
G4cout << fSize[0]/fNSegment[0] << ", "
<< fSize[1]/fNSegment[1] << G4endl;
G4cout << elementName << ": kPhi, "
<< fNSegment[2] << G4endl;
}
// set the sensitive detector
fMeshElementLogical->SetSensitiveDetector(fMFD);
// vis. attributes
G4VisAttributes * visatt = new G4VisAttributes(G4Colour(.5,.5,.5,0.1));
G4VisAttributes * visatt = new G4VisAttributes(G4Colour(.5,.5,.5));
visatt->SetVisibility(true);
//layerLogical[0]->SetVisAttributes(visatt);
//layerLogical[1]->SetVisAttributes(visatt);
layerLogical[0]->SetVisAttributes(visatt);
layerLogical[1]->SetVisAttributes(visatt);
visatt = new G4VisAttributes(G4Colour(.5,.5,.5,0.01));
//visatt->SetForceSolid(true);
fMeshElementLogical->SetVisAttributes(visatt);
@@ -271,48 +223,39 @@ void G4ScoringCylinder::List() const {
void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg) {
G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance();
if(pVisManager) {
// cell vectors
std::vector<std::vector<std::vector<double> > > cell; // cell[R][Z][PHI]
std::vector<double> ephi;
for(int phi = 0; phi < fNSegment[2]; phi++) ephi.push_back(0.);
std::vector<std::vector<double> > ezphi;
for(int z = 0; z < fNSegment[1]; z++) ezphi.push_back(ephi);
for(int r = 0; r < fNSegment[0]; r++) cell.push_back(ezphi);
std::vector<std::vector<double> > rzcell; // rzcell[R][Z]
std::vector<double> ez;
for(int z = 0; z < fNSegment[1]; z++) ez.push_back(0.);
for(int r = 0; r < fNSegment[0]; r++) rzcell.push_back(ez);
for(int phi = 0; phi < fNSegment[IPHI]; phi++) ephi.push_back(0.);
//-
std::vector<std::vector<double> > zphicell; // zphicell[Z][PHI]
for(int z = 0; z < fNSegment[1]; z++) zphicell.push_back(ephi);
for(int z = 0; z < fNSegment[IZ]; z++) zphicell.push_back(ephi);
//-
std::vector<std::vector<double> > rphicell; // rphicell[R][PHI]
for(int r = 0; r < fNSegment[0]; r++) rphicell.push_back(ephi);
for(int r = 0; r < fNSegment[IR]; r++) rphicell.push_back(ephi);
// search max. values
G4double rzmin = DBL_MAX, zphimin = DBL_MAX, rphimin = DBL_MAX;
G4double rzmax = 0., zphimax = 0., rphimax = 0.;
G4double zphimin = DBL_MAX, rphimin = DBL_MAX;
G4double zphimax = 0., rphimax = 0.;
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->end(); itr++) {
if(itr->first < 0) {
G4cout << itr->first << G4endl;
continue;
}
GetRZPhi(itr->first, q);
rzcell[q[0]][q[1]] += *(itr->second);
if(rzmin > rzcell[q[0]][q[1]]) rzmin = rzcell[q[0]][q[1]];
if(rzmax < rzcell[q[0]][q[1]]) rzmax = rzcell[q[0]][q[1]];
zphicell[q[1]][q[2]] += *(itr->second);
if(zphimin > zphicell[q[1]][q[2]]) zphimin = zphicell[q[1]][q[2]];
if(zphimax < zphicell[q[1]][q[2]]) zphimax = zphicell[q[1]][q[2]];
rphicell[q[0]][q[2]] += *(itr->second);
if(rphimin > rphicell[q[0]][q[2]]) rphimin = rphicell[q[0]][q[2]];
if(rphimax < rphicell[q[0]][q[2]]) rphimax = rphicell[q[0]][q[2]];
// projections
zphicell[q[IZ]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
if(zphimin > zphicell[q[IZ]][q[IPHI]]) zphimin = zphicell[q[IZ]][q[IPHI]];
if(zphimax < zphicell[q[IZ]][q[IPHI]]) zphimax = zphicell[q[IZ]][q[IPHI]];
//-
rphicell[q[IR]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
if(rphimin > rphicell[q[IR]][q[IPHI]]) rphimin = rphicell[q[IR]][q[IPHI]];
if(rphimax < rphicell[q[IR]][q[IPHI]]) rphimax = rphicell[q[IR]][q[IPHI]];
}
G4VisAttributes att;
@@ -329,22 +272,18 @@ void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap*
// z-phi plane
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(zphimin, zphimax); }
G4double zhalf = fSize[1]/fNSegment[1];
for(int phi = 0; phi < fNSegment[2]; phi++) {
for(int z = 0; z < fNSegment[1]; z++) {
G4double angle = twopi/fNSegment[2]*phi;
G4double dphi = twopi/fNSegment[2];
G4Tubs cylinder("z-phi", fSize[0]*0.99, fSize[0], zhalf,
angle, dphi*0.99999);
/*
G4cout << ">>>> "
<< fSize[1]/fNSegment[1]/2. << " : "
<< angle << " - " << angle + dphi
<< G4endl;
*/
G4ThreeVector zpos(0., 0., -fSize[1] + fSize[1]/fNSegment[1]*(1 + 2.*z));
G4double zhalf = fSize[1]/fNSegment[IZ];
for(int phi = 0; phi < fNSegment[IPHI]; phi++) {
for(int z = 0; z < fNSegment[IZ]; z++) {
//-
G4double angle = twopi/fNSegment[IPHI]*phi;
G4double dphi = twopi/fNSegment[IPHI];
G4Tubs cylinder("z-phi", // name
fSize[0]*0.99, fSize[0], // inner radius, outer radius
zhalf, // half length in z
angle, dphi*0.99999); // starting phi angle, delta angle
//-
G4ThreeVector zpos(0., 0., -fSize[1] + fSize[1]/fNSegment[IZ]*(1 + 2.*z));
G4Transform3D trans;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(zpos);
@@ -355,10 +294,7 @@ void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap*
G4double c[4];
colorMap->GetMapColor(zphicell[z][phi], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
/*
G4cout << " " << c[0] << ", "
<< c[1] << ", " << c[2] << G4endl;
*/
//-
pVisManager->Draw(cylinder, att, trans);
}
}
@@ -368,13 +304,13 @@ void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap*
// r-phi plane
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(rphimin, rphimax); }
G4double rsize = fSize[0]/fNSegment[0];
for(int phi = 0; phi < fNSegment[2]; phi++) {
for(int r = 0; r < fNSegment[0]; r++) {
G4double rsize = fSize[0]/fNSegment[IR];
for(int phi = 0; phi < fNSegment[IPHI]; phi++) {
for(int r = 0; r < fNSegment[IR]; r++) {
G4double rs[2] = {rsize*r, rsize*(r+1)};
G4double angle = twopi/fNSegment[2]*phi;
G4double dphi = twopi/fNSegment[2];
G4double angle = twopi/fNSegment[IPHI]*phi;
G4double dphi = twopi/fNSegment[IPHI];
G4Tubs cylinder("z-phi", rs[0], rs[1], 0.001,
angle, dphi*0.99999);
/*
@@ -408,60 +344,80 @@ void G4ScoringCylinder::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap*
}
}
}
colorMap->SetPSUnit(fDrawUnit);
colorMap->SetPSName(fDrawPSName);
colorMap->DrawColorChart();
}
}
void G4ScoringCylinder::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
G4int idxProj, G4int idxColumn)
{
G4int projAxis = 0;
switch(idxProj) {
case 0:
projAxis = IR;
break;
case 1:
projAxis = IZ;
break;
case 2:
projAxis = IPHI;
break;
}
if(idxColumn<0 || idxColumn>=fNSegment[idxProj])
if(idxColumn<0 || idxColumn>=fNSegment[projAxis])
{
G4cerr << "ERROR : Column number " << idxColumn << " is out of scoring mesh [0," << fNSegment[idxProj]-1 <<
G4cerr << "Warning : Column number " << idxColumn << " is out of scoring mesh [0," << fNSegment[projAxis]-1 <<
"]. Method ignored." << G4endl;
return;
}
G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance();
if(pVisManager) {
// cell vectors
std::vector<std::vector<std::vector<double> > > cell; // cell[R][Z][PHI]
std::vector<double> ephi;
for(int phi = 0; phi < fNSegment[2]; phi++) ephi.push_back(0.);
for(int phi = 0; phi < fNSegment[IPHI]; phi++) ephi.push_back(0.);
std::vector<std::vector<double> > ezphi;
for(int z = 0; z < fNSegment[1]; z++) ezphi.push_back(ephi);
for(int r = 0; r < fNSegment[0]; r++) cell.push_back(ezphi);
for(int z = 0; z < fNSegment[IZ]; z++) ezphi.push_back(ephi);
for(int r = 0; r < fNSegment[IR]; r++) cell.push_back(ezphi);
std::vector<std::vector<double> > rzcell; // rzcell[R][Z]
std::vector<double> ez;
for(int z = 0; z < fNSegment[1]; z++) ez.push_back(0.);
for(int r = 0; r < fNSegment[0]; r++) rzcell.push_back(ez);
for(int z = 0; z < fNSegment[IZ]; z++) ez.push_back(0.);
for(int r = 0; r < fNSegment[IR]; r++) rzcell.push_back(ez);
std::vector<std::vector<double> > zphicell; // zphicell[Z][PHI]
for(int z = 0; z < fNSegment[1]; z++) zphicell.push_back(ephi);
for(int z = 0; z < fNSegment[IZ]; z++) zphicell.push_back(ephi);
std::vector<std::vector<double> > rphicell; // rphicell[R][PHI]
for(int r = 0; r < fNSegment[0]; r++) rphicell.push_back(ephi);
for(int r = 0; r < fNSegment[IR]; r++) rphicell.push_back(ephi);
// search max. values
G4double rzmax = 0., zphimax = 0., rphimax = 0.;
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->end(); itr++) {
if(itr->first < 0) {
G4cout << itr->first << G4endl;
continue;
}
GetRZPhi(itr->first, q);
if(idxProj == 0 && q[0] == idxColumn) { // zphi plane
zphicell[q[1]][q[2]] += *(itr->second);
if(zphimax < zphicell[q[1]][q[2]]) zphimax = zphicell[q[1]][q[2]];
if(projAxis == IR && q[IR] == idxColumn) { // zphi plane
zphicell[q[IZ]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
if(zphimax < zphicell[q[IZ]][q[IPHI]]) zphimax = zphicell[q[IZ]][q[IPHI]];
}
if(idxProj == 1 && q[1] == idxColumn) { // rphi plane
rphicell[q[0]][q[2]] += *(itr->second);
if(rphimax < rphicell[q[0]][q[2]]) rphimax = rphicell[q[0]][q[2]];
if(projAxis == IZ && q[IZ] == idxColumn) { // rphi plane
rphicell[q[IR]][q[IPHI]] += *(itr->second)/fDrawUnitValue;
if(rphimax < rphicell[q[IR]][q[IPHI]]) rphimax = rphicell[q[IR]][q[IPHI]];
}
if(idxProj == 2 && q[2] == idxColumn) { // rz plane
rzcell[q[0]][q[1]] += *(itr->second);
if(rzmax < rzcell[q[0]][q[1]]) rzmax = rzcell[q[0]][q[1]];
if(projAxis == IPHI && q[IPHI] == idxColumn) { // rz plane
rzcell[q[IR]][q[IZ]] += *(itr->second)/fDrawUnitValue;
if(rzmax < rzcell[q[IR]][q[IZ]]) rzmax = rzcell[q[IR]][q[IZ]];
}
}
@@ -471,22 +427,22 @@ void G4ScoringCylinder::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreCol
G4Scale3D scale;
// r-phi plane
if(idxProj == 0) {
// z-phi plane
if(projAxis == IR) {
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(0.,zphimax); }
G4double zhalf = fSize[1]/fNSegment[1];
G4double rsize[2] = {fSize[0]/fNSegment[0]*idxColumn,
fSize[0]/fNSegment[0]*(idxColumn+1)};
for(int phi = 0; phi < fNSegment[2]; phi++) {
for(int z = 0; z < fNSegment[1]; z++) {
G4double zhalf = fSize[1]/fNSegment[IZ];
G4double rsize[2] = {fSize[0]/fNSegment[IR]*idxColumn,
fSize[0]/fNSegment[IR]*(idxColumn+1)};
for(int phi = 0; phi < fNSegment[IPHI]; phi++) {
for(int z = 0; z < fNSegment[IZ]; z++) {
G4double angle = twopi/fNSegment[2]*phi*radian;
G4double dphi = twopi/fNSegment[2]*radian;
G4double angle = twopi/fNSegment[IPHI]*phi*radian;
G4double dphi = twopi/fNSegment[IPHI]*radian;
G4Tubs cylinder("z-phi", rsize[0], rsize[1], zhalf,
angle, dphi*0.99999);
G4ThreeVector zpos(0., 0., -fSize[1] + fSize[1]/fNSegment[1]*(1 + 2.*z));
G4ThreeVector zpos(0., 0., -fSize[1] + fSize[1]/fNSegment[IZ]*(1 + 2.*z));
G4Transform3D trans;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(zpos);
@@ -502,21 +458,21 @@ void G4ScoringCylinder::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreCol
}
// r-phi plane
} else if(idxProj == 1) {
} else if(projAxis == IZ) {
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(0.,rphimax); }
G4double rsize = fSize[0]/fNSegment[0];
for(int phi = 0; phi < fNSegment[2]; phi++) {
for(int r = 0; r < fNSegment[0]; r++) {
G4double rsize = fSize[0]/fNSegment[IR];
for(int phi = 0; phi < fNSegment[IPHI]; phi++) {
for(int r = 0; r < fNSegment[IR]; r++) {
G4double rs[2] = {rsize*r, rsize*(r+1)};
G4double angle = twopi/fNSegment[2]*phi*radian;
G4double dz = fSize[1]/fNSegment[1];
G4double dphi = twopi/fNSegment[2]*radian;
G4double angle = twopi/fNSegment[IPHI]*phi*radian;
G4double dz = fSize[1]/fNSegment[IZ];
G4double dphi = twopi/fNSegment[IPHI]*radian;
G4Tubs cylinder("r-phi", rs[0], rs[1], dz,
angle, dphi*0.99999);
G4ThreeVector zpos(0., 0.,
-fSize[1]+fSize[1]/fNSegment[1]*(idxColumn*2+1));
-fSize[1]+fSize[1]/fNSegment[IZ]*(idxColumn*2+1));
G4Transform3D trans;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(zpos);
@@ -532,22 +488,22 @@ void G4ScoringCylinder::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreCol
}
// r-z plane
} else if(idxProj == 2) {
} else if(projAxis == IPHI) {
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(0.,rzmax); }
G4double rsize = fSize[0]/fNSegment[0];
G4double zhalf = fSize[1]/fNSegment[1];
G4double angle = twopi/fNSegment[2]*idxColumn*radian;
G4double dphi = twopi/fNSegment[2]*radian;
for(int z = 0; z < fNSegment[1]; z++) {
for(int r = 0; r < fNSegment[0]; r++) {
G4double rsize = fSize[0]/fNSegment[IR];
G4double zhalf = fSize[1]/fNSegment[IZ];
G4double angle = twopi/fNSegment[IPHI]*idxColumn*radian;
G4double dphi = twopi/fNSegment[IPHI]*radian;
for(int z = 0; z < fNSegment[IZ]; z++) {
for(int r = 0; r < fNSegment[IR]; r++) {
G4double rs[2] = {rsize*r, rsize*(r+1)};
G4Tubs cylinder("z-phi", rs[0], rs[1], zhalf,
angle, dphi);
G4ThreeVector zpos(0., 0.,
-fSize[1]+fSize[1]/fNSegment[1]*(2.*z+1));
-fSize[1]+fSize[1]/fNSegment[IZ]*(2.*z+1));
G4Transform3D trans;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(zpos);
@@ -564,14 +520,21 @@ void G4ScoringCylinder::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreCol
}
}
colorMap->SetPSUnit(fDrawUnit);
colorMap->SetPSName(fDrawPSName);
colorMap->DrawColorChart();
}
void G4ScoringCylinder::GetRZPhi(G4int index, G4int q[3]) const {
// index = k + j * k-size + i * jk-plane-size
q[0] = index/(fNSegment[2]*fNSegment[1]);
q[1] = (index - q[0]*fNSegment[2]*fNSegment[1])/fNSegment[2];
q[2] = index - q[1]*fNSegment[2] - q[0]*fNSegment[2]*fNSegment[1];
// nested : z -> phi -> r
G4int i = IZ;
G4int j = IPHI;
G4int k = IR;
G4int jk = fNSegment[j]*fNSegment[k];
q[i] = index/jk;
q[j] = (index - q[i]*jk)/fNSegment[k];
q[k] = index - q[j]*fNSegment[k] - q[i]*jk;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ScoringManager.cc,v 1.31 2008/03/25 02:18:38 akimura Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ScoringManager.cc,v 1.33 2010/09/24 05:51:27 asaim Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
#include "G4ScoringManager.hh"
@@ -39,7 +39,7 @@
G4ScoringManager* G4ScoringManager::fSManager = 0;
G4int G4ScoringManager::replicaLevel = 2;
G4int G4ScoringManager::replicaLevel = 3;
G4ScoringManager* G4ScoringManager::GetScoringManager()
{
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ScoringMessenger.cc,v 1.39 2008/11/26 21:27:35 asaim Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ScoringMessenger.cc,v 1.42 2010/07/26 03:52:33 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
// ---------------------------------------------------------------------
@@ -184,7 +184,8 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
drawCmd = new G4UIcommand("/score/drawProjection",this);
drawCmd->SetGuidance("Draw projection(s) of scored quantities.");
drawCmd->SetGuidance("Parameter <proj> specified which projection(s) to be drawn.");
drawCmd->SetGuidance(" 100 : xy-plane, 010 : yz-place, 001 : zx-plane -- default 111");
drawCmd->SetGuidance(" 100 : xy-plane, 010 : yz-plane, 001 : zx-plane -- default 111");
drawCmd->SetGuidance(" 100 : N/A, 010 : z_phi-plane, 001 : r_phi-plane -- default 111");
param = new G4UIparameter("meshName",'s',false);
drawCmd->SetParameter(param);
param = new G4UIparameter("psName",'s',false);
@@ -199,7 +200,8 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
// Draw column
drawColumnCmd = new G4UIcommand("/score/drawColumn",this);
drawColumnCmd->SetGuidance("Draw a cell column.");
drawColumnCmd->SetGuidance(" plane = 0 : xy, 1: yz, 2: zx");
drawColumnCmd->SetGuidance(" plane = 0 : x-y, 1: y-z, 2: z-x for box mesh");
drawColumnCmd->SetGuidance(" 0 : z-phi, 1: r-phi, 2: r-z for cylinder mesh");
param = new G4UIparameter("meshName",'s',false);
drawColumnCmd->SetParameter(param);
param = new G4UIparameter("psName",'s',false);
@@ -234,6 +236,7 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
param = new G4UIparameter("maxValue",'d',false);
colorMapMinMaxCmd->SetParameter(param);
/*
chartCmd = new G4UIcommand("/score/drawChart",this);
chartCmd->SetGuidance("Draw color chart on the screen.");
chartCmd->SetGuidance("[usage] /score/drawChart");
@@ -251,7 +254,8 @@ G4ScoringMessenger::G4ScoringMessenger(G4ScoringManager* SManager)
param = new G4UIparameter("scale",'s',true);
param->SetDefaultValue("linear");
chartCmd->SetParameter(param);
*/
// Dump a scored quantity
dumpQtyToFileCmd = new G4UIcommand("/score/dumpQuantityToFile", this);
dumpQtyToFileCmd->SetGuidance("Dump one scored quantity to file.");
@@ -540,9 +544,20 @@ void G4ScoringMessenger::MeshBinCommand(G4VScoringMesh* mesh,G4TokenVec& token){
G4int Nj = StoI(token[1]);
G4int Nk = StoI(token[2]);
G4int nSegment[3];
nSegment[0] = Ni;
nSegment[1] = Nj;
nSegment[2] = Nk;
if(dynamic_cast<G4ScoringBox*>(mesh)) {
G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringBox" << G4endl;
nSegment[0] = Ni;
nSegment[1] = Nj;
nSegment[2] = Nk;
} else if(dynamic_cast<G4ScoringCylinder*>(mesh)) {
G4cout << ".... G4ScoringMessenger::MeshBinCommand - G4ScoringCylinder" << G4endl;
nSegment[0] = Nj;
nSegment[1] = Nk;
nSegment[2] = Ni;
} else {
G4Exception("G4ScoringMessenger::MeshBinCommand()", "001", FatalException, "invalid mesh type");
}
//
mesh->SetNumberOfSegments(nSegment);
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VScoreColorMap.cc,v 1.4 2009/05/04 15:57:33 akimura Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VScoreColorMap.cc,v 1.8 2010/07/26 03:52:33 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
#include "G4VScoreColorMap.hh"
@@ -79,6 +79,7 @@ void G4VScoreColorMap::DrawColorChartBar(G4int _nPoint) {
}
void G4VScoreColorMap::DrawColorChartText(G4int _nPoint) {
G4double min = this->GetMin();
G4double max = this->GetMax();
G4double c[4];
@@ -114,4 +115,52 @@ void G4VScoreColorMap::DrawColorChartText(G4int _nPoint) {
fVisManager->Draw2D(text);
}
// draw ps name
// background
G4int lpsname = 20;//fPSName.size();
if(lpsname > 0) {
for(int l = 0; l < 22; l++) {
G4Polyline line;
line.push_back(G4Point3D(-0.9, -0.965+0.002*l, 0.));
line.push_back(G4Point3D(-0.9+0.025*lpsname, -0.965+0.002*l, 0.));
G4VisAttributes attblack(black);
//G4VisAttributes attblack(G4Colour(.5, .5, 1.));
line.SetVisAttributes(&attblack);
fVisManager->Draw2D(line);
}
// ps name
G4Text txtpsname(fPSName, G4Point3D(-0.9, -0.96, 0.));
G4double size = 12.;
txtpsname.SetScreenSize(size);
G4Colour color(1., 1., 1.);
G4VisAttributes att(color);
txtpsname.SetVisAttributes(&att);
fVisManager->Draw2D(txtpsname);
}
// draw unit
// background
G4int len = fPSUnit.size();
if(len > 0) {
for(int l = 0; l < 21; l++) {
G4Polyline line;
line.push_back(G4Point3D(-0.7, -0.9+0.002*l, 0.));
line.push_back(G4Point3D(-0.7+0.3, -0.9+0.002*l, 0.));
G4VisAttributes attblack(black);
//G4VisAttributes attblack(G4Colour(.5, .5, .5));
line.SetVisAttributes(&attblack);
fVisManager->Draw2D(line);
}
// unit
G4String psunit = "[" + fPSUnit + "]";
G4Text txtunit(psunit, G4Point3D(-0.69, -0.9, 0.));
G4double size = 12.;
txtunit.SetScreenSize(size);
G4Colour color(1., 1., 1.);
G4VisAttributes att(color);
txtunit.SetVisAttributes(&att);
fVisManager->Draw2D(txtunit);
}
}
+39 -6
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VScoreWriter.cc,v 1.5 2008/03/04 23:19:09 taso Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VScoreWriter.cc,v 1.10 2010/07/27 01:44:54 akimura Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
#include "G4VScoreWriter.hh"
@@ -86,8 +86,24 @@ void G4VScoreWriter::DumpQuantityToFile(G4String & psName, G4String & fileName,
<< psName << "\"." << G4endl;
return;
}
std::map<G4int, G4double*> * score = msMapItr->second->GetMap();
ofile << "# primitive scorer name: " << msMapItr->first << G4endl;
ofile << "# primitive scorer name: " << msMapItr->first << std::endl;
G4double unitValue = fScoringMesh->GetPSUnitValue(psName);
G4String unit = fScoringMesh->GetPSUnit(psName);
G4String divisionAxisNames[3];
fScoringMesh->GetDivisionAxisNames(divisionAxisNames);
// index order
ofile << "# i" << divisionAxisNames[0]
<< ", i" << divisionAxisNames[1]
<< ", i" << divisionAxisNames[2];
// unit of scored value
ofile << ", value ";
if(unit.size() > 0) ofile << "[" << unit << "]";
ofile << G4endl;
// "sequence" option: write header info
if(opt.find("sequence") != std::string::npos) {
@@ -110,7 +126,7 @@ void G4VScoreWriter::DumpQuantityToFile(G4String & psName, G4String & fileName,
if(value == score->end()) {
ofile << 0.;
} else {
ofile << *(value->second);
ofile << *(value->second)/unitValue;
}
if(opt.find("csv") != std::string::npos) {
@@ -159,8 +175,25 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(G4String & fileName, G4String & opt
MeshScoreMap::const_iterator msMapItr = fSMap.begin();
std::map<G4int, G4double*> * score;
for(; msMapItr != fSMap.end(); msMapItr++) {
G4String psname = msMapItr->first;
score = msMapItr->second->GetMap();
ofile << "# primitive scorer name: " << msMapItr->first << G4endl;
ofile << "# primitive scorer name: " << msMapItr->first << std::endl;
G4double unitValue = fScoringMesh->GetPSUnitValue(psname);
G4String unit = fScoringMesh->GetPSUnit(psname);
G4String divisionAxisNames[3];
fScoringMesh->GetDivisionAxisNames(divisionAxisNames);
// index order
ofile << "# i" << divisionAxisNames[0]
<< ", i" << divisionAxisNames[1]
<< ", i" << divisionAxisNames[2];
// unit of scored value
ofile << ", value ";
if(unit.size() > 0) ofile << "[" << unit << "]";
ofile << G4endl;
// "sequence" option: write header info
if(opt.find("sequence") != std::string::npos) {
@@ -183,7 +216,7 @@ void G4VScoreWriter::DumpAllQuantitiesToFile(G4String & fileName, G4String & opt
if(value == score->end()) {
ofile << 0.;
} else {
ofile << *(value->second);
ofile << *(value->second)/unitValue;
}
if(opt.find("csv") != std::string::npos) {
+76 -3
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VScoringMesh.cc,v 1.37 2009/10/12 04:11:25 akimura Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4VScoringMesh.cc,v 1.43 2010/11/09 00:29:55 asaim Exp $
// GEANT4 tag $Name: geant4-09-04 $
//
#include "G4VScoringMesh.hh"
@@ -38,12 +38,14 @@
G4VScoringMesh::G4VScoringMesh(G4String wName)
: fWorldName(wName),fConstructed(false),fActive(true),
fRotationMatrix(NULL), fMFD(new G4MultiFunctionalDetector(wName)),
verboseLevel(0),sizeIsSet(false),nMeshIsSet(false)
verboseLevel(0),sizeIsSet(false),nMeshIsSet(false),
fDrawUnit(""), fDrawUnitValue(1.)
{
G4SDManager::GetSDMpointer()->AddNewDetector(fMFD);
fSize[0] = fSize[1] = fSize[2] = 0.;
fNSegment[0] = fNSegment[1] = fNSegment[2] = 1;
fDivisionAxisNames[0] = fDivisionAxisNames[1] = fDivisionAxisNames[2] = "";
}
G4VScoringMesh::~G4VScoringMesh()
@@ -151,6 +153,50 @@ G4bool G4VScoringMesh::FindPrimitiveScorer(G4String & psname) {
return true;
}
G4String G4VScoringMesh::GetPSUnit(G4String & psname) {
std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.find(psname);;
if(itr == fMap.end()) {
return G4String("");
} else {
return GetPrimitiveScorer(psname)->GetUnit();
}
}
G4String G4VScoringMesh::GetCurrentPSUnit(){
G4String unit = "";
if(fCurrentPS == NULL) {
G4String msg = "ERROR : G4VScoringMesh::GetCurrentPSUnit() : ";
msg += " Current primitive scorer is null.";
G4cerr << msg << G4endl;
}else{
unit = fCurrentPS->GetUnit();
}
return unit;
}
void G4VScoringMesh::SetCurrentPSUnit(const G4String& unit){
if(fCurrentPS == NULL) {
G4String msg = "ERROR : G4VScoringMesh::GetCurrentPSUnit() : ";
msg += " Current primitive scorer is null.";
G4cerr << msg << G4endl;
}else{
fCurrentPS->SetUnit(unit);
}
}
G4double G4VScoringMesh::GetPSUnitValue(G4String & psname) {
std::map<G4String, G4THitsMap<G4double>* >::iterator itr = fMap.find(psname);;
if(itr == fMap.end()) {
return 1.;
} else {
return GetPrimitiveScorer(psname)->GetUnitValue();
}
}
void G4VScoringMesh::GetDivisionAxisNames(G4String divisionAxisNames[3]) {
for(int i = 0; i < 3; i++) divisionAxisNames[i] = fDivisionAxisNames[i];
}
G4VPrimitiveScorer * G4VScoringMesh::GetPrimitiveScorer(G4String & name) {
if(fMFD == NULL) return NULL;
@@ -216,3 +262,30 @@ void G4VScoringMesh::Dump() {
}
void G4VScoringMesh::DrawMesh(G4String psName,G4VScoreColorMap* colorMap,G4int axflg)
{
fDrawPSName = psName;
std::map<G4String, G4THitsMap<G4double>* >::const_iterator fMapItr = fMap.find(psName);
if(fMapItr!=fMap.end()) {
fDrawUnit = GetPSUnit(psName);
fDrawUnitValue = GetPSUnitValue(psName);
Draw(fMapItr->second->GetMap(), colorMap,axflg);
} else {
G4cerr << "Scorer <" << psName << "> is not defined. Method ignored." << G4endl;
}
}
void G4VScoringMesh::DrawMesh(G4String psName,G4int idxPlane,G4int iColumn,G4VScoreColorMap* colorMap)
{
fDrawPSName = psName;
std::map<G4String, G4THitsMap<G4double>* >::const_iterator fMapItr = fMap.find(psName);
if(fMapItr!=fMap.end()) {
fDrawUnit = GetPSUnit(psName);
fDrawUnitValue = GetPSUnitValue(psName);
DrawColumn(fMapItr->second->GetMap(),colorMap,idxPlane,iColumn);
} else {
G4cerr << "Scorer <" << psName << "> is not defined. Method ignored." << G4endl;
}
}