Import Geant4 7.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 11:11:55 +02:00
parent e083ffb441
commit 516dbf1a58
5914 changed files with 202605 additions and 71141 deletions
+13 -12
View File
@@ -1,4 +1,4 @@
# $Id: GNUmakefile,v 1.61 2004/06/11 14:08:57 gcosmo Exp $
# $Id: GNUmakefile,v 1.65 2004/12/13 16:27:48 gcosmo Exp $
# -----------------------------------------------------------------
# "gmake" makes default libraries for each subdomain.
# "gmake global" makes global libraries for each subdomain.
@@ -60,7 +60,7 @@ libmap: $(G4LIBDIR)/liblist
@echo " files, e.g., after gmake in the source/ directory."
@echo "Searching $(G4INSTALL)/source"
@echo ' for GNUmakefiles containing "name" and sorting ...'
@find $(G4INSTALL)/source \
@find . \
-name GNUmakefile -exec $(GREP) -l '^ *name *:=' {} \; \
| sort \
> /tmp/G4_all_lib_makefiles.$(unique);
@@ -78,7 +78,8 @@ libmap: $(G4LIBDIR)/liblist
do \
$(GREP) '^ *name *:=' $$i | cut -d \ -f 3 \
>> /tmp/G4libname.map.starter.$(unique); \
echo $$i >> /tmp/G4libname.map.starter.$(unique); \
echo $$i | sed "s/^\\./source/" \
>> /tmp/G4libname.map.starter.$(unique); \
done
@echo "Making libname.map ..."
@rm -f $(G4LIBDIR)/libname.map;
@@ -150,11 +151,11 @@ clean:
@rm -rf $(G4INSTALL)/.config/bin/$(G4SYSTEM)
@echo Removing physics-lists installation ...
ifndef G4LISTS_BASE
@rm -rf $(G4LIB)/.lists_build/$(G4SYSTEM)
@rm -rf $(G4TMP)/.lists_build/$(G4SYSTEM)
@rm -rf $(G4LIB)/plists/$(G4SYSTEM)
@rm -rf $(G4TMP)/plists/$(G4SYSTEM)
else
@rm -rf $(G4LISTS_BASE)/lists/.lists_build/lib/$(G4SYSTEM)
@rm -rf $(G4LISTS_BASE)/lists/.lists_build/tmp/$(G4SYSTEM)
@rm -rf $(G4LISTS_BASE)/hadronic/plists/lib/$(G4SYSTEM)
@rm -rf $(G4LISTS_BASE)/hadronic/plists/tmp/$(G4SYSTEM)
endif
ifdef CFRONT
@rm -rf $(G4TREP)
@@ -163,11 +164,11 @@ endif
clean_lists:
@echo Removing physics-lists installation ...
ifndef G4LISTS_BASE
@rm -rf $(G4LIB)/.lists_build/$(G4SYSTEM)
@rm -rf $(G4TMP)/.lists_build/$(G4SYSTEM)
@rm -rf $(G4LIB)/plists/$(G4SYSTEM)
@rm -rf $(G4TMP)/plists/$(G4SYSTEM)
else
@rm -rf $(G4LISTS_BASE)/lists/.lists_build/lib/$(G4SYSTEM)
@rm -rf $(G4LISTS_BASE)/lists/.lists_build/tmp/$(G4SYSTEM)
@rm -rf $(G4LISTS_BASE)/hadronic/plists/lib/$(G4SYSTEM)
@rm -rf $(G4LISTS_BASE)/hadronic/plists/tmp/$(G4SYSTEM)
endif
# Pay _extremely_ attention before executing the following target !!
@@ -184,7 +185,7 @@ clean_all:
@rm -rf $(G4INCLUDE)
ifdef G4LISTS_BASE
@echo Removing physics-lists installation ...
@rm -rf $(G4LISTS_BASE)/lists/.lists_build
@rm -rf $(G4LISTS_BASE)/hadronic/plists
endif
@echo Removing installation configurations ...
@rm -rf $(G4INSTALL)/.config
+9 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.8 2004/06/11 14:46:49 gcosmo Exp $
$Id: History,v 1.10 2004/11/18 23:54:22 perl Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,14 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Nov 18, 2004, J.Perl (digits_hits-V06-02-01)
- G4VDigi.hh: add methods to store and retrieve HepRep attributes in same
manner that we currently have for trajectories and hits.
Jul 1, 2004, G.Cosmo (digits_hits-V06-02-00)
- G4CellScoreComposer.cc, G4TrackLogger.cc: trivial fix for extra
semicolons, required for porting on gcc-3.4.0 compiler.
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
+5 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.3 2004/05/03 08:14:01 gcosmo Exp $
$Id: History,v 1.4 2004/07/01 09:19:11 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,10 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Jul, 1st 2004 G.Cosmo
- G4CellScoreComposer.cc, G4TrackLogger.cc: trivial fix for extra
semicolons, required for porting on gcc-3.4.0 compiler.
May, 3rd 2004 G.Cosmo
- G4SDManager, G4SDStructure: added optional argument 'warning' to
FindSensitiveDetector(pathName, warning), defaulted to TRUE, to
@@ -22,7 +22,7 @@
//
//
// $Id: G4CellScoreComposer.hh,v 1.1 2003/10/03 10:06:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// Class G4CellScoreComposer
@@ -22,7 +22,7 @@
//
//
// $Id: G4CellScoreValues.hh,v 1.1 2003/10/03 10:07:07 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// Class G4CellScoreValues
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4CellStoreScorer.hh,v 1.1 2003/10/03 10:07:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// Class G4CellStoreScorer
@@ -22,7 +22,7 @@
//
//
// $Id: G4CollectionNameVector.hh,v 1.1 2003/10/03 10:07:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4CollectionNameVector_H
@@ -22,7 +22,7 @@
//
//
// $Id: G4HCtable.hh,v 1.2 2004/03/09 19:33:37 asaim Exp $
// GEANT4 tag $Name: geant4-06-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4HCtable_H
@@ -22,7 +22,7 @@
//
//
// $Id: G4SDManager.hh,v 1.2 2004/05/03 08:14:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4SDManager_h
@@ -22,7 +22,7 @@
//
//
// $Id: G4SDStructure.hh,v 1.2 2004/05/03 08:14:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4SDStructure_h
@@ -22,7 +22,7 @@
//
//
// $Id: G4SDmessenger.hh,v 1.1 2003/10/03 10:09:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4SDmessenger_h
@@ -22,7 +22,7 @@
//
//
// $Id: G4SensitiveVolumeList.hh,v 1.1 2003/10/03 10:09:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ------------------------------------------------------------
// GEANT 4 class header file --- Copyright CERN 1996
@@ -22,7 +22,7 @@
//
//
// $Id: G4SensitiveVolumeList.icc,v 1.1 2003/10/03 10:09:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// -----------------------------------------------------------
// Inline functions of GEANT 4 class header file.
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4TrackLogger.hh,v 1.1 2003/10/03 10:09:45 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// Class G4TrackLogger
@@ -22,7 +22,7 @@
//
//
// $Id: G4VReadOutGeometry.hh,v 1.1 2003/10/03 10:10:00 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4VSensitiveDetector.hh,v 1.1 2003/10/03 10:10:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4VSensitiveDetector_h
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4CellScoreComposer.cc,v 1.1 2003/10/03 10:10:41 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4CellScoreComposer.cc,v 1.2 2004/07/01 09:19:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -95,7 +95,7 @@ GetStandardCellScoreValues() const {
void G4CellScoreComposer::SetImportnace(G4double importance){
fSCScoreValues.fImportance = importance;
};
}
std::ostream& operator<<(std::ostream &out,
const G4CellScoreComposer &ps) {
@@ -22,7 +22,7 @@
//
//
// $Id: G4CellStoreScorer.cc,v 1.1 2003/10/03 10:10:56 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4HCtable.cc,v 1.3 2004/03/15 19:16:07 asaim Exp $
// GEANT4 tag $Name: geant4-06-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4HCtable.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4SDManager.cc,v 1.2 2004/05/03 08:14:01 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4SDManager.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4SDStructure.cc,v 1.2 2004/05/03 08:14:02 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// G4SDStructure
@@ -22,7 +22,7 @@
//
//
// $Id: G4SDmessenger.cc,v 1.1 2003/10/03 10:11:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ---------------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4SensitiveVolumeList.cc,v 1.1 2003/10/03 10:12:09 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4TrackLogger.cc,v 1.1 2003/10/03 10:12:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4TrackLogger.cc,v 1.2 2004/07/01 09:19:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -45,7 +45,7 @@ void G4TrackLogger::SetEventID(G4int id){
fTrackIDsSet.clear();
fPreviousEventID =id;
}
};
}
G4bool G4TrackLogger::FirstEnterance(G4int trid){
G4bool first = true;
@@ -62,5 +62,4 @@ G4bool G4TrackLogger::FirstEnterance(G4int trid){
}
return first;
};
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4VReadOutGeometry.cc,v 1.1 2003/10/03 10:12:41 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4VReadOutGeometry.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4VSensitiveDetector.cc,v 1.1 2003/10/03 10:12:56 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// G4VSensitiveDetector
#include "G4VSensitiveDetector.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4DCofThisEvent.hh,v 1.4 2004/06/11 14:10:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4DCofThisEvent_h
@@ -22,7 +22,7 @@
//
//
// $Id: G4TDigiCollection.hh,v 1.4 2004/06/11 14:10:30 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4TDigiCollection_h
+20 -2
View File
@@ -21,14 +21,19 @@
// ********************************************************************
//
//
// $Id: G4VDigi.hh,v 1.1 2003/10/03 10:14:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4VDigi.hh,v 1.2 2004/11/18 23:54:22 perl Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4VDigi_h
#define G4VDigi_h 1
#include "globals.hh"
#include <vector>
#include <map>
class G4AttDef;
class G4AttValue;
// class description:
//
@@ -50,6 +55,19 @@ class G4VDigi
virtual void Draw();
virtual void Print();
virtual const std::map<G4String,G4AttDef>* GetAttDefs() const
{ return 0; }
// If implemented by a derived class, returns a pointer to a map of
// attribute definitions for the attribute values below. The user
// must test the validity of this pointer.
virtual std::vector<G4AttValue>* CreateAttValues() const
{ return 0; }
// If implemented by a derived class, returns a pointer to a list
// of attribute values suitable, e.g., for picking. Each must
// refer to an attribute definition in the above map; its name is
// the key. The user must test the validity of this pointer and
// delete the list after use.
};
#endif
@@ -22,7 +22,7 @@
//
//
// $Id: G4VDigiCollection.hh,v 1.1 2003/10/03 10:14:48 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4VDigiCollection_h
@@ -22,7 +22,7 @@
//
//
// $Id: G4DCofThisEvent.cc,v 1.3 2004/06/11 14:10:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4DCofThisEvent.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4TDigiCollection.cc,v 1.3 2004/06/11 14:10:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4TDigiCollection.hh"
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4VDigi.cc,v 1.1 2003/10/03 10:15:39 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// G4VDigi
@@ -22,7 +22,7 @@
//
//
// $Id: G4VDigiCollection.cc,v 1.1 2003/10/03 10:15:55 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// G4VDigiCollection
@@ -22,7 +22,7 @@
//
//
// $Id: G4HCofThisEvent.hh,v 1.4 2004/06/11 14:10:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4HCofThisEvent_h
@@ -22,7 +22,7 @@
//
//
// $Id: G4THitsCollection.hh,v 1.4 2004/06/11 14:10:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4THitsCollection_h
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4VHit.hh,v 1.1 2003/10/03 10:17:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4VHit_h
@@ -22,7 +22,7 @@
//
//
// $Id: G4VHitsCollection.hh,v 1.1 2003/10/03 10:17:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4VHitsCollection_h
@@ -22,7 +22,7 @@
//
//
// $Id: G4HCofThisEvent.cc,v 1.3 2004/06/11 14:10:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4HCofThisEvent.hh"
@@ -22,7 +22,7 @@
//
//
// $Id: G4THitsCollection.cc,v 1.3 2004/06/11 14:10:33 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4THitsCollection.hh"
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4VHit.cc,v 1.1 2003/10/03 10:18:31 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// G4VHit
@@ -22,7 +22,7 @@
//
//
// $Id: G4VHitsCollection.cc,v 1.1 2003/10/03 10:20:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// G4VHitsCollection
+17 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.79 2004/06/11 14:52:16 gcosmo Exp $
$Id: History,v 1.84 2004/12/02 06:40:37 asaim Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,22 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
Dec 02, 2004, M.Asai (event-V06-02-04)
- Migration to <cmath>.
Oct 28, 2004, F.Lei (event-V06-02-03)
- Added new features, focused beam and multiple vertexes, to GeneralParticleSource.
Aug 10, 2004, M.Asai (event-V06-02-02)
- G4PrimaryTransformer becomes a base class.
Jul 7, 2004, M.Asai (event-V06-02-01)
- Treatment of G4UnknownParticle is added to G4PrimaryTransformer.
Jul 1, 2004, G.Cosmo (event-V06-02-00)
- Trivial fix for porting on gcc-3.4.0 compiler: removed extra semicolons
in G4CellScorerStore.cc.
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.
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4CellScorer.hh,v 1.1 2002/10/28 10:06:00 dressel Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// Class G4CellScorer
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4CellScorerStore.hh,v 1.2 2003/06/16 16:50:26 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// Class G4CellScorerStore
@@ -22,7 +22,7 @@
//
//
// $Id: G4ClassificationOfNewTrack.hh,v 1.5 2001/07/19 00:14:15 asaim Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4EvManMessenger.hh,v 1.4 2001/07/11 09:58:47 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4EvManMessenger_h
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Event.hh,v 1.10 2004/06/11 14:11:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4Event_h
+8 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EventManager.hh,v 1.14 2004/05/26 17:08:33 asaim Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4EventManager.hh,v 1.15 2004/08/10 23:59:37 asaim Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
@@ -197,6 +197,12 @@ class G4EventManager
// the current event. Both methods are valid only for G4State_EventProc
// application state.
inline G4PrimaryTransformer* GetPrimaryTransformer() const
{ return transformer; }
inline void SetPrimaryTransformer(G4PrimaryTransformer* tf)
{ transformer = tf; }
};
+32 -22
View File
@@ -41,6 +41,9 @@
//
// CHANGE HISTORY
// --------------
// 26/10/2004, F Lei
// Added the Multiple_vertex capability.
// Removed "inline" from all Set/Get methods.
//
// Version 2.0, 05/02/2004, Fan Lei, Created.
// based on version 1.1 in Geant4 v6.0
@@ -84,6 +87,9 @@
// void SetCurrentSourceIntensity(G4double)
// change the current particle gun strength
//
// void SetMultipleVertex(G4bool )
// Set if multiple vertex per event.
// G4SingleParticleSource* GetCurrentSource()
// return the pointer to current particle gun
//
@@ -109,21 +115,21 @@
// void SetParticleCharge(G4double aCharge)
// set the charge state of the primary track
//
// inline void SetParticlePolarization (G4ThreeVector aVal)
// inline G4ThreeVector GetParticlePolarization ()
// void SetParticlePolarization (G4ThreeVector aVal)
// 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; };
// void SetParticleTime(G4double aTime) { particle_time = aTime; };
// G4double GetParticleTime() { return particle_time; };
// Set/Get the Time.
//
// inline void SetNumberOfParticles(G4int i)
// inline G4int GetNumberOfParticles()
// void SetNumberOfParticles(G4int i)
// G4int GetNumberOfParticles()
// set/get the number of particles to be generated in the primary track
//
// inline G4ThreeVector GetParticlePosition()
// inline G4ThreeVector GetParticleMomentumDirection()
// inline G4double GetParticleEnergy()
// G4ThreeVector GetParticlePosition()
// G4ThreeVector GetParticleMomentumDirection()
// G4double GetParticleEnergy()
// get the position, direction, and energy of the current particle
//
///////////////////////////////////////////////////////////////////////////////
@@ -161,36 +167,40 @@ public:
void DeleteaSource(G4int);
// Set the verbosity level.
inline void SetVerbosity(G4int i) {currentSource->SetVerbosity(i);} ;
void SetVerbosity(G4int i) {currentSource->SetVerbosity(i);} ;
// Set if multiple vertex per event.
void SetMultipleVertex(G4bool av) {multiple_vertex = av;} ;
// Set the particle species
inline void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition)
void SetParticleDefinition (G4ParticleDefinition * aParticleDefinition)
{currentSource->SetParticleDefinition(aParticleDefinition); } ;
inline G4ParticleDefinition * GetParticleDefinition () { return currentSource->GetParticleDefinition();} ;
G4ParticleDefinition * GetParticleDefinition () { return currentSource->GetParticleDefinition();} ;
inline void SetParticleCharge(G4double aCharge) { currentSource->SetParticleCharge(aCharge); } ;
void SetParticleCharge(G4double aCharge) { currentSource->SetParticleCharge(aCharge); } ;
// Set polarization
inline void SetParticlePolarization (G4ThreeVector aVal) {currentSource->SetParticlePolarization(aVal);};
inline G4ThreeVector GetParticlePolarization () {return currentSource->GetParticlePolarization();};
void SetParticlePolarization (G4ThreeVector aVal) {currentSource->SetParticlePolarization(aVal);};
G4ThreeVector GetParticlePolarization () {return currentSource->GetParticlePolarization();};
// Set Time.
inline void SetParticleTime(G4double aTime) { currentSource->SetParticleTime(aTime); };
inline G4double GetParticleTime() { return currentSource->GetParticleTime(); };
void SetParticleTime(G4double aTime) { currentSource->SetParticleTime(aTime); };
G4double GetParticleTime() { return currentSource->GetParticleTime(); };
inline void SetNumberOfParticles(G4int i) { currentSource->SetNumberOfParticles(i); };
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();};
G4int GetNumberOfParticles() { return currentSource->GetNumberOfParticles(); };
G4ThreeVector GetParticlePosition() { return currentSource->GetParticlePosition();};
G4ThreeVector GetParticleMomentumDirection() { return currentSource->GetParticleMomentumDirection();};
G4double GetParticleEnergy() {return currentSource->GetParticleEnergy();};
private:
void IntensityNormalization();
private:
G4bool multiple_vertex;
G4bool normalised;
G4int currentSourceIdx;
G4SingleParticleSource* currentSource;
@@ -129,6 +129,7 @@ private: //commands
G4UIcmdWithAnInteger *setsourceCmd;
G4UIcmdWithADouble *setintensityCmd;
G4UIcmdWithAnInteger *deletesourceCmd;
G4UIcmdWithABool *multiplevertexCmd;
// positional commands
G4UIdirectory *positionDirectory;
G4UIcmdWithAString *typeCmd1;
@@ -178,6 +179,7 @@ private: //commands
G4UIcmdWithADoubleAndUnit *angsigmarCmd1;
G4UIcmdWithADoubleAndUnit *angsigmaxCmd1;
G4UIcmdWithADoubleAndUnit *angsigmayCmd1;
G4UIcmdWith3VectorAndUnit *angfocusCmd;
G4UIcmdWithABool *useuserangaxisCmd1;
G4UIcmdWithABool *surfnormCmd1;
// old ones, will be removed soon
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4HEPEvtInterface.hh,v 1.7 2003/06/16 16:50:27 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4HEPEvtInterface_h
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4HEPEvtParticle.hh,v 1.8 2004/06/11 14:11:15 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4ParticleGun.hh,v 1.7 2001/11/20 23:21:41 asaim Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4ParticleGun_h
@@ -22,7 +22,7 @@
//
//
// $Id: G4ParticleGunMessenger.hh,v 1.7 2002/02/26 16:34:04 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4PrimaryParticle.hh,v 1.14 2004/06/11 14:11:16 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
+14 -11
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryTransformer.hh,v 1.6 2001/07/18 01:25:44 asaim Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4PrimaryTransformer.hh,v 1.8 2004/08/10 23:59:37 asaim Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4PromaryTransformer_h
@@ -45,32 +45,35 @@ class G4PrimaryTransformer
{
public:
G4PrimaryTransformer();
~G4PrimaryTransformer();
virtual ~G4PrimaryTransformer();
G4TrackVector* GimmePrimaries(G4Event* anEvent, G4int trackIDCounter=0);
void CheckUnknown();
private:
protected:
G4TrackVector TV;
G4ParticleTable* particleTable;
G4int verboseLevel;
G4int trackID;
G4ParticleDefinition* unknown;
G4bool unknownParticleDefined;
public:
inline void SetVerboseLevel(G4int vl)
{ verboseLevel = vl; };
private:
protected:
void GenerateTracks(G4PrimaryVertex* primaryVertex);
void GenerateSingleTrack(G4PrimaryParticle* primaryParticle,
G4double x0,G4double y0,G4double z0,G4double t0,G4double wv);
void SetDecayProducts(G4PrimaryParticle* mother,
G4DynamicParticle* motherDP);
inline G4ParticleDefinition* GetDefinition(G4PrimaryParticle*pp)
{
G4ParticleDefinition* partDef = pp->GetG4code();
if(!partDef) partDef = particleTable->FindParticle(pp->GetPDGcode());
return partDef;
};
protected: //with description
virtual G4ParticleDefinition* GetDefinition(G4PrimaryParticle*pp);
// virtual method to be overwritten. Return appropriate G4ParticleDefinition
// w.r.t. the primary particle. If NULL is return, the particle will not be
// treated as a track, but its daughters will be examined.
};
#endif
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4PrimaryVertex.hh,v 1.11 2004/06/11 14:11:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
+10 -1
View File
@@ -35,7 +35,9 @@
//
// CHANGE HISTORY
// --------------
//
// 26/10/2004 F Lei
// Added a "focused" option to allow all primary particles pointing to
// a user specified focusing point.
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
@@ -93,6 +95,10 @@
// This method generates momentum vectors for particles according
// to a cosine-law distribution.
//
// void GenerateFocusedFlux()
// This method generates momentum vectors for particles pointing to
// an user specified focusing point.
//
// void GenerateUserDefFlux()
// Controls generation of momentum vectors according to user-defined
// distributions.
@@ -161,6 +167,7 @@ public:
void SetBeamSigmaInAngY(G4double);
void UserDefAngTheta(G4ThreeVector);
void UserDefAngPhi(G4ThreeVector);
void SetFocusPoint(G4ThreeVector);
inline void SetParticleMomentumDirection
(G4ParticleMomentum aMomentumDirection)
{ particle_momentum_direction = aMomentumDirection.unit(); }
@@ -179,6 +186,7 @@ public:
private:
// These methods generate the momentum vectors for the particles.
void GenerateFocusedFlux();
void GenerateIsotropicFlux();
void GenerateCosineLawFlux();
void GenerateBeamFlux();
@@ -195,6 +203,7 @@ private:
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
G4ThreeVector FocusPoint ; // the focusing point in mother coordinates
G4bool IPDFThetaExist, IPDFPhiExist; // tell whether IPDF histos exist
G4PhysicsOrderedFreeVector UDefThetaH; // Theta histo data
G4PhysicsOrderedFreeVector IPDFThetaH; //Cumulative Theta histogram.
+28 -2
View File
@@ -35,6 +35,8 @@
// CHANGE HISTORY
// --------------
//
// 26/10/2004 F Lei
// Created separated the theta, phi generators for position distributions.
//
// Version 1.0, 05/02/2004, Fan Lei, Created.
// Based on the G4GeneralParticleSource class in Geant4 v6.0
@@ -77,6 +79,14 @@
// Allows the user to re-distribute the random
// numbers used to generate values of phi.
//
// void SetPosThetaBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate values of theta for position distribution.
//
// void SetPosPhiBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate values of phi for position distribution.
//
// void SetEnergyBias(G4ThreeVector)
// Allows the user to re-distribute the random
// numbers used to generate the energies.
@@ -99,6 +109,12 @@
// G4double GenRandEnergy()
// Generates the random number for energy, with or without biasing.
//
// G4double GenRandPosTheta()
// Generates the random number for theta, with or without biasing for position distribution.
//
// G4double GenRandPosPhi()
// Generates the random number for phi, with or without biasing for position distribution.
//
// inline G4double GetBiasWeight()
// Returns the weight change after biasing
//
@@ -131,15 +147,19 @@ public:
void SetThetaBias(G4ThreeVector);
void SetPhiBias(G4ThreeVector);
void SetEnergyBias(G4ThreeVector);
void SetPosThetaBias(G4ThreeVector);
void SetPosPhiBias(G4ThreeVector);
G4double GenRandX();
G4double GenRandY();
G4double GenRandZ();
G4double GenRandTheta();
G4double GenRandPhi();
G4double GenRandEnergy();
G4double GenRandPosTheta();
G4double GenRandPosPhi();
inline G4double GetBiasWeight()
{ return bweights[0]*bweights[1]*bweights[2]*bweights[3]*bweights[4]*bweights[5];};
{ return bweights[0]*bweights[1]*bweights[2]*bweights[3]*bweights[4]*bweights[5]*bweights[6]*bweights[7];};
// method to re-set the histograms
void ReSetHist(G4String);
@@ -169,8 +189,14 @@ private:
G4bool EnergyBias, IPDFEnergyBias;
G4PhysicsOrderedFreeVector EnergyBiasH;
G4PhysicsOrderedFreeVector IPDFEnergyBiasH;
G4bool PosThetaBias, IPDFPosThetaBias;
G4PhysicsOrderedFreeVector PosThetaBiasH;
G4PhysicsOrderedFreeVector IPDFPosThetaBiasH;
G4bool PosPhiBias, IPDFPosPhiBias;
G4PhysicsOrderedFreeVector PosPhiBiasH;
G4PhysicsOrderedFreeVector IPDFPosPhiBiasH;
G4double bweights[6]; //record x,y,z,theta,phi,energy weights
G4double bweights[8]; //record x,y,z,theta,phi,energy,posThet, posPhi weights
// Verbosity
G4int verbosityLevel;
+1 -1
View File
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4ScoreTable.hh,v 1.2 2003/06/16 16:50:29 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// Class G4ScoreTable
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Scorer.hh,v 1.1 2002/10/28 10:06:01 dressel Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// Class G4Scorer
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4StackChecker.hh,v 1.1 2003/06/12 15:14:43 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4StackChecker_h
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4StackManager.hh,v 1.11 2003/06/16 16:50:30 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4StackedTrack.hh,v 1.9 2004/06/11 14:11:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Last Modification : 02/Feb/96 M.Asai
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4StackingMessenger.hh,v 1.4 2001/07/11 09:58:49 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4StackingMessenger_h
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4TrackStack.hh,v 1.5 2001/07/13 15:01:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// Last Modification : 09/Dec/96 M.Asai
@@ -22,7 +22,7 @@
//
//
// $Id: G4TrajectoryContainer.hh,v 1.14 2004/06/11 14:11:17 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// G4TrajectoryContainer
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4UserEventAction.hh,v 1.5 2001/07/11 09:58:50 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
//
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4UserStackingAction.hh,v 1.5 2001/07/11 09:58:50 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4UserStackingAction_h
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4VPrimaryGenerator.hh,v 1.7 2003/08/02 00:18:30 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef G4VPrimaryGenerator_h
@@ -22,7 +22,7 @@
//
//
// $Id: G4VUserEventInformation.hh,v 1.1 2003/09/09 20:09:17 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
//---------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4VUserPrimaryParticleInformation.hh,v 1.1 2003/09/12 21:51:32 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
//---------------------------------------------------------------
@@ -22,7 +22,7 @@
//
//
// $Id: G4VUserPrimaryVertexInformation.hh,v 1.1 2003/09/12 21:51:32 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
//---------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: eventgendefs.hh,v 1.3 2001/07/11 09:58:50 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#ifndef EventGenerator_DEBUG
#define EventGenerator_DEBUG
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: evmandefs.hh,v 1.3 2001/07/11 09:58:50 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
///#define G4EVENTMANAGER_DEBUG 1
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: trajectoryControl.hh,v 1.3 2001/07/11 09:58:51 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
////#define G4_STORE_TRAJECTORY 1
-1
View File
@@ -1 +0,0 @@
*.d
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4CellScorer.cc,v 1.3 2003/04/29 07:05:38 dressel Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
+4 -4
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4CellScorerStore.cc,v 1.2 2002/11/04 10:52:39 dressel Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// $Id: G4CellScorerStore.cc,v 1.3 2004/07/01 10:05:40 gcosmo Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
@@ -55,7 +55,7 @@ AddCellScorer(G4VPhysicalVolume &vol, G4int repnum) {
}
fMapGeometryCellCellScorer[G4GeometryCell(vol, repnum)] = s;
return s;
};
}
G4CellScorer *G4CellScorerStore::
AddCellScorer(const G4GeometryCell &gCell) {
@@ -66,7 +66,7 @@ AddCellScorer(const G4GeometryCell &gCell) {
}
fMapGeometryCellCellScorer[gCell] = s;
return s;
};
}
const G4MapGeometryCellCellScorer &G4CellScorerStore::GetMapGeometryCellCellScorer() const {
return fMapGeometryCellCellScorer;
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4EvManMessenger.cc,v 1.4 2002/12/04 18:43:15 asaim Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// --------------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Event.cc,v 1.8 2004/06/11 14:11:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// G4Event
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4EventManager.cc,v 1.20 2004/05/26 17:08:33 asaim Exp $
// GEANT4 tag $Name: geant4-06-02 $
// $Id: G4EventManager.cc,v 1.21 2004/08/10 23:59:37 asaim Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
//
+15 -7
View File
@@ -59,6 +59,7 @@
#include "G4GeneralParticleSource.hh"
G4GeneralParticleSource::G4GeneralParticleSource()
: multiple_vertex(false)
{
sourceVector.clear();
sourceIntensity.clear();
@@ -161,12 +162,19 @@ void G4GeneralParticleSource::DeleteaSource(G4int aV)
void G4GeneralParticleSource::GeneratePrimaryVertex(G4Event* evt)
{
if (sourceIntensity.size() > 1) {
if (!normalised) IntensityNormalization();
G4double rndm = G4UniformRand();
size_t i = 0 ;
while ( rndm > sourceProbability[i] ) i++;
(currentSource = sourceVector[i]);
}
if (!multiple_vertex){
if (sourceIntensity.size() > 1) {
if (!normalised) IntensityNormalization();
G4double rndm = G4UniformRand();
size_t i = 0 ;
while ( rndm > sourceProbability[i] ) i++;
(currentSource = sourceVector[i]);
}
currentSource-> GeneratePrimaryVertex(evt);
}
else {
for (size_t i = 0; i < sourceIntensity.size(); i++) {
sourceVector[i]->GeneratePrimaryVertex(evt);
}
}
}
@@ -116,6 +116,12 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
setintensityCmd->SetParameterName("setintensity",false,false);
setintensityCmd->SetRange("setintensity > 0.");
multiplevertexCmd = new G4UIcmdWithABool("/gps/source/multiplevertex",this);
multiplevertexCmd->SetGuidance("true for simulaneous generation mutiple vertex");
multiplevertexCmd->SetGuidance("Default is false");
multiplevertexCmd->SetParameterName("multiplevertex",true);
multiplevertexCmd->SetDefaultValue(false);
// below we reproduce commands awailable in G4Particle Gun
listCmd = new G4UIcmdWithoutParameter("/gps/List",this);
@@ -194,7 +200,7 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
polCmd->SetRange("Px>=-1.&&Px<=1.&&Py>=-1.&&Py<=1.&&Pz>=-1.&&Pz<=1.");
numberCmd = new G4UIcmdWithAnInteger("/gps/number",this);
numberCmd->SetGuidance("Set number of particles to be generated.");
numberCmd->SetGuidance("Set number of particles to be generated per vertex.");
numberCmd->SetParameterName("N",true,true);
numberCmd->SetRange("N>0");
@@ -429,10 +435,10 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
angtypeCmd1 = new G4UIcmdWithAString("/gps/ang/type",this);
angtypeCmd1->SetGuidance("Sets angular source distribution type");
angtypeCmd1->SetGuidance("Possible variables are: iso, cos planar beam1d beam2d or user");
angtypeCmd1->SetGuidance("Possible variables are: iso, cos, planar, beam1d, beam2d, focused or user");
angtypeCmd1->SetParameterName("AngDis",true,true);
angtypeCmd1->SetDefaultValue("iso");
angtypeCmd1->SetCandidates("iso cos planar beam1d beam2d user");
angtypeCmd1->SetCandidates("iso cos planar beam1d beam2d focused user");
angrot1Cmd1 = new G4UIcmdWith3Vector("/gps/ang/rot1",this);
angrot1Cmd1->SetGuidance("Sets the 1st vector for angular distribution rotation matrix");
@@ -491,6 +497,12 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
angsigmayCmd1->SetDefaultUnit("rad");
angsigmayCmd1->SetUnitCandidates("rad deg");
angfocusCmd = new G4UIcmdWith3VectorAndUnit("/gps/ang/focuspoint",this);
angfocusCmd->SetGuidance("Set the focusing point for the beam");
angfocusCmd->SetParameterName("x","y","z",true,true);
angfocusCmd->SetDefaultUnit("cm");
angfocusCmd->SetUnitCandidates("micron mm cm m km");
useuserangaxisCmd1 = new G4UIcmdWithABool("/gps/ang/user_coor",this);
useuserangaxisCmd1->SetGuidance("true for using user defined angular co-ordinates");
useuserangaxisCmd1->SetGuidance("Default is false");
@@ -718,13 +730,13 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
histnameCmd1->SetGuidance("Sets histogram type");
histnameCmd1->SetParameterName("HistType",true,true);
histnameCmd1->SetDefaultValue("biasx");
histnameCmd1->SetCandidates("biasx biasy biasz biast biasp biase theta phi energy arb epn");
histnameCmd1->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
resethistCmd1 = new G4UIcmdWithAString("/gps/hist/reset",this);
resethistCmd1->SetGuidance("Reset (clean) the histogram ");
resethistCmd1->SetParameterName("HistType",true,true);
resethistCmd1->SetDefaultValue("energy");
resethistCmd1->SetCandidates("biasx biasy biasz biast biasp biase theta phi energy arb epn");
resethistCmd1->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
histpointCmd1 = new G4UIcmdWith3Vector("/gps/hist/point",this);
histpointCmd1->SetGuidance("Allows user to define a histogram");
@@ -743,14 +755,14 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
histnameCmd->SetGuidance("Sets histogram type (obsolete!)");
histnameCmd->SetParameterName("HistType",true,true);
histnameCmd->SetDefaultValue("biasx");
histnameCmd->SetCandidates("biasx biasy biasz biast biasp biase theta phi energy arb epn");
histnameCmd->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
// re-set the histograms
resethistCmd = new G4UIcmdWithAString("/gps/resethist",this);
resethistCmd->SetGuidance("Re-Set the histogram (obsolete!)");
resethistCmd->SetParameterName("HistType",true,true);
resethistCmd->SetDefaultValue("energy");
resethistCmd->SetCandidates("biasx biasy biasz biast biasp biase theta phi energy arb epn");
resethistCmd->SetCandidates("biasx biasy biasz biast biasp biase biaspt biaspp theta phi energy arb epn");
histpointCmd = new G4UIcmdWith3Vector("/gps/histpoint",this);
histpointCmd->SetGuidance("Allows user to define a histogram (obsolete!)");
@@ -826,7 +838,7 @@ G4GeneralParticleSourceMessenger::~G4GeneralParticleSourceMessenger()
delete maxphiCmd1;
delete angsigmarCmd1;
delete angsigmaxCmd1;
delete angsigmayCmd1;
delete angfocusCmd;
delete useuserangaxisCmd1;
delete surfnormCmd1;
@@ -887,6 +899,7 @@ G4GeneralParticleSourceMessenger::~G4GeneralParticleSourceMessenger()
delete setsourceCmd;
delete setintensityCmd;
delete deletesourceCmd;
delete multiplevertexCmd;
delete gpsDirectory;
@@ -1223,6 +1236,11 @@ void G4GeneralParticleSourceMessenger::SetNewValue(G4UIcommand *command, G4Strin
{
fGPS->DeleteaSource(deletesourceCmd->GetNewIntValue(newValues));
}
else if(command == multiplevertexCmd)
{
fGPS->SetMultipleVertex(multiplevertexCmd->GetNewBoolValue(newValues));
}
//
// new implementations
//
//
@@ -1336,6 +1354,10 @@ void G4GeneralParticleSourceMessenger::SetNewValue(G4UIcommand *command, G4Strin
{
fParticleGun->GetAngDist()->SetBeamSigmaInAngY(angsigmayCmd1->GetNewDoubleValue(newValues));
}
else if(command == angfocusCmd)
{
fParticleGun->GetAngDist()->SetFocusPoint(angfocusCmd->GetNew3VectorValue(newValues));
}
else if(command == useuserangaxisCmd1)
{
fParticleGun->GetAngDist()->SetUseUserAngAxis(useuserangaxisCmd1->GetNewBoolValue(newValues));
@@ -1412,6 +1434,10 @@ void G4GeneralParticleSourceMessenger::SetNewValue(G4UIcommand *command, G4Strin
fParticleGun->GetBiasRndm()->SetThetaBias(histpointCmd1->GetNew3VectorValue(newValues));
if(histtype == "biasp")
fParticleGun->GetBiasRndm()->SetPhiBias(histpointCmd1->GetNew3VectorValue(newValues));
if(histtype == "biaspt")
fParticleGun->GetBiasRndm()->SetPosThetaBias(histpointCmd1->GetNew3VectorValue(newValues));
if(histtype == "biaspp")
fParticleGun->GetBiasRndm()->SetPosPhiBias(histpointCmd1->GetNew3VectorValue(newValues));
if(histtype == "biase")
fParticleGun->GetBiasRndm()->SetEnergyBias(histpointCmd1->GetNew3VectorValue(newValues));
if(histtype == "theta")
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4HEPEvtInterface.cc,v 1.9 2003/06/16 16:50:33 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
// --------------------------------------------------------------------
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4HEPEvtParticle.cc,v 1.7 2004/06/11 14:11:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
//
+6 -6
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ParticleGun.cc,v 1.7 2003/11/19 19:28:43 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4ParticleGun.cc,v 1.8 2004/12/02 06:40:37 asaim Exp $
// GEANT4 tag $Name: geant4-07-00-cand-03 $
//
// G4ParticleGun
@@ -98,7 +98,7 @@ void G4ParticleGun::SetParticleMomentum(G4ParticleMomentum aMomentum)
G4double mass = particle_definition->GetPDGMass();
G4double p = aMomentum.mag();
particle_momentum_direction = aMomentum.unit();
if ((particle_energy>0.0)&&(abs(particle_energy+mass-sqrt(p*p+mass*mass))>keV))
if ((particle_energy>0.0)&&(std::abs(particle_energy+mass-std::sqrt(p*p+mass*mass))>keV))
{
G4cout << "G4ParticleGun::" << particle_definition->GetParticleName() << G4endl;
G4cout << " KineticEnergy and Momentum could be inconsistent" << G4endl;
@@ -106,9 +106,9 @@ void G4ParticleGun::SetParticleMomentum(G4ParticleMomentum aMomentum)
G4cout << " Mass:" << mass/GeV << " GeV/c/c)" << G4endl;
G4cout << " KineticEnergy is overwritten!! ";
G4cout << particle_energy/GeV << "->";
G4cout << (sqrt(p*p+mass*mass)-mass)/GeV << "GeV" << G4endl;
G4cout << (std::sqrt(p*p+mass*mass)-mass)/GeV << "GeV" << G4endl;
}
particle_energy = sqrt(p*p+mass*mass)-mass;
particle_energy = std::sqrt(p*p+mass*mass)-mass;
}
}
@@ -123,7 +123,7 @@ void G4ParticleGun::GeneratePrimaryVertex(G4Event* evt)
// 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 pmom = std::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();
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4ParticleGunMessenger.cc,v 1.11 2004/02/22 02:55:26 kurasige Exp $
// GEANT4 tag $Name: geant4-06-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4ParticleGunMessenger.hh"
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4PrimaryParticle.cc,v 1.13 2004/06/11 14:11:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4PrimaryParticle.hh"
+32 -6
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PrimaryTransformer.cc,v 1.18 2003/10/01 13:17:34 asaim Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// $Id: G4PrimaryTransformer.cc,v 1.20 2004/08/10 23:59:37 asaim Exp $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4PrimaryTransformer.hh"
@@ -37,13 +37,23 @@
#include "G4ios.hh"
G4PrimaryTransformer::G4PrimaryTransformer()
:verboseLevel(0),trackID(0)
:verboseLevel(0),trackID(0),unknown(0),unknownParticleDefined(false)
{
particleTable = G4ParticleTable::GetParticleTable();
CheckUnknown();
}
G4PrimaryTransformer::~G4PrimaryTransformer()
{;}
void G4PrimaryTransformer::CheckUnknown()
{
unknown = particleTable->FindParticle("unknown");
if(unknown)
{ unknownParticleDefined = true; }
else
{ unknownParticleDefined = false; }
}
G4TrackVector* G4PrimaryTransformer::GimmePrimaries(G4Event* anEvent,G4int trackIDCounter)
{
@@ -93,7 +103,7 @@ void G4PrimaryTransformer::GenerateSingleTrack
{
G4ParticleDefinition* partDef = GetDefinition(primaryParticle);
if((!partDef)||partDef->IsShortLived())
// The particle is not defined in GEANT4, check daughters
// The particle is not defined in GEANT4 or it is "short-lived", check daughters
{
#ifdef G4VERBOSE
if(verboseLevel>2)
@@ -129,10 +139,13 @@ void G4PrimaryTransformer::GenerateSingleTrack
primaryParticle->GetPolZ());
if(primaryParticle->GetProperTime()>0.0)
{ DP->SetPreAssignedDecayProperTime(primaryParticle->GetProperTime()); }
// Set Charge is specified
// Set Charge if it is specified
if (primaryParticle->GetCharge()<DBL_MAX) {
DP->SetCharge(primaryParticle->GetCharge());
}
// Set Mass if it is specified
if(partDef==unknown)
{ DP->SetMass(primaryParticle->GetMass()); }
// Set decay products to the DynamicParticle
SetDecayProducts( primaryParticle, DP );
// Set primary particle
@@ -166,7 +179,7 @@ void G4PrimaryTransformer::SetDecayProducts
while(daughter)
{
G4ParticleDefinition* partDef = GetDefinition(daughter);
if(!partDef)
if((!partDef)||partDef->IsShortLived())
{
#ifdef G4VERBOSE
if(verboseLevel>2)
@@ -193,6 +206,12 @@ void G4PrimaryTransformer::SetDecayProducts
// Decay proper time for daughter
if(daughter->GetProperTime()>0.0)
{ DP->SetPreAssignedDecayProperTime(daughter->GetProperTime()); }
// Set Charge is specified
if (daughter->GetCharge()<DBL_MAX) {
DP->SetCharge(daughter->GetCharge());
}
if(partDef==unknown)
{ DP->SetMass(daughter->GetMass()); }
decayProducts->PushProducts(DP);
SetDecayProducts(daughter,DP);
}
@@ -200,6 +219,13 @@ void G4PrimaryTransformer::SetDecayProducts
}
}
G4ParticleDefinition* G4PrimaryTransformer::GetDefinition(G4PrimaryParticle*pp)
{
G4ParticleDefinition* partDef = pp->GetG4code();
if(!partDef) partDef = particleTable->FindParticle(pp->GetPDGcode());
if(unknownParticleDefined && ((!partDef)||partDef->IsShortLived())) partDef = unknown;
return partDef;
}
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4PrimaryVertex.cc,v 1.9 2004/06/11 14:11:19 gcosmo Exp $
// GEANT4 tag $Name: geant4-06-02 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4PrimaryVertex.hh"
+43 -26
View File
@@ -64,6 +64,7 @@ G4SPSAngDistribution::G4SPSAngDistribution()
DR = 0.;
DX = 0.;
DY = 0.;
FocusPoint = G4ThreeVector(0., 0., 0.);
UserDistType = "NULL";
UserWRTSurface = true;
UserAngRef = false;
@@ -79,8 +80,8 @@ 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;
&& atype != "beam1d" && atype != "beam2d" && atype != "focused")
G4cout << "Error, distribution must be iso, cos, planar, beam1d, beam2d, focused or user" << G4endl;
else
AngDistType = atype;
if (AngDistType == "cos") MaxTheta = pi/2. ;
@@ -172,6 +173,11 @@ void G4SPSAngDistribution::UserDefAngPhi(G4ThreeVector input)
UDefPhiH.InsertValues(phhi, val);
}
void G4SPSAngDistribution::SetFocusPoint(G4ThreeVector input)
{
FocusPoint = input;
}
void G4SPSAngDistribution::SetUserWRTSurface(G4bool wrtSurf)
{
// This is only applied in user mode?
@@ -202,9 +208,9 @@ void G4SPSAngDistribution::GenerateBeamFlux()
{
px = G4RandGauss::shoot(0.0,DX);
py = G4RandGauss::shoot(0.0,DY);
theta = sqrt (px*px + py*py);
theta = std::sqrt (px*px + py*py);
if (theta != 0.) {
phi = acos(px/theta);
phi = std::acos(px/theta);
if ( py < 0.) phi = -phi;
}
else
@@ -212,9 +218,9 @@ void G4SPSAngDistribution::GenerateBeamFlux()
phi = 0.0;
}
}
px = -sin(theta) * cos(phi);
py = -sin(theta) * sin(phi);
pz = -cos(theta);
px = -std::sin(theta) * std::cos(phi);
py = -std::sin(theta) * std::sin(phi);
pz = -std::cos(theta);
G4double finx, finy, finz ;
finx = px, finy =py, finz =pz;
if (UserAngRef){
@@ -223,7 +229,7 @@ void G4SPSAngDistribution::GenerateBeamFlux()
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));
G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
@@ -237,6 +243,15 @@ void G4SPSAngDistribution::GenerateBeamFlux()
G4cout << "Generating beam vector: " << particle_momentum_direction << G4endl;
}
void G4SPSAngDistribution::GenerateFocusedFlux()
{
particle_momentum_direction = (FocusPoint - posDist->particle_position).unit();
//
// particle_momentum_direction now holds unit momentum vector.
if(verbosityLevel >= 1)
G4cout << "Generating focused vector: " << particle_momentum_direction << G4endl;
}
void G4SPSAngDistribution::GenerateIsotropicFlux()
{
// generates isotropic flux.
@@ -247,13 +262,13 @@ void G4SPSAngDistribution::GenerateIsotropicFlux()
//
G4double sintheta, sinphi,costheta,cosphi;
rndm = angRndm->GenRandTheta();
costheta = cos(MinTheta) - rndm * (cos(MinTheta) - cos(MaxTheta));
sintheta = sqrt(1. - costheta*costheta);
costheta = std::cos(MinTheta) - rndm * (std::cos(MinTheta) - std::cos(MaxTheta));
sintheta = std::sqrt(1. - costheta*costheta);
rndm2 = angRndm->GenRandPhi();
Phi = MinPhi + (MaxPhi - MinPhi) * rndm2;
sinphi = sin(Phi);
cosphi = cos(Phi);
sinphi = std::sin(Phi);
cosphi = std::cos(Phi);
px = -sintheta * cosphi;
py = -sintheta * sinphi;
@@ -288,7 +303,7 @@ void G4SPSAngDistribution::GenerateIsotropicFlux()
finz = (px*posDist->SideRefVec1.z()) + (py*posDist->SideRefVec2.z()) + (pz*posDist->SideRefVec3.z());
}
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
@@ -310,14 +325,14 @@ void G4SPSAngDistribution::GenerateCosineLawFlux()
//
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);
sintheta = std::sqrt( rndm * (std::sin(MaxTheta)*std::sin(MaxTheta) - std::sin(MinTheta)*std::sin(MinTheta) )
+std::sin(MinTheta)*std::sin(MinTheta) );
costheta = std::sqrt(1. -sintheta*sintheta);
rndm2 = angRndm->GenRandPhi();
Phi = MinPhi + (MaxPhi - MinPhi) * rndm2;
sinphi = sin(Phi);
cosphi = cos(Phi);
sinphi = std::sin(Phi);
cosphi = std::cos(Phi);
px = -sintheta * cosphi;
py = -sintheta * sinphi;
@@ -350,7 +365,7 @@ void G4SPSAngDistribution::GenerateCosineLawFlux()
finz = (px*posDist->SideRefVec1.z()) + (py*posDist->SideRefVec2.z()) + (pz*posDist->SideRefVec3.z());
}
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
@@ -398,7 +413,7 @@ void G4SPSAngDistribution::GenerateUserDefFlux()
while(Theta > MaxTheta || Theta < MinTheta)
{
rndm = angRndm->GenRandTheta();
Theta = acos(1. - (2. * rndm));
Theta = std::acos(1. - (2. * rndm));
}
Phi = 10.;
while(Phi > MaxPhi || Phi < MinPhi)
@@ -413,11 +428,11 @@ void G4SPSAngDistribution::GenerateUserDefFlux()
while(Phi > MaxPhi || Phi < MinPhi)
Phi = GenerateUserDefPhi();
}
px = -sin(Theta) * cos(Phi);
py = -sin(Theta) * sin(Phi);
pz = -cos(Theta);
px = -std::sin(Theta) * std::cos(Phi);
py = -std::sin(Theta) * std::sin(Phi);
pz = -std::cos(Theta);
pmag = sqrt((px*px) + (py*py) + (pz*pz));
pmag = std::sqrt((px*px) + (py*py) + (pz*pz));
if(!UserWRTSurface) {
G4double finx, finy, finz;
@@ -432,7 +447,7 @@ void G4SPSAngDistribution::GenerateUserDefFlux()
finy = py;
finz = pz;
}
G4double ResMag = sqrt((finx*finx) + (finy*finy) + (finz*finz));
G4double ResMag = std::sqrt((finx*finx) + (finy*finy) + (finz*finz));
finx = finx/ResMag;
finy = finy/ResMag;
finz = finz/ResMag;
@@ -458,7 +473,7 @@ void G4SPSAngDistribution::GenerateUserDefFlux()
G4double resultz = (pxh*posDist->SideRefVec1.z()) + (pyh*posDist->SideRefVec2.z()) +
(pzh*posDist->SideRefVec3.z());
G4double ResMag = sqrt((resultx*resultx) + (resulty*resulty) + (resultz*resultz));
G4double ResMag = std::sqrt((resultx*resultx) + (resulty*resulty) + (resultz*resultz));
resultx = resultx/ResMag;
resulty = resulty/ResMag;
resultz = resultz/ResMag;
@@ -592,6 +607,8 @@ G4ParticleMomentum G4SPSAngDistribution::GenerateOne()
GenerateBeamFlux();
else if(AngDistType == "user")
GenerateUserDefFlux();
else if(AngDistType == "focused")
GenerateFocusedFlux();
else
G4cout << "Error: AngDistType has unusual value" << G4endl;
return particle_momentum_direction;
+36 -36
View File
@@ -222,7 +222,7 @@ void G4SPSEneDistribution::CalculateCdgSpectrum()
{
omalpha = 1. - spind[i];
CDGhist[i+1] = CDGhist[i] + (pfact[i]/omalpha)*
(pow(ene_line[i+1],omalpha)-pow(ene_line[i],omalpha));
(std::pow(ene_line[i+1],omalpha)-std::pow(ene_line[i],omalpha));
i++;
}
@@ -242,7 +242,7 @@ void G4SPSEneDistribution::CalculateBbodySpectrum()
// Proved very hard to integrate indefinitely, so different
// method. User inputs emin, emax and T. These are used to
// create a 10,000 bin histogram.
// Use photon density spectrum = 2 nu**2/c**2 * (exp(h nu/kT)-1)
// Use photon density spectrum = 2 nu**2/c**2 * (std::exp(h nu/kT)-1)
// = 2 E**2/h**2c**2 times the exponential
G4double erange = Emax - Emin;
G4double steps = erange/10000.;
@@ -258,8 +258,8 @@ void G4SPSEneDistribution::CalculateBbodySpectrum()
while(count < 10000)
{
Bbody_x[count] = Emin + G4double(count*steps);
Bbody_y[count] = (2.*pow(Bbody_x[count],2.))/
(h2*c2*(exp(Bbody_x[count]/(k*Temp)) - 1.));
Bbody_y[count] = (2.*std::pow(Bbody_x[count],2.))/
(h2*c2*(std::exp(Bbody_x[count]/(k*Temp)) - 1.));
sum = sum + Bbody_y[count];
BBHist[count+1] = BBHist[count] + Bbody_y[count];
count++;
@@ -348,7 +348,7 @@ void G4SPSEneDistribution::LinearInterpolation()
// convert point to energy unit and its value to per energy unit
G4double total_energy;
for(count=0;count<maxi;count++) {
total_energy = sqrt((Arb_x[count]*Arb_x[count])
total_energy = std::sqrt((Arb_x[count]*Arb_x[count])
+ (mass*mass)); // total energy
Arb_y[count] = Arb_y[count] * Arb_x[count]/total_energy;
@@ -449,7 +449,7 @@ void G4SPSEneDistribution::LogInterpolation()
// convert point to energy unit and its value to per energy unit
G4double total_energy;
for(count=0;count<maxi;count++) {
total_energy = sqrt((Arb_x[count]*Arb_x[count])
total_energy = std::sqrt((Arb_x[count]*Arb_x[count])
+ (mass*mass)); // total energy
Arb_y[count] = Arb_y[count] * Arb_x[count]/total_energy;
@@ -486,10 +486,10 @@ void G4SPSEneDistribution::LogInterpolation()
Arb_y[i] = 1e-20;
}
Arb_alpha[i] = (log10(Arb_y[i])-log10(Arb_y[i-1]))/(log10(Arb_x[i])-log10(Arb_x[i-1]));
Arb_Const[i] = Arb_y[i]/(pow(Arb_x[i],Arb_alpha[i]));
Arb_alpha[i] = (std::log10(Arb_y[i])-std::log10(Arb_y[i-1]))/(std::log10(Arb_x[i])-std::log10(Arb_x[i-1]));
Arb_Const[i] = Arb_y[i]/(std::pow(Arb_x[i],Arb_alpha[i]));
alp = Arb_alpha[i] + 1;
Area_seg[i] = (Arb_Const[i]/alp) * (pow(Arb_x[i],alp) - pow(Arb_x[i-1],alp));
Area_seg[i] = (Arb_Const[i]/alp) * (std::pow(Arb_x[i],alp) - std::pow(Arb_x[i-1],alp));
sum = sum + Area_seg[i];
Arb_Cum_Area[i] = Arb_Cum_Area[i-1] + Area_seg[i];
if(verbosityLevel == 2)
@@ -546,7 +546,7 @@ void G4SPSEneDistribution::ExpInterpolation()
// convert point to energy unit and its value to per energy unit
G4double total_energy;
for(count=0;count<maxi;count++) {
total_energy = sqrt((Arb_x[count]*Arb_x[count])
total_energy = std::sqrt((Arb_x[count]*Arb_x[count])
+ (mass*mass)); // total energy
Arb_y[count] = Arb_y[count] * Arb_x[count]/total_energy;
@@ -562,13 +562,13 @@ void G4SPSEneDistribution::ExpInterpolation()
Arb_Cum_Area[0] = 0.;
while(i < maxi)
{
G4double test = log(Arb_y[i]) - log(Arb_y[i-1]);
G4double test = std::log(Arb_y[i]) - std::log(Arb_y[i-1]);
if(test > 0. || test < 0.)
{
Arb_ezero[i] = -(Arb_x[i] - Arb_x[i-1])/(log(Arb_y[i]) - log(Arb_y[i-1]));
Arb_Const[i] = Arb_y[i]/(exp(-Arb_x[i]/Arb_ezero[i]));
Area_seg[i]=-(Arb_Const[i]*Arb_ezero[i])*(exp(-Arb_x[i]/Arb_ezero[i])
-exp(-Arb_x[i-1]/Arb_ezero[i]));
Arb_ezero[i] = -(Arb_x[i] - Arb_x[i-1])/(std::log(Arb_y[i]) - std::log(Arb_y[i-1]));
Arb_Const[i] = Arb_y[i]/(std::exp(-Arb_x[i]/Arb_ezero[i]));
Area_seg[i]=-(Arb_Const[i]*Arb_ezero[i])*(std::exp(-Arb_x[i]/Arb_ezero[i])
-std::exp(-Arb_x[i-1]/Arb_ezero[i]));
}
else
{
@@ -630,7 +630,7 @@ void G4SPSEneDistribution::SplineInterpolation()
// convert point to energy unit and its value to per energy unit
G4double total_energy;
for(count=0;count<maxi;count++) {
total_energy = sqrt((Arb_x[count]*Arb_x[count])
total_energy = std::sqrt((Arb_x[count]*Arb_x[count])
+ (mass*mass)); // total energy
Arb_y[count] = Arb_y[count] * Arb_x[count]/total_energy;
@@ -685,9 +685,9 @@ void G4SPSEneDistribution::GenerateGaussEnergies()
void G4SPSEneDistribution::GenerateLinearEnergies(G4bool bArb = false)
{
G4double rndm;
G4double emaxsq = pow(Emax,2.); //Emax squared
G4double eminsq = pow(Emin,2.); //Emin squared
G4double intersq = pow(cept,2.); //cept squared
G4double emaxsq = std::pow(Emax,2.); //Emax squared
G4double eminsq = std::pow(Emin,2.); //Emin squared
G4double intersq = std::pow(cept,2.); //cept squared
if (bArb) rndm = G4UniformRand();
else rndm = eneRndm->GenRandEnergy();
@@ -702,7 +702,7 @@ void G4SPSEneDistribution::GenerateLinearEnergies(G4bool bArb = false)
{
G4double sqbrack = (intersq - 4*(grad/2.)*(bracket));
// G4cout << "SQBRACK" << sqbrack << G4endl;
sqbrack = sqrt(sqbrack);
sqbrack = std::sqrt(sqbrack);
G4double root1 = -cept + sqbrack;
root1 = root1/(2.*(grad/2.));
@@ -735,8 +735,8 @@ void G4SPSEneDistribution::GeneratePowEnergies(G4bool bArb = false)
G4double rndm;
G4double emina, emaxa;
emina = pow(Emin,alpha+1);
emaxa = pow(Emax,alpha+1);
emina = std::pow(Emin,alpha+1);
emaxa = std::pow(Emax,alpha+1);
if (bArb) rndm = G4UniformRand();
else rndm = eneRndm->GenRandEnergy();
@@ -744,12 +744,12 @@ void G4SPSEneDistribution::GeneratePowEnergies(G4bool bArb = false)
if(alpha != -1.)
{
particle_energy = ((rndm*(emaxa - emina)) + emina);
particle_energy = pow(particle_energy,(1./(alpha+1.)));
particle_energy = std::pow(particle_energy,(1./(alpha+1.)));
}
else if(alpha == -1.)
{
particle_energy = (log(Emin) + rndm*(log(Emax) - log(Emin)));
particle_energy = exp(particle_energy);
particle_energy = (std::log(Emin) + rndm*(std::log(Emax) - std::log(Emin)));
particle_energy = std::exp(particle_energy);
}
if(verbosityLevel >= 1)
G4cout << "Energy is " << particle_energy << G4endl;
@@ -764,8 +764,8 @@ void G4SPSEneDistribution::GenerateExpEnergies(G4bool bArb = false)
if (bArb) rndm = G4UniformRand();
else rndm = eneRndm->GenRandEnergy();
particle_energy = -Ezero*(log(rndm*(exp(-Emax/Ezero) - exp(-Emin/Ezero)) +
exp(-Emin/Ezero)));
particle_energy = -Ezero*(std::log(rndm*(std::exp(-Emax/Ezero) - std::exp(-Emin/Ezero)) +
std::exp(-Emin/Ezero)));
if(verbosityLevel >= 1)
G4cout << "Energy is " << particle_energy << G4endl;
}
@@ -781,11 +781,11 @@ void G4SPSEneDistribution::GenerateBremEnergies()
G4double expmax, expmin, k;
k = 8.6181e-11; // Boltzmann's const in MeV/K
G4double ksq = pow(k,2.); // k squared
G4double Tsq = pow(Temp,2.); // Temp squared
G4double ksq = std::pow(k,2.); // k squared
G4double Tsq = std::pow(Temp,2.); // Temp squared
expmax = exp(-Emax/(k*Temp));
expmin = exp(-Emin/(k*Temp));
expmax = std::exp(-Emax/(k*Temp));
expmin = std::exp(-Emin/(k*Temp));
// If either expmax or expmin are zero then this will cause problems
// Most probably this will be because T is too low or E is too high
@@ -815,7 +815,7 @@ void G4SPSEneDistribution::GenerateBremEnergies()
{
etest = Emin + (i-1)*steps;
diff = etest*(exp(-etest/(k*Temp))) + k*Temp*(exp(-etest/(k*Temp))) - bigc;
diff = etest*(std::exp(-etest/(k*Temp))) + k*Temp*(std::exp(-etest/(k*Temp))) - bigc;
if(diff < 0.)
diff = -diff;
@@ -907,9 +907,9 @@ void G4SPSEneDistribution::GenerateCdgEnergies()
i++;
}
// Generate final energy.
particle_energy = (pow(ene_line[i-1],omalpha[i-1]) + (pow(ene_line[i],omalpha[i-1])
- pow(ene_line[i-1],omalpha[i-1]))*rndm2);
particle_energy = pow(particle_energy,(1./omalpha[i-1]));
particle_energy = (std::pow(ene_line[i-1],omalpha[i-1]) + (std::pow(ene_line[i],omalpha[i-1])
- std::pow(ene_line[i-1],omalpha[i-1]))*rndm2);
particle_energy = std::pow(particle_energy,(1./omalpha[i-1]));
if(verbosityLevel >= 1)
G4cout << "Energy is " << particle_energy << G4endl;
@@ -964,7 +964,7 @@ void G4SPSEneDistribution::GenUserHistEnergies()
// to make evals counts/s/energy
for(ii=0;ii<maxbin;ii++)
{
bins[ii] = sqrt((bins[ii]*bins[ii]) + (mass*mass)) - mass; //kinetic energy
bins[ii] = std::sqrt((bins[ii]*bins[ii]) + (mass*mass)) - mass; //kinetic energy
}
for(ii=1;ii<maxbin;ii++)
{
+58 -59
View File
@@ -152,7 +152,7 @@ void G4SPSPosDistribution::SetRadius0(G4double rad)
void G4SPSPosDistribution::SetBeamSigmaInR(G4double r)
{
SR = r;
SX = SY = r/sqrt(2.);
SX = SY = r/std::sqrt(2.);
}
void G4SPSPosDistribution::SetBeamSigmaInX(G4double r)
@@ -257,7 +257,7 @@ void G4SPSPosDistribution::GeneratePointsInBeam()
{
x = Radius + 100.;
y = Radius + 100.;
while(sqrt((x*x) + (y*y)) > Radius)
while(std::sqrt((x*x) + (y*y)) > Radius)
{
x = posRndm->GenRandX();
y = posRndm->GenRandY();
@@ -320,7 +320,7 @@ void G4SPSPosDistribution::GeneratePointsInPlane()
{
x = Radius + 100.;
y = Radius + 100.;
while(sqrt((x*x) + (y*y)) > Radius)
while(std::sqrt((x*x) + (y*y)) > Radius)
{
x = posRndm->GenRandX();
y = posRndm->GenRandY();
@@ -333,7 +333,7 @@ void G4SPSPosDistribution::GeneratePointsInPlane()
{
x = Radius + 100.;
y = Radius + 100.;
while(sqrt((x*x) + (y*y)) > Radius || sqrt((x*x) + (y*y)) < Radius0 )
while(std::sqrt((x*x) + (y*y)) > Radius || std::sqrt((x*x) + (y*y)) < Radius0 )
{
x = posRndm->GenRandX();
y = posRndm->GenRandY();
@@ -436,16 +436,15 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
if(Shape == "Sphere")
{
G4double tantheta;
theta = posRndm->GenRandTheta();
phi = posRndm->GenRandPhi();
theta = acos(1. - 2.*theta); // theta isotropic
theta = posRndm->GenRandPosTheta();
phi = posRndm->GenRandPosPhi();
theta = std::acos(1. - 2.*theta); // theta isotropic
phi = phi * 2. * pi;
tantheta = tan(theta);
tantheta = std::tan(theta);
x = Radius * sin(theta) * cos(phi);
y = Radius * sin(theta) * sin(phi);
z = Radius * cos(theta);
x = Radius * std::sin(theta) * std::cos(phi);
y = Radius * std::sin(theta) * std::sin(phi);
z = Radius * std::cos(theta);
RandPos.setX(x);
RandPos.setY(y);
@@ -469,31 +468,31 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
twopi/(halfz*halfz);
// simplified approach
theta = posRndm->GenRandTheta();
phi = posRndm->GenRandPhi();
theta = acos(1. - 2.*theta);
theta = posRndm->GenRandPosTheta();
phi = posRndm->GenRandPosPhi();
theta = std::acos(1. - 2.*theta);
minphi = 0.;
maxphi = twopi;
while(maxphi-minphi > 0.)
{
middlephi = (maxphi+minphi)/2.;
answer = (1./(halfx*halfx))*(middlephi/2. + sin(2*middlephi)/4.)
+ (1./(halfy*halfy))*(middlephi/2. - sin(2*middlephi)/4.)
answer = (1./(halfx*halfx))*(middlephi/2. + std::sin(2*middlephi)/4.)
+ (1./(halfy*halfy))*(middlephi/2. - std::sin(2*middlephi)/4.)
+ middlephi/(halfz*halfz);
answer = answer/constant;
if(answer > phi) maxphi = middlephi;
if(answer < phi) minphi = middlephi;
if(fabs(answer-phi) <= 0.00001)
if(std::fabs(answer-phi) <= 0.00001)
{
minphi = maxphi +1;
phi = middlephi;
}
}
x = sin(theta)*cos(phi);
y = sin(theta)*sin(phi);
z = cos(theta);
x = std::sin(theta)*std::cos(phi);
y = std::sin(theta)*std::sin(phi);
z = std::cos(theta);
// x,y and z form a unit vector. Put this onto the ellipse.
G4double lhs;
// solve for x
@@ -504,7 +503,7 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
+ (numZinX*numZinX)/(halfz*halfz);
tempxvar = 1./tempxvar;
G4double coordx = sqrt(tempxvar);
G4double coordx = std::sqrt(tempxvar);
//solve for y
G4double numXinY = x/y;
@@ -513,7 +512,7 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
tempyvar=(numXinY*numXinY)/(halfx*halfx)+1./(halfy*halfy)
+(numZinY*numZinY)/(halfz*halfz);
tempyvar = 1./tempyvar;
G4double coordy = sqrt(tempyvar);
G4double coordy = std::sqrt(tempyvar);
//solve for z
G4double numXinZ = x/z;
@@ -522,13 +521,13 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
tempzvar=(numXinZ*numXinZ)/(halfx*halfx)
+(numYinZ*numYinZ)/(halfy*halfy)+1./(halfz*halfz);
tempzvar = 1./tempzvar;
G4double coordz = sqrt(tempzvar);
G4double coordz = std::sqrt(tempzvar);
lhs = sqrt((coordx*coordx)/(halfx*halfx) +
lhs = std::sqrt((coordx*coordx)/(halfx*halfx) +
(coordy*coordy)/(halfy*halfy) +
(coordz*coordz)/(halfz*halfz));
if(fabs(lhs-1.) > 0.001 && verbosityLevel >= 1)
if(std::fabs(lhs-1.) > 0.001 && verbosityLevel >= 1)
G4cout << "Error: theta, phi not really on ellipsoid" << G4endl;
// coordx, coordy and coordz are all positive
@@ -579,7 +578,7 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
prob1 = AreaTop / AreaTotal;
prob2 = AreaBot / AreaTotal;
prob3 = 1.00 - prob1 - prob2;
if(fabs(prob3 - (AreaLat/AreaTotal)) >= 0.001)
if(std::fabs(prob3 - (AreaLat/AreaTotal)) >= 0.001)
{
if(verbosityLevel >= 1)
G4cout << AreaLat/AreaTotal << " " << prob3<<G4endl;
@@ -636,11 +635,11 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
G4double rand;
//Point on Lateral Surface
rand = G4UniformRand();
rand = posRndm->GenRandPosPhi();
rand = rand * 2. * pi;
x = Radius * cos(rand);
y = Radius * sin(rand);
x = Radius * std::cos(rand);
y = Radius * std::sin(rand);
z = posRndm->GenRandZ();
@@ -699,14 +698,14 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
if(testrand < Probs[0])
{
// side is +x
x = halfx + z*tan(ParTheta)*cos(ParPhi) + y*tan(ParAlpha);
y = y + z*tan(ParTheta)*sin(ParPhi);
x = halfx + z*std::tan(ParTheta)*std::cos(ParPhi) + y*std::tan(ParAlpha);
y = y + z*std::tan(ParTheta)*std::sin(ParPhi);
z = z;
// Cosine-law
G4ThreeVector xdash(halfz*tan(ParTheta)*cos(ParPhi),
halfz*tan(ParTheta)*sin(ParPhi),
halfz/cos(ParPhi));
G4ThreeVector ydash(halfy*tan(ParAlpha), -halfy, 0.0);
G4ThreeVector xdash(halfz*std::tan(ParTheta)*std::cos(ParPhi),
halfz*std::tan(ParTheta)*std::sin(ParPhi),
halfz/std::cos(ParPhi));
G4ThreeVector ydash(halfy*std::tan(ParAlpha), -halfy, 0.0);
xdash = xdash.unit();
ydash = ydash.unit();
G4ThreeVector zdash = xdash.cross(ydash);
@@ -717,14 +716,14 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
else if(testrand >= Probs[0] && testrand < Probs[1])
{
// side is -x
x = -halfx + z*tan(ParTheta)*cos(ParPhi) + y*tan(ParAlpha);
y = y + z*tan(ParTheta)*sin(ParPhi);
x = -halfx + z*std::tan(ParTheta)*std::cos(ParPhi) + y*std::tan(ParAlpha);
y = y + z*std::tan(ParTheta)*std::sin(ParPhi);
z = z;
// Cosine-law
G4ThreeVector xdash(halfz*tan(ParTheta)*cos(ParPhi),
halfz*tan(ParTheta)*sin(ParPhi),
halfz/cos(ParPhi));
G4ThreeVector ydash(halfy*tan(ParAlpha), halfy, 0.0);
G4ThreeVector xdash(halfz*std::tan(ParTheta)*std::cos(ParPhi),
halfz*std::tan(ParTheta)*std::sin(ParPhi),
halfz/std::cos(ParPhi));
G4ThreeVector ydash(halfy*std::tan(ParAlpha), halfy, 0.0);
xdash = xdash.unit();
ydash = ydash.unit();
G4ThreeVector zdash = xdash.cross(ydash);
@@ -735,13 +734,13 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
else if(testrand >= Probs[1] && testrand < Probs[2])
{
// side is +y
x = x + z*tan(ParTheta)*cos(ParPhi) + halfy*tan(ParAlpha);
y = halfy + z*tan(ParTheta)*sin(ParPhi);
x = x + z*std::tan(ParTheta)*std::cos(ParPhi) + halfy*std::tan(ParAlpha);
y = halfy + z*std::tan(ParTheta)*std::sin(ParPhi);
z = z;
// Cosine-law
G4ThreeVector ydash(halfz*tan(ParTheta)*cos(ParPhi),
halfz*tan(ParTheta)*sin(ParPhi),
halfz/cos(ParPhi));
G4ThreeVector ydash(halfz*std::tan(ParTheta)*std::cos(ParPhi),
halfz*std::tan(ParTheta)*std::sin(ParPhi),
halfz/std::cos(ParPhi));
ydash = ydash.unit();
G4ThreeVector xdash = Roty.cross(ydash);
G4ThreeVector zdash = xdash.cross(ydash);
@@ -752,13 +751,13 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
else if(testrand >= Probs[2] && testrand < Probs[3])
{
// side is -y
x = x + z*tan(ParTheta)*cos(ParPhi) - halfy*tan(ParAlpha);
y = -halfy + z*tan(ParTheta)*sin(ParPhi);
x = x + z*std::tan(ParTheta)*std::cos(ParPhi) - halfy*std::tan(ParAlpha);
y = -halfy + z*std::tan(ParTheta)*std::sin(ParPhi);
z = z;
// Cosine-law
G4ThreeVector ydash(halfz*tan(ParTheta)*cos(ParPhi),
halfz*tan(ParTheta)*sin(ParPhi),
halfz/cos(ParPhi));
G4ThreeVector ydash(halfz*std::tan(ParTheta)*std::cos(ParPhi),
halfz*std::tan(ParTheta)*std::sin(ParPhi),
halfz/std::cos(ParPhi));
ydash = ydash.unit();
G4ThreeVector xdash = Roty.cross(ydash);
G4ThreeVector zdash = xdash.cross(ydash);
@@ -770,8 +769,8 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
{
// side is +z
z = halfz;
y = y + halfz*sin(ParPhi)*tan(ParTheta);
x = x + halfz*cos(ParPhi)*tan(ParTheta) + y*tan(ParAlpha);
y = y + halfz*std::sin(ParPhi)*std::tan(ParTheta);
x = x + halfz*std::cos(ParPhi)*std::tan(ParTheta) + y*std::tan(ParAlpha);
// Cosine-law
SideRefVec1 = Rotx;
SideRefVec2 = Roty;
@@ -781,8 +780,8 @@ void G4SPSPosDistribution::GeneratePointsOnSurface()
{
// side is -z
z = -halfz;
y = y - halfz*sin(ParPhi)*tan(ParTheta);
x = x - halfz*cos(ParPhi)*tan(ParTheta) + y*tan(ParAlpha);
y = y - halfz*std::sin(ParPhi)*std::tan(ParTheta);
x = x - halfz*std::cos(ParPhi)*std::tan(ParTheta) + y*std::tan(ParAlpha);
// Cosine-law
SideRefVec1 = Rotx;
SideRefVec2 = -Roty;
@@ -894,8 +893,8 @@ void G4SPSPosDistribution::GeneratePointsInVolume()
x = (x*2.*halfx) - halfx;
y = (y*2.*halfy) - halfy;
z = (z*2.*halfz) - halfz;
x = x + z*tan(ParTheta)*cos(ParPhi) + y*tan(ParAlpha);
y = y + z*tan(ParTheta)*sin(ParPhi);
x = x + z*std::tan(ParTheta)*std::cos(ParPhi) + y*std::tan(ParAlpha);
y = y + z*std::tan(ParTheta)*std::sin(ParPhi);
z = z;
}
else
+156 -4
View File
@@ -76,7 +76,11 @@ G4SPSRandomGenerator::G4SPSRandomGenerator()
IPDFPhiBias = false;
EnergyBias = false;
IPDFEnergyBias = false;
bweights[0] = bweights[1] = bweights[2] = bweights[3] = bweights[4] = bweights[5] = 1. ;
PosThetaBias = false;
IPDFPosThetaBias = false;
PosPhiBias = false;
IPDFPosPhiBias = false;
bweights[0] = bweights[1] = bweights[2] = bweights[3] = bweights[4] = bweights[5] = bweights[6] = bweights[7]= 1. ;
verbosityLevel = 0 ;
}
@@ -145,6 +149,23 @@ void G4SPSRandomGenerator::SetEnergyBias(G4ThreeVector input)
EnergyBias = true;
}
void G4SPSRandomGenerator::SetPosThetaBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
PosThetaBiasH.InsertValues(ehi, val);
PosThetaBias = true;
}
void G4SPSRandomGenerator::SetPosPhiBias(G4ThreeVector input)
{
G4double ehi, val;
ehi = input.x();
val = input.y();
PosPhiBiasH.InsertValues(ehi, val);
PosPhiBias = true;
}
void G4SPSRandomGenerator::ReSetHist(G4String atype)
{
@@ -172,13 +193,19 @@ void G4SPSRandomGenerator::ReSetHist(G4String atype)
EnergyBias = false ;
IPDFEnergyBias = false;
EnergyBiasH = IPDFEnergyBiasH = ZeroPhysVector ;}
else if ( atype == "biaspt") {
PosThetaBias = false ;
IPDFPosThetaBias = false;
PosThetaBiasH = IPDFPosThetaBiasH = ZeroPhysVector ;}
else if ( atype == "biaspp") {
PosPhiBias = false ;
IPDFPosPhiBias = false;
PosPhiBiasH = IPDFPosPhiBiasH = ZeroPhysVector ;}
else {
G4cout << "Error, histtype not accepted " << G4endl;
}
}
G4double G4SPSRandomGenerator::GenRandX()
{
if(verbosityLevel >= 1)
@@ -557,7 +584,132 @@ G4double G4SPSRandomGenerator::GenRandEnergy()
}
G4double G4SPSRandomGenerator::GenRandPosTheta()
{
if(verbosityLevel >= 1)
{
G4cout << "In GenRandPosTheta" << G4endl;
G4cout << "Verbosity " << verbosityLevel << G4endl;
}
if(PosThetaBias == false)
{
// Theta is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// Theta is biased
if(IPDFPosThetaBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(ThetaBiasH.GetVectorLength());
bins[0] = PosThetaBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = PosThetaBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = PosThetaBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = PosThetaBiasH(size_t(ii)) + vals[ii-1];
sum = sum + PosThetaBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFPosThetaBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFThetaBias = true
IPDFPosThetaBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// size_t weight_bin_no = IPDFThetaBiasH.FindValueBinLocation(rndm);
size_t numberOfBin = IPDFPosThetaBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFPosThetaBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[6] = IPDFPosThetaBiasH(biasn2) - IPDFPosThetaBiasH(biasn2 - 1);
G4double xaxisl = IPDFPosThetaBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFPosThetaBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[6] = NatProb/bweights[6];
if(verbosityLevel >= 1)
G4cout << "PosTheta bin weight " << bweights[6] << " " << rndm << G4endl;
return(IPDFPosThetaBiasH.GetEnergy(rndm));
}
}
G4double G4SPSRandomGenerator::GenRandPosPhi()
{
if(verbosityLevel >= 1)
G4cout << "In GenRandPosPhi" << G4endl;
if(PosPhiBias == false)
{
// PosPhi is not biased
G4double rndm = G4UniformRand();
return(rndm);
}
else
{
// PosPhi is biased
if(IPDFPosPhiBias == false)
{
// IPDF has not been created, so create it
G4double bins[1024],vals[1024], sum;
G4int ii;
G4int maxbin = G4int(PosPhiBiasH.GetVectorLength());
bins[0] = PosPhiBiasH.GetLowEdgeEnergy(size_t(0));
vals[0] = PosPhiBiasH(size_t(0));
sum = vals[0];
for(ii=1;ii<maxbin;ii++)
{
bins[ii] = PosPhiBiasH.GetLowEdgeEnergy(size_t(ii));
vals[ii] = PosPhiBiasH(size_t(ii)) + vals[ii-1];
sum = sum + PosPhiBiasH(size_t(ii));
}
for(ii=0;ii<maxbin;ii++)
{
vals[ii] = vals[ii]/sum;
IPDFPosPhiBiasH.InsertValues(bins[ii], vals[ii]);
}
// Make IPDFPosPhiBias = true
IPDFPosPhiBias = true;
}
// IPDF has been create so carry on
G4double rndm = G4UniformRand();
// size_t weight_bin_no = IPDFPosPhiBiasH.FindValueBinLocation(rndm);
size_t numberOfBin = IPDFPosPhiBiasH.GetVectorLength();
G4int biasn1 = 0;
G4int biasn2 = numberOfBin/2;
G4int biasn3 = numberOfBin - 1;
while (biasn1 != biasn3 - 1) {
if (rndm > IPDFPosPhiBiasH(biasn2))
biasn1 = biasn2;
else
biasn3 = biasn2;
biasn2 = biasn1 + (biasn3 - biasn1 + 1)/2;
}
bweights[7] = IPDFPosPhiBiasH(biasn2) - IPDFPosPhiBiasH(biasn2 - 1);
G4double xaxisl = IPDFPosPhiBiasH.GetLowEdgeEnergy(size_t(biasn2-1));
G4double xaxisu = IPDFPosPhiBiasH.GetLowEdgeEnergy(size_t(biasn2));
G4double NatProb = xaxisu - xaxisl;
bweights[7] = NatProb/bweights[7];
if(verbosityLevel >= 1)
G4cout << "PosPhi bin weight " << bweights[4] << " " << rndm << G4endl;
return(IPDFPosPhiBiasH.GetEnergy(rndm));
}
}
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4ScoreTable.cc,v 1.3 2003/06/16 16:50:36 gunter Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4Scorer.cc,v 1.1 2002/10/28 10:06:01 dressel Exp $
// GEANT4 tag $Name: geant4-05-02-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
// ----------------------------------------------------------------------
// GEANT 4 class source file
+39 -35
View File
@@ -107,49 +107,53 @@ void G4SingleParticleSource::GeneratePrimaryVertex(G4Event *evt)
{
if(particle_definition==NULL) return;
if(verbosityLevel > 1)
G4cout << " NumberOfParticlesToBeGenerated: "<<NumberOfParticlesToBeGenerated << G4endl;
// 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();
for( G4int i=0; i<NumberOfParticlesToBeGenerated; i++ ) {
// Angular stuff
particle_momentum_direction = angGenerator->GenerateOne();
// Energy stuff
particle_energy = eneGenerator->GenerateOne(particle_definition);
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 = std::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);
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;
}
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();
// pass it to primary particle
particle->SetWeight(particle_weight);
}
// now pass the weight to the primary vertex
vertex->SetWeight(particle_weight);
evt->AddPrimaryVertex( vertex );
if(verbosityLevel > 1)
G4cout << " Primary Vetex generated !"<< G4endl;
+1 -1
View File
@@ -22,7 +22,7 @@
//
//
// $Id: G4StackChecker.cc,v 1.1 2003/06/12 15:14:44 vnivanch Exp $
// GEANT4 tag $Name: geant4-06-00-patch-01 $
// GEANT4 tag $Name: geant4-07-00-cand-01 $
//
#include "G4StackChecker.hh"

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