Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
+52 -20
View File
@@ -1,10 +1,11 @@
# $Id: GNUmakefile,v 1.41 2003/12/05 07:44:10 gcosmo Exp $
# $Id: GNUmakefile,v 1.61 2004/06/11 14:08:57 gcosmo Exp $
# -----------------------------------------------------------------
# "gmake" makes default libraries for each subdomain.
# "gmake global" makes global libraries for each subdomain.
# Composite libraries are built.
# "gmake includes" places header files .h/.hh in $G4INCLUDE
# "gmake libmap" forces rebuilding of map-file for granular libraries.
# "gmake dll" forces building of DLLs global libraries and generates DLLs on WIN32
# "gmake clean_libs" removes just archive (.a) and shared (.so) libraries
# of current platform installation.
# "gmake clean" removes installation of current platform.
@@ -12,10 +13,10 @@
#
# (The .o files(s) are made by implicit rules.)
SUBDIR1 = global particles processes geometry digits_hits
SUBDIR2 = event tracking track materials run graphics_reps intercoms
SUBDIR2 += parameterisations persistency readout
SUBDIR3 = interfaces visualization
SUBDIR1 = global intercoms graphics_reps materials
SUBDIR2 = geometry particles track digits_hits processes
SUBDIR2 += parameterisations tracking event run readout
SUBDIR3 = persistency interfaces visualization
SUBDIR4 = g3tog4
ifndef G4INSTALL
@@ -28,25 +29,28 @@ G4LIBDIR := $(G4LIB)/$(G4SYSTEM)
G4TMPDIR := $(G4TMP)/$(G4SYSTEM)
unique := $(shell echo $$$$)
.PHONY: all glob global libmap includes clean_libs clean clean_lists clean_all
.PHONY: all glob global kernel_global kernel libmap dll win32def includes clean_libs clean clean_lists clean_all
all:
@for dir in $(SUBDIR1); do (cd $$dir && $(MAKE)); done;:
@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE)); done;:
@for dir in $(SUBDIR3); do (cd $$dir && $(MAKE)); done;:
all: kernel
ifdef G4USE_G3TOG4
@for dir in $(SUBDIR4); do (cd $$dir && $(MAKE)); done;:
endif
$(MAKE) libmap
glob global:
@for dir in $(SUBDIR1); do (cd $$dir && $(MAKE) global); done;:
@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE)); done;:
@for dir in $(SUBDIR3); do (cd $$dir && $(MAKE)); done;:
glob global: kernel_global
ifdef G4USE_G3TOG4
@for dir in $(SUBDIR4); do (cd $$dir && $(MAKE)); done;:
endif
kernel_global:
@for dir in $(SUBDIR1); do (cd $$dir && $(MAKE) global); done;:
@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE) global); done;:
@for dir in $(SUBDIR3); do (cd $$dir && $(MAKE) global); done;:
kernel:
@for dir in $(SUBDIR1); do (cd $$dir && $(MAKE)); done;:
@for dir in $(SUBDIR2); do (cd $$dir && $(MAKE)); done;:
@for dir in $(SUBDIR3); do (cd $$dir && $(MAKE)); done;:
libmap: $(G4LIBDIR)/liblist
@echo "WARNING: Making a library map of granular libraries."
@@ -55,12 +59,12 @@ libmap: $(G4LIBDIR)/liblist
@echo " To do this it needs a complete set of dependency"
@echo " files, e.g., after gmake in the source/ directory."
@echo "Searching $(G4INSTALL)/source"
@echo ' for GNUmakefiles containing "name" and sorting...'
@echo ' for GNUmakefiles containing "name" and sorting ...'
@find $(G4INSTALL)/source \
-name GNUmakefile -exec $(GREP) -l '^ *name *:=' {} \; \
| sort \
> /tmp/G4_all_lib_makefiles.$(unique);
@echo "Weeding out /test[s]/, global level GNUmakefiles, etc..."
@echo "Weeding out /test[s]/, global level GNUmakefiles, etc ..."
@for i in `cat /tmp/G4_all_lib_makefiles.$(unique)`; \
do \
echo $$i | $(GREP) -q '/tests\?/' || \
@@ -68,7 +72,7 @@ libmap: $(G4LIBDIR)/liblist
$(GREP) -q G4hepgeometry $$i || \
echo $$i >> /tmp/G4_granlib_makefiles.$(unique); \
done
@echo "Making libname.map starter file..."
@echo "Making libname.map starter file ..."
@touch /tmp/G4libname.map.starter.$(unique);
@for i in `cat /tmp/G4_granlib_makefiles.$(unique)`; \
do \
@@ -76,7 +80,7 @@ libmap: $(G4LIBDIR)/liblist
>> /tmp/G4libname.map.starter.$(unique); \
echo $$i >> /tmp/G4libname.map.starter.$(unique); \
done
@echo "Making libname.map..."
@echo "Making libname.map ..."
@rm -f $(G4LIBDIR)/libname.map;
@G4TMP=$(G4TMP); export G4TMP; \
$(G4LIBDIR)/liblist -l -d $(G4TMPDIR) \
@@ -87,9 +91,37 @@ libmap: $(G4LIBDIR)/liblist
@rm -f /tmp/G4libname.map.starter.$(unique);
$(G4LIBDIR)/liblist: $(G4INSTALL)/config/liblist.c
@echo "Compiling liblist.c..."
@echo "Building library management utility liblist ..."
@if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ;fi
$(CC) $(CCFLAGS) -o $(G4LIBDIR)/liblist $(G4INSTALL)/config/liblist.c
@$(CC) $(CCFLAGS) -o $(G4LIBDIR)/liblist $(G4INSTALL)/config/liblist.c
dll: win32def
ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
@echo "Verifying existence of global libraries for DLLs ..."
@$(MAKE) kernel_global G4LIB_BUILD_DLL=1
@echo "Building Windows DLL libraries ..."
@$(MAKE) kernel_global G4LIB_BUILD_DLL=1 G4LIB_BUILD_SHARED=1
@echo "Clearing temporary DLL objects and temporaries ..."
@rm -rf $(G4LIBDIR)/*.def $(G4LIBDIR)/*.exp
@rm -rf $(G4TMPDIR)/*
ifdef G4USE_G3TOG4
@for dir in $(SUBDIR4); do (cd $$dir && $(MAKE)); done;:
@mv $(G4LIBDIR)/libG3toG4.a $(G4LIBDIR)/libG3toG4.lib
endif
@echo "Done !"
else
@echo "Sorry !"
endif
win32def: $(G4INSTALL)/config/win32def.c
ifneq (,$(findstring WIN32-VC,$(G4SYSTEM)))
@echo "Building DLL management utility win32def ..."
@if [ ! -d $(G4LIBDIR) ] ; then mkdir $(G4LIBDIR) ;fi
@$(CC) $(CCFLAGS) -o $(G4LIBDIR)/win32def $(G4INSTALL)/config/win32def.c
else
@echo "Build of DLLs is only supported on Windows platforms !"
@echo "The system you have currently selected is $(G4SYSTEM)."
endif
includes:
@echo Installing includes files in $(G4INCLUDE) ...
+4 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.2 2003/10/03 10:24:01 gcosmo Exp $
# $Id: GNUmakefile,v 1.3 2004/06/01 15:34:51 gcosmo Exp $
# --------------------------------------------------------------
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
# --------------------------------------------------------------
@@ -8,6 +8,9 @@ name := G4digits_hits
SUBDIRS := detector hits digits
SUBLIBS = G4detector G4digits G4hits
GLOBLIBS = libG4track.lib libG4particles.lib libG4geometry.lib
GLOBLIBS += libG4materials.lib libG4intercoms.lib libG4global.lib
ifndef G4INSTALL
G4INSTALL = ../..
endif
+26 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.4 2004/03/15 19:16:05 asaim Exp $
$Id: History,v 1.8 2004/06/11 14:46:49 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -16,6 +16,31 @@ committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Jun 11, 2004, G.Cosmo (digits_hits-V06-01-03)
- Use global flag G4DIGI_ALLOC_EXPORT to export extern symbols for DLLs.
Modified granular GNUmakefiles and rearranged usage of extern symbols
in classes.
Jun 9, 2004, G.Cosmo (digits_hits-V06-01-02)
- Adopt G4DLLIMPORT/G4DLLEXPORT technique to handle extern simbols for
allowing support of DLLs on Windows.
- Coworks with "global-V06-01-02b".
Jun 7, 2004, G.Cosmo (digits_hits-V06-01-01)
- G4THitsCollection, G4HCofThisEvent, G4TDigiCollection, G4DCofThisEvent:
export extern symbols for allowing support of DLLs.
- GNUmakefile: added definition of GLOBLIBS for DLLs support on Windows.
- Coworks with "global-V06-01-02a".
May 3, 2004, G.Cosmo (digits_hits-V06-01-00)
- G4SDManager, G4SDStructure: added optional argument 'warning' to
FindSensitiveDetector(pathName, warning), defaulted to TRUE, to
eventually exclude warning issued by G4SDManager when sensitive
detector is not found.
The fix has been requested by ALICE to deactivate the warning when
a new sensitive-detector is created automatically in their framework.
Mar 15, 2004, M.Asai (digits_hits-V06-00-01)
- Fix errors in the previous tag.
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.2 2003/10/03 10:29:19 gcosmo Exp $
# $Id: GNUmakefile,v 1.3 2004/06/11 14:10:29 gcosmo Exp $
# --------------------------------------------------------------
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
# --------------------------------------------------------------
@@ -11,6 +11,7 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4DIGI_ALLOC_EXPORT
CPPFLAGS += \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/management/include \
+9 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.2 2003/10/03 10:29:19 gcosmo Exp $
$Id: History,v 1.3 2004/05/03 08:14:01 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,14 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
May, 3rd 2004 G.Cosmo
- G4SDManager, G4SDStructure: added optional argument 'warning' to
FindSensitiveDetector(pathName, warning), defaulted to TRUE, to
eventually exclude warning issued by G4SDManager when sensitive
detector is not found.
The fix has been requested by ALICE to deactivate the warning when
a new sensitive-detector is created automatically in their framework.
Oct, 4th 2003 G.Cosmo
- Imported from digits+hits directory.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SDManager.hh,v 1.1 2003/10/03 10:08:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4SDManager.hh,v 1.2 2004/05/03 08:14:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#ifndef G4SDManager_h
@@ -71,7 +71,7 @@ class G4SDManager
// These two methods return the ID number of the sensitive detector.
public:
G4VSensitiveDetector* FindSensitiveDetector(G4String dName);
G4VSensitiveDetector* FindSensitiveDetector(G4String dName, G4bool warning = true);
G4HCofThisEvent* PrepareNewEvent();
void TerminateCurrentEvent(G4HCofThisEvent* HCE);
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SDStructure.hh,v 1.1 2003/10/03 10:08:42 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4SDStructure.hh,v 1.2 2004/05/03 08:14:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#ifndef G4SDStructure_h
@@ -54,7 +54,7 @@ class G4SDStructure
void Activate(G4String aName, G4bool sensitiveFlag);
void Initialize(G4HCofThisEvent*HCE);
void Terminate(G4HCofThisEvent*HCE);
G4VSensitiveDetector* FindSensitiveDetector(G4String aName);
G4VSensitiveDetector* FindSensitiveDetector(G4String aName, G4bool warning = true);
G4VSensitiveDetector* GetSD(G4String aName);
void ListTree();
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SDManager.cc,v 1.1 2003/10/03 10:11:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4SDManager.cc,v 1.2 2004/05/03 08:14:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4SDManager.hh"
@@ -101,11 +101,11 @@ void G4SDManager::Activate(G4String dName, G4bool activeFlag)
treeTop->Activate(pathName,activeFlag);
}
G4VSensitiveDetector* G4SDManager::FindSensitiveDetector(G4String dName)
G4VSensitiveDetector* G4SDManager::FindSensitiveDetector(G4String dName, G4bool warning)
{
G4String pathName = dName;
if( pathName(0) != '/' ) pathName.prepend("/");
return treeTop->FindSensitiveDetector(pathName);
return treeTop->FindSensitiveDetector(pathName, warning);
}
G4int G4SDManager::GetCollectionID(G4String colName)
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4SDStructure.cc,v 1.1 2003/10/03 10:11:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4SDStructure.cc,v 1.2 2004/05/03 08:14:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// G4SDStructure
@@ -160,7 +160,7 @@ void G4SDStructure::Activate(G4String aName, G4bool sensitiveFlag)
}
}
G4VSensitiveDetector* G4SDStructure::FindSensitiveDetector(G4String aName)
G4VSensitiveDetector* G4SDStructure::FindSensitiveDetector(G4String aName, G4bool warning)
{
G4String aPath = aName;
aPath.remove(0,pathName.length());
@@ -170,7 +170,8 @@ G4VSensitiveDetector* G4SDStructure::FindSensitiveDetector(G4String aName)
G4SDStructure* tgtSDS = FindSubDirectory(subD);
if( tgtSDS == 0 )
{ // The subdirectory is not found
G4cout << subD << " is not found in " << pathName << G4endl;
if (warning)
G4cout << subD << " is not found in " << pathName << G4endl;
return 0;
}
else
@@ -183,7 +184,8 @@ G4VSensitiveDetector* G4SDStructure::FindSensitiveDetector(G4String aName)
G4VSensitiveDetector* tgtSD = GetSD(aPath);
if( tgtSD == 0 )
{ // The detector is not found.
G4cout << aPath << " is not found in " << pathName << G4endl;
if (warning)
G4cout << aPath << " is not found in " << pathName << G4endl;
}
return tgtSD;
}
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.1 2003/10/03 10:13:29 gcosmo Exp $
# $Id: GNUmakefile,v 1.2 2004/06/11 14:10:29 gcosmo Exp $
# --------------------------------------------------------------
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
# --------------------------------------------------------------
@@ -11,6 +11,7 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4DIGI_ALLOC_EXPORT
CPPFLAGS += \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/management/include \
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4DCofThisEvent.hh,v 1.1 2003/10/03 10:14:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4DCofThisEvent.hh,v 1.4 2004/06/11 14:10:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#ifndef G4DCofThisEvent_h
@@ -85,7 +85,11 @@ class G4DCofThisEvent
}
};
extern G4Allocator<G4DCofThisEvent> anDCoTHAllocator;
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4DCofThisEvent> anDCoTHAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4DCofThisEvent> anDCoTHAllocator;
#endif
inline void* G4DCofThisEvent::operator new(size_t)
{
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TDigiCollection.hh,v 1.1 2003/10/03 10:14:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4TDigiCollection.hh,v 1.4 2004/06/11 14:10:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#ifndef G4TDigiCollection_h
@@ -55,7 +55,11 @@ class G4DigiCollection : public G4VDigiCollection
void* theCollection;
};
extern G4Allocator<G4DigiCollection> aDCAllocator;
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4DigiCollection> aDCAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4DigiCollection> aDCAllocator;
#endif
template <class T> class G4TDigiCollection : public G4DigiCollection
{
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4DCofThisEvent.cc,v 1.1 2003/10/03 10:15:09 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4DCofThisEvent.cc,v 1.3 2004/06/11 14:10:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4DCofThisEvent.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TDigiCollection.cc,v 1.1 2003/10/03 10:15:24 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4TDigiCollection.cc,v 1.3 2004/06/11 14:10:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4TDigiCollection.hh"
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.1 2003/10/03 10:16:22 gcosmo Exp $
# $Id: GNUmakefile,v 1.2 2004/06/11 14:10:32 gcosmo Exp $
# --------------------------------------------------------------
# GNUmakefile for digits+hits library. Makoto Asai, 1/11/96.
# --------------------------------------------------------------
@@ -11,6 +11,7 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4DIGI_ALLOC_EXPORT
CPPFLAGS += \
-I$(G4BASE)/global/HEPRandom/include \
-I$(G4BASE)/global/management/include \
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HCofThisEvent.hh,v 1.1 2003/10/03 10:16:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4HCofThisEvent.hh,v 1.4 2004/06/11 14:10:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#ifndef G4HCofThisEvent_h
@@ -84,7 +84,11 @@ class G4HCofThisEvent
}
};
extern G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4HCofThisEvent> anHCoTHAllocator;
#endif
inline void* G4HCofThisEvent::operator new(size_t)
{
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4THitsCollection.hh,v 1.1 2003/10/03 10:17:08 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4THitsCollection.hh,v 1.4 2004/06/11 14:10:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#ifndef G4THitsCollection_h
@@ -56,7 +56,11 @@ class G4HitsCollection : public G4VHitsCollection
void* theCollection;
};
extern G4Allocator<G4HitsCollection> anHCAllocator;
#if defined G4DIGI_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4HitsCollection> anHCAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4HitsCollection> anHCAllocator;
#endif
template <class T> class G4THitsCollection : public G4HitsCollection
{
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HCofThisEvent.cc,v 1.1 2003/10/03 10:18:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4HCofThisEvent.cc,v 1.3 2004/06/11 14:10:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4HCofThisEvent.hh"
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4THitsCollection.cc,v 1.1 2003/10/03 10:18:14 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4THitsCollection.cc,v 1.3 2004/06/11 14:10:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4THitsCollection.hh"
+7 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.5 2003/10/03 14:12:14 gcosmo Exp $
# $Id: GNUmakefile,v 1.7 2004/06/11 14:11:15 gcosmo Exp $
# ------------------------------------------------------------
# GNUmakefile for events library. Makoto Asai, 5/9/95.
# ------------------------------------------------------------
@@ -9,8 +9,14 @@ ifndef G4INSTALL
G4INSTALL = ../..
endif
GLOBLIBS = libG4tracking.lib libG4processes.lib libG4digits_hits.lib
GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
GLOBLIBS += libG4materials.lib libG4graphics_reps.lib
GLOBLIBS += libG4intercoms.lib libG4global.lib
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4EVENT_ALLOC_EXPORT
CPPFLAGS += \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPRandom/include \
+44 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.71 2004/03/16 00:04:25 asaim Exp $
$Id: History,v 1.79 2004/06/11 14:52:16 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,49 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Jun 11, 2004, G.Cosmo (event-V06-01-07)
- Use global flag G4EVENT_ALLOC_EXPORT to export extern symbols for DLLs.
Modified GNUmakefile and rearranged usage of extern symbols in classes.
Jun 9, 2004, G.Cosmo (event-V06-01-06)
- Adopt G4DLLIMPORT/G4DLLEXPORT technique to handle extern simbols for
allowing support of DLLs on Windows.
- Coworks with "global-V06-01-02b".
Jun 7, 2004, G.Cosmo (event-V06-01-05)
- Export extern symbols for allowing support of DLLs on Windows. Modified files:
G4Event.hh, G4HEPEvtParticle.hh, G4PrimaryParticle.hh, G4PrimaryVertex.hh,
G4StackedTrack.hh, G4TrajectoryContainer.hh.
- GNUmakefile: added definition of GLOBLIBS for DLLs support on Windows.
- Coworks with "global-V06-01-02a".
May 26, 2004, M.Asai (event-V06-01-04)
- Fix incorrect behaviour of event abortion requested by BeginOfEventAction.
May 04, 2004, M.Asai (event-V06-01-03)
- Access methods to G4TrackingManager and G4StackManager are added
to G4EventManager.
Apr, 26, 2004, F. Lei (event-V06-01-02)
- Restored a few methods to G4GeneralParticleSource.hh to maintain backward
compatibility.
Apr, 5, 2004, F. Lei (event-V06-01-01)
- Added "UserWRTSurace = true", "UserAngRef= flase" to constructor of
G4SPSAngDistribution.
- Apply the Max/Min angle limits to the User defined angular distribution case.
- New formula for conevrting integral spectrum to differential one.
Apr, 1, 2004, F. Lei (event-V06-01-00)
- Major design iteration of the G4GeneralParticleSource class. The following
new classes have been added:
- G4SingleParticleSource
- G4SPSEneDistribution
- G4SPSAngDistribution
- G4SPSPosDistribution
- G4SPSRandomGenerator
See http://reat.space.qinetiq.com/gps for more details of the changes.
Mar. 15, 2004, M.Asai (event-V06-00-01)
- LocateGlobalPointAndSetup() method of G4Navigator is now invoked at the
beginning of each event to reset the navigator.
+7 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Event.hh,v 1.7 2003/09/09 20:09:17 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4Event.hh,v 1.10 2004/06/11 14:11:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#ifndef G4Event_h
@@ -155,7 +155,11 @@ class G4Event
// Set and Get method of G4VUserEventInformation
};
extern G4Allocator<G4Event> anEventAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4Event> anEventAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4Event> anEventAllocator;
#endif
inline void* G4Event::operator new(size_t)
{
+9 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EventManager.hh,v 1.12 2003/09/09 20:09:17 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4EventManager.hh,v 1.14 2004/05/26 17:08:33 asaim Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
@@ -126,6 +126,7 @@ class G4EventManager
G4SDManager* sdManager;
G4PrimaryTransformer* transformer;
G4bool tracking;
G4bool abortRequested;
G4EvManMessenger* theMessenger;
@@ -146,6 +147,7 @@ class G4EventManager
public: // with description
inline void AbortCurrentEvent()
{
abortRequested = true;
trackContainer->clear();
if(tracking) trackManager->EventAborted();
}
@@ -173,6 +175,11 @@ class G4EventManager
void SetNumberOfAdditionalWaitingStacks(G4int iAdd)
{ trackContainer->SetNumberOfAdditionalWaitingStacks(iAdd); }
inline G4StackManager* GetStackManager() const
{ return trackContainer; }
inline G4TrackingManager* GetTrackingManager() const
{ return trackManager; }
public: // with description
inline G4int GetVerboseLevel()
{ return verboseLevel; }
+119 -582
View File
@@ -22,647 +22,184 @@
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4GeneralParticleSource.hh
// MODULE: G4GeneralParticleSource.hh
//
// Version: 1.1
// Date: 18/10/00
// Author: C Ferguson, F Lei & P Truscott
// Organisation: University of Southampton / DERA
// Customer: ESA/ESTEC
// Version: 2.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
// Documentation avaialable at http://reat.space.qinetiq.com/gps
// These include:
// User Requirement Document (URD)
// Software Specification Documents (SSD)
// Software User Manual (SUM): on-line version available
// Technical Note (TN) on the physics and algorithms
//
///////////////////////////////////////////////////////////////////////////////
// $Id: G4GeneralParticleSource.hh,v 1.8 2003/10/13 09:21:27 flei Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
//
// CHANGE HISTORY
// --------------
//
// Version 2.0, 05/02/2004, Fan Lei, Created.
// based on version 1.1 in Geant4 v6.0
// - Mutilple particle source definition
// - Re-structured commands
// - Split the task into smaller classes
//
// - old commonds have been retained for backward compatibility, but will
// be removed in the future.
//
///////////////////////////////////////////////////////////////////////////////
//
// Class Description:
//
// The General Particle Source is designed to extend the functionality of the
// G4ParticleGun class. It is designed to allow specification of input
// particles in terms of position, direction (or angular) and energy
// distributions. This class is derived from G4VPrimaryGenerator.
// The General Particle Source is designed to replace the G4ParticleGun class.
// It is designed to allow specification of mutiple particle sources, each with
// independent definitions of particle type, position, direction (or angular)
// and energy distributions.
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4GeneralParticleSource ()
// Constructor: Initializes variables and instantiates the
// Messenger and Navigator classes
// G4GeneralParticleSource()
// Constructor: Initializes variables and instantiates the
// Messenger and generator classes
//
// ~G4GeneralParticleSource ()
// Destructor: deletes Messenger and prints out run information.
// ~G4GeneralParticleSourceMessenger()
// Destructor: deletes Messenger and others
//
// void GeneratePrimaryVertex(G4Event *evt)
// Generate the particles initial parameters.
// G4int GetNumberofSource()
// Return the number of particle gun defined
//
// void SetPosDisType(G4String)
// Allows user to choose Point, Plane, Surface or Volume source
// position distributions.
// void ListSource()
// List the particle guns defined
//
// void SetPosDisShape(G4String)
// Allows the user to choose the particular shape they wish for the
// position distribution. Choices are Square, Circle, Ellipse, Rectangle,
// Sphere, Ellipsoid, Cylinder, Parallelepiped.
// void SetCurrentSourceto(G4int)
// set the current gun to the specified one so its definition can be changed
//
// void SetCentreCoords(G4ThreeVector)
// Sets the co-ordinates of the centre of the position distribution.
//
// void SetPosRot1(G4ThreeVector)
// Used to specify the co-ordinate system for the position distribution
// along with SetPosRot2. SetPosRot1 sets the vector x' and need not be
// a unit vector.
//
// void SetPosRot2(G4ThreeVector)
// Used in connection with SetPosRot1. This sets a vector in the plane
// x'y'. By a series of cross products x', y', z' are generated. Again
// need not be a unit vector.
// void SetCurrentSourceIntensity(G4double)
// change the current particle gun strength
//
// G4SingleParticleSource* GetCurrentSource()
// return the pointer to current particle gun
//
// void SetHalfX(G4double)
// Sets the half length in x.
// G4int GetCurrentSourceIndex()
// return the index of the current particle gun
//
// void SetHalfY(G4double)
// Sets the half length in y.
// G4double GetCurrentSourceIntensity()
// return the strength of the current gun
//
// void SetHalfZ(G4double)
// Sets the half length in z.
// void ClearAll()
// remove all defined aprticle gun
//
// void SetRadius(G4double)
// Sets the radius where appropriate for source distribution shapes.
// void AddaSource (G4double)
// add a new particle gun with the specified strength
//
// void SetRadius0(G4double)
// Sets the inner radius where appropriate for source distribution shapes.
// void DeleteaSource(G4int);
// delete the specified particle gun
//
// void SetParAlpha(G4double)
// Sets the angle Alpha in the Parallelepiped shapes.
// void SetParticleDefinition ();
// G4ParticleDefinition * GetParticleDefinition ()
// Get/Set the particle definition of the primary track
//
// void SetParTheta(G4double)
// Sets the angle Theta in the Parallelepiped shapes.
// void SetParticleCharge(G4double aCharge)
// set the charge state of the primary track
//
// void SetParPhi(G4double)
// Sets the angle Phi in the Parallelepiped shapes.
// inline void SetParticlePolarization (G4ThreeVector aVal)
// inline G4ThreeVector GetParticlePolarization ()
// Set/Get the polarization state of the primary track
//
// void ConfineSourceToVolume(G4String)
// Used to confine the start positions to a particular volume.
// inline void SetParticleTime(G4double aTime) { particle_time = aTime; };
// inline G4double GetParticleTime() { return particle_time; };
// Set/Get the Time.
//
// void GenerateRotationMatrices()
// This is used to calculate the cross products and determine the
// vectors x', y', z' for the position distribution.
// inline void SetNumberOfParticles(G4int i)
// inline G4int GetNumberOfParticles()
// set/get the number of particles to be generated in the primary track
//
// void GeneratePointSource()
// Generates a point source.
//
// void GeneratePointsInPlane()
// Generates starting positions confined to a plane source.
//
// void GeneratePointsOnSurface()
// Generates starting positions confined to the surface of a shape.
//
// void GeneratePointsInVolume()
// Generates starting positions within the volume of a shape.
//
// G4bool IsSourceConfined()
// Checks the source is confined to the requested volume.
//
// Angular Distribution Methods:
//
// void SetAngDistType(G4String)
// Used to set the type of angular distribution wanted. Arguments
// are iso, cos and user for isotropic, cosine-law and user-defined
// respectively.
//
// void DefineAngRefAxes(G4String, G4ThreeVector)
// DefineAngRefAxes is used in a similar way as SetPosRot to
// define vectors, one x' and one in the plane x'y', to create
// a rotated set of axes for the angular distribution.
//
// void SetMinTheta(G4double)
// Sets the minimum value for the angle theta.
//
// void SetMinPhi(G4double)
// Sets the minimum value for phi.
//
// void SetMaxTheta(G4double)
// Sets the maximum value for theta.
//
// void SetMaxPhi(G4double)
// Sets the maximum value for phi.
//
// void UserDefAngTheta(G4ThreeVector)
// This method allows the user to define a histogram in Theta.
//
// void UserDefAngPhi(G4ThreeVector)
// This method allows the user to define a histogram in phi.
//
// void GenerateIsotropicFlux()
// This method generates momentum vectors for particles according
// to an isotropic distribution.
//
// void GenerateCosineLawFlux()
// This method generates momentum vectors for particles according
// to a cosine-law distribution.
//
// void GenerateUserDefFlux()
// Controls generation of momentum vectors according to user-defined
// distributions.
//
// G4double GenerateUserDefTheta()
// Generates the theta angle according to a user-defined distribution.
//
// G4double GenerateUserDefPhi()
// Generates phi according to a user-defined distribution.
//
// void SetUserWRTSurface(G4bool)
// Allows user to have user-defined spectra either with respect to the
// co-ordinate system (default) or with respect to the surface normal.
//
// Energy Distribution methods:
//
// void SetEnergyDisType(G4String)
// Allows the user to choose the energy distribution type. The arguments
// are Mono (mono-energetic), Lin (linear), Pow (power-law), Exp
// (exponential), Brem (bremsstrahlung), BBody (black-body), Cdg
// (cosmic diffuse gamma-ray), User (user-defined), Arb (arbitrary
// point-wise), Epn (energy per nucleon).
//
// void SetEmin(G4double)
// Sets the minimum energy.
//
// void SetEmax(G4double)
// Sets the maximum energy.
//
// void SetMonoEnergy(G4double)
// Sets energy for mono-energetic distribution.
//
// void SetAlpha(G4double)
// Sets alpha for a power-law distribution.
//
// void SetTemp(G4double)
// Sets Temperature for a Brem or BBody distributions.
//
// void SetEzero(G4double)
// Sets Ezero for an exponential distribution.
//
// void SetGradient(G4double)
// Sets gradient for a linear distribution.
//
// void SetInterCept(G4double)
// Sets intercept for a linear distribution.
//
// void UserEnergyHisto(G4ThreeVector)
// Allows user to defined a histogram for the energy distribution.
//
// void ArbEnergyHisto(G4ThreeVector)
// Allows the user to define an Arbitrary set of points for the
// energy distribution.
//
// void EpnEnergyHisto(G4ThreeVector)
// Allows the user to define an Energy per nucleon histogram.
//
// void Calculate()
// Controls the calculation of Integral PDF for the Cdg and BBody
// distributions.
//
// void CalculateCdgSpectrum()
// Calculates the integral PDF for the Cdg distribution.
//
// void CalculateBbodySpectrum()
// Calculates the Integral PDF for the Bbody distribution.
//
// void InputEnergySpectra(G4bool)
// Allows the user to choose between momentum and energy histograms
// for user-defined histograms and arbitrary point-wise spectr.
// The default is true (energy).
//
// void InputDifferentialSpectra(G4bool)
// Allows the user to choose between integral and differential
// distributions when using the arbitrary point-wise option.
//
// void ArbInterpolate(G4String)
// ArbInterpolate allows the user to specify the type of function to
// interpolate the Arbitrary points spectrum with.
//
// void LinearInterpolation()
// Interpolates arbitrary points with a series of line segments.
//
// void LogInterpolation()
// Interpolates arbitrary points with a series of power-laws.
//
// void ExpInterpolation()
// Interpolates arbitrary points with a series of exponentials.
//
// void SplineInterpolation()
// Interpolates arbitrary points using cubic splines.
//
// void GenerateMonoEnergetic()
// Generates a mono-energetic source.
//
// void GenerateLinearEnergies()
// Generates particle energies according to a linear distribution.
//
// void GeneratePowEnergies()
// Generates particle energies according to a power-law distribution.
//
// void GenerateExpEnergies()
// Generates particle energies according to an exponential distribution.
//
// void GenerateBremEnergies()
// Generates particle energies according to a bremsstrahlung distribution.
//
// void GenerateBbodyEnergies()
// Generates particle energies according to a black-body distribution.
//
// void GenerateCdgEnergies()
// Generates particle energies according to a Cdg distribution.
//
// void GenUserHistEnergies()
// Generates particle energies according to a user-defined distribution.
//
// void GenEpnHistEnergies()
// Generates particle energies according to a energy per nucleon
// distribution.
//
// void GenArbPointEnergies()
// Generates particle energies according to an arbitrary point-wise
// spectrum.
//
// void ConvertEPNToEnergy()
// Converts energy per nucleon histograms to energy histograms.
//
// Biasing Methods:
//
// void SetXBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate x co-ordinates.
//
// void SetYBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate y co-ordinates.
//
// void SetZBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate z co-ordinates.
//
// void SetThetaBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate values of theta.
//
// void SetPhiBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate values of phi.
//
// void SetEnergyBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate the energies.
//
// G4double GenRandX()
// Generates the random number for x, with or without biasing.
//
// G4double GenRandY()
// Generates the random number for y, with or without biasing.
//
// G4double GenRandZ()
// Generates the random number for z, with or without biasing.
//
// G4double GenRandTheta()
// Generates the random number for theta, with or without biasing.
//
// G4double GenRandPhi()
// Generates the random number for phi, with or without biasing.
//
// G4double GenRandEnergy()
// Generates the random number for energy, with or without biasing.
//
// void SetVerbosity(G4int)
// Sets the verbosity level.
// inline G4ThreeVector GetParticlePosition()
// inline G4ThreeVector GetParticleMomentumDirection()
// inline G4double GetParticleEnergy()
// get the position, direction, and energy of the current particle
//
///////////////////////////////////////////////////////////////////////////////
//
//
// CHANGE HISTORY
// --------------
//
// Version 1.0, 28 February 2000, C Ferguson, Created.
//
// Version 1.1, 18 October 2000, Modified to inherit from G4VPrimaryGenerator.
// New name at the request of M. Asai.
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4GeneralParticleSource_h
#define G4GeneralParticleSource_h 1
#ifndef G4GeneralParticleSource_H
#define G4GeneralParticleSource_H 1
#include "G4VPrimaryGenerator.hh"
#include "G4Navigator.hh"
#include "G4PhysicsOrderedFreeVector.hh"
#include "G4ParticleMomentum.hh"
#include "G4ParticleDefinition.hh"
#include "G4DataInterpolation.hh"
#include "globals.hh"
#include <vector>
#include "G4Event.hh"
#include "G4SingleParticleSource.hh"
//
#include "G4GeneralParticleSourceMessenger.hh"
class G4GeneralParticleSource : public G4VPrimaryGenerator
class G4GeneralParticleSource
{
//
public:
G4GeneralParticleSource ();
~G4GeneralParticleSource ();
void GeneratePrimaryVertex(G4Event *evt);
// methods to create source position dist.
void SetPosDisType(G4String); // Point, Plane, Surface, Volume
inline G4String GetPosDisType()
{ return SourcePosType; }
void SetPosDisShape(G4String);
inline G4String GetPosDisShape()
{ return Shape; }
// SetPosDisShape - Square, Circle, Annulus, Ellipse, Rectangle, Sphere,
// Ellipsoid, Cylinder, Right (parallelepiped).
void SetCentreCoords(G4ThreeVector);
inline G4ThreeVector GetCentreCoords()
{ return CentreCoords; }
void SetPosRot1(G4ThreeVector);
void SetPosRot2(G4ThreeVector);
void SetHalfX(G4double);
inline G4double GetHalfX()
{ return halfx; }
void SetHalfY(G4double);
inline G4double GetHalfY()
{ return halfy; }
void SetHalfZ(G4double);
inline G4double GetHalfZ()
{ return halfz; }
void SetRadius(G4double);
inline G4double GetRadius()
{ return Radius; }
void SetRadius0(G4double);
void SetBeamSigmaInR(G4double);
void SetBeamSigmaInX(G4double);
void SetBeamSigmaInY(G4double);
void SetParAlpha(G4double);
void SetParTheta(G4double);
void SetParPhi(G4double);
void ConfineSourceToVolume(G4String);
void GenerateRotationMatrices();
// the following routines generate the source position
void GeneratePointSource();
void GeneratePointsInBeam();
void GeneratePointsInPlane();
void GeneratePointsOnSurface();
void GeneratePointsInVolume();
G4GeneralParticleSource();
~G4GeneralParticleSource();
G4bool IsSourceConfined();
void GeneratePrimaryVertex(G4Event*);
// Angular Distribution Methods
void SetAngDistType(G4String);
void DefineAngRefAxes(G4String, G4ThreeVector);
void SetMinTheta(G4double);
void SetMinPhi(G4double);
void SetMaxTheta(G4double);
void SetMaxPhi(G4double);
void SetBeamSigmaInAngR(G4double);
void SetBeamSigmaInAngX(G4double);
void SetBeamSigmaInAngY(G4double);
void UserDefAngTheta(G4ThreeVector);
void UserDefAngPhi(G4ThreeVector);
inline void SetParticleMomentumDirection
(G4ParticleMomentum aMomentumDirection)
{ particle_momentum_direction = aMomentumDirection.unit(); }
// These methods generate the momentum vectors for the particles.
void GenerateIsotropicFlux();
void GenerateCosineLawFlux();
void GenerateBeamFlux();
void GeneratePlanarFlux();
void GenerateUserDefFlux();
G4double GenerateUserDefTheta();
G4double GenerateUserDefPhi();
void SetUseUserAngAxis(G4bool);
void SetUserWRTSurface(G4bool);
// Energy Distribution methods
void SetEnergyDisType(G4String);
inline G4String GetEnergyDisType()
{return EnergyDisType;}
void SetEmin(G4double);
inline G4double GetEmin()
{return Emin;}
inline G4double GetArbEmin()
{return ArbEmin;}
void SetEmax(G4double);
inline G4double GetEmax()
{return Emax;}
inline G4double GetArbEmax()
{return ArbEmax;}
void SetMonoEnergy(G4double);
void SetAlpha(G4double);
void SetTemp(G4double);
void SetBeamSigmaInE(G4double);
void SetEzero(G4double);
void SetGradient(G4double);
void SetInterCept(G4double);
void UserEnergyHisto(G4ThreeVector);
void ArbEnergyHisto(G4ThreeVector);
void EpnEnergyHisto(G4ThreeVector);
void Calculate();
void CalculateCdgSpectrum();
void CalculateBbodySpectrum();
void InputEnergySpectra(G4bool);
void InputDifferentialSpectra(G4bool);
void ArbInterpolate(G4String);
inline G4String GetIntType()
{return IntType;}
void LinearInterpolation();
void LogInterpolation();
void ExpInterpolation();
void SplineInterpolation();
// The following methods generate energies according to the spectral
// parameters defined above.
void GenerateMonoEnergetic();
void GenerateLinearEnergies();
void GeneratePowEnergies();
void GenerateExpEnergies();
void GenerateGaussEnergies();
void GenerateBremEnergies();
void GenerateBbodyEnergies();
void GenerateCdgEnergies();
void GenUserHistEnergies();
void GenEpnHistEnergies();
void GenArbPointEnergies();
// converts energy per nucleon to energy.
void ConvertEPNToEnergy();
// Biasing Methods
void SetXBias(G4ThreeVector);
void SetYBias(G4ThreeVector);
void SetZBias(G4ThreeVector);
void SetThetaBias(G4ThreeVector);
void SetPhiBias(G4ThreeVector);
void SetEnergyBias(G4ThreeVector);
G4double GenRandX();
G4double GenRandY();
G4double GenRandZ();
G4double GenRandTheta();
G4double GenRandPhi();
G4double GenRandEnergy();
// method to re-set the histograms
void ReSetHist(G4String);
G4int GetNumberofSource() { return G4int(sourceVector.size()); };
void ListSource();
void SetCurrentSourceto(G4int) ;
void SetCurrentSourceIntensity(G4double);
G4SingleParticleSource* GetCurrentSource() {return currentSource;};
G4int GetCurrentSourceIndex() { return currentSourceIdx; };
G4double GetCurrentSourceIntensity() { return sourceIntensity[currentSourceIdx]; };
void ClearAll();
void AddaSource (G4double);
void DeleteaSource(G4int);
// Set the verbosity level.
void SetVerbosity(G4int);
inline void SetVerbosity(G4int i) {currentSource->SetVerbosity(i);} ;
// Set the particle species
void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition);
inline G4ParticleDefinition * GetParticleDefinition ()
{return particle_definition;}
inline void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition)
{currentSource->SetParticleDefinition(aParticleDefinition); } ;
// SR1.3 - allowing user to define an isotope by A,Z,energy.
// void SetNucleus(Nucleus theIon1); // Sets the isotope.
//inline Nucleus GetNucleus() {return theIon;} // Returns the isotope.
inline G4ParticleDefinition * GetParticleDefinition () { return currentSource->GetParticleDefinition();} ;
inline void SetParticleCharge(G4double aCharge)
{ particle_charge = aCharge; }
inline void SetParticleCharge(G4double aCharge) { currentSource->SetParticleCharge(aCharge); } ;
// Set polarization
inline void SetParticlePolarization (G4ThreeVector aVal)
{particle_polarization = aVal;}
inline G4ThreeVector GetParticlePolarization ()
{return particle_polarization;}
inline void SetParticlePolarization (G4ThreeVector aVal) {currentSource->SetParticlePolarization(aVal);};
inline G4ThreeVector GetParticlePolarization () {return currentSource->GetParticlePolarization();};
// Set Time.
inline void SetParticleTime(G4double aTime)
{ particle_time = aTime; }
inline G4double GetParticleTime()
{ return particle_time; }
inline void SetParticleTime(G4double aTime) { currentSource->SetParticleTime(aTime); };
inline G4double GetParticleTime() { return currentSource->GetParticleTime(); };
inline void SetNumberOfParticles(G4int i)
{ NumberOfParticlesToBeGenerated = i; }
inline G4int GetNumberOfParticles()
{ return NumberOfParticlesToBeGenerated; }
inline G4ThreeVector GetParticlePosition()
{ return particle_position;}
inline G4ThreeVector GetParticleMomentumDirection()
{ return particle_momentum_direction;}
inline G4double GetTheta()
{ return Theta;}
inline G4double GetPhi()
{ return Phi;}
inline G4double GetParticleEnergy()
{return particle_energy;}
inline void SetNumberOfParticles(G4int i) { currentSource->SetNumberOfParticles(i); };
//
inline G4int GetNumberOfParticles() { return currentSource->GetNumberOfParticles(); };
inline G4ThreeVector GetParticlePosition() { return currentSource->GetParticlePosition();};
inline G4ThreeVector GetParticleMomentumDirection() { return currentSource->GetParticleMomentumDirection();};
inline G4double GetParticleEnergy() {return currentSource->GetParticleEnergy();};
private:
// Position distribution Variables
G4String SourcePosType; //Point,Plane,Surface,Volume
G4String Shape; //Circle,Square,Rectangle etc..
G4double halfx, halfy, halfz; //half lengths
G4double Radius; //Radius for circles or spheres
G4double Radius0; // The inner radius of an annulus
G4double SR,SX,SY; // Standard deviation in raduial, x, y for beam type source
G4ThreeVector CentreCoords; // Coords of centre of input shape
G4ThreeVector Rotx, Roty, Rotz; // Unit vectors defining rotation matrix
G4double ParAlpha, ParTheta, ParPhi; //Angle for Right Parallellepipeds
G4bool Confine; //If true confines source distribution to VolName
G4String VolName;
G4ThreeVector SideRefVec1,SideRefVec2,SideRefVec3; //Side rotation matrices
// Angular distribution variables.
G4String AngDistType; // String to hold Ang dist type iso, cos, user
G4ThreeVector AngRef1, AngRef2, AngRef3; // Reference axes for ang dist
G4double MinTheta, MaxTheta, MinPhi, MaxPhi; // min/max theta/phi
G4double DR,DX,DY ; // Standard deviation for beam divergence
G4double Theta, Phi; // Store these for use with DEBUG
G4bool IPDFThetaExist, IPDFPhiExist; // tell whether IPDF histos exist
G4PhysicsOrderedFreeVector UDefThetaH; // Theta histo data
G4PhysicsOrderedFreeVector IPDFThetaH; //Cumulative Theta histogram.
G4PhysicsOrderedFreeVector UDefPhiH; // Phi histo bins
G4PhysicsOrderedFreeVector IPDFPhiH; // Cumulative phi histogram.
G4String UserDistType; //String to hold user distributions
G4bool UserWRTSurface; // G4bool to tell whether user wants distribution wrt
// surface normals or co-ordinate system
G4bool UserAngRef; // Set to true when user defines aaa new coordinates
// Energy Distribution variables
G4String EnergyDisType; // energy dis type Variable - Mono,Lin,Exp,etc
G4double MonoEnergy; //Mono-energteic energy
G4double SE ; // Standard deviation for Gaussion distrbution in energy
G4double Emin, Emax; // emin and emax
G4double alpha, Ezero, Temp; // alpha (pow), E0 (exp) and Temp (bbody,brem)
G4double grad, cept; // gradient and intercept for linear spectra
G4bool EnergySpec; // true - energy spectra, false - momentum spectra
G4bool DiffSpec; // true - differential spec, false integral spec
G4bool ApplyRig; // false no rigidity cutoff, true then apply one
G4double ERig; // energy of rigidity cutoff
G4PhysicsOrderedFreeVector UDefEnergyH; // energy hist data
G4PhysicsOrderedFreeVector IPDFEnergyH;
G4bool IPDFEnergyExist, IPDFArbExist, Epnflag;
G4PhysicsOrderedFreeVector ArbEnergyH; // Arb x,y histogram
G4PhysicsOrderedFreeVector IPDFArbEnergyH; // IPDF for Arb
G4PhysicsOrderedFreeVector EpnEnergyH;
G4double CDGhist[3]; // cumulative histo for cdg
G4double BBHist[10001], Bbody_x[10001];
G4String IntType; // Interpolation type
G4double Arb_grad[1024], Arb_cept[1024]; // grad and cept for 1024 segments
G4double Arb_alpha[1024], Arb_Const[1024]; // alpha and constants
G4double Arb_ezero[1024]; // ezero
G4double ArbEmin, ArbEmax; // Emin and Emax for the whole arb distribution
//use primarily for debug.
// Bias variables
G4bool XBias, IPDFXBias;
G4PhysicsOrderedFreeVector XBiasH;
G4PhysicsOrderedFreeVector IPDFXBiasH;
G4bool YBias, IPDFYBias;
G4PhysicsOrderedFreeVector YBiasH;
G4PhysicsOrderedFreeVector IPDFYBiasH;
G4bool ZBias, IPDFZBias;
G4PhysicsOrderedFreeVector ZBiasH;
G4PhysicsOrderedFreeVector IPDFZBiasH;
G4bool ThetaBias, IPDFThetaBias;
G4PhysicsOrderedFreeVector ThetaBiasH;
G4PhysicsOrderedFreeVector IPDFThetaBiasH;
G4bool PhiBias, IPDFPhiBias;
G4PhysicsOrderedFreeVector PhiBiasH;
G4PhysicsOrderedFreeVector IPDFPhiBiasH;
G4bool EnergyBias, IPDFEnergyBias;
G4PhysicsOrderedFreeVector EnergyBiasH;
G4PhysicsOrderedFreeVector IPDFEnergyBiasH;
G4double bweights[6], bweight; //record x,y,z,theta,phi,energy weights
// Other particle properties
G4int NumberOfParticlesToBeGenerated;
G4ParticleDefinition * particle_definition;
G4ParticleMomentum particle_momentum_direction;
G4double particle_energy;
G4double particle_charge;
G4ThreeVector particle_position;
G4double particle_time;
G4ThreeVector particle_polarization;
// Verbosity
G4int verbosityLevel;
void IntensityNormalization();
private:
G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
G4bool normalised;
G4int currentSourceIdx;
G4SingleParticleSource* currentSource;
std::vector <G4SingleParticleSource*> sourceVector;
std::vector <G4double> sourceIntensity;
std::vector <G4double>sourceProbability;
G4DataInterpolation *SplineInt; // holds Spline stuff
G4GeneralParticleSourceMessenger *theMessenger;
G4Navigator *gNavigator;
// Nucleus theIon;
G4GeneralParticleSourceMessenger* theMessenger;
};
#endif
@@ -24,23 +24,32 @@
//
// MODULE: G4GeneralParticleSourceMessenger.hh
//
// Version: 1.1
// Date: 19/10/00
// Author: C Ferguson, F Lei and P Truscott
// Organisation: University of Southampton / DERA
// Version: 2.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
// $Id: G4GeneralParticleSourceMessenger.hh,v 1.8 2002/02/26 16:34:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
//
// CHANGE HISTORY
// --------------
//
// Version 2.0, 05/02/2004, Fan Lei, Created.
// After changes to version 1.1 as in Geant4 v6.0
// - Mutilple particle source definition
// - Re-structured commands
// - old commonds have been retained for backward compatibility, will be
// removed in the future.
//
///////////////////////////////////////////////////////////////////////////////
//
//
// Class Description:
//
// The function of the G4GeneralParticleSourceMessenger is to allow the user to
// enter commands either in interactive command line mode or through macros to
// control the G4GeneralParticleSource. The G4GeneralParticleSourceMessenger
// class is based on G4ParticleGunMessenger.
// control the G4GeneralParticleSource.
//
///////////////////////////////////////////////////////////////////////////////
//
@@ -53,32 +62,22 @@
// ~G4GeneralParticleSourceMessenger()
// Destructor: Deletes commands.
//
// void SetParticleGun(G4SingleParticleSource *fpg) { fParticleGun = fpg; } ;
// To selecte the particle gun to be defined/modified.
// void SetNewValue(G4UIcommand *command, G4String newValues)
// Uses the appropriate methods in the G4GeneralParticleSource to carry out
// the user commands.
//
// G4String GetCurrentValue(G4UIcommand *command)
// Allows the user to retrieve the current values of parameters.
// Not implemented yet.
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
// Version 1.0, 28 February 2000, C Ferguson, Created.
//
// Version 1.1, 19 October 2000, Modified to inherit from G4VPrimaryGenerator.
// New name at the request of M. Asai.
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4GeneralParticleSourceMessenger_h
#define G4GeneralParticleSourceMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
//#include "UIcmdWithNucleusAndUnit.hh"
class G4ParticleTable;
class G4UIcommand;
@@ -93,14 +92,17 @@ class G4UIcmdWithADouble;
class G4UIcmdWithABool;
class G4UIcmdWithoutParameter;
class G4SingleParticleSource;
class G4GeneralParticleSource;
class G4GeneralParticleSourceMessenger: public G4UImessenger
{
public:
G4GeneralParticleSourceMessenger(G4GeneralParticleSource *fPtclGun);
G4GeneralParticleSourceMessenger(G4GeneralParticleSource*);
~G4GeneralParticleSourceMessenger();
void SetParticleGun(G4SingleParticleSource *fpg) { fParticleGun = fpg; } ;
// To selecte the particle gun to be defined/modified.
void SetNewValue(G4UIcommand *command, G4String newValues);
// Identifies the command which has been invoked by the user, extracts the
// parameters associated with that command (held in newValues), and uses
@@ -111,13 +113,42 @@ private:
void IonCommand(G4String newValues);
private:
G4GeneralParticleSource *fParticleGun;
G4GeneralParticleSource *fGPS;
G4SingleParticleSource *fParticleGun;
G4ParticleTable *particleTable;
G4String histtype;
private: //commands
G4UIdirectory *gpsDirectory;
// multiple source control commands
G4UIdirectory *sourceDirectory;
G4UIcmdWithADouble *addsourceCmd;
G4UIcmdWithoutParameter *listsourceCmd;
G4UIcmdWithoutParameter *clearsourceCmd;
G4UIcmdWithoutParameter *getsourceCmd;
G4UIcmdWithAnInteger *setsourceCmd;
G4UIcmdWithADouble *setintensityCmd;
G4UIcmdWithAnInteger *deletesourceCmd;
// positional commands
G4UIdirectory *positionDirectory;
G4UIcmdWithAString *typeCmd1;
G4UIcmdWithAString *shapeCmd1;
G4UIcmdWith3VectorAndUnit *centreCmd1;
G4UIcmdWith3Vector *posrot1Cmd1;
G4UIcmdWith3Vector *posrot2Cmd1;
G4UIcmdWithADoubleAndUnit *halfxCmd1;
G4UIcmdWithADoubleAndUnit *halfyCmd1;
G4UIcmdWithADoubleAndUnit *halfzCmd1;
G4UIcmdWithADoubleAndUnit *radiusCmd1;
G4UIcmdWithADoubleAndUnit *radius0Cmd1;
G4UIcmdWithADoubleAndUnit *possigmarCmd1;
G4UIcmdWithADoubleAndUnit *possigmaxCmd1;
G4UIcmdWithADoubleAndUnit *possigmayCmd1;
G4UIcmdWithADoubleAndUnit *paralpCmd1;
G4UIcmdWithADoubleAndUnit *partheCmd1;
G4UIcmdWithADoubleAndUnit *parphiCmd1;
G4UIcmdWithAString *confineCmd1;
//old ones, will be reomved soon
G4UIcmdWithAString *typeCmd;
G4UIcmdWithAString *shapeCmd;
G4UIcmdWith3VectorAndUnit *centreCmd;
@@ -135,7 +166,21 @@ private: //commands
G4UIcmdWithADoubleAndUnit *partheCmd;
G4UIcmdWithADoubleAndUnit *parphiCmd;
G4UIcmdWithAString *confineCmd;
// angular commands
G4UIdirectory *angularDirectory;
G4UIcmdWithAString *angtypeCmd1;
G4UIcmdWith3Vector *angrot1Cmd1;
G4UIcmdWith3Vector *angrot2Cmd1;
G4UIcmdWithADoubleAndUnit *minthetaCmd1;
G4UIcmdWithADoubleAndUnit *maxthetaCmd1;
G4UIcmdWithADoubleAndUnit *minphiCmd1;
G4UIcmdWithADoubleAndUnit *maxphiCmd1;
G4UIcmdWithADoubleAndUnit *angsigmarCmd1;
G4UIcmdWithADoubleAndUnit *angsigmaxCmd1;
G4UIcmdWithADoubleAndUnit *angsigmayCmd1;
G4UIcmdWithABool *useuserangaxisCmd1;
G4UIcmdWithABool *surfnormCmd1;
// old ones, will be removed soon
G4UIcmdWithAString *angtypeCmd;
G4UIcmdWith3Vector *angrot1Cmd;
G4UIcmdWith3Vector *angrot2Cmd;
@@ -148,7 +193,22 @@ private: //commands
G4UIcmdWithADoubleAndUnit *angsigmayCmd;
G4UIcmdWithABool *useuserangaxisCmd;
G4UIcmdWithABool *surfnormCmd;
// energy commands
G4UIdirectory *energyDirectory;
G4UIcmdWithAString *energytypeCmd1;
G4UIcmdWithADoubleAndUnit *eminCmd1;
G4UIcmdWithADoubleAndUnit *emaxCmd1;
G4UIcmdWithADoubleAndUnit *monoenergyCmd1;
G4UIcmdWithADoubleAndUnit *engsigmaCmd1;
G4UIcmdWithADouble *alphaCmd1;
G4UIcmdWithADouble *tempCmd1;
G4UIcmdWithADouble *ezeroCmd1;
G4UIcmdWithADouble *gradientCmd1;
G4UIcmdWithADouble *interceptCmd1;
G4UIcmdWithoutParameter *calculateCmd1;
G4UIcmdWithABool *energyspecCmd1;
G4UIcmdWithABool *diffspecCmd1;
// old ones, will be removed soon
G4UIcmdWithAString *energytypeCmd;
G4UIcmdWithADoubleAndUnit *eminCmd;
G4UIcmdWithADoubleAndUnit *emaxCmd;
@@ -162,24 +222,28 @@ private: //commands
G4UIcmdWithoutParameter *calculateCmd;
G4UIcmdWithABool *energyspecCmd;
G4UIcmdWithABool *diffspecCmd;
// histogram commands
G4UIdirectory *histDirectory;
G4UIcmdWith3Vector *histpointCmd;
G4UIcmdWithAString *histnameCmd;
G4UIcmdWithAString *arbintCmd;
G4UIcmdWithAString *resethistCmd;
// old ones, will be removed soon
G4UIcmdWith3Vector *histpointCmd1;
G4UIcmdWithAString *histnameCmd1;
G4UIcmdWithAString *arbintCmd1;
G4UIcmdWithAString *resethistCmd1;
//
G4UIcmdWithAnInteger *verbosityCmd;
// below are commands from G4ParticleGun
G4UIcommand *ionCmd;
G4UIcmdWithAString *particleCmd;
G4UIcmdWithADoubleAndUnit *timeCmd;
G4UIcmdWith3Vector *polCmd;
G4UIcmdWithAnInteger *numberCmd;
G4UIcmdWith3VectorAndUnit *positionCmd;
G4UIcmdWith3Vector *directionCmd;
G4UIcmdWithADoubleAndUnit *energyCmd;
+7 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HEPEvtParticle.hh,v 1.5 2001/07/13 15:01:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4HEPEvtParticle.hh,v 1.8 2004/06/11 14:11:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
@@ -75,7 +75,11 @@ class G4HEPEvtParticle
{ return JDAHEP2; }
};
extern G4Allocator<G4HEPEvtParticle> aHEPEvtParticleAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4HEPEvtParticle> aHEPEvtParticleAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4HEPEvtParticle> aHEPEvtParticleAllocator;
#endif
inline void * G4HEPEvtParticle::operator new(size_t)
{
+7 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryParticle.hh,v 1.11 2003/09/12 21:51:32 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PrimaryParticle.hh,v 1.14 2004/06/11 14:11:16 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
@@ -188,7 +188,11 @@ class G4PrimaryParticle
}
};
extern G4Allocator<G4PrimaryParticle> aPrimaryParticleAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4PrimaryParticle> aPrimaryParticleAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4PrimaryParticle> aPrimaryParticleAllocator;
#endif
inline void * G4PrimaryParticle::operator new(size_t)
{
+7 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryVertex.hh,v 1.8 2003/09/12 21:51:32 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PrimaryVertex.hh,v 1.11 2004/06/11 14:11:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
@@ -139,7 +139,11 @@ class G4PrimaryVertex
{ return userInfo; }
};
extern G4Allocator<G4PrimaryVertex> aPrimaryVertexAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4PrimaryVertex> aPrimaryVertexAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4PrimaryVertex> aPrimaryVertexAllocator;
#endif
inline void * G4PrimaryVertex::operator new(size_t)
{
@@ -0,0 +1,223 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSAngDistribution.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
// Class Description:
//
// To generate the direction of a primary vertex according to the defined distribution
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4SPSAngDistribution ()
// Constructor: Initializes variables
//
// ~G4SPSAngDistribution ()
// Destructor:
//
// void SetAngDistType(G4String)
// Used to set the type of angular distribution wanted. Arguments
// are iso, cos, beam and user for isotropic, cosine-law, beam and user-defined
// respectively.
//
// void DefineAngRefAxes(G4String, G4ThreeVector)
// DefineAngRefAxes is used in a similar way as SetPosRot to
// define vectors, one x' and one in the plane x'y', to create
// a rotated set of axes for the angular distribution.
//
// void SetMinTheta(G4double)
// Sets the minimum value for the angle theta.
//
// void SetMinPhi(G4double)
// Sets the minimum value for phi.
//
// void SetMaxTheta(G4double)
// Sets the maximum value for theta.
//
// void SetMaxPhi(G4double)
// Sets the maximum value for phi.
//
// void UserDefAngTheta(G4ThreeVector)
// This method allows the user to define a histogram in Theta.
//
// void UserDefAngPhi(G4ThreeVector)
// This method allows the user to define a histogram in phi.
//
// void GenerateIsotropicFlux()
// This method generates momentum vectors for particles according
// to an isotropic distribution.
//
// void GenerateCosineLawFlux()
// This method generates momentum vectors for particles according
// to a cosine-law distribution.
//
// void GenerateUserDefFlux()
// Controls generation of momentum vectors according to user-defined
// distributions.
//
// G4double GenerateUserDefTheta()
// Generates the theta angle according to a user-defined distribution.
//
// G4double GenerateUserDefPhi()
// Generates phi according to a user-defined distribution.
//
// void SetBeamSigmaInAngR(G4double);
// Sets the sigma for 1D beam
//
// void SetBeamSigmaInAngX(G4double);
// Sets the first sigma for 2D beam
//
// void SetBeamSigmaInAngY(G4double);
// Sets the second sigma for 2D beam
//
// void SetUserWRTSurface(G4bool)
// Allows user to have user-defined spectra either with respect to the
// co-ordinate system (default) or with respect to the surface normal.
//
// void SetPosDistribution(G4SPSPosDistribution* a) {posDist = a; };
// Sets the required position generator, required for determining the cosine-law distribution
//
// void SetBiasRndm (G4SPSRandomGenerator* a)
// Sets the biased random number generator
//
// G4ThreeVector GenerateOne();
// Generate one random direction
//
// void ReSetHist(G4String);
// Re-sets the histogram for user defined distribution
//
// void SetVerbosity(G4int)
// Sets the verbosity level.
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4SPSAngDistribution_h
#define G4SPSAngDistribution_h 1
#include "G4PhysicsOrderedFreeVector.hh"
#include "G4DataInterpolation.hh"
#include "G4ParticleMomentum.hh"
#include "G4SPSPosDistribution.hh"
#include "G4SPSRandomGenerator.hh"
class G4SPSAngDistribution
{
public:
G4SPSAngDistribution ();
~G4SPSAngDistribution ();
// Angular Distribution Methods
void SetAngDistType(G4String);
void DefineAngRefAxes(G4String, G4ThreeVector);
void SetMinTheta(G4double);
void SetMinPhi(G4double);
void SetMaxTheta(G4double);
void SetMaxPhi(G4double);
void SetBeamSigmaInAngR(G4double);
void SetBeamSigmaInAngX(G4double);
void SetBeamSigmaInAngY(G4double);
void UserDefAngTheta(G4ThreeVector);
void UserDefAngPhi(G4ThreeVector);
inline void SetParticleMomentumDirection
(G4ParticleMomentum aMomentumDirection)
{ particle_momentum_direction = aMomentumDirection.unit(); }
void SetUseUserAngAxis(G4bool);
void SetUserWRTSurface(G4bool);
//
void SetPosDistribution(G4SPSPosDistribution* a) {posDist = a; };
void SetBiasRndm(G4SPSRandomGenerator* a) {angRndm = a;};
// method to re-set the histograms
void ReSetHist(G4String);
//
// Set the verbosity level.
void SetVerbosity(G4int a) {verbosityLevel = a; } ;
//
G4ParticleMomentum GenerateOne();
private:
// These methods generate the momentum vectors for the particles.
void GenerateIsotropicFlux();
void GenerateCosineLawFlux();
void GenerateBeamFlux();
void GeneratePlanarFlux();
void GenerateUserDefFlux();
G4double GenerateUserDefTheta();
G4double GenerateUserDefPhi();
private:
// Angular distribution variables.
G4String AngDistType; // String to hold Ang dist type iso, cos, user
G4ThreeVector AngRef1, AngRef2, AngRef3; // Reference axes for ang dist
G4double MinTheta, MaxTheta, MinPhi, MaxPhi; // min/max theta/phi
G4double DR,DX,DY ; // Standard deviations for beam divergence
G4double Theta, Phi; // Store these for use with DEBUG
G4bool IPDFThetaExist, IPDFPhiExist; // tell whether IPDF histos exist
G4PhysicsOrderedFreeVector UDefThetaH; // Theta histo data
G4PhysicsOrderedFreeVector IPDFThetaH; //Cumulative Theta histogram.
G4PhysicsOrderedFreeVector UDefPhiH; // Phi histo bins
G4PhysicsOrderedFreeVector IPDFPhiH; // Cumulative phi histogram.
G4String UserDistType; //String to hold user distributions
G4bool UserWRTSurface; // G4bool to tell whether user wants distribution wrt
// surface normals or co-ordinate system
G4bool UserAngRef; // Set to true when user defines a new coordinates
//
G4ParticleMomentum particle_momentum_direction;
//
G4SPSPosDistribution* posDist; // need it here for the cosine-law distri
G4SPSRandomGenerator* angRndm; // biased random generator
// Verbosity
G4int verbosityLevel;
//
G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
};
#endif
@@ -0,0 +1,251 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSEneDistribution.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
//
// Class Description:
//
// To generate the energy of a primary vertex according to the defined distribution
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4SPSEneDistribution ()
// Constructor: Initializes variables
//
// ~G4SPSEneDistribution ()
// Destructor:
//
// void SetEnergyDisType(G4String)
// Allows the user to choose the energy distribution type. The arguments
// are Mono (mono-energetic), Lin (linear), Pow (power-law), Exp
// (exponential), Gauss (gaussian), Brem (bremsstrahlung), BBody (black-body), Cdg
// (cosmic diffuse gamma-ray), User (user-defined), Arb (arbitrary
// point-wise), Epn (energy per nucleon).
//
// void SetEmin(G4double)
// Sets the minimum energy.
//
// void SetEmax(G4double)
// Sets the maximum energy.
//
// void SetMonoEnergy(G4double)
// Sets energy for mono-energetic distribution.
//
// void SetAlpha(G4double)
// Sets alpha for a power-law distribution.
//
// void SetTemp(G4double)
// Sets Temperature for a Brem or BBody distributions.
//
// void SetEzero(G4double)
// Sets Ezero for an exponential distribution.
//
// void SetGradient(G4double)
// Sets gradient for a linear distribution.
//
// void SetInterCept(G4double)
// Sets intercept for a linear distribution.
//
// void UserEnergyHisto(G4ThreeVector)
// Allows user to defined a histogram for the energy distribution.
//
// void ArbEnergyHisto(G4ThreeVector)
// Allows the user to define an Arbitrary set of points for the
// energy distribution.
//
// void EpnEnergyHisto(G4ThreeVector)
// Allows the user to define an Energy per nucleon histogram.
//
// void Calculate()
// Controls the calculation of Integral PDF for the Cdg and BBody
// distributions.
//
// void InputEnergySpectra(G4bool)
// Allows the user to choose between momentum and energy histograms
// for user-defined histograms and arbitrary point-wise spectr.
// The default is true (energy).
//
// void InputDifferentialSpectra(G4bool)
// Allows the user to choose between integral and differential
// distributions when using the arbitrary point-wise option.
//
// void ArbInterpolate(G4String)
// ArbInterpolate allows the user to specify the type of function to
// interpolate the Arbitrary points spectrum with.
//
// void SetBiasRndm (G4SPSRandomGenerator* a)
// Sets the biased random number generator
//
// G4double GenerateOne(G4ParticleDefinition*);
// Generate one random energy for the specified particle
//
// void ReSetHist(G4String);
// Re-sets the histogram for user defined distribution
//
// void SetVerbosity(G4int)
// Sets the verbosity level.
//
///////////////////////////////////////////////////////////////////////////////
#ifndef G4SPSEneDistribution_h
#define G4SPSEneDistribution_h 1
#include "G4PhysicsOrderedFreeVector.hh"
#include "G4ParticleMomentum.hh"
#include "G4ParticleDefinition.hh"
#include "G4DataInterpolation.hh"
//
#include "G4SPSRandomGenerator.hh"
class G4SPSEneDistribution
{
public:
G4SPSEneDistribution ();
~G4SPSEneDistribution ();
void SetEnergyDisType(G4String);
inline G4String GetEnergyDisType() {return EnergyDisType;};
void SetEmin(G4double);
inline G4double GetEmin() {return Emin;} ;
inline G4double GetArbEmin() {return ArbEmin;} ;
void SetEmax(G4double);
inline G4double GetEmax() {return Emax;} ;
inline G4double GetArbEmax() {return ArbEmax;};
void SetMonoEnergy(G4double);
void SetAlpha(G4double);
void SetTemp(G4double);
void SetBeamSigmaInE(G4double);
void SetEzero(G4double);
void SetGradient(G4double);
void SetInterCept(G4double);
void UserEnergyHisto(G4ThreeVector);
void ArbEnergyHisto(G4ThreeVector);
void EpnEnergyHisto(G4ThreeVector);
void InputEnergySpectra(G4bool);
void InputDifferentialSpectra(G4bool);
void ArbInterpolate(G4String);
inline G4String GetIntType() {return IntType;};
void Calculate();
//
void SetBiasRndm(G4SPSRandomGenerator* a) {eneRndm = a; };
// method to re-set the histograms
void ReSetHist(G4String);
// Set the verbosity level.
void SetVerbosity(G4int a) {verbosityLevel = a; } ;
//x
G4double GenerateOne(G4ParticleDefinition*);
private:
void LinearInterpolation();
void LogInterpolation();
void ExpInterpolation();
void SplineInterpolation();
void CalculateCdgSpectrum();
void CalculateBbodySpectrum();
// The following methods generate energies according to the spectral
// parameters defined above.
void GenerateMonoEnergetic();
void GenerateLinearEnergies(G4bool);
void GeneratePowEnergies(G4bool);
void GenerateExpEnergies(G4bool );
void GenerateGaussEnergies();
void GenerateBremEnergies();
void GenerateBbodyEnergies();
void GenerateCdgEnergies();
void GenUserHistEnergies();
void GenEpnHistEnergies();
void GenArbPointEnergies();
// converts energy per nucleon to energy.
void ConvertEPNToEnergy();
private:
G4String EnergyDisType; // energy dis type Variable - Mono,Lin,Exp,etc
G4double MonoEnergy; //Mono-energteic energy
G4double SE ; // Standard deviation for Gaussion distrbution in energy
G4double Emin, Emax; // emin and emax
G4double alpha, Ezero, Temp; // alpha (pow), E0 (exp) and Temp (bbody,brem)
G4double grad, cept; // gradient and intercept for linear spectra
G4bool EnergySpec; // true - energy spectra, false - momentum spectra
G4bool DiffSpec; // true - differential spec, false integral spec
G4bool ApplyRig; // false no rigidity cutoff, true then apply one
G4double ERig; // energy of rigidity cutoff
G4PhysicsOrderedFreeVector UDefEnergyH; // energy hist data
G4PhysicsOrderedFreeVector IPDFEnergyH;
G4bool IPDFEnergyExist, IPDFArbExist, Epnflag;
G4PhysicsOrderedFreeVector ArbEnergyH; // Arb x,y histogram
G4PhysicsOrderedFreeVector IPDFArbEnergyH; // IPDF for Arb
G4PhysicsOrderedFreeVector EpnEnergyH;
G4double CDGhist[3]; // cumulative histo for cdg
G4double BBHist[10001], Bbody_x[10001];
G4String IntType; // Interpolation type
G4double Arb_grad[1024], Arb_cept[1024]; // grad and cept for 1024 segments
G4double Arb_alpha[1024], Arb_Const[1024]; // alpha and constants
G4double Arb_ezero[1024]; // ezero
G4double ArbEmin, ArbEmax; // Emin and Emax for the whole arb distribution used primarily for debug.
G4double particle_energy;
G4ParticleDefinition* particle_definition;
G4SPSRandomGenerator* eneRndm;
// Verbosity
G4int verbosityLevel;
G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
G4DataInterpolation *SplineInt; // holds Spline stuff
};
#endif
@@ -0,0 +1,218 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSPosDistribution.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
//
// Class Description:
//
// To generate the position of a primary vertex according to the defined distribution
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4SPSPosDistribution ()
// Constructor: Initializes variables and instantiates the Navigator class
//
// ~G4SPSPosDistribution ()
// Destructor:
//
// void SetPosDisType(G4String)
// Allows user to choose Point, Plane, Surface or Volume source
// position distributions.
//
// void SetPosDisShape(G4String)
// Allows the user to choose the particular shape they wish for the
// position distribution. Choices are Square, Circle, Ellipse, Rectangle,
// Sphere, Ellipsoid, Cylinder, Parallelepiped.
//
// void SetCentreCoords(G4ThreeVector)
// Sets the co-ordinates of the centre of the position distribution.
//
// void SetPosRot1(G4ThreeVector)
// Used to specify the co-ordinate system for the position distribution
// along with SetPosRot2. SetPosRot1 sets the vector x' and need not be
// a unit vector.
//
// void SetPosRot2(G4ThreeVector)
// Used in connection with SetPosRot1. This sets a vector in the plane
// x'y'. By a series of cross products x', y', z' are generated. Again
// need not be a unit vector.
//
// void SetHalfX(G4double)
// Sets the half length in x.
//
// void SetHalfY(G4double)
// Sets the half length in y.
//
// void SetHalfZ(G4double)
// Sets the half length in z.
//
// void SetRadius(G4double)
// Sets the radius where appropriate for source distribution shapes.
//
// void SetRadius0(G4double)
// Sets the inner radius where appropriate for source distribution shapes.
//
// void SetBeamSigmaInR(G4double);
// Sets the sigma for 1D beam
//
// void SetBeamSigmaInX(G4double);
// Sets the first sigma for 2D beam
//
// void SetBeamSigmaInY(G4double);
// Sets the second sigma for 2D beam
//
// void SetParAlpha(G4double)
// Sets the angle Alpha in the Parallelepiped shapes.
//
// void SetParTheta(G4double)
// Sets the angle Theta in the Parallelepiped shapes.
//
// void SetParPhi(G4double)
// Sets the angle Phi in the Parallelepiped shapes.
//
// void ConfineSourceToVolume(G4String)
// Used to confine the start positions to a particular volume.
//
// void SetBiasRndm (G4SPSRandomGenerator* a) { posRndm = a ; };
// Sets the biased random number generator
//
// G4ThreeVector GenerateOne();
// Generate one random position
//
// void SetVerbosity(G4int)
// Sets the verbosity level.
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4SPSPosDistribution_h
#define G4SPSPosDistribution_h 1
#include "G4Navigator.hh"
#include "G4SPSRandomGenerator.hh"
class G4SPSPosDistribution
{
//
friend class G4SPSAngDistribution;
public:
G4SPSPosDistribution ();
~G4SPSPosDistribution ();
// methods to create source position dist.
void SetPosDisType(G4String); // Point, Plane, Surface, Volume
inline G4String GetPosDisType() { return SourcePosType; };
void SetPosDisShape(G4String);
inline G4String GetPosDisShape() { return Shape; };
// SetPosDisShape - Square, Circle, Annulus, Ellipse, Rectangle, Sphere,
// Ellipsoid, Cylinder, Right (parallelepiped).
void SetCentreCoords(G4ThreeVector);
inline G4ThreeVector GetCentreCoords() { return CentreCoords; } ;
void SetPosRot1(G4ThreeVector);
void SetPosRot2(G4ThreeVector);
void SetHalfX(G4double);
inline G4double GetHalfX() { return halfx; } ;
void SetHalfY(G4double);
inline G4double GetHalfY() { return halfy; } ;
void SetHalfZ(G4double);
inline G4double GetHalfZ() { return halfz; } ;
void SetRadius(G4double);
inline G4double GetRadius() { return Radius; };
void SetRadius0(G4double);
void SetBeamSigmaInR(G4double);
void SetBeamSigmaInX(G4double);
void SetBeamSigmaInY(G4double);
void SetParAlpha(G4double);
void SetParTheta(G4double);
void SetParPhi(G4double);
void ConfineSourceToVolume(G4String);
//
void SetBiasRndm (G4SPSRandomGenerator* a) { posRndm = a ; };
// Set the verbosity level.
void SetVerbosity(G4int a) {verbosityLevel = a; } ;
//
G4ThreeVector GenerateOne();
private:
void GenerateRotationMatrices();
// the following routines generate the source position
void GeneratePointSource();
void GeneratePointsInBeam();
void GeneratePointsInPlane();
void GeneratePointsOnSurface();
void GeneratePointsInVolume();
G4bool IsSourceConfined();
private:
// Position distribution Variables
G4String SourcePosType; //Point,Plane,Surface,Volume
G4String Shape; //Circle,Square,Rectangle etc..
G4double halfx, halfy, halfz; //half lengths
G4double Radius; //Radius for circles or spheres
G4double Radius0; // The inner radius of an annulus
G4double SR,SX,SY; // Standard deviation in raduial, x, y for beam type source
G4ThreeVector CentreCoords; // Coords of centre of input shape
G4ThreeVector Rotx, Roty, Rotz; // Unit vectors defining rotation matrix
G4double ParAlpha, ParTheta, ParPhi; //Angle for Right Parallellepipeds
G4bool Confine; //If true confines source distribution to VolName
G4String VolName;
G4ThreeVector SideRefVec1,SideRefVec2,SideRefVec3; //Side rotation matrices
G4ThreeVector particle_position; // the final particle position to be returned
//
G4Navigator *gNavigator;
//
G4SPSRandomGenerator* posRndm; // biased random generator
// Verbosity
G4int verbosityLevel;
};
#endif
@@ -0,0 +1,187 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSRandomGenerator.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
// Class Description:
//
// Special random number generator used by G4GeneralParticleSource to allow
// biasing applied at the lowest level for all distributions.
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4SPSRandomGenerator ()
// Constructor: Initializes variables
//
// ~G4SPSRandomGenerator ()
// Destructor:
//
// void SetXBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate x co-ordinates.
//
// void SetYBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate y co-ordinates.
//
// void SetZBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate z co-ordinates.
//
// void SetThetaBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate values of theta.
//
// void SetPhiBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate values of phi.
//
// void SetEnergyBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate the energies.
//
// G4double GenRandX()
// Generates the random number for x, with or without biasing.
//
// G4double GenRandY()
// Generates the random number for y, with or without biasing.
//
// G4double GenRandZ()
// Generates the random number for z, with or without biasing.
//
// G4double GenRandTheta()
// Generates the random number for theta, with or without biasing.
//
// G4double GenRandPhi()
// Generates the random number for phi, with or without biasing.
//
// G4double GenRandEnergy()
// Generates the random number for energy, with or without biasing.
//
// inline G4double GetBiasWeight()
// Returns the weight change after biasing
//
// void ReSetHist(G4String);
// Re-sets the histogram for user defined distribution
//
// void SetVerbosity(G4int)
// Sets the verbosity level.
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4SPSRandomGenerator_h
#define G4SPSRandomGenerator_h 1
#include "G4PhysicsOrderedFreeVector.hh"
#include "G4DataInterpolation.hh"
class G4SPSRandomGenerator
{
public:
G4SPSRandomGenerator ();
~G4SPSRandomGenerator ();
// static G4SPSRandomGenerator* getInstance ();
// Biasing Methods
void SetXBias(G4ThreeVector);
void SetYBias(G4ThreeVector);
void SetZBias(G4ThreeVector);
void SetThetaBias(G4ThreeVector);
void SetPhiBias(G4ThreeVector);
void SetEnergyBias(G4ThreeVector);
G4double GenRandX();
G4double GenRandY();
G4double GenRandZ();
G4double GenRandTheta();
G4double GenRandPhi();
G4double GenRandEnergy();
inline G4double GetBiasWeight()
{ return bweights[0]*bweights[1]*bweights[2]*bweights[3]*bweights[4]*bweights[5];};
// method to re-set the histograms
void ReSetHist(G4String);
// Set the verbosity level.
void SetVerbosity(G4int a) {verbosityLevel = a; } ;
private:
// static G4SPSRandomGenerator *instance;
G4bool XBias, IPDFXBias;
G4PhysicsOrderedFreeVector XBiasH;
G4PhysicsOrderedFreeVector IPDFXBiasH;
G4bool YBias, IPDFYBias;
G4PhysicsOrderedFreeVector YBiasH;
G4PhysicsOrderedFreeVector IPDFYBiasH;
G4bool ZBias, IPDFZBias;
G4PhysicsOrderedFreeVector ZBiasH;
G4PhysicsOrderedFreeVector IPDFZBiasH;
G4bool ThetaBias, IPDFThetaBias;
G4PhysicsOrderedFreeVector ThetaBiasH;
G4PhysicsOrderedFreeVector IPDFThetaBiasH;
G4bool PhiBias, IPDFPhiBias;
G4PhysicsOrderedFreeVector PhiBiasH;
G4PhysicsOrderedFreeVector IPDFPhiBiasH;
G4bool EnergyBias, IPDFEnergyBias;
G4PhysicsOrderedFreeVector EnergyBiasH;
G4PhysicsOrderedFreeVector IPDFEnergyBiasH;
G4double bweights[6]; //record x,y,z,theta,phi,energy weights
// Verbosity
G4int verbosityLevel;
G4PhysicsOrderedFreeVector ZeroPhysVector ; // for re-set only
};
#endif
@@ -0,0 +1,184 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SingleParticleSource.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
// Class Description:
//
// The Single Particle Source is designed to extend the functionality of the
// G4ParticleGun class. It is designed to allow specification of input
// particles in terms of position, direction (or angular) and energy
// distributions. It is used by the General Particle source class
// and it is derived from G4VPrimaryGenerator.
//
///////////////////////////////////////////////////////////////////////////////
//
// MEMBER FUNCTIONS
// ----------------
//
// G4SingleParticleSource ()
// Constructor: Initializes variables and instantiates the
// Messenger and Navigator classes
//
// ~G4SingleParticleSource ()
// Destructor: deletes Messenger and prints out run information.
//
// void GeneratePrimaryVertex(G4Event *evt)
// Generate the particles initial parameters.
//
// G4SPSPosDistribution* GetPosDist()
// Return a pointer to the position distribution generator
//
// G4SPSAngDistribution* GetAngDist()
// Return a pointer to the angular distribution generator
//
// G4SPSEneDistribution* GetEneDist()
// Return a pointer to the energy distribution generator
//
// G4SPSRandomGenerator* GetBiasRndm() {return biasRndm;};
// Return a pointer to the biased random number generator
//
// void SetVerbosity(G4int);
// Set the verbosity level.
//
// void SetParticleDefinition ();
// G4ParticleDefinition * GetParticleDefinition ()
// Get/Set the particle definition of the primary track
//
// void SetParticleCharge(G4double aCharge)
// set the charge state of the primary track
//
// inline void SetParticlePolarization (G4ThreeVector aVal)
// inline G4ThreeVector GetParticlePolarization ()
// Set/Get the polarization state of the primary track
//
// inline void SetParticleTime(G4double aTime) { particle_time = aTime; };
// inline G4double GetParticleTime() { return particle_time; };
// Set/Get the Time.
//
// inline void SetNumberOfParticles(G4int i)
// inline G4int GetNumberOfParticles()
// set/get the number of particles to be generated in the primary track
//
// inline G4ThreeVector GetParticlePosition()
// inline G4ThreeVector GetParticleMomentumDirection()
// inline G4double GetParticleEnergy()
// get the position, direction, and energy of the current particle
//
///////////////////////////////////////////////////////////////////////////////
//
#ifndef G4SingleParticleSource_h
#define G4SingleParticleSource_h 1
#include "G4VPrimaryGenerator.hh"
#include "G4ParticleMomentum.hh"
#include "G4ParticleDefinition.hh"
//
#include "G4SPSPosDistribution.hh"
#include "G4SPSAngDistribution.hh"
#include "G4SPSEneDistribution.hh"
#include "G4SPSRandomGenerator.hh"
class G4SingleParticleSource : public G4VPrimaryGenerator
{
public:
G4SingleParticleSource ();
~G4SingleParticleSource ();
void GeneratePrimaryVertex(G4Event *evt);
//
G4SPSPosDistribution* GetPosDist() {return posGenerator;};
G4SPSAngDistribution* GetAngDist() {return angGenerator;};
G4SPSEneDistribution* GetEneDist() {return eneGenerator;};
G4SPSRandomGenerator* GetBiasRndm() {return biasRndm;};
// Set the verbosity level.
void SetVerbosity(G4int);
// Set the particle species
void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition);
inline G4ParticleDefinition * GetParticleDefinition () { return particle_definition;} ;
inline void SetParticleCharge(G4double aCharge) { particle_charge = aCharge; } ;
// Set polarization
inline void SetParticlePolarization (G4ThreeVector aVal) {particle_polarization = aVal;};
inline G4ThreeVector GetParticlePolarization () {return particle_polarization;};
// Set Time.
inline void SetParticleTime(G4double aTime) { particle_time = aTime; };
inline G4double GetParticleTime() { return particle_time; };
inline void SetNumberOfParticles(G4int i) { NumberOfParticlesToBeGenerated = i; };
//
inline G4int GetNumberOfParticles() { return NumberOfParticlesToBeGenerated; };
inline G4ThreeVector GetParticlePosition() { return particle_position;};
inline G4ThreeVector GetParticleMomentumDirection() { return particle_momentum_direction;};
inline G4double GetParticleEnergy() {return particle_energy;};
private:
G4SPSPosDistribution* posGenerator;
G4SPSAngDistribution* angGenerator;
G4SPSEneDistribution* eneGenerator;
G4SPSRandomGenerator* biasRndm;
//
// Other particle properties
G4int NumberOfParticlesToBeGenerated;
G4ParticleDefinition * particle_definition;
G4ParticleMomentum particle_momentum_direction;
G4double particle_energy;
G4double particle_charge;
G4ThreeVector particle_position;
G4double particle_time;
G4ThreeVector particle_polarization;
G4double particle_weight;
// Verbosity
G4int verbosityLevel;
};
#endif
+7 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StackedTrack.hh,v 1.6 2001/07/13 15:01:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4StackedTrack.hh,v 1.9 2004/06/11 14:11:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// Last Modification : 02/Feb/96 M.Asai
@@ -83,7 +83,11 @@ class G4StackedTrack
{ nextStackedTrack = value; }
};
extern G4Allocator<G4StackedTrack> aStackedTrackAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4StackedTrack> aStackedTrackAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4StackedTrack> aStackedTrackAllocator;
#endif
inline void * G4StackedTrack::operator new(size_t)
{
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TrajectoryContainer.hh,v 1.11 2003/06/16 16:50:31 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4TrajectoryContainer.hh,v 1.14 2004/06/11 14:11:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// G4TrajectoryContainer
@@ -73,8 +73,11 @@ class G4TrajectoryContainer
TrajectoryVector* vect;
};
extern G4Allocator<G4TrajectoryContainer> aTrajectoryContainerAllocator;
#if defined G4EVENT_ALLOC_EXPORT
extern G4DLLEXPORT G4Allocator<G4TrajectoryContainer> aTrajectoryContainerAllocator;
#else
extern G4DLLIMPORT G4Allocator<G4TrajectoryContainer> aTrajectoryContainerAllocator;
#endif
inline void* G4TrajectoryContainer::operator new(size_t)
{
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Event.cc,v 1.6 2003/09/09 20:09:18 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4Event.cc,v 1.8 2004/06/11 14:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// G4Event
+6 -4
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EventManager.cc,v 1.19 2004/03/16 00:04:30 asaim Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4EventManager.cc,v 1.20 2004/05/26 17:08:33 asaim Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
//
@@ -46,7 +46,7 @@ G4EventManager* G4EventManager::GetEventManager()
G4EventManager::G4EventManager()
:currentEvent(0),trajectoryContainer(0),
verboseLevel(0),tracking(false)
verboseLevel(0),tracking(false),abortRequested(false)
{
if(fpEventManager)
{
@@ -145,7 +145,8 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
}
#endif
StackTracks( transformer->GimmePrimaries( currentEvent, trackIDCounter ),true );
if(!abortRequested)
{ StackTracks( transformer->GimmePrimaries( currentEvent, trackIDCounter ),true ); }
#ifdef G4VERBOSE
if ( verboseLevel > 0 )
@@ -252,6 +253,7 @@ void G4EventManager::DoProcessing(G4Event* anEvent)
currentEvent = 0;
stateManager->SetNewState(G4State_GeomClosed);
abortRequested = false;
}
void G4EventManager::StackTracks(G4TrackVector *trackVector,G4bool IDhasAlreadySet)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4HEPEvtParticle.cc,v 1.5 2003/05/21 20:52:53 asaim Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4HEPEvtParticle.cc,v 1.7 2004/06/11 14:11:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryParticle.cc,v 1.11 2003/09/12 21:51:34 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PrimaryParticle.cc,v 1.13 2004/06/11 14:11:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4PrimaryParticle.hh"
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryVertex.cc,v 1.7 2003/09/12 21:51:34 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PrimaryVertex.cc,v 1.9 2004/06/11 14:11:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4PrimaryVertex.hh"
+607
View File
@@ -0,0 +1,607 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSAngDistribution.cc
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
#include "Randomize.hh"
//#include <math.h>
#include "G4SPSAngDistribution.hh"
G4SPSAngDistribution::G4SPSAngDistribution()
{
// Angular distribution Variables
G4ThreeVector zero;
particle_momentum_direction = G4ParticleMomentum(0,0,-1);
AngDistType = "planar";
AngRef1 = HepXHat;
AngRef2 = HepYHat;
AngRef3 = HepZHat;
MinTheta = 0.;
MaxTheta = pi;
MinPhi = 0.;
MaxPhi = twopi;
DR = 0.;
DX = 0.;
DY = 0.;
UserDistType = "NULL";
UserWRTSurface = true;
UserAngRef = false;
IPDFThetaExist = false;
IPDFPhiExist = false;
verbosityLevel = 0 ;
}
G4SPSAngDistribution::~G4SPSAngDistribution()
{}
//
void G4SPSAngDistribution::SetAngDistType(G4String atype)
{
if(atype != "iso" && atype != "cos" && atype != "user" && atype != "planar"
&& atype != "beam1d" && atype != "beam2d")
G4cout << "Error, distribution must be iso, cos, planar, beam1d, beam2d or user" << G4endl;
else
AngDistType = atype;
if (AngDistType == "cos") MaxTheta = pi/2. ;
if (AngDistType == "user") {
UDefThetaH = IPDFThetaH = ZeroPhysVector ;
IPDFThetaExist = false ;
UDefPhiH = IPDFPhiH = ZeroPhysVector ;
IPDFPhiExist = false ;
}
}
void G4SPSAngDistribution::DefineAngRefAxes(G4String refname, G4ThreeVector ref)
{
if(refname == "angref1")
AngRef1 = ref.unit(); // x'
else if(refname == "angref2")
AngRef2 = ref.unit(); // vector in x'y' plane
// User defines x' (AngRef1) and a vector in the x'y'
// plane (AngRef2). Then, AngRef1 x AngRef2 = AngRef3
// the z' vector. Then, AngRef3 x AngRef1 = AngRef2
// which will now be y'.
AngRef3 = AngRef1.cross(AngRef2); // z'
AngRef2 = AngRef3.cross(AngRef1); // y'
UserAngRef = true ;
if(verbosityLevel == 2)
{
G4cout << "Angular distribution rotation axes " << AngRef1 << " " << AngRef2 << " " << AngRef3 << G4endl;
}
}
void G4SPSAngDistribution::SetMinTheta(G4double mint)
{
MinTheta = mint;
}
void G4SPSAngDistribution::SetMinPhi(G4double minp)
{
MinPhi = minp;
}
void G4SPSAngDistribution::SetMaxTheta(G4double maxt)
{
MaxTheta = maxt;
}
void G4SPSAngDistribution::SetMaxPhi(G4double maxp)
{
MaxPhi = maxp;
}
void G4SPSAngDistribution::SetBeamSigmaInAngR(G4double r)
{
DR = r;
}
void G4SPSAngDistribution::SetBeamSigmaInAngX(G4double r)
{
DX = r;
}
void G4SPSAngDistribution::SetBeamSigmaInAngY(G4double r)
{
DY = r;
}
void G4SPSAngDistribution::UserDefAngTheta(G4ThreeVector input)
{
if(UserDistType == "NULL") UserDistType = "theta";
if(UserDistType == "phi") UserDistType = "both";
G4double thi, val;
thi = input.x();
val = input.y();
if(verbosityLevel >= 1)
G4cout << "In UserDefAngTheta" << G4endl;
UDefThetaH.InsertValues(thi, val);
}
void G4SPSAngDistribution::UserDefAngPhi(G4ThreeVector input)
{
if(UserDistType == "NULL") UserDistType = "phi";
if(UserDistType == "theta") UserDistType = "both";
G4double phhi, val;
phhi = input.x();
val = input.y();
if(verbosityLevel >= 1)
G4cout << "In UserDefAngPhi" << G4endl;
UDefPhiH.InsertValues(phhi, val);
}
void G4SPSAngDistribution::SetUserWRTSurface(G4bool wrtSurf)
{
// This is only applied in user mode?
// if UserWRTSurface = true then the user wants momenta with respect
// to the surface normals.
// When doing this theta has to be 0-90 only otherwise there will be
// errors, which currently are flagged anywhere.
UserWRTSurface = wrtSurf;
}
void G4SPSAngDistribution::SetUseUserAngAxis(G4bool userang)
{
// if UserAngRef = true the angular distribution is defined wrt
// the user defined co-ordinates
UserAngRef = userang;
}
void G4SPSAngDistribution::GenerateBeamFlux()
{
G4double theta, phi;
G4double px, py, pz;
if (AngDistType == "beam1d")
{
theta = G4RandGauss::shoot(0.0,DR);
phi = twopi * G4UniformRand();
}
else
{
px = G4RandGauss::shoot(0.0,DX);
py = G4RandGauss::shoot(0.0,DY);
theta = sqrt (px*px + py*py);
if (theta != 0.) {
phi = acos(px/theta);
if ( py < 0.) phi = -phi;
}
else
{
phi = 0.0;
}
}
px = -sin(theta) * cos(phi);
py = -sin(theta) * sin(phi);
pz = -cos(theta);
G4double finx, finy, finz ;
finx = px, finy =py, finz =pz;
if (UserAngRef){
// Apply Angular Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
}
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
particle_momentum_direction.setZ(finz);
// particle_momentum_direction now holds unit momentum vector.
if(verbosityLevel >= 1)
G4cout << "Generating beam vector: " << particle_momentum_direction << G4endl;
}
void G4SPSAngDistribution::GenerateIsotropicFlux()
{
// generates isotropic flux.
// No vectors are needed.
G4double rndm, rndm2;
G4double px, py, pz;
//
G4double sintheta, sinphi,costheta,cosphi;
rndm = angRndm->GenRandTheta();
costheta = cos(MinTheta) - rndm * (cos(MinTheta) - cos(MaxTheta));
sintheta = sqrt(1. - costheta*costheta);
rndm2 = angRndm->GenRandPhi();
Phi = MinPhi + (MaxPhi - MinPhi) * rndm2;
sinphi = sin(Phi);
cosphi = cos(Phi);
px = -sintheta * cosphi;
py = -sintheta * sinphi;
pz = -costheta;
// for volume and ponit source use mother or user defined co-ordinates
// for plane and surface source user surface-normal or userdefined co-ordinates
//
G4double finx, finy, finz;
if (posDist->SourcePosType == "Point" || posDist->SourcePosType == "Volume") {
if (UserAngRef){
// Apply Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = px;
finy = py;
finz = pz;
}
} else { // for plane and surface source
if (UserAngRef){
// Apply Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = (px*posDist->SideRefVec1.x()) + (py*posDist->SideRefVec2.x()) + (pz*posDist->SideRefVec3.x());
finy = (px*posDist->SideRefVec1.y()) + (py*posDist->SideRefVec2.y()) + (pz*posDist->SideRefVec3.y());
finz = (px*posDist->SideRefVec1.z()) + (py*posDist->SideRefVec2.z()) + (pz*posDist->SideRefVec3.z());
}
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
particle_momentum_direction.setZ(finz);
// particle_momentum_direction now holds unit momentum vector.
if(verbosityLevel >= 1)
G4cout << "Generating isotropic vector: " << particle_momentum_direction << G4endl;
}
void G4SPSAngDistribution::GenerateCosineLawFlux()
{
// Method to generate flux distributed with a cosine law
G4double px, py, pz;
G4double rndm, rndm2;
//
G4double sintheta, sinphi,costheta,cosphi;
rndm = angRndm->GenRandTheta();
sintheta = sqrt( rndm * (sin(MaxTheta)*sin(MaxTheta) - sin(MinTheta)*sin(MinTheta) )
+sin(MinTheta)*sin(MinTheta) );
costheta = sqrt(1. -sintheta*sintheta);
rndm2 = angRndm->GenRandPhi();
Phi = MinPhi + (MaxPhi - MinPhi) * rndm2;
sinphi = sin(Phi);
cosphi = cos(Phi);
px = -sintheta * cosphi;
py = -sintheta * sinphi;
pz = -costheta;
// for volume and ponit source use mother or user defined co-ordinates
// for plane and surface source user surface-normal or userdefined co-ordinates
//
G4double finx, finy, finz;
if (posDist->SourcePosType == "Point" || posDist->SourcePosType == "Volume") {
if (UserAngRef){
// Apply Rotation Matrix
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = px;
finy = py;
finz = pz;
}
} else { // for plane and surface source
if (UserAngRef){
// Apply Rotation Matrix
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else {
finx = (px*posDist->SideRefVec1.x()) + (py*posDist->SideRefVec2.x()) + (pz*posDist->SideRefVec3.x());
finy = (px*posDist->SideRefVec1.y()) + (py*posDist->SideRefVec2.y()) + (pz*posDist->SideRefVec3.y());
finz = (px*posDist->SideRefVec1.z()) + (py*posDist->SideRefVec2.z()) + (pz*posDist->SideRefVec3.z());
}
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
particle_momentum_direction.setZ(finz);
// particle_momentum_direction now contains unit momentum vector.
if(verbosityLevel >= 1)
{
G4cout << "Resultant cosine-law unit momentum vector " << particle_momentum_direction << G4endl;
}
}
void G4SPSAngDistribution::GeneratePlanarFlux()
{
// particle_momentum_direction now contains unit momentum vector.
// nothing need be done here as the m-directions have been set directly
// under this option
if(verbosityLevel >= 1)
{
G4cout << "Resultant Planar wave momentum vector " << particle_momentum_direction << G4endl;
}
}
void G4SPSAngDistribution::GenerateUserDefFlux()
{
G4double rndm, px, py, pz, pmag;
if(UserDistType == "NULL")
G4cout << "Error: UserDistType undefined" << G4endl;
else if(UserDistType == "theta") {
Theta = 10.;
while(Theta > MaxTheta || Theta < MinTheta)
Theta = GenerateUserDefTheta();
Phi = 10.;
while(Phi > MaxPhi || Phi < MinPhi) {
rndm = angRndm->GenRandPhi();
Phi = twopi * rndm;
}
}
else if(UserDistType == "phi") {
Theta = 10.;
while(Theta > MaxTheta || Theta < MinTheta)
{
rndm = angRndm->GenRandTheta();
Theta = acos(1. - (2. * rndm));
}
Phi = 10.;
while(Phi > MaxPhi || Phi < MinPhi)
Phi = GenerateUserDefPhi();
}
else if(UserDistType == "both")
{
Theta = 10.;
while(Theta > MaxTheta || Theta < MinTheta)
Theta = GenerateUserDefTheta();
Phi = 10.;
while(Phi > MaxPhi || Phi < MinPhi)
Phi = GenerateUserDefPhi();
}
px = -sin(Theta) * cos(Phi);
py = -sin(Theta) * sin(Phi);
pz = -cos(Theta);
pmag = sqrt((px*px) + (py*py) + (pz*pz));
if(!UserWRTSurface) {
G4double finx, finy, finz;
if (UserAngRef) {
// Apply Rotation Matrix
// x * AngRef1, y * AngRef2 and z * AngRef3
finx = (px * AngRef1.x()) + (py * AngRef2.x()) + (pz * AngRef3.x());
finy = (px * AngRef1.y()) + (py * AngRef2.y()) + (pz * AngRef3.y());
finz = (px * AngRef1.z()) + (py * AngRef2.z()) + (pz * AngRef3.z());
} else { // use mother co-ordinates
finx = px;
finy = py;
finz = pz;
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
particle_momentum_direction.setX(finx);
particle_momentum_direction.setY(finy);
particle_momentum_direction.setZ(finz);
}
else { // UserWRTSurface = true
G4double pxh = px/pmag;
G4double pyh = py/pmag;
G4double pzh = pz/pmag;
if(verbosityLevel > 1) {
G4cout <<"SideRefVecs " <<posDist->SideRefVec1<<posDist->SideRefVec2<<posDist->SideRefVec3<<G4endl;
G4cout <<"Raw Unit vector "<<pxh<<","<<pyh<<","<<pzh<<G4endl;
}
G4double resultx = (pxh*posDist->SideRefVec1.x()) + (pyh*posDist->SideRefVec2.x()) +
(pzh*posDist->SideRefVec3.x());
G4double resulty = (pxh*posDist->SideRefVec1.y()) + (pyh*posDist->SideRefVec2.y()) +
(pzh*posDist->SideRefVec3.y());
G4double resultz = (pxh*posDist->SideRefVec1.z()) + (pyh*posDist->SideRefVec2.z()) +
(pzh*posDist->SideRefVec3.z());
G4double ResMag = sqrt((resultx*resultx) + (resulty*resulty) + (resultz*resultz));
resultx = resultx/ResMag;
resulty = resulty/ResMag;
resultz = resultz/ResMag;
particle_momentum_direction.setX(resultx);
particle_momentum_direction.setY(resulty);
particle_momentum_direction.setZ(resultz);
}
// particle_momentum_direction now contains unit momentum vector.
if(verbosityLevel > 0 )
{
G4cout << "Final User Defined momentum vector " << particle_momentum_direction << G4endl;
}
}
G4double G4SPSAngDistribution::GenerateUserDefTheta()
{
// Create cumulative histogram if not already done so. Then use RandFlat
//::shoot to generate the output Theta value.
if(UserDistType == "NULL" || UserDistType == "phi")
{
// No user defined theta distribution
G4cout << "Error ***********************" << G4endl;
G4cout << "UserDistType = " << UserDistType << G4endl;
return (0.);
}
else
{
// UserDistType = theta or both and so a theta distribution
// is defined. This should be integrated if not already done.
if(IPDFThetaExist == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(UDefThetaH.GetVectorLength());
bins[0] = UDefThetaH.GetLowEdgeEnergy(size_t(0));
vals[0] = UDefThetaH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = UDefThetaH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = UDefThetaH(size_t(ii)) + vals[ii-1];
sum = sum + UDefThetaH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFThetaH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFThetaExist = true
IPDFThetaExist = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
return(IPDFThetaH.GetEnergy(rndm));
}
}
G4double G4SPSAngDistribution::GenerateUserDefPhi()
{
// Create cumulative histogram if not already done so. Then use RandFlat
//::shoot to generate the output Theta value.
if(UserDistType == "NULL" || UserDistType == "theta")
{
// No user defined phi distribution
G4cout << "Error ***********************" << G4endl;
G4cout << "UserDistType = " << UserDistType << G4endl;
return(0.);
}
else
{
// UserDistType = phi or both and so a phi distribution
// is defined. This should be integrated if not already done.
if(IPDFPhiExist == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(UDefPhiH.GetVectorLength());
bins[0] = UDefPhiH.GetLowEdgeEnergy(size_t(0));
vals[0] = UDefPhiH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = UDefPhiH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = UDefPhiH(size_t(ii)) + vals[ii-1];
sum = sum + UDefPhiH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFPhiH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFPhiExist = true
IPDFPhiExist = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
return(IPDFPhiH.GetEnergy(rndm));
}
}
//
void G4SPSAngDistribution::ReSetHist(G4String atype)
{
if (atype == "theta") {
UDefThetaH = IPDFThetaH = ZeroPhysVector ;
IPDFThetaExist = false ;}
else if (atype == "phi"){
UDefPhiH = IPDFPhiH = ZeroPhysVector ;
IPDFPhiExist = false ;}
else {
G4cout << "Error, histtype not accepted " << G4endl;
}
}
G4ParticleMomentum G4SPSAngDistribution::GenerateOne()
{
// Angular stuff
if(AngDistType == "iso")
GenerateIsotropicFlux();
else if(AngDistType == "cos")
GenerateCosineLawFlux();
else if(AngDistType == "planar")
GeneratePlanarFlux();
else if(AngDistType == "beam1d" || AngDistType == "beam2d" )
GenerateBeamFlux();
else if(AngDistType == "user")
GenerateUserDefFlux();
else
G4cout << "Error: AngDistType has unusual value" << G4endl;
return particle_momentum_direction;
}
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+565
View File
@@ -0,0 +1,565 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SPSRandomGenerator.cc
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
#include "G4PrimaryParticle.hh"
#include "G4Event.hh"
#include "Randomize.hh"
#include <math.h>
#include "G4TransportationManager.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4IonTable.hh"
#include "G4Ions.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
#include "G4SPSRandomGenerator.hh"
//G4SPSRandomGenerator* G4SPSRandomGenerator::instance = 0;
G4SPSRandomGenerator::G4SPSRandomGenerator()
{
// Initialise all variables
// Bias variables
XBias = false;
IPDFXBias = false;
YBias = false;
IPDFYBias = false;
ZBias = false;
IPDFZBias = false;
ThetaBias = false;
IPDFThetaBias = false;
PhiBias = false;
IPDFPhiBias = false;
EnergyBias = false;
IPDFEnergyBias = false;
bweights[0] = bweights[1] = bweights[2] = bweights[3] = bweights[4] = bweights[5] = 1. ;
verbosityLevel = 0 ;
}
G4SPSRandomGenerator::~G4SPSRandomGenerator()
{}
//G4SPSRandomGenerator* G4SPSRandomGenerator::getInstance ()
//{
// if (instance == 0) instance = new G4SPSRandomGenerator();
// return instance;
//}
// Biasing methods
void G4SPSRandomGenerator::SetXBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
XBiasH.InsertValues(ehi, val);
XBias = true;
}
void G4SPSRandomGenerator::SetYBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
YBiasH.InsertValues(ehi, val);
YBias = true;
}
void G4SPSRandomGenerator::SetZBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
ZBiasH.InsertValues(ehi, val);
ZBias = true;
}
void G4SPSRandomGenerator::SetThetaBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
ThetaBiasH.InsertValues(ehi, val);
ThetaBias = true;
}
void G4SPSRandomGenerator::SetPhiBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
PhiBiasH.InsertValues(ehi, val);
PhiBias = true;
}
void G4SPSRandomGenerator::SetEnergyBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
EnergyBiasH.InsertValues(ehi, val);
EnergyBias = true;
}
void G4SPSRandomGenerator::ReSetHist(G4String atype)
{
if ( atype == "biasx") {
XBias = false ;
IPDFXBias = false;
XBiasH = IPDFXBiasH = ZeroPhysVector ;}
else if ( atype == "biasy") {
YBias = false ;
IPDFYBias = false;
YBiasH = IPDFYBiasH = ZeroPhysVector ;}
else if ( atype == "biasz") {
ZBias = false ;
IPDFZBias = false;
ZBiasH = IPDFZBiasH = ZeroPhysVector ;}
else if ( atype == "biast") {
ThetaBias = false ;
IPDFThetaBias = false;
ThetaBiasH = IPDFThetaBiasH = ZeroPhysVector ;}
else if ( atype == "biasp") {
PhiBias = false ;
IPDFPhiBias = false;
PhiBiasH = IPDFPhiBiasH = ZeroPhysVector ;}
else if ( atype == "biase") {
EnergyBias = false ;
IPDFEnergyBias = false;
EnergyBiasH = IPDFEnergyBiasH = ZeroPhysVector ;}
else {
G4cout << "Error, histtype not accepted " << G4endl;
}
}
G4double G4SPSRandomGenerator::GenRandX()
{
if(verbosityLevel >= 1)
G4cout << "In GenRandX" << G4endl;
if(XBias == false)
{
// X is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// X is biased
if(IPDFXBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(XBiasH.GetVectorLength());
bins[0] = XBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = XBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = XBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = XBiasH(size_t(ii)) + vals[ii-1];
sum = sum + XBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFXBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFXBias = true
IPDFXBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// Calculate the weighting: Find the bin that the determined
// rndm is in and the weigthing will be the difference in the
// natural probability (from the x-axis) divided by the
// difference in the biased probability (the area).
size_t numberOfBin = IPDFXBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFXBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
// retrieve the areas and then the x-axis values
bweights[0] = IPDFXBiasH(biasn2) - IPDFXBiasH(biasn2 - 1);
G4double xaxisl = IPDFXBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFXBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
//G4cout << "X Bin weight " << bweights[0] << " " << rndm << G4endl;
//G4cout << "lower and upper xaxis vals "<<xaxisl<<" "<<xaxisu<<G4endl;
bweights[0] = NatProb/bweights[0];
if(verbosityLevel >= 1)
G4cout << "X bin weight " << bweights[0] << " " << rndm << G4endl;
return(IPDFXBiasH.GetEnergy(rndm));
}
}
G4double G4SPSRandomGenerator::GenRandY()
{
if(verbosityLevel >= 1)
G4cout << "In GenRandY" << G4endl;
if(YBias == false)
{
// Y is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// Y is biased
if(IPDFYBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(YBiasH.GetVectorLength());
bins[0] = YBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = YBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = YBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = YBiasH(size_t(ii)) + vals[ii-1];
sum = sum + YBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFYBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFYBias = true
IPDFYBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
size_t numberOfBin = IPDFYBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFYBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[1] = IPDFYBiasH(biasn2) - IPDFYBiasH(biasn2 - 1);
G4double xaxisl = IPDFYBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFYBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[1] = NatProb/bweights[1];
if(verbosityLevel >= 1)
G4cout << "Y bin weight " << bweights[1] << " " << rndm << G4endl;
return(IPDFYBiasH.GetEnergy(rndm));
}
}
G4double G4SPSRandomGenerator::GenRandZ()
{
if(verbosityLevel >= 1)
G4cout << "In GenRandZ" << G4endl;
if(ZBias == false)
{
// Z is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// Z is biased
if(IPDFZBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(ZBiasH.GetVectorLength());
bins[0] = ZBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = ZBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = ZBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = ZBiasH(size_t(ii)) + vals[ii-1];
sum = sum + ZBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFZBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFZBias = true
IPDFZBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// size_t weight_bin_no = IPDFZBiasH.FindValueBinLocation(rndm);
size_t numberOfBin = IPDFZBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFZBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[2] = IPDFZBiasH(biasn2) - IPDFZBiasH(biasn2 - 1);
G4double xaxisl = IPDFZBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFZBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[2] = NatProb/bweights[2];
if(verbosityLevel >= 1)
G4cout << "Z bin weight " << bweights[2] << " " << rndm << G4endl;
return(IPDFZBiasH.GetEnergy(rndm));
}
}
G4double G4SPSRandomGenerator::GenRandTheta()
{
if(verbosityLevel >= 1)
{
G4cout << "In GenRandTheta" << G4endl;
G4cout << "Verbosity " << verbosityLevel << G4endl;
}
if(ThetaBias == false)
{
// Theta is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// Theta is biased
if(IPDFThetaBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(ThetaBiasH.GetVectorLength());
bins[0] = ThetaBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = ThetaBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = ThetaBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = ThetaBiasH(size_t(ii)) + vals[ii-1];
sum = sum + ThetaBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFThetaBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFThetaBias = true
IPDFThetaBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// size_t weight_bin_no = IPDFThetaBiasH.FindValueBinLocation(rndm);
size_t numberOfBin = IPDFThetaBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFThetaBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[3] = IPDFThetaBiasH(biasn2) - IPDFThetaBiasH(biasn2 - 1);
G4double xaxisl = IPDFThetaBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFThetaBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[3] = NatProb/bweights[3];
if(verbosityLevel >= 1)
G4cout << "Theta bin weight " << bweights[3] << " " << rndm << G4endl;
return(IPDFThetaBiasH.GetEnergy(rndm));
}
}
G4double G4SPSRandomGenerator::GenRandPhi()
{
if(verbosityLevel >= 1)
G4cout << "In GenRandPhi" << G4endl;
if(PhiBias == false)
{
// Phi is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// Phi is biased
if(IPDFPhiBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(PhiBiasH.GetVectorLength());
bins[0] = PhiBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = PhiBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = PhiBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = PhiBiasH(size_t(ii)) + vals[ii-1];
sum = sum + PhiBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFPhiBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFPhiBias = true
IPDFPhiBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// size_t weight_bin_no = IPDFPhiBiasH.FindValueBinLocation(rndm);
size_t numberOfBin = IPDFPhiBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFPhiBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[4] = IPDFPhiBiasH(biasn2) - IPDFPhiBiasH(biasn2 - 1);
G4double xaxisl = IPDFPhiBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFPhiBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[4] = NatProb/bweights[4];
if(verbosityLevel >= 1)
G4cout << "Phi bin weight " << bweights[4] << " " << rndm << G4endl;
return(IPDFPhiBiasH.GetEnergy(rndm));
}
}
G4double G4SPSRandomGenerator::GenRandEnergy()
{
if(verbosityLevel >= 1)
G4cout << "In GenRandEnergy" << G4endl;
if(EnergyBias == false)
{
// Energy is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else {
// ENERGY is biased
if(IPDFEnergyBias == false) {
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(EnergyBiasH.GetVectorLength());
bins[0] = EnergyBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = EnergyBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++) {
bins[ii] = EnergyBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = EnergyBiasH(size_t(ii)) + vals[ii-1];
sum = sum + EnergyBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++) {
vals[ii] = vals[ii]/sum;
IPDFEnergyBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFEnergyBias = true
IPDFEnergyBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// size_t weight_bin_no = IPDFEnergyBiasH.FindValueBinLocation(rndm);
size_t numberOfBin = IPDFEnergyBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFEnergyBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[5] = IPDFEnergyBiasH(biasn2) - IPDFEnergyBiasH(biasn2 - 1);
G4double xaxisl = IPDFEnergyBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFEnergyBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[5] = NatProb/bweights[5];
if(verbosityLevel >= 1)
G4cout << "Energy bin weight " << bweights[5] << " " << rndm << G4endl;
return(IPDFEnergyBiasH.GetEnergy(rndm));
}
}
+165
View File
@@ -0,0 +1,165 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
///////////////////////////////////////////////////////////////////////////////
//
// MODULE: G4SingleParticleSource.hh
//
// Version: 1.0
// Date: 5/02/04
// Author: Fan Lei
// Organisation: QinetiQ ltd.
// Customer: ESA/ESTEC
//
///////////////////////////////////////////////////////////////////////////////
//
// CHANGE HISTORY
// --------------
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
//
///////////////////////////////////////////////////////////////////////////////
//
#include "G4PrimaryParticle.hh"
#include "G4Event.hh"
#include "Randomize.hh"
#include <math.h>
#include "G4ParticleTable.hh"
#include "G4Geantino.hh"
#include "G4ParticleDefinition.hh"
#include "G4IonTable.hh"
#include "G4Ions.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
#include "G4SingleParticleSource.hh"
G4SingleParticleSource::G4SingleParticleSource()
{
// Initialise all variables
// Position distribution Variables
NumberOfParticlesToBeGenerated = 1;
particle_definition = G4Geantino::GeantinoDefinition();
G4ThreeVector zero;
particle_momentum_direction = G4ParticleMomentum(1,0,0);
particle_energy = 1.0*MeV;
particle_position = zero;
particle_time = 0.0;
particle_polarization = zero;
particle_charge = 0.0;
particle_weight = 1.0;
biasRndm = new G4SPSRandomGenerator();
posGenerator = new G4SPSPosDistribution();
posGenerator->SetBiasRndm(biasRndm);
angGenerator = new G4SPSAngDistribution();
angGenerator->SetPosDistribution(posGenerator);
angGenerator->SetBiasRndm(biasRndm);
eneGenerator = new G4SPSEneDistribution();
eneGenerator->SetBiasRndm(biasRndm);
// verbosity
verbosityLevel = 0;
}
G4SingleParticleSource::~G4SingleParticleSource()
{}
void G4SingleParticleSource::SetVerbosity(int vL)
{
verbosityLevel = vL;
posGenerator->SetVerbosity(vL);
angGenerator->SetVerbosity(vL);
eneGenerator->SetVerbosity(vL);
G4cout << "Verbosity Set to: " << verbosityLevel << G4endl;
}
void G4SingleParticleSource::SetParticleDefinition
(G4ParticleDefinition* aParticleDefinition)
{
particle_definition = aParticleDefinition;
particle_charge = particle_definition->GetPDGCharge();
}
void G4SingleParticleSource::GeneratePrimaryVertex(G4Event *evt)
{
if(particle_definition==NULL) return;
// Position stuff
particle_position = posGenerator->GenerateOne();
// Angular stuff
particle_momentum_direction = angGenerator->GenerateOne();
// Energy stuff
particle_energy = eneGenerator->GenerateOne(particle_definition);
// create a new vertex
G4PrimaryVertex* vertex = new G4PrimaryVertex(particle_position,particle_time);
if(verbosityLevel >= 2)
G4cout << "Creating primaries and assigning to vertex" << G4endl;
// create new primaries and set them to the vertex
G4double mass = particle_definition->GetPDGMass();
G4double energy = particle_energy + mass;
G4double pmom = sqrt(energy*energy-mass*mass);
G4double px = pmom*particle_momentum_direction.x();
G4double py = pmom*particle_momentum_direction.y();
G4double pz = pmom*particle_momentum_direction.z();
if(verbosityLevel > 1){
G4cout << "Particle name: "<<particle_definition->GetParticleName() << G4endl;
G4cout << " Energy: "<<particle_energy << G4endl;
G4cout << " Position: "<<particle_position<< G4endl;
G4cout << " Direction: "<<particle_momentum_direction << G4endl;
G4cout << " NumberOfParticlesToBeGenerated: "<<NumberOfParticlesToBeGenerated << G4endl;
}
for( G4int i=0; i<NumberOfParticlesToBeGenerated; i++ )
{
G4PrimaryParticle* particle =
new G4PrimaryParticle(particle_definition,px,py,pz);
particle->SetMass( mass );
particle->SetCharge( particle_charge );
particle->SetPolarization(particle_polarization.x(),
particle_polarization.y(),
particle_polarization.z());
vertex->SetPrimary( particle );
// Set bweight equal to the multiple of all non-zero weights
particle_weight = biasRndm->GetBiasWeight();
// now pass it to the primary vertex
vertex->SetWeight(particle_weight);
}
evt->AddPrimaryVertex( vertex );
if(verbosityLevel > 1)
G4cout << " Primary Vetex generated !"<< G4endl;
}
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StackedTrack.cc,v 1.6 2003/05/21 20:52:54 asaim Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4StackedTrack.cc,v 1.8 2004/06/11 14:11:20 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// Last Modification : 02/Feb/96 M.Asai
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TrajectoryContainer.cc,v 1.2 2002/10/06 11:46:48 asaim Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4TrajectoryContainer.cc,v 1.4 2004/06/11 14:11:21 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G4TrajectoryContainer.hh"
+5 -1
View File
@@ -18,6 +18,11 @@ ifndef G4INSTALL
G4INSTALL := ../..
endif
GLOBLIBS = libG4tracking.lib libG4processes.lib libG4digits_hits.lib
GLOBLIBS += libG4track.lib libG4particles.lib libG4geometry.lib
GLOBLIBS += libG4materials.lib libG4intercoms.lib
GLOBLIBS += libG4graphics_reps.lib libG4global.lib
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += \
@@ -31,7 +36,6 @@ CPPFLAGS += \
-I$(G4BASE)/geometry/solids/specific/include \
-I$(G4BASE)/geometry/solids/Boolean/include \
-I$(G4BASE)/geometry/solids/BREPS/include \
-I$(G4BASE)/geometry/solids/STEP/include \
-I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/particles/management/include \
+15 -1
View File
@@ -1,8 +1,22 @@
$Id: History,v 1.53 2003/10/03 14:31:40 gcosmo Exp $
$Id: History,v 1.56 2004/06/17 14:27:32 gcosmo Exp $
G3toG4 Modification History (reverse chronological order, please !)
--------------------------------------------------------------------
g3tog4-V06-01-02 17-Jun-2004 G.Cosmo
- GNUmakefile: added definition of GLOBLIBS.
g3tog4-V06-01-01 03-May-2004 G.Cosmo
- G4gsrotm.cc: commented warning about left-handled coordinates for
rotation axes (I.Hrivnacova).
g3tog4-V06-01-00 26-Mar-2004 G.Cosmo
- Removed hardwired gSeparator constant (a character which is used
during generation of volume names) to '_'. Now gSeparator is made non
constant and so can be changed in case a user wants to use '_' in his
code (I.Hrivnacova).
Modified files: G3toG4.hh, clparse.cc.
g3tog4-V05-02-00 03-Oct-2003 G.Cosmo
- GNUmakefile:
o replaced "digits+hits" with "digits_hits".
+3 -3
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G3toG4.hh,v 1.7 2001/07/11 09:58:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G3toG4.hh,v 1.8 2004/03/26 14:59:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// modified by I.Hrivnacova, 27 Sep 99
@@ -31,7 +31,7 @@
#include "globals.hh"
const char gSeparator('_');
extern char gSeparator;
extern G4int Ipar[1000];
extern G4double Rpar[1000];
+6 -6
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4gsrotm.cc,v 1.9 2001/07/11 09:59:02 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4gsrotm.cc,v 1.10 2004/05/03 07:49:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
#include "G3toG4.hh"
#include "G3RotTable.hh"
@@ -85,10 +85,10 @@ void G4gsrotm(G4int irot, G4double theta1, G4double phi1,
G4cerr << G4endl;
G4Exception("G4gsrotm error");
}
else if (1+check<=tol) {
G4cerr << "G4gsrotm warning: coordinate axes forming rotation "
<< "matrix " << irot << " are left-handed" << G4endl;
}
//else if (1+check<=tol) {
// G4cerr << "G4gsrotm warning: coordinate axes forming rotation "
// << "matrix " << irot << " are left-handed" << G4endl;
//}
G3toG4RotationMatrix* rotp = new G3toG4RotationMatrix;
+3 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: clparse.cc,v 1.15 2003/06/16 16:50:58 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: clparse.cc,v 1.16 2004/03/26 14:59:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// modified by I.Hrivnacova
// added G3SensVol
@@ -56,6 +56,7 @@ G3PartTable G3Part; // particle ID <-> ParticleDefinition pointer
G3DetTable G3Det; // sensitive detector name <-> pointer
G3EleTable G3Ele; // element names table
G3SensVolVector G3SensVol; // vector of sensitive logical volumes
char gSeparator('_');
G4int narray;
+3 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.11 2003/10/08 14:39:19 gcosmo Exp $
# $Id: GNUmakefile,v 1.12 2004/06/01 15:35:46 gcosmo Exp $
# --------------------------------------------------------------
# GNUmakefile for geometry. Gabriele Cosmo, 16/11/96.
# --------------------------------------------------------------
@@ -9,6 +9,8 @@ ifndef G4INSTALL
G4INSTALL = ../..
endif
GLOBLIBS = libG4intercoms.lib libG4graphics_reps.lib libG4global.lib
include $(G4INSTALL)/config/architecture.gmk
SUBDIRS = management volumes magneticfield navigation biasing divisions
+13 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.30 2003/11/04 09:47:57 gcosmo Exp $
$Id: History,v 1.32 2004/06/11 15:01:29 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,18 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Jun 11, 2004 Gabriele Cosmo geometry-V06-01-01
-----------------------------
- Includes tag "geomnav-V06-01-01".
- Use global flag G4GEOMETRY_ALLOC_EXPORT to export extern symbols for DLLs.
Modified granular GNUmakefiles and rearranged usage of extern symbols
in classes in volumes module.
Jun 07, 2004 Gabriele Cosmo geometry-V06-01-00
-----------------------------
- GNUmakefile: added definition of GLOBLIBS for DLLs support on Windows.
- Includes tags in "geant4-06-02-cand-00" plus "geomvol-V06-01-02".
Nov 04, 2003 Gabriele Cosmo geometry-V05-02-01
-----------------------------
- Includes headers review. Tags included:
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.3 2003/10/01 14:51:38 gcosmo Exp $
# $Id: GNUmakefile,v 1.4 2004/06/11 14:17:12 gcosmo Exp $
# --------------------------------------------------------------------
# GNUmakefile for geometry/biasing library. Gabriele Cosmo, 25/03/02.
# --------------------------------------------------------------------
@@ -11,6 +11,7 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4GEOM_ALLOC_EXPORT
CPPFLAGS += -I$(G4BASE)/geometry/solids/CSG/include \
-I$(G4BASE)/materials/include \
-I$(G4BASE)/graphics_reps/include \
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.3 2003/11/19 11:51:44 gcosmo Exp $
# $Id: GNUmakefile,v 1.4 2004/06/11 14:17:13 gcosmo Exp $
# ----------------------------------------------------------------------
# GNUmakefile for geometry/divisions library. Gabriele Cosmo, 16/06/03.
# ----------------------------------------------------------------------
@@ -11,6 +11,7 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4GEOM_ALLOC_EXPORT
CPPFLAGS += \
-I$(G4BASE)/global/management/include \
-I$(G4BASE)/global/HEPGeometry/include \
+13 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.10 2003/11/19 18:02:10 gcosmo Exp $
$Id: History,v 1.12 2004/05/17 07:20:59 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,18 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
May 17th, 2004 G.Cosmo (geomdiv-V06-01-01)
- Corrected handling of offset in Z for reflection.
May 13th, 2004 G.Cosmo (geomdiv-V06-01-00)
- Added support for reflection of divided volumes (courtesy of I.Hrivnacova):
o Added concrete istance of division-factory G4PVDivisionFactory
for the creation of volume divisions on demand.
o Enhanced unit-test suite "ExDivisions" to support reflections with
additional input argument for positioning type (normal/reflected).
o Coworks with tags: geommng-V06-01-00, geomvol-V06-01-00 and
geom-bool-V06-01-00.
Nov 19th, 2003 G.Cosmo (geomdiv-V05-02-07)
- Moved verbose output between G4DIVDEBUG compilation flag.
- Added testing framework for divisions to be used also as base for user's example.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PVDivision.hh,v 1.7 2003/11/19 11:51:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PVDivision.hh,v 1.8 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4PVDivision
//
@@ -61,9 +61,9 @@
// n=0..nReplicas-1
// History:
// 09.05.01 - P.Arce Initial version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// ----------------------------------------------------------------------
#ifndef G4PVDIVISION_HH
#define G4PVDIVISION_HH
@@ -0,0 +1,98 @@
//
// ********************************************************************
// * 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: G4PVDivisionFactory.hh,v 1.1 2004/05/13 14:56:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// class G4PVDivisionFactory
//
// Class description:
//
// Implementation of the interfaces for creating volumes divisions
// (defined in G4VPVDivisionFactory) for G4PVDivision type.
// Author: Ivana Hrivnacova, 4.5.2004 (Ivana.Hrivnacova@cern.ch)
// ------------------------------------------------------------------------
#ifndef G4PVDIVISION_FACTORY_HH
#define G4PVDIVISION_FACTORY_HH
#include "geomdefs.hh"
#include "G4VPVDivisionFactory.hh"
class G4LogicalVolume;
class G4PVDivisionFactory : public G4VPVDivisionFactory
{
public: // with description
virtual ~G4PVDivisionFactory();
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMother,
const EAxis pAxis,
const G4int nReplicas,
const G4double width,
const G4double offset );
// Create division - with number of divisions and width.
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4int nReplicas,
const G4double offset );
// Create division - with number of divisions.
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4double width,
const G4double offset );
// Create division - with width.
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const G4VPVParameterisation* param);
// Create division - with parameterisation.
virtual G4bool IsPVDivision(const G4VPhysicalVolume* pv) const;
// Returns true if pv is division.
static G4PVDivisionFactory* GetInstance();
// Create the unique instance of the singleton.
protected:
G4PVDivisionFactory();
};
#endif
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationBox.hh,v 1.3 2003/11/19 11:51:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationBox.hh,v 1.4 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationBoxX,
// G4ParameterisationBoxY,
@@ -34,9 +34,10 @@
// dividing a G4Box along one of each axis X, Y, Z.
// History:
// 09.05.01 - P.Arce Initial version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#ifndef G4ParameterisationBox_H
#define G4ParameterisationBox_H 1
@@ -58,7 +59,18 @@ class G4Tubs;
class G4Polycone;
class G4Polyhedra;
class G4ParameterisationBoxX : public G4VDivisionParameterisation
class G4VParameterisationBox : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationBox( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationBox();
};
class G4ParameterisationBoxX : public G4VParameterisationBox
{
public: // with description
@@ -75,8 +87,7 @@ class G4ParameterisationBoxX : public G4VDivisionParameterisation
void ComputeDimensions(G4Box& box, const G4int copyNo,
const G4VPhysicalVolume* physVol) const;
private: // Dummy declarations to get rid of warnings ...
private: // Dummy declarations to get rid of warnings ...
void ComputeDimensions (G4Cons&,const G4int,
const G4VPhysicalVolume*) const {}
@@ -102,7 +113,7 @@ class G4ParameterisationBoxX : public G4VDivisionParameterisation
const G4VPhysicalVolume*) const {}
};
class G4ParameterisationBoxY : public G4VDivisionParameterisation
class G4ParameterisationBoxY : public G4VParameterisationBox
{
public: // with description
@@ -145,7 +156,7 @@ class G4ParameterisationBoxY : public G4VDivisionParameterisation
const G4VPhysicalVolume*) const {}
};
class G4ParameterisationBoxZ : public G4VDivisionParameterisation
class G4ParameterisationBoxZ : public G4VParameterisationBox
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationCons.hh,v 1.4 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationCons.hh,v 1.5 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationConsRho,
// G4ParameterisationConsPhi,
@@ -34,9 +34,10 @@
// dividing a G4Cons along one of each axis Rho, Phi, Z.
// History:
// 09.05.01 - P.Arce Initial version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#ifndef G4ParameterisationCons_H
#define G4ParameterisationCons_H 1
@@ -58,7 +59,18 @@ class G4Tubs;
class G4Polycone;
class G4Polyhedra;
class G4ParameterisationConsRho : public G4VDivisionParameterisation
class G4VParameterisationCons : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationCons( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationCons();
};
class G4ParameterisationConsRho : public G4VParameterisationCons
{
public: // with description
@@ -100,7 +112,7 @@ class G4ParameterisationConsRho : public G4VDivisionParameterisation
const G4VPhysicalVolume*) const {}
};
class G4ParameterisationConsPhi : public G4VDivisionParameterisation
class G4ParameterisationConsPhi : public G4VParameterisationCons
{
public: // with description
@@ -142,7 +154,7 @@ class G4ParameterisationConsPhi : public G4VDivisionParameterisation
const G4VPhysicalVolume*) const {}
};
class G4ParameterisationConsZ : public G4VDivisionParameterisation
class G4ParameterisationConsZ : public G4VParameterisationCons
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationPara.hh,v 1.5 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationPara.hh,v 1.6 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationParaX,
// G4ParameterisationParaY,
@@ -34,9 +34,10 @@
// dividing a G4Para along one of each axis X, Y, Z.
// History:
// 09.05.01 - P.Arce First version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#ifndef G4ParameterisationPara_H
#define G4ParameterisationPara_H 1
@@ -56,8 +57,18 @@ class G4Tubs;
class G4Polycone;
class G4Polyhedra;
class G4VParameterisationPara : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationPara( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationPara();
};
class G4ParameterisationParaX : public G4VDivisionParameterisation
class G4ParameterisationParaX : public G4VParameterisationPara
{
public: // with description
@@ -101,7 +112,7 @@ class G4ParameterisationParaX : public G4VDivisionParameterisation
};
class G4ParameterisationParaY : public G4VDivisionParameterisation
class G4ParameterisationParaY : public G4VParameterisationPara
{
public: // with description
@@ -145,7 +156,7 @@ class G4ParameterisationParaY : public G4VDivisionParameterisation
};
class G4ParameterisationParaZ : public G4VDivisionParameterisation
class G4ParameterisationParaZ : public G4VParameterisationPara
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationPolycone.hh,v 1.5 2003/11/18 12:15:30 arce Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationPolycone.hh,v 1.6 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationPolyconeRho,
// G4ParameterisationPolyconePhi,
@@ -34,7 +34,9 @@
// dividing a G4Polycone along one of each axis Rho, Phi, Z.
// History:
// 09.05.01 - P.Arce First version
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
//---------------------------------------------------------------------
#ifndef G4ParameterisationPolycone_H
#define G4ParameterisationPolycone_H 1
@@ -56,11 +58,22 @@ class G4Hype;
class G4Tubs;
class G4Polyhedra;
class G4VParameterisationPolycone : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationPolycone( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationPolycone();
};
//---------------------------------------------------------------------
// Class G4ParameterisationPolyconeRho
//---------------------------------------------------------------------
class G4ParameterisationPolyconeRho : public G4VDivisionParameterisation
class G4ParameterisationPolyconeRho : public G4VParameterisationPolycone
{
public: // with description
@@ -109,7 +122,7 @@ class G4ParameterisationPolyconeRho : public G4VDivisionParameterisation
// Class G4ParameterisationPolyconePhi
//---------------------------------------------------------------------
class G4ParameterisationPolyconePhi : public G4VDivisionParameterisation
class G4ParameterisationPolyconePhi : public G4VParameterisationPolycone
{
public: // with description
@@ -156,7 +169,7 @@ class G4ParameterisationPolyconePhi : public G4VDivisionParameterisation
// Class G4ParameterisationPolyconeZ
//---------------------------------------------------------------------
class G4ParameterisationPolyconeZ : public G4VDivisionParameterisation
class G4ParameterisationPolyconeZ : public G4VParameterisationPolycone
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationPolyhedra.hh,v 1.6 2003/11/18 12:15:30 arce Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationPolyhedra.hh,v 1.7 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationPolyhedraRho,
// G4ParameterisationPolyhedraPhi,
@@ -34,7 +34,9 @@
// dividing a G4Polyhedra along one of each axis Rho, Phi, Z.
// History:
// 09.05.01 - P.Arce First version
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
//---------------------------------------------------------------------
#ifndef G4ParameterisationPolyhedra_H
#define G4ParameterisationPolyhedra_H 1
@@ -56,11 +58,28 @@ class G4Hype;
class G4Tubs;
class G4Polycone;
class G4VParameterisationPolyhedra : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationPolyhedra( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationPolyhedra();
private:
G4double ConvertRadiusFactor(const G4Polyhedra& phedra) const;
// Converts radius of the sides to radius of the corners:
// r_corners = r_sides/factor
};
//---------------------------------------------------------------------
// Class G4ParameterisationPolyhedraRho
//---------------------------------------------------------------------
class G4ParameterisationPolyhedraRho : public G4VDivisionParameterisation
class G4ParameterisationPolyhedraRho : public G4VParameterisationPolyhedra
{
public: // with description
@@ -109,7 +128,7 @@ class G4ParameterisationPolyhedraRho : public G4VDivisionParameterisation
// Class G4ParameterisationPolyhedraPhi
//---------------------------------------------------------------------
class G4ParameterisationPolyhedraPhi : public G4VDivisionParameterisation
class G4ParameterisationPolyhedraPhi : public G4VParameterisationPolyhedra
{
public: // with description
@@ -158,7 +177,7 @@ class G4ParameterisationPolyhedraPhi : public G4VDivisionParameterisation
// Class G4ParameterisationPolyhedraZ
//---------------------------------------------------------------------
class G4ParameterisationPolyhedraZ : public G4VDivisionParameterisation
class G4ParameterisationPolyhedraZ : public G4VParameterisationPolyhedra
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationTrd.hh,v 1.5 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationTrd.hh,v 1.6 2004/05/13 14:57:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationTrdX
// G4ParameterisationTrdY
@@ -34,9 +34,10 @@
// dividing a trapezoid along one of each axis X, Y, Z.
// History:
// 09.05.01 P.Arce First version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#ifndef G4ParameterisationTrd_H
#define G4ParameterisationTrd_H 1
@@ -57,7 +58,18 @@ class G4Tubs;
class G4Polycone;
class G4Polyhedra;
class G4ParameterisationTrdX : public G4VDivisionParameterisation
class G4VParameterisationTrd : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationTrd( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationTrd();
};
class G4ParameterisationTrdX : public G4VParameterisationTrd
{
public: // with description
@@ -103,7 +115,7 @@ class G4ParameterisationTrdX : public G4VDivisionParameterisation
};
class G4ParameterisationTrdY : public G4VDivisionParameterisation
class G4ParameterisationTrdY : public G4VParameterisationTrd
{
public: // with description
@@ -149,7 +161,7 @@ class G4ParameterisationTrdY : public G4VDivisionParameterisation
};
class G4ParameterisationTrdZ : public G4VDivisionParameterisation
class G4ParameterisationTrdZ : public G4VParameterisationTrd
{
public: // with description
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationTubs.hh,v 1.4 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationTubs.hh,v 1.5 2004/05/13 14:57:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// classes G4ParameterisationTubsRho
// G4ParameterisationTubsPhi
@@ -34,9 +34,10 @@
// dividing a G4Tubs along one of each axis Rho, Phi, Z.
// History:
// 09.05.01 P.Arce First version
// ********************************************************************
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#ifndef G4ParameterisationTubsRho_H
#define G4ParameterisationTubsRho_H 1
@@ -56,8 +57,18 @@ class G4Hype;
class G4Polycone;
class G4Polyhedra;
class G4VParameterisationTubs : public G4VDivisionParameterisation
{
public: // with description
G4VParameterisationTubs( EAxis axis, G4int nCopies,
G4double offset, G4double step,
G4VSolid* msolid, DivisionType divType );
virtual ~G4VParameterisationTubs();
};
class G4ParameterisationTubsRho : public G4VDivisionParameterisation
class G4ParameterisationTubsRho : public G4VParameterisationTubs
{
public: // with description
@@ -100,7 +111,7 @@ class G4ParameterisationTubsRho : public G4VDivisionParameterisation
};
class G4ParameterisationTubsPhi : public G4VDivisionParameterisation
class G4ParameterisationTubsPhi : public G4VParameterisationTubs
{
public: // with description
@@ -143,7 +154,7 @@ class G4ParameterisationTubsPhi : public G4VDivisionParameterisation
};
class G4ParameterisationTubsZ : public G4VDivisionParameterisation
class G4ParameterisationTubsZ : public G4VParameterisationTubs
{
public: // with description
@@ -21,20 +21,20 @@
// ********************************************************************
//
//
// $Id: G4VDivisionParameterisation.hh,v 1.6 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4VDivisionParameterisation.hh,v 1.8 2004/05/17 07:20:39 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4VDivisionParameterisation
//
// Class description:
//
// ......
//
// Member data:
//
// Base class for parameterisations defining divisions of volumes
// for different kind of CSG and specific solids.
// History:
// 09.05.01 - P.Arce Initial version
// -------
// 09.05.01 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
//---------------------------------------------------------------------
#ifndef G4VDivisionParameterisation_H
#define G4VDivisionParameterisation_H 1
@@ -58,6 +58,8 @@ class G4VDivisionParameterisation : public G4VPVParameterisation
G4VSolid* motherSolid = 0);
virtual ~G4VDivisionParameterisation();
virtual G4VSolid* ComputeSolid(const G4int, G4VPhysicalVolume *);
virtual void ComputeTransformation(const G4int copyNo,
G4VPhysicalVolume *physVol) const = 0;
@@ -84,6 +86,7 @@ class G4VDivisionParameterisation : public G4VPVParameterisation
void CheckOffset( G4double maxPar );
void CheckNDivAndWidth( G4double maxPar );
virtual G4double GetMaxParameter() const = 0;
G4double OffsetZ() const;
protected:
@@ -94,6 +97,8 @@ class G4VDivisionParameterisation : public G4VPVParameterisation
G4double foffset;
DivisionType fDivisionType;
G4VSolid* fmotherSolid;
G4bool fReflectedSolid;
G4bool fDeleteSolid;
static G4int verbose;
G4int theVoluFirstCopyNo;
@@ -21,13 +21,12 @@
// ********************************************************************
//
//
// $Id: G4VDivisionParameterisation.icc,v 1.2 2003/11/18 12:15:30 arce Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4VDivisionParameterisation.icc,v 1.3 2004/05/13 14:57:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4VDivisionParameterisation Inline Implementation file
//
// 26.05.03 - G.Cosmo: Created
// ********************************************************************
// --------------------------------------------------------------------
inline
const G4String& G4VDivisionParameterisation::GetType() const
+13 -3
View File
@@ -21,17 +21,18 @@
// ********************************************************************
//
//
// $Id: G4PVDivision.cc,v 1.10 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PVDivision.cc,v 1.11 2004/05/13 14:57:13 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4PVDivision Implementation file
//
// 26.05.03 - P.Arce Initial version
// ********************************************************************
// --------------------------------------------------------------------
#include "G4PVDivision.hh"
#include "G4LogicalVolume.hh"
#include "G4VSolid.hh"
#include "G4ReflectedSolid.hh"
#include "G4ParameterisationBox.hh"
#include "G4ParameterisationTubs.hh"
#include "G4ParameterisationCons.hh"
@@ -257,6 +258,15 @@ void G4PVDivision::SetParameterisation( G4LogicalVolume* motherLogical,
G4VSolid* mSolid = motherLogical->GetSolid();
G4String mSolidType = mSolid->GetEntityType();
// If the solid is a reflected one, update type to its
// real constituent solid.
//
if (mSolidType == "G4ReflectedSolid")
{
mSolidType = ((G4ReflectedSolid*)mSolid)->GetConstituentMovedSolid()
->GetEntityType();
}
// Parameterisation type depend of mother solid type and axis of division
//
if( mSolidType == "G4Box" )
@@ -0,0 +1,159 @@
//
// ********************************************************************
// * 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: G4PVDivisionFactory.cc,v 1.1 2004/05/13 14:56:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4PVDivisionFactory Implementation file
//
// Author: Ivana Hrivnacova, 4.5.2004 (Ivana.Hrivnacova@cern.ch)
// --------------------------------------------------------------------
#include "G4PVDivisionFactory.hh"
#include "G4PVDivision.hh"
#include "G4VDivisionParameterisation.hh"
//_____________________________________________________________________________
G4PVDivisionFactory::G4PVDivisionFactory()
: G4VPVDivisionFactory()
{
// Protected singleton constructor.
// ---
}
//_____________________________________________________________________________
G4PVDivisionFactory::~G4PVDivisionFactory()
{
}
//_____________________________________________________________________________
G4PVDivisionFactory* G4PVDivisionFactory::GetInstance()
{
static G4PVDivisionFactory theFactory;
if (!fgInstance)
{
fgInstance = &theFactory;
}
return &theFactory;
}
//_____________________________________________________________________________
G4VPhysicalVolume*
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4int nReplicas,
const G4double width,
const G4double offset )
{
// Create division - with number of divisions and width
// ---
return new G4PVDivision(pName, pLogical, pMotherLogical,
pAxis, nReplicas, width, offset);
}
//_____________________________________________________________________________
G4VPhysicalVolume*
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4int nReplicas,
const G4double offset )
{
// Create division - with number of divisions
// ---
return new G4PVDivision(pName, pLogical, pMotherLogical,
pAxis, nReplicas, offset);
}
//_____________________________________________________________________________
G4VPhysicalVolume*
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4double width,
const G4double offset )
{
// Create division - with width
// ---
return new G4PVDivision(pName, pLogical, pMotherLogical,
pAxis, width, offset);
}
//_____________________________________________________________________________
G4VPhysicalVolume*
G4PVDivisionFactory::CreatePVDivision(const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const G4VPVParameterisation* param)
{
// Create division - with parameterisation
// ---
// Get parameterisation data
//
const G4VDivisionParameterisation* divParam
= dynamic_cast<const G4VDivisionParameterisation*>(param);
if (!divParam)
{
G4Exception("G4PVDivisionFactory::CreatePVDivision()",
"WrongType", FatalException,
"Unexpected parameterisation type !");
}
EAxis axis = divParam->GetAxis();
G4int nofDivisions = divParam->GetNoDiv();
G4double width = divParam->GetWidth();
G4double offset = divParam->GetOffset();
return new G4PVDivision(pName, pLogical, pMotherLogical,
axis, nofDivisions, width, offset);
}
//_____________________________________________________________________________
G4bool G4PVDivisionFactory::IsPVDivision(const G4VPhysicalVolume* pv) const
{
// Returns true if pv is division
// ---
if (dynamic_cast<const G4PVDivision*>(pv))
return true;
else
return false;
}
@@ -21,13 +21,14 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationBox.cc,v 1.5 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationBox.cc,v 1.7 2004/05/17 07:20:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4ParameterisationBox Implementation file
//
// 26.05.03 - P.Arce Initial version
// ********************************************************************
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#include "G4ParameterisationBox.hh"
@@ -36,26 +37,50 @@
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ReflectedSolid.hh"
#include "G4Box.hh"
//--------------------------------------------------------------------------
G4VParameterisationBox::
G4VParameterisationBox( EAxis axis, G4int nDiv, G4double width,
G4double offset, G4VSolid* msolid,
DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
{
G4Box* msol = (G4Box*)(msolid);
if (msolid->GetEntityType() == "G4ReflectedSolid")
{
// Get constituent solid
G4VSolid* mConstituentSolid
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
msol = (G4Box*)(mConstituentSolid);
fmotherSolid = msol;
fReflectedSolid = true;
}
}
//--------------------------------------------------------------------------
G4VParameterisationBox::~G4VParameterisationBox()
{
}
//--------------------------------------------------------------------------
G4ParameterisationBoxX::
G4ParameterisationBoxX( EAxis axis, G4int nDiv, G4double width,
G4double offset, G4VSolid* msolid,
DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionBoxX" );
G4Box* mbox = (G4Box*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Box* mbox = (G4Box*)(msolid);
fnDiv = CalculateNDiv( 2*mbox->GetXHalfLength(), width, offset );
}
else if( divType == DivNDIV )
{
G4Box* mbox = (G4Box*)(msolid);
fwidth = CalculateWidth( 2*mbox->GetXHalfLength(), nDiv, offset );
}
#ifdef G4DIVDEBUG
@@ -149,19 +174,18 @@ G4ParameterisationBoxY::
G4ParameterisationBoxY( EAxis axis, G4int nDiv, G4double width,
G4double offset, G4VSolid* msolid,
DivisionType divType)
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionBoxY" );
G4Box* mbox = (G4Box*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Box* mbox = (G4Box*)(msolid);
fnDiv = CalculateNDiv( 2*mbox->GetYHalfLength(), width, offset );
}
else if( divType == DivNDIV )
{
G4Box* mbox = (G4Box*)(msolid);
fwidth = CalculateWidth( 2*mbox->GetYHalfLength(), nDiv, offset );
}
@@ -254,19 +278,18 @@ G4ParameterisationBoxZ::
G4ParameterisationBoxZ( EAxis axis, G4int nDiv, G4double width,
G4double offset, G4VSolid* msolid,
DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationBox( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionBoxZ" );
G4Box* mbox = (G4Box*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Box* mbox = (G4Box*)(msolid);
fnDiv = CalculateNDiv( 2*mbox->GetZHalfLength(), width, offset );
}
else if ( divType == DivNDIV )
{
G4Box* mbox = (G4Box*)(msolid);
fwidth = CalculateWidth( 2*mbox->GetZHalfLength(), nDiv, offset );
}
#ifdef G4DIVDEBUG
@@ -301,7 +324,8 @@ ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
//----- translation
G4ThreeVector origin(0.,0.,0.);
G4double posi = -mdz + foffset + (copyNo+0.5)*fwidth;
G4double posi = -mdz + OffsetZ() + (copyNo+0.5)*fwidth;
if( faxis == kZAxis )
{
origin.setZ( posi );
@@ -21,13 +21,14 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationCons.cc,v 1.6 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationCons.cc,v 1.8 2004/05/17 07:20:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4ParameterisationCons Implementation file
//
// 26.05.03 - P.Arce Initial version
// ********************************************************************
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#include "G4ParameterisationCons.hh"
@@ -36,19 +37,54 @@
#include "G4RotationMatrix.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4ReflectedSolid.hh"
#include "G4Cons.hh"
//--------------------------------------------------------------------------
G4VParameterisationCons::
G4VParameterisationCons( EAxis axis, G4int nDiv, G4double width,
G4double offset, G4VSolid* msolid,
DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
{
G4Cons* msol = (G4Cons*)(msolid);
if (msolid->GetEntityType() == "G4ReflectedSolid")
{
// Get constituent solid
G4VSolid* mConstituentSolid
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
msol = (G4Cons*)(mConstituentSolid);
// Create a new solid with inversed parameters
G4Cons* newSolid
= new G4Cons(msol->GetName(),
msol->GetInnerRadiusPlusZ(), msol->GetOuterRadiusPlusZ(),
msol->GetInnerRadiusMinusZ(), msol->GetOuterRadiusMinusZ(),
msol->GetZHalfLength(),
msol->GetStartPhiAngle(), msol->GetDeltaPhiAngle());
msol = newSolid;
fmotherSolid = newSolid;
fReflectedSolid = true;
fDeleteSolid = true;
}
}
//------------------------------------------------------------------------
G4VParameterisationCons::~G4VParameterisationCons()
{
}
//--------------------------------------------------------------------------
G4ParameterisationConsRho::
G4ParameterisationConsRho( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationCons( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionConsRho" );
G4Cons* msol = (G4Cons*)(msolid);
G4Cons* msol = (G4Cons*)(fmotherSolid);
if( msol->GetInnerRadiusPlusZ() == 0. )
{
G4cerr << "WARNING - G4ParameterisationConsRho, OuterRadiusMinusZ = 0. "
@@ -175,19 +211,18 @@ G4ParameterisationConsPhi::
G4ParameterisationConsPhi( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationCons( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionConsPhi" );
G4Cons* msol = (G4Cons*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Cons* msol = (G4Cons*)(msolid);
fnDiv = CalculateNDiv( msol->GetDeltaPhiAngle(), width, offset );
}
else if( divType == DivNDIV )
{
G4Cons* msol = (G4Cons*)(msolid);
fwidth = CalculateWidth( msol->GetDeltaPhiAngle(), nDiv, offset );
}
@@ -282,19 +317,18 @@ G4ParameterisationConsZ::
G4ParameterisationConsZ( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationCons( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionConsZ" );
G4Cons* msol = (G4Cons*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Cons* msol = (G4Cons*)(msolid);
fnDiv = CalculateNDiv( 2*msol->GetZHalfLength(), width, offset );
}
else if( divType == DivNDIV )
{
G4Cons* msol = (G4Cons*)(msolid);
fwidth = CalculateWidth( 2*msol->GetZHalfLength(), nDiv, offset );
}
@@ -329,7 +363,7 @@ ComputeTransformation( const G4int copyNo, G4VPhysicalVolume* physVol ) const
{
//----- set translation: along Z axis
G4Cons* motherCons = (G4Cons*)(GetMotherSolid());
G4double posi = - motherCons->GetZHalfLength() + foffset
G4double posi = - motherCons->GetZHalfLength() + OffsetZ()
+ fwidth/2 + copyNo*fwidth;
G4ThreeVector origin(0.,0.,posi);
physVol->SetTranslation( origin );
@@ -367,8 +401,8 @@ ComputeDimensions( G4Cons& cons, const G4int copyNo,
- msol->GetOuterRadiusMinusZ()) / (2*mHalfLength);
G4double bROuter = (msol->GetOuterRadiusPlusZ()
+ msol->GetOuterRadiusMinusZ()) / 2;
G4double xMinusZ = -mHalfLength + foffset + fwidth*copyNo;
G4double xPlusZ = -mHalfLength + foffset + fwidth*(copyNo+1);
G4double xMinusZ = -mHalfLength + OffsetZ() + fwidth*copyNo;
G4double xPlusZ = -mHalfLength + OffsetZ() + fwidth*(copyNo+1);
cons.SetInnerRadiusMinusZ( aRInner * xMinusZ + bRInner );
cons.SetOuterRadiusMinusZ( aROuter * xMinusZ + bROuter );
cons.SetInnerRadiusPlusZ( aRInner * xPlusZ + bRInner );
@@ -390,4 +424,5 @@ ComputeDimensions( G4Cons& cons, const G4int copyNo,
if( verbose >= 4 ) cons.DumpInfo();
}
#endif
}
@@ -21,13 +21,14 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationPara.cc,v 1.6 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationPara.cc,v 1.8 2004/05/17 07:20:41 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4ParameterisationPara Implementation file
//
// 26.05.03 - P.Arce Initial version
// ********************************************************************
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#include "G4ParameterisationPara.hh"
@@ -37,26 +38,64 @@
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ReflectedSolid.hh"
#include "G4Para.hh"
//--------------------------------------------------------------------------
G4VParameterisationPara::
G4VParameterisationPara( EAxis axis, G4int nDiv, G4double width,
G4double offset, G4VSolid* msolid,
DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
{
G4Para* msol = (G4Para*)(msolid);
if (msolid->GetEntityType() == "G4ReflectedSolid")
{
// Get constituent solid
G4VSolid* mConstituentSolid
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
msol = (G4Para*)(mConstituentSolid);
fmotherSolid = msol;
// Create a new solid with inversed parameters
G4Para* newSolid
= new G4Para(msol->GetName(),
msol->GetXHalfLength(),
msol->GetYHalfLength(),
msol->GetZHalfLength(),
atan(msol->GetTanAlpha()),
M_PI - msol->GetSymAxis().theta(),
msol->GetSymAxis().phi());
msol = newSolid;
fmotherSolid = newSolid;
fReflectedSolid = true;
fDeleteSolid = true;
}
}
//------------------------------------------------------------------------
G4VParameterisationPara::~G4VParameterisationPara()
{
}
//------------------------------------------------------------------------
G4ParameterisationParaX::
G4ParameterisationParaX( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationPara( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionParaX" );
G4Para* mpara = (G4Para*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Para* mpara = (G4Para*)(msolid);
fnDiv = CalculateNDiv( 2*mpara->GetXHalfLength(), width, offset );
}
else if( divType == DivNDIV )
{
G4Para* mpara = (G4Para*)(msolid);
fwidth = CalculateWidth( 2*mpara->GetXHalfLength(), nDiv, offset );
}
@@ -145,19 +184,18 @@ G4ParameterisationParaY::
G4ParameterisationParaY( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationPara( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionParaY" );
G4Para* mpara = (G4Para*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Para* mpara = (G4Para*)(msolid);
fnDiv = CalculateNDiv( 2*mpara->GetYHalfLength(), width, offset );
}
else if( divType == DivNDIV )
{
G4Para* mpara = (G4Para*)(msolid);
fwidth = CalculateWidth( 2*mpara->GetYHalfLength(), nDiv, offset );
}
@@ -248,19 +286,18 @@ G4ParameterisationParaZ::
G4ParameterisationParaZ( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationPara( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionParaZ" );
G4Para* mpara = (G4Para*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Para* mpara = (G4Para*)(msolid);
fnDiv = CalculateNDiv( 2*mpara->GetZHalfLength(), width, offset );
}
else if( divType == DivNDIV )
{
G4Para* mpara = (G4Para*)(msolid);
fwidth = CalculateWidth( 2*mpara->GetZHalfLength(), nDiv, offset );
}
@@ -296,7 +333,7 @@ ComputeTransformation( const G4int copyNo, G4VPhysicalVolume *physVol ) const
G4double mdz = msol->GetZHalfLength( );
//----- translation
G4double posi = -mdz + foffset + (copyNo+0.5)*fwidth;
G4double posi = -mdz + OffsetZ() + (copyNo+0.5)*fwidth;
G4ThreeVector symAxis = msol->GetSymAxis();
G4ThreeVector origin( symAxis * posi / symAxis.z() );
@@ -21,12 +21,13 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationPolycone.cc,v 1.7 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationPolycone.cc,v 1.9 2004/05/17 07:20:41 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4ParameterisationPolycone Implementation file
//
// 26.05.03 - P.Arce Initial version
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
//---------------------------------------------------------------------
#include "G4ParameterisationPolycone.hh"
@@ -36,18 +37,64 @@
#include "G4RotationMatrix.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4ReflectedSolid.hh"
//-----------------------------------------------------------------------
G4VParameterisationPolycone::
G4VParameterisationPolycone( EAxis axis, G4int nDiv, G4double width,
G4double offset, G4VSolid* msolid,
DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
{
G4Polycone* msol = (G4Polycone*)(msolid);
if (msolid->GetEntityType() == "G4ReflectedSolid")
{
// Get constituent solid
G4VSolid* mConstituentSolid
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
msol = (G4Polycone*)(mConstituentSolid);
// Get parameters
G4int nofZplanes = msol->GetOriginalParameters()->Num_z_planes;
G4double* zValues = msol->GetOriginalParameters()->Z_values;
G4double* rminValues = msol->GetOriginalParameters()->Rmin;
G4double* rmaxValues = msol->GetOriginalParameters()->Rmax;
// Invert z values
G4double* zValuesRefl = new double[nofZplanes];
for (G4int i=0; i<nofZplanes; i++) zValuesRefl[i] = - zValues[i];
G4Polycone* newSolid
= new G4Polycone(msol->GetName(),
msol->GetStartPhi(),
msol->GetEndPhi() - msol->GetStartPhi(),
nofZplanes, zValuesRefl, rminValues, rmaxValues);
delete [] zValuesRefl;
msol = newSolid;
fmotherSolid = newSolid;
fReflectedSolid = true;
fDeleteSolid = true;
}
}
//---------------------------------------------------------------------
G4VParameterisationPolycone::~G4VParameterisationPolycone()
{
}
//---------------------------------------------------------------------
G4ParameterisationPolyconeRho::
G4ParameterisationPolyconeRho( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationPolycone( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionPolyconeRho" );
G4Polycone* msol = (G4Polycone*)(msolid);
G4Polycone* msol = (G4Polycone*)(fmotherSolid);
G4PolyconeHistorical* origparamMother = msol->GetOriginalParameters();
if( divType == DivWIDTH )
@@ -190,12 +237,12 @@ G4ParameterisationPolyconePhi::
G4ParameterisationPolyconePhi( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationPolycone( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionPolyconePhi" );
G4Polycone* msol = (G4Polycone*)(msolid);
G4Polycone* msol = (G4Polycone*)(fmotherSolid);
G4double deltaPhi = msol->GetEndPhi() - msol->GetStartPhi();
if( divType == DivWIDTH )
@@ -296,12 +343,13 @@ G4ParameterisationPolyconeZ::
G4ParameterisationPolyconeZ( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType)
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationPolycone( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionPolyconeZ" );
G4Polycone* msol = (G4Polycone*)(msolid);
G4Polycone* msol = (G4Polycone*)(fmotherSolid);
G4PolyconeHistorical* origparamMother = msol->GetOriginalParameters();
if( divType == DivWIDTH )
@@ -338,8 +386,8 @@ G4double G4ParameterisationPolyconeZ::GetMaxParameter() const
{
G4Polycone* msol = (G4Polycone*)(fmotherSolid);
G4PolyconeHistorical* origparamMother = msol->GetOriginalParameters();
return (origparamMother->Z_values[origparamMother->Num_z_planes-1]
-origparamMother->Z_values[0]);
return abs (origparamMother->Z_values[origparamMother->Num_z_planes-1]
-origparamMother->Z_values[0]);
}
//---------------------------------------------------------------------
@@ -21,13 +21,14 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationPolyhedra.cc,v 1.6 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationPolyhedra.cc,v 1.8 2004/05/17 07:20:41 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4ParameterisationPolyhedra Implementation file
//
// 14.10.03 - P.Arce Initial version
//---------------------------------------------------------------------
// 14.10.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#include "G4ParameterisationPolyhedra.hh"
@@ -36,19 +37,92 @@
#include "G4RotationMatrix.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4ReflectedSolid.hh"
#include "G4Polyhedra.hh"
//--------------------------------------------------------------------------
G4VParameterisationPolyhedra::
G4VParameterisationPolyhedra( EAxis axis, G4int nDiv, G4double width,
G4double offset, G4VSolid* msolid,
DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
{
G4Polyhedra* msol = (G4Polyhedra*)(msolid);
if (msolid->GetEntityType() == "G4ReflectedSolid")
{
// Get constituent solid
G4VSolid* mConstituentSolid
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
msol = (G4Polyhedra*)(mConstituentSolid);
// Get parameters
G4int nofSides = msol->GetOriginalParameters()->numSide;
G4int nofZplanes = msol->GetOriginalParameters()->Num_z_planes;
G4double* zValues = msol->GetOriginalParameters()->Z_values;
G4double* rminValues = msol->GetOriginalParameters()->Rmin;
G4double* rmaxValues = msol->GetOriginalParameters()->Rmax;
// Invert z values,
// convert radius parameters
G4double* rminValues2 = new G4double[nofZplanes];
G4double* rmaxValues2 = new G4double[nofZplanes];
G4double* zValuesRefl = new G4double[nofZplanes];
for (G4int i=0; i<nofZplanes; i++)
{
rminValues2[i] = rminValues[i] * ConvertRadiusFactor(*msol);
rmaxValues2[i] = rmaxValues[i] * ConvertRadiusFactor(*msol);
zValuesRefl[i] = - zValues[i];
}
G4Polyhedra* newSolid
= new G4Polyhedra(msol->GetName(),
msol->GetStartPhi(),
msol->GetEndPhi() - msol->GetStartPhi(),
nofSides,
nofZplanes, zValuesRefl, rminValues2, rmaxValues2);
delete [] rminValues2;
delete [] rmaxValues2;
delete [] zValuesRefl;
msol = newSolid;
fmotherSolid = newSolid;
fReflectedSolid = true;
fDeleteSolid = true;
}
}
//------------------------------------------------------------------------
G4VParameterisationPolyhedra::~G4VParameterisationPolyhedra()
{
}
//--------------------------------------------------------------------------
G4double
G4VParameterisationPolyhedra::
ConvertRadiusFactor(const G4Polyhedra& phedra) const
{
G4double phiTotal = phedra.GetEndPhi() - phedra.GetStartPhi();
G4int nofSides = phedra.GetOriginalParameters()->numSide;
if ( (phiTotal <=0) || (phiTotal > 2*M_PI+kAngTolerance) )
phiTotal = 2*M_PI;
return cos(0.5*phiTotal/nofSides);
}
//--------------------------------------------------------------------------
G4ParameterisationPolyhedraRho::
G4ParameterisationPolyhedraRho( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionPolyhedraRho" );
G4Polyhedra* msol = (G4Polyhedra*)(msolid);
G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
G4PolyhedraHistorical* original_pars = msol->GetOriginalParameters();
if( divType == DivWIDTH )
@@ -190,12 +264,12 @@ G4ParameterisationPolyhedraPhi::
G4ParameterisationPolyhedraPhi( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionPolyhedraPhi" );
G4Polyhedra* msol = (G4Polyhedra*)(msolid);
G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
G4double deltaPhi = msol->GetEndPhi() - msol->GetStartPhi();
if( divType == DivWIDTH )
@@ -345,12 +419,12 @@ G4ParameterisationPolyhedraZ::
G4ParameterisationPolyhedraZ( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationPolyhedra( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionPolyhedraZ" );
G4Polyhedra* msol = (G4Polyhedra*)(msolid);
G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
if( divType == DivWIDTH )
@@ -387,8 +461,8 @@ G4double G4ParameterisationPolyhedraZ::GetMaxParameter() const
{
G4Polyhedra* msol = (G4Polyhedra*)(fmotherSolid);
G4PolyhedraHistorical* origparamMother = msol->GetOriginalParameters();
return (origparamMother->Z_values[origparamMother->Num_z_planes-1]
-origparamMother->Z_values[0]);
return abs (origparamMother->Z_values[origparamMother->Num_z_planes-1]
-origparamMother->Z_values[0]);
}
//---------------------------------------------------------------------
@@ -21,13 +21,14 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationTrd.cc,v 1.8 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationTrd.cc,v 1.10 2004/05/17 07:20:41 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4ParameterisationTrd Implementation file
//
// 26.05.03 - P.Arce Initial version
// ********************************************************************
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#include "G4ParameterisationTrd.hh"
@@ -36,29 +37,62 @@
#include "G4RotationMatrix.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4ReflectedSolid.hh"
#include "G4Trd.hh"
#include "G4Trap.hh"
//--------------------------------------------------------------------------
G4VParameterisationTrd::
G4VParameterisationTrd( EAxis axis, G4int nDiv, G4double width,
G4double offset, G4VSolid* msolid,
DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
{
G4Trd* msol = (G4Trd*)(msolid);
if (msolid->GetEntityType() == "G4ReflectedSolid")
{
// Get constituent solid
G4VSolid* mConstituentSolid
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
msol = (G4Trd*)(mConstituentSolid);
// Create a new solid with inversed parameters
G4Trd* newSolid
= new G4Trd(msol->GetName(),
msol->GetXHalfLength2(), msol->GetXHalfLength1(),
msol->GetYHalfLength2(), msol->GetYHalfLength1(),
msol->GetZHalfLength());
msol = newSolid;
fmotherSolid = newSolid;
fReflectedSolid = true;
fDeleteSolid = true;
}
}
//------------------------------------------------------------------------
G4VParameterisationTrd::~G4VParameterisationTrd()
{
}
//------------------------------------------------------------------------
G4ParameterisationTrdX::
G4ParameterisationTrdX( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationTrd( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionTrdX" );
G4Trd* msol = (G4Trd*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Trd* mtrd = (G4Trd*)(msolid);
fnDiv = CalculateNDiv( 2*mtrd->GetXHalfLength1(),
fnDiv = CalculateNDiv( 2*msol->GetXHalfLength1(),
width, offset );
}
else if( divType == DivNDIV )
{
G4Trd* mtrd = (G4Trd*)(msolid);
fwidth = CalculateWidth( 2*mtrd->GetXHalfLength1(), nDiv, offset );
fwidth = CalculateWidth( 2*msol->GetXHalfLength1(), nDiv, offset );
}
#ifdef G4DIVDEBUG
@@ -175,21 +209,20 @@ G4ParameterisationTrdY::
G4ParameterisationTrdY( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType)
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationTrd( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionTrdY" );
G4Trd* msol = (G4Trd*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Trd* mtrd = (G4Trd*)(msolid);
fnDiv = CalculateNDiv( 2*mtrd->GetYHalfLength1(),
fnDiv = CalculateNDiv( 2*msol->GetYHalfLength1(),
width, offset );
}
else if( divType == DivNDIV )
{
G4Trd* mtrd = (G4Trd*)(msolid);
fwidth = CalculateWidth( 2*mtrd->GetYHalfLength1(),
fwidth = CalculateWidth( 2*msol->GetYHalfLength1(),
nDiv, offset );
}
@@ -304,21 +337,20 @@ G4ParameterisationTrdZ::
G4ParameterisationTrdZ( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationTrd( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivTrdZ" );
G4Trd* msol = (G4Trd*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Trd* mtrd = (G4Trd*)(msolid);
fnDiv = CalculateNDiv( 2*mtrd->GetZHalfLength(),
fnDiv = CalculateNDiv( 2*msol->GetZHalfLength(),
width, offset );
}
else if( divType == DivNDIV )
{
G4Trd* mtrd = (G4Trd*)(msolid);
fwidth = CalculateWidth( 2*mtrd->GetZHalfLength(),
fwidth = CalculateWidth( 2*msol->GetZHalfLength(),
nDiv, offset );
}
@@ -355,7 +387,7 @@ ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const
//----- translation
G4ThreeVector origin(0.,0.,0.);
G4double posi = -mdz + foffset + (copyNo+0.5)*fwidth;
G4double posi = -mdz + OffsetZ() + (copyNo+0.5)*fwidth;
if( faxis == kZAxis )
{
origin.setZ( posi );
@@ -397,10 +429,10 @@ ComputeDimensions(G4Trd& trd, const G4int copyNo,
G4double pDz = fwidth/2.;
G4double zLength = 2*msol->GetZHalfLength();
trd.SetAllParameters ( pDx1+DDx*(foffset+copyNo*fwidth)/zLength,
pDx1+DDx*(foffset+(copyNo+1)*fwidth)/zLength,
pDy1+DDy*(foffset+copyNo*fwidth)/zLength,
pDy1+DDy*(foffset+(copyNo+1)*fwidth)/zLength, pDz );
trd.SetAllParameters( pDx1+DDx*(OffsetZ()+copyNo*fwidth)/zLength,
pDx1+DDx*(OffsetZ()+(copyNo+1)*fwidth)/zLength,
pDy1+DDy*(OffsetZ()+copyNo*fwidth)/zLength,
pDy1+DDy*(OffsetZ()+(copyNo+1)*fwidth)/zLength, pDz );
#ifdef G4DIVDEBUG
if( verbose >= 1 )
@@ -21,13 +21,14 @@
// ********************************************************************
//
//
// $Id: G4ParameterisationTubs.cc,v 1.5 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParameterisationTubs.cc,v 1.7 2004/05/17 07:20:41 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4ParameterisationTubs Implementation file
//
// 26.05.03 - P.Arce Initial version
// ********************************************************************
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#include "G4ParameterisationTubs.hh"
@@ -36,27 +37,51 @@
#include "G4RotationMatrix.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4ReflectedSolid.hh"
#include "G4Tubs.hh"
//--------------------------------------------------------------------------
G4VParameterisationTubs::
G4VParameterisationTubs( EAxis axis, G4int nDiv, G4double width,
G4double offset, G4VSolid* msolid,
DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
{
G4Tubs* msol = (G4Tubs*)(msolid);
if (msolid->GetEntityType() == "G4ReflectedSolid")
{
//----- get constituent solid
G4VSolid* mConstituentSolid
= ((G4ReflectedSolid*)msolid)->GetConstituentMovedSolid();
msol = (G4Tubs*)(mConstituentSolid);
fmotherSolid = msol;
fReflectedSolid = true;
}
}
//------------------------------------------------------------------------
G4VParameterisationTubs::~G4VParameterisationTubs()
{
}
//--------------------------------------------------------------------------
G4ParameterisationTubsRho::
G4ParameterisationTubsRho( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionTubsRho" );
G4Tubs* msol = (G4Tubs*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Tubs* msol = (G4Tubs*)(msolid);
fnDiv = CalculateNDiv( msol->GetOuterRadius() - msol->GetInnerRadius(),
width, offset );
}
else if( divType == DivNDIV )
{
G4Tubs* msol = (G4Tubs*)(msolid);
fwidth = CalculateWidth( msol->GetOuterRadius() - msol->GetInnerRadius(),
nDiv, offset );
}
@@ -155,19 +180,18 @@ G4ParameterisationTubsPhi::
G4ParameterisationTubsPhi( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionTubsPhi" );
G4Tubs* msol = (G4Tubs*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Tubs* msol = (G4Tubs*)(msolid);
fnDiv = CalculateNDiv( msol->GetDeltaPhiAngle(), width, offset );
}
else if( divType == DivNDIV )
{
G4Tubs* msol = (G4Tubs*)(msolid);
fwidth = CalculateWidth( msol->GetDeltaPhiAngle(), nDiv, offset );
}
@@ -265,18 +289,18 @@ G4ParameterisationTubsZ::
G4ParameterisationTubsZ( EAxis axis, G4int nDiv,
G4double width, G4double offset,
G4VSolid* msolid, DivisionType divType )
: G4VDivisionParameterisation( axis, nDiv, width, offset, divType, msolid )
: G4VParameterisationTubs( axis, nDiv, width, offset, msolid, divType )
{
CheckParametersValidity();
SetType( "DivisionTubsZ" );
G4Tubs* msol = (G4Tubs*)(fmotherSolid);
if( divType == DivWIDTH )
{
G4Tubs* msol = (G4Tubs*)(msolid);
fnDiv = CalculateNDiv( 2*msol->GetZHalfLength(), width, offset );
}
else if( divType == DivNDIV )
{
G4Tubs* msol = (G4Tubs*)(msolid);
fwidth = CalculateWidth( 2*msol->GetZHalfLength(), nDiv, offset );
}
@@ -310,7 +334,7 @@ ComputeTransformation(const G4int copyNo, G4VPhysicalVolume *physVol) const
{
//----- set translation: along Z axis
G4Tubs* motherTubs = (G4Tubs*)(fmotherSolid);
G4double posi = - motherTubs->GetZHalfLength() + foffset
G4double posi = - motherTubs->GetZHalfLength() + OffsetZ()
+ fwidth/2 + copyNo*fwidth;
G4ThreeVector origin(0.,0.,posi);
physVol->SetTranslation( origin );
@@ -21,18 +21,20 @@
// ********************************************************************
//
//
// $Id: G4VDivisionParameterisation.cc,v 1.8 2003/11/19 11:51:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4VDivisionParameterisation.cc,v 1.10 2004/05/17 07:20:42 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4VDivisionParameterisation Implementation file
//
// 26.05.03 - P.Arce Initial version
// ********************************************************************
// 26.05.03 - P.Arce, Initial version
// 08.04.04 - I.Hrivnacova, Implemented reflection
// --------------------------------------------------------------------
#include "G4VDivisionParameterisation.hh"
#include "G4VSolid.hh"
#include "G4VPhysicalVolume.hh"
#include "G4RotationMatrix.hh"
#include "G4ReflectedSolid.hh"
G4int G4VDivisionParameterisation::verbose = 5;
@@ -41,8 +43,9 @@ G4VDivisionParameterisation::
G4VDivisionParameterisation( EAxis axis, G4int nDiv,
G4double step, G4double offset,
DivisionType divType, G4VSolid* motherSolid )
: faxis(axis), fnDiv( nDiv), fwidth(step),
foffset(offset), fDivisionType(divType), fmotherSolid( motherSolid )
: faxis(axis), fnDiv( nDiv), fwidth(step), foffset(offset),
fDivisionType(divType), fmotherSolid( motherSolid ), fReflectedSolid(false),
fDeleteSolid(false)
{
#ifdef G4DIVDEBUG
if (verbose >= 1)
@@ -60,8 +63,22 @@ G4VDivisionParameterisation( EAxis axis, G4int nDiv,
//--------------------------------------------------------------------------
G4VDivisionParameterisation::~G4VDivisionParameterisation()
{
if (fDeleteSolid) delete fmotherSolid;
}
//--------------------------------------------------------------------------
G4VSolid*
G4VDivisionParameterisation::
ComputeSolid( const G4int i, G4VPhysicalVolume* pv )
{
G4VSolid* solid = G4VPVParameterisation::ComputeSolid(i, pv);
if (solid->GetEntityType() == "G4ReflectedSolid")
{
solid = ((G4ReflectedSolid*)solid)->GetConstituentMovedSolid();
}
return solid;
}
//--------------------------------------------------------------------------
void
G4VDivisionParameterisation::
@@ -149,3 +166,15 @@ void G4VDivisionParameterisation::CheckNDivAndWidth( G4double maxPar )
"Not supported configuration.");
}
}
//--------------------------------------------------------------------------
G4double G4VDivisionParameterisation::OffsetZ() const
{
// take into account reflection in the offset
G4double offset = foffset;
if (fReflectedSolid) offset = GetMaxParameter() - fwidth*fnDiv - foffset;
return offset;
}
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.3 2002/01/10 15:56:30 gcosmo Exp $
# $Id: GNUmakefile,v 1.4 2004/06/11 14:17:14 gcosmo Exp $
# -----------------------------------------------------------------------
# GNUmakefile for geometry/management library. Gabriele Cosmo, 16/11/96.
# -----------------------------------------------------------------------
@@ -11,6 +11,7 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4GEOM_ALLOC_EXPORT
CPPFLAGS += -I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/global/management/include \
+8 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.66 2003/12/01 14:54:14 gcosmo Exp $
$Id: History,v 1.67 2004/05/13 14:54:15 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,13 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
May 07, 2004 G.Cosmo geommng-V06-01-00
- Imported G4ReflectedSolid class from solids/Boolean.
- Added abstract factory G4VPVDivisionFactory defining interfaces
for the creation of volumes divisions (courtesy of I.Hrivnacova).
- Coworks with tags: geomvol-V06-01-00, geomdiv-V06-01-00 and
geom-bool-V06-01-00.
Dec 01, 2003 P.Gumplinger geommng-V05-02-05
- G4LogicalSurface[.hh.icc]: modified to use G4SurfaceProperty instead
of G4OpticalSurface. Requires tag "materials-V05-02-00".
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ReflectedSolid.hh,v 1.8 2003/11/03 17:48:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ReflectedSolid.hh,v 1.1 2004/05/13 14:49:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// class G4ReflectedSolid
@@ -36,7 +36,6 @@
//
// 23.07.01 V.Grichine: created
// 15.02.02 V.Grichine: get/set methods for fPtr(Direct)Transform3D
//
// --------------------------------------------------------------------
#ifndef G4ReflectedSolid_HH
#define G4ReflectedSolid_HH
@@ -0,0 +1,102 @@
//
// ********************************************************************
// * 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: G4VPVDivisionFactory.hh,v 1.1 2004/05/13 14:53:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// class G4VPVDivisionFactory
//
// Class description:
//
// Abstract factory that defines interfaces for creating
// volumes divisions.
// Author: Ivana Hrivnacova, 4.5.2004 (Ivana.Hrivnacova@cern.ch)
// ------------------------------------------------------------------------
#ifndef G4VPVDIVISION_FACTORY_HH
#define G4VPVDIVISION_FACTORY_HH
#include "geomdefs.hh"
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4VPVParameterisation;
class G4VPVDivisionFactory
{
public: // with description
virtual ~G4VPVDivisionFactory();
static G4VPVDivisionFactory* Instance();
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMother,
const EAxis pAxis,
const G4int nReplicas,
const G4double width,
const G4double offset ) = 0;
// Create division - with number of divisions and width.
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4int nReplicas,
const G4double offset ) = 0;
// Create division - with number of divisions.
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const EAxis pAxis,
const G4double width,
const G4double offset ) = 0;
// Create division - with width.
virtual G4VPhysicalVolume* CreatePVDivision(
const G4String& pName,
G4LogicalVolume* pLogical,
G4LogicalVolume* pMotherLogical,
const G4VPVParameterisation* param) = 0;
// Create division - with parameterisation.
virtual G4bool IsPVDivision(const G4VPhysicalVolume* pv) const = 0;
// Returns true if pv is division.
protected:
G4VPVDivisionFactory();
protected:
static G4VPVDivisionFactory* fgInstance;
};
#endif
@@ -21,9 +21,9 @@
// ********************************************************************
//
//
// $Id: G4ReflectedSolid.cc,v 1.14 2003/12/01 09:32:05 gcosmo Exp $
// $Id: G4ReflectedSolid.cc,v 1.1 2004/05/13 14:49:42 gcosmo Exp $
//
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-06-02 $
//
// Implementation for G4ReflectedSolid class for boolean
// operations between other solids
@@ -0,0 +1,59 @@
//
// ********************************************************************
// * 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: G4VPVDivisionFactory.cc,v 1.1 2004/05/13 14:53:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
// class G4VPVDivisionFactory Implementation file
//
// Author: Ivana Hrivnacova, 4.5.2004 (Ivana.Hrivnacova@cern.ch)
// ------------------------------------------------------------------------
#include "G4VPVDivisionFactory.hh"
G4VPVDivisionFactory* G4VPVDivisionFactory::fgInstance = 0;
//_____________________________________________________________________________
G4VPVDivisionFactory* G4VPVDivisionFactory::Instance()
{
// Static singleton access method.
// ---
return fgInstance;
}
//_____________________________________________________________________________
G4VPVDivisionFactory::G4VPVDivisionFactory()
{
// Protected singleton constructor.
// ---
// fgInstance = this;
}
//_____________________________________________________________________________
G4VPVDivisionFactory::~G4VPVDivisionFactory()
{
}
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.1 2003/10/01 14:51:38 gcosmo Exp $
# $Id: GNUmakefile,v 1.2 2004/06/11 14:17:15 gcosmo Exp $
# --------------------------------------------------------------------
# GNUmakefile for geometry/volumes library. Gabriele Cosmo, 16/11/96.
# --------------------------------------------------------------------
@@ -11,6 +11,7 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4GEOM_ALLOC_EXPORT
CPPFLAGS += -I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/intercoms/include \
-I$(G4BASE)/global/management/include \
+24 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.22 2004/03/11 13:17:42 gcosmo Exp $
$Id: History,v 1.28 2004/06/18 12:45:10 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,29 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Jun 18th, 2004 - G.Cosmo (geomnav-V06-01-03)
------------------------
- Enhanced check for null step in G4Navigator::ComputeStep().
Now attempting a corrective action after 10 consecutive zero steps.
Event gets aborted after 25 zero steps.
Jun 15th, 2004 - G.Cosmo (geomnav-V06-01-02)
------------------------
- Relax exception in G4Navigator::ComputeStep() for stuck tracks.
Event gets aborted after 25 zero steps.
Jun 11th, 2004 - G.Cosmo (geomnav-V06-01-01)
------------------------
- Added check to G4Navigator to count the number of steps with zero length
and issue an exception for tracks that get stuck in a loop (J.Apostolakis).
- Modified GNUmakefile to define G4GEOMETRY_ALLOC_EXPORT flag for DLLs
build on Windows.
May 17th, 2004 - G.Cosmo (geomnav-V06-01-00)
------------------------
- Added more verbosity on solids response for navigators (optimised/not
optimised) if "check_mode" state is combined with verbose level-1.
Mar 11th, 2004 - G.Cosmo (geomnav-V06-00-02)
------------------------
- Added "check_mode" state for navigators. The state can be activated by
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Navigator.hh,v 1.5 2004/03/10 18:21:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4Navigator.hh,v 1.8 2004/06/18 12:47:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// class G4Navigator
@@ -355,22 +355,32 @@ class G4Navigator
G4ThreeVector fGrandMotherExitNormal; // Leaving volume normal, in its
// own coordinate system
G4NavigationHistory fHistory;
// Transformation & `path' history
// of current path through geomtrical
// hierarchy
// Transformation & `path' history of current path
// through geomtrical hierarchy
G4bool fLastStepWasZero;
// Whether the last ComputeStep moved Zero
// Used to check for edges.
G4bool fLocatedOnEdge;
// Whether the Navigator has detected an edge
// Count zero steps - as one or two can occur due to changing momentum at
// a boundary or at an edge common between volumes
// - several are likely a problem in the geometry
// description or in the navigation
//
G4bool fLastStepWasZero;
// Whether the last ComputeStep moved Zero. Used to check for edges.
G4bool fLocatedOnEdge;
// Whether the Navigator has detected an edge
G4int fNumberZeroSteps;
// Number of preceding moves that were Zero. Reset to 0 after finite step
G4int fActionThreshold_NoZeroSteps;
// After this many failed/zero steps, act (push etc)
G4int fAbandonThreshold_NoZeroSteps;
// After this many failed/zero steps, abandon track
G4ThreeVector fPreviousSftOrigin;
G4double fPreviousSafety;
// Memory of last safety origin & value.
// Used in ComputeStep to ensure that
// origin of current Step is in the same
// volume as the point of the last relocation.
// Memory of last safety origin & value. Used in ComputeStep to ensure
// that origin of current Step is in the same volume as the point of the
// last relocation
//
// END State information
//
@@ -393,6 +403,8 @@ class G4Navigator
G4bool fCheck;
// Check-mode flag [if true, more strict checks are performed].
G4bool fPushed;
// Push flag [if true, means a stuck particle has been pushed].
G4int fVerbose;
// Verbose(ness) level [if > 0, printout can occur].
+108 -22
View File
@@ -21,7 +21,7 @@
// ********************************************************************
//
//
// $Id: G4Navigator.cc,v 1.8 2004/03/11 13:09:29 gcosmo Exp $
// $Id: G4Navigator.cc,v 1.13 2004/06/18 12:47:05 gcosmo Exp $
// GEANT4 tag $ Name: $
//
// class G4Navigator Implementation
@@ -42,9 +42,12 @@
//
G4Navigator::G4Navigator()
: fWasLimitedByGeometry(false), fTopPhysical(0),
fCheck(false), fVerbose(0)
fCheck(false), fPushed(false), fVerbose(0)
{
ResetStackAndState();
fActionThreshold_NoZeroSteps = 10;
fAbandonThreshold_NoZeroSteps = 25;
}
// ********************************************************************
@@ -230,6 +233,20 @@ G4Navigator::LocateGlobalPointAndSetup( const G4ThreeVector& globalPoint,
targetSolid = fHistory.GetTopVolume()->GetLogicalVolume()->GetSolid();
localPoint = fHistory.GetTopTransform().TransformPoint(globalPoint);
insideCode = targetSolid->Inside(localPoint);
#ifdef G4VERBOSE
if(( fVerbose == 1 ) && ( fCheck ))
{
G4String solidResponse = "-kInside-";
if (insideCode == kOutside)
solidResponse = "-kOutside-";
else if (insideCode == kSurface)
solidResponse = "-kSurface-";
G4cout << "*** G4Navigator::LocateGlobalPointAndSetup(): ***" << G4endl
<< " Invoked Inside() for solid: " << targetSolid->GetName()
<< ". Solid replied: " << solidResponse << G4endl
<< " For local point p: " << localPoint << G4endl;
}
#endif
}
else
{
@@ -464,8 +481,9 @@ G4Navigator::LocateGlobalPointWithinVolume(const G4ThreeVector& pGlobalpoint)
break;
case kReplica:
G4Exception("G4Navigator::LocateGlobalPointWithinVolume()", "NotApplicable",
FatalException, "Not applicable for replicated volumes.");
G4Exception("G4Navigator::LocateGlobalPointWithinVolume()",
"NotApplicable", FatalException,
"Not applicable for replicated volumes.");
break;
}
}
@@ -550,6 +568,9 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
G4VPhysicalVolume *motherPhysical = fHistory.GetTopVolume();
G4LogicalVolume *motherLogical = motherPhysical->GetLogicalVolume();
static G4int sNavCScalls=0;
sNavCScalls++;
#ifdef G4VERBOSE
G4int oldcoutPrec= G4cout.precision(8);
G4int oldcerrPrec= G4cerr.precision(10);
@@ -759,11 +780,73 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
fPreviousSftOrigin = pGlobalpoint;
fPreviousSafety = pNewSafety;
// Edge if two consecutive steps are zero, because
// at least two candidate volumes must have been checked
// Count zero steps - one can occur due to changing momentum at a boundary
// - one, two (or a few) can occur at common edges between
// volumes
// - more than two is likely a problem in the geometry
// description or the Navigation
// Rule of thumb: likely at an Edge if two consecutive steps are zero,
// because at least two candidate volumes must have been
// checked
//
fLocatedOnEdge = fLastStepWasZero && (Step==0);
fLastStepWasZero = (Step==0);
fLocatedOnEdge = fLastStepWasZero && (Step==0.0);
fLastStepWasZero = (Step==0.0);
if (fPushed) fPushed = fLastStepWasZero;
// Handle large number of consecutive zero steps
//
if ( fLastStepWasZero )
{
fNumberZeroSteps++;
#ifdef G4DEBUG_NAVIGATION
if( fNumberZeroSteps > 1 )
{
G4cout << "G4Nav - CompStep: another zero step, # " << fNumberZeroSteps
<< " at " << pGlobalpoint
<< " in volume " << motherPhysical->GetName()
<< " nav-comp-step calls # " << sNavCScalls
<< G4endl;
}
#endif
if( (fNumberZeroSteps > fActionThreshold_NoZeroSteps-1) && (!fPushed) )
{
// Act to recover this stuck track. Pushing it once along direction
//
Step += 0.9*kCarTolerance;
fPushed = true;
#ifdef G4VERBOSE
G4cerr << "WARNING - G4Navigator::ComputeStep()" << G4endl
<< " Track stuck, not moving for "
<< fNumberZeroSteps << " steps" << G4endl
<< " in volume -" << motherPhysical->GetName()
<< "- at point " << pGlobalpoint << G4endl
<< " direction: " << pDirection << "." << G4endl
<< " Potential geometry or navigation problem !"
<< G4endl
<< " Trying pushing it of " << Step << " mm ..."
<< G4endl;
#endif
}
if( fNumberZeroSteps > fAbandonThreshold_NoZeroSteps-1 )
{
// Must kill this stuck track
//
G4cerr << "ERROR - G4Navigator::ComputeStep()" << G4endl
<< " Track stuck, not moving for "
<< fNumberZeroSteps << " steps" << G4endl
<< " in volume -" << motherPhysical->GetName()
<< "- at point " << pGlobalpoint << G4endl
<< " direction: " << pDirection << "." << G4endl;
G4Exception("G4Navigator::ComputeStep()",
"StuckTrack", EventMustBeAborted,
"Stuck Track: potential geometry or navigation problem.");
}
}
else
{
if (!fPushed) fNumberZeroSteps = 0;
}
fEnteredDaughter = fEntering; // I expect to enter a volume in this Step
fExitedMother = fExiting;
@@ -857,22 +940,25 @@ G4double G4Navigator::ComputeStep( const G4ThreeVector &pGlobalpoint,
//
void G4Navigator::ResetState()
{
fWasLimitedByGeometry=false;
fEntering=false;
fExiting=false;
fLocatedOnEdge = false;
fLastStepWasZero= false;
fEnteredDaughter = false;
fExitedMother = false;
fValidExitNormal = false;
fExitNormal = G4ThreeVector(0,0,0);
fWasLimitedByGeometry = false;
fEntering = false;
fExiting = false;
fLocatedOnEdge = false;
fLastStepWasZero = false;
fEnteredDaughter = false;
fExitedMother = false;
fPushed = false;
fPreviousSftOrigin = G4ThreeVector(0,0,0);
fPreviousSafety = 0.0;
fValidExitNormal = false;
fExitNormal = G4ThreeVector(0,0,0);
fPreviousSftOrigin = G4ThreeVector(0,0,0);
fPreviousSafety = 0.0;
fNumberZeroSteps = 0;
fBlockedPhysicalVolume=0;
fBlockedReplicaNo=-1;
fBlockedPhysicalVolume = 0;
fBlockedReplicaNo = -1;
}
// ********************************************************************
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4NormalNavigation.cc,v 1.3 2004/03/10 18:21:20 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4NormalNavigation.cc,v 1.4 2004/05/17 13:30:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// class G4NormalNavigation Implementation
@@ -86,6 +86,15 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
#ifdef G4VERBOSE
if ( fCheck )
{
if( fVerbose == 1 )
{
G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl
<< " Invoked DistanceToOut(p) for mother solid: "
<< motherSolid->GetName()
<< ". Solid replied: " << motherSafety << G4endl
<< " For local point p: " << localPoint << G4endl
<< " To be considered as 'mother safety'." << G4endl;
}
if ( motherSafety < 0.0 )
{
G4cerr << "ERROR - G4NormalNavigation::ComputeStep()" << G4endl
@@ -160,6 +169,18 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
sampleDirection = sampleTf.TransformAxis(localDirection);
const G4double sampleStep =
sampleSolid->DistanceToIn(samplePoint,sampleDirection);
#ifdef G4VERBOSE
if(( fCheck ) && ( fVerbose == 1 ))
{
G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl
<< " Invoked DistanceToIn(p,v) for daughter solid: "
<< sampleSolid->GetName()
<< ". Solid replied: " << sampleStep << G4endl
<< " For local point p: " << samplePoint << G4endl
<< " Direction v: " << sampleDirection
<< ", to be considered as 'daughter step'." << G4endl;
}
#endif
if ( sampleStep<=ourStep )
{
ourStep = sampleStep;
@@ -177,6 +198,20 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
G4ThreeVector intersectionPoint;
intersectionPoint= samplePoint + sampleStep * sampleDirection;
EInside insideIntPt= sampleSolid->Inside(intersectionPoint);
G4String solidResponse = "-kInside-";
if (insideIntPt == kOutside)
solidResponse = "-kOutside-";
else if (insideIntPt == kSurface)
solidResponse = "-kSurface-";
if( fVerbose == 1 )
{
G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl
<< " Invoked Inside() for solid: "
<< sampleSolid->GetName()
<< ". Solid replied: " << solidResponse << G4endl
<< " For point p: " << intersectionPoint
<< ", considered as 'intersection' point." << G4endl;
}
if ( insideIntPt != kSurface )
{
G4int oldcoutPrec = G4cout.precision(16);
@@ -184,14 +219,8 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
<< " Inaccurate DistanceToIn for solid "
<< sampleSolid->GetName() << G4endl;
G4cout << " Solid gave DistanceToIn = " << sampleStep
<< " yet returns " ;
if ( insideIntPt == kInside )
G4cout << "-kInside-";
else if ( insideIntPt == kOutside )
G4cout << "-kOutside-";
else
G4cout << "-kSurface-";
G4cout << " for this point !" << G4endl;
<< " yet returns " << solidResponse
<< " for this point !" << G4endl;
G4cout << " Point = " << intersectionPoint << G4endl;
if ( insideIntPt != kInside )
G4cout << " DistanceToIn(p) = "
@@ -233,7 +262,18 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
&validExitNormal,
&exitNormal);
#ifdef G4VERBOSE
if ( fCheck )
if ( fCheck )
{
if( fVerbose == 1 )
{
G4cout << "*** G4NormalNavigation::ComputeStep(): ***" << G4endl
<< " Invoked DistanceToOut(p,v,...) for mother solid: "
<< motherSolid->GetName()
<< ". Solid replied: " << motherStep << G4endl
<< " For local point p: " << localPoint << G4endl
<< " Direction v: " << localDirection
<< ", to be considered as 'mother step'." << G4endl;
}
if( ( motherStep < 0.0 ) || ( motherStep >= kInfinity) )
{
G4cerr << "ERROR - G4NormalNavigation::ComputeStep()" << G4endl
@@ -246,6 +286,7 @@ G4NormalNavigation::ComputeStep(const G4ThreeVector &localPoint,
"PointDistOutInvalid", FatalException,
"Current point is outside the current solid !");
}
}
#endif
if ( motherStep<=ourStep )
@@ -295,6 +336,18 @@ G4double G4NormalNavigation::ComputeSafety(const G4ThreeVector &localPoint,
motherSafety = motherSolid->DistanceToOut(localPoint);
ourSafety = motherSafety; // Working isotropic safety
#ifdef G4VERBOSE
if(( fCheck ) && ( fVerbose == 1 ))
{
G4cout << "*** G4NormalNavigation::ComputeSafety(): ***" << G4endl
<< " Invoked DistanceToOut(p) for mother solid: "
<< motherSolid->GetName()
<< ". Solid replied: " << motherSafety << G4endl
<< " For local point p: " << localPoint
<< ", to be considered as 'mother safety'." << G4endl;
}
#endif
// Compute daughter safeties
//
localNoDaughters = motherLogical->GetNoDaughters();
@@ -314,6 +367,17 @@ G4double G4NormalNavigation::ComputeSafety(const G4ThreeVector &localPoint,
{
ourSafety = sampleSafety;
}
#ifdef G4VERBOSE
if(( fCheck ) && ( fVerbose == 1 ))
{
G4cout << "*** G4NormalNavigation::ComputeSafety(): ***" << G4endl
<< " Invoked DistanceToIn(p) for daughter solid: "
<< sampleSolid->GetName()
<< ". Solid replied: " << sampleSafety << G4endl
<< " For local point p: " << samplePoint
<< ", to be considered as 'daughter safety'." << G4endl;
}
#endif
}
return ourSafety;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VoxelNavigation.cc,v 1.3 2004/03/10 18:21:20 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-01 $
// $Id: G4VoxelNavigation.cc,v 1.4 2004/05/17 13:30:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// class G4VoxelNavigation Implementation
@@ -104,6 +104,15 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
#ifdef G4VERBOSE
if ( fCheck )
{
if(fVerbose == 1 )
{
G4cout << "*** G4VoxelNavigation::ComputeStep(): ***" << G4endl
<< " Invoked DistanceToOut(p) for mother solid: "
<< motherSolid->GetName()
<< ". Solid replied: " << motherSafety << G4endl
<< " For local point p: " << localPoint
<< ", to be considered as 'mother safety'." << G4endl;
}
if( motherSafety < 0.0 )
{
G4cout << "ERROR - G4VoxelNavigation::ComputeStep()" << G4endl
@@ -184,6 +193,17 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
samplePhysical->GetLogicalVolume()->GetSolid();
const G4double sampleSafety =
sampleSolid->DistanceToIn(samplePoint);
#ifdef G4VERBOSE
if(( fCheck ) && ( fVerbose == 1 ))
{
G4cout << "*** G4VoxelNavigation::ComputeStep(): ***" << G4endl
<< " Invoked DistanceToIn(p) for daughter solid: "
<< sampleSolid->GetName()
<< ". Solid replied: " << sampleSafety << G4endl
<< " For local point p: " << samplePoint
<< ", to be considered as 'daughter safety'." << G4endl;
}
#endif
if ( sampleSafety<ourSafety )
{
ourSafety = sampleSafety;
@@ -193,6 +213,18 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
sampleDirection = sampleTf.TransformAxis(localDirection);
G4double sampleStep =
sampleSolid->DistanceToIn(samplePoint, sampleDirection);
#ifdef G4VERBOSE
if(( fCheck ) && ( fVerbose == 1 ))
{
G4cout << "*** G4VoxelNavigation::ComputeStep(): ***" << G4endl
<< " Invoked DistanceToIn(p,v) for daughter solid: "
<< sampleSolid->GetName()
<< ". Solid replied: " << sampleStep << G4endl
<< " For local point p: " << samplePoint << G4endl
<< " Direction v: " << sampleDirection
<< ", to be considered as 'daughter step'." << G4endl;
}
#endif
if ( sampleStep<=ourStep )
{
ourStep = sampleStep;
@@ -210,6 +242,20 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
G4ThreeVector intersectionPoint;
intersectionPoint= samplePoint + sampleStep * sampleDirection;
EInside insideIntPt= sampleSolid->Inside(intersectionPoint);
G4String solidResponse = "-kInside-";
if (insideIntPt == kOutside)
solidResponse = "-kOutside-";
else if (insideIntPt == kSurface)
solidResponse = "-kSurface-";
if( fVerbose == 1 )
{
G4cout << "*** G4VoxelNavigation::ComputeStep(): ***"<<G4endl
<< " Invoked Inside() for solid: "
<< sampleSolid->GetName()
<< ". Solid replied: " << solidResponse << G4endl
<< " For point p: " << intersectionPoint
<< ", considered as 'intersection' point." << G4endl;
}
if( insideIntPt != kSurface )
{
G4int oldcoutPrec = G4cout.precision(16);
@@ -218,14 +264,8 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
<< " Inaccurate solid DistanceToIn"
<< " for solid " << sampleSolid->GetName() << G4endl;
G4cout << " Solid gave DistanceToIn = "
<< sampleStep << " yet returns " ;
if( insideIntPt == kInside )
G4cout << "-kInside-";
else if( insideIntPt == kOutside )
G4cout << "-kOutside-";
else
G4cout << "-kSurface-";
G4cout << " for this point !" << G4endl;
<< sampleStep << " yet returns " << solidResponse
<< " for this point !" << G4endl;
G4cout << " Point = " << intersectionPoint << G4endl;
if ( insideIntPt != kInside )
G4cout << " DistanceToIn(p) = "
@@ -277,7 +317,18 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
localDirection,
true, &validExitNormal, &exitNormal);
#ifdef G4VERBOSE
if ( fCheck )
if ( fCheck )
{
if(fVerbose == 1)
{
G4cout << "*** G4VoxelNavigation::ComputeStep(): ***" << G4endl
<< " Invoked DistanceToOut(p,v,...) for mother solid: "
<< motherSolid->GetName()
<< ". Solid replied: " << motherStep << G4endl
<< " For local point p: " << localPoint << G4endl
<< " Direction v: " << localDirection
<< ", to be considered as 'mother step'." << G4endl;
}
if( ( motherStep < 0.0 ) || ( motherStep >= kInfinity) )
{
G4int oldPrOut= G4cout.precision(16);
@@ -294,6 +345,7 @@ G4VoxelNavigation::ComputeStep( const G4ThreeVector& localPoint,
G4cout.precision(oldPrOut);
G4cerr.precision(oldPrErr);
}
}
#endif
if ( motherStep<=ourStep )
{
@@ -620,6 +672,17 @@ G4VoxelNavigation::ComputeSafety(const G4ThreeVector& localPoint,
motherSafety = motherSolid->DistanceToOut(localPoint);
ourSafety = motherSafety; // Working isotropic safety
#ifdef G4VERBOSE
if(( fCheck ) && ( fVerbose == 1 ))
{
G4cout << "*** G4VoxelNavigation::ComputeSafety(): ***" << G4endl
<< " Invoked DistanceToOut(p) for mother solid: "
<< motherSolid->GetName()
<< ". Solid replied: " << motherSafety << G4endl
<< " For local point p: " << localPoint
<< ", to be considered as 'mother safety'." << G4endl;
}
#endif
//
// Compute daughter safeties
//
@@ -648,6 +711,17 @@ G4VoxelNavigation::ComputeSafety(const G4ThreeVector& localPoint,
{
ourSafety = sampleSafety;
}
#ifdef G4VERBOSE
if(( fCheck ) && ( fVerbose == 1 ))
{
G4cout << "*** G4VoxelNavigation::ComputeSafety(): ***" << G4endl
<< " Invoked DistanceToIn(p) for daughter solid: "
<< sampleSolid->GetName()
<< ". Solid replied: " << sampleSafety << G4endl
<< " For local point p: " << samplePoint
<< ", to be considered as 'daughter safety'." << G4endl;
}
#endif
}
voxelSafety = ComputeVoxelSafety(localPoint);
if ( voxelSafety<ourSafety )
+3 -2
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.4 2000/01/21 13:47:35 gcosmo Exp $
# $Id: GNUmakefile,v 1.5 2004/06/11 14:17:16 gcosmo Exp $
# ------------------------------------------------------------
# GNUmakefile for BREPS library. Gabriele Cosmo, 15/11/96.
# ------------------------------------------------------------
@@ -11,7 +11,8 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += \
CPPFLAGS += -DG4GEOM_ALLOC_EXPORT
CPPFLAGS += \
-I$(G4BASE)/geometry/management/include \
-I$(G4BASE)/geometry/solids/Boolean/include \
-I$(G4BASE)/geometry/solids/CSG/include \
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.3 2002/01/10 15:34:27 gcosmo Exp $
# $Id: GNUmakefile,v 1.4 2004/06/11 14:17:17 gcosmo Exp $
# ----------------------------------------------------------------
# GNUmakefile for geometry/CSG library. Gabriele Cosmo, 16/11/96.
# ----------------------------------------------------------------
@@ -11,6 +11,7 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4GEOM_ALLOC_EXPORT
CPPFLAGS += -I$(G4BASE)/intercoms/include \
-I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/global/management/include \
+8 -1
View File
@@ -1,5 +1,5 @@
$Id: History,v 1.45 2004/02/27 14:22:07 gcosmo Exp $
$Id: History,v 1.46 2004/05/13 14:52:28 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -20,6 +20,13 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
May 07, 2004 G.Cosmo geom-bool-V06-01-00
- Moved G4ReflectedSolid class to "management" module.
- Moved G4ReflectionFactory class to "volumes" module.
- Moved unit test for reflection to "volumes" module.
- Coworks with tags: geommng-V06-01-00, geomvol-V06-01-00 and
geomdiv-V06-01-00.
Feb 27, 2004 V.Grichine geom-bool-V06-00-00
- G4UnionSolid.cc, G4SubtractionSolid.cc: fix in debug printout for
SurfaceNomal().
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.4 2002/01/10 15:42:24 gcosmo Exp $
# $Id: GNUmakefile,v 1.5 2004/06/11 14:17:17 gcosmo Exp $
# ----------------------------------------------------------------
# GNUmakefile for geometry/CSG library. Gabriele Cosmo, 16/11/96.
# ----------------------------------------------------------------
@@ -11,6 +11,7 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4GEOM_ALLOC_EXPORT
CPPFLAGS += -I$(G4BASE)/intercoms/include \
-I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/global/management/include \
+2 -1
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.3 2003/11/14 14:46:15 gcosmo Exp $
# $Id: GNUmakefile,v 1.4 2004/06/11 14:17:18 gcosmo Exp $
# ----------------------------------------------------------------------------
# GNUmakefile for geometry/solids/specific library. Gabriele Cosmo, 05/04/00.
# ----------------------------------------------------------------------------
@@ -11,6 +11,7 @@ endif
include $(G4INSTALL)/config/architecture.gmk
CPPFLAGS += -DG4GEOM_ALLOC_EXPORT
CPPFLAGS += -I$(G4BASE)/intercoms/include \
-I$(G4BASE)/graphics_reps/include \
-I$(G4BASE)/global/management/include \
+32 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.34 2004/01/12 10:30:31 gcosmo Exp $
$Id: History,v 1.39 2004/06/07 08:46:53 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,37 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
07-Jun-2004, G.Cosmo (geom-specific-V06-01-04)
- Fixed compilation problem in G4TwistedSurface.cc on WIN32-VC.
28-May-2004, G.Cosmo (geom-specific-V06-01-03)
- Fixed archiving problem on WIN32-VC7: replaced structs with classes
in G4VSurface.
- Replaced misleading names for masks in G4VSurface and moved inlined
methods of nested classes to .cc.
25-May-2004, G.Cosmo (geom-specific-V06-01-02)
- Fixed compilation problem on SUN-CC. Made EValidate enum public in
G4VSurface.hh.
24-May-2004, G.Cosmo (geom-specific-V06-01-01)
- Removed compilation warnings and minor cleanup...
19-May-2004, O.Link (geom-specific-V06-01-00)
- First implementation of a framework for twisted surfaces, integrated from
the original version of Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp)
implemented in the 'Jupiter' application.
o Includes new specific twisted shape: G4TwistedTubs.
o New classes: G4VSurface, G4TwistedSurface, G4HyperbolicSurface,
G4FlatSurface, G4TwistedTubs.
o Cleanup of original code (debugging messages, compiler errors, migration
of g4std to new convention...)
o New organisation of class G4TwistedTubs: now independent of XXXSurface;
removed backpointer 'fSolid' from XXXSurface to G4TwistedTubs.
o New form of constructors in G4TwistedSurface, G4HyperbolicSurface and
G4FlatSurface.
o Change in G4TwistedSurface::DistanceToIn(p,v,...): roundoff correction.
12-Jan-2004, G.Cosmo (geom-specific-V06-00-00)
- G4PolyhedraSide.cc: fixed bug in which particles could "leak" out the
center of a face if inner radius = 0.
@@ -0,0 +1,103 @@
//
// ********************************************************************
// * 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: G4FlatSurface.hh,v 1.4 2004/05/24 12:09:46 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4FlatSurface
//
// Class description:
//
// Class describing a flat boundary surface for G4VSolid.
// Author:
// 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp)
//
// History:
// 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4
// from original version in Jupiter-2.5.02 application.
// --------------------------------------------------------------------
#ifndef __G4FLATSURFACE__
#define __G4FLATSURFACE__
#include "G4VSurface.hh"
// class G4TwistedTubs;
class G4FlatSurface : public G4VSurface
{
public: // with description
G4FlatSurface(const G4String &name,
const G4RotationMatrix &rot,
const G4ThreeVector &tlate,
const G4ThreeVector &n,
const EAxis axis1 = kRho, // RHO axis !
const EAxis axis2 = kPhi, // PHI axis !
G4double axis0min = -kInfinity,
G4double axis1min = -kInfinity,
G4double axis0max = kInfinity,
G4double axis1max = kInfinity );
G4FlatSurface( const G4String &name,
G4double EndInnerRadius[2],
G4double EndOuterRadius[2],
G4double DPhi,
G4double EndPhi[2],
G4double EndZ[2],
G4int handedness ) ;
virtual ~G4FlatSurface();
virtual G4ThreeVector GetNormal(const G4ThreeVector & /* xx */ ,
G4bool isGlobal = false);
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
const G4ThreeVector &gv,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[],
G4bool isvalid[],
EValidate validate = kValidateWithTol);
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[]);
protected: // with description
virtual G4int GetAreaCode(const G4ThreeVector &xx,
G4bool withTol = true) ;
private:
virtual void SetCorners();
virtual void SetBoundaries();
};
#endif
@@ -0,0 +1,152 @@
//
// ********************************************************************
// * 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: G4HyperbolicSurface.hh,v 1.4 2004/05/24 12:09:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
//
//
// --------------------------------------------------------------------
// GEANT 4 class header file
//
//
// G4HyperbolicSurface
//
// Class description:
//
// Class describing a hyperbolic boundary surface for G4VSolid.
// Author:
// 01-Aug-2002 - Kotoyo Hoshina (hoshina@hepburn.s.chiba-u.ac.jp)
//
// History:
// 13-Nov-2003 - O.Link (Oliver.Link@cern.ch), Integration in Geant4
// from original version in Jupiter-2.5.02 application.
// --------------------------------------------------------------------
#ifndef __G4HYPERBOLICSURFACE__
#define __G4HYPERBOLICSURFACE__
#include "G4VSurface.hh"
class G4HyperbolicSurface : public G4VSurface
{
public: // with description
G4HyperbolicSurface(const G4String &name,
const G4RotationMatrix &rot, // 0.5*(phi-width segment)
const G4ThreeVector &tlate,
const G4int handedness,// R-hand = 1, L-hand = -1
const G4double kappa, // tan(TwistAngle/2)/fZHalfLen
const G4double tanstereo, // tan(stereo angle)
const G4double r0, // radius at z = 0
const EAxis axis0 = kPhi,
const EAxis axis1 = kZAxis,
G4double axis0min = -kInfinity,
G4double axis1min = -kInfinity,
G4double axis0max = kInfinity,
G4double axis1max = kInfinity);
G4HyperbolicSurface(const G4String &name,
G4double EndInnerRadius[2],
G4double EndOuterRadius[2],
G4double DPhi,
G4double EndPhi[2],
G4double EndZ[2],
G4double InnerRadius,
G4double OuterRadius,
G4double Kappa,
G4double TanInnerStereo,
G4double TanOuterStereo,
G4int handedness) ;
virtual ~G4HyperbolicSurface();
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
const G4ThreeVector &gv,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[],
G4bool isvalid[],
EValidate validate = kValidateWithTol);
virtual G4int DistanceToSurface(const G4ThreeVector &gp,
G4ThreeVector gxx[],
G4double distance[],
G4int areacode[]);
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx,
G4bool isGlobal = false) ;
virtual EInside Inside(const G4ThreeVector &gp) ;
inline virtual G4double GetRhoAtPZ(const G4ThreeVector &p,
G4bool isglobal = false) const ;
private:
virtual G4int GetAreaCode(const G4ThreeVector &xx,
G4bool withTol = true);
virtual G4int GetAreaCodeInPhi(const G4ThreeVector &xx,
G4bool withTol = true);
virtual void SetCorners();
virtual void SetCorners(G4double EndInnerRadius[2],
G4double EndOuterRadius[2],
G4double DPhi,
G4double EndPhi[2],
G4double EndZ[2]);
virtual void SetBoundaries();
private:
G4double fKappa; // tan(TwistedAngle/2)/HalfLenZ;
G4double fTanStereo; // tan(StereoAngle)
G4double fTan2Stereo; // tan(StereoAngle)**2
G4double fR0; // radius at z = 0
G4double fR02; // radius**2 at z = 0
class Insidetype
{
public:
G4ThreeVector gp;
EInside inside;
};
Insidetype fInside;
};
//========================================================
// inline functions
//========================================================
inline
G4double G4HyperbolicSurface::GetRhoAtPZ(const G4ThreeVector &p,
G4bool isglobal) const
{
// Get Rho at p.z() on Hyperbolic Surface.
G4ThreeVector tmpp;
if (isglobal) {
tmpp = fRot.inverse()*p - fTrans;
} else {
tmpp = p;
}
return sqrt(fR02 + tmpp.z() * tmpp.z() * fTan2Stereo);
}
#endif

Some files were not shown because too many files have changed in this diff Show More