Import Geant4 9.5.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 16:46:55 +02:00
parent 89a9605df1
commit b1eb5424d2
10957 changed files with 888481 additions and 160139 deletions
@@ -23,8 +23,8 @@
// * 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-09-02 $
// $Id: G4AttFilterUtils.cc,v 1.4 2006-12-13 15:50:06 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Visualisation attribute filter utility functions.
//
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4AxesModel.cc,v 1.6 2006/06/29 21:32:38 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4AxesModel.cc,v 1.6 2006-06-29 21:32:38 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 3rd April 2001
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4BoundingSphereScene.cc,v 1.11 2006/06/29 21:32:40 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4BoundingSphereScene.cc,v 1.11 2006-06-29 21:32:40 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 7th June 1997
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// $Id: G4DigiFilterFactories.cc,v 1.1 2010/05/30 11:24:30 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
/// $Id: G4DigiFilterFactories.cc,v 1.1 2010-05-30 11:24:30 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Digi filter model factories creating filters
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4DigiModel.cc,v 1.1 2010/05/30 11:24:30 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
// $Id: G4DigiModel.cc,v 1.1 2010-05-30 11:24:30 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 26th August 1998.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FlavoredParallelWorldModel.cc,v 1.7 2006/06/29 21:32:42 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4FlavoredParallelWorldModel.cc,v 1.7 2006-06-29 21:32:42 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// P. Mora de Freitas et M.Verderi - 19 June 1998.
// Model for flavored parallel world volumes.
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// $Id: G4HitFilterFactories.cc,v 1.2 2010/05/30 11:24:03 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
/// $Id: G4HitFilterFactories.cc,v 1.2 2010-05-30 11:24:03 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Hits filter model factories creating filters
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4HitsModel.cc,v 1.18 2006/11/14 14:42:08 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4HitsModel.cc,v 1.18 2006-11-14 14:42:08 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 26th August 1998.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeModel.cc,v 1.14 2006/11/01 10:28:42 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4LogicalVolumeModel.cc,v 1.14 2006-11-01 10:28:42 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 26th July 1999.
@@ -142,8 +142,9 @@ void G4LogicalVolumeModel::DescribeSolid
G4VSolid* pSol1 = pSol -> GetConstituentSolid (1);
if (!pSol1) {
G4Exception
("G4PhysicalVolumeModel::DescribeSolid:"
" 2nd component solid is missing.");
("G4PhysicalVolumeModel::DescribeSolid",
"modeling0001", FatalException,
"2nd component solid in Boolean is missing.");
}
// Draw these constituents white and "forced wireframe"...
G4VisAttributes constituentAttributes;
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ModelingParameters.cc,v 1.16 2010/05/11 11:13:35 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
// $Id: G4ModelingParameters.cc,v 1.16 2010-05-11 11:13:35 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 31st December 1997.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4NullModel.cc,v 1.9 2006/06/29 21:32:50 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4NullModel.cc,v 1.9 2006-06-29 21:32:50 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 4th April 1998.
@@ -40,5 +40,7 @@ G4NullModel::G4NullModel (const G4ModelingParameters* pMP):
G4NullModel::~G4NullModel () {}
void G4NullModel::DescribeYourselfTo (G4VGraphicsScene&) {
G4Exception ("G4NullModel::DescribeYourselfTo called.");
G4Exception ("G4NullModel::DescribeYourselfTo",
"modeling0002", FatalException,
"There is a serious mistake if this is called!");
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PSHitsModel.cc,v 1.4 2009/11/04 12:44:39 allison Exp $
// GEANT4 tag $Name: geant4-09-03 $
// $Id: G4PSHitsModel.cc,v 1.4 2009-11-04 12:44:39 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Created: Mar. 31, 2009 Akinori Kimura
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeMassScene.cc,v 1.7 2006/11/06 09:24:13 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4PhysicalVolumeMassScene.cc,v 1.7 2006-11-06 09:24:13 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 10th August 1998.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeModel.cc,v 1.68 2010/11/05 15:19:29 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4PhysicalVolumeModel.cc,v 1.68 2010-11-05 15:19:29 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 31st December 1997.
@@ -133,7 +133,8 @@ void G4PhysicalVolumeModel::DescribeYourselfTo
(G4VGraphicsScene& sceneHandler)
{
if (!fpMP) G4Exception
("G4PhysicalVolumeModel::DescribeYourselfTo: No modeling parameters.");
("G4PhysicalVolumeModel::DescribeYourselfTo",
"modeling0003", FatalException, "No modeling parameters.");
// For safety...
fCurrentDepth = 0;
@@ -385,7 +386,7 @@ void G4PhysicalVolumeModel::DescribeAndDescend
G4int copyNo = fpCurrentPV->GetCopyNo();
fFullPVPath.push_back
(G4PhysicalVolumeNodeID
(fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform));
(fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform,thisToBeDrawn));
if (thisToBeDrawn) {
@@ -393,7 +394,7 @@ void G4PhysicalVolumeModel::DescribeAndDescend
G4int copyNo = fpCurrentPV->GetCopyNo();
fDrawnPVPath.push_back
(G4PhysicalVolumeNodeID
(fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform));
(fpCurrentPV,copyNo,fCurrentDepth,*fpCurrentTransform,thisToBeDrawn));
if (fpMP->IsExplode() && fDrawnPVPath.size() == 1) {
// For top-level drawn volumes, explode along radius...
@@ -594,9 +595,6 @@ G4bool G4PhysicalVolumeModel::Validate (G4bool warn)
-> 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!!
if (warn) {
G4cout << "G4PhysicalVolumeModel::Validate() called." << G4endl;
}
G4PhysicalVolumeModel searchModel (world);
G4PhysicalVolumeSearchScene searchScene
(&searchModel, fTopPVName, fTopPVCopyNo);
@@ -606,12 +604,14 @@ G4bool G4PhysicalVolumeModel::Validate (G4bool warn)
searchModel.DescribeYourselfTo (searchScene);
G4VPhysicalVolume* foundVolume = searchScene.GetFoundVolume ();
if (foundVolume) {
if (warn) {
G4cout << " Volume of the same name and copy number (\""
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 WARNING: This does not necessarily guarantee it's the same"
"\n volume you originally specified in /vis/scene/add/."
"\n But it is not the same volume you originally specified"
"\n in /vis/scene/add/."
<< G4endl;
}
fpTopPV = foundVolume;
@@ -620,7 +620,9 @@ G4bool G4PhysicalVolumeModel::Validate (G4bool warn)
}
else {
if (warn) {
G4cout << " A volume of the same name and copy number (\""
G4cout <<
"G4PhysicalVolumeModel::Validate(): A volume of the same name and"
"\n copy number (\""
<< fTopPVName << "\", copy " << fTopPVCopyNo
<< ") no longer exists."
<< G4endl;
@@ -717,7 +719,7 @@ std::vector<G4AttValue>* G4PhysicalVolumeModel::CreateCurrentAttValues() const
if (!fpCurrentLV) {
G4Exception
("G4PhysicalVolumeModel::CreateCurrentAttValues",
"",
"modeling0004",
JustWarning,
"Current logical volume not defined.");
return values;
@@ -770,6 +772,7 @@ std::ostream& operator<<
<< ':' << node.GetCopyNo()
<< '[' << node.GetNonCulledDepth() << ']'
<< ':' << node.GetTransform();
if (!node.GetDrawn()) os << " Not "; os << "drawn";
} else {
os << "Null node";
}
@@ -785,9 +788,9 @@ const G4ThreeVector& G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetT
size_t i = fFullPVPath.size() - depth - 1;
if (i >= fFullPVPath.size()) {
G4Exception("G4PhysicalVolumeModelTouchable::GetTranslation",
"Index out of range",
"modeling0005",
FatalErrorInArgument,
"Asking for non-existent depth");
"Index out of range. Asking for non-existent depth");
}
static G4ThreeVector tempTranslation;
tempTranslation = fFullPVPath[i].GetTransform().getTranslation();
@@ -799,9 +802,9 @@ const G4RotationMatrix* G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::G
size_t i = fFullPVPath.size() - depth - 1;
if (i >= fFullPVPath.size()) {
G4Exception("G4PhysicalVolumeModelTouchable::GetRotation",
"Index out of range",
"modeling0006",
FatalErrorInArgument,
"Asking for non-existent depth");
"Index out of range. Asking for non-existent depth");
}
static G4RotationMatrix tempRotation;
tempRotation = fFullPVPath[i].GetTransform().getRotation();
@@ -813,9 +816,9 @@ G4VPhysicalVolume* G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetVol
size_t i = fFullPVPath.size() - depth - 1;
if (i >= fFullPVPath.size()) {
G4Exception("G4PhysicalVolumeModelTouchable::GetVolume",
"Index out of range",
"modeling0007",
FatalErrorInArgument,
"Asking for non-existent depth");
"Index out of range. Asking for non-existent depth");
}
return fFullPVPath[i].GetPhysicalVolume();
}
@@ -825,9 +828,9 @@ G4VSolid* G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetSolid(G4int
size_t i = fFullPVPath.size() - depth - 1;
if (i >= fFullPVPath.size()) {
G4Exception("G4PhysicalVolumeModelTouchable::GetSolid",
"Index out of range",
"modeling0008",
FatalErrorInArgument,
"Asking for non-existent depth");
"Index out of range. Asking for non-existent depth");
}
return fFullPVPath[i].GetPhysicalVolume()->GetLogicalVolume()->GetSolid();
}
@@ -837,9 +840,9 @@ G4int G4PhysicalVolumeModel::G4PhysicalVolumeModelTouchable::GetReplicaNumber(G4
size_t i = fFullPVPath.size() - depth - 1;
if (i >= fFullPVPath.size()) {
G4Exception("G4PhysicalVolumeModelTouchable::GetReplicaNumber",
"Index out of range",
"modeling0009",
FatalErrorInArgument,
"Asking for non-existent depth");
"Index out of range. Asking for non-existent depth");
}
return fFullPVPath[i].GetCopyNo();
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicalVolumeSearchScene.cc,v 1.14 2008/07/27 10:49:24 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4PhysicalVolumeSearchScene.cc,v 1.14 2008-07-27 10:49:24 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 10th August 1998.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ScaleModel.cc,v 1.4 2006/06/29 21:32:58 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4ScaleModel.cc,v 1.4 2006-06-29 21:32:58 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 21st July 2001.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4TextModel.cc,v 1.7 2006/06/29 21:33:00 gunter Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4TextModel.cc,v 1.7 2006-06-29 21:33:00 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 3rd April 2001
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4TrajectoriesModel.cc,v 1.25 2010/05/11 11:21:52 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
// $Id: G4TrajectoriesModel.cc,v 1.25 2010-05-11 11:21:52 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 26th August 1998.
@@ -90,7 +90,7 @@ G4int G4TrajectoriesModel::GetDrawingMode() const
else {
G4Exception
("G4TrajectoriesModel::GetDrawingMode",
"",
"modeling0010",
FatalException,
"Illegal attempt to obtain i_mode."
"\n i_mode is an old trajectories parameter that is DEPRECATED"
@@ -106,7 +106,7 @@ void G4TrajectoriesModel::SetDrawingMode(G4int drawingMode)
else {
G4Exception
("G4TrajectoriesModel::SetDrawingMode",
"",
"modeling0011",
FatalException,
"Illegal attempt to set i_mode."
"\n i_mode is an old trajectories parameter that is DEPRECATED"
@@ -23,8 +23,8 @@
// * 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: geant4-09-02 $
// $Id: G4TrajectoryChargeFilter.cc,v 1.4 2006-08-25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Filter trajectories according to charge. Only registered
// charges will pass the filter.
@@ -67,10 +67,11 @@ G4TrajectoryChargeFilter::Add(const G4String& charge)
MyCharge myCharge;
if (!ConvertToCharge(charge, myCharge)) {
std::ostringstream o;
o << "Invalid charge "<<charge;
G4ExceptionDescription ed;
ed << "Invalid charge "<<charge;
G4Exception
("G4TrajectoryChargeFilter::Add(const G4String& charge)", "InvalidCharge", JustWarning, o.str().c_str());
("G4TrajectoryChargeFilter::Add(const G4String& charge)",
"modeling0115", JustWarning, ed);
return;
}
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawByAttribute.cc,v 1.5 2010/05/28 02:00:59 allison Exp $
// GEANT4 tag $Name: geant4-09-04-beta-01 $
// $Id: G4TrajectoryDrawByAttribute.cc,v 1.6 2010-12-11 16:41:11 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Jane Tinslay August 2006
//
@@ -38,7 +38,6 @@
#include "G4VisTrajContext.hh"
#include "G4VTrajectory.hh"
#include <assert.h>
#include <sstream>
G4TrajectoryDrawByAttribute::G4TrajectoryDrawByAttribute(const G4String& name, G4VisTrajContext* context)
:G4VTrajectoryModel(name, context)
@@ -76,10 +75,11 @@ G4TrajectoryDrawByAttribute::Draw(const G4VTrajectory& object,
if (fAttName.isNull()) {
if (!fWarnedMissingAttribute) {
std::ostringstream o;
o<<"Null attribute name";
G4Exception("G4TrajectoryDrawByAttribute::Draw", "NullAttributeName", JustWarning, o.str().c_str());
G4ExceptionDescription ed;
ed<<"Null attribute name";
G4Exception("G4TrajectoryDrawByAttribute::Draw",
"modeling0116",
JustWarning, ed);
fWarnedMissingAttribute = true;
}
@@ -96,10 +96,18 @@ G4TrajectoryDrawByAttribute::Draw(const G4VTrajectory& object,
// 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());
static G4bool warnedUnableToExtract = false;
if (!warnedUnableToExtract) {
G4ExceptionDescription ed;
ed <<"Unable to extract attribute definition named "<<fAttName;
G4Exception
("G4TrajectoryDrawByAttribute::Draw",
"modeling0117", JustWarning, ed, "Invalid attribute name");
G4cout << "Available attributes:\n"
<< object.GetAttDefs();
warnedUnableToExtract = true;
}
return;
}
// Get new G4AttValue filter
@@ -126,10 +134,18 @@ G4TrajectoryDrawByAttribute::Draw(const G4VTrajectory& object,
// Expect value to exist
if (!G4AttUtils::ExtractAttValue(object, fAttName, attVal)) {
std::ostringstream o;
o <<"Unable to extract attribute value named "<<fAttName;
static G4bool warnedUnableToExtract = false;
if (!warnedUnableToExtract) {
G4ExceptionDescription ed;
ed <<"Unable to extract attribute value named "<<fAttName;
G4Exception
("G4TrajectoryDrawByAttribute::Draw", "InvalidAttributeValue", FatalErrorInArgument, o.str().c_str());
("G4TrajectoryDrawByAttribute::Draw",
"modeling0118", JustWarning, ed, "Invalid attribute name");
G4cout << "Available attributes:\n"
<< object.GetAttDefs();
warnedUnableToExtract = true;
}
return;
}
G4VisTrajContext myContext(GetContext());
@@ -205,10 +221,11 @@ G4TrajectoryDrawByAttribute::AddIntervalContext(const G4String& name, G4VisTrajC
ContextMap::iterator iter = fContextMap.find(myPair);
if (iter != fContextMap.end()) {
std::ostringstream o;
o <<"Interval "<< name <<" already exists"<<std::endl;
G4ExceptionDescription ed;
ed <<"Interval "<< name <<" already exists";
G4Exception
("G4TrajectoryDrawByAttribute::AddIntervalContext", "InvalidInterval", FatalErrorInArgument, o.str().c_str());
("G4TrajectoryDrawByAttribute::AddIntervalContext",
"modeling0119", FatalErrorInArgument, ed, "Invalid interval");
}
fContextMap[myPair] = context;
@@ -223,10 +240,11 @@ G4TrajectoryDrawByAttribute::AddValueContext(const G4String& name, G4VisTrajCont
ContextMap::iterator iter = fContextMap.find(myPair);
if (iter != fContextMap.end()) {
std::ostringstream o;
o <<"Single value "<< name <<" already exists"<<std::endl;
G4ExceptionDescription ed;
ed <<"Single value "<< name <<" already exists";
G4Exception
("G4TrajectoryDrawByAttribute::AddSingleValueContext", "InvalidInterval", FatalErrorInArgument, o.str().c_str());
("G4TrajectoryDrawByAttribute::AddSingleValueContext",
"modeling0120", FatalErrorInArgument, ed, "Invalid value");
}
fContextMap[myPair] = context;
@@ -23,8 +23,8 @@
// * 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: geant4-09-04-beta-01 $
// $Id: G4TrajectoryDrawByCharge.cc,v 1.10 2010-05-28 02:00:59 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
#include "G4TrajectoryDrawByCharge.hh"
@@ -116,10 +116,10 @@ G4TrajectoryDrawByCharge::Set(const G4String& charge, const G4String& colour)
Charge myCharge;
if (!ConvertToCharge(charge, myCharge)) {
std::ostringstream o;
o << "Invalid charge "<<charge;
G4ExceptionDescription ed;
ed << "Invalid charge "<<charge;
G4Exception
("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4String& colour)", "InvalidCharge", JustWarning, o.str().c_str());
("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4String& colour)", "modeling0121", JustWarning, ed);
return;
}
@@ -132,10 +132,10 @@ G4TrajectoryDrawByCharge::Set(const G4String& charge, const G4Colour& colour)
Charge myCharge;
if (!ConvertToCharge(charge, myCharge)) {
std::ostringstream o;
o << "Invalid charge "<<charge;
G4ExceptionDescription ed;
ed << "Invalid charge "<<charge;
G4Exception
("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4Colour& colour)", "InvalidCharge", JustWarning, o.str().c_str());
("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4Colour& colour)", "modeling0122", JustWarning, ed);
}
return Set(myCharge, colour);
@@ -23,8 +23,8 @@
// * 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: geant4-09-04-beta-01 $
// $Id: G4TrajectoryDrawByOriginVolume.cc,v 1.6 2010-05-28 02:00:59 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Jane Tinslay March 2006
@@ -34,7 +34,6 @@
#include "G4TransportationManager.hh"
#include "G4VisTrajContext.hh"
#include "G4VTrajectoryPoint.hh"
#include <sstream>
G4TrajectoryDrawByOriginVolume::G4TrajectoryDrawByOriginVolume(const G4String& name, G4VisTrajContext* context)
:G4VTrajectoryModel(name, context)
@@ -96,11 +95,10 @@ G4TrajectoryDrawByOriginVolume::SetDefault(const G4String& colour)
// Will not modify default colour if colour key does not exist
if (!G4Colour::GetColour(colour, myColour)) {
std::ostringstream o;
o << "G4Colour with key "<<colour<<" does not exist ";
G4ExceptionDescription ed;
ed << "G4Colour with key "<<colour<<" does not exist ";
G4Exception
("G4TrajectoryDrawByOriginParticleID::SetDefault(const G4String& colour)",
"NonExistentColour", JustWarning, o.str().c_str());
("G4TrajectoryDrawByOriginParticleID::SetDefault(const G4String& colour)", "modeling0123", JustWarning, ed);
return;
}
@@ -23,8 +23,8 @@
// * 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: geant4-09-04-beta-01 $
// $Id: G4TrajectoryDrawByParticleID.cc,v 1.11 2010-06-01 21:17:41 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
@@ -32,7 +32,6 @@
#include "G4TrajectoryDrawerUtils.hh"
#include "G4VisTrajContext.hh"
#include "G4VTrajectory.hh"
#include <sstream>
G4TrajectoryDrawByParticleID::G4TrajectoryDrawByParticleID(const G4String& name, G4VisTrajContext* context)
:G4VTrajectoryModel(name, context)
@@ -87,11 +86,11 @@ G4TrajectoryDrawByParticleID::SetDefault(const G4String& colour)
// Will not modify myColour if colour key does not exist
if (!G4Colour::GetColour(colour, myColour)) {
std::ostringstream o;
o << "G4Colour with key "<<colour<<" does not exist ";
G4ExceptionDescription ed;
ed << "G4Colour with key "<<colour<<" does not exist ";
G4Exception
("G4TrajectoryDrawByParticleID::SetDefault(const G4String& colour)",
"NonExistentColour", JustWarning, o.str().c_str());
"modeling0124", JustWarning, ed);
}
SetDefault(myColour);
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// $Id: G4TrajectoryDrawerUtils.cc,v 1.15 2010/11/14 22:13:55 allison Exp $
// GEANT4 tag $Name: geant4-09-04 $
// $Id: G4TrajectoryDrawerUtils.cc,v 1.16 2010-12-11 16:40:16 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -39,16 +39,30 @@
#include "G4VVisManager.hh"
#include "G4UIcommand.hh"
#include "G4AttValue.hh"
#include <sstream>
namespace G4TrajectoryDrawerUtils {
enum TimesValidity {InvalidTimes, ValidTimes};
void GetPoints(const G4VTrajectory& traj,
G4Polyline& trajectoryLine,
G4Polymarker& auxiliaryPoints,
G4Polymarker& stepPoints)
TimesValidity GetPointsAndTimes
(const G4VTrajectory& traj,
const G4VisTrajContext& context,
G4Polyline& trajectoryLine,
G4Polymarker& auxiliaryPoints,
G4Polymarker& stepPoints,
std::vector<G4double>& trajectoryLineTimes,
std::vector<G4double>& auxiliaryPointTimes,
std::vector<G4double>& stepPointTimes)
{
TimesValidity validity = InvalidTimes;
if (context.GetTimeSliceInterval()) validity = ValidTimes;
// Memory for last trajectory point position for auxiliary point
// time interpolation algorithm. There are no auxiliary points
// for the first trajectory point, so its initial value is
// immaterial.
G4ThreeVector lastTrajectoryPointPosition;
// Keep positions. Don't store unless first or different.
std::vector<G4ThreeVector> positions;
@@ -62,6 +76,56 @@ namespace G4TrajectoryDrawerUtils {
if (positions.size() == 0 ||
trajectoryPointPosition != positions[positions.size()-1]) {
// Pre- and Post-Point times from the trajectory point...
G4double trajectoryPointPreTime = -std::numeric_limits<double>::max();
G4double trajectoryPointPostTime = std::numeric_limits<double>::max();
if (context.GetTimeSliceInterval() && validity == ValidTimes) {
std::vector<G4AttValue>* trajectoryPointAttValues =
aTrajectoryPoint->CreateAttValues();
if (!trajectoryPointAttValues) {
static G4bool warnedNoAttValues = false;
if (!warnedNoAttValues) {
G4cout <<
"*************************************************************************"
"\n* WARNING: G4TrajectoryDrawerUtils::GetPointsAndTimes: no att values."
"\n*************************************************************************"
<< G4endl;
warnedNoAttValues = true;
}
validity = InvalidTimes;
} 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 <<
"*************************************************************************"
"\n* WARNING: G4TrajectoryDrawerUtils::GetPointsAndTimes: times not found."
"\n*************************************************************************"
<< G4endl;
warnedTimesNotFound = true;
}
validity = InvalidTimes;
}
}
}
const std::vector<G4ThreeVector>* auxiliaries
= aTrajectoryPoint->GetAuxiliaryPoints();
if (0 != auxiliaries) {
@@ -73,6 +137,19 @@ namespace G4TrajectoryDrawerUtils {
positions.push_back(trajectoryPointPosition);
trajectoryLine.push_back(auxPointPosition);
auxiliaryPoints.push_back(auxPointPosition);
if (validity == ValidTimes) {
// Interpolate time for auxiliary points...
const G4ThreeVector& auxPointPosition = (*auxiliaries)[iAux];
G4double s1 =
(auxPointPosition - lastTrajectoryPointPosition).mag();
G4double s2 =
(trajectoryPointPosition - auxPointPosition).mag();
G4double t = trajectoryPointPreTime +
(trajectoryPointPostTime - trajectoryPointPreTime) *
(s1 / (s1 + s2));
trajectoryLineTimes.push_back(t);
auxiliaryPointTimes.push_back(t);
}
}
}
}
@@ -80,169 +157,14 @@ namespace G4TrajectoryDrawerUtils {
positions.push_back(trajectoryPointPosition);
trajectoryLine.push_back(trajectoryPointPosition);
stepPoints.push_back(trajectoryPointPosition);
}
}
}
/***
void DrawLineAndPoints(const G4VTrajectory& traj, const G4int& i_mode, const G4Colour& colour, const G4bool& visible) {
// If i_mode>=0, draws a trajectory as a polyline (default is blue for
// positive, red for negative, green for neutral) and, if i_mode!=0,
// adds markers - yellow circles for step points and magenta squares
// for auxiliary points, if any - whose screen size in pixels is
// given by std::abs(i_mode)/1000. E.g: i_mode = 5000 gives easily
// visible markers.
static G4bool warnedAboutIMode = false;
std::ostringstream oss;
oss << "WARNING: DEPRECATED use of i_mode (i_mode: " << i_mode
<< "). Feature will be removed at a future major release.";
if (!warnedAboutIMode) {
G4Exception
("G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, i_mode, colour, visible)",
"",
JustWarning,
oss.str().c_str());
warnedAboutIMode = true;
}
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (0 == pVVisManager) return;
const G4double markerSize = std::abs(i_mode)/1000;
G4bool lineRequired (i_mode >= 0);
G4bool markersRequired (markerSize > 0.);
// Return if don't need to do anything
if (!lineRequired && !markersRequired) return;
// Get points to draw
G4Polyline trajectoryLine;
G4Polymarker stepPoints;
G4Polymarker auxiliaryPoints;
GetPoints(traj, trajectoryLine, auxiliaryPoints, stepPoints);
if (lineRequired) {
G4VisAttributes trajectoryLineAttribs(colour);
trajectoryLineAttribs.SetVisibility(visible);
trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
pVVisManager->Draw(trajectoryLine);
}
if (markersRequired) {
auxiliaryPoints.SetMarkerType(G4Polymarker::squares);
auxiliaryPoints.SetScreenSize(markerSize);
auxiliaryPoints.SetFillStyle(G4VMarker::filled);
G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.)); // Magenta
auxiliaryPointsAttribs.SetVisibility(visible);
auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
pVVisManager->Draw(auxiliaryPoints);
stepPoints.SetMarkerType(G4Polymarker::circles);
stepPoints.SetScreenSize(markerSize);
stepPoints.SetFillStyle(G4VMarker::filled);
G4VisAttributes stepPointsAttribs(G4Colour(1.,1.,0.)); // Yellow.
stepPoints.SetVisAttributes(&stepPointsAttribs);
pVVisManager->Draw(stepPoints);
}
}
***/
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.
// Memory for last trajectory point position for auxiliary point
// algorithm. There are no auxiliary points for the first
// trajectory point, so its initial value is immaterial.
G4ThreeVector lastTrajectoryPointPosition;
// Keep positions. Don't store unless first or different.
std::vector<G4ThreeVector> positions;
for (G4int i=0; i<traj.GetPointEntries(); i++) {
G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(i);
const G4ThreeVector& trajectoryPointPosition =
aTrajectoryPoint->GetPosition();
// Only store if first or if different
if (positions.size() == 0 ||
trajectoryPointPosition != positions[positions.size()-1]) {
// Pre- and Post-Point times from the trajectory point...
G4double trajectoryPointPreTime = -std::numeric_limits<double>::max();
G4double trajectoryPointPostTime = std::numeric_limits<double>::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;
}
if (validity == ValidTimes) {
trajectoryLineTimes.push_back(trajectoryPointPostTime);
stepPointTimes.push_back(trajectoryPointPostTime);
}
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& auxPointPosition = (*auxiliaries)[iAux];
G4double s1 = (auxPointPosition - lastTrajectoryPointPosition).mag();
G4double s2 = (trajectoryPointPosition - auxPointPosition).mag();
G4double t = trajectoryPointPreTime +
(trajectoryPointPostTime - trajectoryPointPreTime) *
(s1 / (s1 + s2));
// Only store if first or if different
if (positions.size() == 0 ||
auxPointPosition != positions[positions.size()-1]) {
positions.push_back(trajectoryPointPosition);
trajectoryLineTimes.push_back(t);
auxiliaryPointTimes.push_back(t);
}
}
}
positions.push_back(trajectoryPointPosition);
trajectoryLineTimes.push_back(trajectoryPointPostTime);
stepPointTimes.push_back(trajectoryPointPostTime);
lastTrajectoryPointPosition = trajectoryPointPosition;
lastTrajectoryPointPosition = trajectoryPointPosition;
}
}
}
return validity;
}
static void SliceLine(G4double timeIncrement,
@@ -393,15 +315,13 @@ namespace G4TrajectoryDrawerUtils {
void DrawLineAndPoints(const G4VTrajectory& traj, const G4VisTrajContext& context, const G4int& i_mode)
{
static G4bool warnedAboutIMode = false;
std::ostringstream oss;
oss << "WARNING: DEPRECATED use of i_mode (i_mode: " << i_mode
G4ExceptionDescription ed;
ed << "WARNING: DEPRECATED use of i_mode (i_mode: " << i_mode
<< "). Feature will be removed at a future major release.";
if (!warnedAboutIMode) {
G4Exception
("G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, context, i_mode)",
"",
JustWarning,
oss.str().c_str());
"modeling0125", JustWarning, ed);
warnedAboutIMode = true;
}
@@ -424,42 +344,32 @@ namespace G4TrajectoryDrawerUtils {
// Return if don't need to do anything
if (!myContext.GetDrawLine() && !myContext.GetDrawAuxPts() && !myContext.GetDrawStepPts()) return;
// Get points to draw
// Get points and times (times are returned only if time-slicing
// is requested).
G4Polyline trajectoryLine;
G4Polymarker stepPoints;
G4Polymarker auxiliaryPoints;
std::vector<G4double> trajectoryLineTimes;
std::vector<G4double> stepPointTimes;
std::vector<G4double> auxiliaryPointTimes;
TimesValidity validity = GetPointsAndTimes
(traj, context,
trajectoryLine, auxiliaryPoints, stepPoints,
trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes);
GetPoints(traj, trajectoryLine, auxiliaryPoints, stepPoints);
if (myContext.GetTimeSliceInterval()) {
if (validity == ValidTimes) {
// Get corresponding track time information, if any
std::vector<G4double> trajectoryLineTimes;
std::vector<G4double> stepPointTimes;
std::vector<G4double> auxiliaryPointTimes;
GetTimes(traj, trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes);
SliceLine(context.GetTimeSliceInterval(),
trajectoryLine, trajectoryLineTimes);
// 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);
}
DrawWithTime(context,
trajectoryLine, auxiliaryPoints, stepPoints,
trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes);
} else {
DrawWithoutTime(myContext, trajectoryLine, auxiliaryPoints, stepPoints);
DrawWithoutTime(context, trajectoryLine, auxiliaryPoints, stepPoints);
}
}
@@ -469,38 +379,28 @@ namespace G4TrajectoryDrawerUtils {
// Return if don't need to do anything
if (!context.GetDrawLine() && !context.GetDrawAuxPts() && !context.GetDrawStepPts()) return;
// Get points to draw
// Get points and times (times are returned only if time-slicing
// is requested).
G4Polyline trajectoryLine;
G4Polymarker stepPoints;
G4Polymarker auxiliaryPoints;
std::vector<G4double> trajectoryLineTimes;
std::vector<G4double> stepPointTimes;
std::vector<G4double> auxiliaryPointTimes;
TimesValidity validity = GetPointsAndTimes
(traj, context,
trajectoryLine, auxiliaryPoints, stepPoints,
trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes);
GetPoints(traj, trajectoryLine, auxiliaryPoints, stepPoints);
if (context.GetTimeSliceInterval()) {
if (validity == ValidTimes) {
// Get corresponding track time information, if any
std::vector<G4double> trajectoryLineTimes;
std::vector<G4double> stepPointTimes;
std::vector<G4double> auxiliaryPointTimes;
GetTimes(traj, trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes);
SliceLine(context.GetTimeSliceInterval(),
trajectoryLine, trajectoryLineTimes);
// Check validity
if (trajectoryLineTimes.size() != trajectoryLine.size() ||
stepPointTimes.size() != stepPoints.size() ||
auxiliaryPointTimes.size() != auxiliaryPoints.size()) {
// Revert to drawing without time information...
DrawWithoutTime(context, trajectoryLine, auxiliaryPoints, stepPoints);
} else {
SliceLine(context.GetTimeSliceInterval(),
trajectoryLine, trajectoryLineTimes);
DrawWithTime(context,
trajectoryLine, auxiliaryPoints, stepPoints,
trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes);
}
DrawWithTime(context,
trajectoryLine, auxiliaryPoints, stepPoints,
trajectoryLineTimes, auxiliaryPointTimes, stepPointTimes);
} else {
@@ -23,8 +23,8 @@
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
/// $Id: G4TrajectoryFilterFactories.cc,v 1.5 2006/09/12 18:53:03 tinslay Exp $
// GEANT4 tag $Name: geant4-09-02 $
/// $Id: G4TrajectoryFilterFactories.cc,v 1.5 2006-09-12 18:53:03 tinslay Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// Trajectory filter model factories creating filters
@@ -23,8 +23,8 @@
// * 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: geant4-09-04-beta-01 $
// $Id: G4TrajectoryGenericDrawer.cc,v 1.3 2010-05-11 11:31:31 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Jane Tinslay May 2006
//
@@ -23,8 +23,8 @@
// * 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: geant4-09-02 $
// $Id: G4TrajectoryModelFactories.cc,v 1.7 2006-09-12 18:53:03 tinslay Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Jane Tinslay, John Allison, Joseph Perl October 2005
@@ -23,8 +23,8 @@
// * 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: geant4-09-02 $
// $Id: G4TrajectoryOriginVolumeFilter.cc,v 1.3 2006-08-25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Filter trajectories according to volume name. Only registered
// volumes will pass the filter.
@@ -23,8 +23,8 @@
// * 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: geant4-09-02 $
// $Id: G4TrajectoryParticleFilter.cc,v 1.3 2006-08-25 19:44:14 tinslay Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Filter trajectories according to particle type. Only registered
// particle types will pass the filter.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4VModel.cc,v 1.14 2006/11/01 10:33:00 allison Exp $
// GEANT4 tag $Name: geant4-09-02 $
// $Id: G4VModel.cc,v 1.14 2006-11-01 10:33:00 allison Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
//
// John Allison 31st December 1997.
@@ -23,8 +23,8 @@
// * 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: geant4-09-02 $
// $Id: G4VTrajectoryModel.cc,v 1.3 2006-06-29 21:33:26 gunter Exp $
// GEANT4 tag $Name: not supported by cvs2svn $
//
// Jane Tinslay May 2006
//