Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
+2 -3
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.9 2005/02/15 14:51:15 johna Exp $
# $Id: GNUmakefile,v 1.11 2006/05/22 08:49:27 allison Exp $
# --------------------------------------------------------------
# GNUmakefile for modeling library. John Allison, 31/12/1997.
# --------------------------------------------------------------
@@ -9,7 +9,7 @@ ifndef G4INSTALL
G4INSTALL = ../../..
endif
GLOBLIBS = libG4run.lib libG4event.lib
GLOBLIBS = libG4event.lib
GLOBLIBS += libG4tracking.lib libG4processes.lib libG4digits_hits.lib
GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
@@ -30,7 +30,6 @@ CPPFLAGS += -I$(G4BASE)/materials/include
CPPFLAGS += -I$(G4BASE)/global/HEPRandom/include
CPPFLAGS += -I$(G4BASE)/processes/management/include
CPPFLAGS += -I$(G4BASE)/particles/management/include
CPPFLAGS += -I$(G4BASE)/run/include
CPPFLAGS += -I$(G4BASE)/event/include
CPPFLAGS += -I$(G4BASE)/digits_hits/hits/include
CPPFLAGS += -I$(G4BASE)/digits_hits/digits/include
+101 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.46 2005/12/05 00:16:34 perl Exp $
$Id: History,v 1.73 2006/06/07 22:14:04 allison Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,106 @@ committal in the CVS repository !
History file for visualization/modeling
---------------------------------------
7th June 2006 John Allison (modeling-V08-00-14)
- G4PhysicalVolumeModel.cc: Added protection for zero vis atts.
6th June 2006 John Allison (modeling-V08-00-13)
- G4TrajectoryChargeFilter.cc: Added #include <sstream> for Sun compiler.
- G4PhysicalVolumeModel::Validate: Relaxed requirement for modeling parameters.
(Caused crash after change of geometry.)
2nd June 2006 Joseph Perl (modeling-V08-00-12)
- G4VisTrajContext: change default of point sizes from 0 to 2
30th May 2006 Jane Tinslay
- Add G4TrajectoryChargeFilter and G4TrajectoryOriginVolumeFilter
25th May 2006 John Allison (modeling-V08-00-11)
- G4VModelFactory.hh: Indent printing of models.
- G4ModelApplyCommandsT.hh: Fix trivial compiler warnings.
22nd May 2006 John Allison (modeling-V08-00-10)
- Remove dependency on Run.
- G4ModelingParameters.cc: Protect operator<< for zero fpDefaultVisAttributes.
12th May 2006 John Allison (modeling-V08-00-09)
- G4TrajectoriesModel and G4HitsModel: Removed dependency on G4RunManager.
Uses G4RunManagerKernel. Needs event-V08-00-01.
- G4CallbackModel: Added G4VGraphicsScene argument to operator().
4th May 2006 Joseph Perl (modeling-V08-00-08)
- Add missing assert to G4VTrajectoryModel needed by Windows.
4th May 2006 John Allison
- Improved protection for null models and parameters.
2nd May 2006 Jane Tinslay
- Add context to trajectory drawers. Intended to replace imode.
Allows to configure default drawing style for lines, step and
auxiliary points. For example, colours, visibility, point sizes,
fill styles..
- Add generic drawer, G4TrajectoryGenericDrawer. Draws all trajectories
in the same style, based on its default context.
- Update generic commands
- Add verbose to drawers
21st April 2006 Jane Tinslay (modeling-V08-00-07)
- Get rid of some warning messages from G4ModelCommandsT
when compiling on Linux
- Add Print method to G4VModelFactory
19th April 2006 John Allison (modeling-V08-00-06 - needs greps-V08-00-02)
- G4BoundingSphereScene.hh, G4PhysicalVolumeMassScene.hh and
G4PhysicalVolumeSearchScene.hh; Added dummy Begin/EndPrimitives2D
for greps-V08-00-02.
- G4PhysicalVolumeModel.cc: Improved legibility and efficiency of
culling algorithm.
28th March 2006 Jane Tinslay (jst28032006)
- Add G4TrajectoryFilterFactories and G4TrajectoryParticleFilter
for trajectory filtering.
- Add more generic commands to G4ModelCommandsT
28th March 2006 John Allison (modeling-V08-00-05)
- G4PhysicalVolumeMassScene and G4PhysicalVolumeSearchScene:
o Removed EstablishSpecials.
- G4PhysicalVolumeModel:
o GetTopPhysicalVolume, GetCurrentPV, GetCurrentLV,
GetCurrentMaterial: return non-const pointers. (It has proved
impossibly difficult to deal with const pointers.)
o Modified for new G4PhysicalVolumeSearchScene constructor.
- G4BoundingSphereScene: Removed use of GetG4PhysicalVolumeModel (uses
dynamic cast instead).
24th March 2006 Jane Tinslay (jst24032006)
- Add G4bool visibility parameter to trajectory draw
models "Draw" method.
16th March 2006 Jane Tinslay (jst16032006)
- Template commands and colour map used in trajectory models
- Introduce G4TrajectoryDrawByOriginVolume
14th March 2006 John Allison (modeling-V08-00-04)
- G4PhysicalVolumeModel::G4PhysicalVolumeNodeID: Added output operator<<.
16th February 2006 John Allison (modeling-V08-00-03)
- G4PhysicalVolumeModel: Minor enhancements to facilitate future
removal of Establish/DecommisionSpecials.
8th February 2006 John Allison (modeling-V08-00-02)
- Added DrawingStyle to G4ModelingParameters.
- G4PhysicalVolumeModel: Fixed bug in culling of covered daughters and
improved readability of culling algorithm.
26th January 2006 John Allison (modeling-V08-00-01)
- G4PhysicalVolumeModel: Added capability of maintaining path of the
current drawn (non-culled) volume in terms of drawn (non-culled)
ancesters. See G4PhysicalVolumeModel.hh for detailed description.
- Removed some unnecessary data members and other small tidying.
11th January 2006 John Allison (modeling-V08-00-00)
- G4NullModel.cc: Changed G4Transform3D::Identity to G4Transform3D().
2nd December 2005 Joseph Perl (modeling-V07-01-07)
- Change "G4String inline" to "inline G4String" to correct compiler
warning in G4VTrajectoryModel.hh.
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4AxesModel.hh,v 1.4 2001/08/24 20:34:14 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4AxesModel.hh,v 1.5 2006/06/29 21:30:04 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 3rd April 2001
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4AxesModel.icc,v 1.3 2001/08/24 20:34:15 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4AxesModel.icc,v 1.4 2006/06/29 21:30:06 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
inline G4String G4AxesModel::GetCurrentTag () const {
return fGlobalTag;
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4BoundingSphereScene.hh,v 1.15 2005/06/07 16:54:33 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4BoundingSphereScene.hh,v 1.17 2006/06/29 21:30:08 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 7th June 1997
@@ -87,6 +90,8 @@ public:
virtual void BeginPrimitives (const G4Transform3D&) {}
virtual void EndPrimitives () {}
virtual void BeginPrimitives2D () {}
virtual void EndPrimitives2D () {}
virtual void AddPrimitive (const G4Polyline&) {}
virtual void AddPrimitive (const G4Scale&) {}
virtual void AddPrimitive (const G4Text&) {}
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4CallbackModel.hh,v 1.3 2005/03/03 16:22:02 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4CallbackModel.hh,v 1.5 2006/06/29 21:30:10 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 31st December 1997.
@@ -30,19 +33,21 @@
// Class Description:
//
// G4CallbackModel calls a user-defined function containing, for
// example, calls to the Draw methods of G4VVisManager. This allows
// the user to add his own graphical objects to a scene. The idea is
// that the callback function is invoked by the vis system to refresh
// the screen or remake a graphical database whenever required.
// example, calls to the Draw methods of G4VVisManager or the
// *Primitive* methods of G4VGraphicsScene. This allows the user to
// add his own graphical objects to a scene. The idea is that the
// callback function is invoked by the vis system to refresh the
// screen or remake a graphical database whenever required. The
// function class must contain:
//
// The user instantiates a function object containing, for example,
// calls to the Draw methods of G4VVisManager. A base class
// G4VUserVisAction is provided in the visualisation category. A
// G4CallbackModel is made by instantiating this template with a
// pointer to the function object. The G4VisManager does this for the
// user if he/she registers it (SetUserAction) and issues the command
// /vis/scene/add/userAction. See the User Guide for Application
// Developers, Section 8.8.7 and 8.8.8.
// void operator()(G4VGraphicsScene&, const G4Transform3D&)
//
// A base class G4VUserVisAction is provided in the visualisation
// category. A G4CallbackModel is made by instantiating this template
// with a pointer to the function object. The G4VisManager does this
// for the user if he/she registers it (SetUserAction) and issues the
// command /vis/scene/add/userAction. See the User Guide for
// Application Developers, Section 8.8.7 and 8.8.8.
#ifndef G4CALLBACKMODEL_HH
#define G4CALLBACKMODEL_HH
@@ -55,8 +60,8 @@ template <class F> class G4CallbackModel: public G4VModel {
G4CallbackModel(F* function):
fFunction(function) {}
~G4CallbackModel() {}
void DescribeYourselfTo(G4VGraphicsScene&) {
(*fFunction)(fTransform);
void DescribeYourselfTo(G4VGraphicsScene& sceneHandler) {
(*fFunction)(sceneHandler, fTransform);
}
protected:
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4FlavoredParallelWorldModel.hh,v 1.7 2005/11/22 16:29:40 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4FlavoredParallelWorldModel.hh,v 1.8 2006/06/29 21:30:12 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// P. Mora de Freitas et M.Verderi - 19 June 1998.
//
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4HitsModel.hh,v 1.7 2001/08/24 20:36:13 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4HitsModel.hh,v 1.8 2006/06/29 21:30:14 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 26th August 1998.
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4HitsModel.icc,v 1.6 2001/08/24 20:36:14 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4HitsModel.icc,v 1.7 2006/06/29 21:30:16 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
inline G4String G4HitsModel::GetCurrentTag () const {
return fGlobalTag;
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4LogicalVolumeModel.hh,v 1.7 2005/11/22 16:29:40 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4LogicalVolumeModel.hh,v 1.8 2006/06/29 21:30:18 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 26th July 1999.
@@ -0,0 +1,492 @@
//
// ********************************************************************
// * 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: G4ModelApplyCommandsT.hh,v 1.3 2006/06/29 21:30:20 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Abstract model messenges. Derived classes should implement
// the "Apply" method
//
// Jane Tinslay April 2006
//
#ifndef G4APPLYCOMMANDST_HH
#define G4APPLYCOMMANDST_HH
#include "G4Colour.hh"
#include "G4String.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcommand.hh"
#include "G4VModelCommand.hh"
#include "globals.hh"
#include <sstream>
///////////////////////////////////////////////////////////////////////////
// ApplyStringColour command
template <typename M>
class G4ModelCmdApplyStringColour : public G4VModelCommand<M> {
public: // With description
G4ModelCmdApplyStringColour(M* model, const G4String& placement, const G4String& cmdName);
virtual ~G4ModelCmdApplyStringColour();
void SetNewValue(G4UIcommand* command, G4String newValue);
protected:
// Implement in derived class
virtual void Apply(const G4String&, const G4Colour&) = 0;
G4UIcommand* StringCommand() {return fpStringCmd;}
G4UIcommand* ComponentCommand() {return fpComponentCmd;}
private:
G4UIcommand* fpStringCmd;
G4UIcommand* fpComponentCmd;
};
template <typename M>
G4ModelCmdApplyStringColour<M>::G4ModelCmdApplyStringColour(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
{
//Set variable colour through a string
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
G4UIparameter* param(0);
fpStringCmd = new G4UIcommand(dir, this);
fpStringCmd->SetGuidance("Set variable colour through a string");
param = new G4UIparameter("Variable", 's', false);
fpStringCmd->SetParameter(param);
param = new G4UIparameter("Value", 's', false);
fpStringCmd->SetParameter(param);
//Set variable colour through RGBA components
G4String componentDir = dir+"RGBA";
fpComponentCmd = new G4UIcommand(componentDir, this);
fpComponentCmd->SetGuidance("Set variable colour through red, green, blue and alpha components");
param = new G4UIparameter("Variable", 's', false);
fpComponentCmd->SetParameter(param);
param = new G4UIparameter("Red component", 'd', false);
fpComponentCmd->SetParameter(param);
param = new G4UIparameter("Green component", 'd', false);
fpComponentCmd->SetParameter(param);
param = new G4UIparameter("Blue component", 'd', false);
fpComponentCmd->SetParameter(param);
param = new G4UIparameter("Alpha component", 'd', false);
fpComponentCmd->SetParameter(param);
}
template <typename M>
G4ModelCmdApplyStringColour<M>::~G4ModelCmdApplyStringColour()
{
delete fpStringCmd;
delete fpComponentCmd;
}
template <typename M>
void G4ModelCmdApplyStringColour<M>::SetNewValue(G4UIcommand* cmd, G4String newValue)
{
G4Colour myColour;
G4String parameter;
if (cmd == fpStringCmd) {
G4String colour;
std::istringstream is (newValue);
is >> parameter >> colour;
// Colour key should exist
if (!G4Colour::GetColour(colour, myColour)) {
std::ostringstream o;
o << "G4Colour with key "<<colour<<" does not exist ";
G4Exception
("G4ModelCmdApplyStringColour<M>::SetNewValue",
"NonExistentColour", JustWarning, o.str().c_str());
return;
}
}
if (cmd == fpComponentCmd) {
G4double red(0), green(0), blue(0), alpha(0);
std::istringstream is (newValue);
is >> parameter >> red >> green >> blue >> alpha;
G4Colour colour(red, green, blue, alpha);
myColour = colour;
}
Apply(parameter, myColour);
}
///////////////////////////////////////////////////////////////////////////
//ApplyColour command
template <typename M>
class G4ModelCmdApplyColour : public G4VModelCommand<M> {
public: // With description
G4ModelCmdApplyColour(M* model, const G4String& placement, const G4String& cmdName);
virtual ~G4ModelCmdApplyColour();
void SetNewValue(G4UIcommand* command, G4String newValue);
protected:
// Implement in derived class
virtual void Apply(const G4Colour&) = 0;
G4UIcommand* StringCommand() {return fpStringCmd;}
G4UIcommand* ComponentCommand() {return fpComponentCmd;}
private:
G4UIcommand* fpStringCmd;
G4UIcommand* fpComponentCmd;
};
template <typename M>
G4ModelCmdApplyColour<M>::G4ModelCmdApplyColour(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
{
//Set colour through a string
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
G4UIparameter* param(0);
fpStringCmd = new G4UIcommand(dir, this);
fpStringCmd->SetGuidance("Set colour through a string");
param = new G4UIparameter("Variable", 's', false);
fpStringCmd->SetParameter(param);
//Set colour through RGBA components
G4String componentDir = dir+"RGBA";
fpComponentCmd = new G4UIcommand(componentDir, this);
fpComponentCmd->SetGuidance("Set colour through red, green, blue and alpha components");
fpComponentCmd->SetGuidance("Four inputs are expected.");
param = new G4UIparameter("Red component", 'd', false);
fpComponentCmd->SetParameter(param);
param = new G4UIparameter("Green component", 'd', false);
fpComponentCmd->SetParameter(param);
param = new G4UIparameter("Blue component", 'd', false);
fpComponentCmd->SetParameter(param);
param = new G4UIparameter("Alpha component", 'd', false);
fpComponentCmd->SetParameter(param);
}
template <typename M>
G4ModelCmdApplyColour<M>::~G4ModelCmdApplyColour()
{
delete fpStringCmd;
delete fpComponentCmd;
}
template <typename M>
void G4ModelCmdApplyColour<M>::SetNewValue(G4UIcommand* cmd, G4String newValue)
{
G4Colour myColour;
if (cmd == fpStringCmd) {
G4String colour;
std::istringstream is (newValue);
is >> colour;
// Colour key should exist
if (!G4Colour::GetColour(colour, myColour)) {
std::ostringstream o;
o << "G4Colour with key "<<colour<<" does not exist ";
G4Exception
("G4ModelCmdApplyColour<M>::SetNewValue",
"NonExistentColour", JustWarning, o.str().c_str());
return;
}
}
if (cmd == fpComponentCmd) {
G4double red(0), green(0), blue(0), alpha(0);
std::istringstream is (newValue);
is >> red >> green >> blue >> alpha;
G4Colour colour(red, green, blue, alpha);
myColour = colour;
}
Apply(myColour);
}
///////////////////////////////////////////////////////////////////////////
//ApplyBool command
template <typename M>
class G4ModelCmdApplyBool : public G4VModelCommand<M> {
public: // With description
G4ModelCmdApplyBool(M* model, const G4String& placement, const G4String& cmdName);
virtual ~G4ModelCmdApplyBool();
void SetNewValue(G4UIcommand* command, G4String newValue);
protected:
// Implement in derived class
virtual void Apply(const G4bool&) = 0;
G4UIcmdWithABool* Command() {return fpCmd;}
private:
G4UIcmdWithABool* fpCmd;
};
template <typename M>
G4ModelCmdApplyBool<M>::G4ModelCmdApplyBool(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
{
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
fpCmd = new G4UIcmdWithABool(dir, this);
fpCmd->SetParameterName("Bool", false);
}
template <typename M>
G4ModelCmdApplyBool<M>::~G4ModelCmdApplyBool()
{
delete fpCmd;
}
template <typename M>
void G4ModelCmdApplyBool<M>::SetNewValue(G4UIcommand*, G4String newValue)
{
Apply(fpCmd->GetNewBoolValue(newValue));
}
///////////////////////////////////////////////////////////////////////////
//ApplyNull command
template <typename M>
class G4ModelCmdApplyNull : public G4VModelCommand<M> {
public: // With description
G4ModelCmdApplyNull(M* model, const G4String& placement, const G4String& cmdName);
virtual ~G4ModelCmdApplyNull();
void SetNewValue(G4UIcommand* command, G4String newValue);
protected:
// Implement in derived class
virtual void Apply() = 0;
G4UIcommand* Command() {return fpCmd;}
private:
G4UIcommand* fpCmd;
};
template <typename M>
G4ModelCmdApplyNull<M>::G4ModelCmdApplyNull(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
{
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
fpCmd = new G4UIcommand(dir, this);
}
template <typename M>
G4ModelCmdApplyNull<M>::~G4ModelCmdApplyNull()
{
delete fpCmd;
}
template <typename M>
void G4ModelCmdApplyNull<M>::SetNewValue(G4UIcommand*, G4String)
{
Apply();
}
///////////////////////////////////////////////////////////////////////////
//ApplyDouble command
template <typename M>
class G4ModelCmdApplyDouble : public G4VModelCommand<M> {
public: // With description
G4ModelCmdApplyDouble(M* model, const G4String& placement, const G4String& cmdName);
virtual ~G4ModelCmdApplyDouble();
void SetNewValue(G4UIcommand* command, G4String newValue);
protected:
// Implement in derived class
virtual void Apply(const G4double&) = 0;
G4UIcmdWithADouble* Command() {return fpCmd;}
private:
G4UIcmdWithADouble* fpCmd;
};
template <typename M>
G4ModelCmdApplyDouble<M>::G4ModelCmdApplyDouble(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
{
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
fpCmd = new G4UIcmdWithADouble(dir, this);
fpCmd->SetParameterName("Double", false);
}
template <typename M>
G4ModelCmdApplyDouble<M>::~G4ModelCmdApplyDouble()
{
delete fpCmd;
}
template <typename M>
void G4ModelCmdApplyDouble<M>::SetNewValue(G4UIcommand*, G4String newValue)
{
Apply(fpCmd->GetNewDoubleValue(newValue));
}
///////////////////////////////////////////////////////////////////////////
// ApplyInteger command
template <typename M>
class G4ModelCmdApplyInteger : public G4VModelCommand<M> {
public: // With description
G4ModelCmdApplyInteger(M* model, const G4String& placement, const G4String& cmdName);
virtual ~G4ModelCmdApplyInteger();
void SetNewValue(G4UIcommand* command, G4String newValue);
protected:
// Implement in derived class
virtual void Apply(const G4int&) = 0;
G4UIcmdWithAnInteger* Command() {return fpCmd;}
private:
G4UIcmdWithAnInteger* fpCmd;
};
template <typename M>
G4ModelCmdApplyInteger<M>::G4ModelCmdApplyInteger(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
{
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
fpCmd = new G4UIcmdWithAnInteger(dir, this);
fpCmd->SetParameterName("Integer", false);
}
template <typename M>
G4ModelCmdApplyInteger<M>::~G4ModelCmdApplyInteger()
{
delete fpCmd;
}
template <typename M>
void G4ModelCmdApplyInteger<M>::SetNewValue(G4UIcommand* cmd, G4String newValue)
{
Apply(fpCmd->GetNewIntValue(newValue));
}
///////////////////////////////////////////////////////////////////////////
// ApplyString command
template <typename M>
class G4ModelCmdApplyString : public G4VModelCommand<M> {
public: // With description
G4ModelCmdApplyString(M* model, const G4String& placement, const G4String& cmdName);
virtual ~G4ModelCmdApplyString();
void SetNewValue(G4UIcommand* command, G4String newValue);
protected:
// Implement in derived class
virtual void Apply(const G4String&) = 0;
G4UIcmdWithAString* Command() {return fpCmd;}
private:
G4UIcmdWithAString* fpCmd;
};
template <typename M>
G4ModelCmdApplyString<M>::G4ModelCmdApplyString(M* model, const G4String& placement, const G4String& cmdName)
:G4VModelCommand<M>(model)
{
G4String dir = placement+"/"+model->Name()+"/"+cmdName;
fpCmd = new G4UIcmdWithAString(dir, this);
}
template <typename M>
G4ModelCmdApplyString<M>::~G4ModelCmdApplyString()
{
delete fpCmd;
}
template <typename M>
void G4ModelCmdApplyString<M>::SetNewValue(G4UIcommand*, G4String newValue)
{
Apply(newValue);
}
#endif
@@ -0,0 +1,129 @@
//
// ********************************************************************
// * 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: G4ModelColourMap.hh,v 1.2 2006/06/29 21:30:22 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Generic variable->G4Colour map, where "variable" is the template
// parameter.
//
// Jane Tinslay March 2006
#ifndef G4MODELCOLOURMAP_HH
#define G4MODELCOLOURMAP_HH
#include "G4Colour.hh"
#include "G4String.hh"
#include <map>
template <typename T>
class G4ModelColourMap {
public: // With description
G4ModelColourMap();
virtual ~G4ModelColourMap();
// Configuration functions
void Set(const T&, const G4Colour&);
void Set(const T&, const G4String&);
G4Colour& operator[](const T& quantity);
// Access functions
bool GetColour(const T&, G4Colour&) const;
void Print(std::ostream& ostr) const;
private:
// Data member
std::map<T, G4Colour> fMap;
};
template <typename T>
G4Colour&
G4ModelColourMap<T>::operator[](const T& quantity) {return fMap[quantity];}
template <typename T>
G4ModelColourMap<T>::G4ModelColourMap() {}
template <typename T>
G4ModelColourMap<T>::~G4ModelColourMap() {}
template <typename T>
void
G4ModelColourMap<T>::Set(const T& quantity, const G4String& colour)
{
G4Colour myColour;
// Will not setup the map if colour key does not exist
if (!G4Colour::GetColour(colour, myColour)) {
std::ostringstream o;
o << "G4Colour with key "<<colour<<" does not exist ";
G4Exception
("G4ColourMap::Set(Charge charge, const G4String& colour)",
"NonExistentColour", JustWarning, o.str().c_str());
return;
}
// Will not modify myColour if colour key does not exist
Set(quantity, myColour);
}
template <typename T>
void
G4ModelColourMap<T>::Set(const T& quantity, const G4Colour& colour)
{
fMap[quantity] = colour;
}
template <typename T>
bool
G4ModelColourMap<T>::GetColour(const T& quantity, G4Colour& colour) const
{
typename std::map<T, G4Colour>::const_iterator iter = fMap.find(quantity);
if (iter != fMap.end()) {
colour = iter->second;
return true;
}
return false;
}
template <typename T>
void
G4ModelColourMap<T>::Print(std::ostream& ostr) const
{
typename std::map<T, G4Colour>::const_iterator iter = fMap.begin();
while (iter != fMap.end()) {
ostr<< iter->first <<" : "<< iter->second <<G4endl;
iter++;
}
}
#endif
@@ -1,74 +0,0 @@
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4ModelCommandsDrawByCharge.hh,v 1.2 2005/11/23 05:19:23 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
// Class Description
// Trajectory model commands.
// Class Description - End:
#ifndef G4MODELCOMMANDDRAWBYCHARGE_HH
#define G4MODELCOMMANDDRAWBYCHARGE_HH
#include "G4String.hh"
#include "G4VModelCommand.hh"
class G4TrajectoryDrawByCharge;
class G4UIcmdWithAString;
class G4UIcommand;
// Command to set positive/negative/neutral trajectory colouring through a string
class G4ModelCommandDrawByChargeSet : public G4VModelCommand<G4TrajectoryDrawByCharge> {
public: // With description
G4ModelCommandDrawByChargeSet(G4TrajectoryDrawByCharge* model, const G4String& placement);
virtual ~G4ModelCommandDrawByChargeSet();
void SetNewValue(G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
// Command to set positive/negative/neutral trajectory colouring through G4Colour components
class G4ModelCommandDrawByChargeSetRGBA : public G4VModelCommand<G4TrajectoryDrawByCharge> {
public:
G4ModelCommandDrawByChargeSetRGBA(G4TrajectoryDrawByCharge* model, const G4String& placement) ;
virtual ~G4ModelCommandDrawByChargeSetRGBA();
void SetNewValue(G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
#endif
@@ -1,107 +0,0 @@
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4ModelCommandsDrawByParticleID.hh,v 1.2 2005/11/23 20:24:15 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
// Class Description
// Trajectory model commands.
// Class Description - End:
#ifndef G4MODELCOMMANDDRAWBYPARTICLEID_HH
#define G4MODELCOMMANDDRAWBYPARTICLEID_HH
#include "G4String.hh"
#include "G4VModelCommand.hh"
class G4TrajectoryDrawByParticleID;
class G4UIcmdWithAString;
class G4UIcommand;
// Command to set positive/negative/neutral trajectory colouring through a string
class G4ModelCommandDrawByParticleIDSet : public G4VModelCommand<G4TrajectoryDrawByParticleID> {
public: // With description
G4ModelCommandDrawByParticleIDSet(G4TrajectoryDrawByParticleID* model, const G4String& placement);
virtual ~G4ModelCommandDrawByParticleIDSet();
void SetNewValue(G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
// Command to set default positive/negative/neutral trajectory colouring through G4Colour components
class G4ModelCommandDrawByParticleIDSetRGBA : public G4VModelCommand<G4TrajectoryDrawByParticleID> {
public:
G4ModelCommandDrawByParticleIDSetRGBA(G4TrajectoryDrawByParticleID* model, const G4String& placement) ;
virtual ~G4ModelCommandDrawByParticleIDSetRGBA();
void SetNewValue(G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
// Command to set default positive/negative/neutral trajectory colouring through a string
class G4ModelCommandDrawByParticleIDSetDefault : public G4VModelCommand<G4TrajectoryDrawByParticleID> {
public: // With description
G4ModelCommandDrawByParticleIDSetDefault(G4TrajectoryDrawByParticleID* model, const G4String& placement);
virtual ~G4ModelCommandDrawByParticleIDSetDefault();
void SetNewValue(G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
// Command to set default positive/negative/neutral trajectory colouring through G4Colour components
class G4ModelCommandDrawByParticleIDSetDefaultRGBA : public G4VModelCommand<G4TrajectoryDrawByParticleID> {
public:
G4ModelCommandDrawByParticleIDSetDefaultRGBA(G4TrajectoryDrawByParticleID* model, const G4String& placement) ;
virtual ~G4ModelCommandDrawByParticleIDSetDefaultRGBA();
void SetNewValue(G4UIcommand* command, G4String newValue);
private:
G4UIcmdWithAString* fpCommand;
};
#endif
@@ -0,0 +1,611 @@
//
// ********************************************************************
// * 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: G4ModelCommandsT.hh,v 1.7 2006/06/29 21:30:24 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Generic model messenges.
//
// Jane Tinslay March 2006
//
#ifndef G4MODELCOMMANDST_HH
#define G4MODELCOMMANDST_HH
#include "G4ModelApplyCommandsT.hh"
#include "G4Polymarker.hh"
#include "G4UIdirectory.hh"
#include <sstream>
////////////////////////////////////////////////////////////////////////
// Set parameter colour
template <typename M>
class G4ModelCmdSetStringColour : public G4ModelCmdApplyStringColour<M> {
public: // With description
G4ModelCmdSetStringColour(M* model, const G4String& placement)
:G4ModelCmdApplyStringColour<M>(model, placement, "set") {}
virtual ~G4ModelCmdSetStringColour() {}
protected:
virtual void Apply(const G4String& param, const G4Colour& colour) {
G4VModelCommand<M>::Model()->Set(param, colour);
}
};
////////////////////////////////////////////////////////////////////////
// Set default colour
template <typename M>
class G4ModelCmdSetDefaultColour : public G4ModelCmdApplyColour<M> {
public: // With description
G4ModelCmdSetDefaultColour(M* model, const G4String& placement)
:G4ModelCmdApplyColour<M>(model, placement, "setDefault") {}
virtual ~G4ModelCmdSetDefaultColour() {}
protected:
virtual void Apply(const G4Colour& colour) {
G4VModelCommand<M>::Model()->SetDefault(colour);
}
};
////////////////////////////////////////////////////////////////////////
// Add string command
template <typename M>
class G4ModelCmdAddString : public G4ModelCmdApplyString<M> {
public: // With description
G4ModelCmdAddString(M* model, const G4String& placement)
:G4ModelCmdApplyString<M>(model, placement, "add")
{
G4ModelCmdApplyString<M>::Command()->SetGuidance("Add command");
}
virtual ~G4ModelCmdAddString() {}
protected:
virtual void Apply(const G4String& newValue) {
G4VModelCommand<M>::Model()->Add(newValue);
}
};
////////////////////////////////////////////////////////////////////////
//Add integer command
template <typename M>
class G4ModelCmdAddInt : public G4ModelCmdApplyInteger<M> {
public: // With description
G4ModelCmdAddInt(M* model, const G4String& placement)
:G4ModelCmdApplyInteger<M>(model, placement, "add")
{
G4ModelCmdApplyInteger<M>::Command()->SetGuidance("Add command");
}
virtual ~G4ModelCmdAddInt() {}
protected:
virtual void Apply(const G4int& newValue) {
G4VModelCommand<M>::Model()->Add(newValue);
}
};
////////////////////////////////////////////////////////////////////////
// Invert command
template <typename M>
class G4ModelCmdInvert : public G4ModelCmdApplyBool<M> {
public: // With description
G4ModelCmdInvert(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "invert")
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Invert command");
}
virtual ~G4ModelCmdInvert() {}
protected:
virtual void Apply(const G4bool& newValue) {
G4VModelCommand<M>::Model()->SetInvert(newValue);
}
};
////////////////////////////////////////////////////////////////////////
// Active command
template <typename M>
class G4ModelCmdActive : public G4ModelCmdApplyBool<M> {
public: // With description
G4ModelCmdActive(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "active")
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Active command");
}
virtual ~G4ModelCmdActive() {}
protected:
virtual void Apply(const G4bool& newValue) {
G4VModelCommand<M>::Model()->SetActive(newValue);
}
};
////////////////////////////////////////////////////////////////////////
// Verbose command
template <typename M>
class G4ModelCmdVerbose : public G4ModelCmdApplyBool<M> {
public: // With description
G4ModelCmdVerbose(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "verbose")
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Verbose command");
}
virtual ~G4ModelCmdVerbose() {}
protected:
virtual void Apply(const G4bool& newValue) {
G4VModelCommand<M>::Model()->SetVerbose(newValue);
}
};
////////////////////////////////////////////////////////////////////////
// Reset command
template <typename M>
class G4ModelCmdReset : public G4ModelCmdApplyNull<M> {
public: // With description
G4ModelCmdReset(M* model, const G4String& placement)
:G4ModelCmdApplyNull<M>(model, placement, "reset")
{
G4ModelCmdApplyNull<M>::Command()->SetGuidance("Reset command");
}
virtual ~G4ModelCmdReset() {}
protected:
virtual void Apply() {
G4VModelCommand<M>::Model()->Reset();
}
};
////////////////////////////////////////////////////////////////////////
// Set auxiliary points colour command
template <typename M>
class G4ModelCmdSetAuxPtsColour : public G4ModelCmdApplyColour<M> {
public:
G4ModelCmdSetAuxPtsColour(M* model, const G4String& placement)
:G4ModelCmdApplyColour<M>(model, placement, "setAuxPtsColour") {}
protected:
void Apply(const G4Colour& colour) {
G4VModelCommand<M>::Model()->SetAuxPtsColour(colour);
}
};
////////////////////////////////////////////////////////////////////////
// Set set points colour command
template <typename M>
class G4ModelCmdSetStepPtsColour : public G4ModelCmdApplyColour<M> {
public:
G4ModelCmdSetStepPtsColour(M* model, const G4String& placement)
:G4ModelCmdApplyColour<M>(model, placement, "setStepPtsColour") {}
protected:
void Apply(const G4Colour& colour) {
G4VModelCommand<M>::Model()->SetStepPtsColour(colour);
}
};
////////////////////////////////////////////////////////////////////////
// Set draw line command
template <typename M>
class G4ModelCmdSetDrawLine : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetDrawLine(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setDrawLine")
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw line command");
}
protected:
void Apply(const G4bool& myBool) {
G4VModelCommand<M>::Model()->SetDrawLine(myBool);
}
};
////////////////////////////////////////////////////////////////////////
// Set line visibility command
template <typename M>
class G4ModelCmdSetLineVisible : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetLineVisible(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setLineVisible")
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set line visibility command");
}
protected:
void Apply(const G4bool& myBool) {
G4VModelCommand<M>::Model()->SetLineVisible(myBool);
}
};
////////////////////////////////////////////////////////////////////////
// Set draw auxiliary points command
template <typename M>
class G4ModelCmdSetDrawAuxPts : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetDrawAuxPts(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setDrawAuxPts")
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw auxiliary points command");
}
protected:
void Apply(const G4bool& myBool) {
G4VModelCommand<M>::Model()->SetDrawAuxPts(myBool);
}
};
////////////////////////////////////////////////////////////////////////
// Set auxiliary points visibility
template <typename M>
class G4ModelCmdSetAuxPtsVisible : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetAuxPtsVisible(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setAuxPtsVisible")
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set auxiliary points visibility command");
}
protected:
void Apply(const G4bool& myBool) {
G4VModelCommand<M>::Model()->SetAuxPtsVisible(myBool);
}
};
////////////////////////////////////////////////////////////////////////
// Set draw step points command
template <typename M>
class G4ModelCmdSetDrawStepPts : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetDrawStepPts(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setDrawStepPts")
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set draw step points command");
}
protected:
void Apply(const G4bool& myBool) {
G4VModelCommand<M>::Model()->SetDrawStepPts(myBool);
}
};
////////////////////////////////////////////////////////////////////////
// Set step points visible command
template <typename M>
class G4ModelCmdSetStepPtsVisible : public G4ModelCmdApplyBool<M> {
public:
G4ModelCmdSetStepPtsVisible(M* model, const G4String& placement)
:G4ModelCmdApplyBool<M>(model, placement, "setStepPtsVisible")
{
G4ModelCmdApplyBool<M>::Command()->SetGuidance("Set step points colour command");
}
protected:
void Apply(const G4bool& myBool) {
G4VModelCommand<M>::Model()->SetStepPtsVisible(myBool);
}
};
////////////////////////////////////////////////////////////////////////
// Set auxiliary points size command
template <typename M>
class G4ModelCmdSetAuxPtsSize : public G4ModelCmdApplyDouble<M> {
public:
G4ModelCmdSetAuxPtsSize(M* model, const G4String& placement)
:G4ModelCmdApplyDouble<M>(model, placement, "setAuxPtsSize")
{
G4ModelCmdApplyDouble<M>::Command()->SetGuidance("Set auxiliary points size command");
}
protected:
void Apply(const G4double& myDouble) {
G4VModelCommand<M>::Model()->SetAuxPtsSize(myDouble);
}
};
////////////////////////////////////////////////////////////////////////
// Set step points size command
template <typename M>
class G4ModelCmdSetStepPtsSize : public G4ModelCmdApplyDouble<M> {
public:
G4ModelCmdSetStepPtsSize(M* model, const G4String& placement)
:G4ModelCmdApplyDouble<M>(model, placement, "setStepPtsSize")
{
G4ModelCmdApplyDouble<M>::Command()->SetGuidance("Set step points colour command");
}
protected:
void Apply(const G4double& myDouble) {
G4VModelCommand<M>::Model()->SetStepPtsSize(myDouble);
}
};
////////////////////////////////////////////////////////////////////////
// Set step points type command
template <typename M>
class G4ModelCmdSetStepPtsType : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetStepPtsType(M* model, const G4String& placement)
:G4ModelCmdApplyString<M>(model, placement, "setStepPtsType")
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Set step points type.");
cmd->SetCandidates("dots circles squares");
}
protected:
void Apply(const G4String& type) {
G4Polymarker::MarkerType myType;
if (type == "dots") {myType = G4Polymarker::dots;}
else if (type == "circles") {myType = G4Polymarker::circles;}
else if (type == "squares") {myType = G4Polymarker::squares;}
else {
std::ostringstream o;
o << "Invalid argument. See command guidance for options.";
G4Exception
("G4ModelCmdSetStepPtsType::Apply",
"InvalidArgument", JustWarning, o.str().c_str());
return;
}
G4VModelCommand<M>::Model()->SetStepPtsType(myType);
}
};
////////////////////////////////////////////////////////////////////////
// Set auxiliary points type command
template <typename M>
class G4ModelCmdSetAuxPtsType : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetAuxPtsType(M* model, const G4String& placement)
:G4ModelCmdApplyString<M>(model, placement, "setAuxPtsType")
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Set auxiliary points type.");
cmd->SetCandidates("dots circles squares");
}
protected:
void Apply(const G4String& type) {
G4Polymarker::MarkerType myType;
if (type == "dots") {myType = G4Polymarker::dots;}
else if (type == "circles") {myType = G4Polymarker::circles;}
else if (type == "squares") {myType = G4Polymarker::squares;}
else {
std::ostringstream o;
o << "Invalid argument. See command guidance for options.";
G4Exception
("G4ModelCmdSetAuxPtsType::Apply",
"InvalidArgument", JustWarning, o.str().c_str());
return;
}
G4VModelCommand<M>::Model()->SetAuxPtsType(myType);
}
};
////////////////////////////////////////////////////////////////////////
// Set step points fill style command
template <typename M>
class G4ModelCmdSetStepPtsFillStyle : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetStepPtsFillStyle(M* model, const G4String& placement)
:G4ModelCmdApplyString<M>(model, placement, "setStepPtsFillStyle")
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Set step fill style type.");
cmd->SetCandidates("noFill hashed filled");
}
protected:
void Apply(const G4String& type) {
G4VMarker::FillStyle myFillStyle;
if (type == "noFill") {myFillStyle = G4VMarker::noFill;}
else if (type == "hashed") {myFillStyle = G4VMarker::hashed;}
else if (type == "filled") {myFillStyle = G4VMarker::filled;}
else {
std::ostringstream o;
o << "Invalid argument. See command guidance for options.";
G4Exception
("G4ModelCmdSetStepPtsFillStyle::Apply",
"InvalidArgument", JustWarning, o.str().c_str());
return;
}
G4VModelCommand<M>::Model()->SetStepPtsFillStyle(myFillStyle);
}
};
////////////////////////////////////////////////////////////////////////
// Set auxiliary points fill style command
template <typename M>
class G4ModelCmdSetAuxPtsFillStyle : public G4ModelCmdApplyString<M> {
public:
G4ModelCmdSetAuxPtsFillStyle(M* model, const G4String& placement)
:G4ModelCmdApplyString<M>(model, placement, "setAuxPtsFillStyle")
{
G4UIcmdWithAString* cmd = G4ModelCmdApplyString<M>::Command();
cmd->SetGuidance("Set auxiliary fill style.");
cmd->SetCandidates("noFill hashed filled");
}
protected:
void Apply(const G4String& type) {
G4VMarker::FillStyle myFillStyle;
if (type == "noFill") {myFillStyle = G4VMarker::noFill;}
else if (type == "hashed") {myFillStyle = G4VMarker::hashed;}
else if (type == "filled") {myFillStyle = G4VMarker::filled;}
else {
std::ostringstream o;
o << "Invalid argument. See command guidance for options.";
G4Exception
("G4ModelCmdSetAuxPtsFillStyle::Apply",
"InvalidArgument", JustWarning, o.str().c_str());
return;
}
G4VModelCommand<M>::Model()->SetAuxPtsFillStyle(myFillStyle);
}
};
////////////////////////////////////////////////////////////////////////
// SetLineColour command
template <typename M>
class G4ModelCmdSetLineColour : public G4ModelCmdApplyColour<M> {
public:
G4ModelCmdSetLineColour(M* model, const G4String& placement)
:G4ModelCmdApplyColour<M>(model, placement, "setLineColour") {}
protected:
void Apply(const G4Colour& colour) {
G4VModelCommand<M>::Model()->SetLineColour(colour);
}
};
////////////////////////////////////////////////////////////////////////
// Create context directory command
template <typename M>
class G4ModelCmdCreateContextDir : public G4UImessenger {
public:
G4ModelCmdCreateContextDir(M* model, const G4String& placement) {
G4String title = placement+"/"+model->Name()+"/";
cmd = new G4UIdirectory(title);
cmd->SetGuidance("Commands for default configuration");
}
virtual ~G4ModelCmdCreateContextDir() {
delete cmd;
}
protected:
G4UIdirectory* cmd;
};
#endif
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4ModelingParameters.hh,v 1.10 2005/03/15 12:56:29 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ModelingParameters.hh,v 1.12 2006/06/29 21:30:26 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 31st December 1997.
@@ -47,6 +50,14 @@ public: // With description
friend std::ostream& operator << (std::ostream& os, const G4ModelingParameters&);
enum DrawingStyle {
wf, // Draw edges - no hidden line removal (wireframe).
hlr, // Draw edges - hidden lines removed.
hsr, // Draw surfaces - hidden surfaces removed.
hlhsr // Draw surfaces and edges - hidden removed.
};
// Currently requested drawing style.
enum RepStyle {
wireframe, // Use G4Wireframe.
polyhedron, // Use G4Polyhedron.
@@ -57,6 +68,33 @@ public: // With description
G4ModelingParameters ();
G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
DrawingStyle drawingStyle,
RepStyle repStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides);
// noOfSides is suggested no. of sides per circle in case a
// polygonal representation is produced.
G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
DrawingStyle drawingStyle,
RepStyle repStyle,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides,
G4bool isViewGeom,
G4bool isViewHits,
G4bool isViewDigis);
// noOfSides is suggested no. of sides per circle in case a
// polygonal representation is produced.
G4ModelingParameters (const G4VisAttributes* pDefaultVisAttributes,
RepStyle repStyle,
G4bool isCulling,
@@ -90,6 +128,7 @@ public: // With description
// Get and Is functions...
const G4VisAttributes* GetDefaultVisAttributes () const;
DrawingStyle GetDrawingStyle () const;
RepStyle GetRepStyle () const;
G4bool IsCulling () const;
G4bool IsCullingInvisible () const;
@@ -103,6 +142,7 @@ public: // With description
// Set functions...
void SetDefaultVisAttributes (const G4VisAttributes* pDefaultVisAttributes);
void SetDrawingStyle (DrawingStyle);
void SetRepStyle (RepStyle);
void SetCulling (G4bool);
void SetCullingInvisible (G4bool);
@@ -124,16 +164,17 @@ private:
// Data members...
const G4VisAttributes* fpDefaultVisAttributes;
RepStyle fRepStyle; // Representation style.
G4bool fCulling; // Culling requested.
G4bool fCullInvisible; // Cull (don't Draw) invisible objects.
G4bool fDensityCulling; // Density culling requested. If so...
G4double fVisibleDensity; // ...density lower than this not drawn.
G4bool fCullCovered; // Cull daughters covered by opaque mothers.
G4int fNoOfSides; // ...if polygon approximates circle.
G4bool fViewGeom; // View geometry objects.
G4bool fViewHits; // View hits, if any.
G4bool fViewDigis; // View digis, if any.
DrawingStyle fDrawingStyle; // Drawing style.
RepStyle fRepStyle; // Representation style.
G4bool fCulling; // Culling requested.
G4bool fCullInvisible; // Cull (don't Draw) invisible objects.
G4bool fDensityCulling; // Density culling requested. If so...
G4double fVisibleDensity; // ...density lower than this not drawn.
G4bool fCullCovered; // Cull daughters covered by opaque mothers.
G4int fNoOfSides; // ...if polygon approximates circle.
G4bool fViewGeom; // View geometry objects.
G4bool fViewHits; // View hits, if any.
G4bool fViewDigis; // View digis, if any.
};
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4ModelingParameters.icc,v 1.4 2001/07/11 10:09:21 gunter Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ModelingParameters.icc,v 1.6 2006/06/29 21:30:28 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 31st December 1997.
@@ -33,6 +36,11 @@ G4ModelingParameters::GetDefaultVisAttributes () const {
return fpDefaultVisAttributes;
}
inline G4ModelingParameters::DrawingStyle
G4ModelingParameters::GetDrawingStyle () const {
return fDrawingStyle;
}
inline G4ModelingParameters::RepStyle
G4ModelingParameters::GetRepStyle () const {
return fRepStyle;
@@ -79,6 +87,12 @@ inline void G4ModelingParameters::SetDefaultVisAttributes
fpDefaultVisAttributes = pDefaultVisAttributes;
}
inline void
G4ModelingParameters::SetDrawingStyle
(G4ModelingParameters::DrawingStyle style) {
fDrawingStyle = style;
}
inline void
G4ModelingParameters::SetRepStyle (G4ModelingParameters::RepStyle style) {
fRepStyle = style;
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4NullModel.hh,v 1.6 2001/08/24 20:36:15 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4NullModel.hh,v 1.7 2006/06/29 21:30:30 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 4th April 1998.
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4PhysicalVolumeMassScene.hh,v 1.4 2005/01/27 20:06:35 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4PhysicalVolumeMassScene.hh,v 1.7 2006/06/29 21:30:32 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 12th September 2004
@@ -38,8 +41,7 @@
// then adding the mass of the daughter, and so on down the heirarchy.
//
// Usage for a given G4PhysicalVolumeModel* pvModel:
// G4PhysicalVolumeMassScene massScene;
// massScene.EstablishSpecials (*pvModel);
// G4PhysicalVolumeMassScene massScene(pvModel);
// pvModel->DescribeYourselfTo (massScene);
// G4double volume = massScene.GetVolume();
// G4double mass = massScene.GetMass();
@@ -71,7 +73,7 @@ class G4Material;
class G4PhysicalVolumeMassScene: public G4VGraphicsScene {
public:
G4PhysicalVolumeMassScene ();
G4PhysicalVolumeMassScene (G4PhysicalVolumeModel*);
virtual ~G4PhysicalVolumeMassScene ();
public: // With description
@@ -103,13 +105,14 @@ public:
void AddSolid (const G4VSolid& s) {AccrueMass (s);}
void AddCompound (const G4VTrajectory&) {}
void AddCompound (const G4VHit&) {}
void EstablishSpecials (G4PhysicalVolumeModel&);
////////////////////////////////////////////////////////////////
// Functions not used but required by the abstract interface.
virtual void BeginPrimitives (const G4Transform3D&) {}
virtual void EndPrimitives () {}
virtual void BeginPrimitives2D () {}
virtual void EndPrimitives2D () {}
virtual void AddPrimitive (const G4Polyline&) {}
virtual void AddPrimitive (const G4Scale&) {}
virtual void AddPrimitive (const G4Text&) {}
@@ -121,6 +124,7 @@ public:
private:
void AccrueMass (const G4VSolid&);
G4PhysicalVolumeModel* fpPVModel;
G4double fVolume;
G4double fMass;
G4VPhysicalVolume* fpLastPV;
@@ -128,10 +132,6 @@ private:
G4int fLastDepth;
G4double fLastDensity;
std::deque<G4double> fDensityStack;
G4int fCurrentDepth; // Current depth of geom. hierarchy.
G4VPhysicalVolume* fpCurrentPV; // Current physical volume.
G4LogicalVolume* fpCurrentLV; // Current logical volume.
G4Material* fpCurrentMaterial; // Current material.
};
#endif
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4PhysicalVolumeModel.hh,v 1.21 2005/11/22 16:29:40 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4PhysicalVolumeModel.hh,v 1.28 2006/06/29 21:30:34 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 31st December 1997.
@@ -36,6 +39,10 @@
// For access to base class information, e.g., modeling parameters,
// use GetModelingParameters() inherited from G4VModel. See Class
// Description of the base class G4VModel.
//
// G4PhysicalVolumeModel assumes the modeling parameters have been set
// up with meaningful information - default vis attributes and culling
// policy in particular.
#ifndef G4PHYSICALVOLUMEMODEL_HH
#define G4PHYSICALVOLUMEMODEL_HH
@@ -43,6 +50,8 @@
#include "G4VModel.hh"
#include "G4Transform3D.hh"
#include <iostream>
#include <vector>
class G4VPhysicalVolume;
class G4LogicalVolume;
@@ -57,6 +66,20 @@ public: // With description
enum {UNLIMITED = -1};
class G4PhysicalVolumeNodeID {
public:
G4PhysicalVolumeNodeID(G4VPhysicalVolume* pPV = 0, G4int iCopyNo = 0):
fpPV(pPV), fCopyNo(iCopyNo) {}
G4VPhysicalVolume* GetPhysicalVolume() const {return fpPV;}
G4int GetCopyNo() const {return fCopyNo;}
G4bool operator< (const G4PhysicalVolumeNodeID& right) const;
G4bool operator== (const G4PhysicalVolumeNodeID& right) const;
private:
G4VPhysicalVolume* fpPV;
G4int fCopyNo;
};
// Nested class for identifying physical volume nodes.
G4PhysicalVolumeModel
(G4VPhysicalVolume*,
G4int requestedDepth = UNLIMITED,
@@ -86,21 +109,43 @@ public: // With description
G4String GetCurrentTag () const;
// A tag which depends on the current state of the model.
const G4PhysicalVolumeModel* GetG4PhysicalVolumeModel () const {
return this;
}
const G4PhysicalVolumeModel* GetG4PhysicalVolumeModel () const
{return this;}
G4PhysicalVolumeModel* GetG4PhysicalVolumeModel () {
return this;
}
G4PhysicalVolumeModel* GetG4PhysicalVolumeModel ()
{return this;}
const G4VPhysicalVolume* GetTopPhysicalVolume () const {return fpTopPV;}
G4VPhysicalVolume* GetTopPhysicalVolume () const {return fpTopPV;}
G4int GetRequestedDepth () const {return fRequestedDepth;}
const G4Polyhedron* GetClippingVolume () const {
return fpClippingPolyhedron;
}
const G4Polyhedron* GetClippingVolume () const
{return fpClippingPolyhedron;}
G4int GetCurrentDepth() const {return fCurrentDepth;}
// Current depth of geom. hierarchy.
G4VPhysicalVolume* GetCurrentPV() const {return fpCurrentPV;}
// Current physical volume.
G4LogicalVolume* GetCurrentLV() const {return fpCurrentLV;}
// Current logical volume.
G4Material* GetCurrentMaterial() const {return fpCurrentMaterial;}
// Current material.
const std::vector<G4PhysicalVolumeNodeID>& GetDrawnPVPath() const
{return fDrawnPVPath;}
// Path of the current drawn (non-culled) volume in terms of drawn
// (non-culled) ancesters. It is a vector of physical volume node
// identifiers corresponding to the geometry hierarchy actually
// selected, i.e., not culled. It is guaranteed that volumes are
// presented to the scene handlers in top-down hierarchy order,
// i.e., ancesters first, mothers before daughters, so the scene
// handler can be assured that, if it is building its own scene
// graph tree, a mother, if any, will have already been encountered
// and there will already be a node in place on which to hang the
// current volume.
void SetRequestedDepth (G4int requestedDepth) {
fRequestedDepth = requestedDepth;
@@ -113,13 +158,16 @@ public: // With description
G4bool Validate (G4bool warn);
// Validate, but allow internal changes (hence non-const function).
void DefinePointersToWorkingSpace (G4int* pCurrentDepth,
G4VPhysicalVolume** ppCurrentPV,
G4LogicalVolume** ppCurrentLV,
G4Material** ppCurrentMaterial);
void DefinePointersToWorkingSpace
(G4int* pCurrentDepth = 0,
G4VPhysicalVolume** ppCurrentPV = 0,
G4LogicalVolume** ppCurrentLV = 0,
G4Material** ppCurrentMaterial = 0,
std::vector<G4PhysicalVolumeNodeID>* pDrawnPVPath = 0);
// For use (optional) by the scene handler if it needs to know about
// the current information maintained through these pointers.
// the current information maintained through these pointers. For
// description of pointers, see below.
void CurtailDescent() {fCurtailDescent = true;}
protected:
@@ -142,11 +190,6 @@ protected:
const G4VisAttributes* pVisAttribs,
G4VGraphicsScene& sceneHandler);
G4bool IsThisCulled (const G4LogicalVolume*,
const G4Material*);
G4bool IsDaughterCulled (const G4LogicalVolume* pMotherLV);
void CalculateExtent ();
/////////////////////////////////////////////////////////
@@ -162,16 +205,18 @@ protected:
G4VPhysicalVolume* fpCurrentPV; // Current physical volume.
G4LogicalVolume* fpCurrentLV; // Current logical volume.
G4Material* fpCurrentMaterial; // Current material.
G4bool fCurtailDescent;// Can be set to curtail descent.
std::vector<G4PhysicalVolumeNodeID> fDrawnPVPath;
G4bool fCurtailDescent; // Can be set to curtail descent.
const G4Polyhedron*fpClippingPolyhedron;
////////////////////////////////////////////////////////////
// Pointers to working space in scene, if required.
// Pointers to working space in scene handler, if required.
G4int* fpCurrentDepth; // Current depth of geom. hierarchy.
G4VPhysicalVolume** fppCurrentPV; // Current physical volume.
G4LogicalVolume** fppCurrentLV; // Current logical volume.
G4Material** fppCurrentMaterial; // Current material.
std::vector<G4PhysicalVolumeNodeID>* fpDrawnPVPath;
private:
@@ -181,4 +226,7 @@ private:
G4PhysicalVolumeModel& operator = (const G4PhysicalVolumeModel&);
};
std::ostream& operator<<
(std::ostream& os, const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID);
#endif
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4PhysicalVolumeSearchScene.hh,v 1.13 2005/01/27 20:06:37 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4PhysicalVolumeSearchScene.hh,v 1.17 2006/06/29 21:30:36 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 10th August 1998.
@@ -50,7 +53,9 @@ class G4PhysicalVolumeSearchScene: public G4VGraphicsScene {
public:
G4PhysicalVolumeSearchScene
(const G4String& requiredPhysicalVolumeName, G4int requiredCopyNo);
(G4PhysicalVolumeModel*,
const G4String& requiredPhysicalVolumeName,
G4int requiredCopyNo);
virtual ~G4PhysicalVolumeSearchScene ();
void PreAddSolid (const G4Transform3D& objectTransformation,
const G4VisAttributes&);
@@ -68,7 +73,6 @@ public:
void AddSolid (const G4VSolid& s) {FindVolume (s);}
void AddCompound (const G4VTrajectory&) {}
void AddCompound (const G4VHit&) {}
void EstablishSpecials (G4PhysicalVolumeModel&);
G4int GetFoundDepth () const;
G4VPhysicalVolume* GetFoundVolume () const;
const G4Transform3D& GetFoundTransformation () const;
@@ -78,6 +82,8 @@ public:
virtual void BeginPrimitives (const G4Transform3D&) {}
virtual void EndPrimitives () {}
virtual void BeginPrimitives2D () {}
virtual void EndPrimitives2D () {}
virtual void AddPrimitive (const G4Polyline&) {}
virtual void AddPrimitive (const G4Scale&) {}
virtual void AddPrimitive (const G4Text&) {}
@@ -89,12 +95,9 @@ public:
private:
void FindVolume (const G4VSolid&);
const G4PhysicalVolumeModel* fpPVModel;
G4String fRequiredPhysicalVolumeName;
G4int fRequiredCopyNo;
G4int fCurrentDepth; // Current depth of geom. hierarchy.
G4VPhysicalVolume* fpCurrentPV; // Current physical volume.
G4LogicalVolume* fpCurrentLV; // Current logical volume.
G4Material* fpCurrentMaterial; // Current material.
const G4Transform3D* fpCurrentObjectTransformation;
G4int fFoundDepth; // Found depth.
G4VPhysicalVolume* fpFoundPV; // Found physical volume.
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4PhysicalVolumeSearchScene.icc,v 1.5 2005/01/27 20:06:42 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4PhysicalVolumeSearchScene.icc,v 1.6 2006/06/29 21:30:38 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 10th August 1998.
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4ScaleModel.hh,v 1.2 2001/08/24 20:36:18 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ScaleModel.hh,v 1.3 2006/06/29 21:31:10 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 21st July 2001.
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4ScaleModel.icc,v 1.2 2001/08/24 20:36:19 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ScaleModel.icc,v 1.3 2006/06/29 21:31:35 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
inline G4String G4ScaleModel::GetCurrentTag () const {
return fGlobalTag;
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TextModel.hh,v 1.5 2005/05/31 17:01:25 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TextModel.hh,v 1.6 2006/06/29 21:31:39 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 3rd April 2001
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TextModel.icc,v 1.3 2001/08/24 20:36:22 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TextModel.icc,v 1.4 2006/06/29 21:31:41 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
inline G4String G4TextModel::GetCurrentTag () const {
return fGlobalTag;
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TrajectoriesModel.hh,v 1.8 2002/11/11 18:39:28 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TrajectoriesModel.hh,v 1.9 2006/06/29 21:31:43 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 26th August 1998.
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TrajectoriesModel.icc,v 1.6 2001/08/24 20:36:24 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TrajectoriesModel.icc,v 1.7 2006/06/29 21:31:45 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
inline G4String G4TrajectoriesModel::GetCurrentTag () const {
return fGlobalTag;
@@ -0,0 +1,75 @@
//
// ********************************************************************
// * 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: G4TrajectoryChargeFilter.hh,v 1.2 2006/06/29 21:31:47 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Filter trajectories according to charge. Only registered
// charges will pass the filter.
//
// Jane Tinslay, May 2006
//
#ifndef G4TRAJECTORYCHARGEFILTER_HH
#define G4TRAJECTORYCHARGEFILTER_HH
#include "G4SmartFilter.hh"
#include "G4VTrajectory.hh"
#include <vector>
class G4TrajectoryChargeFilter : public G4SmartFilter<G4VTrajectory> {
public: // With description
// Construct with filter name
G4TrajectoryChargeFilter(const G4String& name = "Unspecified");
virtual ~G4TrajectoryChargeFilter();
// Evaluate this trajectory
virtual bool Evaluate(const G4VTrajectory&);
// Print configuration
virtual void Print(std::ostream& ostr) const;
// Clear filter
virtual void Clear();
// Configuration function
void Add(const G4String& particle);
private:
enum MyCharge {Negative=-1, Neutral=0, Positive=1};
G4bool ConvertToCharge(const G4String&, MyCharge&);
void Add(const MyCharge& chgear);
// Data member
std::vector<MyCharge> fCharges;
};
#endif
@@ -1,38 +1,43 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TrajectoryDrawByCharge.hh,v 1.3 2005/11/23 05:19:23 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TrajectoryDrawByCharge.hh,v 1.7 2006/06/29 21:31:49 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
// Class Description:
// Trajectory model which colours a trajectory according to
// charge. Guts taken from G4VTrajectory::DrawTrajectory method.
// charge.
// Class Description - End:
#ifndef G4TRAJECTORYDRAWBYCHARGE_HH
#define G4TRAJECTORYDRAWBYCHARGE_HH
#include "G4Colour.hh"
#include "G4ModelColourMap.hh"
#include "G4VTrajectoryModel.hh"
#include <map>
@@ -42,7 +47,7 @@ public: // With description
enum Charge {Negative=-1, Neutral=0, Positive=1};
G4TrajectoryDrawByCharge(const G4String& name = "Unspecified");
G4TrajectoryDrawByCharge(const G4String& name = "Unspecified", G4VisTrajContext* context=0);
G4TrajectoryDrawByCharge(const G4String& name,
const G4Colour& positive,
@@ -51,20 +56,26 @@ public: // With description
virtual ~G4TrajectoryDrawByCharge();
virtual void Draw(const G4VTrajectory& trajectory, G4int i_mode = 0) const;
// Draw the trajectory with optional i_mode parameter
virtual void Draw(const G4VTrajectory& trajectory, const G4int& i_mode = 0,
const G4bool& visible = true) const;
virtual void Print(std::ostream& ostr) const;
// Print configuration
virtual void Print(std::ostream& ostr) const;
void Set(Charge charge, const G4String& colour);
void Set(Charge charge, const G4Colour& colour);
void Set(const Charge& charge, const G4Colour& colour);
void Set(const Charge& charge, const G4String& colour);
void Set(const G4String& charge, const G4Colour& colour);
void Set(const G4String& charge, const G4String& colour);
// Configuration functions
private:
G4bool ConvertToCharge(const G4String&, Charge&);
// Data member
std::map<Charge, G4Colour> fMap;
G4ModelColourMap<Charge> fMap;
};
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * 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: G4TrajectoryDrawByOriginVolume.hh,v 1.4 2006/06/29 21:31:51 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Class Description:
// Trajectory model which colours a trajectory according to
// the origin volume
// Class Description - End:
// Jane Tinslay March 2006
#ifndef G4TRAJECTORYDRAWBYORIGINVOLUME
#define G4TRAJECTORYDRAWBYORIGINVOLUME
#include "G4VTrajectoryModel.hh"
#include "G4Colour.hh"
#include "G4ModelColourMap.hh"
#include "G4String.hh"
#include <map>
class G4TrajectoryDrawByOriginVolume : public G4VTrajectoryModel {
public: // With description
G4TrajectoryDrawByOriginVolume(const G4String& name = "Unspecified", G4VisTrajContext* context=0);
virtual ~G4TrajectoryDrawByOriginVolume();
virtual void Draw(const G4VTrajectory&, const G4int& i_mode = 0,
const G4bool& visible = true) const;
// Draw the trajectory with optional i_mode parameter
virtual void Print(std::ostream& ostr) const;
// Print configuration
void SetDefault(const G4String&);
void SetDefault(const G4Colour&);
void Set(const G4String& particle, const G4String& colour);
void Set(const G4String& particle, const G4Colour& colour);
// Configuration functions
private:
// Data members
G4ModelColourMap<G4String> fMap;
G4Colour fDefault;
};
#endif
@@ -1,26 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TrajectoryDrawByParticleID.hh,v 1.3 2005/11/23 05:19:23 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TrajectoryDrawByParticleID.hh,v 1.7 2006/06/29 21:31:53 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -34,6 +38,7 @@
#include "G4VTrajectoryModel.hh"
#include "G4Colour.hh"
#include "G4ModelColourMap.hh"
#include "G4String.hh"
#include <map>
@@ -41,11 +46,12 @@ class G4TrajectoryDrawByParticleID : public G4VTrajectoryModel {
public: // With description
G4TrajectoryDrawByParticleID(const G4String& name = "Unspecified");
G4TrajectoryDrawByParticleID(const G4String& name = "Unspecified", G4VisTrajContext* context=0);
virtual ~G4TrajectoryDrawByParticleID();
virtual void Draw(const G4VTrajectory&, G4int) const;
virtual void Draw(const G4VTrajectory&, const G4int&i_mode = 0,
const G4bool& visible = true) const;
// Draw the trajectory with optional i_mode parameter
virtual void Print(std::ostream& ostr) const;
@@ -61,7 +67,7 @@ public: // With description
private:
// Data members
std::map<G4String, G4Colour> fMap;
G4ModelColourMap<G4String> fMap;
G4Colour fDefault;
};
@@ -1,26 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TrajectoryDrawerUtils.hh,v 1.2 2005/11/21 05:44:44 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TrajectoryDrawerUtils.hh,v 1.6 2006/06/29 21:31:55 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -31,15 +35,30 @@
#ifndef G4TRAJECTORYDRAWERUTILS
#define G4TRAJECTORYDRAWERUTILS
#include "globals.hh"
class G4Colour;
class G4Polyline;
class G4Polymarker;
class G4VisTrajContext;
class G4VTrajectory;
namespace G4TrajectoryDrawerUtils {
namespace {
G4bool warnedAboutIMode = false;
}
void GetPoints(const G4VTrajectory& traj, G4Polyline& trajectoryLine,
G4Polymarker& auxiliaryPoints, G4Polymarker& stepPoints);
// Draw trajectory line and points
void DrawLineAndPoints(const G4VTrajectory& traj, const G4int& i_mode,
const G4Colour& cfg, const G4bool& visible);
// Draw trajectory line and points using G4VisTrajContext object information
void DrawLineAndPoints(const G4VTrajectory& traj, const G4VisTrajContext&, const G4int& i_mode=0);
}
#endif
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * 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: G4TrajectoryFilterFactories.hh,v 1.3 2006/06/29 21:31:57 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// Trajectory filter model factories creating filters
// and associated messengers.
//
// Jane Tinslay March 2006
//
#ifndef G4TRAJECTORYFILTERFACTORIES_HH
#define G4TRAJECTORYFILTERFACTORIES_HH
#include "G4VFilter.hh"
#include "G4VModelFactory.hh"
#include "G4VTrajectory.hh"
// Charge filter
class G4TrajectoryChargeFilterFactory : public G4VModelFactory< G4VFilter<G4VTrajectory> > {
public: // With description
typedef std::vector<G4UImessenger*> Messengers;
typedef std::pair< G4VFilter<G4VTrajectory> *, Messengers > ModelAndMessengers;
G4TrajectoryChargeFilterFactory();
virtual ~G4TrajectoryChargeFilterFactory();
ModelAndMessengers Create(const G4String& placement, const G4String& name);
};
// Particle filter
class G4TrajectoryParticleFilterFactory : public G4VModelFactory< G4VFilter<G4VTrajectory> > {
public: // With description
typedef std::vector<G4UImessenger*> Messengers;
typedef std::pair< G4VFilter<G4VTrajectory> *, Messengers > ModelAndMessengers;
G4TrajectoryParticleFilterFactory();
virtual ~G4TrajectoryParticleFilterFactory();
ModelAndMessengers Create(const G4String& placement, const G4String& name);
};
// Origin volume filter
class G4TrajectoryOriginVolumeFilterFactory : public G4VModelFactory< G4VFilter<G4VTrajectory> > {
public: // With description
typedef std::vector<G4UImessenger*> Messengers;
typedef std::pair< G4VFilter<G4VTrajectory> *, Messengers > ModelAndMessengers;
G4TrajectoryOriginVolumeFilterFactory();
virtual ~G4TrajectoryOriginVolumeFilterFactory();
ModelAndMessengers Create(const G4String& placement, const G4String& name);
};
#endif
@@ -0,0 +1,61 @@
//
// ********************************************************************
// * 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: G4TrajectoryGenericDrawer.hh,v 1.2 2006/06/29 21:31:59 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
// Class Description:
// Trajectory model which colours a trajectory according to
// charge. Guts taken from G4VTrajectory::DrawTrajectory method.
// Class Description - End:
#ifndef G4TRAJECTORYGENERICDRAWER_HH
#define G4TRAJECTORYGENERICDRAWER_HH
#include "G4Colour.hh"
#include "G4VTrajectoryModel.hh"
class G4TrajectoryGenericDrawer : public G4VTrajectoryModel {
public: // With description
G4TrajectoryGenericDrawer(const G4String& name = "Unspecified", G4VisTrajContext* context=0);
virtual ~G4TrajectoryGenericDrawer();
virtual void Draw(const G4VTrajectory& trajectory, const G4int& i_mode = 0,
const G4bool& visible = true) const;
// Draw the trajectory with optional i_mode parameter
virtual void Print(std::ostream& ostr) const;
// Print configuration
private:
};
#endif
@@ -1,26 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TrajectoryModelFactories.hh,v 1.2 2005/11/23 05:19:23 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TrajectoryModelFactories.hh,v 1.5 2006/06/29 21:32:01 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl October 2005
//
@@ -52,6 +56,18 @@ public: // With description
};
class G4TrajectoryGenericDrawerFactory : public G4VModelFactory<G4VTrajectoryModel> {
public: // With description
G4TrajectoryGenericDrawerFactory();
virtual ~G4TrajectoryGenericDrawerFactory();
ModelAndMessengers Create(const G4String& placement, const G4String& name);
};
class G4TrajectoryDrawByParticleIDFactory : public G4VModelFactory<G4VTrajectoryModel> {
public: // With description
@@ -64,6 +80,18 @@ public: // With description
};
class G4TrajectoryDrawByOriginVolumeFactory : public G4VModelFactory<G4VTrajectoryModel> {
public: // With description
G4TrajectoryDrawByOriginVolumeFactory();
virtual ~G4TrajectoryDrawByOriginVolumeFactory();
ModelAndMessengers Create(const G4String& placement, const G4String& name);
};
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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: G4TrajectoryOriginVolumeFilter.hh,v 1.2 2006/06/29 21:32:03 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Filter trajectories according to volume name. Only registered
// volumes will pass the filter.
//
// Jane Tinslay, May 2006
//
#ifndef G4TRAJECTORYORIGINVOLUMEFILTER_HH
#define G4TRAJECTORYORIGINVOLUMEFILTER_HH
#include "G4SmartFilter.hh"
#include "G4VTrajectory.hh"
#include <vector>
class G4TrajectoryOriginVolumeFilter : public G4SmartFilter<G4VTrajectory> {
public: // With description
// Construct with filter name
G4TrajectoryOriginVolumeFilter(const G4String& name = "Unspecified");
virtual ~G4TrajectoryOriginVolumeFilter();
// Evaluate this trajectory
virtual bool Evaluate(const G4VTrajectory&);
// Print configuration
virtual void Print(std::ostream& ostr) const;
// Clear filter
virtual void Clear();
// Configuration function
void Add(const G4String& volume);
private:
// Data member
std::vector<G4String> fVolumes;
};
#endif
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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: G4TrajectoryParticleFilter.hh,v 1.2 2006/06/29 21:32:05 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Filter trajectories according to particle type. Only registered
// particle types will pass the filter.
//
// Jane Tinslay, March 2006
//
#ifndef G4TRAJECTORYPARTICLEFILTER_HH
#define G4TRAJECTORYPARTICLEFILTER_HH
#include "G4SmartFilter.hh"
#include "G4VTrajectory.hh"
#include <vector>
class G4TrajectoryParticleFilter : public G4SmartFilter<G4VTrajectory> {
public: // With description
// Construct with filter name
G4TrajectoryParticleFilter(const G4String& name = "Unspecified");
virtual ~G4TrajectoryParticleFilter();
// Evaluate this trajectory
virtual bool Evaluate(const G4VTrajectory&);
// Print configuration
virtual void Print(std::ostream& ostr) const;
// Clear filter
virtual void Clear();
// Configuration function
void Add(const G4String& particle);
private:
// Data member
std::vector<G4String> fParticles;
};
#endif
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4VModel.hh,v 1.17 2005/11/22 16:29:40 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VModel.hh,v 1.18 2006/06/29 21:32:07 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 31st December 1997.
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4VModel.icc,v 1.10 2005/03/03 16:39:15 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VModel.icc,v 1.11 2006/06/29 21:32:11 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 31st December 1997.
@@ -1,26 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4VModelCommand.hh,v 1.2 2005/11/28 20:07:11 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VModelCommand.hh,v 1.3 2006/06/29 21:32:27 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
@@ -1,26 +1,30 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4VModelFactory.hh,v 1.1 2005/11/21 05:44:44 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VModelFactory.hh,v 1.6 2006/06/29 21:32:30 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl October 2005
//
@@ -34,6 +38,7 @@
#define G4VMODELFACTORY
#include "G4String.hh"
#include <iostream>
#include <utility>
#include <vector>
@@ -55,6 +60,8 @@ public: // With description
virtual ModelAndMessengers Create(const G4String& placement, const G4String& modelName) = 0;
void Print(std::ostream& ostr) const;
private:
G4String fName;
@@ -76,5 +83,12 @@ G4VModelFactory<T>::Name()
return fName;
}
template <typename T>
void
G4VModelFactory<T>::Print(std::ostream& ostr) const
{
ostr<<" "<<fName<<std::endl;
}
#endif
@@ -1,66 +1,79 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4VTrajectoryModel.hh,v 1.3 2005/12/02 19:16:15 perl Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VTrajectoryModel.hh,v 1.6 2006/06/29 21:32:32 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl October 2005
//
// Class Description:
// Abstract base class for trajectory models. Trajectory models are responsible
// for drawing individual trajectories according to a particular style.
// Abstract base class for trajectory drawing models. Trajectory drawing
// models are responsible for drawing individual trajectories according
// to a particular style.
// Class Description - End:
#ifndef G4VTRAJECTORYMODEL_HH
#define G4VTRAJECTORYMODEL_HH
#include "G4String.hh"
#include <iostream>
#include "G4VTrajectory.hh"
class G4VTrajectory;
class G4VisTrajContext;
class G4VTrajectoryModel {
public: // With description
public:
G4VTrajectoryModel(const G4String& name):fName(name) {}
// Construct with context object
G4VTrajectoryModel(const G4String& name, G4VisTrajContext* fpContext=0);
virtual ~G4VTrajectoryModel() {}
virtual void Draw(const G4VTrajectory& trajectory, G4int i_mode = 0) const = 0;
// Draw the trajectory with optional i_mode parameter
virtual void Print(std::ostream& ostr) const = 0;
// Destructor
virtual ~G4VTrajectoryModel();
// Draw method
virtual void Draw(const G4VTrajectory& model, const G4int& i_mode = 0,
const G4bool& visible = true) const = 0;
// Print configuration
virtual void Print(std::ostream& ostr) const = 0;
// Accessors
G4String Name() const ;
const G4VisTrajContext& GetContext() const;
// Set verbosity
void SetVerbose(const G4bool&);
G4bool GetVerbose() const;
protected:
private:
// Data member
G4String fName;
G4bool fVerbose;
G4VisTrajContext* fpContext;
};
inline G4String G4VTrajectoryModel::Name() const {return fName;}
#endif
@@ -0,0 +1,133 @@
//
// ********************************************************************
// * 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: G4VisTrajContext.hh,v 1.2 2006/06/29 21:32:34 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay May 2006
//
#ifndef G4VISTRAJCONTEXT_HH
#define G4VISTRAJCONTEXT_HH
#include "G4Colour.hh"
#include "G4Polymarker.hh"
class G4VisTrajContext {
public:
// Default configuration
G4VisTrajContext(const G4String& name = "Unspecified");
// Destructor
virtual ~G4VisTrajContext();
G4String Name() const;
void SetVisible(const G4bool& visible);
// Print configuration
void Print(std::ostream& ostr) const;
// Line
void SetLineColour(const G4Colour& colour);
G4Colour GetLineColour() const;
void SetDrawLine(const G4bool& draw);
G4bool GetDrawLine() const;
void SetLineVisible(const G4bool& visible);
G4bool GetLineVisible() const;
// Auxiliary points
void SetDrawAuxPts(const G4bool& draw);
G4bool GetDrawAuxPts() const;
void SetAuxPtsType(const G4Polymarker::MarkerType& marker);
G4Polymarker::MarkerType GetAuxPtsType() const;
void SetAuxPtsSize(const G4double& size);
G4double GetAuxPtsSize() const;
void SetAuxPtsFillStyle(const G4VMarker::FillStyle& style);
G4VMarker::FillStyle GetAuxPtsFillStyle() const;
void SetAuxPtsColour(const G4Colour& colour);
G4Colour GetAuxPtsColour() const;
void SetAuxPtsVisible(const G4bool& visible);
G4bool GetAuxPtsVisible() const;
// Step points
void SetDrawStepPts(const G4bool& draw);
G4bool GetDrawStepPts() const;
void SetStepPtsType(const G4Polymarker::MarkerType& marker);
G4Polymarker::MarkerType GetStepPtsType() const;
void SetStepPtsSize(const G4double& size);
G4double GetStepPtsSize() const;
void SetStepPtsFillStyle(const G4VMarker::FillStyle& style);
G4VMarker::FillStyle GetStepPtsFillStyle() const;
void SetStepPtsColour(const G4Colour& colour);
G4Colour GetStepPtsColour() const;
void SetStepPtsVisible(const G4bool& visible);
G4bool GetStepPtsVisible() const;
private:
// Data members
G4String fName;
// Line data
G4Colour fLineColour;
G4bool fLineVisible;
G4bool fDrawLine;
// Auxiliary point data
G4bool fDrawAuxPts;
G4Polymarker::MarkerType fAuxPtsType;
G4double fAuxPtsSize;
G4VMarker::FillStyle fAuxPtsFillStyle;
G4Colour fAuxPtsColour;
G4bool fAuxPtsVisible;
// Step point data
G4bool fDrawStepPts;
G4Polymarker::MarkerType fStepPtsType;
G4double fStepPtsSize;
G4VMarker::FillStyle fStepPtsFillStyle;
G4Colour fStepPtsColour;
G4bool fStepPtsVisible;
};
#include "G4VisTrajContext.icc"
#endif
@@ -0,0 +1,111 @@
//
// ********************************************************************
// * 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: G4VisTrajContext.icc,v 1.2 2006/06/29 21:32:36 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay May 2006
//
#ifndef G4VISTRAJ_CONTEXT_ICC
#define G4VISTRAJ_CONTEXT_ICC
inline G4String G4VisTrajContext::Name() const {return fName;}
inline void G4VisTrajContext::SetVisible(const G4bool& visible)
{
SetLineVisible(visible);
SetAuxPtsVisible(visible);
SetStepPtsVisible(visible);
}
// Line
inline void G4VisTrajContext::SetLineColour(const G4Colour& colour) {fLineColour = colour;}
inline G4Colour G4VisTrajContext::GetLineColour() const {return fLineColour;}
inline void G4VisTrajContext::SetDrawLine(const G4bool& draw) {fDrawLine = draw;}
inline G4bool G4VisTrajContext::GetDrawLine() const {return fDrawLine;}
inline void G4VisTrajContext::SetLineVisible(const G4bool& visible) {fLineVisible = visible;}
inline G4bool G4VisTrajContext::GetLineVisible() const {return fLineVisible;}
// Auxiliary points
inline void G4VisTrajContext::SetDrawAuxPts(const G4bool& draw) {fDrawAuxPts = draw;}
inline G4bool G4VisTrajContext::GetDrawAuxPts() const {return fDrawAuxPts;}
inline void G4VisTrajContext::SetAuxPtsType(const G4Polymarker::MarkerType& marker) {fAuxPtsType = marker;}
inline G4Polymarker::MarkerType G4VisTrajContext::GetAuxPtsType() const {return fAuxPtsType;}
inline void G4VisTrajContext::SetAuxPtsSize(const G4double& size) {fAuxPtsSize = size;}
inline G4double G4VisTrajContext::GetAuxPtsSize() const {return fAuxPtsSize;}
inline void G4VisTrajContext::SetAuxPtsFillStyle(const G4VMarker::FillStyle& style) {fAuxPtsFillStyle = style;}
inline G4VMarker::FillStyle G4VisTrajContext::GetAuxPtsFillStyle() const {return fAuxPtsFillStyle;}
inline void G4VisTrajContext::SetAuxPtsColour(const G4Colour& colour) {fAuxPtsColour = colour;}
inline G4Colour G4VisTrajContext::GetAuxPtsColour() const {return fAuxPtsColour;}
inline void G4VisTrajContext::SetAuxPtsVisible(const G4bool& visible) {fAuxPtsVisible = visible;}
inline G4bool G4VisTrajContext::GetAuxPtsVisible() const {return fAuxPtsVisible;}
// Step points
inline void G4VisTrajContext::SetDrawStepPts(const G4bool& draw) {fDrawStepPts = draw;}
inline G4bool G4VisTrajContext::GetDrawStepPts() const {return fDrawStepPts;}
inline void G4VisTrajContext::SetStepPtsType(const G4Polymarker::MarkerType& marker) {fStepPtsType = marker;}
inline G4Polymarker::MarkerType G4VisTrajContext::GetStepPtsType() const {return fStepPtsType;}
inline void G4VisTrajContext::SetStepPtsSize(const G4double& size) {fStepPtsSize = size;}
inline G4double G4VisTrajContext::GetStepPtsSize() const {return fStepPtsSize;}
inline void G4VisTrajContext::SetStepPtsFillStyle(const G4VMarker::FillStyle& style) {fStepPtsFillStyle = style;}
inline G4VMarker::FillStyle G4VisTrajContext::GetStepPtsFillStyle() const {return fStepPtsFillStyle;}
inline void G4VisTrajContext::SetStepPtsColour(const G4Colour& colour) {fStepPtsColour = colour;}
inline G4Colour G4VisTrajContext::GetStepPtsColour() const {return fStepPtsColour;}
inline void G4VisTrajContext::SetStepPtsVisible(const G4bool& visible) {fStepPtsVisible = visible;}
inline G4bool G4VisTrajContext::GetStepPtsVisible() const {return fStepPtsVisible;}
inline void G4VisTrajContext::Print(std::ostream& ostr) const
{
ostr<<"Name: "<<Name()<<G4endl;
ostr<<"Line colour "<<GetLineColour()<<G4endl;
ostr<<"Draw line ? "<<GetDrawLine()<<G4endl;
ostr<<"Line visibile ? "<<GetLineVisible()<<G4endl;
ostr<<"Draw auxiliary points ? "<<GetDrawAuxPts()<<G4endl;
ostr<<"Auxiliary points type "<<GetAuxPtsType()<<G4endl;
ostr<<"Auxiliary points size "<<GetAuxPtsSize()<<G4endl;
ostr<<"Auxiliary points fill style "<<GetAuxPtsFillStyle()<<G4endl;
ostr<<"Auxiliary points colour "<<GetAuxPtsColour()<<G4endl;
ostr<<"Auxiliary points visible ? "<<GetAuxPtsVisible()<<G4endl;
ostr<<"Draw step points ? "<<GetDrawStepPts()<<G4endl;
ostr<<"Step points type "<<GetStepPtsType()<<G4endl;
ostr<<"Step points size "<<GetStepPtsSize()<<G4endl;
ostr<<"Step points fill style "<<GetStepPtsFillStyle()<<G4endl;
ostr<<"Step points colour "<<GetStepPtsColour()<<G4endl;
ostr<<"Step points visible ? "<<GetStepPtsVisible()<<G4endl;
}
#endif
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4AxesModel.cc,v 1.5 2001/08/14 18:43:29 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4AxesModel.cc,v 1.6 2006/06/29 21:32:38 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 3rd April 2001
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4BoundingSphereScene.cc,v 1.9 2005/01/27 20:06:49 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4BoundingSphereScene.cc,v 1.11 2006/06/29 21:32:40 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 7th June 1997
@@ -63,7 +66,7 @@ void G4BoundingSphereScene::Accrue (const G4VSolid& solid) {
AccrueBoundingSphere (newCentre, newRadius);
// Curtail descent - can assume daughters are contained within mother...
G4PhysicalVolumeModel* pPVM = fpModel->GetG4PhysicalVolumeModel();
G4PhysicalVolumeModel* pPVM = dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
if (pPVM) pPVM->CurtailDescent();
}
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4FlavoredParallelWorldModel.cc,v 1.6 2002/11/20 17:21:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4FlavoredParallelWorldModel.cc,v 1.7 2006/06/29 21:32:42 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// P. Mora de Freitas et M.Verderi - 19 June 1998.
// Model for flavored parallel world volumes.
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4HitsModel.cc,v 1.11 2005/01/27 20:06:52 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4HitsModel.cc,v 1.15 2006/06/29 21:32:44 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 26th August 1998.
@@ -31,10 +34,8 @@
#include "G4HitsModel.hh"
#include "G4VGraphicsScene.hh"
#include "G4ModelingParameters.hh"
#include "G4RunManager.hh"
#include "G4EventManager.hh"
#include "G4Event.hh"
#include "G4HCofThisEvent.hh"
G4HitsModel::~G4HitsModel () {}
@@ -44,20 +45,18 @@ G4HitsModel::G4HitsModel () {
}
void G4HitsModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
if (fpMP && fpMP -> IsViewHits ()) {
G4RunManager* runManager = G4RunManager::GetRunManager ();
const G4Event* event = runManager -> GetCurrentEvent ();
if (event) {
G4HCofThisEvent* HCE = event -> GetHCofThisEvent ();
if (HCE) {
G4int nHC = HCE -> GetCapacity ();
for (int iHC = 0; iHC < nHC; iHC++) {
G4VHitsCollection* HC = HCE -> GetHC (iHC);
if (HC) {
for(size_t iHit = 0; iHit < HC->GetSize(); ++iHit) {
G4VHit* hit = HC -> GetHit (iHit);
sceneHandler.AddCompound (*hit);
}
const G4Event* event =
G4EventManager::GetEventManager()->GetConstCurrentEvent();
if (event) {
G4HCofThisEvent* HCE = event -> GetHCofThisEvent ();
if (HCE) {
G4int nHC = HCE -> GetCapacity ();
for (int iHC = 0; iHC < nHC; iHC++) {
G4VHitsCollection* HC = HCE -> GetHC (iHC);
if (HC) {
for(size_t iHit = 0; iHit < HC->GetSize(); ++iHit) {
G4VHit* hit = HC -> GetHit (iHit);
sceneHandler.AddCompound (*hit);
}
}
}
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4LogicalVolumeModel.cc,v 1.11 2005/02/15 14:51:33 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4LogicalVolumeModel.cc,v 1.13 2006/06/29 21:32:46 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 26th July 1999.
@@ -84,12 +87,13 @@ void G4LogicalVolumeModel::DescribeYourselfTo
(G4VGraphicsScene& sceneHandler) {
// Store current modeling parameters and ensure nothing is culled.
const G4ModelingParameters* tpMP = fpMP;
G4ModelingParameters nonCulledMP (*fpMP);
const G4ModelingParameters* tmpMP = fpMP;
G4ModelingParameters nonCulledMP;
if (fpMP) nonCulledMP = *fpMP;
nonCulledMP.SetCulling (false);
fpMP = &nonCulledMP;
G4PhysicalVolumeModel::DescribeYourselfTo (sceneHandler);
fpMP = tpMP;
fpMP = tmpMP;
if (fVoxels) {
if (fpTopPV->GetLogicalVolume()->GetVoxelHeader()) {
@@ -1,141 +0,0 @@
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4ModelCommandsDrawByCharge.cc,v 1.6 2005/11/28 20:07:11 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
#include "G4ModelCommandsDrawByCharge.hh"
#include "G4TrajectoryDrawByCharge.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcommand.hh"
#include <sstream>
//Set colour with string
G4ModelCommandDrawByChargeSet::G4ModelCommandDrawByChargeSet(G4TrajectoryDrawByCharge* model, const G4String& placement)
:G4VModelCommand<G4TrajectoryDrawByCharge>(model)
{
G4String name = model->Name();
G4String myCommand = placement+"/"+name+"/set";
fpCommand = new G4UIcmdWithAString(myCommand, this);
fpCommand->SetGuidance("Set trajectory colour through a string.");
fpCommand->SetGuidance("Two inputs are expected, for example");
G4String example = myCommand+" -1 red";
fpCommand->SetGuidance(example);
fpCommand->SetParameterName("parameters", false);
}
G4ModelCommandDrawByChargeSet::~G4ModelCommandDrawByChargeSet()
{
delete fpCommand;
}
void G4ModelCommandDrawByChargeSet::SetNewValue(G4UIcommand*, G4String newValue)
{
G4int charge(-999);
G4String colour;
std::istringstream is (newValue);
is >> charge >> colour;
G4TrajectoryDrawByCharge::Charge myCharge = G4TrajectoryDrawByCharge::Positive;
switch (charge) {
case 1:
myCharge = G4TrajectoryDrawByCharge::Positive;
break;
case 0:
myCharge = G4TrajectoryDrawByCharge::Neutral;
break;
case -1:
myCharge = G4TrajectoryDrawByCharge::Negative;
break;
default:
std::ostringstream o;
o << "Invalid charge "<<charge;
G4Exception
("G4ModelCommandDrawByChargeSet::SetNewValue (G4UIcommand*, G4String newValue) ",
"InvalidCharge", FatalErrorInArgument, o.str().c_str());
}
// Configure model as requested
Model()->Set(myCharge, colour);
}
//Set colour by red, green, blue and alpha components
G4ModelCommandDrawByChargeSetRGBA::G4ModelCommandDrawByChargeSetRGBA(G4TrajectoryDrawByCharge* model, const G4String& placement)
:G4VModelCommand<G4TrajectoryDrawByCharge>(model)
{
G4String name = model->Name();
G4String myCommand = placement+"/"+name+"/setRGBA";
fpCommand = new G4UIcmdWithAString(myCommand, this);
fpCommand->SetGuidance("Set trajectory colour through red, green, blue and alpha components.");
fpCommand->SetGuidance("Five inputs are expected, for example");
G4String example = myCommand+" -1 1 1 1 1";
;
fpCommand->SetGuidance(example);
fpCommand->SetParameterName("parameters", false);
}
G4ModelCommandDrawByChargeSetRGBA::~G4ModelCommandDrawByChargeSetRGBA()
{
delete fpCommand;
}
void G4ModelCommandDrawByChargeSetRGBA::SetNewValue(G4UIcommand*, G4String newValue)
{
G4int charge(-999);
G4double red(0), green(0), blue(0), alpha(0);
std::istringstream is (newValue);
is >> charge >> red >> green >> blue >> alpha;
G4TrajectoryDrawByCharge::Charge myCharge = G4TrajectoryDrawByCharge::Positive;
switch (charge) {
case 1:
myCharge = G4TrajectoryDrawByCharge::Positive;
break;
case 0:
myCharge = G4TrajectoryDrawByCharge::Neutral;
break;
case -1:
myCharge = G4TrajectoryDrawByCharge::Negative;
break;
default:
std::ostringstream o;
o << "Invalid charge "<<charge;
G4Exception
("G4ModelCommandDrawByChargeSetRGBA::SetNewValue (G4UIcommand*, G4String newValue) ",
"InvalidCharge", FatalErrorInArgument, o.str().c_str());
}
G4Colour myColour(red, green, blue, alpha);
// Configure model as requested
Model()->Set(myCharge, myColour);
}
@@ -1,163 +0,0 @@
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * 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. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
// $Id: G4ModelCommandsDrawByParticleID.cc,v 1.3 2005/11/28 20:07:11 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
#include "G4ModelCommandsDrawByParticleID.hh"
#include "G4TrajectoryDrawByParticleID.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcommand.hh"
#include <sstream>
//Set colour with string
G4ModelCommandDrawByParticleIDSet::G4ModelCommandDrawByParticleIDSet(G4TrajectoryDrawByParticleID* model, const G4String& placement)
:G4VModelCommand<G4TrajectoryDrawByParticleID>(model)
{
G4String name = model->Name();
G4String myCommand = placement+"/"+name+"/set";
fpCommand = new G4UIcmdWithAString(myCommand, this);
fpCommand->SetGuidance("Set trajectory colour through a string.");
fpCommand->SetGuidance("Two inputs are expected, for example");
G4String example = myCommand+" gamma red";
fpCommand->SetGuidance(example);
fpCommand->SetParameterName("parameters", false);
}
G4ModelCommandDrawByParticleIDSet::~G4ModelCommandDrawByParticleIDSet()
{
delete fpCommand;
}
void G4ModelCommandDrawByParticleIDSet::SetNewValue(G4UIcommand*, G4String newValue)
{
G4String particle;
G4String colour;
std::istringstream is (newValue);
is >> particle >> colour;
// Configure model as requested
Model()->Set(particle, colour);
}
//Set colour by red, green, blue and alpha components
G4ModelCommandDrawByParticleIDSetRGBA::G4ModelCommandDrawByParticleIDSetRGBA(G4TrajectoryDrawByParticleID* model, const G4String& placement)
:G4VModelCommand<G4TrajectoryDrawByParticleID>(model)
{
G4String name = model->Name();
G4String myCommand = placement+"/"+name+"/setRGBA";
fpCommand = new G4UIcmdWithAString(myCommand, this);
fpCommand->SetGuidance("Set trajectory colour through red, green, blue and alpha components.");
fpCommand->SetGuidance("Five inputs are expected, for example");
G4String example = myCommand+" gamma 1 1 1 1";
;
fpCommand->SetGuidance(example);
fpCommand->SetParameterName("parameters", false);
}
G4ModelCommandDrawByParticleIDSetRGBA::~G4ModelCommandDrawByParticleIDSetRGBA()
{
delete fpCommand;
}
void G4ModelCommandDrawByParticleIDSetRGBA::SetNewValue(G4UIcommand*, G4String newValue)
{
G4String particle;
G4double red(0), green(0), blue(0), alpha(0);
std::istringstream is (newValue);
is >> particle >> red >> green >> blue >> alpha;
G4Colour myColour(red, green, blue, alpha);
// Configure model as requested
Model()->Set(particle, myColour);
}
//Set default colour with string
G4ModelCommandDrawByParticleIDSetDefault::G4ModelCommandDrawByParticleIDSetDefault(G4TrajectoryDrawByParticleID* model, const G4String& placement)
:G4VModelCommand<G4TrajectoryDrawByParticleID>(model)
{
G4String name = model->Name();
G4String myCommand = placement+"/"+name+"/setDefault";
fpCommand = new G4UIcmdWithAString(myCommand, this);
fpCommand->SetGuidance("Set default trajectory colour through a string.");
fpCommand->SetGuidance("One input is expected, for example");
G4String example = myCommand+" red";
fpCommand->SetGuidance(example);
fpCommand->SetParameterName("parameters", false);
}
G4ModelCommandDrawByParticleIDSetDefault::~G4ModelCommandDrawByParticleIDSetDefault()
{
delete fpCommand;
}
void G4ModelCommandDrawByParticleIDSetDefault::SetNewValue(G4UIcommand*, G4String newValue)
{
// Configure model as requested
Model()->SetDefault(newValue);
}
//Set colour by red, green, blue and alpha components
G4ModelCommandDrawByParticleIDSetDefaultRGBA::G4ModelCommandDrawByParticleIDSetDefaultRGBA(G4TrajectoryDrawByParticleID* model, const G4String& placement)
:G4VModelCommand<G4TrajectoryDrawByParticleID>(model)
{
G4String name = model->Name();
G4String myCommand = placement+"/"+name+"/setDefaultRGBA";
fpCommand = new G4UIcmdWithAString(myCommand, this);
fpCommand->SetGuidance("Set default trajectory colour through red, green, blue and alpha components.");
fpCommand->SetGuidance("Four inputs are expected, for example");
G4String example = myCommand+" 1 1 1 1";
;
fpCommand->SetGuidance(example);
fpCommand->SetParameterName("parameters", false);
}
G4ModelCommandDrawByParticleIDSetDefaultRGBA::~G4ModelCommandDrawByParticleIDSetDefaultRGBA()
{
delete fpCommand;
}
void G4ModelCommandDrawByParticleIDSetDefaultRGBA::SetNewValue(G4UIcommand*, G4String newValue)
{
G4double red(0), green(0), blue(0), alpha(0);
std::istringstream is (newValue);
is >> red >> green >> blue >> alpha;
G4Colour myColour(red, green, blue, alpha);
// Configure model as requested
Model()->SetDefault(myColour);
}
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4ModelingParameters.cc,v 1.7 2005/03/15 12:56:29 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ModelingParameters.cc,v 1.10 2006/06/29 21:32:48 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 31st December 1997.
@@ -32,9 +35,11 @@
#include "G4ios.hh"
#include "G4VisAttributes.hh"
#include "G4ExceptionSeverity.hh"
G4ModelingParameters::G4ModelingParameters ():
fpDefaultVisAttributes (0),
fDrawingStyle (wf),
fRepStyle (polyhedron),
fCulling (false),
fCullInvisible (false),
@@ -58,6 +63,7 @@ G4ModelingParameters::G4ModelingParameters
G4int noOfSides
):
fpDefaultVisAttributes (pDefaultVisAttributes),
fDrawingStyle (wf),
fRepStyle (repStyle),
fCulling (isCulling),
fCullInvisible (isCullingInvisible),
@@ -84,6 +90,60 @@ G4ModelingParameters::G4ModelingParameters
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,
G4bool isCulling,
G4bool isCullingInvisible,
G4bool isDensityCulling,
G4double visibleDensity,
G4bool isCullingCovered,
G4int noOfSides
):
fpDefaultVisAttributes (pDefaultVisAttributes),
fDrawingStyle (drawingStyle),
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::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),
@@ -132,6 +192,7 @@ void G4ModelingParameters::PrintDifferences
if (
(fpDefaultVisAttributes != that.fpDefaultVisAttributes) ||
(fDrawingStyle != that.fDrawingStyle) ||
(fRepStyle != that.fRepStyle) ||
(fCulling != that.fCulling) ||
(fCullInvisible != that.fCullInvisible) ||
@@ -148,7 +209,23 @@ void G4ModelingParameters::PrintDifferences
std::ostream& operator << (std::ostream& os, const G4ModelingParameters& mp) {
os << "Modeling parameters and options:";
os << "\n Default vis. attributes: " << *mp.fpDefaultVisAttributes;
const G4VisAttributes* va = mp.fpDefaultVisAttributes;
os << "\n Default vis. attributes: ";
if (va) os << *va;
else os << "none";
os << "\n Current requested drawing style: ";
switch (mp.fDrawingStyle) {
case G4ModelingParameters::wf:
os << "wireframe"; break;
case G4ModelingParameters::hlr:
os << "hidden line removal (hlr)"; break;
case G4ModelingParameters::hsr:
os << "surface (hsr)"; break;
case G4ModelingParameters::hlhsr:
os << "surface and edges (hlhsr)"; break;
default: os << "unrecognised"; break;
}
os << "\n Representation style for graphics reps, if needed: ";
switch (mp.fRepStyle) {
@@ -203,6 +280,7 @@ G4bool G4ModelingParameters::operator !=
if (
(*fpDefaultVisAttributes != *mp.fpDefaultVisAttributes) ||
(fDrawingStyle != mp.fDrawingStyle) ||
(fRepStyle != mp.fRepStyle) ||
(fCulling != mp.fCulling) ||
(fCullInvisible != mp.fCullInvisible) ||
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4NullModel.cc,v 1.7 2003/05/30 13:01:32 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4NullModel.cc,v 1.9 2006/06/29 21:32:50 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 4th April 1998.
@@ -32,7 +35,7 @@
#include "G4NullModel.hh"
G4NullModel::G4NullModel (const G4ModelingParameters* pMP):
G4VModel (G4Transform3D::Identity, pMP) {}
G4VModel (G4Transform3D(), pMP) {}
G4NullModel::~G4NullModel () {}
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4PhysicalVolumeMassScene.cc,v 1.4 2005/01/26 16:48:56 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4PhysicalVolumeMassScene.cc,v 1.6 2006/06/29 21:32:52 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 10th August 1998.
@@ -39,29 +42,19 @@
#include "G4VPVParameterisation.hh"
#include "G4UnitsTable.hh"
G4PhysicalVolumeMassScene::G4PhysicalVolumeMassScene ():
G4PhysicalVolumeMassScene::G4PhysicalVolumeMassScene
(G4PhysicalVolumeModel* pPVModel):
fpPVModel (pPVModel),
fVolume (0.),
fMass (0.),
fpLastPV (0),
fPVPCount (0),
fLastDepth (0),
fLastDensity (0.),
fCurrentDepth (0),
fpCurrentPV (0),
fpCurrentLV (0),
fpCurrentMaterial (0)
fLastDensity (0.)
{}
G4PhysicalVolumeMassScene::~G4PhysicalVolumeMassScene () {}
void G4PhysicalVolumeMassScene::EstablishSpecials
(G4PhysicalVolumeModel& pvModel) {
pvModel.DefinePointersToWorkingSpace (&fCurrentDepth,
&fpCurrentPV,
&fpCurrentLV,
&fpCurrentMaterial);
}
void G4PhysicalVolumeMassScene::Reset ()
{
fVolume = 0.;
@@ -71,32 +64,33 @@ void G4PhysicalVolumeMassScene::Reset ()
fLastDepth = 0;
fLastDensity = 0.;
fDensityStack.clear();
fCurrentDepth = 0;
fpCurrentPV = 0;
fpCurrentLV = 0;
fpCurrentMaterial = 0;
}
void G4PhysicalVolumeMassScene::AccrueMass (const G4VSolid& solid)
{
if (fpCurrentPV != fpLastPV) {
fpLastPV = fpCurrentPV;
G4int currentDepth = fpPVModel->GetCurrentDepth();
G4VPhysicalVolume* pCurrentPV = fpPVModel->GetCurrentPV();
//G4LogicalVolume* pCurrentLV = fpPVModel->GetCurrentLV();
G4Material* pCurrentMaterial = fpPVModel->GetCurrentMaterial();
if (pCurrentPV != fpLastPV) {
fpLastPV = pCurrentPV;
fPVPCount = 0;
}
G4double currentVolume = ((G4VSolid&)solid).GetCubicVolume();
G4double currentDensity = fpCurrentMaterial->GetDensity();
G4double currentDensity = pCurrentMaterial->GetDensity();
/* Using G4Polyhedron... (gives slightly different answers on Tubs, e.g.).
G4Polyhedron* pPolyhedron = solid.GetPolyhedron();
if (pPolyhedron) {
G4Material* pMaterial;
G4VPVParameterisation* pP = fpCurrentPV->GetParameterisation();
G4VPVParameterisation* pP = pCurrentPV->GetParameterisation();
if (pP) {
pMaterial = pP -> ComputeMaterial (fPVPCount++, fpCurrentPV);
pMaterial = pP -> ComputeMaterial (fPVPCount++, pCurrentPV);
} else {
pMaterial = fpCurrentLV->GetMaterial();
pMaterial = pCurrentLV->GetMaterial();
}
assert(pMaterial == fpCurrentMaterial);
assert(pMaterial == pCurrentMaterial);
currentVolume = pPolyhedron->GetVolume();
currentDensity = pMaterial->GetDensity();
} else {
@@ -112,17 +106,17 @@ void G4PhysicalVolumeMassScene::AccrueMass (const G4VSolid& solid)
}
*/
if (fCurrentDepth == 0) fVolume = currentVolume;
if (currentDepth == 0) fVolume = currentVolume;
if (fCurrentDepth > fLastDepth) {
if (currentDepth > fLastDepth) {
fDensityStack.push_back (fLastDensity);
} else if (fCurrentDepth < fLastDepth) {
} else if (currentDepth < fLastDepth) {
fDensityStack.pop_back();
}
fLastDepth = fCurrentDepth;
fLastDepth = currentDepth;
fLastDensity = currentDensity;
G4double motherDensity = 0.;
if (fCurrentDepth > 0) motherDensity = fDensityStack.back();
if (currentDepth > 0) motherDensity = fDensityStack.back();
G4double subtractedMass = currentVolume * motherDensity;
G4double addedMass = currentVolume * currentDensity;
@@ -145,9 +139,9 @@ void G4PhysicalVolumeMassScene::AccrueMass (const G4VSolid& solid)
G4cout <<
"G4PhysicalVolumeMassScene::AccrueMass: WARNING:"
"\n Mass going negative for \""
<< fpCurrentPV->GetName() <<
<< pCurrentPV->GetName() <<
"\", copy "
<< fpCurrentPV->GetCopyNo() <<
<< pCurrentPV->GetCopyNo() <<
". Larger than mother?"
<< G4endl;
}
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4PhysicalVolumeModel.cc,v 1.36 2005/11/24 11:15:21 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4PhysicalVolumeModel.cc,v 1.47 2006/06/29 21:32:54 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 31st December 1997.
@@ -41,11 +44,37 @@
#include "G4BoundingSphereScene.hh"
#include "G4PhysicalVolumeSearchScene.hh"
#include "G4TransportationManager.hh"
#include "G4VVisManager.hh"
#include "G4Polyhedron.hh"
#include <sstream>
G4bool G4PhysicalVolumeModel::G4PhysicalVolumeNodeID::operator<
(const G4PhysicalVolumeModel::G4PhysicalVolumeNodeID& right) const
{
if (fpPV < right.fpPV) return true;
if (fpPV == right.fpPV) return fCopyNo < right.fCopyNo;
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();
} else {
os << "Null node";
}
return os;
}
G4PhysicalVolumeModel::G4PhysicalVolumeModel
(G4VPhysicalVolume* pVPV,
G4int requestedDepth,
@@ -61,12 +90,14 @@ G4PhysicalVolumeModel::G4PhysicalVolumeModel
fCurrentDepth (0),
fpCurrentPV (0),
fpCurrentLV (0),
fpCurrentMaterial (0),
fCurtailDescent (false),
fpClippingPolyhedron (0),
fpCurrentDepth (0),
fppCurrentPV (0),
fppCurrentLV (0),
fppCurrentMaterial (0)
fpCurrentDepth (0),
fppCurrentPV (0),
fppCurrentLV (0),
fppCurrentMaterial (0),
fpDrawnPVPath (0)
{
std::ostringstream o;
o << fpTopPV -> GetCopyNo ();
@@ -78,7 +109,8 @@ G4PhysicalVolumeModel::G4PhysicalVolumeModel
G4PhysicalVolumeModel::~G4PhysicalVolumeModel () {}
void G4PhysicalVolumeModel::CalculateExtent () {
void G4PhysicalVolumeModel::CalculateExtent ()
{
if (fUseFullExtent) {
fExtent = fpTopPV -> GetLogicalVolume () -> GetSolid () -> GetExtent ();
}
@@ -88,7 +120,7 @@ void G4PhysicalVolumeModel::CalculateExtent () {
fRequestedDepth = -1; // Always search to all depths to define extent.
const G4ModelingParameters* tempMP = fpMP;
G4ModelingParameters mParams
(0, // No default vis attributes.
(0, // No default vis attributes needed.
G4ModelingParameters::wireframe,
true, // Global culling.
true, // Cull invisible volumes.
@@ -120,43 +152,52 @@ void G4PhysicalVolumeModel::CalculateExtent () {
}
void G4PhysicalVolumeModel::DescribeYourselfTo
(G4VGraphicsScene& sceneHandler) {
(G4VGraphicsScene& sceneHandler)
{
if (!fpMP) G4Exception
("G4PhysicalVolumeModel::DescribeYourselfTo: No modeling parameters.");
if (fpMP && fpMP -> IsViewGeom ()) {
sceneHandler.EstablishSpecials (*this);
// See .hh file for explanation of this mechanism.
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;
fCurrentDepth = 0;
// Store in working space (via pointer to working space).
if (fpCurrentDepth) *fpCurrentDepth = fCurrentDepth;
G4Transform3D startingTransformation = fTransform;
G4Transform3D startingTransformation = fTransform;
VisitGeometryAndGetVisReps
(fpTopPV,
fRequestedDepth,
startingTransformation,
sceneHandler);
VisitGeometryAndGetVisReps (fpTopPV,
fRequestedDepth,
startingTransformation,
sceneHandler);
// Clear data...
fCurrentDepth = 0;
fpCurrentPV = 0;
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();
// Clear current data and working space (via pointers to working space).
fCurrentDepth = 0;
fpCurrentPV = 0;
fpCurrentLV = 0;
if (fpCurrentDepth) *fpCurrentDepth = fCurrentDepth;
if (fppCurrentPV) *fppCurrentPV = fpCurrentPV;
if (fppCurrentLV) *fppCurrentLV = fpCurrentLV;
if (fppCurrentMaterial) *fppCurrentMaterial = fpCurrentMaterial;
sceneHandler.DecommissionSpecials (*this);
sceneHandler.DecommissionSpecials (*this);
// Clear pointers to working space.
fpCurrentDepth = 0;
fppCurrentPV = 0;
fppCurrentLV = 0;
fppCurrentMaterial = 0;
}
// Clear pointers to working space.
fpCurrentDepth = 0;
fppCurrentPV = 0;
fppCurrentLV = 0;
fppCurrentMaterial = 0;
fpDrawnPVPath = 0;
}
G4String G4PhysicalVolumeModel::GetCurrentTag () const {
G4String G4PhysicalVolumeModel::GetCurrentTag () const
{
if (fpCurrentPV) {
std::ostringstream o;
o << fpCurrentPV -> GetCopyNo ();
@@ -167,7 +208,8 @@ G4String G4PhysicalVolumeModel::GetCurrentTag () const {
}
}
G4String G4PhysicalVolumeModel::GetCurrentDescription () const {
G4String G4PhysicalVolumeModel::GetCurrentDescription () const
{
return "G4PhysicalVolumeModel " + GetCurrentTag ();
}
@@ -175,19 +217,22 @@ void G4PhysicalVolumeModel::DefinePointersToWorkingSpace
(G4int* pCurrentDepth,
G4VPhysicalVolume** ppCurrentPV,
G4LogicalVolume** ppCurrentLV,
G4Material** ppCurrentMaterial) {
fpCurrentDepth = pCurrentDepth;
fppCurrentPV = ppCurrentPV;
fppCurrentLV = ppCurrentLV;
G4Material** ppCurrentMaterial,
std::vector<G4PhysicalVolumeNodeID>* pDrawnPVPath)
{
fpCurrentDepth = pCurrentDepth;
fppCurrentPV = ppCurrentPV;
fppCurrentLV = ppCurrentLV;
fppCurrentMaterial = ppCurrentMaterial;
fpDrawnPVPath = pDrawnPVPath;
}
void G4PhysicalVolumeModel::VisitGeometryAndGetVisReps
(G4VPhysicalVolume* pVPV,
G4int requestedDepth,
const G4Transform3D& theAT,
G4VGraphicsScene& sceneHandler) {
G4VGraphicsScene& sceneHandler)
{
// Visits geometry structure to a given depth (requestedDepth), starting
// at given physical volume with given starting transformation and
// describes volumes to the scene handler.
@@ -326,17 +371,17 @@ void G4PhysicalVolumeModel::DescribeAndDescend
G4VSolid* pSol,
G4Material* pMaterial,
const G4Transform3D& theAT,
G4VGraphicsScene& sceneHandler) {
// Maintain data members and store in working space (via pointers to
// working space).
if (fpCurrentDepth) *fpCurrentDepth = fCurrentDepth;
G4VGraphicsScene& sceneHandler)
{
// Maintain useful data members...
fpCurrentPV = pVPV;
fpCurrentLV = pLV;
fpCurrentMaterial = pMaterial;
if (fppCurrentPV) *fppCurrentPV = fpCurrentPV;
if (fppCurrentLV) *fppCurrentLV = fpCurrentLV;
if (fppCurrentMaterial) *fppCurrentMaterial = fpCurrentMaterial;
// ...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 ();
@@ -378,50 +423,141 @@ void G4PhysicalVolumeModel::DescribeAndDescend
G4cout << G4endl;
**********************************************************/
// Make decision to Draw.
G4bool thisToBeDrawn = !IsThisCulled (pLV, pMaterial);
// Make decision to draw...
const G4VisAttributes* pVisAttribs = pLV->GetVisAttributes();
if (!pVisAttribs) pVisAttribs = fpMP->GetDefaultVisAttributes();
// Beware - pVisAttribs might still be zero - create a temporary default one...
G4bool visAttsCreated = false;
if (!pVisAttribs) {
pVisAttribs = new G4VisAttributes;
visAttsCreated = true;
}
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 cullingLowDensity = fpMP->IsDensityCulling();
G4double density = pMaterial->GetDensity();
G4double densityCut = fpMP -> GetVisibleDensity ();
// 1) Global culling is on....
if (culling) {
// 2) Culling of invisible volumes is on...
if (cullingInvisible) {
// 3) ...and the volume is marked not visible...
if (!markedVisible) thisToBeDrawn = false;
}
// 4) Or culling of low density volumes is on...
if (cullingLowDensity) {
// 5) ...and density is less than cut value...
if (density < densityCut) thisToBeDrawn = false;
}
}
if (thisToBeDrawn) {
const G4VisAttributes* pVisAttribs = pLV -> GetVisAttributes ();
if (!pVisAttribs) pVisAttribs = fpMP -> GetDefaultVisAttributes ();
// Update path of physical volumes, if required...
G4int copyNo = fpCurrentPV->GetCopyNo();
fDrawnPVPath.push_back(G4PhysicalVolumeNodeID(fpCurrentPV,copyNo));
if (fpDrawnPVPath) {
fpDrawnPVPath->push_back(G4PhysicalVolumeNodeID(fpCurrentPV,copyNo));
}
DescribeSolid (theNewAT, pSol, pVisAttribs, sceneHandler);
}
if (fCurtailDescent) {
fCurtailDescent = false;
// Reset for normal descending of next volume at this level.
return;
}
// Make decision to draw daughters, if any. There are various
// reasons why daughters might not be drawn...
// First check if mother covers...
// First, reasons that do not depend on culling policy...
G4int nDaughters = pLV->GetNoDaughters();
G4bool daughtersToBeDrawn = true;
// 1) There are no daughters...
if (!nDaughters) daughtersToBeDrawn = false;
// 2) We are at the limit if requested depth...
else if (requestedDepth == 0) daughtersToBeDrawn = false;
// 3) The user has asked that the descent be curtailed...
else if (fCurtailDescent) daughtersToBeDrawn = false;
// This is only effective in surface drawing style, and then only if
// the volumes are visible and opaque, and then only if no sections
// or cutways are in operation.
G4bool cullDaughter = thisToBeDrawn && IsDaughterCulled (pLV);
if (!cullDaughter) {
// OK, now let's check for daughters...
if (requestedDepth != 0) {
int nDaughters = pLV -> GetNoDaughters ();
if (nDaughters) {
for (int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
G4VPhysicalVolume* pVPV = pLV -> GetDaughter (iDaughter);
// Descend the geometry structure recursively...
fCurrentDepth++;
VisitGeometryAndGetVisReps
(pVPV, requestedDepth - 1, theNewAT, sceneHandler);
fCurrentDepth--;
// Now, reasons that depend on culling policy...
else {
G4bool culling = fpMP->IsCulling();
G4bool cullingInvisible = fpMP->IsCullingInvisible();
G4bool daughtersInvisible =
pVisAttribs? pVisAttribs->IsDaughtersInvisible(): false;
// Culling of covered daughters request. This is computed in
// G4VSceneHandler::CreateModelingParameters() depending on view
// parameters...
G4bool cullingCovered = fpMP->IsCullingCovered();
G4bool surfaceDrawing =
fpMP->GetDrawingStyle() == G4ModelingParameters::hsr ||
fpMP->GetDrawingStyle() == G4ModelingParameters::hlhsr;
if (pVisAttribs && 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;
// 4) Global culling is on....
if (culling) {
// 5) ..and culling of invisible volumes is on...
if (cullingInvisible) {
// 6) ...and the mother requests daughters invisible
if (daughtersInvisible) daughtersToBeDrawn = false;
}
// 7) Or culling of covered daughters is requested...
if (cullingCovered) {
// 8) ...and surface drawing is operating...
if (surfaceDrawing) {
// 9) ...but only if mother is visible...
if (thisToBeDrawn) {
// 10) ...and opaque...
if (opaque) daughtersToBeDrawn = false;
}
}
}
}
}
// Vis atts for this volume no longer needed if created...
if (visAttsCreated) delete pVisAttribs;
if (daughtersToBeDrawn) {
for (G4int iDaughter = 0; iDaughter < nDaughters; iDaughter++) {
G4VPhysicalVolume* pVPV = pLV -> GetDaughter (iDaughter);
// Descend the geometry structure recursively...
fCurrentDepth++;
VisitGeometryAndGetVisReps
(pVPV, requestedDepth - 1, theNewAT, sceneHandler);
fCurrentDepth--;
}
}
// Reset for normal descending of next volume at this level...
fCurtailDescent = false;
// Pop item from path of physical volumes...
if (thisToBeDrawn) {
fDrawnPVPath.pop_back();
if (fpDrawnPVPath) {
fpDrawnPVPath->pop_back();
}
}
}
void G4PhysicalVolumeModel::DescribeSolid
(const G4Transform3D& theAT,
G4VSolid* pSol,
const G4VisAttributes* pVisAttribs,
G4VGraphicsScene& sceneHandler) {
G4VGraphicsScene& sceneHandler)
{
sceneHandler.PreAddSolid (theAT, *pVisAttribs);
if (fpClippingPolyhedron) // Clip and force polyhedral representation...
{
@@ -445,7 +581,9 @@ void G4PhysicalVolumeModel::DescribeSolid
else
{
clipped.SetVisAttributes(pVisAttribs);
G4VVisManager::GetConcreteInstance()->Draw(clipped,theAT);
sceneHandler.BeginPrimitives(theAT);
sceneHandler.AddPrimitive(clipped);
sceneHandler.EndPrimitives();
}
}
}
@@ -457,66 +595,8 @@ void G4PhysicalVolumeModel::DescribeSolid
sceneHandler.PostAddSolid ();
}
G4bool G4PhysicalVolumeModel::IsThisCulled (const G4LogicalVolume* pLV,
const G4Material* pMaterial) {
// If true, cull, i.e., do not Draw.
G4double density = 0.;
if (pMaterial) density = pMaterial -> GetDensity ();
const G4VisAttributes* pVisAttribs = pLV -> GetVisAttributes ();
if (!pVisAttribs) pVisAttribs = fpMP -> GetDefaultVisAttributes ();
if (fpMP) {
return
fpMP -> IsCulling () && // Global culling flag.
(
// Invisible volumes...
(fpMP -> IsCullingInvisible () &&
!(pVisAttribs ? pVisAttribs -> IsVisible () : true)) ||
// Low density volumes...
(fpMP -> IsDensityCulling () &&
(density < fpMP -> GetVisibleDensity ()))
)
;
}
else {
return false;
}
}
G4bool G4PhysicalVolumeModel::IsDaughterCulled
(const G4LogicalVolume* pMotherLV) {
// If true, cull, i.e., do not Draw.
const G4VisAttributes* pVisAttribs = pMotherLV -> GetVisAttributes ();
if (!pVisAttribs) pVisAttribs = fpMP -> GetDefaultVisAttributes ();
if (fpMP) {
return
fpMP -> IsCulling () // Global culling flag.
&&
(
// Does mother request daughters not to be drawn?
(pVisAttribs ? pVisAttribs -> IsDaughtersInvisible () : false)
||
(
// Global covered daughter flag. This is affected by drawing
// style, etc. The enforcing of this is done in
// G4VScene::CreateModelingParameters ()
fpMP -> IsCullingCovered ()
&&
// Cull only if mother is visible...
(pVisAttribs ? pVisAttribs -> IsVisible () : true)
&&
// ...and opaque...
(pVisAttribs ? (pVisAttribs -> GetColour ().GetAlpha() >= 1.) : true)
)
)
;
}
else {
return false;
}
}
G4bool G4PhysicalVolumeModel::Validate (G4bool warn) {
G4bool G4PhysicalVolumeModel::Validate (G4bool warn)
{
G4VPhysicalVolume* world =
G4TransportationManager::GetTransportationManager ()
-> GetNavigatorForTracking () -> GetWorldVolume ();
@@ -525,9 +605,11 @@ G4bool G4PhysicalVolumeModel::Validate (G4bool warn) {
if (warn) {
G4cout << "G4PhysicalVolumeModel::Validate() called." << G4endl;
}
G4PhysicalVolumeSearchScene searchScene (fTopPVName, fTopPVCopyNo);
G4PhysicalVolumeModel searchModel (world);
G4PhysicalVolumeSearchScene searchScene
(&searchModel, fTopPVName, fTopPVCopyNo);
G4ModelingParameters mp; // Default modeling parameters for this search.
mp.SetDefaultVisAttributes(fpMP? fpMP->GetDefaultVisAttributes(): 0);
searchModel.SetModelingParameters (&mp);
searchModel.DescribeYourselfTo (searchScene);
G4VPhysicalVolume* foundVolume = searchScene.GetFoundVolume ();
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4PhysicalVolumeSearchScene.cc,v 1.9 2005/11/22 16:34:20 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4PhysicalVolumeSearchScene.cc,v 1.12 2006/06/29 21:32:56 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 10th August 1998.
@@ -35,13 +38,12 @@
#include "G4PhysicalVolumeModel.hh"
G4PhysicalVolumeSearchScene::G4PhysicalVolumeSearchScene
(const G4String& requiredPhysicalVolumeName, G4int requiredCopyNo):
(G4PhysicalVolumeModel* pPVModel,
const G4String& requiredPhysicalVolumeName,
G4int requiredCopyNo):
fpPVModel (pPVModel),
fRequiredPhysicalVolumeName (requiredPhysicalVolumeName),
fRequiredCopyNo (requiredCopyNo),
fCurrentDepth (0),
fpCurrentPV (0),
fpCurrentLV (0),
fpCurrentMaterial (0),
fpCurrentObjectTransformation (0),
fFoundDepth (0),
fpFoundPV (0),
@@ -51,31 +53,28 @@ G4PhysicalVolumeSearchScene::G4PhysicalVolumeSearchScene
G4PhysicalVolumeSearchScene::~G4PhysicalVolumeSearchScene () {}
void G4PhysicalVolumeSearchScene::EstablishSpecials
(G4PhysicalVolumeModel& pvModel) {
pvModel.DefinePointersToWorkingSpace (&fCurrentDepth,
&fpCurrentPV,
&fpCurrentLV,
&fpCurrentMaterial);
}
void G4PhysicalVolumeSearchScene::FindVolume (const G4VSolid&) {
G4int currentDepth = fpPVModel->GetCurrentDepth();
G4VPhysicalVolume* pCurrentPV = fpPVModel->GetCurrentPV();
G4LogicalVolume* pCurrentLV = fpPVModel->GetCurrentLV();
//G4Material* pCurrentMaterial = fpPVModel->GetCurrentMaterial();
/**************************************************
G4cout << "Required volume: \"" << fRequiredPhysicalVolumeName
<< "\", copy no. " << fRequiredCopyNo << G4endl;
G4cout << "PhysicalVolume: \"" << fpCurrentPV -> GetName ()
<< "\", copy no. " << fpCurrentPV -> GetCopyNo () << G4endl;
G4cout << "PhysicalVolume: \"" << pCurrentPV -> GetName ()
<< "\", copy no. " << pCurrentPV -> GetCopyNo () << G4endl;
*******************************************/
if (fRequiredPhysicalVolumeName == fpCurrentPV -> GetName () &&
if (fRequiredPhysicalVolumeName == pCurrentPV -> GetName () &&
(fRequiredCopyNo < 0 || // I.e., ignore negative request.
fRequiredCopyNo == fpCurrentPV -> GetCopyNo ())) {
fRequiredCopyNo == pCurrentPV -> GetCopyNo ())) {
// Current policy - take first one found!!
if (!fpFoundPV) { // i.e., if not already found.
fFoundDepth = fCurrentDepth;
fpFoundPV = fpCurrentPV;
fpFoundLV = fpCurrentLV;
fFoundDepth = currentDepth;
fpFoundPV = pCurrentPV;
fpFoundLV = pCurrentLV;
fFoundObjectTransformation = *fpCurrentObjectTransformation;
}
else {
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4ScaleModel.cc,v 1.3 2001/08/14 18:43:31 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ScaleModel.cc,v 1.4 2006/06/29 21:32:58 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 21st July 2001.
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TextModel.cc,v 1.6 2005/06/07 16:53:40 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TextModel.cc,v 1.7 2006/06/29 21:33:00 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 3rd April 2001
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TrajectoriesModel.cc,v 1.14 2005/01/27 20:07:05 johna Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TrajectoriesModel.cc,v 1.18 2006/06/29 21:33:02 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 26th August 1998.
@@ -31,7 +34,7 @@
#include "G4TrajectoriesModel.hh"
#include "G4VGraphicsScene.hh"
#include "G4RunManager.hh"
#include "G4EventManager.hh"
#include "G4Event.hh"
G4TrajectoriesModel::~G4TrajectoriesModel () {}
@@ -43,8 +46,8 @@ fDrawingMode(drawingMode) {
}
void G4TrajectoriesModel::DescribeYourselfTo (G4VGraphicsScene& sceneHandler) {
G4RunManager* runManager = G4RunManager::GetRunManager ();
const G4Event* event = runManager -> GetCurrentEvent ();
const G4Event* event =
G4EventManager::GetEventManager()->GetConstCurrentEvent();
if (event) {
G4TrajectoryContainer* TC = event -> GetTrajectoryContainer ();
if (TC) {
@@ -0,0 +1,129 @@
//
// ********************************************************************
// * 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: G4TrajectoryChargeFilter.cc,v 1.3 2006/06/29 21:33:04 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Filter trajectories according to charge. Only registered
// charges will pass the filter.
//
// Jane Tinslay May 2006
//
#include "G4TrajectoryChargeFilter.hh"
#include <sstream>
G4TrajectoryChargeFilter::G4TrajectoryChargeFilter(const G4String& name)
:G4SmartFilter<G4VTrajectory>(name)
{}
G4TrajectoryChargeFilter::~G4TrajectoryChargeFilter() {}
bool
G4TrajectoryChargeFilter::Evaluate(const G4VTrajectory& traj)
{
G4double charge = traj.GetCharge();
if (GetVerbose()) G4cout<<"G4TrajectoryChargeFilter processing trajectory with charge: "<<charge<<G4endl;
MyCharge myCharge;
if(charge>0.) myCharge = Positive;
else if(charge<0.) myCharge = Negative;
else myCharge = Neutral;
std::vector<MyCharge>::const_iterator iter = std::find(fCharges.begin(), fCharges.end(), myCharge);
// Fail if charge not registered
if (iter == fCharges.end()) return false;
return true;
}
void
G4TrajectoryChargeFilter::Add(const G4String& charge)
{
MyCharge myCharge;
if (!ConvertToCharge(charge, myCharge)) {
std::ostringstream o;
o << "Invalid charge "<<charge;
G4Exception
("G4TrajectoryChargeFilter::Add(const G4String& charge)", "InvalidCharge", JustWarning, o.str().c_str());
return;
}
return Add(myCharge);
}
void
G4TrajectoryChargeFilter::Add(const MyCharge& charge)
{
fCharges.push_back(charge);
}
void
G4TrajectoryChargeFilter::Print(std::ostream& ostr) const
{
ostr<<"Charges registered: "<<G4endl;
std::vector<MyCharge>::const_iterator iter = fCharges.begin();
while (iter != fCharges.end()) {
ostr<<*iter<<G4endl;
iter++;
}
}
void
G4TrajectoryChargeFilter::Clear()
{
// Clear registered charge vector
fCharges.clear();
}
G4bool
G4TrajectoryChargeFilter::ConvertToCharge(const G4String& string, MyCharge& myCharge)
{
bool result(true);
G4int charge;
std::istringstream is(string.c_str());
is >> charge;
switch (charge) {
case 1:
myCharge = G4TrajectoryChargeFilter::Positive;
break;
case 0:
myCharge = G4TrajectoryChargeFilter::Neutral;
break;
case -1:
myCharge = G4TrajectoryChargeFilter::Negative;
break;
default:
result = false;
}
return result;
}
@@ -1,43 +1,43 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TrajectoryDrawByCharge.cc,v 1.3 2005/11/23 20:24:15 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TrajectoryDrawByCharge.cc,v 1.8 2006/06/29 21:33:06 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
#include "G4TrajectoryDrawByCharge.hh"
#include "G4Polyline.hh"
#include "G4Polymarker.hh"
#include "G4TrajectoryDrawerUtils.hh"
#include "G4VisAttributes.hh"
#include "G4VisTrajContext.hh"
#include "G4VTrajectory.hh"
#include "G4VVisManager.hh"
#include <sstream>
G4TrajectoryDrawByCharge::G4TrajectoryDrawByCharge(const G4String& name)
:G4VTrajectoryModel(name)
G4TrajectoryDrawByCharge::G4TrajectoryDrawByCharge(const G4String& name, G4VisTrajContext* context)
:G4VTrajectoryModel(name, context)
{
// Default configuration
fMap[Positive] = G4Color::Blue();
fMap[Positive] = G4Colour::Blue();
fMap[Negative] = G4Colour::Red();
fMap[Neutral] = G4Colour::Green();
}
@@ -56,93 +56,105 @@ G4TrajectoryDrawByCharge::G4TrajectoryDrawByCharge(const G4String& name,
G4TrajectoryDrawByCharge::~G4TrajectoryDrawByCharge() {}
void
G4TrajectoryDrawByCharge::Draw(const G4VTrajectory& traj, G4int i_mode) const
G4TrajectoryDrawByCharge::Draw(const G4VTrajectory& traj, const G4int& i_mode, const G4bool& visible) const
{
// 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.
G4Colour colour;
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (0 == pVVisManager) return;
const G4double charge = traj.GetCharge();
const G4double markerSize = std::abs(i_mode)/1000;
G4bool lineRequired (i_mode >= 0);
G4bool markersRequired (markerSize > 0.);
if(charge>0.) fMap.GetColour(Positive, colour);
else if(charge<0.) fMap.GetColour(Negative, colour);
else fMap.GetColour(Neutral, colour);
// Return if don't need to do anything
if (!lineRequired && !markersRequired) return;
// Get points to draw
G4Polyline trajectoryLine;
G4Polymarker stepPoints;
G4Polymarker auxiliaryPoints;
G4VisTrajContext myContext(GetContext());
G4TrajectoryDrawerUtils::GetPoints(traj, trajectoryLine,
auxiliaryPoints, stepPoints);
myContext.SetLineColour(colour);
myContext.SetVisible(visible);
if (lineRequired) {
G4Colour colour;
const G4double charge = traj.GetCharge();
if(charge>0.) colour = fMap.find(Positive)->second;
else if(charge<0.) colour = fMap.find(Negative)->second;
else colour = fMap.find(Neutral)->second;
G4VisAttributes trajectoryLineAttribs(colour);
trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
pVVisManager->Draw(trajectoryLine);
if (GetVerbose()) {
G4cout<<"G4TrajectoryDrawByCharge drawer named "<<Name();
G4cout<<", drawing trajectory with charge, "<<charge<<G4endl;
G4cout<<", with configuration:"<<G4endl;
myContext.Print(G4cout);
}
if (markersRequired) {
auxiliaryPoints.SetMarkerType(G4Polymarker::squares);
auxiliaryPoints.SetScreenSize(markerSize);
auxiliaryPoints.SetFillStyle(G4VMarker::filled);
G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.)); // Magenta
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);
}
G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, myContext, i_mode);
}
void
G4TrajectoryDrawByCharge::Print(std::ostream& ostr) const
{
ostr<<"G4TrajectoryDrawByCharge model "<< Name() <<" colour scheme: "<<std::endl;
std::map<Charge, G4Colour>::const_iterator iter = fMap.begin();
while (iter != fMap.end()) {
ostr<< iter->first <<" : "<< iter->second <<G4endl;
iter++;
}
fMap.Print(ostr);
ostr<<"Default configuration:"<<G4endl;
GetContext().Print(G4cout);
}
void
G4TrajectoryDrawByCharge::Set(Charge charge, const G4String& colour)
G4TrajectoryDrawByCharge::Set(const Charge& charge, const G4String& colour)
{
G4Colour myColour(G4Colour::White());
// 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 ";
G4Exception
("G4TrajectoryDrawByCharge::Set(Charge charge, const G4String& colour)",
"NonExistentColour", JustWarning, o.str().c_str());
}
Set(charge, myColour);
fMap.Set(charge, colour);
}
void
G4TrajectoryDrawByCharge::Set(Charge charge, const G4Colour& colour)
G4TrajectoryDrawByCharge::Set(const Charge& charge, const G4Colour& colour)
{
fMap[charge] = colour;
}
void
G4TrajectoryDrawByCharge::Set(const G4String& charge, const G4String& colour)
{
Charge myCharge;
if (!ConvertToCharge(charge, myCharge)) {
std::ostringstream o;
o << "Invalid charge "<<charge;
G4Exception
("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4String& colour)", "InvalidCharge", JustWarning, o.str().c_str());
return;
}
return Set(myCharge, colour);
}
void
G4TrajectoryDrawByCharge::Set(const G4String& charge, const G4Colour& colour)
{
Charge myCharge;
if (!ConvertToCharge(charge, myCharge)) {
std::ostringstream o;
o << "Invalid charge "<<charge;
G4Exception
("G4TrajectoryDrawByCharge::Set(const G4int& charge, const G4Colour& colour)", "InvalidCharge", JustWarning, o.str().c_str());
}
return Set(myCharge, colour);
}
G4bool
G4TrajectoryDrawByCharge::ConvertToCharge(const G4String& string, Charge& myCharge)
{
bool result(true);
G4int charge;
std::istringstream is(string.c_str());
is >> charge;
switch (charge) {
case 1:
myCharge = G4TrajectoryDrawByCharge::Positive;
break;
case 0:
myCharge = G4TrajectoryDrawByCharge::Neutral;
break;
case -1:
myCharge = G4TrajectoryDrawByCharge::Negative;
break;
default:
result = false;
}
return result;
}
@@ -0,0 +1,130 @@
//
// ********************************************************************
// * 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: G4TrajectoryDrawByOriginVolume.cc,v 1.4 2006/06/29 21:33:08 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay March 2006
#include "G4TrajectoryDrawByOriginVolume.hh"
#include "G4TrajectoryDrawerUtils.hh"
#include "G4VTrajectory.hh"
#include "G4TransportationManager.hh"
#include "G4VisTrajContext.hh"
#include "G4VTrajectoryPoint.hh"
#include <sstream>
G4TrajectoryDrawByOriginVolume::G4TrajectoryDrawByOriginVolume(const G4String& name, G4VisTrajContext* context)
:G4VTrajectoryModel(name, context)
,fDefault(G4Colour::Grey())
{}
G4TrajectoryDrawByOriginVolume::~G4TrajectoryDrawByOriginVolume() {}
void
G4TrajectoryDrawByOriginVolume::Draw(const G4VTrajectory& traj, const G4int& i_mode, const G4bool& visible) const
{
G4Colour colour(fDefault);
G4Navigator* navigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
assert (0 != aTrajectoryPoint);
G4VPhysicalVolume* volume = navigator->LocateGlobalPointAndSetup(aTrajectoryPoint->GetPosition());
// Logical volumes form basis.
G4LogicalVolume* logicalVolume = volume->GetLogicalVolume();
assert (0 != logicalVolume);
G4String logicalName = logicalVolume->GetName();
fMap.GetColour(logicalName, colour);
// Override with physical volume colouring if it exists
G4String physicalName = volume->GetName();
fMap.GetColour(physicalName, colour);
G4VisTrajContext myContext(GetContext());
myContext.SetLineColour(colour);
myContext.SetVisible(visible);
if (GetVerbose()) {
G4cout<<"G4TrajectoryDrawByOriginVolume drawer named "<<Name();
G4cout<<", drawing trajectory originating in logical volume, "<<logicalName;
G4cout<<", physical volumed "<<physicalName<<", with configuration:"<<G4endl;
myContext.Print(G4cout);
}
G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, myContext, i_mode);
}
void
G4TrajectoryDrawByOriginVolume::SetDefault(const G4String& colour)
{
G4Colour myColour;
// 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 ";
G4Exception
("G4TrajectoryDrawByOriginParticleID::SetDefault(const G4String& colour)",
"NonExistentColour", JustWarning, o.str().c_str());
return;
}
SetDefault(myColour);
}
void
G4TrajectoryDrawByOriginVolume::SetDefault(const G4Colour& colour)
{
fDefault = colour;
}
void
G4TrajectoryDrawByOriginVolume::Set(const G4String& particle, const G4String& colour)
{
fMap.Set(particle, colour);
}
void
G4TrajectoryDrawByOriginVolume::Set(const G4String& particle, const G4Colour& colour)
{
fMap[particle] = colour;
}
void
G4TrajectoryDrawByOriginVolume::Print(std::ostream& ostr) const
{
ostr<<"G4TrajectoryDrawByOriginVolume model "<< Name() <<" colour scheme: "<<std::endl;
ostr<<"Default : "<<fDefault<<G4endl;
fMap.Print(ostr);
ostr<<"Default configuration:"<<G4endl;
GetContext().Print(G4cout);
}
@@ -1,45 +1,69 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TrajectoryDrawByParticleID.cc,v 1.4 2005/11/23 20:24:15 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TrajectoryDrawByParticleID.cc,v 1.8 2006/06/29 21:33:10 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
#include "G4TrajectoryDrawByParticleID.hh"
#include "G4Polyline.hh"
#include "G4Polymarker.hh"
#include "G4TrajectoryDrawerUtils.hh"
#include "G4VisAttributes.hh"
#include "G4VisTrajContext.hh"
#include "G4VTrajectory.hh"
#include "G4VVisManager.hh"
#include <sstream>
G4TrajectoryDrawByParticleID::G4TrajectoryDrawByParticleID(const G4String& name)
:G4VTrajectoryModel(name)
,fDefault(G4Color::Grey())
G4TrajectoryDrawByParticleID::G4TrajectoryDrawByParticleID(const G4String& name, G4VisTrajContext* context)
:G4VTrajectoryModel(name, context)
,fDefault(G4Colour::Grey())
{}
G4TrajectoryDrawByParticleID::~G4TrajectoryDrawByParticleID() {}
void
G4TrajectoryDrawByParticleID::Draw(const G4VTrajectory& traj, const G4int& i_mode, const G4bool& visible) const
{
G4Colour colour(fDefault);
G4String particle = traj.GetParticleName();
fMap.GetColour(particle, colour);
G4VisTrajContext myContext(GetContext());
myContext.SetLineColour(colour);
myContext.SetVisible(visible);
if (GetVerbose()) {
G4cout<<"G4TrajectoryDrawByParticleID drawer named "<<Name();
G4cout<<", drawing trajectory with particle type, "<<particle<<G4endl;
G4cout<<", with configuration:"<<G4endl;
myContext.Print(G4cout);
}
G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, myContext, i_mode);
}
void
G4TrajectoryDrawByParticleID::SetDefault(const G4String& colour)
{
@@ -66,88 +90,13 @@ G4TrajectoryDrawByParticleID::SetDefault(const G4Colour& colour)
void
G4TrajectoryDrawByParticleID::Set(const G4String& particle, const G4String& colour)
{
G4Colour myColour(fDefault);
// 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 ";
G4Exception
("G4TrajectoryDrawByParticleID::Set(const G4String& particle, const G4String& colour)",
"NonExistentColour", JustWarning, o.str().c_str());
}
Set(particle, myColour);
fMap.Set(particle, colour);
}
void
G4TrajectoryDrawByParticleID::Set(const G4String& particle, const G4Colour& colour)
{
std::map<G4String, G4Colour>::iterator iter = fMap.find(particle);
if (iter == fMap.end()) {
fMap[particle] = colour;
}
else {
std::ostringstream o;
o << "Particle "<<particle<<" already has colour "<<colour<<" assigned.";
G4Exception
("G4TrajectoryDrawByParticleID::Set(const G4String& particle, const G4String& colour)",
"ParticleColourExists", JustWarning, o.str().c_str());
}
}
void
G4TrajectoryDrawByParticleID::Draw(const G4VTrajectory& traj, G4int i_mode) const
{
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;
G4TrajectoryDrawerUtils::GetPoints(traj, trajectoryLine,
auxiliaryPoints, stepPoints);
if (lineRequired) {
G4Colour colour(fDefault);
G4String particle = traj.GetParticleName();
map<G4String, G4Colour>::const_iterator iter = fMap.find(particle);
if (iter != fMap.end()) colour = iter->second;
G4VisAttributes trajectoryLineAttribs(colour);
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
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);
}
return;
fMap[particle] = colour;
}
void
@@ -155,12 +104,10 @@ G4TrajectoryDrawByParticleID::Print(std::ostream& ostr) const
{
ostr<<"G4TrajectoryDrawByParticleID model "<< Name() <<" colour scheme: "<<std::endl;
ostr<<"Default : "<<fDefault<<G4endl;
ostr<<"Default colour: "<<fDefault<<G4endl;
std::map<G4String, G4Colour>::const_iterator iter = fMap.begin();
while (iter != fMap.end()) {
ostr<<iter->first <<" : "<< iter->second <<G4endl;
iter++;
}
fMap.Print(ostr);
ostr<<"Default configuration:"<<G4endl;
GetContext().Print(G4cout);
}
@@ -1,37 +1,46 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TrajectoryDrawerUtils.cc,v 1.2 2005/11/21 05:44:44 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TrajectoryDrawerUtils.cc,v 1.6 2006/06/29 21:33:12 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl November 2005
//
#include "G4TrajectoryDrawerUtils.hh"
#include "G4Colour.hh"
#include "G4Polyline.hh"
#include "G4Polymarker.hh"
#include "G4VTrajectory.hh"
#include "G4VTrajectoryPoint.hh"
#include "G4VisAttributes.hh"
#include "G4VisTrajContext.hh"
#include "G4VVisManager.hh"
namespace G4TrajectoryDrawerUtils {
void GetPoints(const G4VTrajectory& traj, G4Polyline& trajectoryLine,
G4Polymarker& auxiliaryPoints, G4Polymarker& stepPoints)
{
@@ -41,7 +50,7 @@ namespace G4TrajectoryDrawerUtils {
const std::vector<G4ThreeVector>* auxiliaries
= aTrajectoryPoint->GetAuxiliaryPoints();
if (auxiliaries) {
if (0 != auxiliaries) {
for (size_t iAux=0; iAux<auxiliaries->size(); ++iAux) {
const G4ThreeVector pos((*auxiliaries)[iAux]);
trajectoryLine.push_back(pos);
@@ -53,4 +62,124 @@ namespace G4TrajectoryDrawerUtils {
stepPoints.push_back(pos);
}
}
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.
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);
}
}
void DrawLineAndPoints(const G4VTrajectory& traj, const G4VisTrajContext& context, const G4int& i_mode)
{
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (0 == pVVisManager) return;
// Extra copy while i_mode is still around
G4VisTrajContext myContext(context);
if (i_mode != 0) {
const G4double markerSize = std::abs(i_mode)/1000;
G4bool lineRequired (i_mode >= 0);
G4bool markersRequired (markerSize > 0.);
myContext.SetDrawLine(lineRequired);
myContext.SetDrawAuxPts(markersRequired);
myContext.SetDrawStepPts(markersRequired);
myContext.SetAuxPtsSize(markerSize);
myContext.SetStepPtsSize(markerSize);
if (!warnedAboutIMode) {
G4cout<<"Trajectory drawing configuration will be based on imode value of "<<i_mode<<G4endl;
warnedAboutIMode = true;
}
}
// Return if don't need to do anything
if (!myContext.GetDrawLine() && !myContext.GetDrawAuxPts() && !myContext.GetDrawStepPts()) return;
// Get points to draw
G4Polyline trajectoryLine;
G4Polymarker stepPoints;
G4Polymarker auxiliaryPoints;
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);
}
}
}
@@ -0,0 +1,117 @@
//
// ********************************************************************
// * 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: G4TrajectoryFilterFactories.cc,v 1.4 2006/06/29 21:33:14 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// Trajectory filter model factories creating filters
// and associated messengers.
//
// Jane Tinslay March 2006
//
#include "G4ModelCommandsT.hh"
#include "G4TrajectoryFilterFactories.hh"
#include "G4TrajectoryChargeFilter.hh"
#include "G4TrajectoryParticleFilter.hh"
#include "G4TrajectoryOriginVolumeFilter.hh"
// Charge filter
G4TrajectoryChargeFilterFactory::G4TrajectoryChargeFilterFactory()
:G4VModelFactory< G4VFilter<G4VTrajectory> >("chargeFilter")
{}
G4TrajectoryChargeFilterFactory::~G4TrajectoryChargeFilterFactory() {}
G4TrajectoryChargeFilterFactory::ModelAndMessengers
G4TrajectoryChargeFilterFactory::Create(const G4String& placement, const G4String& name)
{
// Create model
G4TrajectoryChargeFilter* model = new G4TrajectoryChargeFilter(name);
// Create associated messengers
Messengers messengers;
messengers.push_back(new G4ModelCmdAddString<G4TrajectoryChargeFilter>(model, placement));
messengers.push_back(new G4ModelCmdInvert<G4TrajectoryChargeFilter>(model, placement));
messengers.push_back(new G4ModelCmdActive<G4TrajectoryChargeFilter>(model, placement));
messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryChargeFilter>(model, placement));
messengers.push_back(new G4ModelCmdReset<G4TrajectoryChargeFilter>(model, placement));
return ModelAndMessengers(model, messengers);
}
// Particle type filter
G4TrajectoryParticleFilterFactory::G4TrajectoryParticleFilterFactory()
:G4VModelFactory< G4VFilter<G4VTrajectory> >("particleFilter")
{}
G4TrajectoryParticleFilterFactory::~G4TrajectoryParticleFilterFactory() {}
G4TrajectoryParticleFilterFactory::ModelAndMessengers
G4TrajectoryParticleFilterFactory::Create(const G4String& placement, const G4String& name)
{
// Create model
G4TrajectoryParticleFilter* model = new G4TrajectoryParticleFilter(name);
// Create associated messengers
Messengers messengers;
messengers.push_back(new G4ModelCmdAddString<G4TrajectoryParticleFilter>(model, placement));
messengers.push_back(new G4ModelCmdInvert<G4TrajectoryParticleFilter>(model, placement));
messengers.push_back(new G4ModelCmdActive<G4TrajectoryParticleFilter>(model, placement));
messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryParticleFilter>(model, placement));
messengers.push_back(new G4ModelCmdReset<G4TrajectoryParticleFilter>(model, placement));
return ModelAndMessengers(model, messengers);
}
// Origin volume filter
G4TrajectoryOriginVolumeFilterFactory::G4TrajectoryOriginVolumeFilterFactory()
:G4VModelFactory< G4VFilter<G4VTrajectory> >("originVolumeFilter")
{}
G4TrajectoryOriginVolumeFilterFactory::~G4TrajectoryOriginVolumeFilterFactory() {}
G4TrajectoryOriginVolumeFilterFactory::ModelAndMessengers
G4TrajectoryOriginVolumeFilterFactory::Create(const G4String& placement, const G4String& name)
{
// Create model
G4TrajectoryOriginVolumeFilter* model = new G4TrajectoryOriginVolumeFilter(name);
// Create associated messengers
Messengers messengers;
messengers.push_back(new G4ModelCmdAddString<G4TrajectoryOriginVolumeFilter>(model, placement));
messengers.push_back(new G4ModelCmdInvert<G4TrajectoryOriginVolumeFilter>(model, placement));
messengers.push_back(new G4ModelCmdActive<G4TrajectoryOriginVolumeFilter>(model, placement));
messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryOriginVolumeFilter>(model, placement));
messengers.push_back(new G4ModelCmdReset<G4TrajectoryOriginVolumeFilter>(model, placement));
return ModelAndMessengers(model, messengers);
}
@@ -0,0 +1,63 @@
//
// ********************************************************************
// * 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: G4TrajectoryGenericDrawer.cc,v 1.2 2006/06/29 21:33:16 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay May 2006
//
#include "G4TrajectoryGenericDrawer.hh"
#include "G4TrajectoryDrawerUtils.hh"
#include "G4VisTrajContext.hh"
#include "G4VTrajectory.hh"
#include <sstream>
G4TrajectoryGenericDrawer::G4TrajectoryGenericDrawer(const G4String& name, G4VisTrajContext* context)
:G4VTrajectoryModel(name, context)
{}
G4TrajectoryGenericDrawer::~G4TrajectoryGenericDrawer() {}
void
G4TrajectoryGenericDrawer::Draw(const G4VTrajectory& traj, const G4int& i_mode, const G4bool& visible) const
{
G4VisTrajContext myContext(GetContext());
myContext.SetVisible(visible);
if (GetVerbose()) {
G4cout<<"G4TrajectoryGenericDrawer named "<<Name();
G4cout<<", drawing trajectory with configuration: "<<G4endl;
myContext.Print(G4cout);
}
G4TrajectoryDrawerUtils::DrawLineAndPoints(traj, myContext, i_mode);
}
void
G4TrajectoryGenericDrawer::Print(std::ostream& ostr) const
{
ostr<<"G4TrajectoryGenericDrawer model "<< Name()<< ", default configuration :"<<G4endl;
GetContext().Print(G4cout);
}
@@ -1,35 +1,92 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4TrajectoryModelFactories.cc,v 1.2 2005/11/23 05:19:23 tinslay Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4TrajectoryModelFactories.cc,v 1.5 2006/06/29 21:33:18 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay, John Allison, Joseph Perl October 2005
#include "G4ModelCommandsDrawByCharge.hh"
#include "G4ModelCommandsDrawByParticleID.hh"
#include "G4ModelCommandsT.hh"
#include "G4TrajectoryDrawByCharge.hh"
#include "G4TrajectoryDrawByOriginVolume.hh"
#include "G4TrajectoryDrawByParticleID.hh"
#include "G4TrajectoryGenericDrawer.hh"
#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));
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));
}
}
G4TrajectoryGenericDrawerFactory::G4TrajectoryGenericDrawerFactory()
:G4VModelFactory<G4VTrajectoryModel>("generic")
{}
G4TrajectoryGenericDrawerFactory::~G4TrajectoryGenericDrawerFactory() {}
ModelAndMessengers
G4TrajectoryGenericDrawerFactory::Create(const G4String& placement, const G4String& name)
{
Messengers messengers;
// Create default context and model
G4VisTrajContext* context = new G4VisTrajContext("default");
G4TrajectoryGenericDrawer* model = new G4TrajectoryGenericDrawer(name, context);
// Create messengers for default context configuration
AddContextMsgrs(context, messengers, placement+"/"+name);
// Verbose command
messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryGenericDrawer>(model, placement));
return ModelAndMessengers(model, messengers);
}
// drawByCharge
G4TrajectoryDrawByChargeFactory::G4TrajectoryDrawByChargeFactory()
:G4VModelFactory<G4VTrajectoryModel>("drawByCharge")
{}
@@ -39,15 +96,19 @@ G4TrajectoryDrawByChargeFactory::~G4TrajectoryDrawByChargeFactory() {}
ModelAndMessengers
G4TrajectoryDrawByChargeFactory::Create(const G4String& placement, const G4String& name)
{
// Create model
G4TrajectoryDrawByCharge* model = new G4TrajectoryDrawByCharge(name);
// Create associated messengers
Messengers messengers;
messengers.push_back(new G4ModelCommandDrawByChargeSet(model, placement));
messengers.push_back(new G4ModelCommandDrawByChargeSetRGBA(model, placement));
// Create default context and model
G4VisTrajContext* context = new G4VisTrajContext("default");
G4TrajectoryDrawByCharge* model = new G4TrajectoryDrawByCharge(name, context);
// Create messengers for default context configuration
AddContextMsgrs(context, messengers, placement+"/"+name);
// Create messengers for drawer
messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByCharge>(model, placement));
messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByCharge>(model, placement));
return ModelAndMessengers(model, messengers);
}
@@ -61,16 +122,46 @@ G4TrajectoryDrawByParticleIDFactory::~G4TrajectoryDrawByParticleIDFactory() {}
ModelAndMessengers
G4TrajectoryDrawByParticleIDFactory::Create(const G4String& placement, const G4String& name)
{
// Create model
G4TrajectoryDrawByParticleID* model = new G4TrajectoryDrawByParticleID(name);
// Create associated messengers
Messengers messengers;
messengers.push_back(new G4ModelCommandDrawByParticleIDSet(model, placement));
messengers.push_back(new G4ModelCommandDrawByParticleIDSetRGBA(model, placement));
messengers.push_back(new G4ModelCommandDrawByParticleIDSetDefault(model, placement));
messengers.push_back(new G4ModelCommandDrawByParticleIDSetDefaultRGBA(model, placement));
// Create default context and model
G4VisTrajContext* context = new G4VisTrajContext("default");
G4TrajectoryDrawByParticleID* model = new G4TrajectoryDrawByParticleID(name, context);
// Create messengers for default context configuration
AddContextMsgrs(context, messengers, placement+"/"+name);
// Create messengers for drawer
messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByParticleID>(model, placement));
messengers.push_back(new G4ModelCmdSetDefaultColour<G4TrajectoryDrawByParticleID>(model, placement));
messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByParticleID>(model, placement));
return ModelAndMessengers(model, messengers);
}
//Draw by origin volume
G4TrajectoryDrawByOriginVolumeFactory::G4TrajectoryDrawByOriginVolumeFactory()
:G4VModelFactory<G4VTrajectoryModel>("drawByOriginVolume")
{}
G4TrajectoryDrawByOriginVolumeFactory::~G4TrajectoryDrawByOriginVolumeFactory() {}
ModelAndMessengers
G4TrajectoryDrawByOriginVolumeFactory::Create(const G4String& placement, const G4String& name)
{
Messengers messengers;
// Create default context and model
G4VisTrajContext* context = new G4VisTrajContext("default");
G4TrajectoryDrawByOriginVolume* model = new G4TrajectoryDrawByOriginVolume(name, context);
// Create messengers for default context configuration
AddContextMsgrs(context, messengers, placement+"/"+name);
// Create messengers for drawer
messengers.push_back(new G4ModelCmdSetStringColour<G4TrajectoryDrawByOriginVolume>(model, placement));
messengers.push_back(new G4ModelCmdSetDefaultColour<G4TrajectoryDrawByOriginVolume>(model, placement));
messengers.push_back(new G4ModelCmdVerbose<G4TrajectoryDrawByOriginVolume>(model, placement));
return ModelAndMessengers(model, messengers);
}
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * 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: G4TrajectoryOriginVolumeFilter.cc,v 1.2 2006/06/29 21:33:20 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Filter trajectories according to volume name. Only registered
// volumes will pass the filter.
//
// Jane Tinslay May 2006
//
#include "G4TrajectoryOriginVolumeFilter.hh"
#include "G4TransportationManager.hh"
#include "G4VTrajectoryPoint.hh"
G4TrajectoryOriginVolumeFilter::G4TrajectoryOriginVolumeFilter(const G4String& name)
:G4SmartFilter<G4VTrajectory>(name)
{}
G4TrajectoryOriginVolumeFilter::~G4TrajectoryOriginVolumeFilter() {}
bool
G4TrajectoryOriginVolumeFilter::Evaluate(const G4VTrajectory& traj)
{
G4Navigator* navigator = G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking();
G4VTrajectoryPoint* aTrajectoryPoint = traj.GetPoint(0);
assert (0 != aTrajectoryPoint);
G4VPhysicalVolume* volume = navigator->LocateGlobalPointAndSetup(aTrajectoryPoint->GetPosition());
// Logical volume
G4LogicalVolume* logicalVolume = volume->GetLogicalVolume();
assert (0 != logicalVolume);
// Get volume names
G4String logicalName = logicalVolume->GetName();
G4String physicalName = volume->GetName();
if (GetVerbose()) G4cout<<"G4TrajectoryOriginVolumeFilter processing trajectory with originating volume "<<G4endl;
G4cout<<"logical and physical names: "<<logicalName<<" "<<physicalName<<G4endl;
// Search for logical volume name
std::vector<G4String>::const_iterator iterLogical = std::find(fVolumes.begin(), fVolumes.end(), logicalName);
// Keep if logical volume registered
if (iterLogical != fVolumes.end()) return true;
// Repeat for physical volume name
std::vector<G4String>::const_iterator iterPhysical = std::find(fVolumes.begin(), fVolumes.end(), physicalName);
if (iterPhysical != fVolumes.end()) return true;
// Volume names not registered
return false;
}
void
G4TrajectoryOriginVolumeFilter::Add(const G4String& volume)
{
fVolumes.push_back(volume);
}
void
G4TrajectoryOriginVolumeFilter::Print(std::ostream& ostr) const
{
ostr<<"Volume names registered: "<<G4endl;
std::vector<G4String>::const_iterator iter = fVolumes.begin();
while (iter != fVolumes.end()) {
ostr<<*iter<<G4endl;
iter++;
}
}
void
G4TrajectoryOriginVolumeFilter::Clear()
{
// Clear volume vector
fVolumes.clear();
}
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * 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: G4TrajectoryParticleFilter.cc,v 1.2 2006/06/29 21:33:22 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Filter trajectories according to particle type. Only registered
// particle types will pass the filter.
//
// Jane Tinslay March 2006
//
#include "G4TrajectoryParticleFilter.hh"
G4TrajectoryParticleFilter::G4TrajectoryParticleFilter(const G4String& name)
:G4SmartFilter<G4VTrajectory>(name)
{}
G4TrajectoryParticleFilter::~G4TrajectoryParticleFilter() {}
bool
G4TrajectoryParticleFilter::Evaluate(const G4VTrajectory& traj)
{
G4String particle = traj.GetParticleName();
if (GetVerbose()) G4cout<<"G4TrajectoryParticleFilter processing trajectory with particle type: "<<particle<<G4endl;
std::vector<G4String>::const_iterator iter = std::find(fParticles.begin(), fParticles.end(), particle);
// Fail if particle type not found in particle list
if (iter == fParticles.end()) return false;
return true;
}
void
G4TrajectoryParticleFilter::Add(const G4String& particle)
{
fParticles.push_back(particle);
}
void
G4TrajectoryParticleFilter::Print(std::ostream& ostr) const
{
ostr<<"Particle types registered: "<<G4endl;
std::vector<G4String>::const_iterator iter = fParticles.begin();
while (iter != fParticles.end()) {
ostr<<*iter<<G4endl;
iter++;
}
}
void
G4TrajectoryParticleFilter::Clear()
{
// Clear particle type vector
fParticles.clear();
}
+19 -19
View File
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and Disclaimer *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * 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. *
// * 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 intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// * 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: G4VModel.cc,v 1.11 2005/11/30 16:06:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VModel.cc,v 1.13 2006/06/29 21:33:24 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 31st December 1997.
@@ -62,12 +65,9 @@ G4bool G4VModel::Validate (G4bool) {
std::ostream& operator << (std::ostream& os, const G4VModel& m) {
os << m.fGlobalDescription;
os << "\n Modeling parameters:";
if (m.fpMP) {
os << "\n " << *(m.fpMP);
}
else {
os << " none.";
}
const G4ModelingParameters* mp = m.fpMP;
if (mp) os << "\n " << *mp;
else os << " none.";
os << "\n Extent: " << m.fExtent;
os << "\n Transformation: ";
os << "\n Rotation: ";
@@ -0,0 +1,78 @@
//
// ********************************************************************
// * 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: G4VTrajectoryModel.cc,v 1.3 2006/06/29 21:33:26 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
// Jane Tinslay May 2006
//
// See header for details
//
#include "G4VTrajectoryModel.hh"
#include "G4VisTrajContext.hh"
#include <assert.h>
G4VTrajectoryModel::G4VTrajectoryModel(const G4String& name,
G4VisTrajContext* context)
:fName(name)
,fVerbose(false)
,fpContext(context)
{
// Create context object if none is provided. Model will
// then use default G4VisTrajContext configuration
if (0 == fpContext) fpContext = new G4VisTrajContext();
}
G4VTrajectoryModel::~G4VTrajectoryModel()
{
delete fpContext;
}
const G4VisTrajContext&
G4VTrajectoryModel::GetContext() const
{
// Expect context to exist
assert (0 != fpContext);
return *fpContext;
}
G4String
G4VTrajectoryModel::Name() const
{
return fName;
}
void
G4VTrajectoryModel::SetVerbose(const G4bool& verbose)
{
fVerbose = verbose;
}
G4bool
G4VTrajectoryModel::GetVerbose() const
{
return fVerbose;
}
@@ -0,0 +1,49 @@
//
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
#include "G4VisTrajContext.hh"
// Default configuration
G4VisTrajContext::G4VisTrajContext(const G4String& name)
:fName(name)
,fLineColour(G4Colour::Grey())
,fLineVisible(true)
,fDrawLine(true)
,fDrawAuxPts(false)
,fAuxPtsType(G4Polymarker::squares)
,fAuxPtsSize(2)
,fAuxPtsFillStyle(G4VMarker::filled)
,fAuxPtsColour(G4Colour::Magenta())
,fAuxPtsVisible(true)
,fDrawStepPts(false)
,fStepPtsType(G4Polymarker::circles)
,fStepPtsSize(2)
,fStepPtsFillStyle(G4VMarker::filled)
,fStepPtsColour(G4Colour::Yellow())
,fStepPtsVisible(true)
{}
// Destructor
G4VisTrajContext::~G4VisTrajContext() {}