Import Geant4 10.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-10 11:51:14 +02:00
parent e2d2f9810a
commit 286caacf06
12421 changed files with 730077 additions and 502383 deletions
+1 -1
View File
@@ -7,7 +7,7 @@
#
# Generated on : 24/9/2010
#
# $Id: CMakeLists.txt,v 1.1 2010-09-29 18:39:08 bmorgan Exp $
# $Id: CMakeLists.txt 66892 2013-01-17 10:57:59Z gunter $
#
#------------------------------------------------------------------------------
+1 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.11 2010-10-27 08:10:13 gcosmo Exp $
# $Id: GNUmakefile 66892 2013-01-17 10:57:59Z gunter $
# --------------------------------------------------------------
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
# --------------------------------------------------------------
+4 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.15 2010-06-14 13:31:06 gcosmo Exp $
$Id: History 74457 2013-10-07 15:21:35Z gcosmo $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,9 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
October 05, 2013 A.Kimura (detutils-V09-06-00)
- Fixed a bug in G4ScoringBox::DrawColumn(...), which was a wrong size check of the column.
June 14, 2010 G.Cosmo (detutils-V09-03-00)
- Added missing virtual destructor to G4VScoringMesh and removed unnecessary
virtual qualifiers to G4ScoringBox.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4DefaultLinearColorMap.hh 67992 2013-03-13 10:59:57Z gcosmo $
//
#ifndef G4DefaultLinearColorMap_h
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoreLogColorMap.hh 67992 2013-03-13 10:59:57Z gcosmo $
//
#ifndef G4ScoreLogColorMap_h
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoreQuantityMessenger.hh 67992 2013-03-13 10:59:57Z gcosmo $
//
// (HISTORY)
// 03-Sep-2007 T.Aso Command definitions are introduced.
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoringBox.hh 68735 2013-04-05 09:49:13Z gcosmo $
//
#ifndef G4ScoringBox_h
@@ -47,7 +47,8 @@ public:
~G4ScoringBox();
public:
void Construct(G4VPhysicalVolume* fWorldPhys);
virtual void Construct(G4VPhysicalVolume* fWorldPhys);
void List() const;
void Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg=111);
void DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
@@ -68,7 +69,6 @@ private:
private:
G4int fSegmentDirection; // =1: x, =2: y, =3: z
G4LogicalVolume * fMeshElementLogical;
};
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoringCylinder.hh 68735 2013-04-05 09:49:13Z gcosmo $
//
#ifndef G4ScoringCylinder_h
@@ -46,6 +46,7 @@ class G4ScoringCylinder : public G4VScoringMesh
public:
virtual void Construct(G4VPhysicalVolume* fWorldPhys);
virtual void List() const;
virtual void Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg=111);
virtual void DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap,
@@ -59,12 +60,13 @@ class G4ScoringCylinder : public G4VScoringMesh
// get 3D index (z,phi,r) from sequential index
void GetRZPhi(G4int index, G4int q[3]) const;
private:
//Xin Dong 09302011 for Scorers
public:
//private:
//enum IDX {IR, IZ, IPHI};
enum IDX {IZ, IPHI, IR};
G4LogicalVolume * fMeshElementLogical;
private:
void SetupGeometry(G4VPhysicalVolume * fWorldPhys);
};
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoringManager.hh 68735 2013-04-05 09:49:13Z gcosmo $
//
#ifndef G4ScoringManager_h
@@ -82,6 +82,7 @@ class G4ScoringManager
public:
void Accumulate(G4VHitsCollection* map);
void Merge(const G4ScoringManager* scMan);
G4VScoringMesh* FindMesh(const G4String&);
void List() const;
void Dump() const;
@@ -98,8 +99,8 @@ class G4ScoringManager
void ListScoreColorMaps();
private:
static G4ScoringManager * fSManager;
static G4int replicaLevel;
static G4ThreadLocal G4ScoringManager * fSManager;
static G4ThreadLocal G4int replicaLevel;
G4int verboseLevel;
G4ScoringMessenger* fMessenger;
G4ScoreQuantityMessenger* fQuantityMessenger;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoringMessenger.hh 78057 2013-12-03 08:31:15Z gcosmo $
//
// (HISTORY)
// 03-Sep-2007 T.Aso Command definitions are introduced.
@@ -124,7 +124,7 @@ class G4ScoringMessenger: public G4UImessenger
G4UIcmdWithoutParameter * listColorMapCmd;
G4UIcmdWithAString * floatMinMaxCmd;
G4UIcommand * colorMapMinMaxCmd;
G4UIcommand * chartCmd;
//G4UIcommand * chartCmd;
//
// Dump scoring result to file
G4UIcommand * dumpQtyToFileCmd;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VScoreColorMap.hh 67992 2013-03-13 10:59:57Z gcosmo $
//
#ifndef G4VScoreColorMap_h
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VScoreWriter.hh 67992 2013-03-13 10:59:57Z gcosmo $
//
#ifndef G4VScoreWriter_h
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VScoringMesh.hh 68735 2013-04-05 09:49:13Z gcosmo $
//
#ifndef G4VScoringMesh_h
@@ -35,6 +35,7 @@
#include "G4RotationMatrix.hh"
class G4VPhysicalVolume;
class G4LogicalVolume;
class G4MultiFunctionalDetector;
class G4VPrimitiveScorer;
class G4VSDFilter;
@@ -58,6 +59,9 @@ class G4VScoringMesh
public: // with description
// a pure virtual function to construct this mesh geometry
virtual void Construct(G4VPhysicalVolume* fWorldPhys)=0;
virtual void WorkerConstruct(G4VPhysicalVolume* fWorldPhys);
// list infomration of this mesh
virtual void List() const;
@@ -75,7 +79,9 @@ class G4VScoringMesh
inline MeshShape GetShape() const
{ return fShape; }
// accumulate hits in a registered primitive scorer
inline void Accumulate(G4THitsMap<G4double> * map);
void Accumulate(G4THitsMap<G4double> * map);
// merge same kind of meshes
void Merge(const G4VScoringMesh * scMesh);
// dump information of primitive socrers registered in this mesh
void Dump();
// draw a projected quantity on a current viewer
@@ -147,7 +153,8 @@ class G4VScoringMesh
inline void SetVerboseLevel(G4int vl)
{ verboseLevel = vl; }
// get the primitive scorer map
MeshScoreMap GetScoreMap() {return fMap;}
inline MeshScoreMap GetScoreMap() const
{ return fMap; }
// get whether this mesh setup has been ready
inline G4bool ReadyForQuantity() const
{ return (sizeIsSet && nMeshIsSet); }
@@ -181,28 +188,15 @@ protected:
G4String fDrawPSName;
G4String fDivisionAxisNames[3];
G4LogicalVolume * fMeshElementLogical;
public:
inline void SetMeshElementLogical(G4LogicalVolume* val)
{ fMeshElementLogical = val; }
inline G4LogicalVolume* GetMeshElementLogical() const
{ return fMeshElementLogical; }
};
void G4VScoringMesh::Accumulate(G4THitsMap<G4double> * map)
{
G4String psName = map->GetName();
std::map<G4String, G4THitsMap<G4double>* >::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();
}
G4cout << G4endl;
}
}
#endif
+1 -1
View File
@@ -11,7 +11,7 @@
#
# Generated on : 24/9/2010
#
# $Id: sources.cmake,v 1.2 2010-10-19 09:54:03 gcosmo Exp $
# $Id: sources.cmake 66892 2013-01-17 10:57:59Z gunter $
#
#------------------------------------------------------------------------------
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4DefaultLinearColorMap.cc 67992 2013-03-13 10:59:57Z gcosmo $
//
#include "G4DefaultLinearColorMap.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoreLogColorMap.cc 67992 2013-03-13 10:59:57Z gcosmo $
//
#include "G4ScoreLogColorMap.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoreQuantityMessenger.cc 73819 2013-09-12 15:52:52Z gcosmo $
//
// ---------------------------------------------------------------------
// Modifications
@@ -33,6 +33,9 @@
// 24-Mar-2011 T.Aso Size and segmentation for replicated cylinder.
// 01-Jun-2012 T.Aso Support weighted/dividedByArea options
// in flatCurrent and flatFulx commands.
// 27-Mar-2013 T.Aso Unit option in the kineticEnergy filter was
// supported.
//
// ---------------------------------------------------------------------
#include "G4ScoreQuantityMessenger.hh"
@@ -121,11 +124,11 @@ void G4ScoreQuantityMessenger::FilterCommands()
param = new G4UIparameter("elow",'d',true);
param->SetDefaultValue("0.0");
fkinECmd->SetParameter(param);
param = new G4UIparameter("ehigh",'d',false);
param = new G4UIparameter("ehigh",'d',true);
fkinECmd->SetParameter(param);
G4String smax = DtoS(DBL_MAX);
param->SetDefaultValue(smax);
param = new G4UIparameter("unit",'s',false);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultValue("keV");
fkinECmd->SetParameter(param);
//
@@ -228,260 +231,263 @@ void G4ScoreQuantityMessenger::SetNewValue(G4UIcommand * command,G4String newVal
if(command==qTouchCmd) {
mesh->SetCurrentPrimitiveScorer(newVal);
} else if(command == qGetUnitCmd ){
G4cout << "Unit: "<< mesh->GetCurrentPSUnit() <<G4endl;
G4cout << "Unit: "<< mesh->GetCurrentPSUnit() <<G4endl;
} else if(command == qSetUnitCmd ){
mesh->SetCurrentPSUnit(newVal);
mesh->SetCurrentPSUnit(newVal);
} else if(command== qCellChgCmd) {
if ( CheckMeshPS(mesh,token[0]) ){
G4PSCellCharge3D* ps = new G4PSCellCharge3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
if ( CheckMeshPS(mesh,token[0]) ){
G4PSCellCharge3D* ps = new G4PSCellCharge3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qCellFluxCmd) {
if ( CheckMeshPS(mesh,token[0]) ){
if ( CheckMeshPS(mesh,token[0]) ){
if( mesh->GetShape()==boxMesh ) {
G4PSCellFlux3D* ps = new G4PSCellFlux3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
G4PSCellFlux3D* ps = new G4PSCellFlux3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
} else if( mesh->GetShape()==cylinderMesh ) {
G4PSCellFluxForCylinder3D* ps =
new G4PSCellFluxForCylinder3D(token[0]);
new G4PSCellFluxForCylinder3D(token[0]);
ps->SetUnit(token[1]);
G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
ps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
G4int nSeg[3];
mesh->GetNumberOfSegments(nSeg);
ps->SetNumberOfSegments(nSeg);
mesh->SetPrimitiveScorer(ps);
mesh->SetPrimitiveScorer(ps);
}
}
}
} else if(command== qPassCellFluxCmd) {
if ( CheckMeshPS(mesh,token[0]) ){
if ( CheckMeshPS(mesh,token[0]) ){
if( mesh->GetShape()==boxMesh ) {
G4PSPassageCellFlux3D* ps = new G4PSPassageCellFlux3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
G4PSPassageCellFlux3D* ps = new G4PSPassageCellFlux3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
} else if( mesh->GetShape()==cylinderMesh ) {
G4PSPassageCellFluxForCylinder3D* ps =
new G4PSPassageCellFluxForCylinder3D(token[0]);
new G4PSPassageCellFluxForCylinder3D(token[0]);
ps->SetUnit(token[1]);
G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
ps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
G4int nSeg[3];
mesh->GetNumberOfSegments(nSeg);
ps->SetNumberOfSegments(nSeg);
mesh->SetPrimitiveScorer(ps);
mesh->SetPrimitiveScorer(ps);
}
}
}
} else if(command==qeDepCmd) {
if ( CheckMeshPS(mesh,token[0]) ){
G4PSEnergyDeposit3D* ps =new G4PSEnergyDeposit3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
if ( CheckMeshPS(mesh,token[0]) ){
G4PSEnergyDeposit3D* ps =new G4PSEnergyDeposit3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qdoseDepCmd) {
if ( CheckMeshPS(mesh,token[0]) ){
if ( CheckMeshPS(mesh,token[0]) ){
if( mesh->GetShape()==boxMesh ) {
G4PSDoseDeposit3D* ps = new G4PSDoseDeposit3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
G4PSDoseDeposit3D* ps = new G4PSDoseDeposit3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
} else if( mesh->GetShape()==cylinderMesh ) {
G4PSDoseDepositForCylinder3D* ps =
new G4PSDoseDepositForCylinder3D(token[0]);
new G4PSDoseDepositForCylinder3D(token[0]);
ps->SetUnit(token[1]);
G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
G4ThreeVector msize = mesh->GetSize(); // gevin in R Z N/A
ps->SetCylinderSize(msize[0],msize[1]); // given in dr dz
G4int nSeg[3];
mesh->GetNumberOfSegments(nSeg);
ps->SetNumberOfSegments(nSeg);
mesh->SetPrimitiveScorer(ps);
mesh->SetPrimitiveScorer(ps);
}
}
}
} else if(command== qnOfStepCmd) {
if ( CheckMeshPS(mesh,token[0]) ){
G4PSNofStep3D* ps = new G4PSNofStep3D(token[0]);
mesh->SetPrimitiveScorer(ps);
}
if ( CheckMeshPS(mesh,token[0]) ){
G4PSNofStep3D* ps = new G4PSNofStep3D(token[0]);
ps->SetBoundaryFlag(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qnOfSecondaryCmd) {
if ( CheckMeshPS(mesh,token[0]) ){
G4PSNofSecondary3D* ps =new G4PSNofSecondary3D(token[0]);
mesh->SetPrimitiveScorer(ps);
}
if ( CheckMeshPS(mesh,token[0]) ){
G4PSNofSecondary3D* ps =new G4PSNofSecondary3D(token[0]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qTrackLengthCmd) {
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);
}
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 if(command== qPassCellCurrCmd){
if( CheckMeshPS(mesh,token[0]) ) {
G4PSPassageCellCurrent* ps = new G4PSPassageCellCurrent3D(token[0]);
ps->Weighted(StoB(token[1]));
//ps->SetUnit(token[2]);
mesh->SetPrimitiveScorer(ps);
}
if( CheckMeshPS(mesh,token[0]) ) {
G4PSPassageCellCurrent* ps = new G4PSPassageCellCurrent3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qPassTrackLengthCmd){
if( CheckMeshPS(mesh,token[0]) ) {
G4PSPassageTrackLength* ps = new G4PSPassageTrackLength3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
}
if( CheckMeshPS(mesh,token[0]) ) {
G4PSPassageTrackLength* ps = new G4PSPassageTrackLength3D(token[0]);
ps->Weighted(StoB(token[1]));
ps->SetUnit(token[2]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qFlatSurfCurrCmd){
if( CheckMeshPS(mesh,token[0])) {
G4PSFlatSurfaceCurrent3D* ps =
new G4PSFlatSurfaceCurrent3D(token[0],StoI(token[1]));
ps->Weighted(StoB(token[2]));
ps->DivideByArea(StoB(token[3]));
if ( StoB(token[3]) ){
ps->SetUnit(token[4]);
}else{
ps->SetUnit("");
}
mesh->SetPrimitiveScorer(ps);
}
if( CheckMeshPS(mesh,token[0])) {
G4PSFlatSurfaceCurrent3D* ps =
new G4PSFlatSurfaceCurrent3D(token[0],StoI(token[1]));
ps->Weighted(StoB(token[2]));
ps->DivideByArea(StoB(token[3]));
if ( StoB(token[3]) ){
ps->SetUnit(token[4]);
}else{
ps->SetUnit("");
}
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qFlatSurfFluxCmd){
if( CheckMeshPS(mesh, token[0] )) {
G4PSFlatSurfaceFlux3D* ps = new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1]));
ps->Weighted(StoB(token[2]));
ps->DivideByArea(StoB(token[3]));
if ( StoB(token[3]) ){
ps->SetUnit(token[4]);
}else{
ps->SetUnit("");
}
mesh->SetPrimitiveScorer(ps);
}
if( CheckMeshPS(mesh, token[0] )) {
G4PSFlatSurfaceFlux3D* ps = new G4PSFlatSurfaceFlux3D(token[0],StoI(token[1]));
ps->Weighted(StoB(token[2]));
ps->DivideByArea(StoB(token[3]));
if ( StoB(token[3]) ){
ps->SetUnit(token[4]);
}else{
ps->SetUnit("");
}
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]));
// if ( StoB(token[3]) ){
// ps->SetUnit(token[4]);
// }else{
// ps->SetUnit("");
// }
// mesh->SetPrimitiveScorer(ps);
// }
// if( CheckMeshPS(mesh, token[0] )) {
// G4PSSphereSurfaceCurrent3D* ps =
// new G4PSSphereSurfaceCurrent3D(token[0],StoI(token[1]));
// ps->Weighted(StoB(token[2]));
// ps->DivideByArea(StoB(token[3]));
// if ( StoB(token[3]) ){
// ps->SetUnit(token[4]);
// }else{
// ps->SetUnit("");
// }
// mesh->SetPrimitiveScorer(ps);
// }
// } else if(command== qSphereSurfFluxCmd){
// if( CheckMeshPS(mesh,token[0])) {
// if( CheckMeshPS(mesh,token[0])) {
// G4PSSphereSurfaceFlux3D* ps = new G4PSSphereSurfaceFlux3D(token[0], StoI(token[1]));
// ps->Weighted(StoB(token[2]));
// ps->DivideByArea(StoB(token[3]));
// if ( StoB(token[3]) ){
// ps->SetUnit(token[4]);
// }else{
// ps->SetUnit("");
// }
// mesh->SetPrimitiveScorer(ps);
// }
// ps->Weighted(StoB(token[2]));
// ps->DivideByArea(StoB(token[3]));
// if ( StoB(token[3]) ){
// ps->SetUnit(token[4]);
// }else{
// ps->SetUnit("");
// }
// 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]));
// if ( StoB(token[3]) ){
// ps->SetUnit(token[4]);
// }else{
// ps->SetUnit("");
// }
// ps->SetUnit(token[4]);
// mesh->SetPrimitiveScorer(ps);
// }
// if( CheckMeshPS(mesh, token[0] ) ) {
// G4PSCylinderSurfaceCurrent3D* ps =
// new G4PSCylinderSurfaceCurrent3D(token[0],StoI(token[1]));
// ps->Weighted(StoB(token[2]));
// ps->DivideByArea(StoB(token[3]));
// if ( StoB(token[3]) ){
// ps->SetUnit(token[4]);
// }else{
// ps->SetUnit("");
// }
// ps->SetUnit(token[4]);
// mesh->SetPrimitiveScorer(ps);
// }
// } else if(command== qCylSurfFluxCmd){
// if( CheckMeshPS(mesh, token[0] ) {
// if( CheckMeshPS(mesh, token[0] ) {
// G4PSCylinerSurfaceFlux3D* ps =new G4PSCylinderSurfaceFlux3D(token[0], StoI(token[1]));
// ps->Weighted(StoB(token[2]));
// ps->DivideByArea(StoB(token[3]));
// if ( StoB(token[3]) ){
// ps->SetUnit(token[4]);
// }else{
// ps->SetUnit("");
// }
// mesh->SetPrimitiveScorer(ps);
// }
// ps->Weighted(StoB(token[2]));
// ps->DivideByArea(StoB(token[3]));
// if ( StoB(token[3]) ){
// ps->SetUnit(token[4]);
// }else{
// ps->SetUnit("");
// }
// mesh->SetPrimitiveScorer(ps);
// }
} else if(command== qNofCollisionCmd){
if( CheckMeshPS(mesh,token[0])) {
G4PSNofCollision3D* ps =new G4PSNofCollision3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
}
if( CheckMeshPS(mesh,token[0])) {
G4PSNofCollision3D* ps =new G4PSNofCollision3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qPopulationCmd){
if( CheckMeshPS(mesh,token[0]) ) {
G4PSPopulation3D* ps =new G4PSPopulation3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
}
if( CheckMeshPS(mesh,token[0]) ) {
G4PSPopulation3D* ps =new G4PSPopulation3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qTrackCountCmd){
if( CheckMeshPS(mesh,token[0])) {
G4PSTrackCounter3D* ps =new G4PSTrackCounter3D(token[0],StoI(token[1]));
mesh->SetPrimitiveScorer(ps);
}
if( CheckMeshPS(mesh,token[0])) {
G4PSTrackCounter3D* ps =new G4PSTrackCounter3D(token[0],StoI(token[1]));
ps->Weighted(StoB(token[2]));
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qTerminationCmd){
if( CheckMeshPS(mesh,token[0])) {
G4PSTermination3D* ps =new G4PSTermination3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
}
if( CheckMeshPS(mesh,token[0])) {
G4PSTermination3D* ps =new G4PSTermination3D(token[0]);
ps->Weighted(StoB(token[1]));
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qMinKinEAtGeneCmd){
if( CheckMeshPS(mesh,token[0]) ){
G4PSMinKinEAtGeneration3D* ps =new G4PSMinKinEAtGeneration3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
if( CheckMeshPS(mesh,token[0]) ){
G4PSMinKinEAtGeneration3D* ps =new G4PSMinKinEAtGeneration3D(token[0]);
ps->SetUnit(token[1]);
mesh->SetPrimitiveScorer(ps);
}
} else if(command== qStepCheckerCmd){
if( CheckMeshPS(mesh,token[0]) ){
G4PSStepChecker3D* ps =new G4PSStepChecker3D(token[0]);
mesh->SetPrimitiveScorer(ps);
}
if( CheckMeshPS(mesh,token[0]) ){
G4PSStepChecker3D* ps =new G4PSStepChecker3D(token[0]);
mesh->SetPrimitiveScorer(ps);
}
//
// Filters
//
//
// Filters
//
}else if(command== fchargedCmd){
if(!mesh->IsCurrentPrimitiveScorerNull()) {
mesh->SetFilter(new G4SDChargedFilter(token[0]));
} else {
G4cout << "WARNING[" << fchargedCmd->GetCommandPath()
<< "] : Current quantity is not set. Set or touch a quantity first." << G4endl;
}
if(!mesh->IsCurrentPrimitiveScorerNull()) {
mesh->SetFilter(new G4SDChargedFilter(token[0]));
} else {
G4cout << "WARNING[" << fchargedCmd->GetCommandPath()
<< "] : Current quantity is not set. Set or touch a quantity first." << G4endl;
}
}else if(command== fneutralCmd){
if(!mesh->IsCurrentPrimitiveScorerNull()) {
mesh->SetFilter(new G4SDNeutralFilter(token[0]));
} else {
G4cout << "WARNING[" << fneutralCmd->GetCommandPath()
<< "] : Current quantity is not set. Set or touch a quantity first." << G4endl;
}
if(!mesh->IsCurrentPrimitiveScorerNull()) {
mesh->SetFilter(new G4SDNeutralFilter(token[0]));
} else {
G4cout << "WARNING[" << fneutralCmd->GetCommandPath()
<< "] : Current quantity is not set. Set or touch a quantity first." << G4endl;
}
}else if(command== fkinECmd){
if(!mesh->IsCurrentPrimitiveScorerNull()) {
G4String& name = token[0];
G4double elow = StoD(token[1]);
G4double ehigh = StoD(token[2]);
mesh->SetFilter(new G4SDKineticEnergyFilter(name,elow,ehigh));
} else {
G4cout << "WARNING[" << fkinECmd->GetCommandPath()
<< "] : Current quantity is not set. Set or touch a quantity first." << G4endl;
}
if(!mesh->IsCurrentPrimitiveScorerNull()) {
G4String& name = token[0];
G4double elow = StoD(token[1]);
G4double ehigh = StoD(token[2]);
G4double unitVal = G4UnitDefinition::GetValueOf(token[3]);
mesh->SetFilter(new G4SDKineticEnergyFilter(name,elow*unitVal,ehigh*unitVal));
} else {
G4cout << "WARNING[" << fkinECmd->GetCommandPath()
<< "] : Current quantity is not set. Set or touch a quantity first." << G4endl;
}
}else if(command== fparticleKinECmd){
if(!mesh->IsCurrentPrimitiveScorerNull()) {
FParticleWithEnergyCommand(mesh,token);
} else {
G4cout << "WARNING[" << fparticleKinECmd->GetCommandPath()
<< "] : Current quantity is not set. Set or touch a quantity first." << G4endl;
}
if(!mesh->IsCurrentPrimitiveScorerNull()) {
FParticleWithEnergyCommand(mesh,token);
} else {
G4cout << "WARNING[" << fparticleKinECmd->GetCommandPath()
<< "] : Current quantity is not set. Set or touch a quantity first." << G4endl;
}
} else if(command==fparticleCmd) {
if(!mesh->IsCurrentPrimitiveScorerNull()) {
FParticleCommand(mesh,token);
} else {
G4cout << "WARNING[" << fparticleCmd->GetCommandPath()
<< "] : Current quantity is not set. Set or touch a quantity first." << G4endl;
}
if(!mesh->IsCurrentPrimitiveScorerNull()) {
FParticleCommand(mesh,token);
} else {
G4cout << "WARNING[" << fparticleCmd->GetCommandPath()
<< "] : Current quantity is not set. Set or touch a quantity first." << G4endl;
}
}
}
@@ -497,7 +503,7 @@ void G4ScoreQuantityMessenger::FillTokenVec(G4String newValues, G4TokenVec& toke
G4Tokenizer next(newValues);
G4String val;
while ( !(val = next()).isNull() ) {
token.push_back(val);
token.push_back(val);
}
}
@@ -510,7 +516,7 @@ void G4ScoreQuantityMessenger::FParticleCommand(G4VScoringMesh* mesh, G4TokenVec
// particle list
std::vector<G4String> pnames;
for ( G4int i = 1; i<(G4int)token.size(); i++){
pnames.push_back(token[i]);
pnames.push_back(token[i]);
}
//
// Attach Filter
@@ -523,20 +529,20 @@ void G4ScoreQuantityMessenger::FParticleWithEnergyCommand(G4VScoringMesh* mesh,G
G4double ehigh= StoD(token[2]);
G4double unitVal = G4UnitDefinition::GetValueOf(token[3]);
G4SDParticleWithEnergyFilter* filter =
new G4SDParticleWithEnergyFilter(name,elow*unitVal,ehigh*unitVal);
new G4SDParticleWithEnergyFilter(name,elow*unitVal,ehigh*unitVal);
for ( G4int i = 4; i < (G4int)token.size(); i++){
filter->add(token[i]);
filter->add(token[i]);
}
mesh->SetFilter(filter);
}
G4bool G4ScoreQuantityMessenger::CheckMeshPS(G4VScoringMesh* mesh, G4String& psname){
if(!mesh->FindPrimitiveScorer(psname)) {
return true;
return true;
} else {
G4cout << "WARNING[" << qTouchCmd->GetCommandPath()
<< "] : Quantity name, \"" << psname << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
return false;
G4cout << "WARNING[" << qTouchCmd->GetCommandPath()
<< "] : Quantity name, \"" << psname << "\", is already existing." << G4endl;
mesh->SetNullToCurrentPrimitiveScorer();
return false;
}
}
@@ -24,13 +24,17 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoreQuantityMessengerQCmd.cc 73819 2013-09-12 15:52:52Z gcosmo $
//
// ---------------------------------------------------------------------
// Modifications
// 08-Oct-2010 T.Aso remove unit of G4PSPassageCellCurrent.
// 01-Jun-2012 T.Aso Support weighted/dividedByArea options
// 01-Jun-2012 T.Aso Support weighted/dividedByArea options
// in flatCurrent and flatFulx commands.
// 29-Mar-2013 T.Aso Support weighted options in the nOfTrack command.
// Support a boundary flag option in the nOfStep command
// for skipping stepLength=0 steps.
//
// ---------------------------------------------------------------------
#include "G4ScoreQuantityMessenger.hh"
@@ -161,14 +165,21 @@ void G4ScoreQuantityMessenger::QuantityCommands()
qnOfStepCmd->SetGuidance("Number of step scorer.");
qnOfStepCmd->
SetGuidance("[usage] /score/quantiy/nOfStep qname");
qnOfStepCmd->
SetGuidance("[usage] /score/quantiy/nOfStep qname bflag");
qnOfStepCmd->SetGuidance(" qname :(String) scorer name");
qnOfStepCmd->SetGuidance(" bflag :(Bool) Skip zero step ");
qnOfStepCmd->SetGuidance(" at geometry boundary if true");
param = new G4UIparameter("qname",'s',false);
qnOfStepCmd->SetParameter(param);
param = new G4UIparameter("bflag",'b',true);
param->SetDefaultValue("false");
qnOfStepCmd->SetParameter(param);
//
qnOfSecondaryCmd = new G4UIcommand("/score/quantity/nOfSecondary",this);
qnOfSecondaryCmd->SetGuidance("Number of secondary scorer.");
qnOfSecondaryCmd->
SetGuidance("[usage] /score/quantiy/nOfSecondary qname");
SetGuidance("[usage] /score/quantiy/nOfSecondary qname");
qnOfSecondaryCmd->SetGuidance(" qname :(String) scorer name");
param = new G4UIparameter("qname",'s',false);
qnOfSecondaryCmd->SetParameter(param);
@@ -200,19 +211,14 @@ void G4ScoreQuantityMessenger::QuantityCommands()
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 unit");
SetGuidance("[usage] /score/quantiy/passageCellCurrent qname wflag");
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.");
@@ -455,10 +461,14 @@ void G4ScoreQuantityMessenger::QuantityCommands()
qMinKinEAtGeneCmd = new G4UIcommand("/score/quantity/minKinEAtGeneration",this);
qMinKinEAtGeneCmd->SetGuidance("Min Kinetic Energy at Generation");
qMinKinEAtGeneCmd->
SetGuidance("[usage] /score/quantiy/minKinEAtGeneration qname");
SetGuidance("[usage] /score/quantiy/minKinEAtGeneration qname unit");
qMinKinEAtGeneCmd->SetGuidance(" qname :(String) scorer name");
qMinKinEAtGeneCmd->SetGuidance(" unit :(String) unit name");
param = new G4UIparameter("qname",'s',false);
qMinKinEAtGeneCmd->SetParameter(param);
param = new G4UIparameter("unit",'s',true);
param->SetDefaultValue("MeV");
qMinKinEAtGeneCmd->SetParameter(param);
//
qStepCheckerCmd = new G4UIcommand("/score/quantity/stepChecker",this);
qStepCheckerCmd->SetGuidance("Display a comment when this PS is invoked");
+269 -250
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoringBox.cc 74457 2013-10-07 15:21:35Z gcosmo $
//
#include "G4ScoringBox.hh"
@@ -50,8 +50,7 @@
#include <fstream>
G4ScoringBox::G4ScoringBox(G4String wName)
:G4VScoringMesh(wName), fSegmentDirection(-1),
fMeshElementLogical(0)
:G4VScoringMesh(wName), fSegmentDirection(-1)
{
fShape = boxMesh;
fDivisionAxisNames[0] = "X";
@@ -66,161 +65,170 @@ G4ScoringBox::~G4ScoringBox()
void G4ScoringBox::Construct(G4VPhysicalVolume* fWorldPhys)
{
if(fConstructed) {
if(verboseLevel > 0)
G4cout << fWorldPhys->GetName() << " --- All quantities are reset." << G4endl;
if(verboseLevel > 0)
G4cout << fWorldPhys->GetName() << " --- All quantities are reset."
<< G4endl;
ResetScore();
} else {
fConstructed = true;
SetupGeometry(fWorldPhys);
}
}
void G4ScoringBox::SetupGeometry(G4VPhysicalVolume * fWorldPhys) {
if(verboseLevel > 9) G4cout << "G4ScoringBox::SetupGeometry() ..." << G4endl;
// World
G4VPhysicalVolume * scoringWorld = fWorldPhys;
G4LogicalVolume * worldLogical = scoringWorld->GetLogicalVolume();
// Scoring Mesh
if(verboseLevel > 9) G4cout << fWorldName << G4endl;
G4String boxName = fWorldName;
if(verboseLevel > 9) G4cout << fSize[0] << ", " << fSize[1] << ", " << fSize[2] << G4endl;
if(verboseLevel > 9)
G4cout << fSize[0] << ", " << fSize[1] << ", " << fSize[2] << G4endl;
G4VSolid * boxSolid = new G4Box(boxName+"0", fSize[0], fSize[1], fSize[2]);
G4LogicalVolume * boxLogical = new G4LogicalVolume(boxSolid, 0, boxName);
G4LogicalVolume * boxLogical = new G4LogicalVolume(boxSolid, 0, boxName+"_0");
new G4PVPlacement(fRotationMatrix, fCenterPosition,
boxLogical, boxName+"0", worldLogical, false, 0);
boxLogical, boxName+"0", worldLogical, false, 0);
//G4double fsegment[3][3];
//G4int segOrder[3];
//GetSegmentOrder(fSegmentDirection, fNSegment, segOrder, fsegment);
//EAxis axis[3] = {kXAxis, kYAxis, kZAxis};
G4String layerName[2] = {boxName + "1", boxName + "2"};
G4VSolid * layerSolid[2];
G4String layerName[2] = {boxName + "_1", boxName + "_2"};
G4VSolid * layerSolid[2];
G4LogicalVolume * layerLogical[2];
//-- fisrt nested layer (replicated to x direction)
if(verboseLevel > 9) G4cout << "layer 1 :" << G4endl;
layerSolid[0] = new G4Box(layerName[0],
fSize[0]/fNSegment[0],
fSize[1],
fSize[2]);
fSize[0]/fNSegment[0],
fSize[1],
fSize[2]);
layerLogical[0] = new G4LogicalVolume(layerSolid[0], 0, layerName[0]);
if(fNSegment[0] > 1) {
if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Replicate to x direction" << G4endl;
if(verboseLevel > 9)
G4cout << "G4ScoringBox::Construct() : Replicate to x direction" << G4endl;
if(G4ScoringManager::GetReplicaLevel()>0)
{
new G4PVReplica(layerName[0], layerLogical[0], boxLogical, kXAxis,
fNSegment[0], fSize[0]/fNSegment[0]*2.);
fNSegment[0], fSize[0]/fNSegment[0]*2.);
}
else
{
new G4PVDivision(layerName[0], layerLogical[0], boxLogical, kXAxis,
fNSegment[0], 0.);
fNSegment[0], 0.);
}
} else if(fNSegment[0] == 1) {
if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[0], layerName[0], boxLogical, false, 0);
if(verboseLevel > 9)
G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[0], layerName[0],
boxLogical, false, 0);
} else
G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : invalid parameter ("
<< fNSegment[0] << ") "
<< "in placement of the first nested layer." << G4endl;
<< fNSegment[0] << ") "
<< "in placement of the first nested layer." << G4endl;
if(verboseLevel > 9) {
G4cout << fSize[0]/fNSegment[0] << ", "
<< fSize[1] << ", "
<< fSize[2] << G4endl;
<< fSize[1] << ", "
<< fSize[2] << G4endl;
G4cout << layerName[0] << ": kXAxis, "
<< fNSegment[0] << ", "
<< 2.*fSize[0]/fNSegment[0] << G4endl;
<< fNSegment[0] << ", "
<< 2.*fSize[0]/fNSegment[0] << G4endl;
}
// second nested layer (replicated to y direction)
if(verboseLevel > 9) G4cout << "layer 2 :" << G4endl;
layerSolid[1] = new G4Box(layerName[1],
fSize[0]/fNSegment[0],
fSize[1]/fNSegment[1],
fSize[2]);
fSize[0]/fNSegment[0],
fSize[1]/fNSegment[1],
fSize[2]);
layerLogical[1] = new G4LogicalVolume(layerSolid[1], 0, layerName[1]);
if(fNSegment[1] > 1) {
if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Replicate to y direction" << G4endl;
if(verboseLevel > 9)
G4cout << "G4ScoringBox::Construct() : Replicate to y direction" << G4endl;
if(G4ScoringManager::GetReplicaLevel()>1)
{
new G4PVReplica(layerName[1], layerLogical[1], layerLogical[0], kYAxis,
fNSegment[1], fSize[1]/fNSegment[1]*2.);
fNSegment[1], fSize[1]/fNSegment[1]*2.);
}
else
{
new G4PVDivision(layerName[1], layerLogical[1], layerLogical[0], kYAxis,
fNSegment[1], 0.);
fNSegment[1], 0.);
}
} else if(fNSegment[1] == 1) {
if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[1], layerName[1], layerLogical[0], false, 0);
if(verboseLevel > 9)
G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), layerLogical[1], layerName[1],
layerLogical[0], false, 0);
} else
G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : invalid parameter ("
<< fNSegment[1] << ") "
<< "in placement of the second nested layer." << G4endl;
<< fNSegment[1] << ") "
<< "in placement of the second nested layer." << G4endl;
if(verboseLevel > 9) {
G4cout << fSize[0]/fNSegment[0] << ", "
<< fSize[1]/fNSegment[1] << ", "
<< fSize[2] << G4endl;
<< fSize[1]/fNSegment[1] << ", "
<< fSize[2] << G4endl;
G4cout << layerName[1] << ": kYAxis, "
<< fNSegment[1] << ", "
<< 2.*fSize[1]/fNSegment[1] << G4endl;
<< fNSegment[1] << ", "
<< 2.*fSize[1]/fNSegment[1] << G4endl;
}
// mesh elements (replicated to z direction)
if(verboseLevel > 9) G4cout << "mesh elements :" << G4endl;
G4String elementName = boxName +"3";
G4String elementName = boxName +"_3";
G4VSolid * elementSolid = new G4Box(elementName,
fSize[0]/fNSegment[0],
fSize[1]/fNSegment[1],
fSize[2]/fNSegment[2]);
fSize[0]/fNSegment[0],
fSize[1]/fNSegment[1],
fSize[2]/fNSegment[2]);
fMeshElementLogical = new G4LogicalVolume(elementSolid, 0, elementName);
if(fNSegment[2] > 1) {
if(verboseLevel > 9) G4cout << "G4ScoringBox::Construct() : Replicate to z direction" << G4endl;
if(G4ScoringManager::GetReplicaLevel()>2)
{
if(verboseLevel > 9)
G4cout << "G4ScoringBox::Construct() : Replicate to z direction" << G4endl;
if(G4ScoringManager::GetReplicaLevel()>2)
{
new G4PVReplica(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
fNSegment[2], 2.*fSize[2]/fNSegment[2]);
fNSegment[2], 2.*fSize[2]/fNSegment[2]);
}
else
{
new G4PVDivision(elementName, fMeshElementLogical, layerLogical[1], kZAxis,
fNSegment[2], 0.);
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);
if(verboseLevel > 9)
G4cout << "G4ScoringBox::Construct() : Placement" << G4endl;
new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), fMeshElementLogical,
elementName, layerLogical[1], false, 0);
} else
G4cerr << "ERROR : G4ScoringBox::SetupGeometry() : "
<< "invalid parameter (" << fNSegment[2] << ") "
<< "in mesh element placement." << G4endl;
<< "invalid parameter (" << fNSegment[2] << ") "
<< "in mesh element placement." << G4endl;
if(verboseLevel > 9) {
G4cout << fSize[0]/fNSegment[0] << ", "
<< fSize[1]/fNSegment[1] << ", "
<< fSize[2]/fNSegment[2] << G4endl;
<< fSize[1]/fNSegment[1] << ", "
<< fSize[2]/fNSegment[2] << G4endl;
G4cout << elementName << ": kZAxis, "
<< fNSegment[2] << ", "
<< 2.*fSize[2]/fNSegment[2] << G4endl;
<< fNSegment[2] << ", "
<< 2.*fSize[2]/fNSegment[2] << G4endl;
}
// set the sensitive detector
fMeshElementLogical->SetSensitiveDetector(fMFD);
// vis. attributes
G4VisAttributes * visatt = new G4VisAttributes(G4Colour(.5,.5,.5));
visatt->SetVisibility(false);
@@ -234,16 +242,17 @@ void G4ScoringBox::SetupGeometry(G4VPhysicalVolume * fWorldPhys) {
void G4ScoringBox::List() const {
G4cout << "G4ScoringBox : " << fWorldName << " --- Shape: Box mesh" << G4endl;
G4cout << " Size (x, y, z): ("
<< fSize[0]/cm << ", "
<< fSize[1]/cm << ", "
<< fSize[2]/cm << ") [cm]"
<< G4endl;
<< fSize[0]/cm << ", "
<< fSize[1]/cm << ", "
<< fSize[2]/cm << ") [cm]"
<< G4endl;
G4VScoringMesh::List();
}
void G4ScoringBox::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colorMap, G4int axflg) {
void G4ScoringBox::Draw(std::map<G4int, G4double*> * map,
G4VScoreColorMap* colorMap, G4int axflg) {
G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance();
if(pVisManager) {
@@ -254,81 +263,82 @@ void G4ScoringBox::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colo
std::vector<std::vector<double> > eyz;
for(int y = 0; y < fNSegment[1]; y++) eyz.push_back(ez);
for(int x = 0; x < fNSegment[0]; x++) cell.push_back(eyz);
std::vector<std::vector<double> > xycell; // xycell[X][Y]
std::vector<double> ey;
for(int y = 0; y < fNSegment[1]; y++) ey.push_back(0.);
for(int x = 0; x < fNSegment[0]; x++) xycell.push_back(ey);
std::vector<std::vector<double> > yzcell; // yzcell[Y][Z]
for(int y = 0; y < fNSegment[1]; y++) yzcell.push_back(ez);
std::vector<std::vector<double> > xzcell; // xzcell[X][Z]
for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
// projections
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->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;
}
}
// search max. & min. values in each slice
G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
G4double xymax = 0., yzmax = 0., xzmax = 0.;
for(int x = 0; x < fNSegment[0]; x++) {
for(int y = 0; y < fNSegment[1]; y++) {
if(xymin > xycell[x][y]) xymin = xycell[x][y];
if(xymax < xycell[x][y]) xymax = xycell[x][y];
if(xymin > xycell[x][y]) xymin = xycell[x][y];
if(xymax < xycell[x][y]) xymax = xycell[x][y];
}
for(int z = 0; z < fNSegment[2]; z++) {
if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z];
if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z];
if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z];
if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z];
}
}
for(int y = 0; y < fNSegment[1]; y++) {
for(int z = 0; z < fNSegment[2]; z++) {
if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z];
if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z];
if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z];
if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z];
}
}
G4VisAttributes att;
att.SetForceSolid(true);
att.SetForceAuxEdgeVisible(true);
G4Scale3D scale;
if(axflg/100==1) {
// xy plane
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xymin ,xymax); }
G4ThreeVector zhalf(0., 0., fSize[2]/fNSegment[2]*0.98);
G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]*0.01);
G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
fSize[2]/fNSegment[2]*0.01);
for(int x = 0; x < fNSegment[0]; x++) {
for(int y = 0; y < fNSegment[1]; y++) {
G4ThreeVector pos(GetReplicaPosition(x, y, 0) - zhalf);
G4ThreeVector pos2(GetReplicaPosition(x, y, fNSegment[2]-1) + zhalf);
G4Transform3D trans, trans2;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
trans2 = G4Translate3D(fCenterPosition)*trans2;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
trans2 = G4Translate3D(pos2)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(xycell[x][y], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(xyplate, att, trans);
pVisManager->Draw(xyplate, att, trans2);
}
for(int y = 0; y < fNSegment[1]; y++) {
G4ThreeVector pos(GetReplicaPosition(x, y, 0) - zhalf);
G4ThreeVector pos2(GetReplicaPosition(x, y, fNSegment[2]-1) + zhalf);
G4Transform3D trans, trans2;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
trans2 = G4Translate3D(fCenterPosition)*trans2;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
trans2 = G4Translate3D(pos2)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(xycell[x][y], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(xyplate, att, trans);
pVisManager->Draw(xyplate, att, trans2);
}
}
}
axflg = axflg%100;
@@ -336,28 +346,29 @@ void G4ScoringBox::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colo
// yz plane
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin, yzmax); }
G4ThreeVector xhalf(fSize[0]/fNSegment[0]*0.98, 0., 0.);
G4Box yzplate("yz", fSize[0]/fNSegment[0]*0.01, fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]);
G4Box yzplate("yz", fSize[0]/fNSegment[0]*0.01, fSize[1]/fNSegment[1],
fSize[2]/fNSegment[2]);
for(int y = 0; y < fNSegment[1]; y++) {
for(int z = 0; z < fNSegment[2]; z++) {
G4ThreeVector pos(GetReplicaPosition(0, y, z) - xhalf);
G4ThreeVector pos2(GetReplicaPosition(fNSegment[0]-1, y, z) + xhalf);
G4Transform3D trans, trans2;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
trans2 = G4Translate3D(fCenterPosition)*trans2;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
trans2 = G4Translate3D(pos2)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(yzcell[y][z], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(yzplate, att, trans);
pVisManager->Draw(yzplate, att, trans2);
}
for(int z = 0; z < fNSegment[2]; z++) {
G4ThreeVector pos(GetReplicaPosition(0, y, z) - xhalf);
G4ThreeVector pos2(GetReplicaPosition(fNSegment[0]-1, y, z) + xhalf);
G4Transform3D trans, trans2;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
trans2 = G4Translate3D(fCenterPosition)*trans2;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
trans2 = G4Translate3D(pos2)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(yzcell[y][z], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(yzplate, att, trans);
pVisManager->Draw(yzplate, att, trans2);
}
}
}
axflg = axflg%10;
@@ -365,28 +376,29 @@ void G4ScoringBox::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colo
// xz plane
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax); }
G4ThreeVector yhalf(0., fSize[1]/fNSegment[1]*0.98, 0.);
G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1]*0.01, fSize[2]/fNSegment[2]);
G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1]*0.01,
fSize[2]/fNSegment[2]);
for(int x = 0; x < fNSegment[0]; x++) {
for(int z = 0; z < fNSegment[2]; z++) {
G4ThreeVector pos(GetReplicaPosition(x, 0, z) - yhalf);
G4ThreeVector pos2(GetReplicaPosition(x, fNSegment[1]-1, z) + yhalf);
G4Transform3D trans, trans2;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
trans2 = G4Translate3D(fCenterPosition)*trans2;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
trans2 = G4Translate3D(pos2)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(xzcell[x][z], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(xzplate, att, trans);
pVisManager->Draw(xzplate, att, trans2);
}
for(int z = 0; z < fNSegment[2]; z++) {
G4ThreeVector pos(GetReplicaPosition(x, 0, z) - yhalf);
G4ThreeVector pos2(GetReplicaPosition(x, fNSegment[1]-1, z) + yhalf);
G4Transform3D trans, trans2;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
trans2 = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos2);
trans2 = G4Translate3D(fCenterPosition)*trans2;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
trans2 = G4Translate3D(pos2)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(xzcell[x][z], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(xzplate, att, trans);
pVisManager->Draw(xzplate, att, trans2);
}
}
}
}
@@ -396,34 +408,38 @@ void G4ScoringBox::Draw(std::map<G4int, G4double*> * map, G4VScoreColorMap* colo
}
G4ThreeVector G4ScoringBox::GetReplicaPosition(G4int x, G4int y, G4int z) {
G4ThreeVector width(fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]);
G4ThreeVector width(fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
fSize[2]/fNSegment[2]);
G4ThreeVector pos(-fSize[0] + 2*(x+0.5)*width.x(),
-fSize[1] + 2*(y+0.5)*width.y(),
-fSize[2] + 2*(z+0.5)*width.z());
-fSize[1] + 2*(y+0.5)*width.y(),
-fSize[2] + 2*(z+0.5)*width.z());
return pos;
}
void G4ScoringBox::GetXYZ(G4int index, G4int q[3]) const {
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];
}
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])
G4int iColumn[3] = {2, 0, 1};
if(idxColumn<0 || idxColumn>=fNSegment[iColumn[idxProj]])
{
G4cerr << "ERROR : Column number " << idxColumn << " is out of scoring mesh [0," << fNSegment[idxProj]-1 <<
"]. Method ignored." << G4endl;
G4cerr << "ERROR : Column number " << idxColumn
<< " is out of scoring mesh [0," << fNSegment[iColumn[idxProj]]-1
<< "]. Method ignored." << G4endl;
return;
}
G4VVisManager * pVisManager = G4VVisManager::GetConcreteInstance();
@@ -436,128 +452,131 @@ void G4ScoringBox::DrawColumn(std::map<G4int, G4double*> * map, G4VScoreColorMap
std::vector<std::vector<double> > eyz;
for(int y = 0; y < fNSegment[1]; y++) eyz.push_back(ez);
for(int x = 0; x < fNSegment[0]; x++) cell.push_back(eyz);
std::vector<std::vector<double> > xycell; // xycell[X][Y]
std::vector<double> ey;
for(int y = 0; y < fNSegment[1]; y++) ey.push_back(0.);
for(int x = 0; x < fNSegment[0]; x++) xycell.push_back(ey);
std::vector<std::vector<double> > yzcell; // yzcell[Y][Z]
for(int y = 0; y < fNSegment[1]; y++) yzcell.push_back(ez);
std::vector<std::vector<double> > xzcell; // xzcell[X][Z]
for(int x = 0; x < fNSegment[0]; x++) xzcell.push_back(ez);
// projections
G4int q[3];
std::map<G4int, G4double*>::iterator itr = map->begin();
for(; itr != map->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)/fDrawUnitValue;
}
if(idxProj == 1 && q[0] == idxColumn) { // yz plane
yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
yzcell[q[1]][q[2]] += *(itr->second)/fDrawUnitValue;
}
if(idxProj == 2 && q[1] == idxColumn) { // zx plane
xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
xzcell[q[0]][q[2]] += *(itr->second)/fDrawUnitValue;
}
}
}
// search max. & min. values in each slice
G4double xymin = DBL_MAX, yzmin = DBL_MAX, xzmin = DBL_MAX;
G4double xymax = 0., yzmax = 0., xzmax = 0.;
for(int x = 0; x < fNSegment[0]; x++) {
for(int y = 0; y < fNSegment[1]; y++) {
if(xymin > xycell[x][y]) xymin = xycell[x][y];
if(xymax < xycell[x][y]) xymax = xycell[x][y];
if(xymin > xycell[x][y]) xymin = xycell[x][y];
if(xymax < xycell[x][y]) xymax = xycell[x][y];
}
for(int z = 0; z < fNSegment[2]; z++) {
if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z];
if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z];
if(xzmin > xzcell[x][z]) xzmin = xzcell[x][z];
if(xzmax < xzcell[x][z]) xzmax = xzcell[x][z];
}
}
for(int y = 0; y < fNSegment[1]; y++) {
for(int z = 0; z < fNSegment[2]; z++) {
if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z];
if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z];
if(yzmin > yzcell[y][z]) yzmin = yzcell[y][z];
if(yzmax < yzcell[y][z]) yzmax = yzcell[y][z];
}
}
G4VisAttributes att;
att.SetForceSolid(true);
att.SetForceAuxEdgeVisible(true);
G4Scale3D scale;
// xy plane
if(idxProj == 0) {
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xymin,xymax); }
G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]);
G4Box xyplate("xy", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
fSize[2]/fNSegment[2]);
for(int x = 0; x < fNSegment[0]; x++) {
for(int y = 0; y < fNSegment[1]; y++) {
G4ThreeVector pos(GetReplicaPosition(x, y, idxColumn));
G4Transform3D trans;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(xycell[x][y], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(xyplate, att, trans);
}
for(int y = 0; y < fNSegment[1]; y++) {
G4ThreeVector pos(GetReplicaPosition(x, y, idxColumn));
G4Transform3D trans;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(xycell[x][y], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(xyplate, att, trans);
}
}
} else
// yz plane
if(idxProj == 1) {
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin,yzmax); }
G4Box yzplate("yz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]);
for(int y = 0; y < fNSegment[1]; y++) {
for(int z = 0; z < fNSegment[2]; z++) {
G4ThreeVector pos(GetReplicaPosition(idxColumn, y, z));
G4Transform3D trans;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(yzcell[y][z], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(yzplate, att, trans);
}
}
} else
// xz plane
if(idxProj == 2) {
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax);}
G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1], fSize[2]/fNSegment[2]);
for(int x = 0; x < fNSegment[0]; x++) {
for(int z = 0; z < fNSegment[2]; z++) {
G4ThreeVector pos(GetReplicaPosition(x, idxColumn, z));
G4Transform3D trans;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(xzcell[x][z], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(xzplate, att, trans);
}
}
}
// yz plane
if(idxProj == 1) {
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(yzmin,yzmax); }
G4Box yzplate("yz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
fSize[2]/fNSegment[2]);
for(int y = 0; y < fNSegment[1]; y++) {
for(int z = 0; z < fNSegment[2]; z++) {
G4ThreeVector pos(GetReplicaPosition(idxColumn, y, z));
G4Transform3D trans;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(yzcell[y][z], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(yzplate, att, trans);
}
}
} else
// xz plane
if(idxProj == 2) {
if(colorMap->IfFloatMinMax()) { colorMap->SetMinMax(xzmin,xzmax);}
G4Box xzplate("xz", fSize[0]/fNSegment[0], fSize[1]/fNSegment[1],
fSize[2]/fNSegment[2]);
for(int x = 0; x < fNSegment[0]; x++) {
for(int z = 0; z < fNSegment[2]; z++) {
G4ThreeVector pos(GetReplicaPosition(x, idxColumn, z));
G4Transform3D trans;
if(fRotationMatrix) {
trans = G4Rotate3D(*fRotationMatrix).inverse()*G4Translate3D(pos);
trans = G4Translate3D(fCenterPosition)*trans;
} else {
trans = G4Translate3D(pos)*G4Translate3D(fCenterPosition);
}
G4double c[4];
colorMap->GetMapColor(xzcell[x][z], c);
att.SetColour(c[0], c[1], c[2]);//, c[3]);
pVisManager->Draw(xzplate, att, trans);
}
}
}
}
colorMap->SetPSUnit(fDrawUnit);
colorMap->SetPSName(fDrawPSName);
colorMap->DrawColorChart();
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoringCylinder.cc 68735 2013-04-05 09:49:13Z gcosmo $
//
#include "G4ScoringCylinder.hh"
@@ -53,7 +53,7 @@
G4ScoringCylinder::G4ScoringCylinder(G4String wName)
:G4VScoringMesh(wName), fMeshElementLogical(0)
:G4VScoringMesh(wName)
{
fShape = cylinderMesh;
@@ -79,8 +79,6 @@ void G4ScoringCylinder::Construct(G4VPhysicalVolume* fWorldPhys)
}
}
void G4ScoringCylinder::SetupGeometry(G4VPhysicalVolume * fWorldPhys) {
if(verboseLevel > 9) G4cout << "G4ScoringCylinder::SetupGeometry() ..." << G4endl;
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoringManager.cc 78004 2013-12-02 08:28:23Z gcosmo $
//
#include "G4ScoringManager.hh"
@@ -36,9 +36,9 @@
#include "G4DefaultLinearColorMap.hh"
#include "G4ScoreLogColorMap.hh"
G4ScoringManager* G4ScoringManager::fSManager = 0;
G4ThreadLocal G4ScoringManager* G4ScoringManager::fSManager = 0;
G4int G4ScoringManager::replicaLevel = 3;
G4ThreadLocal G4int G4ScoringManager::replicaLevel = 3;
G4ScoringManager* G4ScoringManager::GetScoringManager()
{
@@ -72,7 +72,7 @@ G4ScoringManager::~G4ScoringManager()
delete fColorMapDict;
delete fQuantityMessenger;
delete fMessenger;
delete fSManager;
fSManager = 0;
}
void G4ScoringManager::SetReplicaLevel(G4int lvl)
@@ -221,4 +221,14 @@ void G4ScoringManager::ListScoreColorMaps()
G4cout << G4endl;
}
void G4ScoringManager::Merge(const G4ScoringManager * mgr)
{
for(size_t i = 0; i< GetNumberOfMesh() ; i++)
{
G4VScoringMesh* fMesh = GetMesh(i);
G4VScoringMesh* scMesh = mgr->GetMesh(i);
fMesh->Merge(scMesh);
}
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4ScoringMessenger.cc 78057 2013-12-03 08:31:15Z gcosmo $
//
// ---------------------------------------------------------------------
@@ -310,7 +310,7 @@ G4ScoringMessenger::~G4ScoringMessenger()
delete mRotZCmd;
delete mRotDir;
//
delete chartCmd;
//delete chartCmd;
delete dumpCmd;
delete drawCmd;
delete drawColumnCmd;
@@ -345,12 +345,12 @@ void G4ScoringMessenger::SetNewValue(G4UIcommand * command,G4String newVal)
G4int iColumn = StoI(next());
G4String colorMapName = next();
fSMan->DrawMesh(meshName,psName,iPlane,iColumn,colorMapName);
} else if(command==chartCmd ){
G4Tokenizer next(newVal);
G4String meshName = next();
G4String psName = next();
//G4bool onFlag = StoB(next());
G4String scaleOption = next();
// } else if(command==chartCmd ){
// G4Tokenizer next(newVal);
// G4String meshName = next();
// G4String psName = next();
// //G4bool onFlag = StoB(next());
// G4String scaleOption = next();
// fSMan->DrawChart(meshName,psName,onFlag,scaleOption);
} else if(command==dumpQtyToFileCmd) {
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VScoreColorMap.cc 67992 2013-03-13 10:59:57Z gcosmo $
//
#include "G4VScoreColorMap.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VScoreWriter.cc 67992 2013-03-13 10:59:57Z gcosmo $
//
#include "G4VScoreWriter.hh"
+50 -2
View File
@@ -24,7 +24,7 @@
// ********************************************************************
//
//
// $Id$
// $Id: G4VScoringMesh.cc 68735 2013-04-05 09:49:13Z gcosmo $
//
// ---------------------------------------------------------------------
// Modifications
@@ -47,7 +47,7 @@ G4VScoringMesh::G4VScoringMesh(const G4String& wName)
: fWorldName(wName),fCurrentPS(0),fConstructed(false),fActive(true),
fRotationMatrix(0), fMFD(new G4MultiFunctionalDetector(wName)),
verboseLevel(0),sizeIsSet(false),nMeshIsSet(false),
fDrawUnit(""), fDrawUnitValue(1.)
fDrawUnit(""), fDrawUnitValue(1.), fMeshElementLogical(0)
{
G4SDManager::GetSDMpointer()->AddNewDetector(fMFD);
@@ -311,3 +311,51 @@ 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);
*(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();
}
G4cout << G4endl;
}
}
void G4VScoringMesh::WorkerConstruct(G4VPhysicalVolume* fWorldPhys)
{
if(fConstructed) {
if(verboseLevel > 0)
G4cout << fWorldPhys->GetName() << " --- All quantities are reset." << G4endl;
ResetScore();
} else {
fConstructed = true;
fMeshElementLogical->SetSensitiveDetector(fMFD);
}
}
void G4VScoringMesh::Merge(const G4VScoringMesh * scMesh)
{
const MeshScoreMap scMap = scMesh->GetScoreMap();
MeshScoreMap::const_iterator fMapItr = fMap.begin();
MeshScoreMap::const_iterator mapItr = scMap.begin();
for(; fMapItr != fMap.end(); fMapItr++) {
if(verboseLevel > 9) G4cout << "G4VScoringMesh::Merge()" << fMapItr->first << G4endl;
*(fMapItr->second) += *(mapItr->second);
mapItr++;
}
}