Import Geant4 8.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:55:03 +02:00
parent 216a75eeb1
commit fe73f43734
6714 changed files with 118229 additions and 68144 deletions
+27 -3
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.28 2005/11/26 00:47:54 mverderi Exp $
$Id: History,v 1.33 2006/11/14 08:56:49 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,10 +17,34 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
November 25, 2005, M. Verderi param-V07-01-04
November 10, 2006, M. Verderi - param-V08-01-00
- Limited number of warning messages printed by the
G4GlobalFastSimulationManager.
- Renamed G4FastSimulationManagerProcess_forCoupledTransportation with
G4FastSimulationManagerProcess81.
In addition, this class can now handle the case of Navigator index=0,
i.e., the navigator for tracking, regardless the G4Transportation or
G4CoupledTransportation is used. (For other navigators, there is
of course no choice, and G4CoupledTransportation is necessary.)
November 3, 2006 M. Verderi
- Introduced G4FastSimulationManagerProcess_forCoupledTransportation class for
handling fast simulation in new parallel geometry scheme. This requires
the G4CoupledTransportation to be active.
- Introduced G4GFSManager81 class that gathers the future code to become the
default at next major release in the G4GlobalFastSimulationManager class.
- G4FastSimulationManager: adapted to new scheme. Still has old code for
backward compatibilty.
- G4FastSimulationManagerProcess: mostly the same, apart from a small bug fix.
- G4FastSimulationMessenger: new command created "/param/showSetup", useful
to show the fast simulation setup (region, models, processes, etc...)
It is only valid for geometry closed state. Desirable to have interactive
command in the run manager for this.
November 25, 2005, M.Verderi - param-V07-01-04
- put back Makoto's change: StartTracking(G4Track*)
November 25, 2005, M. Verderi param-V07-01-03
November 25, 2005, M Verderi - param-V07-01-03
- Make ghost functionnality available with G4Region
- ** Note ** Change back StartTracking(G4Track*) -> StartTracking() in G4FSMP
StartTracking(G4Track*) was introduced in param-V07-01-02
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FastSimulationManager.hh,v 1.11 2006/06/29 21:09:04 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4FastSimulationManager.hh,v 1.12 2006/11/03 17:26:04 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
@@ -143,44 +143,25 @@ public: // without description
G4VFastSimulationModel* GetFastSimulationModel(const G4String& modelName,
const G4VFastSimulationModel* previousFound,
bool &foundPrevious) const;
const std::vector<G4VFastSimulationModel*>& GetFastSimulationModelList() const
{return ModelList;}
// -------------------------------------------------
// Methods to add/remove GhostPlacements to/from the
// GhostPlacements List.
// -------------------------------------------------
//
G4Transform3D* AddGhostPlacement(G4RotationMatrix*,
const G4ThreeVector&);
// Flag that the envelope is a ghost volume giving its global
// placement, where the rotation matrix and the translatation
// vector of 3D transformation describe the placement relative
// to the world coordinates.
G4Transform3D* AddGhostPlacement(G4Transform3D*);
// The same but using a G4Transform3D.
G4bool RemoveGhostPlacement(const G4Transform3D*);
// Removes a Ghost placement.
//
//----------------------------------------------
// Interface methods for the G4GlobalFastSimulationManager
//----------------------------------------------
// Parallel geometry placements
G4bool InsertGhostHereIfNecessary(G4VPhysicalVolume* ,
const G4ParticleDefinition&);
//
// -------------------------------------------------------------
// Deprecated ghost methods, to be dropped @ next major release:
// -------------------------------------------------------------
G4Transform3D* AddGhostPlacement(G4RotationMatrix*, const G4ThreeVector&);
G4Transform3D* AddGhostPlacement(G4Transform3D*);
G4bool RemoveGhostPlacement(const G4Transform3D*);
G4bool InsertGhostHereIfNecessary(G4VPhysicalVolume*, const G4ParticleDefinition&);
//----------------------------------------------
// Interface methods for the
// G4FastSimulationManagerProcess process.
//----------------------------------------------
// Trigger
G4bool PostStepGetFastSimulationManagerTrigger(const G4Track &,
const G4Navigator* a = 0);
const G4Navigator* a = 0);
// DoIt
G4VParticleChange* InvokePostStepDoIt();
@@ -199,10 +180,12 @@ private:
G4VFastSimulationModel* fTriggedFastSimulationModel;
G4FastSimulationVector <G4VFastSimulationModel> ModelList;
G4FastSimulationVector <G4VFastSimulationModel> fInactivatedModels;
G4FastSimulationVector <G4Transform3D> GhostPlacements;
G4ParticleDefinition* fLastCrossedParticle;
G4FastSimulationVector <G4VFastSimulationModel> fApplicableModelList;
// -- *** depracating, to be dropped @ next major release:
G4FastSimulationVector <G4Transform3D> GhostPlacements;
};
inline void
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FastSimulationManagerProcess.hh,v 1.12 2006/06/29 21:09:06 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4FastSimulationManagerProcess.hh,v 1.13 2006/11/03 17:26:04 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
@@ -0,0 +1,161 @@
//
// ********************************************************************
// * 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: G4FastSimulationManagerProcess81.hh,v 1.1 2006/11/10 13:23:07 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
//
// G4FastSimulationManagerProcess81.hh
//
// Description:
// The process that triggers parameterised simulations if any.
//
// History:
// Feb 98: Parallel geometry sensitivity. MoraDeFreitas.
// Oct 97: "Fast" replaces "Parameterisation" in class/method names.
// (release B.00 for parameterisation). MoraDeFreitas.
// Aug 97: First implementation. Verderi && MoraDeFreitas.
// Apr 98: modified for new particle change. H.Kurashige
// Oct 06: Move to parallel geometry scheme. M. Verderi
// Nov 06: name xxx81 is given for this release. "81" will be
// removed @ next maj. rel. so that this process becomes
// the standard one.
//
//---------------------------------------------------------------
#ifndef G4FastSimulationManagerProcess81_hh
#define G4FastSimulationManagerProcess81_hh
#include "globals.hh"
#include "G4VProcess.hh"
#include "G4FastSimulationManager.hh"
#include "G4Step.hh"
#include "G4Navigator.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VParticleChange.hh"
// ---------------------------------------------------------------------
//
// G4FastSimulationManagerProcess81 class
//
// ---------------------------------------------------------------------
// Class Description:
// -- G4VProcess providing the interface between the tracking and the fast simulation.
//
class G4FastSimulationManagerProcess81 : public G4VProcess
{
public:
// -------------------------
// Constructor/Destructor:
// -------------------------
// -- Constructor for parameterisation in mass geometry
G4FastSimulationManagerProcess81(const G4String& processName = "G4FastSimulationManagerProcess81",
G4ProcessType theType = fParameterisation);
// -- Contructors for parameterisation attached a parallel geometry.
// -- Can also be used for the mass geometry, providing world volume name.
// -- World volume specified by name or pointer.
G4FastSimulationManagerProcess81(const G4String& processName,
const G4String& worldVolumeName,
G4ProcessType theType = fParameterisation);
G4FastSimulationManagerProcess81(const G4String& processName,
G4VPhysicalVolume* worldVolume,
G4ProcessType theType = fParameterisation);
virtual ~G4FastSimulationManagerProcess81();
// -----------------------
// User access methods:
// -----------------------
// -- const G4VPhysicalVolume* GetWorldVolume() const {return fWorldVolume;}
G4VPhysicalVolume* GetWorldVolume() const {return fWorldVolume;}
// -- Set new world volume to the process
void SetWorldVolume(G4String );
void SetWorldVolume(G4VPhysicalVolume*);
// --------------------------------------------------------------
// Process interface
// --------------------------------------------------------------
// -- Start/End tracking:
void StartTracking(G4Track*);
void EndTracking();
// -- PostStep methods:
G4double PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition);
G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step& );
// -- AtRest methods (still there after many years of no use...):
G4double AtRestGetPhysicalInteractionLength(const G4Track&,
G4ForceCondition*);
G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&);
// -- unused:
G4double AlongStepGetPhysicalInteractionLength(const G4Track&, G4double, G4double, G4double&, G4GPILSelection*) {return 0.0;}
G4VParticleChange* AlongStepDoIt(const G4Track& , const G4Step&) {return 0;}
// -- debug:
void Verbose() const;
// ******* private *******
private:
//-- would be better to my taste to have "const G4VPhysicalVolume* fWorldVolume;", but clashes at compilation
G4VPhysicalVolume* fWorldVolume;
G4bool fIsTrackingTime;
G4bool fIsFirstStep;
G4Navigator* fNavigator;
G4int fNavigatorIndex;
G4FastSimulationManager* fFastSimulationManager;
G4bool fFastSimulationTrigger;
};
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FastSimulationMessenger.hh,v 1.5 2006/06/29 21:09:08 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4FastSimulationMessenger.hh,v 1.6 2006/11/03 17:26:04 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
// GEANT 4 class header file
@@ -64,12 +64,13 @@ private:
G4GlobalFastSimulationManager* fGlobalFastSimulationManager;
//commands
G4UIdirectory *fFSDirectory;
G4UIcmdWithAString *fListEnvelopesCmd;
G4UIcmdWithAString *fListModelsCmd;
G4UIcmdWithAString *fListIsApplicableCmd;
G4UIcmdWithAString *fActivateModel;
G4UIcmdWithAString *fInActivateModel;
G4UIdirectory* fFSDirectory;
G4UIcmdWithoutParameter* fShowSetupCmd;
G4UIcmdWithAString* fListEnvelopesCmd;
G4UIcmdWithAString* fListModelsCmd;
G4UIcmdWithAString* fListIsApplicableCmd;
G4UIcmdWithAString* fActivateModel;
G4UIcmdWithAString* fInActivateModel;
};
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4FastStep.hh,v 1.8 2006/06/29 21:09:14 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
@@ -25,7 +25,7 @@
//
//
// $Id: G4FastStep.icc,v 1.5 2006/06/29 21:09:16 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// $id: G4ParticleChange.icc,v 1.6 1998/04/14 02:25:54 kurasige Exp $
@@ -25,7 +25,7 @@
//
//
// $Id: G4FastTrack.hh,v 1.7 2006/06/29 21:09:18 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
// $Id:
//---------------------------------------------------------------
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FlavoredParallelWorld.hh,v 1.6 2006/06/29 21:09:20 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4FlavoredParallelWorld.hh,v 1.7 2006/11/03 17:26:04 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
@@ -49,7 +49,7 @@
#include "G4VFlavoredParallelWorld.hh"
class G4ParticleDefinition;
class G4VPhysicalVolume;
#include "G4VPhysicalVolume.hh"
class G4FlavoredParallelWorld : public G4VFlavoredParallelWorld
{
@@ -0,0 +1,73 @@
//
// ********************************************************************
// * 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: G4GFSManager81.hh,v 1.1 2006/11/10 13:23:07 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
//
// G4GFSManager81.hh
//
// Description:
// Gathers code to be dropped @ next major release
//
// History:
// November 06: Marc Verderi
//
//---------------------------------------------------------------
#ifndef G4GFSManager81_hh
#define G4GFSManager81_hh
#include "globals.hh"
#include "G4FastSimulationVector.hh"
#include "G4FlavoredParallelWorld.hh"
#include "G4StateManager.hh"
class G4GFSManager;
class G4GFSManager81 {
public:
~G4GFSManager81();
void FastSimulationNeedsToBeClosed();
public:
void CloseFastSimulation();
G4VFlavoredParallelWorld* GetFlavoredWorldForThis(G4ParticleDefinition *);
G4bool Notify(G4ApplicationState requestedState);
G4GFSManager81();
private:
G4bool fClosed;
G4FastSimulationVector <G4FlavoredParallelWorld> NeededFlavoredWorlds;
G4VPhysicalVolume* GiveMeAWorldVolumeClone();
};
#endif
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4GlobalFastSimulationManager.hh,v 1.10 2006/06/29 21:09:22 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4GlobalFastSimulationManager.hh,v 1.12 2006/11/10 13:23:07 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
@@ -53,18 +53,19 @@
#include "G4VGlobalFastSimulationManager.hh"
#include "G4FastSimulationManager.hh"
#include "G4FastSimulationManagerProcess.hh"
#include "G4FastSimulationManagerProcess81.hh"
#include "G4StateManager.hh"
#include "G4VStateDependent.hh"
#include "G4FlavoredParallelWorld.hh"
class G4FastSimulationMessenger;
enum listType {
NAMES_ONLY,
MODELS,
ISAPPLICABLE
};
class G4FastSimulationMessenger;
// Class Description:
// This a singleton class which provides the management of the G4FastSimulationManager
@@ -84,9 +85,17 @@ class G4FastSimulationMessenger;
// geometries.
//
// -- *** to be dropped @ next major release: >>>
#include "G4GFSManager81.hh"
// -- <<<.
class G4GlobalFastSimulationManager : public G4VStateDependent,
public G4VGlobalFastSimulationManager
{
// -- *** to be dropped @ next major release: >>>
friend class G4GFSManager81;
// -- <<<.
public: // With description
static G4GlobalFastSimulationManager* GetGlobalFastSimulationManager();
@@ -123,12 +132,19 @@ public: // Without description
// Destructor
~G4GlobalFastSimulationManager();
// G4FastSimulationManager's management :
//
// G4FastSimulationManager(Process)'s management, no intended for
// general use.
//
// Methods for a G4FastSimulationManager to register itself
//
void AddFastSimulationManager(G4FastSimulationManager*);
void AddFastSimulationManager(G4FastSimulationManager*);
void RemoveFastSimulationManager(G4FastSimulationManager*);
//
// G4FastSimulationManagerProcess bookeeping:
//
void AddFSMP(G4FastSimulationManagerProcess81*);
void RemoveFSMP(G4FastSimulationManagerProcess81*);
// Flag that the Parameterisation must be closed.
@@ -136,19 +152,20 @@ public: // Without description
public: // With description
void CloseFastSimulation();
// Build the parallel worlds when you are using ghost volumes. In this case the Parameterisation
// MUST be closed BEFORE closing the geometry. It's enough to call this method just before
// closing the geometry.
//
void ShowSetup();
// Show the fast simulation setup : world(s), region(s), model(s) and links between them.
// Requires the geometry to be closed.
public: // Without description
// print/control commands
void ListEnvelopes(const G4String& aName = "all",
listType aListType = NAMES_ONLY);
void ListEnvelopes(const G4ParticleDefinition*);
void CloseFastSimulation();
// deprecated
void ListEnvelopes(const G4String& aName = "all",
listType aListType = NAMES_ONLY);
void ListEnvelopes(const G4ParticleDefinition* );
void ActivateFastSimulationModel(const G4String&);
void ActivateFastSimulationModel(const G4String&);
void InActivateFastSimulationModel(const G4String&);
// G4FastSimulationProcess interface
@@ -161,6 +178,9 @@ private:
// Private construtor insures singleton class
G4GlobalFastSimulationManager();
// recursive display of regions, models, etc...
void DisplayRegion(G4Region* motherRegion, G4int depth, std::vector<G4ParticleDefinition*>& particles) const;
// The single instance.
static G4GlobalFastSimulationManager* fGlobalFastSimulationManager;
@@ -170,14 +190,12 @@ private:
// List of G4FastSimulationManagers
G4FastSimulationVector <G4FastSimulationManager> ManagedManagers;
// fClosed flags if the NeededFlavoredWorlds List was Build.
G4bool fClosed;
// Instantiated fast simulation processes:
G4FastSimulationVector <G4FastSimulationManagerProcess81> fFSMPVector;
// List of needed ParallelWorlds after close
G4FastSimulationVector <G4FlavoredParallelWorld> NeededFlavoredWorlds;
// Internal fonction to Build world volume clones.
G4VPhysicalVolume* GiveMeAWorldVolumeClone();
// -- *** to be dropped @ next major release: >>>
G4GFSManager81* _deprecated;
};
#endif
@@ -25,7 +25,7 @@
//
//
// $Id: G4VFastSimulationModel.hh,v 1.7 2006/06/29 21:09:24 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FastSimulationManager.cc,v 1.11 2006/06/29 21:09:26 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4FastSimulationManager.cc,v 1.12 2006/11/03 17:26:04 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//---------------------------------------------------------------
//
@@ -42,6 +42,7 @@
#include "G4FastSimulationManager.hh"
#include "G4GlobalFastSimulationManager.hh"
#include "G4PVPlacement.hh"
#include "G4TransportationManager.hh"
// --------------------------------------------------
// Constructor with envelope and IsUnique flag :
@@ -154,6 +155,7 @@ G4FastSimulationManager::GetFastSimulationModel(const G4String& modelName,
return model;
}
// ***************************************** TO BE DROPPED ********************************************** >>>> BEGINNING
//----------------------------------------
// Methods to add/remove GhostPlacements
@@ -226,6 +228,7 @@ InsertGhostHereIfNecessary(G4VPhysicalVolume* theClone,
return false;
}
// ***************************************** TO BE DROPPED **************************************** <<<< END
//
//-------------------------------------
@@ -369,7 +372,10 @@ void
G4FastSimulationManager::ListTitle() const
{
G4cout << fFastTrack.GetEnvelope()->GetName();
if(GhostPlacements.size()!=0) G4cout << " (ghost)";
// if(GhostPlacements.size()!=0) G4cout << " (ghost)";
if (fFastTrack.GetEnvelope()->GetWorldPhysical() == G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()) G4cout << " (mass geom.)";
else G4cout << " (// geom.)";
}
void
@@ -379,7 +385,7 @@ G4FastSimulationManager::ListModels() const
G4cout << "Current Models for the ";
ListTitle();
G4cout << " Envelope:\n";
G4cout << " envelope:\n";
for (iModel=0; iModel<ModelList.size(); iModel++)
G4cout << " " << ModelList[iModel]->GetName() << "\n";
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FastSimulationManagerProcess.cc,v 1.13 2006/06/29 21:09:28 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4FastSimulationManagerProcess.cc,v 1.14 2006/11/03 17:26:04 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
@@ -148,6 +148,7 @@ G4FastSimulationManagerProcess::PostStepGetPhysicalInteractionLength(
fOutOfGhostWorld = true;
}
}
if (fGhostWorld == 0) fStartTracking = false; // -- case ghost world below
// -------------------------------------------------------
//
@@ -0,0 +1,314 @@
//
// ********************************************************************
// * 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: G4FastSimulationManagerProcess81.cc,v 1.1 2006/11/10 13:23:07 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
//
// G4FastSimulationProcess.cc
//
// Description:
// The process that triggers the parameterised simulations,
// if any.
//
// History:
// August 97: First implementation. Verderi && MoraDeFreitas.
// October 06: move to parallel geometry scheme, M. Verderi
//---------------------------------------------------------------
#include "G4ios.hh"
#include "G4FastSimulationManagerProcess81.hh"
#include "G4GlobalFastSimulationManager.hh"
#include "G4TransportationManager.hh"
#include "G4PathFinder.hh"
#include "G4ParticleChange.hh"
#define PARANOIA
G4FastSimulationManagerProcess81::
G4FastSimulationManagerProcess81(const G4String& processName,
G4ProcessType theType) :
G4VProcess(processName,theType),
fWorldVolume(0),
fIsTrackingTime(false),
fNavigator(0),
fNavigatorIndex(-1),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
{
SetWorldVolume(G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume()->GetName());
if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "' is created, and will message geometry with world volume `"
<< fWorldVolume->GetName() << "'." << G4endl;
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
}
G4FastSimulationManagerProcess81::
G4FastSimulationManagerProcess81(const G4String& processName,
const G4String& worldVolumeName,
G4ProcessType theType) :
G4VProcess(processName,theType),
fWorldVolume(0),
fIsTrackingTime(false),
fNavigator(0),
fNavigatorIndex(-1),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
{
SetWorldVolume(worldVolumeName);
if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "' is created, and will message geometry with world volume `"
<< fWorldVolume->GetName() << "'." << G4endl;
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
}
G4FastSimulationManagerProcess81::
G4FastSimulationManagerProcess81(const G4String& processName,
G4VPhysicalVolume* worldVolume,
G4ProcessType theType) :
G4VProcess(processName,theType),
fWorldVolume(0),
fIsTrackingTime(false),
fNavigator(0),
fNavigatorIndex(-1),
fFastSimulationManager(0),
fFastSimulationTrigger(false)
{
SetWorldVolume(worldVolume);
if (verboseLevel>0) G4cout << "G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "' is created, and will message geometry with world volume `"
<< fWorldVolume->GetName() << "'." << G4endl;
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->AddFSMP(this);
}
G4FastSimulationManagerProcess81::~G4FastSimulationManagerProcess81()
{
G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()->RemoveFSMP(this);
}
// -----------------------
// User access methods:
// -----------------------
void
G4FastSimulationManagerProcess81::
SetWorldVolume(G4String newWorldName)
{
if (fIsTrackingTime)
G4cout << "!!! G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "': changing world volume at tracking time is not allowed for now. Call ignored !!!" << G4endl;
else
{
G4VPhysicalVolume* newWorld = G4TransportationManager::GetTransportationManager()->IsWorldExisting(newWorldName);
G4String tellWhatIsWrong;
tellWhatIsWrong = "Volume newWorldName = `"; tellWhatIsWrong += newWorldName; tellWhatIsWrong += "' is not a parallel world nor the mass world volume.";
if (newWorld == 0) G4Exception("G4FastSimulationManagerProcess81::SetWorldVolume(const G4String&, G4bool verbose)",
"InvalidWorld",
FatalException,
tellWhatIsWrong);
if (verboseLevel>0)
if (fWorldVolume) G4cout << "G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "': changing world volume from '" << fWorldVolume->GetName()
<< "' to `" << newWorld << "'." << G4endl;
else G4cout << "G4FastSimulationManagerProcess81 `" << GetProcessName()
<< "': setting world volume from to `"<< newWorld->GetName() << "'." << G4endl;
fWorldVolume = newWorld;
}
}
void
G4FastSimulationManagerProcess81::
SetWorldVolume(G4VPhysicalVolume* newWorld)
{
if (newWorld) SetWorldVolume(newWorld->GetName());
else G4cout << "!!! G4FastSimulationManagerProcess81::SetWorldVolume(const G4VPhysicalVolume* newWorld) : null pointer passed. !!! Continuing at your own risks..." << G4endl;
}
// --------------------
// Start/End tracking:
// --------------------
void
G4FastSimulationManagerProcess81::
StartTracking(G4Track*)
{
fIsTrackingTime = true;
fIsFirstStep = true;
// -- fetch the navigator (and its index) and activate it:
G4TransportationManager* transportationManager = G4TransportationManager::GetTransportationManager();
fNavigator = transportationManager->GetNavigator(fWorldVolume);
if (fNavigator != transportationManager->GetNavigatorForTracking())
fNavigatorIndex = transportationManager->ActivateNavigator(fNavigator);
else
fNavigatorIndex = 0;
}
void
G4FastSimulationManagerProcess81::
EndTracking()
{
fIsTrackingTime = false;
}
// ------------------------------------------
// PostStepGetPhysicalInteractionLength():
// ------------------------------------------
G4double
G4FastSimulationManagerProcess81::
PostStepGetPhysicalInteractionLength(const G4Track& track,
G4double,
G4ForceCondition* condition)
{
#ifdef PARANOIA
if ( fNavigator->GetWorldVolume() != fWorldVolume ) G4Exception("!!! ??? INCONSISTENT NAVIGATORS/WORLD VOLUMES ??? !!!");
#endif
// -- Get current volume, and check for presence of fast simulation manager.
// -- For the case of the navigator for tracking (fNavigatorIndex == 0)
// -- we use the track volume. This allows the code to be valid for both
// -- cases where the PathFinder is used (G4CoupledTranportation) or not
// -- (G4Transportation).
const G4VPhysicalVolume* currentVolume(0);
if (fNavigatorIndex == 0) currentVolume = track.GetVolume();
else currentVolume = G4PathFinder::GetInstance()->GetLocatedVolume(fNavigatorIndex);
if ( currentVolume )
{
fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
if( fFastSimulationManager )
{
// Ask for trigger:
fFastSimulationTrigger = fFastSimulationManager->PostStepGetFastSimulationManagerTrigger(track, fNavigator);
if( fFastSimulationTrigger )
{
// Take control over stepping:
*condition = ExclusivelyForced;
return 0.0;
}
}
}
// -- no fast simulation occuring there:
*condition = NotForced;
return DBL_MAX;
}
//------------------------------------
// PostStepDoIt()
//------------------------------------
G4VParticleChange*
G4FastSimulationManagerProcess81::
PostStepDoIt(const G4Track&,
const G4Step&)
{
G4VParticleChange* finalState = fFastSimulationManager->InvokePostStepDoIt();
// If the particle is still alive, suspend it to force physics re-initialisation:
if (finalState->GetTrackStatus() != fStopAndKill) finalState->ProposeTrackStatus(fSuspend);
return finalState;
}
//--------------------------------------------
// At Rest parameterisation:
//--------------------------------------------
// AtRestGetPhysiscalInteractionLength:
//--------------------------------------------
G4double
G4FastSimulationManagerProcess81::
AtRestGetPhysicalInteractionLength(const G4Track& track,
G4ForceCondition* condition)
{
const G4VPhysicalVolume* currentVolume(0);
if (fNavigatorIndex == 0) currentVolume = track.GetVolume();
else currentVolume = G4PathFinder::GetInstance()->GetLocatedVolume(fNavigatorIndex);
fFastSimulationManager = currentVolume->GetLogicalVolume()->GetFastSimulationManager();
if( fFastSimulationManager )
{
// Ask for trigger:
fFastSimulationTrigger = fFastSimulationManager->AtRestGetFastSimulationManagerTrigger(track, fNavigator);
if( fFastSimulationTrigger )
{
// Dirty trick to take control over stepping. Does anyone will ever use that ?
*condition = NotForced;
return -1.0;
}
}
// -- no fast simulation occuring there:
*condition = NotForced;
return DBL_MAX;
}
//-----------------------------------------------
// AtRestDoIt:
//-----------------------------------------------
G4VParticleChange* G4FastSimulationManagerProcess81::AtRestDoIt(const G4Track&, const G4Step&)
{
return fFastSimulationManager->InvokeAtRestDoIt();
}
void G4FastSimulationManagerProcess81::Verbose() const
{
/* G4cout << " >>>>> Trigger Status : ";
switch(fFastSimulationManager->GetTriggerStatus())
{
case NoModel:
G4cout << "NoModel" << G4endl;
break;
case OnBoundaryButLeaving:
G4cout << "OnBoundaryButLeaving" << G4endl;
break;
case OneModelTrigger:
G4cout << "OneModelTrigger" << G4endl;
break;
case NoModelTrigger:
G4cout << "NoModelTrigger" << G4endl;
break;
case Undefined:
G4cout << "Undefined" << G4endl;
break;
default:
G4cout << " Bizarre..." << G4endl;
break;
}*/
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4FastSimulationMessenger.cc,v 1.6 2006/06/29 21:09:30 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4FastSimulationMessenger.cc,v 1.7 2006/11/03 17:26:04 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
#include "G4FastSimulationMessenger.hh"
@@ -42,6 +42,11 @@ G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM)
fFSDirectory = new G4UIdirectory("/param/");
fFSDirectory->SetGuidance("Fast Simulation print/control commands.");
fShowSetupCmd =
new G4UIcmdWithoutParameter("/param/showSetup", this);
fShowSetupCmd->SetGuidance("Show fast simulation setup");
fShowSetupCmd->AvailableForStates(G4State_GeomClosed);
fListEnvelopesCmd =
new G4UIcmdWithAString("/param/listEnvelopes", this);
fListEnvelopesCmd->SetParameterName("ParticleName",true);
@@ -78,6 +83,8 @@ G4FastSimulationMessenger(G4GlobalFastSimulationManager* theGFSM)
G4FastSimulationMessenger::~G4FastSimulationMessenger()
{
delete fShowSetupCmd;
fShowSetupCmd = 0;
delete fListIsApplicableCmd;
fListIsApplicableCmd = 0;
delete fActivateModel;
@@ -94,6 +101,8 @@ G4FastSimulationMessenger::~G4FastSimulationMessenger()
void G4FastSimulationMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if (command == fShowSetupCmd)
fGlobalFastSimulationManager->ShowSetup();
if( command == fListEnvelopesCmd)
if(newValue == "all")
fGlobalFastSimulationManager->ListEnvelopes();
@@ -25,7 +25,7 @@
//
//
// $Id: G4FastStep.cc,v 1.16 2006/06/29 21:09:32 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//---------------------------------------------------------------
//
@@ -25,7 +25,7 @@
//
//
// $Id: G4FastTrack.cc,v 1.10 2006/06/29 21:09:34 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//---------------------------------------------------------------
//
@@ -0,0 +1,167 @@
//
// ********************************************************************
// * 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: G4GFSManager81.cc,v 1.1 2006/11/10 13:23:07 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
//
// G4GFSManager81.cc
//
// Description:
// Gathers code to be dropped at the next major release
//
// History:
// November 2006
//
//---------------------------------------------------------------
#include "G4GFSManager81.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4Material.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4TransportationManager.hh"
#include "G4FastSimulationMessenger.hh"
#include "G4GlobalFastSimulationManager.hh"
G4GFSManager81::G4GFSManager81()
{
// It starts closed.
fClosed=true;
}
void G4GFSManager81::FastSimulationNeedsToBeClosed()
{
fClosed=false;
}
void G4GFSManager81::CloseFastSimulation()
{
if(fClosed) return;
G4ParticleTable* theParticleTable;
// Reset the NeededFlavoredWorlds List
NeededFlavoredWorlds.clearAndDestroy();
// We'll look for models for all particle types
theParticleTable=G4ParticleTable::GetParticleTable();
// Creates the first world volume clone.
G4VPhysicalVolume* aClone = GiveMeAWorldVolumeClone();
G4cout << "Closing Fast-Simulation ..." << G4endl;
for (G4int iParticle=0;
iParticle<theParticleTable->entries(); iParticle++) {
G4bool Needed = false;
G4GlobalFastSimulationManager* global = G4GlobalFastSimulationManager::GetGlobalFastSimulationManager();
for (size_t ifsm=0; ifsm< global->ManagedManagers.size(); ifsm++)
Needed = Needed || global->ManagedManagers[ifsm]->
InsertGhostHereIfNecessary(aClone,
*(theParticleTable->
GetParticle(iParticle)));
// if some FSM inserted a ghost, keep this clone.
if(Needed)
{
G4Region* aWorldGhostRegion = new G4Region("Ghost world region for " + theParticleTable->GetParticle(iParticle)->GetParticleName());
aWorldGhostRegion->AddRootLogicalVolume(aClone->GetLogicalVolume());
NeededFlavoredWorlds.push_back(new G4FlavoredParallelWorld(theParticleTable->GetParticle(iParticle), aClone));
// and prepare a new one.
aClone=GiveMeAWorldVolumeClone();
}
}
fClosed=true;
}
G4VFlavoredParallelWorld*
G4GFSManager81::
GetFlavoredWorldForThis(G4ParticleDefinition* particle)
{
for (size_t ipw=0; ipw<NeededFlavoredWorlds.size(); ipw++)
if(NeededFlavoredWorlds[ipw]->GetTheParticleType()==particle)
return NeededFlavoredWorlds[ipw];
return 0;
}
G4VPhysicalVolume*
G4GFSManager81::GiveMeAWorldVolumeClone()
{
G4VPhysicalVolume* theParallelWorldPhysical;
G4TransportationManager *transportationManager=
G4TransportationManager::GetTransportationManager();
G4VSolid *parallelWorldSolid=transportationManager->
GetNavigatorForTracking()->GetWorldVolume()->
GetLogicalVolume()->GetSolid();
G4Material *parallelWorldMaterial=transportationManager->
GetNavigatorForTracking()->GetWorldVolume()->
GetLogicalVolume()->GetMaterial();
G4LogicalVolume *parallelWorldLog =
new G4LogicalVolume(parallelWorldSolid,
parallelWorldMaterial,
"ParallelWorldLogical",
0, 0, 0);
theParallelWorldPhysical= new G4PVPlacement(0,G4ThreeVector(),
"ParallelWorldPhysical",
parallelWorldLog,
0,false,0);
return theParallelWorldPhysical;
}
G4bool
G4GFSManager81::Notify(G4ApplicationState requestedState)
{
G4StateManager * stateManager = G4StateManager::GetStateManager();
if((stateManager->GetPreviousState()==G4State_Idle) &&
(requestedState==G4State_GeomClosed) && (!fClosed) )
{
G4cerr
<< "ERROR - G4GFSManager81::Notify()" << G4endl
<< " 1) you are using ghost volumes;" << G4endl
<< " 2) In this case the G4GFSManager81" << G4endl
<< " MUST be closed BEFORE closing the geometry;" << G4endl
<< " 3) To do this put in your code the call to" << G4endl
<< " GetGlobalFastSimulationManager()->CloseFastSimulation();"
<< G4endl
<< " just before closing the geometry." << G4endl;
G4Exception("G4GFSManager81::Notify()", "InvalidState",
FatalException, "Fast simulation must be closed.");
}
return true;
}
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4GlobalFastSimulationManager.cc,v 1.16 2006/06/29 21:09:36 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// $Id: G4GlobalFastSimulationManager.cc,v 1.19 2006/11/10 15:27:17 mverderi Exp $
// GEANT4 tag $Name: geant4-08-02 $
//
//
//---------------------------------------------------------------
@@ -54,6 +54,14 @@
#include "G4PVPlacement.hh"
#include "G4TransportationManager.hh"
#include "G4FastSimulationMessenger.hh"
#include "G4RegionStore.hh"
#include "G4ProcessVector.hh"
#include "G4ProcessManager.hh"
#include "G4PhysicalVolumeStore.hh"
// -- *** to be dropped @ next major release: >>>>
#include "G4GFSManager81.hh"
// -- <<<<<<<<
G4GlobalFastSimulationManager*
G4GlobalFastSimulationManager::fGlobalFastSimulationManager = 0;
@@ -66,6 +74,7 @@ G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()
{
fGlobalFastSimulationManager = new G4GlobalFastSimulationManager;
SetConcreteInstance(fGlobalFastSimulationManager);
}
return fGlobalFastSimulationManager;
}
@@ -73,10 +82,11 @@ G4GlobalFastSimulationManager::GetGlobalFastSimulationManager()
G4GlobalFastSimulationManager::G4GlobalFastSimulationManager()
{
// It starts closed.
fClosed=true;
// Initialises the G4FastSimulationMessenger
fTheFastSimulationMessenger=new G4FastSimulationMessenger(this);
// -- *** to be dropped @ next major release ***:
_deprecated = new G4GFSManager81();
}
G4GlobalFastSimulationManager::~G4GlobalFastSimulationManager()
@@ -87,7 +97,7 @@ G4GlobalFastSimulationManager::~G4GlobalFastSimulationManager()
void G4GlobalFastSimulationManager::FastSimulationNeedsToBeClosed()
{
fClosed=false;
_deprecated->FastSimulationNeedsToBeClosed();
}
void G4GlobalFastSimulationManager::
@@ -102,54 +112,34 @@ RemoveFastSimulationManager(G4FastSimulationManager* fsmanager)
ManagedManagers.remove(fsmanager);
}
void G4GlobalFastSimulationManager::
AddFSMP(G4FastSimulationManagerProcess81* fp)
{
fFSMPVector.push_back(fp);
}
void G4GlobalFastSimulationManager::
RemoveFSMP(G4FastSimulationManagerProcess81* fp)
{
fFSMPVector.remove(fp);
}
void G4GlobalFastSimulationManager::CloseFastSimulation()
{
if(fClosed) return;
G4ParticleTable* theParticleTable;
// Reset the NeededFlavoredWorlds List
NeededFlavoredWorlds.clearAndDestroy();
// We'll look for models for all particle types
theParticleTable=G4ParticleTable::GetParticleTable();
// Creates the first world volume clone.
G4VPhysicalVolume* aClone = GiveMeAWorldVolumeClone();
G4cout << "Closing Fast-Simulation ..." << G4endl;
for (G4int iParticle=0;
iParticle<theParticleTable->entries(); iParticle++) {
G4bool Needed = false;
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
Needed = Needed || ManagedManagers[ifsm]->
InsertGhostHereIfNecessary(aClone,
*(theParticleTable->
GetParticle(iParticle)));
// if some FSM inserted a ghost, keep this clone.
if(Needed)
{
G4Region* aWorldGhostRegion = new G4Region("Ghost world region for " + theParticleTable->GetParticle(iParticle)->GetParticleName());
aWorldGhostRegion->AddRootLogicalVolume(aClone->GetLogicalVolume());
NeededFlavoredWorlds.push_back(new G4FlavoredParallelWorld(theParticleTable->GetParticle(iParticle), aClone));
// and prepare a new one.
aClone=GiveMeAWorldVolumeClone();
}
}
fClosed=true;
static int count(0);
if (count++ < 5)
G4cout << "G4GlobalFastSimulationManager::CloseFastSimulation() : DEPRECATING, will be dropped @ next major release" << G4endl;
_deprecated->CloseFastSimulation();
}
G4VFlavoredParallelWorld*
G4GlobalFastSimulationManager::
GetFlavoredWorldForThis(G4ParticleDefinition* particle)
GetFlavoredWorldForThis(G4ParticleDefinition* definition)
{
for (size_t ipw=0; ipw<NeededFlavoredWorlds.size(); ipw++)
if(NeededFlavoredWorlds[ipw]->GetTheParticleType()==particle)
return NeededFlavoredWorlds[ipw];
return 0;
static int count(0);
if (count++ < 5)
G4cout << "G4GlobalFastSimulationManager::GetFlavoredWorldForThis(...): DEPRECATING, will be dropped @ next major release" << G4endl;
return _deprecated->GetFlavoredWorldForThis(definition);
}
void
@@ -182,37 +172,143 @@ InActivateFastSimulationModel(const G4String& aName)
G4cout << G4endl;
}
void
G4GlobalFastSimulationManager::ShowSetup()
{
std::vector<G4VPhysicalVolume*> worldDone;
G4VPhysicalVolume* world;
G4RegionStore* regions = G4RegionStore::GetInstance();
// ----------------------------------------------------
// -- loop on regions to get the list of world volumes:
// ----------------------------------------------------
G4cout << "\nFast simulation setup:" << G4endl;
for (size_t i=0; i<regions->size(); i++)
{
world = (*regions)[i]->GetWorldPhysical();
G4bool newWorld = true;
for (size_t ii=0; ii<worldDone.size(); ii++) if (worldDone[ii] == world) {newWorld = false; break;}
if (newWorld)
{
worldDone.push_back(world);
G4Region* worldRegion = world->GetLogicalVolume()->GetRegion();
// -- preambule: print physical volume and region names...
if (world == G4TransportationManager::GetTransportationManager()->GetNavigatorForTracking()->GetWorldVolume())
G4cout << "\n * Mass Geometry with ";
else
G4cout << "\n * Parallel Geometry with ";
G4cout << "world volume: `" << world->GetName() << "' [region : `" << worldRegion->GetName() << "']" << G4endl;
// -- ... and print G4FSMP(s) attached to this world volume:
G4bool findG4FSMP(false);
// -- show to what particles this G4FSMP is attached to:
std::vector<G4ParticleDefinition*> particlesKnown;
for (size_t ip=0; ip<fFSMPVector.size(); ip++)
if (fFSMPVector[ip]->GetWorldVolume() == world)
{
G4cout << " o G4FastSimulationProcess: '" << fFSMPVector[ip]->GetProcessName() << "'" << G4endl;
G4cout << " Attached to:";
G4ParticleTable* particles = G4ParticleTable::GetParticleTable();
for (G4int iParticle=0; iParticle<particles->entries(); iParticle++)
{
G4ParticleDefinition* particle = particles->GetParticle(iParticle);
G4ProcessVector* processes = particle->GetProcessManager()->GetProcessList();
if (processes->contains(fFSMPVector[ip])) {G4cout << " " << particle->GetParticleName(); findG4FSMP = true; particlesKnown.push_back(particle);}
}
G4cout << G4endl;
}
if (!findG4FSMP) G4cout << " o G4FastSimulationProcess: (none)" << G4endl;
// -- now display the regions in this world volume, with mother<->daughter link shown by indentation:
G4cout << " o Region(s) and model(s) setup:" << G4endl;
DisplayRegion(worldRegion, 1, particlesKnown);
}
}
}
void
G4GlobalFastSimulationManager::
DisplayRegion(G4Region* region, G4int depth, std::vector<G4ParticleDefinition*>& particlesKnown) const
{
G4String indent = " ";
for (G4int I=0; I<depth; I++) indent += " ";
G4cout << indent << "Region: `" << region->GetName() <<"'" << G4endl;
G4FastSimulationManager* fastSimManager = region->GetFastSimulationManager();
if (fastSimManager)
{
indent += " ";
G4cout << indent << "Model(s):" << G4endl;
indent += " ";
for (size_t im=0; im<fastSimManager->GetFastSimulationModelList().size(); im++)
{
G4cout << indent << "`" << (fastSimManager->GetFastSimulationModelList())[im]->GetName() << "'";
G4cout << " ; applicable to:";
G4ParticleTable* particles = G4ParticleTable::GetParticleTable();
for (G4int iParticle=0; iParticle<particles->entries(); iParticle++)
{
if ((fastSimManager->GetFastSimulationModelList())[im]->IsApplicable(*(particles->GetParticle(iParticle))))
{
G4cout << " " << particles->GetParticle(iParticle)->GetParticleName();
G4bool known(false);
for (size_t l=0; l<particlesKnown.size();l++) if(particlesKnown[l] == particles->GetParticle(iParticle)) {known = true; break;}
if (!known) G4cout << "[!!]";
}
}
G4cout << G4endl;
}
}
// -- all that to check mothership of "region"
G4PhysicalVolumeStore* physVolStore = G4PhysicalVolumeStore::GetInstance();
for (size_t ip=0; ip<physVolStore->size(); ip++)
{
G4VPhysicalVolume* physVol = (*physVolStore)[ip];
if (physVol->GetLogicalVolume()->IsRootRegion())
if (physVol->GetMotherLogical())
{
G4Region* thisVolMotherRegion = physVol->GetMotherLogical()->GetRegion();
if (thisVolMotherRegion == region)
DisplayRegion(physVol->GetLogicalVolume()->GetRegion(), depth+1, particlesKnown);
}
}
}
void
G4GlobalFastSimulationManager::ListEnvelopes(const G4String& aName,
listType theType)
listType theType)
{
if(theType == ISAPPLICABLE) {
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
ManagedManagers[ifsm]->ListModels(aName);
return;
}
if(aName == "all") {
G4int titled = 0;
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++) {
if(theType == NAMES_ONLY) {
if(!(titled++))
G4cout << "Current Envelopes for Fast Simulation:\n";
G4cout << " ";
ManagedManagers[ifsm]->ListTitle();
G4cout << G4endl;
}
else ManagedManagers[ifsm]->ListModels();
if (theType == ISAPPLICABLE)
{
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
ManagedManagers[ifsm]->ListModels(aName);
return;
}
if(aName == "all")
{
G4int titled = 0;
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
{
if(theType == NAMES_ONLY)
{
if(!(titled++))
G4cout << "Current Envelopes for Fast Simulation:\n";
G4cout << " ";
ManagedManagers[ifsm]->ListTitle();
G4cout << G4endl;
}
else ManagedManagers[ifsm]->ListModels();
}
}
else
{
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
if(aName == ManagedManagers[ifsm]-> GetEnvelope()->GetName())
{
ManagedManagers[ifsm]->ListModels();
break;
}
}
}
else {
for (size_t ifsm=0; ifsm<ManagedManagers.size(); ifsm++)
if(aName == ManagedManagers[ifsm]->
GetEnvelope()->GetName()){
ManagedManagers[ifsm]->ListModels();
break;
}
}
}
void
@@ -222,56 +318,13 @@ G4GlobalFastSimulationManager::ListEnvelopes(const G4ParticleDefinition* aPD)
ManagedManagers[ifsm]->ListModels(aPD);
}
G4VPhysicalVolume*
G4GlobalFastSimulationManager::GiveMeAWorldVolumeClone()
{
G4VPhysicalVolume* theParallelWorldPhysical;
G4TransportationManager *transportationManager=
G4TransportationManager::GetTransportationManager();
G4VSolid *parallelWorldSolid=transportationManager->
GetNavigatorForTracking()->GetWorldVolume()->
GetLogicalVolume()->GetSolid();
G4Material *parallelWorldMaterial=transportationManager->
GetNavigatorForTracking()->GetWorldVolume()->
GetLogicalVolume()->GetMaterial();
G4LogicalVolume *parallelWorldLog =
new G4LogicalVolume(parallelWorldSolid,
parallelWorldMaterial,
"ParallelWorldLogical",
0, 0, 0);
theParallelWorldPhysical= new G4PVPlacement(0,G4ThreeVector(),
"ParallelWorldPhysical",
parallelWorldLog,
0,false,0);
return theParallelWorldPhysical;
}
G4bool
G4GlobalFastSimulationManager::Notify(G4ApplicationState requestedState)
{
G4StateManager * stateManager = G4StateManager::GetStateManager();
if((stateManager->GetPreviousState()==G4State_Idle) &&
(requestedState==G4State_GeomClosed) && (!fClosed) )
{
G4cerr
<< "ERROR - G4GlobalFastSimulationManager::Notify()" << G4endl
<< " 1) you are using ghost volumes;" << G4endl
<< " 2) In this case the G4GlobalFastSimulationManager" << G4endl
<< " MUST be closed BEFORE closing the geometry;" << G4endl
<< " 3) To do this put in your code the call to" << G4endl
<< " GetGlobalFastSimulationManager()->CloseFastSimulation();"
<< G4endl
<< " just before closing the geometry." << G4endl;
G4Exception("G4GlobalFastSimulationManager::Notify()", "InvalidState",
FatalException, "Fast simulation must be closed.");
}
return true;
static int count(0);
if (count++ < 5)
G4cout << "G4GlobalFastSimulationManager::Notify() : DEPRECATING, will be dropped @ next major release" << G4endl;
return _deprecated->Notify(requestedState);
}
G4VFastSimulationModel*
@@ -25,7 +25,7 @@
//
//
// $Id: G4VFastSimulationModel.cc,v 1.6 2006/06/29 21:09:38 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
// GEANT4 tag $Name: geant4-08-02 $
//
//---------------------------------------------------------------
//