Import Geant4 3.2.0 source tree
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# $Id: GNUmakefile,v 1.1 2001/04/10 15:08:02 johna Exp $
|
||||
|
||||
name := G4Tree
|
||||
|
||||
ifndef G4INSTALL
|
||||
G4INSTALL = ../../..
|
||||
endif
|
||||
|
||||
include $(G4INSTALL)/config/architecture.gmk
|
||||
include $(G4INSTALL)/config/G4VIS_BUILD.gmk
|
||||
include $(G4INSTALL)/config/interactivity.gmk
|
||||
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/visualization/modeling/include
|
||||
CPPFLAGS += -I$(G4BASE)/global/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/global/HEPGeometry/include
|
||||
CPPFLAGS += -I$(G4BASE)/graphics_reps/include
|
||||
CPPFLAGS += -I$(G4BASE)/intercoms/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/management/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/volumes/include
|
||||
CPPFLAGS += -I$(G4BASE)/geometry/solids/specific/include
|
||||
|
||||
include $(G4INSTALL)/config/common.gmk
|
||||
@@ -0,0 +1,63 @@
|
||||
$Id: History,v 1.6 2001/06/15 12:29:04 johna Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
|
||||
=========================================================
|
||||
|
||||
Category History file
|
||||
---------------------
|
||||
This file should be used by G4 developers and category coordinators
|
||||
to briefly summarize all major modifications introduced in the code
|
||||
and keep track of all category-tags.
|
||||
It DOES NOT substitute the CVS log-message one should put at every
|
||||
committal in the CVS repository !
|
||||
|
||||
*************************************************************
|
||||
* Note that modeling and test have their own History files. *
|
||||
*************************************************************
|
||||
|
||||
----------------------------------------------------------
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
History file for visualization/Tree sub-category
|
||||
------------------------------------------------
|
||||
|
||||
15th June 2001 John Allison (vis-V03-01-06)
|
||||
- Changed char* to const char* in G4GAGTreeList.hh".
|
||||
- Added 2nd template argument (less) to sets in G4ASCIITreeSceneHandler and
|
||||
G4GAGTreeSceneHandler.
|
||||
|
||||
15th June 2001 Satoshi Tanaka (vis-V03-01-05)
|
||||
- The first committing of GAGTree driver.
|
||||
- Other files are the same as vis-V03-01-04
|
||||
|
||||
5th June 2001 John Allison (vis-V03-01-04)
|
||||
- Moved re-useable code from G4ASCIITree to G4VTree.
|
||||
|
||||
4th June 2001 John Allison
|
||||
- G4ASCIITree: Added logical volume name and solid name and type under
|
||||
verbosity control.
|
||||
- Forced culling off so that all volumes are seen, even if "invisible".
|
||||
|
||||
25th May 2001 John Allison
|
||||
- Bug fix in G4ASCIITree.cc: initialise fVerbosity(0).
|
||||
|
||||
24th May 2001 John Allison (vis-V03-01-03)
|
||||
- Added missing files G4ASCIITreeMessenger.hh/cc.
|
||||
- Bug fix in G4ASCIITreeMessenger.cc: currentAsDefault = true.
|
||||
|
||||
22nd May 2001 John Allison
|
||||
- Refined ASCIITree.
|
||||
|
||||
10th April 2001 John Allison (vis-V03-01-00)
|
||||
- Added first version of ASCIITree to dump geometry hierarchy to
|
||||
standard output as ASCII stream.
|
||||
This requires two new environment variables:
|
||||
G4VIS_BUILD_ASCIITREE_DRIVER
|
||||
G4VIS_USE_ASCIITREE
|
||||
and config-V03-01-00.
|
||||
|
||||
5th April 2001 John Allison (vis-V03-01-00)
|
||||
- First version of G4VTree and G4ASCIITree.
|
||||
@@ -0,0 +1,52 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ASCIITree.hh,v 1.4.2.1 2001/06/28 19:15:54 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A graphics system to dump geometry hierarchy to standard output as
|
||||
// ASCII stream.
|
||||
|
||||
#ifndef G4ASCIITREE_HH
|
||||
#define G4ASCIITREE_HH
|
||||
|
||||
#include "G4VTree.hh"
|
||||
|
||||
class G4ASCIITreeMessenger;
|
||||
|
||||
class G4ASCIITree: public G4VTree {
|
||||
public:
|
||||
G4ASCIITree ();
|
||||
virtual ~G4ASCIITree ();
|
||||
G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
void SetVerbosity(G4int verbosity) {fVerbosity = verbosity;}
|
||||
G4int GetVerbosity() const {return fVerbosity;}
|
||||
protected:
|
||||
G4int fVerbosity;
|
||||
G4ASCIITreeMessenger* fpMessenger;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ASCIITreeMessenger.hh,v 1.3.2.1 2001/06/28 19:15:54 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A scene handler to dump geometry hierarchy to standard output as
|
||||
// ASCII stream.
|
||||
// Based on a provisional G4ASCIITreeGraphicsScene (was in modeling).
|
||||
|
||||
#ifndef G4ASCIITREEMESSENGER_HH
|
||||
#define G4ASCIITREEMESSENGER_HH
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class G4UIcommand;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4ASCIITree;
|
||||
|
||||
class G4ASCIITreeMessenger: public G4UImessenger {
|
||||
public:
|
||||
G4ASCIITreeMessenger(G4ASCIITree*);
|
||||
virtual ~G4ASCIITreeMessenger();
|
||||
G4String GetCurrentValue (G4UIcommand* command);
|
||||
void SetNewValue (G4UIcommand* command, G4String newValue);
|
||||
private:
|
||||
G4ASCIITree* fpASCIITree;
|
||||
G4UIcommand* fpDirectory;
|
||||
G4UIcmdWithAnInteger* fpCommandVerbose;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ASCIITreeSceneHandler.hh,v 1.8.2.1 2001/06/28 19:15:54 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A scene handler to dump geometry hierarchy to standard output as
|
||||
// ASCII stream.
|
||||
// Based on a provisional G4ASCIITreeGraphicsScene (was in modeling).
|
||||
|
||||
#ifndef G4ASCIITREESCENEHANDLER_HH
|
||||
#define G4ASCIITREESCENEHANDLER_HH
|
||||
|
||||
#include "G4VTreeSceneHandler.hh"
|
||||
|
||||
#include "g4std/set"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
class G4ASCIITreeSceneHandler: public G4VTreeSceneHandler {
|
||||
public:
|
||||
G4ASCIITreeSceneHandler(G4VGraphicsSystem& system,
|
||||
const G4String& name);
|
||||
virtual ~G4ASCIITreeSceneHandler();
|
||||
virtual void BeginModeling();
|
||||
virtual void EndModeling();
|
||||
protected:
|
||||
virtual void Dump(const G4VSolid&);
|
||||
G4std::set<G4LogicalVolume*,G4std::less<G4LogicalVolume*> > fLVSet;
|
||||
typedef
|
||||
G4std::set<G4LogicalVolume*,G4std::less<G4LogicalVolume*> >::iterator
|
||||
LVSetIterator;
|
||||
G4std::set<G4VPhysicalVolume*,G4std::less<G4VPhysicalVolume*> > fReplicaSet;
|
||||
typedef
|
||||
G4std::set<G4VPhysicalVolume*,G4std::less<G4VPhysicalVolume*> >::iterator
|
||||
ReplicaSetIterator;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ASCIITreeViewer.hh,v 1.3.2.1 2001/06/28 19:15:55 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A dummy viewer for ASCIITreeSceneHandler.
|
||||
|
||||
#ifndef G4ASCIITREEVIEWER_HH
|
||||
#define G4ASCIITREEVIEWER_HH
|
||||
|
||||
#include "G4VTreeViewer.hh"
|
||||
|
||||
class G4ASCIITreeViewer: public G4VTreeViewer {
|
||||
public:
|
||||
G4ASCIITreeViewer(G4VSceneHandler&,const G4String& name);
|
||||
virtual ~G4ASCIITreeViewer();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Satoshi Tanaka 31 May 2001
|
||||
// A graphics system to dump geometry hierarchy to GAG.
|
||||
//
|
||||
|
||||
#ifndef G4GAGTREE_HH
|
||||
#define G4GAGTREE_HH
|
||||
|
||||
#include "G4VTree.hh"
|
||||
|
||||
class G4GAGTreeMessenger;
|
||||
|
||||
class G4GAGTree: public G4VTree {
|
||||
public:
|
||||
G4GAGTree ();
|
||||
virtual ~G4GAGTree ();
|
||||
G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
void SetVerbosity(G4int verbosity) {fVerbosity = verbosity;}
|
||||
G4int GetVerbosity() const {return fVerbosity;}
|
||||
protected:
|
||||
G4int fVerbosity;
|
||||
G4GAGTreeMessenger* fpMessenger;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,392 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//////////////////////////////////
|
||||
///// G4GAGTreeList.hh ///////
|
||||
///// Satoshi Tanaka ///////
|
||||
//////////////////////////////////
|
||||
|
||||
#if !defined G4GAGTREELIST_HH
|
||||
#define G4GAGTREELIST_HH
|
||||
|
||||
#include "g4std/iostream"
|
||||
#include "globals.hh"
|
||||
|
||||
/////////////////////////////////
|
||||
///// class G4GAGTreeNode /////
|
||||
/////////////////////////////////
|
||||
|
||||
template <class Type> class G4GAGTreeNode {
|
||||
public:
|
||||
Type item ; // item
|
||||
G4GAGTreeNode<Type>* down ; // address of neighboring node (downward)
|
||||
G4GAGTreeNode<Type>* up ; // address of neighboring node (upward)
|
||||
} ; // G4GAGTreeNode
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
///// class G4GAGTreeList<Type> /////
|
||||
///////////////////////////////////////
|
||||
|
||||
template <class Type> class G4GAGTreeList {
|
||||
private:
|
||||
//----- constants
|
||||
enum { ERROR = 0, NORMAL = 1 };
|
||||
|
||||
G4GAGTreeNode<Type>* head ; // head of list
|
||||
G4GAGTreeNode<Type>* tail ; // tail of list
|
||||
G4GAGTreeNode<Type>* cur ; // current node
|
||||
|
||||
//----- number of items in list
|
||||
int nItem ; // number of stored items
|
||||
|
||||
public:
|
||||
//----- Constructor
|
||||
//..... Initialize head and current node of list to NULL.
|
||||
//..... Set name of list ( default name is "no_name")
|
||||
G4GAGTreeList( const char* name_ = "no_name" ) ;
|
||||
|
||||
//----- Destructor
|
||||
~G4GAGTreeList() { this->Clear() ; }
|
||||
|
||||
//----- Add an item to list and make it a new head.
|
||||
//..... Return: NORMAL = 1 (normal)
|
||||
//..... ERROOR = 0 (error)
|
||||
int AddItem( const Type& item );
|
||||
|
||||
//----- Delete an item of current node
|
||||
//..... Return: NORMAL = 1 if deleted.
|
||||
//..... ERROR = 0 if not deleted ( cur = NULL or nItem = 1).
|
||||
//..... In case of NORMAL, cur moves to cur->down.
|
||||
int DeleteItem() ;
|
||||
|
||||
|
||||
//----- Set current node to the head of list.
|
||||
void ToHead() { cur = head ; }
|
||||
|
||||
//----- Set current node to the tail of list.
|
||||
void ToTail() { cur = tail ; }
|
||||
|
||||
//----- Increment current node to downward direction by 1 step
|
||||
//..... Return: NORMAL = 1 (normal)
|
||||
//..... ERROOR = 0 (if cur = NULL)
|
||||
int Downward();
|
||||
|
||||
//----- Increment current node to upward direction by 1 step
|
||||
//..... Return: NORMAL = 1 (normal)
|
||||
//..... ERROOR = 0 (if cur = NULL)
|
||||
int Upward();
|
||||
|
||||
|
||||
//----- Get current item
|
||||
//..... The obtained item is returned to the argument.
|
||||
//..... Return: NORMAL = 1 (normal)
|
||||
//..... ERROR = 0 (error)
|
||||
int GetItem( Type& item );
|
||||
|
||||
//----- Get position of current node counting from tail
|
||||
//..... Return: 0, 1, 2, ..... , nItem -1
|
||||
//..... If cur == tail, 0 is returned.
|
||||
//..... If cur == NULL, -1 is returned.
|
||||
//..... Current node is not modified after calling this function
|
||||
int WhereIsCurrentNode() ;
|
||||
|
||||
//----- Check if current node is NULL
|
||||
//..... Return 1: if cur == NULL
|
||||
//..... 0: if cur != NULL
|
||||
int IsCurrentNodeNull() { return ( cur == NULL ) ; }
|
||||
|
||||
//----- Get number of stored items
|
||||
int GetNumItem() const { return nItem ; }
|
||||
|
||||
//----- Get number of stored items minus one
|
||||
//..... Note: If the list is empty, -1 is returned
|
||||
int GetHeadIndex() const { return (nItem - 1) ; }
|
||||
|
||||
//----- delete all items
|
||||
//..... All nodes are deleted.
|
||||
//..... head, tail, cur are reset to NULL.
|
||||
void Clear();
|
||||
|
||||
//----- For use of STACK: Push
|
||||
//..... Added new node becomes a new current node.
|
||||
//..... Return: NORMAL = 1 (normal)
|
||||
//..... ERROOR = 0 (error)
|
||||
//..... Added new node becomes a new current node.
|
||||
int Push( const Type& item ) { return AddItem( item ) ; }
|
||||
|
||||
//----- For use of STACK
|
||||
//..... Get head->item and then delete it.
|
||||
//..... The obtained item is returned to the argument.
|
||||
//..... Return: NORMAL = 1 (normal)
|
||||
//..... ERROR = 0 (error)
|
||||
//..... In case of NORMAL, cur moves to cur->down.
|
||||
int Pop( Type& item ) ;
|
||||
|
||||
//----- For use of STACK: pop
|
||||
void Pop( void ) { this->ToHead(); this->DeleteItem(); }
|
||||
|
||||
} ; // class G4GAGTreeList
|
||||
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
///// Inline Member functions of class "G4GAGTreeList" ///////
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
||||
//-----
|
||||
template <class Type>
|
||||
inline G4GAGTreeList<Type>::G4GAGTreeList( const char* name_ )
|
||||
{
|
||||
cur = head = tail = NULL ;
|
||||
nItem = 0 ;
|
||||
|
||||
} // G4GAGTreeList<Type>::G4GAGTreeList()
|
||||
|
||||
|
||||
//-----
|
||||
template <class Type>
|
||||
inline int G4GAGTreeList<Type>::AddItem( const Type& item )
|
||||
{
|
||||
//----- local
|
||||
int status ;
|
||||
G4GAGTreeNode<Type>* old_head = head ; // store old head
|
||||
|
||||
//----- allocate dynamical memory for added node
|
||||
head = new G4GAGTreeNode<Type> ;
|
||||
if( !head ){
|
||||
//----- failed to allocate dynamical memory
|
||||
status = ERROR ;
|
||||
|
||||
} else {
|
||||
//----- increment number of stored items
|
||||
nItem++ ;
|
||||
|
||||
//----- set tail of list in the first push
|
||||
if( nItem == 1 ) { tail = head ; }
|
||||
|
||||
//----- set current node to added node
|
||||
cur = head ;
|
||||
|
||||
//----- add an item
|
||||
head->item = item ; // add an item
|
||||
|
||||
//----- make links
|
||||
//..... 2 1
|
||||
//..... NULL <----- head -----> old_head
|
||||
//..... <-----
|
||||
//..... 3
|
||||
head->down = old_head ; // make link 1
|
||||
head->up = NULL ; // make link 2
|
||||
if( old_head != NULL ) {
|
||||
old_head->up = head ; // make link 3
|
||||
}
|
||||
//----- set status
|
||||
status = NORMAL ;
|
||||
} // if--else
|
||||
|
||||
//----- return status
|
||||
return status ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
template <class Type>
|
||||
inline int G4GAGTreeList<Type>::DeleteItem()
|
||||
{
|
||||
//----- local variables
|
||||
int status ;
|
||||
G4GAGTreeNode<Type>* cur_old ; // backup of current node
|
||||
|
||||
//----- ERROR if current node does not have an item
|
||||
//...... or no item exist in list
|
||||
if ( cur == NULL || nItem == 0 ) {
|
||||
status = ERROR ;
|
||||
} else {
|
||||
//----- Below cur != NULL, nItem >= 1,
|
||||
//..... head != NULL, and tail != NULL
|
||||
|
||||
//----- make backup of current node
|
||||
cur_old = cur ;
|
||||
|
||||
//----- remake links
|
||||
if( cur == head ) {
|
||||
cur = cur->down ;
|
||||
head = cur ;
|
||||
if ( head != NULL ) {
|
||||
head->up = NULL ;
|
||||
delete cur_old ; nItem-- ;
|
||||
} else {
|
||||
//----- In case that head = NULL:
|
||||
//..... This case occurs in case that
|
||||
//..... head = tail i.e. nItem = 1.
|
||||
//..... At the end of this function,
|
||||
//..... head = tail = cur = NULL, nItem = 0
|
||||
tail = NULL ;
|
||||
delete cur_old ;
|
||||
nItem = 0 ;
|
||||
// nItem-- ;
|
||||
}
|
||||
|
||||
} else if( cur == tail ){
|
||||
//----- Here, cur != head && cur == tail.
|
||||
//..... So, tail != head.
|
||||
//..... It means, at least 2 items exist in the list.
|
||||
//..... So, tail->up is not NULL.
|
||||
tail = tail->up ;
|
||||
tail->down = NULL;
|
||||
cur = NULL ;
|
||||
delete cur_old ; nItem-- ;
|
||||
|
||||
} else { //----- In case that cur is neither head or tail.
|
||||
//..... head --- .... --- cur ---... --- tail.
|
||||
(cur->up)->down = cur->down ;
|
||||
(cur->down)->up = cur->up ;
|
||||
cur = cur->down ;
|
||||
delete cur_old ; nItem-- ;
|
||||
} // if-else_if-else
|
||||
|
||||
status = NORMAL;
|
||||
|
||||
} // if--else
|
||||
|
||||
//----- return (successfully deleted)
|
||||
return status ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
template <class Type>
|
||||
inline int G4GAGTreeList<Type>::Downward()
|
||||
{
|
||||
int status ;
|
||||
if( cur == NULL ) {
|
||||
status = ERROR ; // do nothing
|
||||
|
||||
} else {
|
||||
cur = cur->down ; // move dawnward
|
||||
status = NORMAL ;
|
||||
}
|
||||
return status ;
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
template <class Type>
|
||||
inline int G4GAGTreeList<Type>::Upward()
|
||||
{
|
||||
int status ;
|
||||
if( cur == NULL ) {
|
||||
status = ERROR ; // do nothing
|
||||
} else {
|
||||
cur = cur->up ; // move upward
|
||||
status = NORMAL ;
|
||||
}
|
||||
return status ;
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
template <class Type>
|
||||
inline int G4GAGTreeList<Type>::GetItem( Type& item )
|
||||
{
|
||||
//----- return value
|
||||
int state ;
|
||||
|
||||
//----- get an item of current node
|
||||
if ( cur == NULL ) {
|
||||
state = ERROR ;
|
||||
} else {
|
||||
state = NORMAL ;
|
||||
item = cur->item ;
|
||||
}
|
||||
|
||||
//----- return
|
||||
return state ;
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
template <class Type>
|
||||
inline int G4GAGTreeList<Type>::WhereIsCurrentNode()
|
||||
{
|
||||
G4GAGTreeNode<Type>* tmp = cur ;// copy current node
|
||||
int n = -1 ; // counter
|
||||
|
||||
//----- count how many steps there are until tail.
|
||||
while( tmp != NULL ) { n++ ; tmp = tmp->down ;}
|
||||
|
||||
//----- return steps
|
||||
return n ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//-----
|
||||
template <class Type>
|
||||
inline void G4GAGTreeList<Type>::Clear()
|
||||
{
|
||||
//----- delete items
|
||||
cur = head ;
|
||||
while( cur != NULL )
|
||||
{
|
||||
G4GAGTreeNode<Type>* tmp = cur ;
|
||||
cur = cur->down ;
|
||||
delete tmp ; // destructor called
|
||||
}
|
||||
|
||||
//----- reset head and current node
|
||||
cur = head = tail = NULL ;
|
||||
|
||||
//----- reset number of stored items
|
||||
nItem = 0 ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
//----- Pop()
|
||||
template <class Type>
|
||||
inline int G4GAGTreeList<Type>::Pop( Type& item )
|
||||
{
|
||||
//----- local variables
|
||||
int status ;
|
||||
|
||||
//----- get head->item
|
||||
ToHead() ;
|
||||
status = GetItem( item ) ;
|
||||
|
||||
//----- delete head->item if it exists
|
||||
//..... and make cur move to cur->down
|
||||
if( status ) { DeleteItem(); }
|
||||
|
||||
//----- RETURN
|
||||
return status ;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
//////////////
|
||||
#endif
|
||||
////////////// end of list.h
|
||||
@@ -0,0 +1,49 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Satoshi Tanaka 31th May 2001
|
||||
//
|
||||
// A messenger for G4GAGTree driver.
|
||||
|
||||
|
||||
#ifndef G4GAGTREEMESSENGER_HH
|
||||
#define G4GAGTREEMESSENGER_HH
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
class G4UIcommand;
|
||||
class G4UIcmdWithAnInteger;
|
||||
class G4GAGTree;
|
||||
|
||||
class G4GAGTreeMessenger: public G4UImessenger {
|
||||
public:
|
||||
G4GAGTreeMessenger(G4GAGTree*);
|
||||
virtual ~G4GAGTreeMessenger();
|
||||
G4String GetCurrentValue (G4UIcommand* command);
|
||||
void SetNewValue (G4UIcommand* command, G4String newValue);
|
||||
private:
|
||||
G4GAGTree* fpGAGTree;
|
||||
G4UIcommand* fpDirectory;
|
||||
G4UIcmdWithAnInteger* fpCommandVerbose;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,105 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Satoshi Tanaka 31th April 2001
|
||||
// A scene handler to dump geometry hierarchy GAG
|
||||
|
||||
|
||||
#ifndef G4GAGTREESCENEHANDLER_HH
|
||||
#define G4GAGTREESCENEHANDLER_HH
|
||||
|
||||
#include "G4VTreeSceneHandler.hh"
|
||||
|
||||
#include "g4std/set"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
|
||||
/////////////////////////////
|
||||
#include "G4GAGTreeList.hh"
|
||||
class G4String ;
|
||||
/////////////////////////////
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// The algorithm of re-generating a geometry tree
|
||||
// of physical volumes (PV):
|
||||
//
|
||||
// In each addition of the N-th PV with a given depth D, P(N;D) to
|
||||
// the tree, we use the following rules:
|
||||
//
|
||||
// R1. We can add P(N;D) to one of the previously-generated PV nodes,
|
||||
// P(N_mother <N; D_mother), if D_mother = D - 1.
|
||||
//
|
||||
// R2. The mother PV node P(N_mother, D_mother) of P(N,D)
|
||||
// is searched in the direction to the root node
|
||||
// (the world volume), starting from P(N-1;*).
|
||||
//
|
||||
// R3. The first PV node found in R2 is adopted as the mother.
|
||||
//
|
||||
// This rule can be easily implemented with a stack.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// The output to G4cout becomes, for example,
|
||||
//
|
||||
// @@DTREEBegin
|
||||
// /WORLD.0/PV1.1
|
||||
// /WORLD.0/PV1.1/PV2.2
|
||||
// /WORLD.0/PV1.1/PV3.3
|
||||
// /WORLD.0/PV1.1/PV3.3/PV4.4
|
||||
// /WORLD.0/PV5.5
|
||||
// ...
|
||||
// @@DTREEBegin
|
||||
//
|
||||
// where ".number" is the index label added by the
|
||||
// G4GAGTree driver.
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
class G4GAGTreeSceneHandler: public G4VTreeSceneHandler {
|
||||
public:
|
||||
G4GAGTreeSceneHandler(G4VGraphicsSystem& system,
|
||||
const G4String& name);
|
||||
virtual ~G4GAGTreeSceneHandler();
|
||||
void BeginModeling();
|
||||
void EndModeling();
|
||||
protected:
|
||||
void Dump(const G4VSolid&);
|
||||
G4std::set<G4LogicalVolume*,G4std::less<G4LogicalVolume*> > fLVSet;
|
||||
typedef
|
||||
G4std::set<G4LogicalVolume*,G4std::less<G4LogicalVolume*> >::iterator
|
||||
LVSetIterator;
|
||||
G4std::set<G4VPhysicalVolume*,G4std::less<G4VPhysicalVolume*> > fReplicaSet;
|
||||
typedef
|
||||
G4std::set<G4VPhysicalVolume*,G4std::less<G4VPhysicalVolume*> >::iterator
|
||||
ReplicaSetIterator;
|
||||
|
||||
/////////////////////////////
|
||||
void ClearPVList(void);
|
||||
void InitializePVList(void);
|
||||
G4GAGTreeList<G4String> fPVNameList ;
|
||||
G4int fPrevDepth ;
|
||||
G4String fPrevAbsPVName ;
|
||||
G4int fPVCounter ;
|
||||
/////////////////////////////
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,37 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Satoshi Tanaka 31th May 2001
|
||||
// A dummy viewer for GAGTreeSceneHandler.
|
||||
|
||||
#ifndef G4GAGTREEVIEWER_HH
|
||||
#define G4GAGTREEVIEWER_HH
|
||||
|
||||
#include "G4VTreeViewer.hh"
|
||||
|
||||
class G4GAGTreeViewer: public G4VTreeViewer {
|
||||
public:
|
||||
G4GAGTreeViewer(G4VSceneHandler&,const G4String& name);
|
||||
virtual ~G4GAGTreeViewer();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4VTree.hh,v 1.3.2.1 2001/06/28 19:15:55 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A graphics system to dump geometry hierarchy.
|
||||
|
||||
#ifndef G4VTREE_HH
|
||||
#define G4VTREE_HH
|
||||
|
||||
#include "G4VGraphicsSystem.hh"
|
||||
|
||||
class G4VTree: public G4VGraphicsSystem {
|
||||
public:
|
||||
G4VTree (const G4String& name,
|
||||
const G4String& nickname,
|
||||
const G4String& description,
|
||||
Functionality f);
|
||||
virtual ~G4VTree ();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,107 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4VTreeSceneHandler.hh,v 1.4.2.1 2001/06/28 19:15:56 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A base class for a scene handler to dump geometry hierarchy.
|
||||
|
||||
#ifndef G4VTREESCENEHANDLER_HH
|
||||
#define G4VTREESCENEHANDLER_HH
|
||||
|
||||
#include "G4VSceneHandler.hh"
|
||||
#include "G4Box.hh"
|
||||
#include "G4Cons.hh"
|
||||
#include "G4Tubs.hh"
|
||||
#include "G4Trd.hh"
|
||||
#include "G4Trap.hh"
|
||||
#include "G4Sphere.hh"
|
||||
#include "G4Para.hh"
|
||||
#include "G4Torus.hh"
|
||||
#include "G4Polycone.hh"
|
||||
#include "G4Polyhedra.hh"
|
||||
|
||||
class G4VPhysicalVolume;
|
||||
class G4LogicalVolume;
|
||||
class G4ModelingParameters;
|
||||
|
||||
class G4VTreeSceneHandler: public G4VSceneHandler {
|
||||
|
||||
public:
|
||||
G4VTreeSceneHandler(G4VGraphicsSystem& system,
|
||||
const G4String& name);
|
||||
virtual ~G4VTreeSceneHandler ();
|
||||
void AddThis (const G4Box& s) {Dump (s);}
|
||||
void AddThis (const G4Cons & s) {Dump (s);}
|
||||
void AddThis (const G4Tubs& s) {Dump (s);}
|
||||
void AddThis (const G4Trd& s) {Dump (s);}
|
||||
void AddThis (const G4Trap& s) {Dump (s);}
|
||||
void AddThis (const G4Sphere& s) {Dump (s);}
|
||||
void AddThis (const G4Para& s) {Dump (s);}
|
||||
void AddThis (const G4Torus& s) {Dump (s);}
|
||||
void AddThis (const G4Polycone& s) {Dump (s);}
|
||||
void AddThis (const G4Polyhedra& s) {Dump (s);}
|
||||
void AddThis (const G4VSolid& s) {Dump (s);}
|
||||
void PreAddThis (const G4Transform3D& objectTransformation,
|
||||
const G4VisAttributes&);
|
||||
void PostAddThis ();
|
||||
void EstablishSpecials (G4PhysicalVolumeModel&);
|
||||
G4int GetFoundDepth () const;
|
||||
G4VPhysicalVolume* GetFoundVolume () const;
|
||||
const G4Transform3D& GetFoundTransformation () const;
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
// Functions not used but required by the abstract interface.
|
||||
|
||||
virtual void BeginPrimitives (const G4Transform3D& objectTransformation) {}
|
||||
virtual void EndPrimitives () {}
|
||||
virtual void AddPrimitive (const G4Polyline&) {}
|
||||
virtual void AddPrimitive (const G4Text&) {}
|
||||
virtual void AddPrimitive (const G4Circle&) {}
|
||||
virtual void AddPrimitive (const G4Square&) {}
|
||||
virtual void AddPrimitive (const G4Polymarker&) {}
|
||||
virtual void AddPrimitive (const G4Polyhedron&) {}
|
||||
virtual void AddPrimitive (const G4NURBS&) {}
|
||||
|
||||
virtual void BeginModeling();
|
||||
virtual void EndModeling();
|
||||
|
||||
static G4int GetSceneCount();
|
||||
|
||||
protected:
|
||||
virtual void Dump (const G4VSolid&) = 0;
|
||||
static G4int fSceneIdCount; // Counter for Tree scene handlers.
|
||||
static G4int fSceneCount; // No. of extanct scene handlers.
|
||||
G4int fCurrentDepth; // Current depth of geom. hierarchy.
|
||||
G4VPhysicalVolume* fpCurrentPV; // Current physical volume.
|
||||
G4LogicalVolume* fpCurrentLV; // Current logical volume.
|
||||
const G4Transform3D* fpCurrentObjectTransformation;
|
||||
const G4ModelingParameters* fpOriginalMP; // Keeps pointer to original.
|
||||
G4ModelingParameters* fpNonCullingMP; // For temporary non-culling.
|
||||
};
|
||||
|
||||
#include "G4VTreeSceneHandler.icc"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,41 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4VTreeSceneHandler.icc,v 1.3.2.1 2001/06/28 19:15:56 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 18th May 2000
|
||||
// An artificial graphics scene to find dump geometry hierarchy.
|
||||
|
||||
inline G4int G4VTreeSceneHandler::GetSceneCount() {
|
||||
return fSceneCount;
|
||||
}
|
||||
|
||||
inline void G4VTreeSceneHandler::PreAddThis
|
||||
(const G4Transform3D& objectTransformation,
|
||||
const G4VisAttributes&) {
|
||||
fpCurrentObjectTransformation = &objectTransformation;
|
||||
}
|
||||
|
||||
inline void G4VTreeSceneHandler::PostAddThis () {}
|
||||
@@ -0,0 +1,45 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4VTreeViewer.hh,v 1.3.2.1 2001/06/28 19:15:56 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A base class for a dummy viewer to dump geometry hierarchy.
|
||||
|
||||
#ifndef G4VTREEVIEWER_HH
|
||||
#define G4VTREEVIEWER_HH
|
||||
|
||||
#include "G4VViewer.hh"
|
||||
|
||||
class G4VTreeViewer: public G4VViewer {
|
||||
public:
|
||||
G4VTreeViewer(G4VSceneHandler&,const G4String& name);
|
||||
virtual ~G4VTreeViewer();
|
||||
void SetView();
|
||||
void ClearView();
|
||||
void DrawView();
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,77 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ASCIITree.cc,v 1.5.2.1 2001/06/28 19:15:56 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A graphics system to dump geometry hierarchy.
|
||||
|
||||
#include "G4ASCIITree.hh"
|
||||
#include "G4ASCIITreeSceneHandler.hh"
|
||||
#include "G4ASCIITreeViewer.hh"
|
||||
#include "G4ASCIITreeMessenger.hh"
|
||||
|
||||
G4ASCIITree::G4ASCIITree ():
|
||||
G4VTree ("ASCIITree",
|
||||
"ATree",
|
||||
"A graphics system to dump geometry hierarchy"
|
||||
"\n to standard output as an ASCII stream.",
|
||||
G4VGraphicsSystem::nonEuclidian),
|
||||
fVerbosity(0)
|
||||
{
|
||||
fpMessenger = new G4ASCIITreeMessenger(this);
|
||||
}
|
||||
|
||||
G4ASCIITree::~G4ASCIITree () {
|
||||
delete fpMessenger;
|
||||
}
|
||||
|
||||
G4VSceneHandler* G4ASCIITree::CreateSceneHandler (const G4String& name) {
|
||||
G4VSceneHandler* pScene = new G4ASCIITreeSceneHandler (*this, name);
|
||||
G4cout << G4ASCIITreeSceneHandler::GetSceneCount ()
|
||||
<< ' ' << fName << " scene handlers extanct." << G4endl;
|
||||
return pScene;
|
||||
}
|
||||
|
||||
G4VViewer* G4ASCIITree::CreateViewer (G4VSceneHandler& scene,
|
||||
const G4String& name) {
|
||||
G4VViewer* pView =
|
||||
new G4ASCIITreeViewer ((G4ASCIITreeSceneHandler&) scene, name);
|
||||
if (pView) {
|
||||
if (pView -> GetViewId () < 0) {
|
||||
G4cerr << "G4ASCIITree::CreateViewer: error flagged by negative"
|
||||
" view id in G4ASCIITreeViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
<< G4endl;
|
||||
delete pView;
|
||||
pView = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
G4cerr << "G4ASCIITree::CreateViewer: null pointer on"
|
||||
" new G4ASCIITreeViewer." << G4endl;
|
||||
}
|
||||
return pView;
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ASCIITreeMessenger.cc,v 1.4.2.1 2001/06/28 19:15:56 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A scene handler to dump geometry hierarchy.
|
||||
// Based on a provisional G4ASCIITreeGraphicsScene (was in modeling).
|
||||
|
||||
#include "G4ASCIITreeMessenger.hh"
|
||||
|
||||
#include "G4ASCIITree.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
G4ASCIITreeMessenger::G4ASCIITreeMessenger
|
||||
(G4ASCIITree* ASCIITree):
|
||||
fpASCIITree(ASCIITree) {
|
||||
G4bool omitable, currentAsDefault;
|
||||
fpDirectory = new G4UIdirectory ("/vis/ASCIITree/");
|
||||
fpDirectory -> SetGuidance ("Commands for ASCIITree control.");
|
||||
fpCommandVerbose = new G4UIcmdWithAnInteger ("/vis/ASCIITree/verbose", this);
|
||||
fpCommandVerbose -> SetGuidance ("/vis/ASCIITree/verbose [<verbosity>]");
|
||||
fpCommandVerbose -> SetGuidance
|
||||
("0 (default) mimimum - 10 maximum printing.");
|
||||
fpCommandVerbose -> SetParameterName ("verbosity",
|
||||
omitable = true,
|
||||
currentAsDefault = true);
|
||||
}
|
||||
|
||||
G4ASCIITreeMessenger::~G4ASCIITreeMessenger() {
|
||||
delete fpCommandVerbose;
|
||||
delete fpDirectory;
|
||||
}
|
||||
|
||||
G4String G4ASCIITreeMessenger::GetCurrentValue
|
||||
(G4UIcommand* command) {
|
||||
return "0";
|
||||
}
|
||||
|
||||
void G4ASCIITreeMessenger::SetNewValue
|
||||
(G4UIcommand* command, G4String newValue) {
|
||||
fpASCIITree->SetVerbosity
|
||||
(fpCommandVerbose->GetNewIntValue(newValue));
|
||||
G4cout << "G4ASCIITree verbosity now "
|
||||
<< fpASCIITree->GetVerbosity()
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ASCIITreeSceneHandler.cc,v 1.8.2.1 2001/06/28 19:15:56 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A scene handler to dump geometry hierarchy.
|
||||
// Based on a provisional G4ASCIITreeGraphicsScene (was in modeling).
|
||||
|
||||
#include "G4ASCIITreeSceneHandler.hh"
|
||||
|
||||
#include "G4ASCIITree.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VPVParameterisation.hh"
|
||||
|
||||
G4ASCIITreeSceneHandler::G4ASCIITreeSceneHandler(G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
G4VTreeSceneHandler(system, name) {}
|
||||
|
||||
G4ASCIITreeSceneHandler::~G4ASCIITreeSceneHandler () {}
|
||||
|
||||
void G4ASCIITreeSceneHandler::BeginModeling () {
|
||||
|
||||
G4VTreeSceneHandler::BeginModeling (); // To re-use "culling off" code.
|
||||
|
||||
const G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
|
||||
const G4int verbosity = pSystem->GetVerbosity();
|
||||
G4cout << "\nG4ASCIITreeSceneHandler::BeginModeling:"
|
||||
"\n set verbosity with \"/vis/ASCIITree/verbose <verbosity>\":"
|
||||
"\n < 10: - does not print daughters of repeated logical volumes."
|
||||
"\n - does not repeat replicas."
|
||||
"\n >= 10: prints all physical volumes."
|
||||
"\n For level of detail add:"
|
||||
"\n >= 0: prints physical volume name."
|
||||
"\n >= 1: prints logical volume name."
|
||||
"\n >= 2: prints solid name and type."
|
||||
"\n Note: all culling, if any, is switched off so all volumes are seen."
|
||||
"\n Now printing with verbosity " << verbosity << G4endl;
|
||||
}
|
||||
|
||||
void G4ASCIITreeSceneHandler::EndModeling () {
|
||||
fLVSet.clear();
|
||||
fReplicaSet.clear();
|
||||
G4cout << "G4ASCIITreeSceneHandler::EndModeling" << G4endl;
|
||||
G4VTreeSceneHandler::EndModeling (); // To re-use "culling off" code.
|
||||
}
|
||||
|
||||
void G4ASCIITreeSceneHandler::Dump (const G4VSolid& solid) {
|
||||
|
||||
const G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
|
||||
const G4int verbosity = pSystem->GetVerbosity();
|
||||
const G4int detail = verbosity % 10;
|
||||
|
||||
if (verbosity < 10 && fReplicaSet.find(fpCurrentPV) != fReplicaSet.end()) {
|
||||
// Ignore if an already treated replica. (Assumes that the model
|
||||
// which has invoked this function is a G4PhysicalVolumeModel - we
|
||||
// check this by testing fpCurrentPV.)
|
||||
if (fpCurrentPV) {
|
||||
((G4PhysicalVolumeModel*)fpModel)->CurtailDescent();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Print indented text...
|
||||
for (G4int i = 0; i < fCurrentDepth; i++ ) G4cout << " ";
|
||||
G4cout << "\"" << fpCurrentPV->GetName()
|
||||
<< "\", copy no. " << fpCurrentPV->GetCopyNo();
|
||||
if (detail >= 1) {
|
||||
G4cout << ", belongs to logical volume \""
|
||||
<< fpCurrentLV->GetName() << "\"";
|
||||
}
|
||||
if (detail >= 2) {
|
||||
G4cout << " and is composed of solid \""
|
||||
<< fpCurrentLV->GetSolid()->GetName()
|
||||
<< "\" of type \""
|
||||
<< fpCurrentLV->GetSolid()->GetEntityType() << "\"";
|
||||
}
|
||||
|
||||
if (fpCurrentPV->IsReplicated()) {
|
||||
fReplicaSet.insert(fpCurrentPV); // Record new replica volume.
|
||||
if (verbosity < 10) {
|
||||
// Add printing for replicas (when replicas are ignored)...
|
||||
EAxis axis;
|
||||
G4int nReplicas;
|
||||
G4double width;
|
||||
G4double offset;
|
||||
G4bool consuming;
|
||||
fpCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
|
||||
G4VPVParameterisation* pP = fpCurrentPV->GetParameterisation();
|
||||
G4cout << " (" << nReplicas;
|
||||
if (pP) {
|
||||
G4cout << " parametrised volumes)";
|
||||
}
|
||||
else {
|
||||
G4cout << " replicas)";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (fLVSet.find(fpCurrentLV) != fLVSet.end()) {
|
||||
if (verbosity < 10) {
|
||||
// Add printing for repeated logical volume...
|
||||
G4cout << " (repeated logical volume)";
|
||||
// Ignore if an already treated logical volume.
|
||||
if (fpCurrentPV) {
|
||||
((G4PhysicalVolumeModel*)fpModel)->CurtailDescent();
|
||||
G4cout << G4endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fLVSet.find(fpCurrentLV) == fLVSet.end()) {
|
||||
fLVSet.insert(fpCurrentLV); // Record new logical volume.
|
||||
}
|
||||
|
||||
G4cout << G4endl;
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4ASCIITreeViewer.cc,v 1.3.2.1 2001/06/28 19:15:56 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
|
||||
#include "G4ASCIITreeViewer.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "g4std/strstream"
|
||||
|
||||
G4ASCIITreeViewer::G4ASCIITreeViewer
|
||||
(G4VSceneHandler& sceneHandler, const G4String& name):
|
||||
G4VTreeViewer(sceneHandler, name) {}
|
||||
|
||||
G4ASCIITreeViewer::~G4ASCIITreeViewer() {}
|
||||
@@ -0,0 +1,70 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Satoshi Tanaka 31th May 2001
|
||||
// A graphics system to dump geometry hierarchy to GAG.
|
||||
|
||||
#include "G4GAGTree.hh"
|
||||
#include "G4GAGTreeSceneHandler.hh"
|
||||
#include "G4GAGTreeViewer.hh"
|
||||
#include "G4GAGTreeMessenger.hh"
|
||||
|
||||
G4GAGTree::G4GAGTree ():
|
||||
G4VTree ("GAGTree",
|
||||
"GAGTree",
|
||||
"A graphics system to dump geometry hierarchy"
|
||||
"\n to GAG.",
|
||||
G4VGraphicsSystem::nonEuclidian) {
|
||||
fpMessenger = new G4GAGTreeMessenger(this);
|
||||
}
|
||||
|
||||
G4GAGTree::~G4GAGTree () {
|
||||
delete fpMessenger;
|
||||
}
|
||||
|
||||
G4VSceneHandler* G4GAGTree::CreateSceneHandler (const G4String& name) {
|
||||
G4VSceneHandler* pScene = new G4GAGTreeSceneHandler (*this, name);
|
||||
G4cout << G4GAGTreeSceneHandler::GetSceneCount ()
|
||||
<< ' ' << fName << " scene handlers extanct." << G4endl;
|
||||
return pScene;
|
||||
}
|
||||
|
||||
G4VViewer* G4GAGTree::CreateViewer (G4VSceneHandler& scene,
|
||||
const G4String& name) {
|
||||
G4VViewer* pView =
|
||||
new G4GAGTreeViewer ((G4GAGTreeSceneHandler&) scene, name);
|
||||
if (pView) {
|
||||
if (pView -> GetViewId () < 0) {
|
||||
G4cerr << "G4GAGTree::CreateViewer: error flagged by negative"
|
||||
" view id in G4GAGTreeViewer creation."
|
||||
"\n Destroying view and returning null pointer."
|
||||
<< G4endl;
|
||||
delete pView;
|
||||
pView = 0;
|
||||
}
|
||||
}
|
||||
else {
|
||||
G4cerr << "G4GAGTree::CreateViewer: null pointer on"
|
||||
" new G4GAGTreeViewer." << G4endl;
|
||||
}
|
||||
return pView;
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Satoshi Tanaka 31th May 2001
|
||||
//
|
||||
// A messenger for G4GAGTree driver.
|
||||
|
||||
#include "G4GAGTreeMessenger.hh"
|
||||
|
||||
#include "G4GAGTree.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
G4GAGTreeMessenger::G4GAGTreeMessenger
|
||||
(G4GAGTree* GAGTree):
|
||||
fpGAGTree(GAGTree) {
|
||||
G4bool omitable, currentAsDefault;
|
||||
fpDirectory = new G4UIdirectory ("/vis/GAGTree/");
|
||||
fpDirectory -> SetGuidance ("Commands for GAGTree control.");
|
||||
fpCommandVerbose = new G4UIcmdWithAnInteger ("/vis/GAGTree/verbose", this);
|
||||
fpCommandVerbose -> SetGuidance ("/vis/GAGTree/verbose [<verbosity>]");
|
||||
fpCommandVerbose -> SetGuidance
|
||||
("0 (default) mimimum - 10 maximum printing.");
|
||||
fpCommandVerbose -> SetParameterName ("verbosity",
|
||||
omitable = true,
|
||||
currentAsDefault = true);
|
||||
}
|
||||
|
||||
G4GAGTreeMessenger::~G4GAGTreeMessenger() {
|
||||
delete fpCommandVerbose;
|
||||
delete fpDirectory;
|
||||
}
|
||||
|
||||
G4String G4GAGTreeMessenger::GetCurrentValue
|
||||
(G4UIcommand* command) {
|
||||
return "0";
|
||||
}
|
||||
|
||||
void G4GAGTreeMessenger::SetNewValue
|
||||
(G4UIcommand* command, G4String newValue) {
|
||||
fpGAGTree->SetVerbosity
|
||||
(fpCommandVerbose->GetNewIntValue(newValue));
|
||||
G4cout << "G4GAGTree verbosity now "
|
||||
<< fpGAGTree->GetVerbosity()
|
||||
<< G4endl;
|
||||
}
|
||||
@@ -0,0 +1,296 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Satoshi Tanaka 31th May 2001
|
||||
// A scene handler to dump geometry hierarchy to GAG.
|
||||
|
||||
#include "g4std/strstream"
|
||||
|
||||
#include "G4GAGTreeSceneHandler.hh"
|
||||
|
||||
#include "G4GAGTree.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4VPVParameterisation.hh"
|
||||
|
||||
// #define DEBUG_GAG_TREE
|
||||
|
||||
const G4String GAG_TREE_WORLD_VOLUME_NAME ( "WORLD" );
|
||||
const G4String GAG_TREE_BEGIN_DTREE ( "@@DTREEBegin" );
|
||||
const G4String GAG_TREE_END_DTREE ( "@@DTREEEnd" );
|
||||
|
||||
|
||||
//-----
|
||||
G4GAGTreeSceneHandler::G4GAGTreeSceneHandler(G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
G4VTreeSceneHandler(system, name)
|
||||
{
|
||||
ClearPVList();
|
||||
}
|
||||
|
||||
//-----
|
||||
G4GAGTreeSceneHandler::~G4GAGTreeSceneHandler ()
|
||||
{
|
||||
ClearPVList();
|
||||
}
|
||||
|
||||
//-----
|
||||
void G4GAGTreeSceneHandler::ClearPVList(void)
|
||||
{
|
||||
fPVNameList.Clear() ;
|
||||
|
||||
fPrevDepth = 0 ;
|
||||
fPrevAbsPVName = "";
|
||||
fPVCounter = 0 ;
|
||||
}
|
||||
|
||||
//-----
|
||||
void G4GAGTreeSceneHandler::InitializePVList(void)
|
||||
{
|
||||
fPVNameList.Clear();
|
||||
fPVNameList.Push( GAG_TREE_WORLD_VOLUME_NAME );
|
||||
|
||||
fPrevDepth = 0 ;
|
||||
fPrevAbsPVName = "";
|
||||
fPVCounter = 0 ;
|
||||
}
|
||||
|
||||
//-----
|
||||
void G4GAGTreeSceneHandler::BeginModeling ()
|
||||
{
|
||||
// To re-use "culling off" code.
|
||||
G4VTreeSceneHandler::BeginModeling ();
|
||||
|
||||
// Initialize the stack the the tree generation
|
||||
InitializePVList();
|
||||
|
||||
// Get the current verbosity level
|
||||
const G4GAGTree* pSystem = (G4GAGTree*)GetGraphicsSystem();
|
||||
const G4int verbosity = pSystem->GetVerbosity();
|
||||
|
||||
// Beginning of the tree output
|
||||
G4cout << "\nG4GAGTreeSceneHandler::BeginModeling:"
|
||||
"\n set verbosity with \"/vis/GAGTree/verbose <verbosity>\":"
|
||||
"\n < 10: - does not print daughters of repeated logical volumes."
|
||||
"\n - does not repeat replicas."
|
||||
"\n >= 10: prints all physical volumes."
|
||||
"\n FORMAT: PV_name.copy_no.index"
|
||||
"\n For level of detail add:"
|
||||
"\n >= 0: prints physical volume name and copy number."
|
||||
"\n FORMAT: PV_name.copy_no.index"
|
||||
"\n >= 1: prints logical volume name."
|
||||
"\n FORMAT: PV_name.copy_no.LV_name.index"
|
||||
"\n >= 2: prints solid name and type."
|
||||
"\n FORMAT: PV_name.copy_no.LV_name.solid_name.solid_type.index"
|
||||
"\n Note: all culling, if any, is switched off so all volumes are seen."
|
||||
"\n Now printing with verbosity " << verbosity << G4endl;
|
||||
|
||||
// Declare to start GAG tree
|
||||
G4cout << GAG_TREE_BEGIN_DTREE << G4endl;
|
||||
|
||||
}
|
||||
|
||||
void G4GAGTreeSceneHandler::EndModeling ()
|
||||
{
|
||||
// Dump the last PV node
|
||||
if( fPrevAbsPVName != "" ) { G4cout << fPrevAbsPVName << G4endl; }
|
||||
|
||||
// Declare to end GAG tree
|
||||
G4cout << GAG_TREE_END_DTREE << G4endl;
|
||||
G4cout << "G4GAGTreeSceneHandler::EndModeling" << G4endl;
|
||||
|
||||
// Clear the sets
|
||||
fLVSet.clear();
|
||||
fReplicaSet.clear();
|
||||
|
||||
// Clear the stack for the tree generation
|
||||
ClearPVList();
|
||||
|
||||
// To re-use "culling off" code.
|
||||
G4VTreeSceneHandler::EndModeling ();
|
||||
}
|
||||
|
||||
void G4GAGTreeSceneHandler::Dump (const G4VSolid& solid)
|
||||
{
|
||||
//////////////////////////////
|
||||
G4String cur_abs_pv_name ;
|
||||
G4String pv_name_tmp ;
|
||||
G4String cur_pv_name ( fpCurrentPV->GetName() ) ;
|
||||
//////////////////////////////
|
||||
|
||||
const G4GAGTree* pSystem = (G4GAGTree*)GetGraphicsSystem();
|
||||
const G4int verbosity = pSystem->GetVerbosity();
|
||||
const G4int detail = verbosity % 10;
|
||||
|
||||
if (verbosity < 10 && fReplicaSet.find(fpCurrentPV) != fReplicaSet.end()) {
|
||||
// Ignore if an already treated replica. (Assumes that the model
|
||||
// which has invoked this function is a G4PhysicalVolumeModel - we
|
||||
// check this by testing fpCurrentPV.)
|
||||
if (fpCurrentPV) {
|
||||
((G4PhysicalVolumeModel*)fpModel)->CurtailDescent();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////
|
||||
// Add the extension ".details.index" to the current PV node
|
||||
|
||||
// Step 1: Initialize the extension
|
||||
const int CHAR_LENGTH = 1024;
|
||||
char pv_ext [CHAR_LENGTH]; pv_ext[0] = '\0';
|
||||
G4std::ostrstream ost (pv_ext, CHAR_LENGTH);
|
||||
|
||||
// Step 2: Generate the extension
|
||||
// copy number
|
||||
ost << "." << fpCurrentPV->GetCopyNo() ;
|
||||
if (detail >= 1) {
|
||||
// LV name
|
||||
ost << "." << fpCurrentLV->GetName() ;
|
||||
}
|
||||
if (detail >= 2) {
|
||||
// Solid info
|
||||
ost << "." << fpCurrentLV->GetSolid()->GetName();
|
||||
ost << "." << fpCurrentLV->GetSolid()->GetEntityType() ;
|
||||
}
|
||||
// Tree index (0 for the world)
|
||||
ost << "." << fPVCounter << '\0' ;
|
||||
|
||||
// Step 3: Add the extention to the current PV name
|
||||
cur_pv_name += pv_ext ;
|
||||
|
||||
// End of adding extension
|
||||
|
||||
|
||||
// Search a mother PV node for the current PV
|
||||
// in the direction to the root node.
|
||||
// depth_mother = depth_current - 1
|
||||
if( fCurrentDepth > fPrevDepth )
|
||||
{
|
||||
// Do nothing (The mother is the previous PV node)
|
||||
|
||||
} else {
|
||||
|
||||
while (1)
|
||||
{
|
||||
// Delete the head item of the list
|
||||
fPVNameList.Pop();
|
||||
|
||||
// Is the right mother at the head of the list?
|
||||
// Note: The mother of the world has depth -1.
|
||||
// It happens when the current node is the world volume,
|
||||
// and so the list becomes empty with the popping above.
|
||||
|
||||
G4int trial_mother_depth = fPVNameList.GetHeadIndex() ;
|
||||
if ( fCurrentDepth > trial_mother_depth ) break ;
|
||||
}
|
||||
|
||||
} // if-else
|
||||
|
||||
// Add the curent PV to the tree as a new node/leaf
|
||||
fPVNameList.Push( cur_pv_name );
|
||||
|
||||
// Make the absolute path name
|
||||
fPVNameList.ToTail() ;
|
||||
while ( fPVNameList.GetItem ( pv_name_tmp ) ) {
|
||||
cur_abs_pv_name += "/" ;
|
||||
cur_abs_pv_name += pv_name_tmp ;
|
||||
fPVNameList.Upward();
|
||||
}
|
||||
|
||||
|
||||
// Add "/" to the PREVIOUS PV node name if it is not a leaf.
|
||||
if( fPrevAbsPVName != "" )
|
||||
{
|
||||
// Add "/"
|
||||
if( fCurrentDepth > fPrevDepth ) {fPrevAbsPVName += "/" ;}
|
||||
}
|
||||
|
||||
// Print the PREVIOUS node after node/leaf distiction
|
||||
// is made clear by reading the current node.
|
||||
if( fPrevAbsPVName != "" ) { G4cout << fPrevAbsPVName ; }
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
if (fpCurrentPV->IsReplicated()) {
|
||||
fReplicaSet.insert(fpCurrentPV); // Record new replica volume.
|
||||
if (verbosity < 10) {
|
||||
// Add printing for replicas (when replicas are ignored)...
|
||||
EAxis axis;
|
||||
G4int nReplicas;
|
||||
G4double width;
|
||||
G4double offset;
|
||||
G4bool consuming;
|
||||
fpCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
|
||||
G4VPVParameterisation* pP = fpCurrentPV->GetParameterisation();
|
||||
#if defined DEBUG_GAG_TREE
|
||||
G4cout << "_(" << nReplicas;
|
||||
#endif
|
||||
if (pP) {
|
||||
#if defined DEBUG_GAG_TREE
|
||||
G4cout << " parametrised volumes)";
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if defined DEBUG_GAG_TREE
|
||||
G4cout << " replicas)";
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (fLVSet.find(fpCurrentLV) != fLVSet.end()) {
|
||||
if (verbosity < 10) {
|
||||
// Add printing for repeated logical volume...
|
||||
#if defined DEBUG_GAG_TREE
|
||||
G4cout << " (repeated logical volume)";
|
||||
#endif
|
||||
// Ignore if an already treated logical volume.
|
||||
if (fpCurrentPV) {
|
||||
((G4PhysicalVolumeModel*)fpModel)->CurtailDescent();
|
||||
G4cout << G4endl;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fLVSet.find(fpCurrentLV) == fLVSet.end()) {
|
||||
fLVSet.insert(fpCurrentLV); // Record new logical volume.
|
||||
}
|
||||
|
||||
|
||||
////////////////////////
|
||||
// End of printing
|
||||
if( fPrevAbsPVName != "" ) { G4cout << G4endl;}
|
||||
|
||||
// Prepare for the next call, i.e. the next PV.
|
||||
fPrevDepth = fCurrentDepth ;
|
||||
fPrevAbsPVName = cur_abs_pv_name ;
|
||||
fPVCounter++ ;
|
||||
////////////////////////
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// Satoshi Tanaka 31th May 2001
|
||||
// A dummy viewer for GAGTreeSceneHandler.
|
||||
|
||||
#include "G4GAGTreeViewer.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "g4std/strstream"
|
||||
|
||||
G4GAGTreeViewer::G4GAGTreeViewer
|
||||
(G4VSceneHandler& sceneHandler, const G4String& name):
|
||||
G4VTreeViewer(sceneHandler, name) {}
|
||||
|
||||
G4GAGTreeViewer::~G4GAGTreeViewer() {}
|
||||
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4VTree.cc,v 1.3.2.1 2001/06/28 19:15:57 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A graphics system to dump geometry hierarchy.
|
||||
|
||||
#include "G4VTree.hh"
|
||||
#include "G4VTreeSceneHandler.hh"
|
||||
#include "G4VTreeViewer.hh"
|
||||
|
||||
G4VTree::G4VTree (const G4String& name,
|
||||
const G4String& nickname,
|
||||
const G4String& description,
|
||||
Functionality f):
|
||||
G4VGraphicsSystem (name,
|
||||
nickname,
|
||||
description,
|
||||
f) {}
|
||||
|
||||
G4VTree::~G4VTree () {}
|
||||
@@ -0,0 +1,86 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4VTreeSceneHandler.cc,v 1.4.2.1 2001/06/28 19:15:57 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
//
|
||||
//
|
||||
// John Allison 5th April 2001
|
||||
// A base class for a scene handler to dump geometry hierarchy.
|
||||
// Based on a provisional G4VTreeGraphicsScene (was in modeling).
|
||||
|
||||
#include "G4VTreeSceneHandler.hh"
|
||||
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4PhysicalVolumeModel.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4LogicalVolume.hh"
|
||||
#include "G4ModelingParameters.hh"
|
||||
|
||||
G4int G4VTreeSceneHandler::fSceneIdCount = 0;
|
||||
// Counter for Tree scene handlers.
|
||||
|
||||
G4int G4VTreeSceneHandler::fSceneCount = 0;
|
||||
// No. of extanct scene handlers.
|
||||
|
||||
G4VTreeSceneHandler::G4VTreeSceneHandler(G4VGraphicsSystem& system,
|
||||
const G4String& name):
|
||||
G4VSceneHandler(system, fSceneIdCount++, name),
|
||||
fCurrentDepth (0),
|
||||
fpCurrentPV (0),
|
||||
fpCurrentLV (0),
|
||||
fpCurrentObjectTransformation (0)
|
||||
{
|
||||
fSceneCount++;
|
||||
}
|
||||
|
||||
G4VTreeSceneHandler::~G4VTreeSceneHandler () {}
|
||||
|
||||
void G4VTreeSceneHandler::EstablishSpecials
|
||||
(G4PhysicalVolumeModel& pvModel) {
|
||||
pvModel.DefinePointersToWorkingSpace (&fCurrentDepth,
|
||||
&fpCurrentPV,
|
||||
&fpCurrentLV);
|
||||
}
|
||||
|
||||
void G4VTreeSceneHandler::BeginModeling() {
|
||||
G4VSceneHandler::BeginModeling(); // Required: see G4VSceneHandler.hh.
|
||||
// Force culling off...
|
||||
if (fpModel) {
|
||||
fpOriginalMP = fpModel->GetModelingParameters();
|
||||
if (fpOriginalMP) {
|
||||
fpNonCullingMP = new G4ModelingParameters(*fpOriginalMP);
|
||||
fpNonCullingMP->SetCulling(false);
|
||||
((G4VModel*)fpModel)->SetModelingParameters(fpNonCullingMP);
|
||||
// Note the deliberate casting away of const.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void G4VTreeSceneHandler::EndModeling() {
|
||||
if (fpModel && fpOriginalMP) {
|
||||
((G4VModel*)fpModel)->SetModelingParameters(fpOriginalMP);
|
||||
delete fpNonCullingMP;
|
||||
}
|
||||
G4VSceneHandler::EndModeling(); // Required: see G4VSceneHandler.hh.
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * 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: G4VTreeViewer.cc,v 1.3.2.1 2001/06/28 19:15:57 gunter Exp $
|
||||
// GEANT4 tag $Name: $
|
||||
|
||||
#include "G4VTreeViewer.hh"
|
||||
|
||||
#include "G4ios.hh"
|
||||
#include "g4std/strstream"
|
||||
|
||||
#include "G4VSceneHandler.hh"
|
||||
|
||||
G4VTreeViewer::G4VTreeViewer
|
||||
(G4VSceneHandler& sceneHandler, const G4String& name):
|
||||
G4VViewer(sceneHandler, sceneHandler.IncrementViewCount(), name) {}
|
||||
|
||||
G4VTreeViewer::~G4VTreeViewer() {}
|
||||
|
||||
void G4VTreeViewer::SetView() {}
|
||||
|
||||
void G4VTreeViewer::ClearView() {}
|
||||
|
||||
void G4VTreeViewer::DrawView() {
|
||||
NeedKernelVisit (); // Always need to visit G4 kernel.
|
||||
ProcessView ();
|
||||
}
|
||||
Reference in New Issue
Block a user