Import Geant4 8.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:55:03 +02:00
parent 216a75eeb1
commit fe73f43734
6714 changed files with 118229 additions and 68144 deletions
@@ -0,0 +1,95 @@
//
// ********************************************************************
// * 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: G4AttFilterUtils.cc,v 1.4 2006/12/13 15:50:06 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Visualisation attribute filter utility functions.
//
// Jane Tinslay, September 2006
//
#include "G4AttFilterUtils.hh"
#include "G4AttDef.hh"
#include "G4AttUtils.hh"
#include "G4AttValueFilterT.hh"
#include "G4CreatorFactoryT.hh"
#include "G4DimensionedDouble.hh"
#include "G4DimensionedThreeVector.hh"
#include "G4String.hh"
#include "G4ThreeVector.hh"
#include "G4TypeKey.hh"
#include "G4TypeKeyT.hh"
#include <assert.h>
namespace G4AttFilterUtils {
namespace {
template <typename T>
G4VAttValueFilter* newFilter() {
return new G4AttValueFilterT<T>;
}
}
// Create new G4AttValue filter factory
G4AttValueFilterFactory* GetAttValueFilterFactory() {
static G4AttValueFilterFactory* factory = new G4AttValueFilterFactory;
static G4bool init(false);
if (!init) {
// Register typekey<->creator pairs
factory->Register(G4TypeKeyT<G4String>(), newFilter<G4String>);
factory->Register(G4TypeKeyT<G4int>(), newFilter<G4int>);
factory->Register(G4TypeKeyT<G4double>(), newFilter<G4double>);
factory->Register(G4TypeKeyT<G4ThreeVector>(), newFilter<G4ThreeVector>);
factory->Register(G4TypeKeyT<G4bool>(), newFilter<G4bool>);
factory->Register(G4TypeKeyT<G4DimensionedDouble>(), newFilter<G4DimensionedDouble>);
factory->Register(G4TypeKeyT<G4DimensionedThreeVector>(), newFilter<G4DimensionedThreeVector>);
init = true;
}
return factory;
}
G4VAttValueFilter* GetNewFilter(const G4AttDef& def) {
G4TypeKey myKey = def.GetTypeKey();
// Get correct type key if original G4AttDef's being used
if (!myKey.IsValid()) {
myKey = G4AttUtils::GetKey(def);
}
// Should be valid now
assert(myKey.IsValid());
G4AttValueFilterFactory* factory = GetAttValueFilterFactory();
G4VAttValueFilter* filter = factory->Create(myKey);
assert (0 != filter);
return filter;
}
}
@@ -25,7 +25,7 @@
//
//
// $Id: G4AxesModel.cc,v 1.6 2006/06/29 21:32:38 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 3rd April 2001
@@ -25,7 +25,7 @@
//
//
// $Id: G4BoundingSphereScene.cc,v 1.11 2006/06/29 21:32:40 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 7th June 1997
@@ -25,7 +25,7 @@
//
//
// $Id: G4FlavoredParallelWorldModel.cc,v 1.7 2006/06/29 21:32:42 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// P. Mora de Freitas et M.Verderi - 19 June 1998.
// Model for flavored parallel world volumes.
@@ -0,0 +1,66 @@
//
// ********************************************************************
// * 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: G4HitFilterFactories.cc,v 1.1 2006/09/12 18:53:03 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// Trajectory filter model factories creating filters
// and associated messengers.
//
// Jane Tinslay March 2006
//
#include "G4ModelCommandsT.hh"
#include "G4HitFilterFactories.hh"
#include "G4AttributeFilterT.hh"
// Attribute filter
G4HitAttributeFilterFactory::G4HitAttributeFilterFactory()
:G4VModelFactory< G4VFilter<G4VHit> >("attributeFilter")
{}
G4HitAttributeFilterFactory::~G4HitAttributeFilterFactory() {}
G4HitAttributeFilterFactory::ModelAndMessengers
G4HitAttributeFilterFactory::Create(const G4String& placement, const G4String& name)
{
typedef G4AttributeFilterT<G4VHit> G4HitAttributeFilter;
// Create model
G4HitAttributeFilter* model = new G4HitAttributeFilter(name);
// Create associated messengers
Messengers messengers;
messengers.push_back(new G4ModelCmdSetString<G4HitAttributeFilter>(model, placement, "setAttribute"));
messengers.push_back(new G4ModelCmdInvert<G4HitAttributeFilter>(model, placement));
messengers.push_back(new G4ModelCmdActive<G4HitAttributeFilter>(model, placement));
messengers.push_back(new G4ModelCmdVerbose<G4HitAttributeFilter>(model, placement));
messengers.push_back(new G4ModelCmdReset<G4HitAttributeFilter>(model, placement));
messengers.push_back(new G4ModelCmdAddInterval<G4HitAttributeFilter>(model, placement, "addInterval"));
messengers.push_back(new G4ModelCmdAddValue<G4HitAttributeFilter>(model, placement, "addValue"));
return ModelAndMessengers(model, messengers);
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4HitsModel.cc,v 1.15 2006/06/29 21:32:44 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4HitsModel.cc,v 1.18 2006/11/14 14:42:08 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 26th August 1998.
@@ -33,20 +33,22 @@
#include "G4HitsModel.hh"
#include "G4ModelingParameters.hh"
#include "G4VGraphicsScene.hh"
#include "G4EventManager.hh"
#include "G4Event.hh"
G4HitsModel::~G4HitsModel () {}
G4HitsModel::G4HitsModel () {
G4HitsModel::G4HitsModel ():
fpCurrentHit(0)
{
fGlobalTag = "G4HitsModel for all hits.";
fGlobalDescription = fGlobalTag;
}
void G4HitsModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
const G4Event* event =
G4EventManager::GetEventManager()->GetConstCurrentEvent();
void G4HitsModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler)
{
const G4Event* event = fpMP->GetEvent();
if (event) {
G4HCofThisEvent* HCE = event -> GetHCofThisEvent ();
if (HCE) {
@@ -55,8 +57,8 @@ void G4HitsModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
G4VHitsCollection* HC = HCE -> GetHC (iHC);
if (HC) {
for(size_t iHit = 0; iHit < HC->GetSize(); ++iHit) {
G4VHit* hit = HC -> GetHit (iHit);
sceneHandler.AddCompound (*hit);
fpCurrentHit = HC -> GetHit (iHit);
if (fpCurrentHit) sceneHandler.AddCompound (*fpCurrentHit);
}
}
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeModel.cc,v 1.13 2006/06/29 21:32:46 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4LogicalVolumeModel.cc,v 1.14 2006/11/01 10:28:42 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 26th July 1999.
@@ -79,10 +79,6 @@ G4LogicalVolumeModel::G4LogicalVolumeModel
G4LogicalVolumeModel::~G4LogicalVolumeModel () {}
G4String G4LogicalVolumeModel::GetCurrentDescription () const {
return "G4LogicalVolumeModel " + GetCurrentTag ();
}
void G4LogicalVolumeModel::DescribeYourselfTo
(G4VGraphicsScene& sceneHandler) {
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.cc,v 1.10 2006/06/29 21:32:48 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4ModelingParameters.cc,v 1.15 2006/11/14 14:42:08 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 31st December 1997.
@@ -36,77 +36,27 @@
#include "G4ios.hh"
#include "G4VisAttributes.hh"
#include "G4ExceptionSeverity.hh"
#include "G4Polyhedron.hh"
G4ModelingParameters::G4ModelingParameters ():
fWarning (true),
fpDefaultVisAttributes (0),
fDrawingStyle (wf),
fRepStyle (polyhedron),
fCulling (false),
fCullInvisible (false),
fDensityCulling (false),
fVisibleDensity (0.01 * g / cm3),
fCullCovered (false),
fExplodeFactor (1.),
fNoOfSides (24),
fViewGeom (true),
fViewHits (true),
fViewDigis (true)
fpSectionPolyhedron (0),
fpCutawayPolyhedron (0),
fpEvent (0)
{}
G4ModelingParameters::G4ModelingParameters
(const G4VisAttributes* pDefaultVisAttributes,
G4ModelingParameters::RepStyle repStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides
):
fpDefaultVisAttributes (pDefaultVisAttributes),
fDrawingStyle (wf),
fRepStyle (repStyle),
fCulling (isCulling),
fCullInvisible (isCullingInvisible),
fDensityCulling (isDensityCulling),
fVisibleDensity (visibleDensity),
fCullCovered (isCullingCovered),
fNoOfSides (noOfSides),
fViewGeom (true),
fViewHits (true),
fViewDigis (true)
{}
G4ModelingParameters::G4ModelingParameters
(const G4VisAttributes* pDefaultVisAttributes,
G4ModelingParameters::RepStyle repStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides,
G4bool isViewGeom,
G4bool isViewHits,
G4bool isViewDigis
):
fpDefaultVisAttributes (pDefaultVisAttributes),
fDrawingStyle (wf),
fRepStyle (repStyle),
fCulling (isCulling),
fCullInvisible (isCullingInvisible),
fDensityCulling (isDensityCulling),
fVisibleDensity (visibleDensity),
fCullCovered (isCullingCovered),
fNoOfSides (noOfSides),
fViewGeom (isViewGeom),
fViewHits (isViewHits),
fViewDigis (isViewDigis)
{}
G4ModelingParameters::G4ModelingParameters
(const G4VisAttributes* pDefaultVisAttributes,
G4ModelingParameters::DrawingStyle drawingStyle,
G4ModelingParameters::RepStyle repStyle,
G4ModelingParameters::DrawingStyle drawingStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
@@ -114,58 +64,35 @@ G4ModelingParameters::G4ModelingParameters
G4bool isCullingCovered,
G4int noOfSides
):
fWarning (true),
fpDefaultVisAttributes (pDefaultVisAttributes),
fDrawingStyle (drawingStyle),
fRepStyle (repStyle),
fCulling (isCulling),
fCullInvisible (isCullingInvisible),
fDensityCulling (isDensityCulling),
fVisibleDensity (visibleDensity),
fCullCovered (isCullingCovered),
fExplodeFactor (1.),
fNoOfSides (noOfSides),
fViewGeom (true),
fViewHits (true),
fViewDigis (true)
fpSectionPolyhedron (0),
fpCutawayPolyhedron (0),
fpEvent (0)
{}
G4ModelingParameters::G4ModelingParameters
(const G4VisAttributes* pDefaultVisAttributes,
G4ModelingParameters::DrawingStyle drawingStyle,
G4ModelingParameters::RepStyle repStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides,
G4bool isViewGeom,
G4bool isViewHits,
G4bool isViewDigis
):
fpDefaultVisAttributes (pDefaultVisAttributes),
fDrawingStyle (drawingStyle),
fRepStyle (repStyle),
fCulling (isCulling),
fCullInvisible (isCullingInvisible),
fDensityCulling (isDensityCulling),
fVisibleDensity (visibleDensity),
fCullCovered (isCullingCovered),
fNoOfSides (noOfSides),
fViewGeom (isViewGeom),
fViewHits (isViewHits),
fViewDigis (isViewDigis)
{}
G4ModelingParameters::~G4ModelingParameters () {}
G4ModelingParameters::~G4ModelingParameters ()
{
delete fpSectionPolyhedron;
delete fpCutawayPolyhedron;
}
void G4ModelingParameters::SetVisibleDensity (G4double visibleDensity) {
const G4double reasonableMaximum = 10.0 * g / cm3;
if (visibleDensity < 0) {
if (visibleDensity < 0 && fWarning) {
G4cout << "G4ModelingParameters::SetVisibleDensity: attempt to set negative "
"density - ignored." << G4endl;
}
else {
if (fVisibleDensity > reasonableMaximum) {
if (fVisibleDensity > reasonableMaximum && fWarning) {
G4cout << "G4ModelingParameters::SetVisibleDensity: density > "
<< reasonableMaximum
<< " g / cm3 - did you mean this?"
@@ -179,35 +106,21 @@ G4int G4ModelingParameters::SetNoOfSides (G4int nSides) {
const G4int nSidesMin = 12;
if (nSides < nSidesMin) {
nSides = nSidesMin;
G4cout << "G4ModelingParameters::SetNoOfSides: attempt to set the"
"\nnumber of sides per circle < " << nSidesMin
<< "; forced to" << nSides << G4endl;
if (fWarning)
G4cout << "G4ModelingParameters::SetNoOfSides: attempt to set the"
"\nnumber of sides per circle < " << nSidesMin
<< "; forced to" << nSides << G4endl;
}
fNoOfSides = nSides;
return fNoOfSides;
}
void G4ModelingParameters::PrintDifferences
(const G4ModelingParameters& that) const {
if (
(fpDefaultVisAttributes != that.fpDefaultVisAttributes) ||
(fDrawingStyle != that.fDrawingStyle) ||
(fRepStyle != that.fRepStyle) ||
(fCulling != that.fCulling) ||
(fCullInvisible != that.fCullInvisible) ||
(fDensityCulling != that.fDensityCulling) ||
(fVisibleDensity != that.fVisibleDensity) ||
(fCullCovered != that.fCullCovered) ||
(fNoOfSides != that.fNoOfSides) ||
(fViewGeom != that.fViewGeom) ||
(fViewHits != that.fViewHits) ||
(fViewDigis != that.fViewDigis))
G4cout << "Difference in 1st batch." << G4endl;
}
std::ostream& operator << (std::ostream& os, const G4ModelingParameters& mp) {
os << "Modeling parameters and options:";
std::ostream& operator << (std::ostream& os, const G4ModelingParameters& mp)
{
os << "Modeling parameters (warning ";
if (mp.fWarning) os << "true";
else os << "false";
os << "):";
const G4VisAttributes* va = mp.fpDefaultVisAttributes;
os << "\n Default vis. attributes: ";
@@ -227,17 +140,6 @@ std::ostream& operator << (std::ostream& os, const G4ModelingParameters& mp) {
default: os << "unrecognised"; break;
}
os << "\n Representation style for graphics reps, if needed: ";
switch (mp.fRepStyle) {
case G4ModelingParameters::wireframe:
os << "wireframe"; break;
case G4ModelingParameters::polyhedron:
os << "polyhedron"; break;
case G4ModelingParameters::nurbs:
os << "nurbs"; break;
default: os << "unrecognised"; break;
}
os << "\n Culling: ";
if (mp.fCulling) os << "on";
else os << "off";
@@ -257,20 +159,21 @@ std::ostream& operator << (std::ostream& os, const G4ModelingParameters& mp) {
if (mp.fCullCovered) os << "on";
else os << "off";
os << "\n Explode factor: " << mp.fExplodeFactor
<< " about centre: " << mp.fExplodeCentre;
os << "\n No. of sides used in circle polygon approximation: "
<< mp.fNoOfSides;
os << "\n View geometry: ";
if (mp.fViewGeom) os << "true";
else os << "false";
os << "\n Section (DCUT) polyhedron pointer: ";
if (!mp.fpSectionPolyhedron) os << "non-";
os << "null";
os << "\n View hits : ";
if (mp.fViewHits) os << "true";
else os << "false";
os << "\n Cutaway (DCUT) polyhedron pointer: ";
if (!mp.fpCutawayPolyhedron) os << "non-";
os << "null";
os << "\n View digits : ";
if (mp.fViewDigis) os << "true";
else os << "false";
os << "\n Event pointer: " << mp.fpEvent;
return os;
}
@@ -279,17 +182,19 @@ G4bool G4ModelingParameters::operator !=
(const G4ModelingParameters& mp) const {
if (
(fWarning != mp.fWarning) ||
(*fpDefaultVisAttributes != *mp.fpDefaultVisAttributes) ||
(fDrawingStyle != mp.fDrawingStyle) ||
(fRepStyle != mp.fRepStyle) ||
(fCulling != mp.fCulling) ||
(fCullInvisible != mp.fCullInvisible) ||
(fDensityCulling != mp.fDensityCulling) ||
(fCullCovered != mp.fCullCovered) ||
(fExplodeFactor != mp.fExplodeFactor) ||
(fExplodeCentre != mp.fExplodeCentre) ||
(fNoOfSides != mp.fNoOfSides) ||
(fViewGeom != mp.fViewGeom) ||
(fViewHits != mp.fViewHits) ||
(fViewDigis != mp.fViewDigis))
(fpSectionPolyhedron != mp.fpSectionPolyhedron) ||
(fpCutawayPolyhedron != mp.fpCutawayPolyhedron) ||
(fpEvent != mp.fpEvent)
)
return true;
if (fDensityCulling &&
@@ -25,7 +25,7 @@
//
//
// $Id: G4NullModel.cc,v 1.9 2006/06/29 21:32:50 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 4th April 1998.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeMassScene.cc,v 1.6 2006/06/29 21:32:52 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4PhysicalVolumeMassScene.cc,v 1.7 2006/11/06 09:24:13 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 10th August 1998.
@@ -82,18 +82,7 @@ void G4PhysicalVolumeMassScene::AccrueMass (const G4VSolid& solid)
G4double currentDensity = pCurrentMaterial->GetDensity();
/* Using G4Polyhedron... (gives slightly different answers on Tubs, e.g.).
G4Polyhedron* pPolyhedron = solid.GetPolyhedron();
if (pPolyhedron) {
G4Material* pMaterial;
G4VPVParameterisation* pP = pCurrentPV->GetParameterisation();
if (pP) {
pMaterial = pP -> ComputeMaterial (fPVPCount++, pCurrentPV);
} else {
pMaterial = pCurrentLV->GetMaterial();
}
assert(pMaterial == pCurrentMaterial);
currentVolume = pPolyhedron->GetVolume();
currentDensity = pMaterial->GetDensity();
} else {
if (!pPolyhedron) {
G4cout <<
"G4PhysicalVolumeMassScene::AccrueMass: WARNING:"
"\n No G4Polyhedron for" << solid.GetEntityType() <<
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.cc,v 1.47 2006/06/29 21:32:54 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4PhysicalVolumeModel.cc,v 1.57 2006/11/16 12:11:30 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 31st December 1997.
@@ -45,6 +45,10 @@
#include "G4PhysicalVolumeSearchScene.hh"
#include "G4TransportationManager.hh"
#include "G4Polyhedron.hh"
#include "G4AttDefStore.hh"
#include "G4AttDef.hh"
#include "G4AttValue.hh"
#include "G4UnitsTable.hh"
#include <sstream>
@@ -52,23 +56,22 @@ G4bool G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::operator<
(const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID& right) const
{
if (fpPV < right.fpPV) return true;
if (fpPV == right.fpPV) return fCopyNo < right.fCopyNo;
if (fpPV == right.fpPV) {
if (fCopyNo < right.fCopyNo) return true;
if (fCopyNo == right.fCopyNo)
return fNonCulledDepth < right.fNonCulledDepth;
}
return false;
}
G4bool G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::operator==
(const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID& right) const
{
return fpPV == right.fpPV && fCopyNo == right.fCopyNo;
}
std::ostream& operator<<
(std::ostream& os, const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID node)
{
G4VPhysicalVolume* pPV = node.GetPhysicalVolume();
if (pPV) {
os << pPV->GetName() << ':'
<< node.GetCopyNo();
os << pPV->GetName()
<< ':' << node.GetCopyNo()
<< '[' << node.GetNonCulledDepth() << ']';
} else {
os << "Null node";
}
@@ -93,11 +96,7 @@ G4PhysicalVolumeModel::G4PhysicalVolumeModel
fpCurrentMaterial (0),
fCurtailDescent (false),
fpClippingPolyhedron (0),
fpCurrentDepth (0),
fppCurrentPV (0),
fppCurrentLV (0),
fppCurrentMaterial (0),
fpDrawnPVPath (0)
fClippingMode (subtraction)
{
std::ostringstream o;
o << fpTopPV -> GetCopyNo ();
@@ -107,7 +106,10 @@ G4PhysicalVolumeModel::G4PhysicalVolumeModel
CalculateExtent ();
}
G4PhysicalVolumeModel::~G4PhysicalVolumeModel () {}
G4PhysicalVolumeModel::~G4PhysicalVolumeModel ()
{
delete fpClippingPolyhedron;
}
void G4PhysicalVolumeModel::CalculateExtent ()
{
@@ -121,16 +123,13 @@ void G4PhysicalVolumeModel::CalculateExtent ()
const G4ModelingParameters* tempMP = fpMP;
G4ModelingParameters mParams
(0, // No default vis attributes needed.
G4ModelingParameters::wireframe,
G4ModelingParameters::wf, // wireframe (not relevant for this).
true, // Global culling.
true, // Cull invisible volumes.
false, // Density culling.
0., // Density (not relevant if density culling false).
true, // Cull daughters of opaque mothers.
24, // No of sides (not relevant for this operation).
true, // View geometry.
false, // View hits - not relevant for physical volume model.
false); // View digis - not relevant for physical volume model.
24); // No of sides (not relevant for this operation).
fpMP = &mParams;
DescribeYourselfTo (bsScene);
G4double radius = bsScene.GetRadius();
@@ -157,13 +156,8 @@ void G4PhysicalVolumeModel::DescribeYourselfTo
if (!fpMP) G4Exception
("G4PhysicalVolumeModel::DescribeYourselfTo: No modeling parameters.");
sceneHandler.EstablishSpecials (*this);
// See .hh file for explanation of this mechanism.
// For safety...
fCurrentDepth = 0;
// ...and in working space in scene handler, if required...
if (fpCurrentDepth) *fpCurrentDepth = 0;
G4Transform3D startingTransformation = fTransform;
@@ -179,21 +173,6 @@ void G4PhysicalVolumeModel::DescribeYourselfTo
fpCurrentLV = 0;
fpCurrentMaterial = 0;
fDrawnPVPath.clear();
// ...and in working space in scene handler, if required...
if (fpCurrentDepth) *fpCurrentDepth = 0;
if (fppCurrentPV) *fppCurrentPV = 0;
if (fppCurrentLV) *fppCurrentLV = 0;
if (fppCurrentMaterial) *fppCurrentMaterial = 0;
if (fpDrawnPVPath) fpDrawnPVPath->clear();
sceneHandler.DecommissionSpecials (*this);
// Clear pointers to working space.
fpCurrentDepth = 0;
fppCurrentPV = 0;
fppCurrentLV = 0;
fppCurrentMaterial = 0;
fpDrawnPVPath = 0;
}
G4String G4PhysicalVolumeModel::GetCurrentTag () const
@@ -213,20 +192,6 @@ G4String G4PhysicalVolumeModel::GetCurrentDescription () const
return "G4PhysicalVolumeModel " + GetCurrentTag ();
}
void G4PhysicalVolumeModel::DefinePointersToWorkingSpace
(G4int* pCurrentDepth,
G4VPhysicalVolume** ppCurrentPV,
G4LogicalVolume** ppCurrentLV,
G4Material** ppCurrentMaterial,
std::vector<G4PhysicalVolumeNodeID>* pDrawnPVPath)
{
fpCurrentDepth = pCurrentDepth;
fppCurrentPV = ppCurrentPV;
fppCurrentLV = ppCurrentLV;
fppCurrentMaterial = ppCurrentMaterial;
fpDrawnPVPath = pDrawnPVPath;
}
void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
(G4VPhysicalVolume* pVPV,
G4int requestedDepth,
@@ -325,14 +290,15 @@ void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
((G4Tubs*)pSol)->SetInnerRadius(width*n+offset);
((G4Tubs*)pSol)->SetOuterRadius(width*(n+1)+offset);
} else {
G4cout <<
"G4PhysicalVolumeModel::VisitGeometryAndGetVisReps: WARNING:"
"\n built-in replicated volumes replicated in radius for "
<< pSol->GetEntityType() <<
"-type\n solids (your solid \""
<< pSol->GetName() <<
"\") are not visualisable."
<< G4endl;
if (fpMP->IsWarning())
G4cout <<
"G4PhysicalVolumeModel::VisitGeometryAndGetVisReps: WARNING:"
"\n built-in replicated volumes replicated in radius for "
<< pSol->GetEntityType() <<
"-type\n solids (your solid \""
<< pSol->GetName() <<
"\") are not visualisable."
<< G4endl;
visualisable = false;
}
break;
@@ -377,11 +343,6 @@ void G4PhysicalVolumeModel::DescribeAndDescend
fpCurrentPV = pVPV;
fpCurrentLV = pLV;
fpCurrentMaterial = pMaterial;
// ...and store in scene handler's working space, if required...
if (fpCurrentDepth) *fpCurrentDepth = fCurrentDepth;
if (fppCurrentPV) *fppCurrentPV = pVPV;
if (fppCurrentLV) *fppCurrentLV = pLV;
if (fppCurrentMaterial) *fppCurrentMaterial = pMaterial;
const G4RotationMatrix objectRotation = pVPV -> GetObjectRotationValue ();
const G4ThreeVector& translation = pVPV -> GetTranslation ();
@@ -433,15 +394,17 @@ void G4PhysicalVolumeModel::DescribeAndDescend
visAttsCreated = true;
}
// From here, can assume pVisAttribs is a valid pointer.
G4bool thisToBeDrawn = true;
// There are various reasons why this volume
// might not be drawn...
G4bool culling = fpMP->IsCulling();
G4bool cullingInvisible = fpMP->IsCullingInvisible();
G4bool markedVisible = pVisAttribs? pVisAttribs->IsVisible(): true;
G4bool markedVisible = pVisAttribs->IsVisible();
G4bool cullingLowDensity = fpMP->IsDensityCulling();
G4double density = pMaterial->GetDensity();
G4double density = pMaterial? pMaterial->GetDensity(): 0;
G4double densityCut = fpMP -> GetVisibleDensity ();
// 1) Global culling is on....
@@ -460,14 +423,29 @@ void G4PhysicalVolumeModel::DescribeAndDescend
if (thisToBeDrawn) {
// Update path of physical volumes, if required...
// Update path of drawn physical volumes...
G4int copyNo = fpCurrentPV->GetCopyNo();
fDrawnPVPath.push_back(G4PhysicalVolumeNodeID(fpCurrentPV,copyNo));
if (fpDrawnPVPath) {
fpDrawnPVPath->push_back(G4PhysicalVolumeNodeID(fpCurrentPV,copyNo));
fDrawnPVPath.push_back
(G4PhysicalVolumeNodeID(fpCurrentPV,copyNo,fCurrentDepth));
if (fpMP->IsExplode() && fDrawnPVPath.size() == 1) {
// 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);
G4double explodeFactor = fpMP->GetExplodeFactor();
G4Translate3D newTranslation =
G4Translate3D(explodeFactor * translation.dx(),
explodeFactor * translation.dy(),
explodeFactor * translation.dz());
theNewAT = centering * newTranslation * rotation * scale;
}
DescribeSolid (theNewAT, pSol, pVisAttribs, sceneHandler);
}
// Make decision to draw daughters, if any. There are various
@@ -487,8 +465,7 @@ void G4PhysicalVolumeModel::DescribeAndDescend
else {
G4bool culling = fpMP->IsCulling();
G4bool cullingInvisible = fpMP->IsCullingInvisible();
G4bool daughtersInvisible =
pVisAttribs? pVisAttribs->IsDaughtersInvisible(): false;
G4bool daughtersInvisible = pVisAttribs->IsDaughtersInvisible();
// Culling of covered daughters request. This is computed in
// G4VSceneHandler::CreateModelingParameters() depending on view
// parameters...
@@ -496,15 +473,14 @@ void G4PhysicalVolumeModel::DescribeAndDescend
G4bool surfaceDrawing =
fpMP->GetDrawingStyle() == G4ModelingParameters::hsr ||
fpMP->GetDrawingStyle() == G4ModelingParameters::hlhsr;
if (pVisAttribs && pVisAttribs->IsForceDrawingStyle()) {
if (pVisAttribs->IsForceDrawingStyle()) {
switch (pVisAttribs->GetForcedDrawingStyle()) {
default:
case G4VisAttributes::wireframe: surfaceDrawing = false; break;
case G4VisAttributes::solid: surfaceDrawing = true; break;
}
}
G4bool opaque =
pVisAttribs? pVisAttribs->GetColour().GetAlpha() >= 1.: false;
G4bool opaque = pVisAttribs->GetColour().GetAlpha() >= 1.;
// 4) Global culling is on....
if (culling) {
// 5) ..and culling of invisible volumes is on...
@@ -543,12 +519,9 @@ void G4PhysicalVolumeModel::DescribeAndDescend
// Reset for normal descending of next volume at this level...
fCurtailDescent = false;
// Pop item from path of physical volumes...
// Pop item from path of drawn physical volumes...
if (thisToBeDrawn) {
fDrawnPVPath.pop_back();
if (fpDrawnPVPath) {
fpDrawnPVPath->pop_back();
}
}
}
@@ -559,39 +532,90 @@ void G4PhysicalVolumeModel::DescribeSolid
G4VGraphicsScene& sceneHandler)
{
sceneHandler.PreAddSolid (theAT, *pVisAttribs);
if (fpClippingPolyhedron) // Clip and force polyhedral representation...
{
G4Polyhedron clipper(*fpClippingPolyhedron); // Local copy.
clipper.Transform(theAT.inverse());
G4Polyhedron::SetNumberOfRotationSteps (fpMP->GetNoOfSides());
G4Polyhedron* pClippee = pSol->GetPolyhedron();
G4Polyhedron::ResetNumberOfRotationSteps ();
if (pClippee) // Solid can provide.
{
G4Polyhedron clipped(pClippee->subtract(clipper));
if(clipped.IsErrorBooleanProcess())
{
G4cout <<
"WARNING: G4PhysicalVolumeModel::DescribeSolid: polyhedron for solid\n \""
<< pSol->GetName() <<
"\" skipped due to error during Boolean processing."
<< G4endl;
}
else
{
clipped.SetVisAttributes(pVisAttribs);
sceneHandler.BeginPrimitives(theAT);
sceneHandler.AddPrimitive(clipped);
sceneHandler.EndPrimitives();
}
const G4Polyhedron* pSectionPolyhedron = fpMP->GetSectionPolyhedron();
const G4Polyhedron* pCutawayPolyhedron = fpMP->GetCutawayPolyhedron();
if (!fpClippingPolyhedron && !pSectionPolyhedron && !pCutawayPolyhedron) {
pSol -> DescribeYourselfTo (sceneHandler); // Standard treatment.
} else {
// Clipping, etc., performed by Boolean operations on polyhedron objects.
// First, get polyhedron for current solid...
G4Polyhedron::SetNumberOfRotationSteps (fpMP->GetNoOfSides());
G4Polyhedron* pOriginal = pSol->GetPolyhedron();
G4Polyhedron::ResetNumberOfRotationSteps ();
if (!pOriginal) {
if (fpMP->IsWarning())
G4cout <<
"WARNING: G4PhysicalVolumeModel::DescribeSolid: solid\n \""
<< pSol->GetName() <<
"\" has no polyhedron. Cannot by clipped."
<< G4endl;
pSol -> DescribeYourselfTo (sceneHandler); // Standard treatment.
} else {
G4Polyhedron resultant = *pOriginal;
if (fpClippingPolyhedron) {
G4Polyhedron clipper = *fpClippingPolyhedron; // Local copy.
clipper.Transform(theAT.inverse());
switch (fClippingMode) {
default:
case subtraction: resultant = resultant.subtract(clipper); break;
case intersection: resultant = resultant.intersect(clipper); break;
}
if(resultant.IsErrorBooleanProcess()) {
if (fpMP->IsWarning())
G4cout <<
"WARNING: G4PhysicalVolumeModel::DescribeSolid: clipped polyhedron for"
"\n solid \"" << pSol->GetName() <<
"\" not defined due to error during Boolean processing."
<< G4endl;
// Nevertheless, keep resultant.
}
}
if (pSectionPolyhedron) {
G4Polyhedron sectioner = *pSectionPolyhedron; // Local copy.
sectioner.Transform(theAT.inverse());
resultant = resultant.intersect(sectioner);
if(resultant.IsErrorBooleanProcess()) {
if (fpMP->IsWarning())
G4cout <<
"WARNING: G4PhysicalVolumeModel::DescribeSolid: sectioned polyhedron for"
"\n solid \"" << pSol->GetName() <<
"\" not defined due to error during Boolean processing."
<< G4endl;
// Nevertheless, keep resultant.
}
}
if (pCutawayPolyhedron) {
G4Polyhedron cutter = *pCutawayPolyhedron; // Local copy.
cutter.Transform(theAT.inverse());
resultant = resultant.subtract(cutter);
if(resultant.IsErrorBooleanProcess()) {
if (fpMP->IsWarning())
G4cout <<
"WARNING: G4PhysicalVolumeModel::DescribeSolid: cutaway polyhedron for"
"\n solid \"" << pSol->GetName() <<
"\" not defined due to error during Boolean processing."
<< G4endl;
// Nevertheless, keep resultant.
}
}
// Finally, force polyhedron drawing...
resultant.SetVisAttributes(pVisAttribs);
sceneHandler.BeginPrimitives(theAT);
sceneHandler.AddPrimitive(resultant);
sceneHandler.EndPrimitives();
}
else // Standard treatment...
{
pSol -> DescribeYourselfTo (sceneHandler);
}
}
sceneHandler.PostAddSolid ();
}
@@ -636,3 +660,63 @@ G4bool G4PhysicalVolumeModel::Validate (G4bool warn)
return false;
}
}
const std::map<G4String,G4AttDef>* G4PhysicalVolumeModel::GetAttDefs() const
{
G4bool isNew;
std::map<G4String,G4AttDef>* store
= G4AttDefStore::GetInstance("G4PhysicalVolumeModel", isNew);
if (isNew) {
(*store)["PVol"] =
G4AttDef("PVol","Physical Volume","Physics","","G4String");
(*store)["Copy"] =
G4AttDef("Copy","Physical Volume Copy No.","Physics","","G4int");
(*store)["LVol"] =
G4AttDef("LVol","Logical Volume","Physics","","G4String");
(*store)["Region"] =
G4AttDef("Region","Cuts Region","Physics","","G4String");
(*store)["RootRegion"] =
G4AttDef("RootRegion","Root Region (0/1 = false/true)","Physics","","G4bool");
(*store)["Solid"] =
G4AttDef("Solid","Solid Name","Physics","","G4String");
(*store)["EType"] =
G4AttDef("EType","Entity Type","Physics","","G4String");
(*store)["Material"] =
G4AttDef("Material","Material Name","Physics","","G4String");
(*store)["Density"] =
G4AttDef("Density","Material Density","Physics","G4BestUnit","G4double");
(*store)["State"] =
G4AttDef("State","Material State (enum undefined,solid,liquid,gas)","Physics","","G4String");
(*store)["Radlen"] =
G4AttDef("Radlen","Material Radiation Length","Physics","G4BestUnit","G4double");
}
return store;
}
std::vector<G4AttValue>* G4PhysicalVolumeModel::CreateCurrentAttValues() const
{
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
std::ostringstream oss;
values->push_back(G4AttValue("PVol", fpCurrentPV->GetName(),""));
oss << fpCurrentPV->GetCopyNo();
values->push_back(G4AttValue("Copy", oss.str(),""));
values->push_back(G4AttValue("LVol", fpCurrentLV->GetName(),""));
G4Region* region = fpCurrentLV->GetRegion();
G4String regionName = region? region->GetName(): G4String("No region");
values->push_back(G4AttValue("Region", regionName,""));
oss.str(""); oss << fpCurrentLV->IsRootRegion();
values->push_back(G4AttValue("RootRegion", oss.str(),""));
G4VSolid* pSol = fpCurrentLV->GetSolid();
values->push_back(G4AttValue("Solid", pSol->GetName(),""));
values->push_back(G4AttValue("EType", pSol->GetEntityType(),""));
G4String matName = fpCurrentMaterial? fpCurrentMaterial->GetName(): G4String("No material");
values->push_back(G4AttValue("Material", matName,""));
G4double matDensity = fpCurrentMaterial? fpCurrentMaterial->GetDensity(): 0.;
values->push_back(G4AttValue("Density", G4BestUnit(matDensity,"Volumic Mass"),""));
G4State matState = fpCurrentMaterial? fpCurrentMaterial->GetState(): kStateUndefined;
oss.str(""); oss << matState;
values->push_back(G4AttValue("State", oss.str(),""));
G4double matRadlen = fpCurrentMaterial? fpCurrentMaterial->GetRadlen(): 0.;
values->push_back(G4AttValue("Radlen", G4BestUnit(matRadlen,"Length"),""));
return values;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeSearchScene.cc,v 1.12 2006/06/29 21:32:56 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4PhysicalVolumeSearchScene.cc,v 1.13 2006/11/05 20:38:08 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 10th August 1998.
@@ -59,6 +59,7 @@ void G4PhysicalVolumeSearchScene::FindVolume (const G4VSolid&) {
G4VPhysicalVolume* pCurrentPV = fpPVModel->GetCurrentPV();
G4LogicalVolume* pCurrentLV = fpPVModel->GetCurrentLV();
//G4Material* pCurrentMaterial = fpPVModel->GetCurrentMaterial();
// Note: pCurrentMaterial may be zero (parallel world).
/**************************************************
G4cout << "Required volume: \"" << fRequiredPhysicalVolumeName
@@ -25,7 +25,7 @@
//
//
// $Id: G4ScaleModel.cc,v 1.4 2006/06/29 21:32:58 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 21st July 2001.
@@ -25,7 +25,7 @@
//
//
// $Id: G4TextModel.cc,v 1.7 2006/06/29 21:33:00 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 3rd April 2001
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4TrajectoriesModel.cc,v 1.18 2006/06/29 21:33:02 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TrajectoriesModel.cc,v 1.24 2006/11/14 14:42:08 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 26th August 1998.
@@ -33,27 +33,76 @@
#include "G4TrajectoriesModel.hh"
#include "G4ModelingParameters.hh"
#include "G4VGraphicsScene.hh"
#include "G4EventManager.hh"
#include "G4Event.hh"
G4TrajectoriesModel::~G4TrajectoriesModel () {}
#include "G4AttValue.hh"
#include "G4AttDef.hh"
#include "G4AttCheck.hh"
G4TrajectoriesModel::G4TrajectoriesModel (G4int drawingMode):
fDrawingMode(drawingMode) {
fDrawingMode(drawingMode), fpCurrentTrajectory(0) {
fGlobalTag = "G4TrajectoriesModel for all trajectories.";
fGlobalDescription = fGlobalTag;
}
G4TrajectoriesModel::~G4TrajectoriesModel () {}
void G4TrajectoriesModelDebugG4AttValues(const G4VTrajectory*);
void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
const G4Event* event =
G4EventManager::GetEventManager()->GetConstCurrentEvent();
const G4Event* event = fpMP->GetEvent();
if (event) {
G4TrajectoryContainer* TC = event -> GetTrajectoryContainer ();
if (TC) {
for (G4int iT = 0; iT < TC->entries(); iT++) {
sceneHandler.AddCompound (*((*TC) [iT]));
fpCurrentTrajectory = (*TC) [iT];
// Debug trajectory:
// fpCurrentTrajectory->ShowTrajectory(); G4cout << G4endl;
// Debug G4AttValues:
// G4TrajectoriesModelDebugG4AttValues(fpCurrentTrajectory);
if (fpCurrentTrajectory)
sceneHandler.AddCompound (*fpCurrentTrajectory);
}
}
}
}
// 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);
}
delete attValues;
}
for (G4int i = 0; i < pTraj->GetPointEntries(); i++) {
G4VTrajectoryPoint* aPoint = pTraj->GetPoint(i);
std::vector<G4AttValue>* attValues = aPoint->CreateAttValues();
if (attValues) {
G4AttCheck attCheck(attValues, aPoint->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;
}
}
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryChargeFilter.cc,v 1.3 2006/06/29 21:33:04 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TrajectoryChargeFilter.cc,v 1.4 2006/08/25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Filter trajectories according to charge. Only registered
// charges will pass the filter.
@@ -41,7 +41,7 @@ G4TrajectoryChargeFilter::G4TrajectoryChargeFilter(const G4String& name)
G4TrajectoryChargeFilter::~G4TrajectoryChargeFilter() {}
bool
G4TrajectoryChargeFilter::Evaluate(const G4VTrajectory& traj)
G4TrajectoryChargeFilter::Evaluate(const G4VTrajectory& traj) const
{
G4double charge = traj.GetCharge();
@@ -0,0 +1,225 @@
//
// ********************************************************************
// * 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: G4TrajectoryDrawByAttribute.cc,v 1.3 2006/09/14 15:41:42 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay August 2006
//
#include "G4TrajectoryDrawByAttribute.hh"
#include "G4AttDef.hh"
#include "G4AttFilterUtils.hh"
#include "G4AttUtils.hh"
#include "G4AttValue.hh"
#include "G4TrajectoryDrawerUtils.hh"
#include "G4VAttValueFilter.hh"
#include "G4VisTrajContext.hh"
#include "G4VTrajectory.hh"
#include <assert.h>
#include <sstream>
G4TrajectoryDrawByAttribute::G4TrajectoryDrawByAttribute(const G4String& name, G4VisTrajContext* context)
:G4VTrajectoryModel(name, context)
,fAttName("")
,fFirst(true)
,fWarnedMissingAttribute(false)
,filter(0)
{}
G4TrajectoryDrawByAttribute::~G4TrajectoryDrawByAttribute()
{
ContextMap::iterator iter = fContextMap.begin();
while (iter != fContextMap.end()) {
delete iter->second;
iter++;
}
delete filter;
}
void
G4TrajectoryDrawByAttribute::Draw(const G4VTrajectory& object, const G4int&,
const G4bool& visible) const
{
// Return if attribute name has not been set. Just print one warning
if (fAttName.isNull()) {
if (!fWarnedMissingAttribute) {
std::ostringstream o;
o<<"Null attribute name";
G4Exception("G4TrajectoryDrawByAttribute::Draw", "NullAttributeName", JustWarning, o.str().c_str());
fWarnedMissingAttribute = true;
}
return;
}
// Basically cache data loaded filter for efficiency
if (fFirst) {
fFirst = false;
// Get attribute definition
G4AttDef attDef;
// Expect definition to exist
if (!G4AttUtils::ExtractAttDef(object, fAttName, attDef)) {
std::ostringstream o;
o <<"Unable to extract attribute definition named "<<fAttName;
G4Exception
("G4TrajectoryDrawByAttribute::Draw", "InvalidAttributeDefinition", FatalErrorInArgument, o.str().c_str());
}
// Get new G4AttValue filter
filter = G4AttFilterUtils::GetNewFilter(attDef);
assert (0 != filter);
// Load both interval and single valued data. Single valued data should
// override interval data.
ContextMap::const_iterator iter = fContextMap.begin();
while (iter != fContextMap.end()) {
if (iter->first.second == G4TrajectoryDrawByAttribute::Interval) {
filter->LoadIntervalElement(iter->first.first);
}
else if (iter->first.second == G4TrajectoryDrawByAttribute::SingleValue) {
filter->LoadSingleValueElement(iter->first.first);
}
iter++;
}
}
// Get attribute value
G4AttValue attVal;
// Expect value to exist
if (!G4AttUtils::ExtractAttValue(object, fAttName, attVal)) {
std::ostringstream o;
o <<"Unable to extract attribute value named "<<fAttName;
G4Exception
("G4TrajectoryDrawByAttribute::Draw", "InvalidAttributeValue", FatalErrorInArgument, o.str().c_str());
}
G4VisTrajContext myContext(GetContext());
G4String key;
// If attribute value passes filter, get corresponding interval/single value
// key loaded into G4AttValue filter.
if (filter->GetValidElement(attVal, key)) {
// Extract context corresponding to valid key.
// Single value match should have overriden interval match.
ContextMap::const_iterator iter = fContextMap.begin();
G4bool gotContext(false);
while (!gotContext && (iter != fContextMap.end())) {
if (iter->first.first == key) {
myContext = *(iter->second);
gotContext = true;
}
iter++;
}
assert (gotContext);
}
myContext.SetVisible(visible);
if (GetVerbose()) {
G4cout<<"G4TrajectoryDrawByAttribute drawer named "<<Name();
G4cout<<", drawing style selected according to value of attribute "<<fAttName;
G4cout<<" : "<<attVal.GetValue()<<". Selected context:"<<G4endl;
myContext.Print(G4cout);
}
// Draw the trajectory
G4TrajectoryDrawerUtils::DrawLineAndPoints(object, myContext);
}
void
G4TrajectoryDrawByAttribute::Print(std::ostream& ostr) const
{
ostr<<"G4TrajectoryDrawByAttribute, dumping configuration for model named "<< Name() <<":"<<std::endl;;
ostr<<"Default configuration:"<<G4endl;
GetContext().Print(ostr);
ostr<<"\nAttribute name "<<fAttName<<std::endl;
ostr<<"\nKey<->Context map dump:"<<std::endl;
ContextMap::const_iterator iter = fContextMap.begin();
while (iter != fContextMap.end()) {
ostr<<"Context for key "<<iter->first.first<<":"<<std::endl;
iter->second->Print(ostr);
iter++;
}
}
void
G4TrajectoryDrawByAttribute::Set(const G4String& name)
{
fAttName = name;
}
void
G4TrajectoryDrawByAttribute::AddIntervalContext(const G4String& name, G4VisTrajContext* context)
{
// Takes ownership of context
std::pair<G4String, Config> myPair(name, G4TrajectoryDrawByAttribute::Interval);
ContextMap::iterator iter = fContextMap.find(myPair);
if (iter != fContextMap.end()) {
std::ostringstream o;
o <<"Interval "<< name <<" already exists"<<std::endl;
G4Exception
("G4TrajectoryDrawByAttribute::AddIntervalContext", "InvalidInterval", FatalErrorInArgument, o.str().c_str());
}
fContextMap[myPair] = context;
}
void
G4TrajectoryDrawByAttribute::AddValueContext(const G4String& name, G4VisTrajContext* context)
{
// Takes ownership of context
std::pair<G4String, Config> myPair(name, G4TrajectoryDrawByAttribute::SingleValue);
ContextMap::iterator iter = fContextMap.find(myPair);
if (iter != fContextMap.end()) {
std::ostringstream o;
o <<"Single value "<< name <<" already exists"<<std::endl;
G4Exception
("G4TrajectoryDrawByAttribute::AddSingleValueContext", "InvalidInterval", FatalErrorInArgument, o.str().c_str());
}
fContextMap[myPair] = context;
}
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4TrajectoryDrawByCharge.cc,v 1.8 2006/06/29 21:33:06 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
#include "G4TrajectoryDrawByCharge.hh"
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4TrajectoryDrawByOriginVolume.cc,v 1.4 2006/06/29 21:33:08 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay March 2006
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4TrajectoryDrawByParticleID.cc,v 1.8 2006/06/29 21:33:10 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawerUtils.cc,v 1.6 2006/06/29 21:33:12 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TrajectoryDrawerUtils.cc,v 1.10 2006/08/30 10:32:14 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -37,10 +37,12 @@
#include "G4VisAttributes.hh"
#include "G4VisTrajContext.hh"
#include "G4VVisManager.hh"
#include "G4UIcommand.hh"
#include "G4AttValue.hh"
namespace G4TrajectoryDrawerUtils {
void GetPoints(const G4VTrajectory& traj, G4Polyline& trajectoryLine,
G4Polymarker& auxiliaryPoints, G4Polymarker& stepPoints)
{
@@ -114,11 +116,231 @@ namespace G4TrajectoryDrawerUtils {
}
void DrawLineAndPoints(const G4VTrajectory& traj, const G4VisTrajContext& context, const G4int& i_mode)
static void GetTimes(const G4VTrajectory& traj,
std::vector<G4double>& trajectoryLineTimes,
std::vector<G4double>& auxiliaryPointTimes,
std::vector<G4double>& stepPointTimes)
{
// It is important check that the sizes of times vectors produced
// by this function matches those of points vectors from
// GetPoints. If not, assume that the time information is
// invalid.
G4ThreeVector lastTrajectoryPointPosition;
for (G4int i=0; i<traj.GetPointEntries(); i++) {
G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i);
// Pre- and Post-Point times from the trajectory point...
G4double trajectoryPointPreTime = -DBL_MAX;
G4double trajectoryPointPostTime = DBL_MAX;
std::vector<G4AttValue>* trajectoryPointAttValues =
aTrajectoryPoint->CreateAttValues();
if (!trajectoryPointAttValues) {
G4cout << "G4TrajectoryDrawerUtils::GetTimes: no att values."
<< G4endl;
return;
} else {
G4bool foundPreTime = false, foundPostTime = false;
for (std::vector<G4AttValue>::iterator i =
trajectoryPointAttValues->begin();
i != trajectoryPointAttValues->end(); ++i) {
if (i->GetName() == "PreT") {
trajectoryPointPreTime =
G4UIcommand::ConvertToDimensionedDouble(i->GetValue());
foundPreTime = true;
}
if (i->GetName() == "PostT") {
trajectoryPointPostTime =
G4UIcommand::ConvertToDimensionedDouble(i->GetValue());
foundPostTime = true;
}
}
if (!foundPreTime || !foundPostTime) {
static G4bool warnedTimesNotFound = false;
if (!warnedTimesNotFound) {
G4cout <<
"WARNING: G4TrajectoryDrawerUtils::GetTimes: times not found."
<< G4endl;
warnedTimesNotFound = true;
}
return;
}
}
const G4ThreeVector& trajectoryPointPosition =
aTrajectoryPoint->GetPosition();
const std::vector<G4ThreeVector>* auxiliaries
= aTrajectoryPoint->GetAuxiliaryPoints();
if (0 != auxiliaries) {
for (size_t iAux=0; iAux<auxiliaries->size(); ++iAux) {
// Interpolate time for auxiliary points...
const G4ThreeVector pos((*auxiliaries)[iAux]);
G4double s1 = (pos - lastTrajectoryPointPosition).mag();
G4double s2 = (trajectoryPointPosition - pos).mag();
G4double t = trajectoryPointPreTime +
(trajectoryPointPostTime - trajectoryPointPreTime) *
(s1 / (s1 + s2));
trajectoryLineTimes.push_back(t);
auxiliaryPointTimes.push_back(t);
}
}
trajectoryLineTimes.push_back(trajectoryPointPostTime);
stepPointTimes.push_back(trajectoryPointPostTime);
lastTrajectoryPointPosition = trajectoryPointPosition;
}
}
static void SliceLine(G4double timeIncrement,
G4Polyline& trajectoryLine,
std::vector<G4double>& trajectoryLineTimes)
{
// Assumes valid arguments from GetPoints and GetTimes.
G4Polyline newTrajectoryLine;
std::vector<G4double> newTrajectoryLineTimes;
newTrajectoryLine.push_back(trajectoryLine[0]);
newTrajectoryLineTimes.push_back(trajectoryLineTimes[0]);
size_t lineSize = trajectoryLine.size();
if (lineSize > 1) {
for (size_t i = 1; i < trajectoryLine.size(); ++i) {
G4double deltaT = trajectoryLineTimes[i] - trajectoryLineTimes[i - 1];
if (deltaT > 0.) {
G4double practicalTimeIncrement =
std::max(timeIncrement, deltaT / 100.);
for (G4double t =
(int(trajectoryLineTimes[i - 1]/practicalTimeIncrement) + 1) *
practicalTimeIncrement;
t <= trajectoryLineTimes[i];
t += practicalTimeIncrement) {
G4ThreeVector pos = trajectoryLine[i - 1] +
(trajectoryLine[i] - trajectoryLine[i - 1]) *
((t - trajectoryLineTimes[i - 1]) / deltaT);
newTrajectoryLine.push_back(pos);
newTrajectoryLineTimes.push_back(t);
}
}
newTrajectoryLine.push_back(trajectoryLine[i]);
newTrajectoryLineTimes.push_back(trajectoryLineTimes[i]);
}
}
trajectoryLine = newTrajectoryLine;
trajectoryLineTimes = newTrajectoryLineTimes;
}
static void DrawWithoutTime(const G4VisTrajContext& myContext,
G4Polyline& trajectoryLine,
G4Polymarker& auxiliaryPoints,
G4Polymarker& stepPoints)
{
// Draw without time slice information
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (0 == pVVisManager) return;
if (myContext.GetDrawLine()) {
G4VisAttributes trajectoryLineAttribs(myContext.GetLineColour());
trajectoryLineAttribs.SetVisibility(myContext.GetLineVisible());
trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
pVVisManager->Draw(trajectoryLine);
}
if (myContext.GetDrawAuxPts() && (auxiliaryPoints.size() > 0)) {
auxiliaryPoints.SetMarkerType(myContext.GetAuxPtsType());
auxiliaryPoints.SetScreenSize(myContext.GetAuxPtsSize());
auxiliaryPoints.SetFillStyle(myContext.GetAuxPtsFillStyle());
G4VisAttributes auxiliaryPointsAttribs(myContext.GetAuxPtsColour());
auxiliaryPointsAttribs.SetVisibility(myContext.GetAuxPtsVisible());
auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
pVVisManager->Draw(auxiliaryPoints);
}
if (myContext.GetDrawStepPts() && (stepPoints.size() > 0)) {
stepPoints.SetMarkerType(myContext.GetStepPtsType());
stepPoints.SetScreenSize(myContext.GetStepPtsSize());
stepPoints.SetFillStyle(myContext.GetStepPtsFillStyle());
G4VisAttributes stepPointsAttribs(myContext.GetStepPtsColour());
stepPointsAttribs.SetVisibility(myContext.GetStepPtsVisible());
stepPoints.SetVisAttributes(&stepPointsAttribs);
pVVisManager->Draw(stepPoints);
}
}
static void DrawWithTime(const G4VisTrajContext& myContext,
G4Polyline& trajectoryLine,
G4Polymarker& auxiliaryPoints,
G4Polymarker& stepPoints,
std::vector<G4double>& trajectoryLineTimes,
std::vector<G4double>& auxiliaryPointTimes,
std::vector<G4double>& stepPointTimes)
{
// Draw with time slice information
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (0 == pVVisManager) return;
if (myContext.GetDrawLine()) {
G4VisAttributes trajectoryLineAttribs(myContext.GetLineColour());
trajectoryLineAttribs.SetVisibility(myContext.GetLineVisible());
for (size_t i = 1; i < trajectoryLine.size(); ++i ) {
G4Polyline slice;
slice.push_back(trajectoryLine[i -1]);
slice.push_back(trajectoryLine[i]);
trajectoryLineAttribs.SetStartTime(trajectoryLineTimes[i - 1]);
trajectoryLineAttribs.SetEndTime(trajectoryLineTimes[i]);
slice.SetVisAttributes(&trajectoryLineAttribs);
pVVisManager->Draw(slice);
}
}
if (myContext.GetDrawAuxPts() && (auxiliaryPoints.size() > 0)) {
G4VisAttributes auxiliaryPointsAttribs(myContext.GetAuxPtsColour());
auxiliaryPointsAttribs.SetVisibility(myContext.GetAuxPtsVisible());
for (size_t i = 0; i < auxiliaryPoints.size(); ++i ) {
G4Polymarker point;
point.push_back(auxiliaryPoints[i]);
point.SetMarkerType(myContext.GetAuxPtsType());
point.SetScreenSize(myContext.GetAuxPtsSize());
point.SetFillStyle(myContext.GetAuxPtsFillStyle());
auxiliaryPointsAttribs.SetStartTime(auxiliaryPointTimes[i]);
auxiliaryPointsAttribs.SetEndTime(auxiliaryPointTimes[i]);
point.SetVisAttributes(&auxiliaryPointsAttribs);
pVVisManager->Draw(point);
}
}
if (myContext.GetDrawStepPts() && (stepPoints.size() > 0)) {
G4VisAttributes stepPointsAttribs(myContext.GetStepPtsColour());
stepPointsAttribs.SetVisibility(myContext.GetStepPtsVisible());
for (size_t i = 0; i < stepPoints.size(); ++i ) {
G4Polymarker point;
point.push_back(stepPoints[i]);
point.SetMarkerType(myContext.GetStepPtsType());
point.SetScreenSize(myContext.GetStepPtsSize());
point.SetFillStyle(myContext.GetStepPtsFillStyle());
stepPointsAttribs.SetStartTime(stepPointTimes[i]);
stepPointsAttribs.SetEndTime(stepPointTimes[i]);
point.SetVisAttributes(&stepPointsAttribs);
pVVisManager->Draw(point);
}
}
}
void DrawLineAndPoints(const G4VTrajectory& traj, const G4VisTrajContext& context, const G4int& i_mode)
{
// Extra copy while i_mode is still around
G4VisTrajContext myContext(context);
@@ -150,36 +372,36 @@ namespace G4TrajectoryDrawerUtils {
GetPoints(traj, trajectoryLine, auxiliaryPoints, stepPoints);
if (myContext.GetDrawLine()) {
G4VisAttributes trajectoryLineAttribs(myContext.GetLineColour());
trajectoryLineAttribs.SetVisibility(myContext.GetLineVisible());
trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
pVVisManager->Draw(trajectoryLine);
}
if (myContext.GetDrawAuxPts() && (auxiliaryPoints.size() > 0)) {
auxiliaryPoints.SetMarkerType(myContext.GetAuxPtsType());
auxiliaryPoints.SetScreenSize(myContext.GetAuxPtsSize());
auxiliaryPoints.SetFillStyle(myContext.GetAuxPtsFillStyle());
G4VisAttributes auxiliaryPointsAttribs(myContext.GetAuxPtsColour());
auxiliaryPointsAttribs.SetVisibility(myContext.GetAuxPtsVisible());
auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
pVVisManager->Draw(auxiliaryPoints);
}
if (myContext.GetDrawStepPts() && (stepPoints.size() > 0)) {
stepPoints.SetMarkerType(myContext.GetStepPtsType());
stepPoints.SetScreenSize(myContext.GetStepPtsSize());
stepPoints.SetFillStyle(myContext.GetStepPtsFillStyle());
G4VisAttributes stepPointsAttribs(myContext.GetStepPtsColour());
stepPointsAttribs.SetVisibility(myContext.GetStepPtsVisible());
stepPoints.SetVisAttributes(&stepPointsAttribs);
pVVisManager->Draw(stepPoints);
if (myContext.GetTimeSliceInterval()) {
// Get corresponding track time information, if any
std::vector<G4double> trajectoryLineTimes;
std::vector<G4double> stepPointTimes;
std::vector<G4double> auxiliaryPointTimes;
GetTimes(traj, trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes);
// Check validity
if (trajectoryLineTimes.size() != trajectoryLine.size() ||
stepPointTimes.size() != stepPoints.size() ||
auxiliaryPointTimes.size() != auxiliaryPoints.size()) {
// Revert to drawing without time information...
DrawWithoutTime(myContext, trajectoryLine, auxiliaryPoints, stepPoints);
} else {
SliceLine(myContext.GetTimeSliceInterval(),
trajectoryLine, trajectoryLineTimes);
DrawWithTime(myContext,
trajectoryLine, auxiliaryPoints, stepPoints,
trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes);
}
} else {
DrawWithoutTime(myContext, trajectoryLine, auxiliaryPoints, stepPoints);
}
}
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// $Id: G4TrajectoryFilterFactories.cc,v 1.4 2006/06/29 21:33:14 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
/// $Id: G4TrajectoryFilterFactories.cc,v 1.5 2006/09/12 18:53:03 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// Trajectory filter model factories creating filters
@@ -32,12 +32,41 @@
//
// Jane Tinslay March 2006
//
#include "G4AttributeFilterT.hh"
#include "G4ModelCommandsT.hh"
#include "G4TrajectoryFilterFactories.hh"
#include "G4TrajectoryChargeFilter.hh"
#include "G4TrajectoryParticleFilter.hh"
#include "G4TrajectoryOriginVolumeFilter.hh"
// Attribute filter
G4TrajectoryAttributeFilterFactory::G4TrajectoryAttributeFilterFactory()
:G4VModelFactory< G4VFilter<G4VTrajectory> >("attributeFilter")
{}
G4TrajectoryAttributeFilterFactory::~G4TrajectoryAttributeFilterFactory() {}
G4TrajectoryAttributeFilterFactory::ModelAndMessengers
G4TrajectoryAttributeFilterFactory::Create(const G4String& placement, const G4String& name)
{
typedef G4AttributeFilterT<G4VTrajectory> G4TrajectoryAttributeFilter;
// Create model
G4TrajectoryAttributeFilter* model = new G4TrajectoryAttributeFilter(name);
// Create associated messengers
Messengers messengers;
messengers.push_back(new G4ModelCmdSetString<G4TrajectoryAttributeFilter>(model, placement, "setAttribute"));
messengers.push_back(new G4ModelCmdInvert<G4TrajectoryAttributeFilter>(model, placement));
messengers.push_back(new G4ModelCmdActive<G4TrajectoryAttributeFilter>(model, placement));
messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryAttributeFilter>(model, placement));
messengers.push_back(new G4ModelCmdReset<G4TrajectoryAttributeFilter>(model, placement));
messengers.push_back(new G4ModelCmdAddInterval<G4TrajectoryAttributeFilter>(model, placement, "addInterval"));
messengers.push_back(new G4ModelCmdAddValue<G4TrajectoryAttributeFilter>(model, placement, "addValue"));
return ModelAndMessengers(model, messengers);
}
// Charge filter
G4TrajectoryChargeFilterFactory::G4TrajectoryChargeFilterFactory()
:G4VModelFactory< G4VFilter<G4VTrajectory> >("chargeFilter")
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4TrajectoryGenericDrawer.cc,v 1.2 2006/06/29 21:33:16 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay May 2006
//
@@ -23,12 +23,15 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryModelFactories.cc,v 1.5 2006/06/29 21:33:18 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TrajectoryModelFactories.cc,v 1.7 2006/09/12 18:53:03 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay, John Allison, Joseph Perl October 2005
#include "G4ModelCompoundCommandsT.hh"
#include "G4ModelCommandsT.hh"
#include "G4ModelCommandUtils.hh"
#include "G4TrajectoryDrawByAttribute.hh"
#include "G4TrajectoryDrawByCharge.hh"
#include "G4TrajectoryDrawByOriginVolume.hh"
#include "G4TrajectoryDrawByParticleID.hh"
@@ -36,30 +39,32 @@
#include "G4TrajectoryModelFactories.hh"
#include "G4VisTrajContext.hh"
namespace {
void AddContextMsgrs(G4VisTrajContext* context, std::vector<G4UImessenger*>& messengers,
const G4String& placement)
{
messengers.push_back(new G4ModelCmdCreateContextDir<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetDrawLine<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetLineVisible<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetLineColour<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetDrawStepPts<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetStepPtsVisible<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetStepPtsColour<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetStepPtsSize<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetStepPtsType<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetStepPtsFillStyle<G4VisTrajContext>(context, placement));
// Draw by attribute
G4TrajectoryDrawByAttributeFactory::G4TrajectoryDrawByAttributeFactory()
:G4VModelFactory<G4VTrajectoryModel>("drawByAttribute")
{}
messengers.push_back(new G4ModelCmdSetDrawAuxPts<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetAuxPtsVisible<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetAuxPtsColour<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetAuxPtsSize<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetAuxPtsType<G4VisTrajContext>(context, placement));
messengers.push_back(new G4ModelCmdSetAuxPtsFillStyle<G4VisTrajContext>(context, placement));
}
G4TrajectoryDrawByAttributeFactory::~G4TrajectoryDrawByAttributeFactory() {}
ModelAndMessengers
G4TrajectoryDrawByAttributeFactory::Create(const G4String& placement, const G4String& name)
{
Messengers messengers;
// Create default context and model
G4VisTrajContext* context = new G4VisTrajContext("default");
G4TrajectoryDrawByAttribute* model = new G4TrajectoryDrawByAttribute(name, context);
// Create messengers for default context configuration
G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByAttribute>(model, placement));
messengers.push_back(new G4ModelCmdSetString<G4TrajectoryDrawByAttribute>(model, placement, "setAttribute"));
messengers.push_back(new G4ModelCmdAddIntervalContext<G4TrajectoryDrawByAttribute>(model, placement, "addInterval"));
messengers.push_back(new G4ModelCmdAddValueContext<G4TrajectoryDrawByAttribute>(model, placement, "addValue"));
return ModelAndMessengers(model, messengers);
}
G4TrajectoryGenericDrawerFactory::G4TrajectoryGenericDrawerFactory()
@@ -78,7 +83,7 @@ G4TrajectoryGenericDrawerFactory::Create(const G4String& placement, const G4Stri
G4TrajectoryGenericDrawer* model = new G4TrajectoryGenericDrawer(name, context);
// Create messengers for default context configuration
AddContextMsgrs(context, messengers, placement+"/"+name);
G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
// Verbose command
messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryGenericDrawer>(model, placement));
@@ -103,7 +108,7 @@ G4TrajectoryDrawByChargeFactory::Create(const G4String& placement, const G4Strin
G4TrajectoryDrawByCharge* model = new G4TrajectoryDrawByCharge(name, context);
// Create messengers for default context configuration
AddContextMsgrs(context, messengers, placement+"/"+name);
G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
// Create messengers for drawer
messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByCharge>(model, placement));
@@ -129,7 +134,7 @@ G4TrajectoryDrawByParticleIDFactory::Create(const G4String& placement, const G4S
G4TrajectoryDrawByParticleID* model = new G4TrajectoryDrawByParticleID(name, context);
// Create messengers for default context configuration
AddContextMsgrs(context, messengers, placement+"/"+name);
G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
// Create messengers for drawer
messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByParticleID>(model, placement));
@@ -156,7 +161,7 @@ G4TrajectoryDrawByOriginVolumeFactory::Create(const G4String& placement, const G
G4TrajectoryDrawByOriginVolume* model = new G4TrajectoryDrawByOriginVolume(name, context);
// Create messengers for default context configuration
AddContextMsgrs(context, messengers, placement+"/"+name);
G4ModelCommandUtils::AddContextMsgrs(context, messengers, placement+"/"+name);
// Create messengers for drawer
messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByOriginVolume>(model, placement));
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryOriginVolumeFilter.cc,v 1.2 2006/06/29 21:33:20 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TrajectoryOriginVolumeFilter.cc,v 1.3 2006/08/25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Filter trajectories according to volume name. Only registered
// volumes will pass the filter.
@@ -42,7 +42,7 @@ G4TrajectoryOriginVolumeFilter::G4TrajectoryOriginVolumeFilter(const G4String& n
G4TrajectoryOriginVolumeFilter::~G4TrajectoryOriginVolumeFilter() {}
bool
G4TrajectoryOriginVolumeFilter::Evaluate(const G4VTrajectory& traj)
G4TrajectoryOriginVolumeFilter::Evaluate(const G4VTrajectory& traj) const
{
G4Navigator* navigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryParticleFilter.cc,v 1.2 2006/06/29 21:33:22 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4TrajectoryParticleFilter.cc,v 1.3 2006/08/25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
// Filter trajectories according to particle type. Only registered
// particle types will pass the filter.
@@ -40,7 +40,7 @@ G4TrajectoryParticleFilter::G4TrajectoryParticleFilter(const G4String& name)
G4TrajectoryParticleFilter::~G4TrajectoryParticleFilter() {}
bool
G4TrajectoryParticleFilter::Evaluate(const G4VTrajectory& traj)
G4TrajectoryParticleFilter::Evaluate(const G4VTrajectory& traj) const
{
G4String particle = traj.GetParticleName();
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VModel.cc,v 1.13 2006/06/29 21:33:24 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4VModel.cc,v 1.14 2006/11/01 10:33:00 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// John Allison 31st December 1997.
@@ -47,15 +47,13 @@ G4VModel::G4VModel (const G4Transform3D& modelTransformation,
G4VModel::~G4VModel () {}
G4String G4VModel::GetCurrentTag () const {
return G4String
("WARNING: GetCurrentTag() not implemented by concrete class."
"\n Global tag: " + fGlobalTag);
// Override in concrete class if concept of "current" is meaningful.
return fGlobalTag;
}
G4String G4VModel::GetCurrentDescription () const {
return G4String
("WARNING: GetCurrentDescription() not implemented by concrete class."
"\n Global description: " + fGlobalDescription);
// Override in concrete class if concept of "current" is meaningful.
return fGlobalDescription;
}
G4bool G4VModel::Validate (G4bool) {
@@ -24,7 +24,7 @@
// ********************************************************************
//
// $Id: G4VTrajectoryModel.cc,v 1.3 2006/06/29 21:33:26 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// Jane Tinslay May 2006
//
@@ -43,6 +43,7 @@ G4VisTrajContext::G4VisTrajContext(const G4String& name)
,fStepPtsFillStyle(G4VMarker::filled)
,fStepPtsColour(G4Colour::Yellow())
,fStepPtsVisible(true)
,fTimeSliceInterval(0.)
{}
// Destructor