Import Geant4 9.6.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 17:01:34 +02:00
parent b1eb5424d2
commit e2d2f9810a
10384 changed files with 698580 additions and 628834 deletions
@@ -0,0 +1,113 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
//
// $Id$
//
//
// John Allison 15th July 2012
// Model that knows how to draw an arrow.
#include "G4ArrowModel.hh"
#include "G4PhysicalConstants.hh"
#include "G4VGraphicsScene.hh"
#include "G4VisAttributes.hh"
#include "G4Tubs.hh"
#include "G4Polycone.hh"
#include "G4Polyhedron.hh"
#include "G4Vector3D.hh"
#include "G4Point3D.hh"
#include "G4Transform3D.hh"
G4ArrowModel::~G4ArrowModel () {}
G4ArrowModel::G4ArrowModel
(G4double x1, G4double y1, G4double z1,
G4double x2, G4double y2, G4double z2,
G4double width, const G4Colour& colour,
const G4String& description)
{
fType = "G4ArrowModel";
fGlobalTag = fType;
fGlobalDescription = fType + ": " + description;
fExtent = G4VisExtent
(std::min(x1,x2),
std::max(x1,x2),
std::min(y1,y2),
std::max(y1,y2),
std::min(z1,z2),
std::max(z1,z2));
// Make a cylinder slightly shorter than the arrow length so that it
// doesn't stick out of the head.
const G4double shaftLength = std::sqrt
(std::pow(x2-x1,2)+std::pow(y2-y1,2)+std::pow(z2-z1,2));
G4double shaftRadius = width/2.;
// Limit the radius
if (shaftRadius > shaftLength/100.) shaftRadius = shaftLength/100.;
const G4double halfShaftLength = shaftLength/2.;
const G4double halfReduction = 4.*shaftRadius;
const G4double halfLength = halfShaftLength-halfReduction;
G4Tubs shaft("shaft",0.,shaftRadius,halfLength,0.,twopi);
fpShaftPolyhedron = shaft.CreatePolyhedron();
// Move it a little so that the tail is at z = -halfShaftLength.
fpShaftPolyhedron->Transform(G4Translate3D(0,0,-halfReduction));
// Locate the head at +halfShaftLength.
const G4int numRZ = 3;
G4double r[] = {0,4,0};
G4double z[] = {0,-6,-4};
for (G4int i = 0; i < numRZ; i++) {
r[i] *= 2.*shaftRadius;
z[i] = halfShaftLength + z[i] * 2.*shaftRadius;
}
G4Polycone head("head",0,twopi,numRZ,r,z);
fpHeadPolyhedron = head.CreatePolyhedron();
// Transform to position
const G4Vector3D arrowDirection = G4Vector3D(x2-x1,y2-y1,z2-z1).unit();
const G4double theta = arrowDirection.theta();
const G4double phi = arrowDirection.phi();
const G4Point3D arrowCentre(0.5*(x1+x2),0.5*(y1+y2),0.5*(z1+z2));
const G4Transform3D tr =
G4Translate3D(arrowCentre) * G4RotateZ3D(phi) * G4RotateY3D(theta);
fpShaftPolyhedron->Transform(tr);
fpHeadPolyhedron->Transform(tr);
G4VisAttributes va;
va.SetColour(colour);
va.SetForceSolid(true);
fpShaftPolyhedron->SetVisAttributes(va);
fpHeadPolyhedron->SetVisAttributes(va);
}
void G4ArrowModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler)
{
sceneHandler.BeginPrimitives();
sceneHandler.AddPrimitive(*fpShaftPolyhedron);
sceneHandler.AddPrimitive(*fpHeadPolyhedron);
sceneHandler.EndPrimitives();
}
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4AttFilterUtils.cc,v 1.4 2006-12-13 15:50:06 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Visualisation attribute filter utility functions.
//
+117 -39
View File
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4AxesModel.cc,v 1.6 2006-06-29 21:32:38 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 3rd April 2001
@@ -38,47 +37,126 @@
#include "G4VisAttributes.hh"
#include "G4Polyline.hh"
#include "G4Colour.hh"
#include "G4UnitsTable.hh"
#include "G4ArrowModel.hh"
#include "G4TextModel.hh"
G4AxesModel::~G4AxesModel () {}
G4AxesModel::G4AxesModel
(G4double x0, G4double y0, G4double z0, G4double length):
fX0(x0), fY0(y0), fZ0(z0), fLength(length) {
fGlobalTag = "G4AxesModel";
fGlobalDescription = fGlobalTag;
(G4double x0, G4double y0, G4double z0, G4double length,
G4double arrowWidth,
const G4String& colourString,
const G4String& description,
G4bool withAnnotation):
fXAxisModel(0),
fXLabelModel(0),
fXAnnotationModel(0),
fYAxisModel(0),
fYLabelModel(0),
fYAnnotationModel(0),
fZAxisModel(0),
fZLabelModel(0),
fZAnnotationModel(0)
{
fType = "G4AxesModel";
fGlobalTag = fType;
fGlobalDescription = fType + ": " + description;
fExtent = G4VisExtent
(x0, x0+length, y0, y0+length, z0, z0+length);
G4Colour colour(1,1,1,1); // Default white and opaque (unless "auto").
G4bool autoColour = false;
if (colourString == "auto") autoColour = true;
else {
if (!G4Colour::GetColour(colourString, colour)) {
G4ExceptionDescription ed;
ed << "Colour \"" << colourString
<< "\" not found. Defaulting to white and opaque.";
G4Exception
("G4AxesModel::G4AxesModel",
"modeling0012", JustWarning, ed);
}
}
G4String annotation = G4BestUnit(length,"Length");
G4Text* text = 0;
G4VisAttributes* va = 0;
G4Colour xColour(colour);
if (autoColour) xColour = G4Colour::Red();
fXAxisModel = new G4ArrowModel
(x0, y0, z0, x0+length, y0, z0, arrowWidth,
xColour, "x-axis: " + description);
if (withAnnotation) {
text = new G4Text("x",G4Point3D(x0+1.05*length, y0, z0));
text->SetScreenSize(10.);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(xColour);
text->SetVisAttributes(va);
fXLabelModel = new G4TextModel(*text);
text = new G4Text(annotation,G4Point3D(x0+0.8*length, y0, z0));
text->SetScreenSize(10.);
text->SetOffset(5.,5.);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(xColour);
text->SetVisAttributes(va);
fXAnnotationModel = new G4TextModel(*text);
}
G4Colour yColour(colour);
if (autoColour) yColour = G4Colour::Green();
fYAxisModel = new G4ArrowModel
(x0, y0, z0, x0, y0+length, z0, arrowWidth,
yColour, "y-axis: " + description);
if (withAnnotation) {
text = new G4Text("y",G4Point3D(x0, y0+1.05*length, z0));
text->SetScreenSize(10.);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(yColour);
text->SetVisAttributes(va);
fYLabelModel = new G4TextModel(*text);
text = new G4Text(annotation,G4Point3D(x0, y0+0.8*length, z0));
text->SetScreenSize(10.);
text->SetOffset(5.,5.);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(yColour);
text->SetVisAttributes(va);
fYAnnotationModel = new G4TextModel(*text);
}
G4Colour zColour(colour);
if (autoColour) zColour = G4Colour::Blue();
fZAxisModel = new G4ArrowModel
(x0, y0, z0, x0, y0, z0+length, arrowWidth,
zColour, "z-axis: " + description);
if (withAnnotation) {
text = new G4Text("z",G4Point3D(x0, y0, z0+1.05*length));
text->SetScreenSize(10.);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(zColour);
text->SetVisAttributes(va);
fZLabelModel = new G4TextModel(*text);
text = new G4Text(annotation,G4Point3D(x0, y0, z0+0.8*length));
text->SetScreenSize(10.);
text->SetOffset(5.,5.);
text->SetLayout(G4Text::centre);
va = new G4VisAttributes(zColour);
text->SetVisAttributes(va);
fZAnnotationModel = new G4TextModel(*text);
}
}
void G4AxesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
G4Polyline x_axis, y_axis, z_axis;
G4Colour cx(1.0, 0.0, 0.0); // color for x-axis
G4Colour cy(0.0, 1.0, 0.0); // color for y-axis
G4Colour cz(0.0, 0.0, 1.0); // color for z-axis
G4VisAttributes ax(cx); // VA for x-axis
G4VisAttributes ay(cy); // VA for y-axis
G4VisAttributes az(cz); // VA for z-axis
sceneHandler.BeginPrimitives();
//----- Draw x-axis
x_axis.SetVisAttributes(&ax);
x_axis.push_back(G4Point3D(fX0,fY0,fZ0));
x_axis.push_back(G4Point3D((fX0 + fLength),fY0,fZ0));
sceneHandler.AddPrimitive(x_axis);
//----- Draw y-axis
y_axis.SetVisAttributes(&ay);
y_axis.push_back(G4Point3D(fX0,fY0,fZ0));
y_axis.push_back(G4Point3D(fX0,(fY0 + fLength),fZ0));
sceneHandler.AddPrimitive(y_axis);
//----- Draw z-axis
z_axis.SetVisAttributes(&az);
z_axis.push_back(G4Point3D(fX0,fY0,fZ0));
z_axis.push_back(G4Point3D(fX0,fY0,(fZ0 + fLength)));
sceneHandler.AddPrimitive(z_axis);
sceneHandler.EndPrimitives();
void G4AxesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler)
{
if (fXAxisModel) fXAxisModel->DescribeYourselfTo(sceneHandler);
if (fXLabelModel) fXLabelModel->DescribeYourselfTo(sceneHandler);
if (fXAnnotationModel) fXAnnotationModel->DescribeYourselfTo(sceneHandler);
if (fYAxisModel) fYAxisModel->DescribeYourselfTo(sceneHandler);
if (fYLabelModel) fYLabelModel->DescribeYourselfTo(sceneHandler);
if (fYAnnotationModel) fYAnnotationModel->DescribeYourselfTo(sceneHandler);
if (fZAxisModel) fZAxisModel->DescribeYourselfTo(sceneHandler);
if (fZLabelModel) fZLabelModel->DescribeYourselfTo(sceneHandler);
if (fZAnnotationModel) fZAnnotationModel->DescribeYourselfTo(sceneHandler);
}
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4BoundingSphereScene.cc,v 1.11 2006-06-29 21:32:40 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 7th June 1997
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4DigiModel.cc,v 1.1 2010-05-30 11:24:30 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 26th August 1998.
@@ -42,6 +41,7 @@ G4DigiModel::~G4DigiModel () {}
G4DigiModel::G4DigiModel ():
fpCurrentDigi(0)
{
fType = "G4DigiModel";
fGlobalTag = "G4DigiModel for all digis.";
fGlobalDescription = fGlobalTag;
}
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4FlavoredParallelWorldModel.cc,v 1.7 2006-06-29 21:32:42 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// P. Mora de Freitas et M.Verderi - 19 June 1998.
// Model for flavored parallel world volumes.
@@ -48,6 +47,7 @@ G4FlavoredParallelWorldModel::G4FlavoredParallelWorldModel
mp),
theFlavoredParallelWorld (FPW)
{
fType = "G4FlavoredParallelWorldModel";
FPW -> GetThePhysicalVolumeWorld () ->
GetLogicalVolume () -> SetVisAttributes (G4VisAttributes::GetInvisible());
}
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4HitsModel.cc,v 1.18 2006-11-14 14:42:08 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 26th August 1998.
@@ -42,6 +41,7 @@ G4HitsModel::~G4HitsModel () {}
G4HitsModel::G4HitsModel ():
fpCurrentHit(0)
{
fType = "G4HitsModel";
fGlobalTag = "G4HitsModel for all hits.";
fGlobalDescription = fGlobalTag;
}
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeModel.cc,v 1.14 2006-11-01 10:28:42 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 26th July 1999.
@@ -59,7 +58,7 @@ G4LogicalVolumeModel::G4LogicalVolumeModel
G4PhysicalVolumeModel
(new G4PVPlacement (0, // No rotation.
G4ThreeVector(), // Null traslation.
"PhysVol representaion of LogVol " + pLV -> GetName (),
"PhysVol representation of LogVol " + pLV -> GetName (),
pLV,
0, // No mother.
false, // Not "MANY".
@@ -73,6 +72,7 @@ G4LogicalVolumeModel::G4LogicalVolumeModel
fVoxels (voxels),
fReadout (readout)
{
fType = "G4LogicalVolumeModel";
fGlobalTag = fpLV -> GetName ();
fGlobalDescription = "G4LogicalVolumeModel " + fGlobalTag;
}
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.cc,v 1.16 2010-05-11 11:13:35 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 31st December 1997.
@@ -36,7 +35,10 @@
#include "G4ios.hh"
#include "G4VisAttributes.hh"
#include "G4ExceptionSeverity.hh"
#include "G4SystemOfUnits.hh"
#include "G4VSolid.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PhysicalVolumeModel.hh"
G4ModelingParameters::G4ModelingParameters ():
fWarning (true),
@@ -85,6 +87,26 @@ G4ModelingParameters::~G4ModelingParameters ()
delete fpCutawaySolid;
}
G4ModelingParameters::VisAttributesModifier::VisAttributesModifier
(const G4VisAttributes& visAtts,
G4ModelingParameters::VisAttributesSignifier signifier,
const std::vector<G4PhysicalVolumeModel::G4PhysicalVolumeNodeID>& path):
fVisAtts(visAtts), fSignifier(signifier)
{
typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
typedef std::vector<PVNodeID> PVPath;
typedef PVPath::const_iterator PVPathConstIterator;
PVPathConstIterator i;
for (i = path.begin();
i != path.end();
++i) {
fPVNameCopyNoPath.push_back
(PVNameCopyNo
(i->GetPhysicalVolume()->GetName(),
i->GetCopyNo()));
}
}
void G4ModelingParameters::SetVisibleDensity (G4double visibleDensity) {
const G4double reasonableMaximum = 10.0 * g / cm3;
if (visibleDensity < 0 && fWarning) {
@@ -187,6 +209,15 @@ std::ostream& operator << (std::ostream& os, const G4ModelingParameters& mp)
os << "\n Event pointer: " << mp.fpEvent;
os << "\n Vis attributes modifiers: ";
const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
mp.fVisAttributesModifiers;
if (vams.empty()) {
os << "None";
} else {
os << vams;
}
return os;
}
@@ -212,5 +243,194 @@ G4bool G4ModelingParameters::operator !=
if (fDensityCulling &&
(fVisibleDensity != mp.fVisibleDensity)) return true;
if (VAMSNotEqual(fVisAttributesModifiers, mp.fVisAttributesModifiers))
return true;
return false;
}
G4bool G4ModelingParameters::PVNameCopyNoPathNotEqual
(const G4ModelingParameters::PVNameCopyNoPath& path1,
const G4ModelingParameters::PVNameCopyNoPath& path2)
{
if (path1.size() != path2.size()) return true;
if (path1.empty()) return false;
PVNameCopyNoPathConstIterator i1, i2;
for (i1 = path1.begin(), i2 = path2.begin();
i1 != path1.end();
++i1, ++i2) {
if (i1->GetName() != i2->GetName()) return true;
if (i1->GetCopyNo() != i2->GetCopyNo()) return true;
}
return false;
}
G4bool G4ModelingParameters::VAMSNotEqual
(const std::vector<G4ModelingParameters::VisAttributesModifier>& vams1,
const std::vector<G4ModelingParameters::VisAttributesModifier>& vams2)
{
if (vams1.size() != vams2.size()) return true;
if (vams1.empty()) return false;
std::vector<VisAttributesModifier>::const_iterator i1, i2;
for (i1 = vams1.begin(), i2 = vams2.begin();
i1 != vams1.end();
++i1, ++i2) {
const PVNameCopyNoPath& vam1Path = i1->GetPVNameCopyNoPath();
const PVNameCopyNoPath& vam2Path = i2->GetPVNameCopyNoPath();
if (PVNameCopyNoPathNotEqual(vam1Path,vam2Path)) return true;
if (i1->GetVisAttributesSignifier() != i2->GetVisAttributesSignifier())
return true;
const G4VisAttributes& vam1VisAtts = i1->GetVisAttributes();
const G4VisAttributes& vam2VisAtts = i2->GetVisAttributes();
const G4Colour& c1 = vam1VisAtts.GetColour();
const G4Colour& c2 = vam2VisAtts.GetColour();
switch (i1->GetVisAttributesSignifier()) {
case G4ModelingParameters::VASVisibility:
if (vam1VisAtts.IsVisible() != vam2VisAtts.IsVisible())
return true;
break;
case G4ModelingParameters::VASDaughtersInvisible:
if (vam1VisAtts.IsDaughtersInvisible() !=
vam2VisAtts.IsDaughtersInvisible())
return true;
break;
case G4ModelingParameters::VASColour:
if (c1 != c2)
return true;
break;
case G4ModelingParameters::VASLineStyle:
if (vam1VisAtts.GetLineStyle() != vam2VisAtts.GetLineStyle())
return true;
break;
case G4ModelingParameters::VASLineWidth:
if (vam1VisAtts.GetLineWidth() != vam2VisAtts.GetLineWidth())
return true;
break;
case G4ModelingParameters::VASForceWireframe:
if (vam1VisAtts.GetForcedDrawingStyle() !=
vam2VisAtts.GetForcedDrawingStyle())
return true;
break;
case G4ModelingParameters::VASForceSolid:
if (vam1VisAtts.GetForcedDrawingStyle() !=
vam2VisAtts.GetForcedDrawingStyle())
return true;
break;
case G4ModelingParameters::VASForceAuxEdgeVisible:
if (vam1VisAtts.IsForceAuxEdgeVisible() !=
vam2VisAtts.IsForceAuxEdgeVisible())
return true;
break;
case G4ModelingParameters::VASForceLineSegmentsPerCircle:
if (vam1VisAtts.GetForcedLineSegmentsPerCircle() !=
vam2VisAtts.GetForcedLineSegmentsPerCircle())
return true;
break;
}
}
return false;
}
std::ostream& operator <<
(std::ostream& os, const G4ModelingParameters::PVNameCopyNoPath& path)
{
// os << "Touchable path: physical-volume-name:copy-number pairs:\n ";
G4ModelingParameters::PVNameCopyNoPathConstIterator i;
for (i = path.begin(); i != path.end(); ++i) {
if (i != path.begin()) {
os << ", ";
}
os << i->GetName() << ':' << i->GetCopyNo();
}
return os;
}
std::ostream& operator <<
(std::ostream& os,
const std::vector<G4ModelingParameters::VisAttributesModifier>& vams)
{
std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
iModifier;
for (iModifier = vams.begin();
iModifier != vams.end();
++iModifier) {
const G4ModelingParameters::PVNameCopyNoPath& vamPath =
iModifier->GetPVNameCopyNoPath();
os << '\n' << vamPath;
const G4VisAttributes& vamVisAtts = iModifier->GetVisAttributes();
const G4Colour& c = vamVisAtts.GetColour();
switch (iModifier->GetVisAttributesSignifier()) {
case G4ModelingParameters::VASVisibility:
os << " visibility ";
if (vamVisAtts.IsVisible()) {
os << "true";
} else {
os << "false";
}
break;
case G4ModelingParameters::VASDaughtersInvisible:
os << " daughtersInvisible ";
if (vamVisAtts.IsDaughtersInvisible()) {
os << "true";
} else {
os << "false";
}
break;
case G4ModelingParameters::VASColour:
os << " colour " << c;
break;
case G4ModelingParameters::VASLineStyle:
os << " lineStyle ";
switch (vamVisAtts.GetLineStyle()) {
case G4VisAttributes::unbroken:
os << "unbroken";
break;
case G4VisAttributes::dashed:
os << "dashed";
break;
case G4VisAttributes::dotted:
os << "dotted";
}
break;
case G4ModelingParameters::VASLineWidth:
os << " lineWidth "
<< vamVisAtts.GetLineWidth();
break;
case G4ModelingParameters::VASForceWireframe:
if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::wireframe) {
os << " forceWireframe ";
if (vamVisAtts.IsForceDrawingStyle()) {
os << "true";
} else {
os << "false";
}
}
break;
case G4ModelingParameters::VASForceSolid:
if (vamVisAtts.GetForcedDrawingStyle() == G4VisAttributes::solid) {
os << " forceSolid ";
if (vamVisAtts.IsForceDrawingStyle()) {
os << "true";
} else {
os << "false";
}
}
break;
case G4ModelingParameters::VASForceAuxEdgeVisible:
os << " forceAuxEdgeVisible ";
if (vamVisAtts.IsForceAuxEdgeVisible()) {
os << "true";
} else {
os << "false";
}
break;
case G4ModelingParameters::VASForceLineSegmentsPerCircle:
os << " lineSegmentsPerCircle "
<< vamVisAtts.GetForcedLineSegmentsPerCircle();
break;
}
}
return os;
}
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4NullModel.cc,v 1.9 2006-06-29 21:32:50 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 4th April 1998.
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PSHitsModel.cc,v 1.4 2009-11-04 12:44:39 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// Created: Mar. 31, 2009 Akinori Kimura
@@ -44,6 +43,7 @@ G4PSHitsModel::~G4PSHitsModel () {}
G4PSHitsModel::G4PSHitsModel (const G4String& requestedMapName):
fRequestedMapName(requestedMapName), fpCurrentHits(0)
{
fType = "G4PSHitsModel";
fGlobalTag = "G4PSHitsModel for G4THitsMap<G4double> hits.";
fGlobalDescription = fGlobalTag;
}
@@ -54,8 +54,8 @@ void G4PSHitsModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler)
G4ScoringManager::GetScoringManagerIfExist();
if (scoringManager) {
size_t nMeshes = scoringManager->GetNumberOfMesh();
for (size_t i = 0; i < nMeshes; ++i) {
G4VScoringMesh* mesh = scoringManager->GetMesh(i);
for (size_t iMesh = 0; iMesh < nMeshes; ++iMesh) {
G4VScoringMesh* mesh = scoringManager->GetMesh(iMesh);
if (mesh && mesh->IsActive()) {
MeshScoreMap scoreMap = mesh->GetScoreMap();
for(MeshScoreMap::const_iterator i = scoreMap.begin();
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeMassScene.cc,v 1.7 2006-11-06 09:24:13 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 10th August 1998.
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.cc,v 1.68 2010-11-05 15:19:29 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 31st December 1997.
@@ -64,8 +63,6 @@ G4PhysicalVolumeModel::G4PhysicalVolumeModel
G4bool useFullExtent):
G4VModel (modelTransformation, pMP),
fpTopPV (pVPV),
fTopPVName (pVPV -> GetName ()),
fTopPVCopyNo (pVPV -> GetCopyNo ()),
fRequestedDepth (requestedDepth),
fUseFullExtent (useFullExtent),
fCurrentDepth (0),
@@ -77,12 +74,18 @@ G4PhysicalVolumeModel::G4PhysicalVolumeModel
fpClippingSolid (0),
fClippingMode (subtraction)
{
std::ostringstream o;
o << fpTopPV -> GetCopyNo ();
fGlobalTag = fpTopPV -> GetName () + "." + o.str();
fGlobalDescription = "G4PhysicalVolumeModel " + fGlobalTag;
if (fpTopPV) {
fType = "G4PhysicalVolumeModel";
fTopPVName = fpTopPV -> GetName ();
fTopPVCopyNo = fpTopPV -> GetCopyNo ();
std::ostringstream o;
o << fpTopPV -> GetCopyNo ();
fGlobalTag = fpTopPV -> GetName () + "." + o.str();
fGlobalDescription = "G4PhysicalVolumeModel " + fGlobalTag;
CalculateExtent ();
CalculateExtent ();
}
}
G4PhysicalVolumeModel::~G4PhysicalVolumeModel ()
@@ -132,6 +135,10 @@ void G4PhysicalVolumeModel::CalculateExtent ()
void G4PhysicalVolumeModel::DescribeYourselfTo
(G4VGraphicsScene& sceneHandler)
{
if (!fpTopPV) G4Exception
("G4PhysicalVolumeModel::DescribeYourselfTo",
"modeling0012", FatalException, "No model.");
if (!fpMP) G4Exception
("G4PhysicalVolumeModel::DescribeYourselfTo",
"modeling0003", FatalException, "No modeling parameters.");
@@ -152,7 +159,15 @@ void G4PhysicalVolumeModel::DescribeYourselfTo
fpCurrentPV = 0;
fpCurrentLV = 0;
fpCurrentMaterial = 0;
fFullPVPath.clear();
if (fFullPVPath.size() != fBaseFullPVPath.size()) {
// They should be equal if pushing and popping is happening properly.
G4Exception
("G4PhysicalVolumeModel::DescribeYourselfTo",
"modeling0013",
FatalException,
"Path at start of modeling not equal to base path. Something badly"
"\nwrong. Please contact visualisation coordinator.");
}
fDrawnPVPath.clear();
}
@@ -207,9 +222,9 @@ void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
G4double offset;
G4bool consuming;
pVPV -> GetReplicationData (axis, nReplicas, width, offset, consuming);
if (fCurrentDepth == 0) nReplicas = 1; // Just draw first
G4VPVParameterisation* pP = pVPV -> GetParameterisation ();
if (pP) { // Parametrised volume.
if (fCurrentDepth == 0) nReplicas = 1; // Just draw first
for (int n = 0; n < nReplicas; n++) {
pSol = pP -> ComputeSolid (n, pVPV);
pP -> ComputeTransformation (n, pVPV);
@@ -345,7 +360,6 @@ void G4PhysicalVolumeModel::DescribeAndDescend
if (fCurrentDepth != 0) theNewAT = theAT * theLT;
fpCurrentTransform = &theNewAT;
// Make decision to draw...
const G4VisAttributes* pVisAttribs = pLV->GetVisAttributes();
if (!pVisAttribs) pVisAttribs = fpMP->GetDefaultVisAttributes();
// Beware - pVisAttribs might still be zero - create a temporary default one...
@@ -354,10 +368,106 @@ void G4PhysicalVolumeModel::DescribeAndDescend
pVisAttribs = new G4VisAttributes;
visAttsCreated = true;
}
// From here, can assume pVisAttribs is a valid pointer.
// Make decision to draw...
G4bool thisToBeDrawn = true;
// Update full path of physical volumes...
G4int copyNo = fpCurrentPV->GetCopyNo();
fFullPVPath.push_back
(G4PhysicalVolumeNodeID
(fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform));
// In case we need to copy the vis atts for modification...
G4bool copyForVAM = false;
const G4VisAttributes* pUnmodifiedVisAtts = pVisAttribs;
G4VisAttributes* pModifiedVisAtts = 0;
// Check if vis attributes are to be modified by a /vis/touchable/set/ command.
const std::vector<G4ModelingParameters::VisAttributesModifier>& vams =
fpMP->GetVisAttributesModifiers();
std::vector<G4ModelingParameters::VisAttributesModifier>::const_iterator
iModifier;
for (iModifier = vams.begin();
iModifier != vams.end();
++iModifier) {
const G4ModelingParameters::PVNameCopyNoPath& vamPath =
iModifier->GetPVNameCopyNoPath();
if (vamPath.size() == fFullPVPath.size()) {
// OK - there's a size match. Check it out.
// G4cout << "Size match" << G4endl;
G4ModelingParameters::PVNameCopyNoPathConstIterator iVAMNameCopyNo;
std::vector<G4PhysicalVolumeNodeID>::const_iterator iPVNodeId;
for (iVAMNameCopyNo = vamPath.begin(), iPVNodeId = fFullPVPath.begin();
iVAMNameCopyNo != vamPath.end();
++iVAMNameCopyNo, ++iPVNodeId) {
// G4cout
// << iVAMNameCopyNo->fName
// << ',' << iVAMNameCopyNo->fCopyNo
// << "; " << iPVNodeId->GetPhysicalVolume()->GetName()
// << ',' << iPVNodeId->GetPhysicalVolume()->GetCopyNo()
// << G4endl;
if (!(
iVAMNameCopyNo->GetName() ==
iPVNodeId->GetPhysicalVolume()->GetName() &&
iVAMNameCopyNo->GetCopyNo() ==
iPVNodeId->GetPhysicalVolume()->GetCopyNo()
)) {
break;
}
}
if (iVAMNameCopyNo == vamPath.end()) {
// G4cout << "Match found" << G4endl;
if (!copyForVAM) {
pModifiedVisAtts = new G4VisAttributes(*pUnmodifiedVisAtts);
pVisAttribs = pModifiedVisAtts;
copyForVAM = true;
}
const G4VisAttributes& transVisAtts = iModifier->GetVisAttributes();
switch (iModifier->GetVisAttributesSignifier()) {
case G4ModelingParameters::VASVisibility:
pModifiedVisAtts->SetVisibility(transVisAtts.IsVisible());
break;
case G4ModelingParameters::VASDaughtersInvisible:
pModifiedVisAtts->SetDaughtersInvisible
(transVisAtts.IsDaughtersInvisible());
break;
case G4ModelingParameters::VASColour:
pModifiedVisAtts->SetColour(transVisAtts.GetColour());
break;
case G4ModelingParameters::VASLineStyle:
pModifiedVisAtts->SetLineStyle(transVisAtts.GetLineStyle());
break;
case G4ModelingParameters::VASLineWidth:
pModifiedVisAtts->SetLineWidth(transVisAtts.GetLineWidth());
break;
case G4ModelingParameters::VASForceWireframe:
if (transVisAtts.GetForcedDrawingStyle() ==
G4VisAttributes::wireframe) {
pModifiedVisAtts->SetForceWireframe
(transVisAtts.IsForceDrawingStyle());
}
break;
case G4ModelingParameters::VASForceSolid:
if (transVisAtts.GetForcedDrawingStyle() ==
G4VisAttributes::solid) {
pModifiedVisAtts->SetForceSolid
(transVisAtts.IsForceDrawingStyle());
}
break;
case G4ModelingParameters::VASForceAuxEdgeVisible:
pModifiedVisAtts->SetForceAuxEdgeVisible
(transVisAtts.IsForceAuxEdgeVisible());
break;
case G4ModelingParameters::VASForceLineSegmentsPerCircle:
pModifiedVisAtts->SetForceLineSegmentsPerCircle
(transVisAtts.GetForcedLineSegmentsPerCircle());
break;
}
}
}
}
// There are various reasons why this volume
// might not be drawn...
@@ -381,17 +491,13 @@ void G4PhysicalVolumeModel::DescribeAndDescend
if (density < densityCut) thisToBeDrawn = false;
}
}
// Update full path of physical volumes...
G4int copyNo = fpCurrentPV->GetCopyNo();
fFullPVPath.push_back
(G4PhysicalVolumeNodeID
(fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform,thisToBeDrawn));
// Record thisToBeDrawn in path...
fFullPVPath.back().SetDrawn(thisToBeDrawn);
if (thisToBeDrawn) {
// Update path of drawn physical volumes...
G4int copyNo = fpCurrentPV->GetCopyNo();
fDrawnPVPath.push_back
(G4PhysicalVolumeNodeID
(fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform,thisToBeDrawn));
@@ -400,16 +506,16 @@ void G4PhysicalVolumeModel::DescribeAndDescend
// For top-level drawn volumes, explode along radius...
G4Transform3D centering = G4Translate3D(fpMP->GetExplodeCentre());
G4Transform3D centred = centering.inverse() * theNewAT;
G4Scale3D scale;
G4Rotate3D rotation;
G4Translate3D translation;
centred.getDecomposition(scale, rotation, translation);
G4Scale3D oldScale;
G4Rotate3D oldRotation;
G4Translate3D oldTranslation;
centred.getDecomposition(oldScale, oldRotation, oldTranslation);
G4double explodeFactor = fpMP->GetExplodeFactor();
G4Translate3D newTranslation =
G4Translate3D(explodeFactor * translation.dx(),
explodeFactor * translation.dy(),
explodeFactor * translation.dz());
theNewAT = centering * newTranslation * rotation * scale;
G4Translate3D(explodeFactor * oldTranslation.dx(),
explodeFactor * oldTranslation.dy(),
explodeFactor * oldTranslation.dz());
theNewAT = centering * newTranslation * oldRotation * oldScale;
}
DescribeSolid (theNewAT, pSol, pVisAttribs, sceneHandler);
@@ -431,8 +537,6 @@ void G4PhysicalVolumeModel::DescribeAndDescend
// Now, reasons that depend on culling policy...
else {
G4bool culling = fpMP->IsCulling();
G4bool cullingInvisible = fpMP->IsCullingInvisible();
G4bool daughtersInvisible = pVisAttribs->IsDaughtersInvisible();
// Culling of covered daughters request. This is computed in
// G4VSceneHandler::CreateModelingParameters() depending on view
@@ -470,6 +574,12 @@ void G4PhysicalVolumeModel::DescribeAndDescend
}
}
// Delete modified vis atts if created...
if (copyForVAM) {
delete pModifiedVisAtts;
pVisAttribs = pUnmodifiedVisAtts;
}
// Vis atts for this volume no longer needed if created...
if (visAttsCreated) delete pVisAttribs;
@@ -590,41 +700,51 @@ void G4PhysicalVolumeModel::DescribeSolid
G4bool G4PhysicalVolumeModel::Validate (G4bool warn)
{
G4VPhysicalVolume* world =
G4TransportationManager::GetTransportationManager ()
-> GetNavigatorForTracking () -> GetWorldVolume ();
// The idea now is to seek a PV with the same name and copy no
// in the hope it's the same one!!
G4PhysicalVolumeModel searchModel (world);
G4PhysicalVolumeSearchScene searchScene
(&searchModel, fTopPVName, fTopPVCopyNo);
G4ModelingParameters mp; // Default modeling parameters for this search.
mp.SetDefaultVisAttributes(fpMP? fpMP->GetDefaultVisAttributes(): 0);
searchModel.SetModelingParameters (&mp);
searchModel.DescribeYourselfTo (searchScene);
G4VPhysicalVolume* foundVolume = searchScene.GetFoundVolume ();
if (foundVolume) {
if (foundVolume != fpTopPV && warn) {
G4cout <<
"G4PhysicalVolumeModel::Validate(): A volume of the same name and"
"\n copy number (\""
<< fTopPVName << "\", copy " << fTopPVCopyNo
<< ") still exists and is being used."
"\n But it is not the same volume you originally specified"
"\n in /vis/scene/add/."
<< G4endl;
G4TransportationManager* transportationManager =
G4TransportationManager::GetTransportationManager ();
size_t nWorlds = transportationManager->GetNoWorlds();
G4bool found = false;
std::vector<G4VPhysicalVolume*>::iterator iterWorld =
transportationManager->GetWorldsIterator();
for (size_t i = 0; i < nWorlds; ++i, ++iterWorld) {
G4VPhysicalVolume* world = (*iterWorld);
// The idea now is to seek a PV with the same name and copy no
// in the hope it's the same one!!
G4PhysicalVolumeModel searchModel (world);
G4PhysicalVolumeSearchScene searchScene
(&searchModel, fTopPVName, fTopPVCopyNo);
G4ModelingParameters mp; // Default modeling parameters for this search.
mp.SetDefaultVisAttributes(fpMP? fpMP->GetDefaultVisAttributes(): 0);
searchModel.SetModelingParameters (&mp);
searchModel.DescribeYourselfTo (searchScene);
G4VPhysicalVolume* foundVolume = searchScene.GetFoundVolume ();
if (foundVolume) {
if (foundVolume != fpTopPV && warn) {
G4cout <<
"G4PhysicalVolumeModel::Validate(): A volume of the same name and"
"\n copy number (\""
<< fTopPVName << "\", copy " << fTopPVCopyNo
<< ") still exists and is being used."
"\n But it is not the same volume you originally specified"
"\n in /vis/scene/add/."
<< G4endl;
}
fpTopPV = foundVolume;
CalculateExtent ();
found = true;
}
fpTopPV = foundVolume;
CalculateExtent ();
return true;
}
if (found) return true;
else {
if (warn) {
G4cout <<
"G4PhysicalVolumeModel::Validate(): A volume of the same name and"
"G4PhysicalVolumeModel::Validate(): No volume of name and"
"\n copy number (\""
<< fTopPVName << "\", copy " << fTopPVCopyNo
<< ") no longer exists."
<< ") exists."
<< G4endl;
}
return false;
@@ -657,12 +777,12 @@ const std::map<G4String,G4AttDef>* G4PhysicalVolumeModel::GetAttDefs() const
G4AttDef("State","Material State (enum undefined,solid,liquid,gas)","Physics","","G4String");
(*store)["Radlen"] =
G4AttDef("Radlen","Material Radiation Length","Physics","G4BestUnit","G4double");
}
(*store)["Region"] =
G4AttDef("Region","Cuts Region","Physics","","G4String");
(*store)["RootRegion"] =
G4AttDef("RootRegion","Root Region (0/1 = false/true)","Physics","","G4bool");
return store;
}
return store;
}
#include <iomanip>
@@ -671,10 +791,10 @@ static std::ostream& operator<< (std::ostream& o, const G4Transform3D t)
{
using namespace std;
G4Scale3D s;
G4Scale3D sc;
G4Rotate3D r;
G4Translate3D tl;
t.getDecomposition(s, r, tl);
t.getDecomposition(sc, r, tl);
const int w = 10;
@@ -695,7 +815,7 @@ static std::ostream& operator<< (std::ostream& o, const G4Transform3D t)
// Scale
o << "* scale:" << endl;
o << setw(w) << s.xx() << setw(w) << s.yy() << setw(w) << s.zz() << endl;
o << setw(w) << sc.xx() << setw(w) << sc.yy() << setw(w) << sc.zz() << endl;
// Transformed axes
o << "Transformed axes:" << endl;
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeSearchScene.cc,v 1.14 2008-07-27 10:49:24 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 10th August 1998.
@@ -55,6 +54,9 @@ G4PhysicalVolumeSearchScene::~G4PhysicalVolumeSearchScene () {}
void G4PhysicalVolumeSearchScene::FindVolume (const G4VSolid&) {
typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
typedef std::vector<PVNodeID> PVPath;
const PVPath& fullPVPath = fpPVModel->GetFullPVPath();
G4int currentDepth = fpPVModel->GetCurrentDepth();
G4VPhysicalVolume* pCurrentPV = fpPVModel->GetCurrentPV();
G4LogicalVolume* pCurrentLV = fpPVModel->GetCurrentLV();
@@ -73,6 +75,7 @@ void G4PhysicalVolumeSearchScene::FindVolume (const G4VSolid&) {
fRequiredCopyNo == pCurrentPV -> GetCopyNo ())) {
// Current policy - take first one found!!
if (!fpFoundPV) { // i.e., if not already found.
fFoundFullPVPath = fullPVPath;
fFoundDepth = currentDepth;
fpFoundPV = pCurrentPV;
fpFoundLV = pCurrentLV;
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4ScaleModel.cc,v 1.4 2006-06-29 21:32:58 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 21st July 2001.
@@ -39,6 +38,7 @@
G4ScaleModel::~G4ScaleModel () {}
G4ScaleModel::G4ScaleModel (const G4Scale& scale): fScale(scale) {
fType = "G4ScaleModel";
fGlobalTag = "G4ScaleModel: " + fScale.GetAnnotation();
switch (fScale.GetDirection()) {
case G4Scale::x:
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TextModel.cc,v 1.7 2006-06-29 21:33:00 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 3rd April 2001
@@ -42,6 +41,7 @@
G4TextModel::~G4TextModel () {}
G4TextModel::G4TextModel (const G4Text& g4Text): fG4Text(g4Text) {
fType = "G4TextModel";
std::ostringstream oss;
oss << "G4TextModel: \"" << fG4Text.GetText()
<< "\" at " << G4BestUnit(g4Text.GetPosition(),"Length")
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4TrajectoriesModel.cc,v 1.25 2010-05-11 11:21:52 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 26th August 1998.
@@ -36,15 +35,18 @@
#include "G4ModelingParameters.hh"
#include "G4VGraphicsScene.hh"
#include "G4Event.hh"
#include "G4AttDefStore.hh"
#include "G4AttValue.hh"
#include "G4AttDef.hh"
#include "G4AttCheck.hh"
#include "G4UIcommand.hh"
G4TrajectoriesModel::G4TrajectoriesModel ():
fDrawingModeSet(false),
fDrawingMode(0),
fpCurrentTrajectory(0)
{
fType = "G4TrajectoriesModel";
fGlobalTag = "G4TrajectoriesModel for all trajectories.";
fGlobalDescription = fGlobalTag;
}
@@ -61,22 +63,35 @@ G4TrajectoriesModel::~G4TrajectoriesModel () {}
void G4TrajectoriesModelDebugG4AttValues(const G4VTrajectory*);
void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
#include "G4VVisManager.hh"
void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler)
{
const G4Event* event = fpMP->GetEvent();
if (event) {
G4TrajectoryContainer* TC = event -> GetTrajectoryContainer ();
if (TC) {
for (G4int iT = 0; iT < TC->entries(); iT++) {
fpCurrentTrajectory = (*TC) [iT];
// Debug trajectory:
// fpCurrentTrajectory->ShowTrajectory(); G4cout << G4endl;
// Debug G4AttValues:
// G4TrajectoriesModelDebugG4AttValues(fpCurrentTrajectory);
if (fpCurrentTrajectory)
sceneHandler.AddCompound (*fpCurrentTrajectory);
}
}
if (!event) return;
G4TrajectoryContainer* TC = event -> GetTrajectoryContainer ();
if (!TC) return;
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (!pVVisManager) return;
fEventID = event->GetEventID();
pVVisManager->BeginDraw();
// The use of Begin/EndDraw (optional methods to improve drawing
// speed) assumes all trajectories are drawn with the same
// transformation. If not, a fatal exception with be raised in
// G4VisManager::DrawT.
for (G4int iT = 0; iT < TC->entries(); iT++) {
fpCurrentTrajectory = (*TC) [iT];
// Debug trajectory:
// fpCurrentTrajectory->ShowTrajectory(); G4cout << G4endl;
// Debug G4AttValues:
// G4TrajectoriesModelDebugG4AttValues(fpCurrentTrajectory);
if (fpCurrentTrajectory)
sceneHandler.AddCompound (*fpCurrentTrajectory);
}
pVVisManager->EndDraw();
}
G4bool G4TrajectoriesModel::IsDrawingModeSet() const
@@ -115,26 +130,50 @@ void G4TrajectoriesModel::SetDrawingMode(G4int drawingMode)
}
}
const std::map<G4String,G4AttDef>* G4TrajectoriesModel::GetAttDefs() const
{
G4bool isNew;
std::map<G4String,G4AttDef>* store
= G4AttDefStore::GetInstance("G4TrajectoriesModel", isNew);
if (isNew) {
(*store)["EventID"] =
G4AttDef("EventID","Event ID","Physics","","G4int");
}
return store;
}
std::vector<G4AttValue>* G4TrajectoriesModel::CreateCurrentAttValues() const
{
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
values->push_back
(G4AttValue("EventID",G4UIcommand::ConvertToString(fEventID),""));
return values;
}
// Debug material...
#include "G4VTrajectoryPoint.hh"
void G4TrajectoriesModelDebugG4AttValues(const G4VTrajectory* pTraj)
{
std::vector<G4AttValue>* attValues = pTraj->CreateAttValues();
if (attValues) {
G4AttCheck attCheck(attValues, pTraj->GetAttDefs());
G4cout << "\nProvided G4Atts:\n" << attCheck;
if (attCheck.Check()) G4cout << "Error" << G4endl;
else {
std::vector<G4AttValue> standardValues;
std::map<G4String,G4AttDef> standardDefinitions;
attCheck.Standard(&standardValues, &standardDefinitions);
G4cout << "\nStandard G4Atts:\n"
<< G4AttCheck(&standardValues, &standardDefinitions);
// Trajectory attributes
{ // Scope bracket - allows re-use of names without compiler warnings.
std::vector<G4AttValue>* attValues = pTraj->CreateAttValues();
if (attValues) {
G4AttCheck attCheck(attValues, pTraj->GetAttDefs());
G4cout << "\nProvided G4Atts:\n" << attCheck;
if (attCheck.Check()) G4cout << "Error" << G4endl;
else {
std::vector<G4AttValue> standardValues;
std::map<G4String,G4AttDef> standardDefinitions;
attCheck.Standard(&standardValues, &standardDefinitions);
G4cout << "\nStandard G4Atts:\n"
<< G4AttCheck(&standardValues, &standardDefinitions);
}
delete attValues;
}
delete attValues;
}
// Trajectory point attributes
for (G4int i = 0; i < pTraj->GetPointEntries(); i++) {
G4VTrajectoryPoint* aPoint = pTraj->GetPoint(i);
std::vector<G4AttValue>* attValues = aPoint->CreateAttValues();
@@ -151,5 +190,5 @@ void G4TrajectoriesModelDebugG4AttValues(const G4VTrajectory* pTraj)
}
delete attValues;
}
}
}
}
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryChargeFilter.cc,v 1.4 2006-08-25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Filter trajectories according to charge. Only registered
// charges will pass the filter.
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawByAttribute.cc,v 1.6 2010-12-11 16:41:11 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Jane Tinslay August 2006
//
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawByCharge.cc,v 1.10 2010-05-28 02:00:59 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
#include "G4TrajectoryDrawByCharge.hh"
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawByOriginVolume.cc,v 1.6 2010-05-28 02:00:59 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Jane Tinslay March 2006
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawByParticleID.cc,v 1.11 2010-06-01 21:17:41 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawerUtils.cc,v 1.16 2010-12-11 16:40:16 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -66,9 +65,9 @@ namespace G4TrajectoryDrawerUtils {
// Keep positions. Don't store unless first or different.
std::vector<G4ThreeVector> positions;
for (G4int i=0; i<traj.GetPointEntries(); i++) {
for (G4int iPoint=0; iPoint<traj.GetPointEntries(); iPoint++) {
G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i);
G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(iPoint);
const G4ThreeVector& trajectoryPointPosition =
aTrajectoryPoint->GetPosition();
@@ -139,7 +138,6 @@ namespace G4TrajectoryDrawerUtils {
auxiliaryPoints.push_back(auxPointPosition);
if (validity == ValidTimes) {
// Interpolate time for auxiliary points...
const G4ThreeVector& auxPointPosition = (*auxiliaries)[iAux];
G4double s1 =
(auxPointPosition - lastTrajectoryPointPosition).mag();
G4double s2 =
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryGenericDrawer.cc,v 1.3 2010-05-11 11:31:31 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Jane Tinslay May 2006
//
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryModelFactories.cc,v 1.7 2006-09-12 18:53:03 tinslay Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Jane Tinslay, John Allison, Joseph Perl October 2005
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryOriginVolumeFilter.cc,v 1.3 2006-08-25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Filter trajectories according to volume name. Only registered
// volumes will pass the filter.
@@ -59,9 +58,10 @@ G4TrajectoryOriginVolumeFilter::Evaluate(const G4VTrajectory& traj) const
G4String logicalName = logicalVolume->GetName();
G4String physicalName = volume->GetName();
if (GetVerbose()) G4cout<<"G4TrajectoryOriginVolumeFilter processing trajectory with originating volume "<<G4endl;
G4cout<<"logical and physical names: "<<logicalName<<" "<<physicalName<<G4endl;
if (GetVerbose()) {
G4cout<<"G4TrajectoryOriginVolumeFilter processing trajectory with originating volume "<<G4endl;
G4cout<<"logical and physical names: "<<logicalName<<" "<<physicalName<<G4endl;
}
// Search for logical volume name
std::vector<G4String>::const_iterator iterLogical = std::find(fVolumes.begin(), fVolumes.end(), logicalName);
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryParticleFilter.cc,v 1.3 2006-08-25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Filter trajectories according to particle type. Only registered
// particle types will pass the filter.
@@ -24,8 +24,7 @@
// ********************************************************************
//
//
// $Id: G4VModel.cc,v 1.14 2006-11-01 10:33:00 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
//
// John Allison 31st December 1997.
@@ -38,6 +37,7 @@
G4VModel::G4VModel (const G4Transform3D& modelTransformation,
const G4ModelingParameters* pMP):
fType ("Other"),
fGlobalTag ("Empty"),
fGlobalDescription ("Empty"),
fTransform (modelTransformation),
@@ -60,22 +60,22 @@ G4bool G4VModel::Validate (G4bool) {
return true;
}
std::ostream& operator << (std::ostream& os, const G4VModel& m) {
os << m.fGlobalDescription;
std::ostream& operator << (std::ostream& os, const G4VModel& model) {
os << model.fGlobalDescription;
os << "\n Modeling parameters:";
const G4ModelingParameters* mp = m.fpMP;
const G4ModelingParameters* mp = model.fpMP;
if (mp) os << "\n " << *mp;
else os << " none.";
os << "\n Extent: " << m.fExtent;
os << "\n Extent: " << model.fExtent;
os << "\n Transformation: ";
os << "\n Rotation: ";
G4RotationMatrix rotation = m.fTransform.getRotation ();
G4RotationMatrix rotation = model.fTransform.getRotation ();
os << rotation.thetaX() << ", "
<< rotation.phiX() << ", "
<< rotation.thetaY() << ", "
<< rotation.phiY() << ", "
<< rotation.thetaZ() << ", "
<< rotation.phiZ();
os << "\n Translation: " << m.fTransform.getTranslation ();
os << "\n Translation: " << model.fTransform.getTranslation ();
return os;
}
@@ -23,8 +23,7 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4VTrajectoryModel.cc,v 1.3 2006-06-29 21:33:26 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
// $Id$
//
// Jane Tinslay May 2006
//