Import Geant4 9.3.0 source tree
This commit is contained in:
+33
-1
@@ -1,4 +1,4 @@
|
||||
$Id: History,v 1.120 2008/09/02 09:56:49 gcosmo Exp $
|
||||
$Id: History,v 1.127 2009/11/18 17:57:59 gcosmo Exp $
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=========================================================
|
||||
@@ -17,6 +17,38 @@ committal in the CVS repository !
|
||||
* Reverse chronological order (last date on top), please *
|
||||
----------------------------------------------------------
|
||||
|
||||
Movember 18th, 2009, G.Cosmo (event-V09-02-05)
|
||||
- Fixes to "Adjoint" classes to allow build of DLLs on Windows: renamed all
|
||||
methods and data holding "External" as keyword to "Ext".
|
||||
Cleanup of the code: use "const G4String&" instead of "G4String" wherever
|
||||
possible; use G4 types in consistent way; avoid usage of "isNan"; code
|
||||
formatting cleanup; added Geant4 disclaimer.
|
||||
|
||||
November 6, 2009, L.Desorgher (event-V09-02-04)
|
||||
- First commit of G4Adjoint calsses for event category
|
||||
New classes are G4AdjointPosOnPhysVolGenerator,G4AdjointPrimaryGenerator, G4AdjointStackingAction
|
||||
|
||||
September 16, 2009, M.Asai (event-V09-02-03)
|
||||
- Improved the logic in G4SmartTrackStack.
|
||||
- Added /event/stack/verbose to have a short report of peak number of tracks in
|
||||
the urgent stack.
|
||||
|
||||
August 17, 2009, M.Asai (event-V09-02-02)
|
||||
- Introducing G4SmartTrackStack class. By using this new stack as the urgent stack of
|
||||
G4StackManager, the next track poped up from the stack is not necessarily the last
|
||||
track stored in the stack, but the track of same particle type as the previous one,
|
||||
as long as such a track exists in the urgent stack. This mechanism is expected to
|
||||
improve the performance for ultra-large scale simulation such as LHC, by increasing
|
||||
the cashe hit rate of the physics tables.
|
||||
- The use of G4SmartTrackStack is optional. To use it, uncomment the "#define" line
|
||||
in include/evmandefs.hh.
|
||||
|
||||
June 29, 2009, M.Asai (event-V09-02-01)
|
||||
- Fix warning message in G4SPSEneDistribution.cc.
|
||||
|
||||
February 17, 2009, F. Lei (event-V09-02-00)
|
||||
- Minor chnages to G4GeneralParticleSourceMessenger.cc. It now uses the full ranges of units pre-defined in G4 for length, energy and angle.
|
||||
|
||||
September 02, 2008, G.Cosmo (event-V09-01-01)
|
||||
- Removed some redundant semicolons in G4SPSAngDistribution header...
|
||||
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointPosOnPhysVolGenerator.hh,v 1.2 2009/11/18 17:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointPosOnPhysVolGenerator
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CHANGE HISTORY
|
||||
// --------------
|
||||
// ChangeHistory:
|
||||
// 1st June 2006 creation by L. Desorgher
|
||||
//
|
||||
//-------------------------------------------------------------
|
||||
// Documentation:
|
||||
// This class is responsible for the generation of primary adjoint particle on the external surface of a user selected volume.
|
||||
// The particle are generated uniformly on the surface with the angular distribution set to a cosine law relative to normal of the surface.
|
||||
// It is equivalent to the flux going in from the surface if an isotropic flux is considered outside.
|
||||
// It uses ray tracking technique and can be applied to all kind of convex volume. Uisng the ray tracking technique the area
|
||||
// of the external surface is also computed. The area is needed to fix the weight of the primary adjoint particle.
|
||||
// At the time of the development of this class, generation of particle on volume surface and computation of surface was limited in G4,
|
||||
// therfore the general ray tracking technique was adopted. It could be now (2009) that direct method of G4VSolid could be used instead. To be checked!
|
||||
//
|
||||
//
|
||||
//
|
||||
#ifndef G4AdjointPosOnPhysVolGenerator_h
|
||||
#define G4AdjointPosOnPhysVolGenerator_h 1
|
||||
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
class G4VSolid;
|
||||
|
||||
class G4AdjointPosOnPhysVolGenerator
|
||||
///////////////////////
|
||||
{
|
||||
|
||||
//--------
|
||||
public: //without description
|
||||
//--------
|
||||
|
||||
static G4AdjointPosOnPhysVolGenerator* GetInstance();
|
||||
|
||||
//--------
|
||||
public: //public methods
|
||||
//--------
|
||||
G4VPhysicalVolume* DefinePhysicalVolume(const G4String& aName);
|
||||
void DefinePhysicalVolume1(const G4String& aName);
|
||||
G4double ComputeAreaOfExtSurface();
|
||||
G4double ComputeAreaOfExtSurface(G4int NStat);
|
||||
G4double ComputeAreaOfExtSurface(G4double epsilon);
|
||||
G4double ComputeAreaOfExtSurface(G4VSolid* aSolid);
|
||||
G4double ComputeAreaOfExtSurface(G4VSolid* aSolid,G4int NStat);
|
||||
G4double ComputeAreaOfExtSurface(G4VSolid* aSolid,G4double epsilon);
|
||||
|
||||
void GenerateAPositionOnTheExtSurfaceOfASolid(G4VSolid* aSolid,G4ThreeVector& p, G4ThreeVector& direction);
|
||||
void GenerateAPositionOnTheExtSurfaceOfTheSolid(G4ThreeVector& p, G4ThreeVector& direction);
|
||||
void GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(G4ThreeVector& p, G4ThreeVector& direction);
|
||||
void GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(G4ThreeVector& p, G4ThreeVector& direction,
|
||||
G4double& costh_to_normal);
|
||||
|
||||
//inline public methods
|
||||
|
||||
inline void SetSolid(G4VSolid* aSolid){theSolid=aSolid;}
|
||||
inline G4double GetAreaOfExtSurfaceOfThePhysicalVolume(){return AreaOfExtSurfaceOfThePhysicalVolume;}
|
||||
inline G4double GetCosThDirComparedToNormal(){return CosThDirComparedToNormal;}
|
||||
|
||||
//---------
|
||||
private: //private methods
|
||||
//---------
|
||||
G4AdjointPosOnPhysVolGenerator();
|
||||
~G4AdjointPosOnPhysVolGenerator();
|
||||
G4double ComputeAreaOfExtSurfaceStartingFromSphere(G4VSolid* aSolid,G4int NStat);
|
||||
G4double ComputeAreaOfExtSurfaceStartingFromBox(G4VSolid* aSolid,G4int NStat);
|
||||
void GenerateAPositionOnASolidBoundary(G4VSolid* aSolid,G4ThreeVector& p, G4ThreeVector& direction);
|
||||
G4double GenerateAPositionOnASphereBoundary(G4VSolid* aSolid,G4ThreeVector& p, G4ThreeVector& direction);
|
||||
G4double GenerateAPositionOnABoxBoundary(G4VSolid* aSolid,G4ThreeVector& p, G4ThreeVector& direction);
|
||||
void ComputeTransformationFromPhysVolToWorld();
|
||||
|
||||
//---------
|
||||
private: //attributes
|
||||
//---------
|
||||
static G4AdjointPosOnPhysVolGenerator* theInstance;
|
||||
G4VSolid* theSolid;
|
||||
G4VPhysicalVolume* thePhysicalVolume;
|
||||
G4int NStat;
|
||||
G4double epsilon;
|
||||
G4bool UseSphere;
|
||||
G4String ModelOfSurfaceSource;
|
||||
G4double ExtSourceRadius;
|
||||
G4double ExtSourceDx,ExtSourceDy,ExtSourceDz ;
|
||||
G4AffineTransform theTransformationFromPhysVolToWorld;
|
||||
G4double AreaOfExtSurfaceOfThePhysicalVolume;
|
||||
G4double CosThDirComparedToNormal;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointPrimaryGenerator.hh,v 1.2 2009/11/18 17:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Module: G4AdjointPrimaryGenerator
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CHANGE HISTORY
|
||||
// --------------
|
||||
// ChangeHistory:
|
||||
// November 2009 creation by L. Desorgher, Splitting of G4AdjointPrimaryGeneratorAction in two classes G4AdjointPrimaryGeneratorAction and G4AdjointPrimaryGenerator
|
||||
//
|
||||
//-------------------------------------------------------------
|
||||
// Documentation:
|
||||
// This class represents the Primary Generator that generate vertex (energy,position and direction) of primary adjoint particles.
|
||||
// It is used by G4AdjointPrimaryGeneratorAction. If the adjoint source is selected by the user as being on the external boundary of a volume
|
||||
// it uses the class G4AdjointPosOnPhysVolGenerator to generate the vertex positions and directions. Otherwise G4SingleParticleSource is used.
|
||||
//
|
||||
//
|
||||
//
|
||||
#ifndef G4AdjointPrimaryGenerator_h
|
||||
#define G4AdjointPrimaryGenerator_h 1
|
||||
#include "globals.hh"
|
||||
#include"G4ThreeVector.hh"
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <iterator>
|
||||
|
||||
class G4AdjointPosOnPhysVolGenerator;
|
||||
class G4Event;
|
||||
class G4SingleParticleSource;
|
||||
class G4ParticleDefinition;
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class G4AdjointPrimaryGenerator
|
||||
{
|
||||
public: //constructor, destructor
|
||||
|
||||
G4AdjointPrimaryGenerator();
|
||||
~G4AdjointPrimaryGenerator();
|
||||
|
||||
public: //public methods
|
||||
|
||||
void GenerateAdjointPrimaryVertex(G4Event* anEvt,G4ParticleDefinition* adj_part,G4double E1,G4double E2);
|
||||
void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos);
|
||||
void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String& volume_name);
|
||||
|
||||
private: //attributes
|
||||
|
||||
//The class responsible for the random generation of positions and direction of primaries for adjoint source set on the external surface of
|
||||
//a G4 volume
|
||||
G4AdjointPosOnPhysVolGenerator* theG4AdjointPosOnPhysVolGenerator;
|
||||
|
||||
G4SingleParticleSource* theSingleParticleSource;
|
||||
|
||||
//Type of adjoint source
|
||||
//--------------------
|
||||
G4String type_of_adjoint_source; //Spherical ExtSurfaceOfAVolume
|
||||
G4double radius_spherical_source;
|
||||
G4ThreeVector center_spherical_source;
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointStackingAction.hh,v 1.2 2009/11/18 17:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointStackingAction
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// CHANGE HISTORY
|
||||
// --------------
|
||||
// ChangeHistory:
|
||||
// -April 2008 First implementation by L. Desorgher
|
||||
// -4-11-2009 Adding the possibility to use user adjoint stacking action, L. Desorgher
|
||||
//
|
||||
//
|
||||
//-------------------------------------------------------------
|
||||
// Documentation:
|
||||
// Stacking action used in the adjoint simulation. It is responsible to kill a primary forward particle before it is traked in the forwrad phase
|
||||
// if the last adjoint particle did not reach the adjoint surface. Was needed for the new design where the G4AdjointSimManager is no more an extension
|
||||
// of the G4RunManager. If the primary particles is not killed before being tracked in the sensitive geometry, the User Stacking action
|
||||
// can be used duiring the forward phase if specified by the method G4AdjointSimManager::UseUserStackingAction(Bool).
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
#ifndef G4AdjointStackingAction_h
|
||||
#define G4AdjointStackingAction_h 1
|
||||
|
||||
#include "globals.hh"
|
||||
#include "G4UserStackingAction.hh"
|
||||
|
||||
class G4Track;
|
||||
class G4ParticleDefinition;
|
||||
|
||||
class G4AdjointStackingAction : public G4UserStackingAction
|
||||
{
|
||||
public:
|
||||
G4AdjointStackingAction();
|
||||
virtual ~G4AdjointStackingAction();
|
||||
|
||||
public:
|
||||
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
|
||||
virtual void NewStage();
|
||||
virtual void PrepareNewEvent();
|
||||
inline void SetUserFwdStackingAction(G4UserStackingAction* anAction){theFwdStackingAction = anAction;}
|
||||
inline void SetUserAdjointStackingAction(G4UserStackingAction* anAction){theUserAdjointStackingAction = anAction;}
|
||||
|
||||
inline void SetKillTracks(G4bool aBool){kill_tracks =aBool;}
|
||||
inline void SetAdjointMode(G4bool aBool){adjoint_mode=aBool;}
|
||||
|
||||
private:
|
||||
G4UserStackingAction* theFwdStackingAction;
|
||||
G4UserStackingAction* theUserAdjointStackingAction;
|
||||
G4bool kill_tracks, adjoint_mode;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SmartTrackStack.hh,v 1.3 2009/09/16 23:10:46 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
// Last Modification : 09/Dec/96 M.Asai
|
||||
//
|
||||
|
||||
|
||||
#ifndef G4SmartTrackStack_h
|
||||
#define G4SmartTrackStack_h 1
|
||||
|
||||
#include "G4StackedTrack.hh"
|
||||
#include "G4TrackStack.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a stack class used by G4StackManager. This class object
|
||||
// stores G4StackedTrack class objects in the form of bi-directional
|
||||
// linked list.
|
||||
|
||||
class G4SmartTrackStack
|
||||
{
|
||||
public:
|
||||
G4SmartTrackStack();
|
||||
~G4SmartTrackStack();
|
||||
|
||||
private:
|
||||
const G4SmartTrackStack & operator=
|
||||
(const G4SmartTrackStack &right);
|
||||
G4int operator==(const G4SmartTrackStack &right) const;
|
||||
G4int operator!=(const G4SmartTrackStack &right) const;
|
||||
|
||||
public:
|
||||
void PushToStack(G4StackedTrack * aStackedTrack);
|
||||
G4StackedTrack * PopFromStack();
|
||||
void clear();
|
||||
void TransferTo(G4TrackStack * aStack);
|
||||
|
||||
private:
|
||||
G4int fTurn;
|
||||
G4int nTurn; // should be 5
|
||||
G4TrackStack* stacks[5];
|
||||
// = 0 : all primaries and secondaries except followings
|
||||
// = 1 : secondary neutrons
|
||||
// = 2 : secondary electrons
|
||||
// = 3 : secondary gammas
|
||||
// = 4 : secondary positrons
|
||||
G4int nStick;
|
||||
G4int safetyValve1;
|
||||
G4int safetyValve2;
|
||||
G4int maxNTracks;
|
||||
|
||||
public:
|
||||
inline G4int GetNTrack() const
|
||||
{ return n_stackedTrack(); }
|
||||
inline G4int GetMaxNTrack() const
|
||||
{ return maxNTracks; }
|
||||
|
||||
private:
|
||||
inline G4int n_stackedTrack() const
|
||||
{
|
||||
return stacks[0]->GetNTrack()+stacks[1]->GetNTrack()
|
||||
+stacks[2]->GetNTrack()+stacks[3]->GetNTrack()+stacks[4]->GetNTrack();
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4StackManager.hh,v 1.12 2006/06/29 18:09:07 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4StackManager.hh,v 1.13 2009/08/15 15:45:50 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
|
||||
@@ -36,10 +36,12 @@
|
||||
#include "G4UserStackingAction.hh"
|
||||
#include "G4StackedTrack.hh"
|
||||
#include "G4TrackStack.hh"
|
||||
#include "G4SmartTrackStack.hh"
|
||||
#include "G4ClassificationOfNewTrack.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4TrackStatus.hh"
|
||||
#include "globals.hh"
|
||||
#include "evmandefs.hh"
|
||||
class G4StackingMessenger;
|
||||
class G4VTrajectory;
|
||||
|
||||
@@ -108,7 +110,11 @@ class G4StackManager
|
||||
private:
|
||||
G4UserStackingAction * userStackingAction;
|
||||
G4int verboseLevel;
|
||||
#ifdef G4_USESMARTSTACK
|
||||
G4SmartTrackStack * urgentStack;
|
||||
#else
|
||||
G4TrackStack * urgentStack;
|
||||
#endif
|
||||
G4TrackStack * waitingStack;
|
||||
G4TrackStack * postponeStack;
|
||||
G4StackingMessenger* theMessenger;
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4StackingMessenger.hh,v 1.5 2006/06/29 18:09:11 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4StackingMessenger.hh,v 1.6 2009/09/16 23:10:46 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
|
||||
#ifndef G4StackingMessenger_h
|
||||
@@ -44,6 +44,7 @@ class G4UIcmdWithAnInteger;
|
||||
// /event/stack/
|
||||
// /event/stack/status
|
||||
// /event/stack/clear
|
||||
// /event/stack/verbose
|
||||
|
||||
class G4StackingMessenger: public G4UImessenger
|
||||
{
|
||||
@@ -56,6 +57,7 @@ class G4StackingMessenger: public G4UImessenger
|
||||
G4UIdirectory* stackDir;
|
||||
G4UIcmdWithoutParameter* statusCmd;
|
||||
G4UIcmdWithAnInteger* clearCmd;
|
||||
G4UIcmdWithAnInteger* verboseCmd;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TrackStack.hh,v 1.6 2006/06/29 18:09:13 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4TrackStack.hh,v 1.8 2009/09/10 21:31:41 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
// Last Modification : 09/Dec/96 M.Asai
|
||||
@@ -38,6 +38,8 @@
|
||||
#include "G4StackedTrack.hh"
|
||||
#include "globals.hh"
|
||||
|
||||
class G4SmartTrackStack;
|
||||
|
||||
// class description:
|
||||
//
|
||||
// This is a stack class used by G4StackManager. This class object
|
||||
@@ -62,15 +64,20 @@ class G4TrackStack
|
||||
void GrabFromStack(G4StackedTrack * aStackedTrack);
|
||||
void clear();
|
||||
void TransferTo(G4TrackStack * aStack);
|
||||
void TransferTo(G4SmartTrackStack * aStack);
|
||||
|
||||
private:
|
||||
G4int n_stackedTrack;
|
||||
G4StackedTrack * firstStackedTrack;
|
||||
G4StackedTrack * lastStackedTrack;
|
||||
G4int maxNTracks;
|
||||
|
||||
public:
|
||||
inline G4int GetNTrack() const
|
||||
{ return n_stackedTrack; }
|
||||
inline G4int GetMaxNTrack() const
|
||||
{ return maxNTracks; }
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: evmandefs.hh,v 1.4 2006/06/29 18:09:27 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: evmandefs.hh,v 1.7 2009/09/16 23:10:46 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
|
||||
///#define G4EVENTMANAGER_DEBUG 1
|
||||
@@ -36,3 +36,8 @@
|
||||
|
||||
#include "trajectoryControl.hh"
|
||||
|
||||
//================ G4SmartStack ===================
|
||||
//
|
||||
//#define G4_USESMARTSTACK 1
|
||||
//
|
||||
|
||||
|
||||
@@ -0,0 +1,423 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointPosOnPhysVolGenerator.cc,v 1.2 2009/11/18 17:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointCrossSurfChecker
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "G4AdjointPosOnPhysVolGenerator.hh"
|
||||
#include "G4VSolid.hh"
|
||||
#include "G4VoxelLimits.hh"
|
||||
#include "G4AffineTransform.hh"
|
||||
#include "Randomize.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4PhysicalVolumeStore.hh"
|
||||
#include "G4LogicalVolumeStore.hh"
|
||||
|
||||
G4AdjointPosOnPhysVolGenerator* G4AdjointPosOnPhysVolGenerator::theInstance = 0;
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointPosOnPhysVolGenerator* G4AdjointPosOnPhysVolGenerator::GetInstance()
|
||||
{
|
||||
if(theInstance == 0) {
|
||||
static G4AdjointPosOnPhysVolGenerator manager;
|
||||
theInstance = &manager;
|
||||
}
|
||||
return theInstance;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointPosOnPhysVolGenerator::~G4AdjointPosOnPhysVolGenerator()
|
||||
{
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointPosOnPhysVolGenerator::G4AdjointPosOnPhysVolGenerator()
|
||||
{
|
||||
theSolid=0;
|
||||
NStat =1000000;
|
||||
epsilon=0.001;
|
||||
ModelOfSurfaceSource = "OnSolid"; //OnSolid, ExternalSphere, ExternalBox
|
||||
thePhysicalVolume = 0;
|
||||
theTransformationFromPhysVolToWorld = G4AffineTransform();
|
||||
UseSphere =true;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4VPhysicalVolume* G4AdjointPosOnPhysVolGenerator::DefinePhysicalVolume(const G4String& aName)
|
||||
{
|
||||
thePhysicalVolume = 0;
|
||||
theSolid =0;
|
||||
G4PhysicalVolumeStore* thePhysVolStore =G4PhysicalVolumeStore::GetInstance();
|
||||
for ( unsigned int i=0; i< thePhysVolStore->size();i++){
|
||||
G4String vol_name =(*thePhysVolStore)[i]->GetName();
|
||||
if (vol_name == ""){
|
||||
vol_name = (*thePhysVolStore)[i]->GetLogicalVolume()->GetName();
|
||||
}
|
||||
if (vol_name == aName){
|
||||
thePhysicalVolume = (*thePhysVolStore)[i];
|
||||
}
|
||||
}
|
||||
if (thePhysicalVolume){
|
||||
theSolid = thePhysicalVolume->GetLogicalVolume()->GetSolid();
|
||||
ComputeTransformationFromPhysVolToWorld();
|
||||
/*AreaOfExtSurfaceOfThePhysicalVolume=ComputeAreaOfExtSurface(1.e-3);
|
||||
G4cout<<"Monte Carlo Estimate of the area of the external surface :"<<AreaOfExtSurfaceOfThePhysicalVolume/m/m<<" m2"<<std::endl;*/
|
||||
}
|
||||
else {
|
||||
G4cout<<"The physical volume with name "<<aName<<" does not exist!!"<<std::endl;
|
||||
G4cout<<"Before generating a source on an external surface of a volume you should select another physical volume"<<std::endl;
|
||||
}
|
||||
return thePhysicalVolume;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPosOnPhysVolGenerator::DefinePhysicalVolume1(const G4String& aName)
|
||||
{
|
||||
thePhysicalVolume = DefinePhysicalVolume(aName);
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface()
|
||||
{
|
||||
return ComputeAreaOfExtSurface(theSolid);
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4int NStat)
|
||||
{
|
||||
return ComputeAreaOfExtSurface(theSolid,NStat);
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4double epsilon)
|
||||
{
|
||||
return ComputeAreaOfExtSurface(theSolid,epsilon);
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4VSolid* aSolid)
|
||||
{
|
||||
return ComputeAreaOfExtSurface(aSolid,1.e-3);
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4VSolid* aSolid,G4int NStat)
|
||||
{
|
||||
if (ModelOfSurfaceSource == "OnSolid" ){
|
||||
if (UseSphere){
|
||||
return ComputeAreaOfExtSurfaceStartingFromSphere(aSolid,NStat);
|
||||
|
||||
}
|
||||
else {
|
||||
return ComputeAreaOfExtSurfaceStartingFromBox(aSolid,NStat);
|
||||
}
|
||||
}
|
||||
else {
|
||||
G4ThreeVector p,dir;
|
||||
if (ModelOfSurfaceSource == "ExternalSphere" ) return GenerateAPositionOnASphereBoundary(aSolid, p,dir);
|
||||
return GenerateAPositionOnABoxBoundary(aSolid, p,dir);
|
||||
}
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurface(G4VSolid* aSolid,G4double epsilon)
|
||||
{
|
||||
G4int Nstat = G4int(1./(epsilon*epsilon));
|
||||
return ComputeAreaOfExtSurface(aSolid,Nstat);
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
void G4AdjointPosOnPhysVolGenerator::GenerateAPositionOnTheExtSurfaceOfASolid(G4VSolid* aSolid,G4ThreeVector& p, G4ThreeVector& direction)
|
||||
{
|
||||
G4double area;
|
||||
area =1.;
|
||||
if (ModelOfSurfaceSource == "OnSolid" ){
|
||||
return GenerateAPositionOnASolidBoundary(aSolid, p,direction);
|
||||
}
|
||||
if (ModelOfSurfaceSource == "ExternalSphere" ) {
|
||||
area = GenerateAPositionOnASphereBoundary(aSolid, p, direction);
|
||||
return;
|
||||
}
|
||||
area = GenerateAPositionOnABoxBoundary(aSolid, p, direction);
|
||||
return;
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
void G4AdjointPosOnPhysVolGenerator::GenerateAPositionOnTheExtSurfaceOfTheSolid(G4ThreeVector& p, G4ThreeVector& direction)
|
||||
{
|
||||
GenerateAPositionOnTheExtSurfaceOfASolid(theSolid,p,direction);
|
||||
}
|
||||
////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurfaceStartingFromBox(G4VSolid* aSolid,G4int Nstat)
|
||||
{
|
||||
G4double area=1.;
|
||||
G4int i=0;
|
||||
G4int j=0;
|
||||
while (i<Nstat){
|
||||
G4ThreeVector p, direction;
|
||||
area = GenerateAPositionOnABoxBoundary( aSolid,p, direction);
|
||||
G4double dist_to_in = aSolid->DistanceToIn(p,direction);
|
||||
if (dist_to_in<kInfinity/2.) i++;
|
||||
j++;
|
||||
}
|
||||
area=area*double(i)/double(j);
|
||||
return area;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::ComputeAreaOfExtSurfaceStartingFromSphere(G4VSolid* aSolid,G4int Nstat)
|
||||
{
|
||||
G4double area=1.;
|
||||
G4int i=0;
|
||||
G4int j=0;
|
||||
while (i<Nstat){
|
||||
G4ThreeVector p, direction;
|
||||
area = GenerateAPositionOnASphereBoundary( aSolid,p, direction);
|
||||
G4double dist_to_in = aSolid->DistanceToIn(p,direction);
|
||||
if (dist_to_in<kInfinity/2.) i++;
|
||||
j++;
|
||||
}
|
||||
area=area*double(i)/double(j);
|
||||
|
||||
return area;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPosOnPhysVolGenerator::GenerateAPositionOnASolidBoundary(G4VSolid* aSolid,G4ThreeVector& p, G4ThreeVector& direction)
|
||||
{
|
||||
G4bool find_pos =false;
|
||||
G4double area=1.;
|
||||
while (!find_pos){
|
||||
if (UseSphere) area = GenerateAPositionOnASphereBoundary( aSolid,p, direction);
|
||||
else area = GenerateAPositionOnABoxBoundary( aSolid,p, direction);
|
||||
G4double dist_to_in = aSolid->DistanceToIn(p,direction);
|
||||
if (dist_to_in<kInfinity/2.) {
|
||||
find_pos =true;
|
||||
G4ThreeVector p1=p+ 0.99999*direction*dist_to_in;
|
||||
G4ThreeVector norm =aSolid->SurfaceNormal(p1);
|
||||
p+= 0.999999*direction*dist_to_in;
|
||||
CosThDirComparedToNormal=direction.dot(-norm);
|
||||
//std::cout<<CosThDirComparedToNormal<<std::endl;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::GenerateAPositionOnASphereBoundary(G4VSolid* aSolid,G4ThreeVector& p, G4ThreeVector& direction)
|
||||
{
|
||||
G4double minX,maxX,minY,maxY,minZ,maxZ;
|
||||
G4bool yesno;
|
||||
|
||||
// values needed for CalculateExtent signature
|
||||
|
||||
G4VoxelLimits limit; // Unlimited
|
||||
G4AffineTransform origin;
|
||||
|
||||
// min max extents of pSolid along X,Y,Z
|
||||
|
||||
yesno = aSolid->CalculateExtent(kXAxis,limit,origin,minX,maxX);
|
||||
yesno = aSolid->CalculateExtent(kYAxis,limit,origin,minY,maxY);
|
||||
yesno = aSolid->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
|
||||
|
||||
G4ThreeVector center = G4ThreeVector((minX+maxX)/2.,(minY+maxY)/2.,(minZ+maxZ)/2.);
|
||||
|
||||
G4double dX=(maxX-minX)/2.;
|
||||
G4double dY=(maxY-minY)/2.;
|
||||
G4double dZ=(maxZ-minZ)/2.;
|
||||
G4double scale=1.01;
|
||||
G4double r=scale*std::sqrt(dX*dX+dY*dY+dZ*dZ);
|
||||
|
||||
G4double cos_th2 = G4UniformRand();
|
||||
G4double theta = std::acos(std::sqrt(cos_th2));
|
||||
G4double phi=G4UniformRand()*3.1415926*2;
|
||||
direction.setRThetaPhi(1.,theta,phi);
|
||||
direction=-direction;
|
||||
G4double cos_th = (1.-2.*G4UniformRand());
|
||||
theta = std::acos(cos_th);
|
||||
if (G4UniformRand() <0.5) theta=3.1415926-theta;
|
||||
phi=G4UniformRand()*3.1415926*2;
|
||||
p.setRThetaPhi(r,theta,phi);
|
||||
p+=center;
|
||||
direction.rotateY(theta);
|
||||
direction.rotateZ(phi);
|
||||
return 4.*3.1415926*r*r;;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4double G4AdjointPosOnPhysVolGenerator::GenerateAPositionOnABoxBoundary(G4VSolid* aSolid,G4ThreeVector& p, G4ThreeVector& direction)
|
||||
{
|
||||
|
||||
G4double ran_var,px,py,pz,minX,maxX,minY,maxY,minZ,maxZ;
|
||||
G4bool yesno;
|
||||
|
||||
// values needed for CalculateExtent signature
|
||||
|
||||
G4VoxelLimits limit; // Unlimited
|
||||
G4AffineTransform origin;
|
||||
|
||||
// min max extents of pSolid along X,Y,Z
|
||||
|
||||
yesno = aSolid->CalculateExtent(kXAxis,limit,origin,minX,maxX);
|
||||
yesno = aSolid->CalculateExtent(kYAxis,limit,origin,minY,maxY);
|
||||
yesno = aSolid->CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
|
||||
|
||||
G4double scale=.1;
|
||||
minX-=scale*std::abs(minX);
|
||||
minY-=scale*std::abs(minY);
|
||||
minZ-=scale*std::abs(minZ);
|
||||
maxX+=scale*std::abs(maxX);
|
||||
maxY+=scale*std::abs(maxY);
|
||||
maxZ+=scale*std::abs(maxZ);
|
||||
|
||||
G4double dX=(maxX-minX);
|
||||
G4double dY=(maxY-minY);
|
||||
G4double dZ=(maxZ-minZ);
|
||||
|
||||
G4double XY_prob=2.*dX*dY;
|
||||
G4double YZ_prob=2.*dY*dZ;
|
||||
G4double ZX_prob=2.*dZ*dX;
|
||||
G4double area=XY_prob+YZ_prob+ZX_prob;
|
||||
XY_prob/=area;
|
||||
YZ_prob/=area;
|
||||
ZX_prob/=area;
|
||||
|
||||
ran_var=G4UniformRand();
|
||||
G4double cos_th2 = G4UniformRand();
|
||||
G4double sth = std::sqrt(1.-cos_th2);
|
||||
G4double cth = std::sqrt(cos_th2);
|
||||
G4double phi=G4UniformRand()*3.1415926*2;
|
||||
G4double dirX = sth*std::cos(phi);
|
||||
G4double dirY = sth*std::sin(phi);
|
||||
G4double dirZ = cth;
|
||||
if (ran_var <=XY_prob){ //on the XY faces
|
||||
G4double ran_var1=ran_var/XY_prob;
|
||||
G4double ranX=ran_var1;
|
||||
if (ran_var1<=0.5){
|
||||
pz=minZ;
|
||||
direction=G4ThreeVector(dirX,dirY,dirZ);
|
||||
ranX=ran_var1*2.;
|
||||
}
|
||||
else{
|
||||
pz=maxZ;
|
||||
direction=-G4ThreeVector(dirX,dirY,dirZ);
|
||||
ranX=(ran_var1-0.5)*2.;
|
||||
}
|
||||
G4double ranY=G4UniformRand();
|
||||
px=minX+(maxX-minX)*ranX;
|
||||
py=minY+(maxY-minY)*ranY;
|
||||
}
|
||||
else if (ran_var <=(XY_prob+YZ_prob)){ //on the YZ faces
|
||||
G4double ran_var1=(ran_var-XY_prob)/YZ_prob;
|
||||
G4double ranY=ran_var1;
|
||||
if (ran_var1<=0.5){
|
||||
px=minX;
|
||||
direction=G4ThreeVector(dirZ,dirX,dirY);
|
||||
ranY=ran_var1*2.;
|
||||
}
|
||||
else{
|
||||
px=maxX;
|
||||
direction=-G4ThreeVector(dirZ,dirX,dirY);
|
||||
ranY=(ran_var1-0.5)*2.;
|
||||
}
|
||||
G4double ranZ=G4UniformRand();
|
||||
py=minY+(maxY-minY)*ranY;
|
||||
pz=minZ+(maxZ-minZ)*ranZ;
|
||||
|
||||
}
|
||||
else{ //on the ZX faces
|
||||
G4double ran_var1=(ran_var-XY_prob-YZ_prob)/ZX_prob;
|
||||
G4double ranZ=ran_var1;
|
||||
if (ran_var1<=0.5){
|
||||
py=minY;
|
||||
direction=G4ThreeVector(dirY,dirZ,dirX);
|
||||
ranZ=ran_var1*2.;
|
||||
}
|
||||
else{
|
||||
py=maxY;
|
||||
direction=-G4ThreeVector(dirY,dirZ,dirX);
|
||||
ranZ=(ran_var1-0.5)*2.;
|
||||
}
|
||||
G4double ranX=G4UniformRand();
|
||||
px=minX+(maxX-minX)*ranX;
|
||||
pz=minZ+(maxZ-minZ)*ranZ;
|
||||
}
|
||||
|
||||
p=G4ThreeVector(px,py,pz);
|
||||
return area;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPosOnPhysVolGenerator::GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(G4ThreeVector& p, G4ThreeVector& direction)
|
||||
{
|
||||
if (!thePhysicalVolume) {
|
||||
G4cout<<"Before generating a source on an external surface of volume you should select a physical volume"<<std::endl;
|
||||
return;
|
||||
};
|
||||
GenerateAPositionOnTheExtSurfaceOfTheSolid(p,direction);
|
||||
p = theTransformationFromPhysVolToWorld.TransformPoint(p);
|
||||
direction = theTransformationFromPhysVolToWorld.TransformAxis(direction);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPosOnPhysVolGenerator::GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(G4ThreeVector& p, G4ThreeVector& direction,
|
||||
G4double& costh_to_normal)
|
||||
{
|
||||
GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(p, direction);
|
||||
costh_to_normal = CosThDirComparedToNormal;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPosOnPhysVolGenerator::ComputeTransformationFromPhysVolToWorld()
|
||||
{
|
||||
G4VPhysicalVolume* daughter =thePhysicalVolume;
|
||||
G4LogicalVolume* mother = thePhysicalVolume->GetMotherLogical();
|
||||
theTransformationFromPhysVolToWorld = G4AffineTransform();
|
||||
G4PhysicalVolumeStore* thePhysVolStore =G4PhysicalVolumeStore::GetInstance();
|
||||
while (mother){
|
||||
theTransformationFromPhysVolToWorld *=
|
||||
G4AffineTransform(daughter->GetFrameRotation(),daughter->GetObjectTranslation());
|
||||
for ( unsigned int i=0; i< thePhysVolStore->size();i++){
|
||||
if ((*thePhysVolStore)[i]->GetLogicalVolume() == mother){
|
||||
daughter = (*thePhysVolStore)[i];
|
||||
mother =daughter->GetMotherLogical();
|
||||
break;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointPrimaryGenerator.cc,v 1.2 2009/11/18 17:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointCrossSurfChecker
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "G4AdjointPrimaryGenerator.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4SingleParticleSource.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4AdjointPosOnPhysVolGenerator.hh"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointPrimaryGenerator::G4AdjointPrimaryGenerator()
|
||||
{
|
||||
theSingleParticleSource = new G4SingleParticleSource();
|
||||
|
||||
theSingleParticleSource->GetEneDist()->SetEnergyDisType("Pow");
|
||||
theSingleParticleSource->GetEneDist()->SetAlpha(-1.);
|
||||
theSingleParticleSource->GetPosDist()->SetPosDisType("Point");
|
||||
theSingleParticleSource->GetAngDist()->SetAngDistType("planar");
|
||||
|
||||
theG4AdjointPosOnPhysVolGenerator = G4AdjointPosOnPhysVolGenerator::GetInstance();
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointPrimaryGenerator::~G4AdjointPrimaryGenerator()
|
||||
{
|
||||
delete theSingleParticleSource;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGenerator::GenerateAdjointPrimaryVertex(G4Event* anEvent,G4ParticleDefinition* adj_part,G4double E1,G4double E2)
|
||||
{
|
||||
if (type_of_adjoint_source == "ExternalSurfaceOfAVolume") {
|
||||
|
||||
//Generate position and direction relative to the external surface of sensitive volume
|
||||
//-------------------------------------------------------------
|
||||
|
||||
G4double costh_to_normal;
|
||||
G4ThreeVector pos,direction;
|
||||
theG4AdjointPosOnPhysVolGenerator->GenerateAPositionOnTheExtSurfaceOfThePhysicalVolume(pos, direction,costh_to_normal);
|
||||
if (costh_to_normal <1.e-4) costh_to_normal =1.e-4;
|
||||
theSingleParticleSource->GetAngDist()->SetParticleMomentumDirection(-direction);
|
||||
theSingleParticleSource->GetPosDist()->SetCentreCoords(pos);
|
||||
}
|
||||
|
||||
theSingleParticleSource->GetEneDist()->SetEmin(E1);
|
||||
theSingleParticleSource->GetEneDist()->SetEmax(E2);
|
||||
|
||||
theSingleParticleSource->SetParticleDefinition(adj_part);
|
||||
theSingleParticleSource->GeneratePrimaryVertex(anEvent);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGenerator::SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector center_pos)
|
||||
{
|
||||
radius_spherical_source = radius;
|
||||
center_spherical_source = center_pos;
|
||||
type_of_adjoint_source ="Spherical";
|
||||
theSingleParticleSource->GetPosDist()->SetPosDisType("Surface");
|
||||
theSingleParticleSource->GetPosDist()->SetPosDisShape("Sphere");
|
||||
theSingleParticleSource->GetPosDist()->SetCentreCoords(center_pos);
|
||||
theSingleParticleSource->GetPosDist()->SetRadius(radius);
|
||||
theSingleParticleSource->GetAngDist()->SetAngDistType("cos");
|
||||
theSingleParticleSource->GetAngDist()->SetMaxTheta(pi);
|
||||
theSingleParticleSource->GetAngDist()->SetMinTheta(halfpi);
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointPrimaryGenerator::SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String& volume_name)
|
||||
{
|
||||
theG4AdjointPosOnPhysVolGenerator->DefinePhysicalVolume1(volume_name);
|
||||
type_of_adjoint_source ="ExternalSurfaceOfAVolume";
|
||||
theSingleParticleSource->GetPosDist()->SetPosDisType("Point");
|
||||
theSingleParticleSource->GetAngDist()->SetAngDistType("planar");
|
||||
}
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
// $Id: G4AdjointStackingAction.cc,v 1.2 2009/11/18 17:57:59 gcosmo Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Class Name: G4AdjointCrossSurfChecker
|
||||
// Author: L. Desorgher
|
||||
// Organisation: SpaceIT GmbH
|
||||
// Contract: ESA contract 21435/08/NL/AT
|
||||
// Customer: ESA/ESTEC
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "G4AdjointStackingAction.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4ios.hh"
|
||||
|
||||
G4AdjointStackingAction::G4AdjointStackingAction()
|
||||
{
|
||||
theFwdStackingAction =0;
|
||||
theUserAdjointStackingAction =0;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4AdjointStackingAction::~G4AdjointStackingAction()
|
||||
{;}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
G4ClassificationOfNewTrack G4AdjointStackingAction::ClassifyNewTrack(const G4Track * aTrack)
|
||||
{
|
||||
G4ClassificationOfNewTrack classification = fUrgent;
|
||||
if ( kill_tracks) classification=fKill;
|
||||
else if (!adjoint_mode && theFwdStackingAction) classification = theFwdStackingAction->ClassifyNewTrack(aTrack);
|
||||
else if (adjoint_mode && theUserAdjointStackingAction) classification = theUserAdjointStackingAction->ClassifyNewTrack(aTrack);
|
||||
return classification;
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointStackingAction::NewStage()
|
||||
{
|
||||
if ( !adjoint_mode && theFwdStackingAction) theFwdStackingAction->NewStage();
|
||||
else if (adjoint_mode && theUserAdjointStackingAction) theUserAdjointStackingAction->NewStage();
|
||||
}
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
void G4AdjointStackingAction::PrepareNewEvent()
|
||||
{
|
||||
if ( !adjoint_mode && theFwdStackingAction) theFwdStackingAction->PrepareNewEvent();
|
||||
else if (adjoint_mode && theUserAdjointStackingAction) theUserAdjointStackingAction->PrepareNewEvent();
|
||||
}
|
||||
|
||||
@@ -239,7 +239,7 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
|
||||
centreCmd1->SetGuidance(" same effect as the /gps/position command");
|
||||
centreCmd1->SetParameterName("X","Y","Z",true,true);
|
||||
centreCmd1->SetDefaultUnit("cm");
|
||||
centreCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
// centreCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
posrot1Cmd1 = new G4UIcmdWith3Vector("/gps/pos/rot1",this);
|
||||
posrot1Cmd1->SetGuidance("Set the 1st vector defining the rotation matrix'.");
|
||||
@@ -257,70 +257,70 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
|
||||
halfxCmd1->SetGuidance("Set x half length of source.");
|
||||
halfxCmd1->SetParameterName("Halfx",true,true);
|
||||
halfxCmd1->SetDefaultUnit("cm");
|
||||
halfxCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
// halfxCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
halfyCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/halfy",this);
|
||||
halfyCmd1->SetGuidance("Set y half length of source.");
|
||||
halfyCmd1->SetParameterName("Halfy",true,true);
|
||||
halfyCmd1->SetDefaultUnit("cm");
|
||||
halfyCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
// halfyCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
halfzCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/halfz",this);
|
||||
halfzCmd1->SetGuidance("Set z half length of source.");
|
||||
halfzCmd1->SetParameterName("Halfz",true,true);
|
||||
halfzCmd1->SetDefaultUnit("cm");
|
||||
halfzCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
// halfzCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
radiusCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/radius",this);
|
||||
radiusCmd1->SetGuidance("Set radius of source.");
|
||||
radiusCmd1->SetParameterName("Radius",true,true);
|
||||
radiusCmd1->SetDefaultUnit("cm");
|
||||
radiusCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
// radiusCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
radius0Cmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/inner_radius",this);
|
||||
radius0Cmd1->SetGuidance("Set inner radius of source when required.");
|
||||
radius0Cmd1->SetParameterName("Radius0",true,true);
|
||||
radius0Cmd1->SetDefaultUnit("cm");
|
||||
radius0Cmd1->SetUnitCandidates("micron mm cm m km");
|
||||
// radius0Cmd1->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
possigmarCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_r",this);
|
||||
possigmarCmd1->SetGuidance("Set standard deviation in radial of the beam positional profile");
|
||||
possigmarCmd1->SetGuidance(" applicable to Beam type source only");
|
||||
possigmarCmd1->SetParameterName("Sigmar",true,true);
|
||||
possigmarCmd1->SetDefaultUnit("cm");
|
||||
possigmarCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
// possigmarCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
possigmaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_x",this);
|
||||
possigmaxCmd1->SetGuidance("Set standard deviation of beam positional profile in x-dir");
|
||||
possigmaxCmd1->SetGuidance(" applicable to Beam type source only");
|
||||
possigmaxCmd1->SetParameterName("Sigmax",true,true);
|
||||
possigmaxCmd1->SetDefaultUnit("cm");
|
||||
possigmaxCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
// possigmaxCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
possigmayCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/sigma_y",this);
|
||||
possigmayCmd1->SetGuidance("Set standard deviation of beam positional profile in y-dir");
|
||||
possigmayCmd1->SetGuidance(" applicable to Beam type source only");
|
||||
possigmayCmd1->SetParameterName("Sigmay",true,true);
|
||||
possigmayCmd1->SetDefaultUnit("cm");
|
||||
possigmayCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
// possigmayCmd1->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
paralpCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/paralp",this);
|
||||
paralpCmd1->SetGuidance("Angle from y-axis of y' in Para");
|
||||
paralpCmd1->SetParameterName("paralp",true,true);
|
||||
paralpCmd1->SetDefaultUnit("rad");
|
||||
paralpCmd1->SetUnitCandidates("rad deg");
|
||||
// paralpCmd1->SetUnitCandidates("rad deg");
|
||||
|
||||
partheCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/parthe",this);
|
||||
partheCmd1->SetGuidance("Polar angle through centres of z faces");
|
||||
partheCmd1->SetParameterName("parthe",true,true);
|
||||
partheCmd1->SetDefaultUnit("rad");
|
||||
partheCmd1->SetUnitCandidates("rad deg");
|
||||
// partheCmd1->SetUnitCandidates("rad deg");
|
||||
|
||||
parphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/pos/parphi",this);
|
||||
parphiCmd1->SetGuidance("Azimuth angle through centres of z faces");
|
||||
parphiCmd1->SetParameterName("parphi",true,true);
|
||||
parphiCmd1->SetDefaultUnit("rad");
|
||||
parphiCmd1->SetUnitCandidates("rad deg");
|
||||
// parphiCmd1->SetUnitCandidates("rad deg");
|
||||
|
||||
confineCmd1 = new G4UIcmdWithAString("/gps/pos/confine",this);
|
||||
confineCmd1->SetGuidance("Confine source to volume (NULL to unset).");
|
||||
@@ -346,7 +346,7 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
|
||||
centreCmd->SetGuidance("Set centre coordinates of source.(obsolete!)");
|
||||
centreCmd->SetParameterName("X","Y","Z",true,true);
|
||||
centreCmd->SetDefaultUnit("cm");
|
||||
centreCmd->SetUnitCandidates("micron mm cm m km");
|
||||
// centreCmd->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
posrot1Cmd = new G4UIcmdWith3Vector("/gps/posrot1",this);
|
||||
posrot1Cmd->SetGuidance("Set rotation matrix of x'.(obsolete!)");
|
||||
@@ -364,67 +364,67 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
|
||||
halfxCmd->SetGuidance("Set x half length of source.(obsolete!)");
|
||||
halfxCmd->SetParameterName("Halfx",true,true);
|
||||
halfxCmd->SetDefaultUnit("cm");
|
||||
halfxCmd->SetUnitCandidates("micron mm cm m km");
|
||||
// halfxCmd->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
halfyCmd = new G4UIcmdWithADoubleAndUnit("/gps/halfy",this);
|
||||
halfyCmd->SetGuidance("Set y half length of source.(obsolete!)");
|
||||
halfyCmd->SetParameterName("Halfy",true,true);
|
||||
halfyCmd->SetDefaultUnit("cm");
|
||||
halfyCmd->SetUnitCandidates("micron mm cm m km");
|
||||
// halfyCmd->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
halfzCmd = new G4UIcmdWithADoubleAndUnit("/gps/halfz",this);
|
||||
halfzCmd->SetGuidance("Set z half length of source.(obsolete!)");
|
||||
halfzCmd->SetParameterName("Halfz",true,true);
|
||||
halfzCmd->SetDefaultUnit("cm");
|
||||
halfzCmd->SetUnitCandidates("micron mm cm m km");
|
||||
// halfzCmd->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
radiusCmd = new G4UIcmdWithADoubleAndUnit("/gps/radius",this);
|
||||
radiusCmd->SetGuidance("Set radius of source.(obsolete!)");
|
||||
radiusCmd->SetParameterName("Radius",true,true);
|
||||
radiusCmd->SetDefaultUnit("cm");
|
||||
radiusCmd->SetUnitCandidates("micron mm cm m km");
|
||||
// radiusCmd->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
radius0Cmd = new G4UIcmdWithADoubleAndUnit("/gps/radius0",this);
|
||||
radius0Cmd->SetGuidance("Set inner radius of source.(obsolete!)");
|
||||
radius0Cmd->SetParameterName("Radius0",true,true);
|
||||
radius0Cmd->SetDefaultUnit("cm");
|
||||
radius0Cmd->SetUnitCandidates("micron mm cm m km");
|
||||
// radius0Cmd->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
possigmarCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposr",this);
|
||||
possigmarCmd->SetGuidance("Set standard deviation of beam position in radial(obsolete!)");
|
||||
possigmarCmd->SetParameterName("Sigmar",true,true);
|
||||
possigmarCmd->SetDefaultUnit("cm");
|
||||
possigmarCmd->SetUnitCandidates("micron mm cm m km");
|
||||
// possigmarCmd->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
possigmaxCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposx",this);
|
||||
possigmaxCmd->SetGuidance("Set standard deviation of beam position in x-dir(obsolete!)");
|
||||
possigmaxCmd->SetParameterName("Sigmax",true,true);
|
||||
possigmaxCmd->SetDefaultUnit("cm");
|
||||
possigmaxCmd->SetUnitCandidates("micron mm cm m km");
|
||||
// possigmaxCmd->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
possigmayCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaposy",this);
|
||||
possigmayCmd->SetGuidance("Set standard deviation of beam position in y-dir(obsolete!)");
|
||||
possigmayCmd->SetParameterName("Sigmay",true,true);
|
||||
possigmayCmd->SetDefaultUnit("cm");
|
||||
possigmayCmd->SetUnitCandidates("micron mm cm m km");
|
||||
// possigmayCmd->SetUnitCandidates("micron mm cm m km");
|
||||
|
||||
paralpCmd = new G4UIcmdWithADoubleAndUnit("/gps/paralp",this);
|
||||
paralpCmd->SetGuidance("Angle from y-axis of y' in Para(obsolete!)");
|
||||
paralpCmd->SetParameterName("paralp",true,true);
|
||||
paralpCmd->SetDefaultUnit("rad");
|
||||
paralpCmd->SetUnitCandidates("rad deg");
|
||||
// paralpCmd->SetUnitCandidates("rad deg");
|
||||
|
||||
partheCmd = new G4UIcmdWithADoubleAndUnit("/gps/parthe",this);
|
||||
partheCmd->SetGuidance("Polar angle through centres of z faces(obsolete!)");
|
||||
partheCmd->SetParameterName("parthe",true,true);
|
||||
partheCmd->SetDefaultUnit("rad");
|
||||
partheCmd->SetUnitCandidates("rad deg");
|
||||
// partheCmd->SetUnitCandidates("rad deg");
|
||||
|
||||
parphiCmd = new G4UIcmdWithADoubleAndUnit("/gps/parphi",this);
|
||||
parphiCmd->SetGuidance("Azimuth angle through centres of z faces(obsolete!)");
|
||||
parphiCmd->SetParameterName("parphi",true,true);
|
||||
parphiCmd->SetDefaultUnit("rad");
|
||||
parphiCmd->SetUnitCandidates("rad deg");
|
||||
// parphiCmd->SetUnitCandidates("rad deg");
|
||||
|
||||
confineCmd = new G4UIcmdWithAString("/gps/confine",this);
|
||||
confineCmd->SetGuidance("Confine source to volume (NULL to unset)(obsolete!) .");
|
||||
@@ -460,51 +460,51 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
|
||||
minthetaCmd1->SetParameterName("MinTheta",true,true);
|
||||
minthetaCmd1->SetDefaultValue(0.);
|
||||
minthetaCmd1->SetDefaultUnit("rad");
|
||||
minthetaCmd1->SetUnitCandidates("rad deg");
|
||||
// minthetaCmd1->SetUnitCandidates("rad deg");
|
||||
|
||||
maxthetaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/maxtheta",this);
|
||||
maxthetaCmd1->SetGuidance("Set maximum theta");
|
||||
maxthetaCmd1->SetParameterName("MaxTheta",true,true);
|
||||
maxthetaCmd1->SetDefaultValue(pi);
|
||||
maxthetaCmd1->SetDefaultUnit("rad");
|
||||
maxthetaCmd1->SetUnitCandidates("rad deg");
|
||||
// maxthetaCmd1->SetUnitCandidates("rad deg");
|
||||
|
||||
minphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/minphi",this);
|
||||
minphiCmd1->SetGuidance("Set minimum phi");
|
||||
minphiCmd1->SetParameterName("MinPhi",true,true);
|
||||
minphiCmd1->SetDefaultUnit("rad");
|
||||
minphiCmd1->SetUnitCandidates("rad deg");
|
||||
// minphiCmd1->SetUnitCandidates("rad deg");
|
||||
|
||||
maxphiCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/maxphi",this);
|
||||
maxphiCmd1->SetGuidance("Set maximum phi");
|
||||
maxphiCmd1->SetParameterName("MaxPhi",true,true);
|
||||
maxphiCmd1->SetDefaultValue(pi);
|
||||
maxphiCmd1->SetDefaultUnit("rad");
|
||||
maxphiCmd1->SetUnitCandidates("rad deg");
|
||||
// maxphiCmd1->SetUnitCandidates("rad deg");
|
||||
|
||||
angsigmarCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_r",this);
|
||||
angsigmarCmd1->SetGuidance("Set standard deviation in direction for 1D beam.");
|
||||
angsigmarCmd1->SetParameterName("Sigmara",true,true);
|
||||
angsigmarCmd1->SetDefaultUnit("rad");
|
||||
angsigmarCmd1->SetUnitCandidates("rad deg");
|
||||
// angsigmarCmd1->SetUnitCandidates("rad deg");
|
||||
|
||||
angsigmaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_x",this);
|
||||
angsigmaxCmd1->SetGuidance("Set standard deviation in direction in x-direc. for 2D beam");
|
||||
angsigmaxCmd1->SetParameterName("Sigmaxa",true,true);
|
||||
angsigmaxCmd1->SetDefaultUnit("rad");
|
||||
angsigmaxCmd1->SetUnitCandidates("rad deg");
|
||||
// angsigmaxCmd1->SetUnitCandidates("rad deg");
|
||||
|
||||
angsigmayCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ang/sigma_y",this);
|
||||
angsigmayCmd1->SetGuidance("Set standard deviation in direction in y-direc. for 2D beam");
|
||||
angsigmayCmd1->SetParameterName("Sigmaya",true,true);
|
||||
angsigmayCmd1->SetDefaultUnit("rad");
|
||||
angsigmayCmd1->SetUnitCandidates("rad deg");
|
||||
// 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");
|
||||
// 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");
|
||||
@@ -542,44 +542,44 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
|
||||
minthetaCmd->SetGuidance("Set minimum theta (obsolete!)");
|
||||
minthetaCmd->SetParameterName("MinTheta",true,true);
|
||||
minthetaCmd->SetDefaultUnit("rad");
|
||||
minthetaCmd->SetUnitCandidates("rad deg");
|
||||
// minthetaCmd->SetUnitCandidates("rad deg");
|
||||
|
||||
maxthetaCmd = new G4UIcmdWithADoubleAndUnit("/gps/maxtheta",this);
|
||||
maxthetaCmd->SetGuidance("Set maximum theta (obsolete!)");
|
||||
maxthetaCmd->SetParameterName("MaxTheta",true,true);
|
||||
maxthetaCmd->SetDefaultValue(3.1416);
|
||||
maxthetaCmd->SetDefaultUnit("rad");
|
||||
maxthetaCmd->SetUnitCandidates("rad deg");
|
||||
// maxthetaCmd->SetUnitCandidates("rad deg");
|
||||
|
||||
minphiCmd = new G4UIcmdWithADoubleAndUnit("/gps/minphi",this);
|
||||
minphiCmd->SetGuidance("Set minimum phi (obsolete!)");
|
||||
minphiCmd->SetParameterName("MinPhi",true,true);
|
||||
minphiCmd->SetDefaultUnit("rad");
|
||||
minphiCmd->SetUnitCandidates("rad deg");
|
||||
// minphiCmd->SetUnitCandidates("rad deg");
|
||||
|
||||
maxphiCmd = new G4UIcmdWithADoubleAndUnit("/gps/maxphi",this);
|
||||
maxphiCmd->SetGuidance("Set maximum phi(obsolete!)");
|
||||
maxphiCmd->SetParameterName("MaxPhi",true,true);
|
||||
maxphiCmd->SetDefaultUnit("rad");
|
||||
maxphiCmd->SetUnitCandidates("rad deg");
|
||||
// maxphiCmd->SetUnitCandidates("rad deg");
|
||||
|
||||
angsigmarCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangr",this);
|
||||
angsigmarCmd->SetGuidance("Set standard deviation of beam direction in radial(obsolete!).");
|
||||
angsigmarCmd->SetParameterName("Sigmara",true,true);
|
||||
angsigmarCmd->SetDefaultUnit("rad");
|
||||
angsigmarCmd->SetUnitCandidates("rad deg");
|
||||
// angsigmarCmd->SetUnitCandidates("rad deg");
|
||||
|
||||
angsigmaxCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangx",this);
|
||||
angsigmaxCmd->SetGuidance("Set standard deviation of beam direction in x-direc(obsolete!).");
|
||||
angsigmaxCmd->SetParameterName("Sigmaxa",true,true);
|
||||
angsigmaxCmd->SetDefaultUnit("rad");
|
||||
angsigmaxCmd->SetUnitCandidates("rad deg");
|
||||
// angsigmaxCmd->SetUnitCandidates("rad deg");
|
||||
|
||||
angsigmayCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmaangy",this);
|
||||
angsigmayCmd->SetGuidance("Set standard deviation of beam direction in y-direc.(obsolete!)");
|
||||
angsigmayCmd->SetParameterName("Sigmaya",true,true);
|
||||
angsigmayCmd->SetDefaultUnit("rad");
|
||||
angsigmayCmd->SetUnitCandidates("rad deg");
|
||||
// angsigmayCmd->SetUnitCandidates("rad deg");
|
||||
|
||||
useuserangaxisCmd = new G4UIcmdWithABool("/gps/useuserangaxis",this);
|
||||
useuserangaxisCmd->SetGuidance("true for using user defined angular co-ordinates(obsolete!)");
|
||||
@@ -608,25 +608,25 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
|
||||
eminCmd1->SetGuidance("Sets minimum energy");
|
||||
eminCmd1->SetParameterName("emin",true,true);
|
||||
eminCmd1->SetDefaultUnit("keV");
|
||||
eminCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
// eminCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
|
||||
emaxCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/max",this);
|
||||
emaxCmd1->SetGuidance("Sets maximum energy");
|
||||
emaxCmd1->SetParameterName("emax",true,true);
|
||||
emaxCmd1->SetDefaultUnit("keV");
|
||||
emaxCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
// emaxCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
|
||||
monoenergyCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/mono",this);
|
||||
monoenergyCmd1->SetGuidance("Sets a monocromatic energy (same as gps/energy)");
|
||||
monoenergyCmd1->SetParameterName("monoenergy",true,true);
|
||||
monoenergyCmd1->SetDefaultUnit("keV");
|
||||
monoenergyCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
// monoenergyCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
|
||||
engsigmaCmd1 = new G4UIcmdWithADoubleAndUnit("/gps/ene/sigma",this);
|
||||
engsigmaCmd1->SetGuidance("Sets the standard deviation for Gaussian energy dist.");
|
||||
engsigmaCmd1->SetParameterName("Sigmae",true,true);
|
||||
engsigmaCmd1->SetDefaultUnit("keV");
|
||||
engsigmaCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
// engsigmaCmd1->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
|
||||
alphaCmd1 = new G4UIcmdWithADouble("/gps/ene/alpha",this);
|
||||
alphaCmd1->SetGuidance("Sets Alpha (index) for power-law energy dist.");
|
||||
@@ -672,25 +672,25 @@ G4GeneralParticleSourceMessenger::G4GeneralParticleSourceMessenger
|
||||
eminCmd->SetGuidance("Sets Emin (obsolete!)");
|
||||
eminCmd->SetParameterName("emin",true,true);
|
||||
eminCmd->SetDefaultUnit("keV");
|
||||
eminCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
// eminCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
|
||||
emaxCmd = new G4UIcmdWithADoubleAndUnit("/gps/emax",this);
|
||||
emaxCmd->SetGuidance("Sets Emax (obsolete!)");
|
||||
emaxCmd->SetParameterName("emax",true,true);
|
||||
emaxCmd->SetDefaultUnit("keV");
|
||||
emaxCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
// emaxCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
|
||||
monoenergyCmd = new G4UIcmdWithADoubleAndUnit("/gps/monoenergy",this);
|
||||
monoenergyCmd->SetGuidance("Sets Monoenergy (obsolete, use gps/energy instead!)");
|
||||
monoenergyCmd->SetParameterName("monoenergy",true,true);
|
||||
monoenergyCmd->SetDefaultUnit("keV");
|
||||
monoenergyCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
// monoenergyCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
|
||||
engsigmaCmd = new G4UIcmdWithADoubleAndUnit("/gps/sigmae",this);
|
||||
engsigmaCmd->SetGuidance("Sets the standard deviation for Gaussian energy dist.(obsolete!)");
|
||||
engsigmaCmd->SetParameterName("Sigmae",true,true);
|
||||
engsigmaCmd->SetDefaultUnit("keV");
|
||||
engsigmaCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
// engsigmaCmd->SetUnitCandidates("eV keV MeV GeV TeV PeV");
|
||||
|
||||
alphaCmd = new G4UIcmdWithADouble("/gps/alpha",this);
|
||||
alphaCmd->SetGuidance("Sets Alpha (index) for power-law energy dist(obsolete!).");
|
||||
|
||||
@@ -1137,6 +1137,12 @@ void G4SPSEneDistribution::ConvertEPNToEnergy()
|
||||
G4cout << "Those above 1024 will be ignored" << G4endl;
|
||||
maxcount = 1024;
|
||||
}
|
||||
if(maxcount < 1)
|
||||
{
|
||||
G4cout << "Histogram contains less than 1 bin!" << G4endl;
|
||||
G4cout << "Redefine the histogram" << G4endl;
|
||||
return;
|
||||
}
|
||||
for(count=0;count<maxcount;count++)
|
||||
{
|
||||
// Read out
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * Neither the authors of this software system, nor their employing *
|
||||
// * institutes,nor the agencies providing financial support for this *
|
||||
// * work make any representation or warranty, express or implied, *
|
||||
// * regarding this software system or assume any liability for its *
|
||||
// * use. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4SmartTrackStack.cc,v 1.3 2009/09/16 23:10:46 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
|
||||
#include "G4SmartTrackStack.hh"
|
||||
#include "G4VTrajectory.hh"
|
||||
|
||||
G4SmartTrackStack::G4SmartTrackStack()
|
||||
:fTurn(0),nTurn(5)
|
||||
{
|
||||
for(int i=0;i<nTurn;i++)
|
||||
{ stacks[i] = new G4TrackStack(); }
|
||||
// If entry of one sub-stack exceeds safetyValve1, we will stick
|
||||
// to that sub-stack until entry of that sub-stack goes down
|
||||
// to safetyValve2.
|
||||
nStick = 100;
|
||||
safetyValve1 = 3000;
|
||||
safetyValve2 = safetyValve1 - nStick;
|
||||
maxNTracks = 0;
|
||||
}
|
||||
|
||||
G4SmartTrackStack::~G4SmartTrackStack()
|
||||
{
|
||||
for(int i=0;i<nTurn;i++)
|
||||
{ delete stacks[i]; }
|
||||
}
|
||||
|
||||
const G4SmartTrackStack & G4SmartTrackStack::operator=(const G4SmartTrackStack &)
|
||||
{ return *this; }
|
||||
int G4SmartTrackStack::operator==(const G4SmartTrackStack &right) const
|
||||
{ return (this==&right); }
|
||||
int G4SmartTrackStack::operator!=(const G4SmartTrackStack &right) const
|
||||
{ return (this!=&right); }
|
||||
|
||||
void G4SmartTrackStack::TransferTo(G4TrackStack * aStack)
|
||||
{
|
||||
for(int i=0;i<nTurn;i++)
|
||||
{ stacks[i]->TransferTo(aStack); }
|
||||
}
|
||||
|
||||
G4StackedTrack * G4SmartTrackStack::PopFromStack()
|
||||
{
|
||||
if( n_stackedTrack() == 0 ) return 0;
|
||||
G4StackedTrack * aStackedTrack = 0;
|
||||
while(!aStackedTrack)
|
||||
{
|
||||
if(stacks[fTurn]->GetNTrack()==0)
|
||||
{
|
||||
fTurn = (++fTurn)%nTurn;
|
||||
//G4cout<<"++++++++ Shift to Stack ["<<fTurn<<"] with "<<stacks[fTurn]->GetNTrack()<<" stacked tracks."<<G4endl;
|
||||
}
|
||||
else
|
||||
{ aStackedTrack = stacks[fTurn]->PopFromStack(); }
|
||||
}
|
||||
return aStackedTrack;
|
||||
}
|
||||
|
||||
#include "G4Neutron.hh"
|
||||
#include "G4Gamma.hh"
|
||||
#include "G4Electron.hh"
|
||||
#include "G4Positron.hh"
|
||||
|
||||
void G4SmartTrackStack::PushToStack( G4StackedTrack * aStackedTrack )
|
||||
{
|
||||
static G4ParticleDefinition* neutDef = G4Neutron::Definition();
|
||||
static G4ParticleDefinition* elecDef = G4Electron::Definition();
|
||||
static G4ParticleDefinition* gammDef = G4Gamma::Definition();
|
||||
static G4ParticleDefinition* posiDef = G4Positron::Definition();
|
||||
|
||||
G4int iDest = 0;
|
||||
if( aStackedTrack->GetTrack()->GetParentID() == 0 )
|
||||
{
|
||||
// We have a primary track, which should go first.
|
||||
fTurn = 0; // reseting the turn
|
||||
}
|
||||
else
|
||||
{
|
||||
G4ParticleDefinition* partDef = aStackedTrack->GetTrack()->GetDefinition();
|
||||
if(partDef==neutDef)
|
||||
{ iDest = 1; }
|
||||
else if(partDef==elecDef)
|
||||
{ iDest = 2; }
|
||||
else if(partDef==gammDef)
|
||||
{ iDest = 3; }
|
||||
else if(partDef==posiDef)
|
||||
{ iDest = 4; }
|
||||
}
|
||||
|
||||
stacks[iDest]->PushToStack(aStackedTrack);
|
||||
if(stacks[iDest]->GetNTrack()>safetyValve1)
|
||||
{
|
||||
// Too many tracks in the stack. Process tracks in this stack first
|
||||
// unless the current stack also have too many tracks.
|
||||
if(stacks[fTurn]->GetNTrack()<safetyValve2)
|
||||
{
|
||||
fTurn = iDest;
|
||||
safetyValve2 = stacks[iDest]->GetNTrack() - nStick;
|
||||
//G4cout<<"++++++++ Shift to Stack ["<<fTurn<<"] with "<<stacks[fTurn]->GetNTrack()<<" stacked tracks."<<G4endl;
|
||||
}
|
||||
}
|
||||
|
||||
if(n_stackedTrack()>maxNTracks) maxNTracks = n_stackedTrack();
|
||||
}
|
||||
|
||||
void G4SmartTrackStack::clear()
|
||||
{
|
||||
for(int i=0;i<nTurn;i++)
|
||||
{ stacks[i]->clear(); }
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4StackManager.cc,v 1.10 2006/06/29 18:10:19 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4StackManager.cc,v 1.14 2009/09/16 23:10:46 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
//
|
||||
// Last Modification : 09/Dec/96 M.Asai
|
||||
@@ -41,7 +41,13 @@ G4StackManager::G4StackManager()
|
||||
:userStackingAction(0),verboseLevel(0),numberOfAdditionalWaitingStacks(0)
|
||||
{
|
||||
theMessenger = new G4StackingMessenger(this);
|
||||
#ifdef G4_USESMARTSTACK
|
||||
urgentStack = new G4SmartTrackStack;
|
||||
G4cout<<"+++ G4StackManager uses G4SmartTrackStack. +++"<<G4endl;
|
||||
#else
|
||||
urgentStack = new G4TrackStack;
|
||||
// G4cout<<"+++ G4StackManager uses ordinary G4TrackStack. +++"<<G4endl;
|
||||
#endif
|
||||
waitingStack = new G4TrackStack;
|
||||
postponeStack = new G4TrackStack;
|
||||
}
|
||||
@@ -49,6 +55,13 @@ G4StackManager::G4StackManager()
|
||||
G4StackManager::~G4StackManager()
|
||||
{
|
||||
if(userStackingAction) delete userStackingAction;
|
||||
|
||||
if(verboseLevel>0)
|
||||
{
|
||||
G4cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << G4endl;
|
||||
G4cout << " Maximum number of tracks in the urgent stack : " << urgentStack->GetMaxNTrack() << G4endl;
|
||||
G4cout << "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << G4endl;
|
||||
}
|
||||
delete urgentStack;
|
||||
delete waitingStack;
|
||||
delete postponeStack;
|
||||
@@ -78,7 +91,7 @@ G4int G4StackManager::PushOneTrack(G4Track *newTrack,G4VTrajectory *newTrajector
|
||||
if(classification==fKill) // delete newTrack without stacking
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if( verboseLevel > 0 )
|
||||
if( verboseLevel > 1 )
|
||||
{
|
||||
G4cout << " ---> G4Track " << newTrack << " (trackID "
|
||||
<< newTrack->GetTrackID() << ", parentID "
|
||||
@@ -120,7 +133,7 @@ G4int G4StackManager::PushOneTrack(G4Track *newTrack,G4VTrajectory *newTrajector
|
||||
G4Track * G4StackManager::PopNextTrack(G4VTrajectory**newTrajectory)
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if( verboseLevel > 0 )
|
||||
if( verboseLevel > 1 )
|
||||
{
|
||||
G4cout << "### pop requested out of "
|
||||
<< GetNUrgentTrack() << " stacked tracks." << G4endl;
|
||||
@@ -130,7 +143,7 @@ G4Track * G4StackManager::PopNextTrack(G4VTrajectory**newTrajectory)
|
||||
while( GetNUrgentTrack() == 0 )
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if( verboseLevel > 0 ) G4cout << "### " << GetNWaitingTrack()
|
||||
if( verboseLevel > 1 ) G4cout << "### " << GetNWaitingTrack()
|
||||
<< " waiting tracks are re-classified to" << G4endl;
|
||||
#endif
|
||||
waitingStack->TransferTo(urgentStack);
|
||||
@@ -145,7 +158,7 @@ G4Track * G4StackManager::PopNextTrack(G4VTrajectory**newTrajectory)
|
||||
}
|
||||
if(userStackingAction) userStackingAction->NewStage();
|
||||
#ifdef G4VERBOSE
|
||||
if( verboseLevel > 0 ) G4cout << " " << GetNUrgentTrack()
|
||||
if( verboseLevel > 1 ) G4cout << " " << GetNUrgentTrack()
|
||||
<< " urgent tracks and " << GetNWaitingTrack()
|
||||
<< " waiting tracks." << G4endl;
|
||||
#endif
|
||||
@@ -157,7 +170,7 @@ G4Track * G4StackManager::PopNextTrack(G4VTrajectory**newTrajectory)
|
||||
*newTrajectory = selectedStackedTrack->GetTrajectory();
|
||||
|
||||
#ifdef G4VERBOSE
|
||||
if( verboseLevel > 1 )
|
||||
if( verboseLevel > 2 )
|
||||
{
|
||||
G4cout << "Selected G4StackedTrack : " << selectedStackedTrack
|
||||
<< " with G4Track " << selectedStackedTrack->GetTrack()
|
||||
@@ -221,7 +234,7 @@ G4int G4StackManager::PrepareNewEvent()
|
||||
if( GetNPostponedTrack() > 0 )
|
||||
{
|
||||
#ifdef G4VERBOSE
|
||||
if( verboseLevel > 0 )
|
||||
if( verboseLevel > 1 )
|
||||
{
|
||||
G4cout << GetNPostponedTrack()
|
||||
<< " postponed tracked are now shifted to the stack." << G4endl;
|
||||
@@ -302,11 +315,12 @@ void G4StackManager::SetNumberOfAdditionalWaitingStacks(G4int iAdd)
|
||||
void G4StackManager::TransferStackedTracks(G4ClassificationOfNewTrack origin, G4ClassificationOfNewTrack destination)
|
||||
{
|
||||
if(origin==destination) return;
|
||||
if(origin==fKill) return;
|
||||
G4TrackStack* originStack = 0;
|
||||
switch(origin)
|
||||
{
|
||||
case fUrgent:
|
||||
originStack = urgentStack;
|
||||
originStack = 0;
|
||||
break;
|
||||
case fWaiting:
|
||||
originStack = waitingStack;
|
||||
@@ -314,24 +328,18 @@ void G4StackManager::TransferStackedTracks(G4ClassificationOfNewTrack origin, G4
|
||||
case fPostpone:
|
||||
originStack = postponeStack;
|
||||
break;
|
||||
case fKill:
|
||||
break;
|
||||
default:
|
||||
int i = origin - 10;
|
||||
if(i<=numberOfAdditionalWaitingStacks) originStack = additionalWaitingStacks[i-1];
|
||||
break;
|
||||
}
|
||||
if(!originStack) return;
|
||||
|
||||
if(destination==fKill)
|
||||
{
|
||||
G4StackedTrack * aStackedTrack;
|
||||
while( (aStackedTrack=originStack->PopFromStack()) != 0 )
|
||||
{
|
||||
delete aStackedTrack->GetTrack();
|
||||
delete aStackedTrack->GetTrajectory();
|
||||
delete aStackedTrack;
|
||||
}
|
||||
if(originStack)
|
||||
{ originStack->clear(); }
|
||||
else
|
||||
{ urgentStack->clear(); }
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -339,7 +347,7 @@ void G4StackManager::TransferStackedTracks(G4ClassificationOfNewTrack origin, G4
|
||||
switch(destination)
|
||||
{
|
||||
case fUrgent:
|
||||
targetStack = urgentStack;
|
||||
targetStack = 0;
|
||||
break;
|
||||
case fWaiting:
|
||||
targetStack = waitingStack;
|
||||
@@ -352,8 +360,15 @@ void G4StackManager::TransferStackedTracks(G4ClassificationOfNewTrack origin, G4
|
||||
if(i<=numberOfAdditionalWaitingStacks) targetStack = additionalWaitingStacks[i-1];
|
||||
break;
|
||||
}
|
||||
if(!targetStack) return;
|
||||
originStack->TransferTo(targetStack);
|
||||
if(originStack)
|
||||
{
|
||||
if(targetStack)
|
||||
{ originStack->TransferTo(targetStack); }
|
||||
else
|
||||
{ originStack->TransferTo(urgentStack); }
|
||||
}
|
||||
else
|
||||
{ urgentStack->TransferTo(targetStack); }
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -361,11 +376,12 @@ void G4StackManager::TransferStackedTracks(G4ClassificationOfNewTrack origin, G4
|
||||
void G4StackManager::TransferOneStackedTrack(G4ClassificationOfNewTrack origin, G4ClassificationOfNewTrack destination)
|
||||
{
|
||||
if(origin==destination) return;
|
||||
if(origin==fKill) return;
|
||||
G4TrackStack* originStack = 0;
|
||||
switch(origin)
|
||||
{
|
||||
case fUrgent:
|
||||
originStack = urgentStack;
|
||||
originStack = 0;
|
||||
break;
|
||||
case fWaiting:
|
||||
originStack = waitingStack;
|
||||
@@ -373,19 +389,20 @@ void G4StackManager::TransferOneStackedTrack(G4ClassificationOfNewTrack origin,
|
||||
case fPostpone:
|
||||
originStack = postponeStack;
|
||||
break;
|
||||
case fKill:
|
||||
break;
|
||||
default:
|
||||
int i = origin - 10;
|
||||
if(i<=numberOfAdditionalWaitingStacks) originStack = additionalWaitingStacks[i-1];
|
||||
break;
|
||||
}
|
||||
if(!originStack) return;
|
||||
|
||||
G4StackedTrack * aStackedTrack;
|
||||
G4StackedTrack * aStackedTrack = 0;
|
||||
if(destination==fKill)
|
||||
{
|
||||
if( (aStackedTrack=originStack->PopFromStack()) != 0 )
|
||||
if(originStack)
|
||||
{ aStackedTrack = originStack->PopFromStack(); }
|
||||
else
|
||||
{ aStackedTrack = urgentStack->PopFromStack(); }
|
||||
if(aStackedTrack)
|
||||
{
|
||||
delete aStackedTrack->GetTrack();
|
||||
delete aStackedTrack->GetTrajectory();
|
||||
@@ -398,7 +415,7 @@ void G4StackManager::TransferOneStackedTrack(G4ClassificationOfNewTrack origin,
|
||||
switch(destination)
|
||||
{
|
||||
case fUrgent:
|
||||
targetStack = urgentStack;
|
||||
targetStack = 0;
|
||||
break;
|
||||
case fWaiting:
|
||||
targetStack = waitingStack;
|
||||
@@ -411,11 +428,14 @@ void G4StackManager::TransferOneStackedTrack(G4ClassificationOfNewTrack origin,
|
||||
if(i<=numberOfAdditionalWaitingStacks) targetStack = additionalWaitingStacks[i-1];
|
||||
break;
|
||||
}
|
||||
if(!targetStack) return;
|
||||
if( (aStackedTrack=originStack->PopFromStack()) != 0 )
|
||||
{
|
||||
targetStack->PushToStack(aStackedTrack);
|
||||
}
|
||||
if(originStack)
|
||||
{ aStackedTrack = originStack->PopFromStack(); }
|
||||
else
|
||||
{ aStackedTrack = urgentStack->PopFromStack(); }
|
||||
if(targetStack)
|
||||
{ targetStack->PushToStack(aStackedTrack); }
|
||||
else
|
||||
{ urgentStack->PushToStack(aStackedTrack); }
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4StackingMessenger.cc,v 1.5 2006/06/29 18:10:23 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4StackingMessenger.cc,v 1.6 2009/09/16 23:10:46 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
@@ -56,6 +56,14 @@ G4StackingMessenger::G4StackingMessenger(G4StackManager * fCont)
|
||||
clearCmd->SetDefaultValue(0);
|
||||
clearCmd->SetRange("level>=-2&&level<=2");
|
||||
clearCmd->AvailableForStates(G4State_GeomClosed,G4State_EventProc);
|
||||
|
||||
verboseCmd = new G4UIcmdWithAnInteger("/event/stack/verbose",this);
|
||||
verboseCmd->SetGuidance("Set verbose level for G4StackManager");
|
||||
verboseCmd->SetGuidance(" 0 : Silence (default)");
|
||||
verboseCmd->SetGuidance(" 1 : Minimum statistics");
|
||||
verboseCmd->SetGuidance(" 2 : Detailed reports");
|
||||
verboseCmd->SetGuidance("Note - this value is overwritten by /event/verbose command.");
|
||||
|
||||
}
|
||||
|
||||
G4StackingMessenger::~G4StackingMessenger()
|
||||
@@ -75,7 +83,7 @@ void G4StackingMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
|
||||
G4cout << " Waiting stack : " << fContainer->GetNWaitingTrack() << G4endl;
|
||||
G4cout << " Postponed stack : " << fContainer->GetNPostponedTrack() << G4endl;
|
||||
}
|
||||
if( command==clearCmd )
|
||||
else if( command==clearCmd )
|
||||
{
|
||||
G4int vc = clearCmd->GetNewIntValue(newValues);
|
||||
switch (vc)
|
||||
@@ -95,5 +103,9 @@ void G4StackingMessenger::SetNewValue(G4UIcommand * command,G4String newValues)
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( command==verboseCmd )
|
||||
{
|
||||
fContainer->SetVerboseLevel(verboseCmd->GetNewIntValue(newValues));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,16 +24,19 @@
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
// $Id: G4TrackStack.cc,v 1.6 2006/06/29 18:10:26 gunter Exp $
|
||||
// GEANT4 tag $Name: geant4-09-02 $
|
||||
// $Id: G4TrackStack.cc,v 1.8 2009/09/10 21:31:41 asaim Exp $
|
||||
// GEANT4 tag $Name: geant4-09-03 $
|
||||
//
|
||||
|
||||
#include "G4TrackStack.hh"
|
||||
#include "G4SmartTrackStack.hh"
|
||||
#include "G4VTrajectory.hh"
|
||||
|
||||
G4TrackStack::G4TrackStack()
|
||||
:n_stackedTrack(0),firstStackedTrack(0),lastStackedTrack(0)
|
||||
{;}
|
||||
{
|
||||
maxNTracks = 0;
|
||||
}
|
||||
|
||||
G4TrackStack::~G4TrackStack()
|
||||
{
|
||||
@@ -88,6 +91,12 @@ void G4TrackStack::TransferTo(G4TrackStack * aStack)
|
||||
lastStackedTrack = 0;
|
||||
}
|
||||
|
||||
void G4TrackStack::TransferTo(G4SmartTrackStack * aStack)
|
||||
{
|
||||
while(n_stackedTrack)
|
||||
{ aStack->PushToStack(PopFromStack()); }
|
||||
}
|
||||
|
||||
G4StackedTrack * G4TrackStack::PopFromStack()
|
||||
{
|
||||
if( n_stackedTrack == 0 ) return 0;
|
||||
@@ -110,6 +119,7 @@ void G4TrackStack::PushToStack( G4StackedTrack * aStackedTrack )
|
||||
}
|
||||
lastStackedTrack = aStackedTrack;
|
||||
n_stackedTrack++;
|
||||
if(n_stackedTrack>maxNTracks) maxNTracks = n_stackedTrack;
|
||||
}
|
||||
|
||||
void G4TrackStack::GrabFromStack( G4StackedTrack * aStackedTrack )
|
||||
|
||||
Reference in New Issue
Block a user