Import Geant4 5.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:15:15 +02:00
parent 37fff30d2e
commit fbd4999cf7
4396 changed files with 56662 additions and 52446 deletions
+71 -33
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.45 2002/11/19 17:15:37 gcosmo Exp $
$Id: History,v 1.58 2003/04/07 13:31:49 gcosmo Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,56 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
April 3, 2003 M. Dressel geommng-V05-00-09
- G4LogicalVolume: added method for scanning recursively the volume tree
and retrieve if the current LV is ancestor of a given PV:
G4bool IsAncestor(const G4VPhysicalVolume*) const
March 31, 2003 G. Cosmo geommng-V05-00-08
- Fixed trivial strict pedantic warnings in G4VSolid.cc and G4PVPlacement.cc.
March 24, 2003 G. Cosmo geommng-V05-00-07
- G4Region.cc: fixed setting/resetting of regions in ScanVolumeTree().
March 05, 2003 M. Asai geommng-V05-00-06
- G4Region.cc: fix for scanning of parameterised materials.
March 05, 2003 G. Cosmo geommng-V05-00-05
- G4LogicalVolume.icc: added check for invalid geometry constructions.
Issue an exception if a placement is attempted in a volume already
containing a replicated daughter.
- Cosmetic formatting changes in G4PVPlacement.cc and G4VPhysicalVolume.cc.
February 07, 2003 G. Cosmo geommng-V05-00-04
- Added method FindOrCreateRegion() to G4RegionStore.
- Added check in constructor of G4Region for existance of region in store.
In case a region with the given name already exists, throw a warning and
do not register it.
January 30, 2003 G. Cosmo geommng-V05-00-03
- Allow logical volume store to deregister root regions for logical volumes
deleted explicitely.
Modified files: G4logicalVolumeStore.cc, G4LogicalVolume[.hh.icc.cc].
- G4Region.hh: moved ClearMaterialList() to public.
January 15, 2003 G. Cosmo geommng-V05-00-02
- Included fix in G4VSolid.cc introduced in "geommng-V04-01-06".
January 14, 2003 M.Asai geommng-V05-00-01
- Fix in src/G4Region.cc.
Does not include fix in "geommng-V04-01-06".
December 16, 2002 G. Cosmo geommng-V05-00-00
- Merged branch "geant4-04-01-ref-02-cuts-branch" to HEAD.
Included development for 'cuts-by-region'; introduced new classes
G4Region and G4RegionStore. Modified G4LogicalVolume to handle recursive
propagation of regions to daughters.
Does not include fix in "geommng-V04-01-06".
December 6, 2002 V. Grichine geommng-V04-01-06
- G4VSolid.cc: restored original conditions for extent clipping in
method ClipPolygon(). Makes unit tests run successfully.
November 19, 2002 G. Cosmo geommng-V04-01-05
- G4GeometryManager[.cc]
o Fixed bug in initialisation of fine-grained timer
@@ -235,59 +285,47 @@ September 11, 2000 G.Cosmo geommng-V02-00-00
application exit when Boolean solids are involved (bug #154).
June 06, 2000 G.Cosmo geommng-V01-01-00
- G4DrawVoxels.hh: removed line '#define G4DrawVoxelsDebug' left in place
accidentally in the code...
April 20, 2000 G. Cosmo
- Reorganised comments for the Software Reference Manual.
- Moved inlined definition to .icc files, where needed.
Created: G4SmartVoxelHeader.icc, G4SmartVoxelNode.icc,
G4SmartVoxelProxy.icc, G4VoxelLimits.icc.
April 11, 2000 J. Allison
- Made virtual G4VisExtent G4VSolid::GetExtent() non-pure and implemented
a default in terms of CalculateExtent.
a default in terms of CalculateExtent.
January 19, 00 G. Cosmo geommng-V01-00-00
January 19, 2000 G. Cosmo geommng-V01-00-00
Syncronized file versioning with HEAD (several CVS headers changed
due to the recent migration for ISO C++)
- Syncronized file versioning with HEAD (several CVS headers changed
due to the recent migration for ISO C++)
January 19, 00 J. Allison
January 19, 2000 J. Allison
G4DrawVoxels.cc:
- G4DrawVoxels.cc: assured GetSlice(slice_no) is called for
slice_no < no_slices.
Assured GetSlice(slice_no) is called for slice_no < no_slices.
November 30, 1999 G. Cosmo geommng-V00-01-01a
- G4DrawVoxels.cc:
Fixed initialization of (const G4VPhysicalVolume*) in method
GetAbsoluteTransformation(). Fix needed for NT/VC++ compiler.
November 30, 99 G. Cosmo geommng-V00-01-01a
G4DrawVoxels.cc:
Fixed initialization of (const G4VPhysicalVolume*) in method
GetAbsoluteTransformation(). Fix needed for NT/VC++ compiler.
November 09, 99 J. Apostolakis geommng-V00-01-01
G4VPhysicalVolume:
i) Made G4RotationMatrix G4VPhysicalVolume::GetObjectRotation() const
November 09, 1999 J. Apostolakis geommng-V00-01-01
- G4VPhysicalVolume:
i) Made G4RotationMatrix G4VPhysicalVolume::GetObjectRotation() const
non-inline and moved it to source file from inline file.
ii) Added GetObjectRotationValue() method.
iii) Minimal changes of comments for Software Ref. Manual in header file
ii) Added GetObjectRotationValue() method.
iii) Minimal changes of comments for Software Ref. Manual in header file
[ Change i) caused problem with HP aCC compiler A.01.19. Atlas
was patching the code to try to get around this, but this
resolution is much better ]
March 17, 99 J. Apostolakis geommng-01-00-02
G4AffineTransform.icc:
March 17, 1999 J. Apostolakis geommng-01-00-02
- G4AffineTransform.icc:
Corrected a typo in InverseProduct (rzy->ryz) that caused the incorrect
calculation of a compound transformation (if tf1.tz*tf2.ryz != 0).
[ This problem was seen in the code of two Atlas Geant4 collaborators:
Andrea del' Acqua and Maya Stavrinakou ]
calculation of a compound transformation (if tf1.tz*tf2.ryz != 0).
This problem was seen in ATLAS code.
@@ -22,7 +22,7 @@
//
//
// $Id: G4AffineTransform.hh,v 1.4 2001/07/11 09:59:15 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4AffineTransform
@@ -22,7 +22,7 @@
//
//
// $Id: G4AffineTransform.icc,v 1.6 2002/01/08 12:38:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// G4AffineTransformation Inline implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4AssemblyTriplet.hh,v 1.5 2001/07/11 09:59:16 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// Class G4AssemblyTriplet
@@ -22,7 +22,7 @@
//
//
// $Id: G4AssemblyTriplet.icc,v 1.5 2001/07/11 09:59:16 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// Class G4AssemblyTriplet - inline implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4AssemblyVolume.hh,v 1.8 2002/09/10 16:59:44 radoone Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// Class G4AssemblyVolume
@@ -22,7 +22,7 @@
//
//
// $Id: G4AssemblyVolume.icc,v 1.4 2002/09/10 16:59:46 radoone Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// Class G4AssemblyVolume - inline implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4DrawVoxels.hh,v 1.11 2002/04/19 08:20:16 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4DrawVoxels
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeometryManager.hh,v 1.6 2002/04/26 16:23:34 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4GeometryManager
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4LogicalSurface.hh,v 1.6 2001/07/11 09:59:16 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
////////////////////////////////////////////////////////////////////////
// Class G4LogicalSurface
@@ -22,7 +22,7 @@
//
//
// $Id: G4LogicalSurface.icc,v 1.5 2001/07/11 09:59:16 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
////////////////////////////////////////////////////////////////////////
// Surface Class Inline Methods
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolume.hh,v 1.9 2002/05/17 17:59:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4LogicalVolume.hh,v 1.12 2003/04/03 10:26:53 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4LogicalVolume
@@ -71,8 +71,10 @@
// - Pointer (possibly 0) to user Step limit object for this node.
// G4SmartVoxelHeader* fVoxel
// - Pointer (possibly 0) to optimisation info objects.
// G4bool fOptimise;
// G4bool fOptimise
// - Flag to identify if optimisation should be applied or not.
// G4bool fRootRegion
// - Flag to identify if the logical volume is a root region.
// G4double fSmartless
// - Quality for optimisation, average number of voxels to be spent
// per content.
@@ -80,12 +82,17 @@
// - Pointer (possibly 0) to visualization attributes.
// G4FastSimulationManager* fFastSimulationManager
// - Pointer (possibly 0) to G4FastSimulationManager object.
// G4Region* fRegion
// - Pointer to the cuts region (if any)
// G4MaterialCutsCouple* fCutsCouple
// - Pointer (possibly 0) to associated production cuts.
// G4bool fIsEnvelope
// - Flags if the Logical Volume is an envelope for a FastSimulationManager.
// G4double fBiasWeight
// - Weight used in the event biasing technique.
// History:
// 24.09.02 G.Cosmo: Added flags and accessors for region cuts handling
// 17.05.02 G.Cosmo: Added IsToOptimise() method and related flag
// 18.04.01 G.Cosmo: Migrated to STL vector
// 12.02.99 S.Giani: Added user defined optimisation quality
@@ -101,6 +108,7 @@
#define G4LOGICALVOLUME_HH
#include "globals.hh"
#include "G4Region.hh"
#include "G4VPhysicalVolume.hh" // Need operator == for vector fdaughters
#include "g4std/vector"
#include <assert.h>
@@ -115,6 +123,7 @@ class G4UserLimits;
class G4SmartVoxelHeader;
class G4VisAttributes;
class G4FastSimulationManager;
class G4MaterialCutsCouple;
class G4LogicalVolume
{
@@ -152,8 +161,12 @@ class G4LogicalVolume
inline void AddDaughter(G4VPhysicalVolume* p);
// Add the volume p as a daughter of the current logical volume.
inline G4bool IsDaughter(const G4VPhysicalVolume* p) const;
// Returns true is the volume p is a daughter of the current
// Returns true if the volume p is a daughter of the current
// logical volume.
G4bool IsAncestor(const G4VPhysicalVolume* p) const;
// Returns true if the volume p is part of the hierarchy of
// volumes established by the current logical volume. Scans
// recursively the volume tree.
inline void RemoveDaughter(const G4VPhysicalVolume* p);
// Remove the volume p from the List of daughter of the current
// logical volume.
@@ -200,7 +213,24 @@ class G4LogicalVolume
// volume hierarchy. Note that for parameterised volumes in the
// hierarchy, optimisation is always applied.
G4bool operator == ( const G4LogicalVolume& lv) const;
inline G4bool IsRootRegion() const;
// Replies if the logical volume represents a root region or not.
inline void SetRegionRootFlag(G4bool rreg);
// Sets/unsets the volume as a root region for cuts.
inline G4bool IsRegion() const;
// Replies if the logical volume is part of a cuts region or not.
inline void SetRegion(G4Region* reg);
// Sets/unsets the volume as cuts region.
inline G4Region* GetRegion() const;
// Return the region to which the volume belongs, if any.
inline void PropagateRegion();
// Propagates region pointer to daughters.
inline const G4MaterialCutsCouple* GetMaterialCutsCouple() const;
inline void SetMaterialCutsCouple(G4MaterialCutsCouple* cuts);
// Accessors for production cuts.
G4bool operator == (const G4LogicalVolume& lv) const;
// Equality defined by address only.
// Returns true if objects are at same address, else false.
@@ -260,6 +290,8 @@ class G4LogicalVolume
// Pointer (possibly 0) to optimisation info objects.
G4bool fOptimise;
// Flag to identify if optimisation should be applied or not.
G4bool fRootRegion;
// Flag to identify if the logical volume is a root region.
G4double fSmartless;
// Quality for optimisation, average number of voxels to be spent
// per content.
@@ -267,6 +299,10 @@ class G4LogicalVolume
// Pointer (possibly 0) to visualization attributes.
G4FastSimulationManager* fFastSimulationManager;
// Pointer (possibly 0) to G4FastSimulationManager object.
G4Region* fRegion;
// Pointer to the cuts region (if any)
G4MaterialCutsCouple* fCutsCouple;
// Pointer (possibly 0) to associated production cuts.
G4bool fIsEnvelope;
// Flags if the Logical Volume is an envelope for a
// FastSimulationManager.
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolume.icc,v 1.8 2002/05/17 17:59:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4LogicalVolume.icc,v 1.11 2003/03/05 18:07:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4LogicalVolume Inline Implementation file
@@ -102,6 +102,17 @@ G4FastSimulationManager* G4LogicalVolume::GetFastSimulationManager () const
inline
void G4LogicalVolume::AddDaughter(G4VPhysicalVolume* pNewDaughter)
{
if( !fDaughters.empty() && fDaughters[0]->IsReplicated() )
{
G4cout << "ERROR - Attempt to place a volume in a mother volume" << G4endl
<< " already containing a replicated volume." << G4endl
<< " A volume can either contain several placements" << G4endl
<< " or a unique replica or parameterised volume !" << G4endl
<< " Mother logical volume: " << GetName() << G4endl
<< " Placing volume: " << pNewDaughter->GetName() << G4endl;
G4Exception("G4LogicalVolume::AddDaughter() - Not a valid geometry setup !");
}
fDaughters.push_back(pNewDaughter);
// Propagates the mother's FastSimulationManager pointer. If we are in
@@ -137,6 +148,11 @@ void G4LogicalVolume::AddDaughter(G4VPhysicalVolume* pNewDaughter)
{
pDaughterLogical->SetFieldManager(fFieldManager, true);
}
if (fRegion)
{
PropagateRegion();
fRegion->RegionModified(true);
}
}
// ********************************************************************
@@ -170,6 +186,10 @@ void G4LogicalVolume::RemoveDaughter(const G4VPhysicalVolume* p)
break;
}
}
if (fRegion)
{
fRegion->RegionModified(true);
}
}
// ********************************************************************
@@ -313,6 +333,88 @@ void G4LogicalVolume::SetOptimisation(G4bool optim)
fOptimise = optim;
}
// ********************************************************************
// IsRootRegion
// ********************************************************************
//
inline
G4bool G4LogicalVolume::IsRootRegion() const
{
return fRootRegion;
}
// ********************************************************************
// SetRegionRootFlag
// ********************************************************************
//
inline
void G4LogicalVolume::SetRegionRootFlag(G4bool rreg)
{
fRootRegion = rreg;
}
// ********************************************************************
// IsRegion
// ********************************************************************
//
inline
G4bool G4LogicalVolume::IsRegion() const
{
G4bool reg = false;
if (fRegion) reg = true;
return reg;
}
// ********************************************************************
// SetRegion
// ********************************************************************
//
inline
void G4LogicalVolume::SetRegion(G4Region* reg)
{
fRegion = reg;
}
// ********************************************************************
// GetRegion
// ********************************************************************
//
inline
G4Region* G4LogicalVolume::GetRegion() const
{
return fRegion;
}
// ********************************************************************
// PropagateRegion
// ********************************************************************
//
inline
void G4LogicalVolume::PropagateRegion()
{
fRegion->ScanVolumeTree(this, true);
}
// ********************************************************************
// GetMaterialCutsCouple
// ********************************************************************
//
inline
const G4MaterialCutsCouple* G4LogicalVolume::GetMaterialCutsCouple() const
{
return fCutsCouple;
}
// ********************************************************************
// SetMaterialCutsCouple
// ********************************************************************
//
inline
void G4LogicalVolume::SetMaterialCutsCouple(G4MaterialCutsCouple* cuts)
{
fCutsCouple = cuts;
}
// ********************************************************************
// Operator ==
// ********************************************************************
@@ -22,7 +22,7 @@
//
//
// $Id: G4LogicalVolumeStore.hh,v 1.7 2002/04/19 08:20:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4LogicalVolumeStore
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4PVParameterised.hh,v 1.6 2002/10/14 07:42:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4PVParameterised
@@ -22,7 +22,7 @@
//
//
// $Id: G4PVPlacement.hh,v 1.7 2002/10/14 07:42:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4PVPlacement
@@ -22,7 +22,7 @@
//
//
// $Id: G4PVReplica.hh,v 1.6 2002/10/14 07:42:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4PVReplica
@@ -22,7 +22,7 @@
//
//
// $Id: G4PhysicalVolumeStore.hh,v 1.8 2002/04/19 08:20:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4PhysicalVolume
//
@@ -0,0 +1,125 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Region.hh,v 1.4 2003/01/30 07:58:59 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4Region
//
// Class description:
//
// Defines a region or a group of regions in the detector geometry
// setup, sharing properties associated to materials or production
// cuts which may affect or bias specific physics processes.
//
// Member data:
//
// History:
// 18.09.02 G.Cosmo Initial version
// ********************************************************************
#ifndef G4REGION_HH
#define G4REGION_HH
class G4ProductionCuts;
class G4LogicalVolume;
class G4Material;
#include "g4std/vector"
#include "globals.hh"
class G4Region
{
typedef G4std::vector<G4LogicalVolume*> G4RootLVList;
typedef G4std::vector<G4Material*> G4MaterialList;
public: // with description
G4Region(const G4String& name);
virtual ~G4Region();
inline G4bool operator==(const G4Region& rg) const;
// Equality defined by address only.
void AddRootLogicalVolume(G4LogicalVolume* lv);
void RemoveRootLogicalVolume(G4LogicalVolume* lv);
// Add/remove root logical volumes and set/reset their
// daughters flags as regions. They also recompute the
// materials list for the region.
inline void SetName(const G4String& name);
inline const G4String& GetName() const;
// Set/get region's name.
inline void RegionModified(G4bool flag);
inline G4bool IsModified() const;
// Accessors to flag identifying if a region has been modified
// (and still cuts needs to be computed) or not.
inline void SetProductionCuts(G4ProductionCuts* cut);
inline G4ProductionCuts* GetProductionCuts() const;
inline G4std::vector<G4LogicalVolume*>::iterator
GetRootLogicalVolumeIterator();
inline G4std::vector<G4Material*>::const_iterator
GetMaterialIterator() const;
// Return iterators to lists of root logical volumes and materials.
inline size_t GetNumberOfMaterials() const;
inline size_t GetNumberOfRootVolumes() const;
// Return the number of elements in the lists of materials and
// root logical volumes.
void UpdateMaterialList();
// Clears material list and recomputes it looping through
// each root logical volume in the region.
void ClearMaterialList();
// Clears the material list.
void ScanVolumeTree(G4LogicalVolume* lv, G4bool region);
// Scans recursively the 'lv' logical volume tree, retrieves
// and places all materials in the list if becoming a region.
private:
G4Region(const G4Region&);
G4Region& operator=(const G4Region&);
// Private copy constructor and assignment operator.
private:
G4String fName;
G4RootLVList fRootVolumes;
G4MaterialList fMaterials;
G4bool fRegionMod;
G4ProductionCuts* fCut;
};
#include "G4Region.icc"
#endif
@@ -0,0 +1,146 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Region.icc,v 1.3 2002/12/16 14:03:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4Region Inline Implementation file
//
// 19.09.02 - G.Cosmo: Created
// ********************************************************************
// ********************************************************************
// Equality operator, defined by address only
// ********************************************************************
//
inline
G4bool G4Region::operator==(const G4Region& rg) const
{
return (this==&rg) ? true : false;
}
// ********************************************************************
// GetName
// ********************************************************************
//
inline
const G4String& G4Region::GetName() const
{
return fName;
}
// ********************************************************************
// SetName
// ********************************************************************
//
inline
void G4Region::SetName(const G4String& pName)
{
fName = pName;
}
// ********************************************************************
// RegionModified
// ********************************************************************
//
inline
void G4Region::RegionModified(G4bool flag)
{
fRegionMod = flag;
}
// ********************************************************************
// IsModified
// ********************************************************************
//
inline
G4bool G4Region::IsModified() const
{
return fRegionMod;
}
// ********************************************************************
// SetProductionCuts
// ********************************************************************
//
inline
void G4Region::SetProductionCuts(G4ProductionCuts* cut)
{
fCut = cut;
fRegionMod = true;
}
// ********************************************************************
// GetProductionCuts
// ********************************************************************
//
inline
G4ProductionCuts* G4Region::GetProductionCuts() const
{
return fCut;
}
// ********************************************************************
// GetLogicalVolumeIterator
// ********************************************************************
//
inline
G4std::vector<G4LogicalVolume*>::iterator
G4Region::GetRootLogicalVolumeIterator()
{
G4RootLVList::iterator iterator = G4RootLVList::iterator(fRootVolumes.begin());
return iterator;
}
// ********************************************************************
// GetMaterialIterator
// ********************************************************************
//
inline
G4std::vector<G4Material*>::const_iterator
G4Region::GetMaterialIterator() const
{
G4MaterialList::const_iterator iterator = fMaterials.begin();
return iterator;
}
// ********************************************************************
// GetNumberOfMaterials
// ********************************************************************
//
inline
size_t G4Region::GetNumberOfMaterials() const
{
return fMaterials.size();
}
// ********************************************************************
// GetNumberOfRootVolumes
// ********************************************************************
//
inline
size_t G4Region::GetNumberOfRootVolumes() const
{
return fRootVolumes.size();
}
@@ -0,0 +1,105 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4RegionStore.hh,v 1.3 2003/02/07 11:32:20 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4RegionStore
//
// Class description:
//
// Container for all regiong, with functionality derived from
// std::vector<T>. The class is a `singleton', in that only
// one can exist, and access is provided via the static method
// G4RegionStore::GetInstance().
//
// All regions should be registered with G4RegionStore, and removed on their
// destruction. The underlying container initially has a capacity of 20.
//
// If much additional functionality is added, should consider containment
// instead of inheritance for std::vector<T>
//
// Member data:
//
// static G4RegionStore*
// - Pointer to the single G4RegionStore
// History:
// 18.09.02 G.Cosmo Initial version
// ********************************************************************
#ifndef G4REGIONSTORE_HH
#define G4REGIONSTORE_HH
class G4Region;
#include "g4std/vector"
#include "globals.hh"
class G4RegionStore : public G4std::vector<G4Region*>
{
public: // with description
static void Register(G4Region* pSolid);
// Add the region to the collection.
static void DeRegister(G4Region* pSolid);
// Remove the region from the collection.
static G4RegionStore* GetInstance();
// Get a ptr to the unique G4RegionStore, creating it if necessary.
static void Clean();
// Delete all regions from the store.
G4bool IsModified() const;
// Loops through all regions to verify if a region has been
// modified. It returns TRUE if just one region is modified.
void ResetRegionModified();
// Loops through all regions to reset flag for modification
// to FALSE. Used by the run manager to notify that the
// physics table has been updated.
void UpdateMaterialList();
// Forces recomputation of material lists in all regions
// in the store.
G4Region* GetRegion(const G4String& name, G4bool verbose=true) const;
// Returns a region through its name specification.
G4Region* FindOrCreateRegion(const G4String& name);
// Returns a region through its name specification, if it exists.
// If it does not exist it will allocate one delegating ownership
// to the client.
virtual ~G4RegionStore();
// Destructor: takes care to delete allocated regions.
protected:
G4RegionStore();
private:
static G4RegionStore* fgInstance;
static G4bool locked;
};
#endif
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelHeader.hh,v 1.7 2002/05/15 10:06:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4SmartVoxelHeader
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelHeader.icc,v 1.4 2002/05/15 10:06:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// G4SmartVoxelHeader Inline implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelNode.hh,v 1.7 2002/04/19 08:20:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4SmartVoxelNode
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelNode.icc,v 1.3 2001/07/11 09:59:18 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// G4SmartVoxelNode Inline implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelProxy.hh,v 1.6 2002/04/19 08:20:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4SmartVoxelProxy
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelProxy.icc,v 1.2 2001/07/11 09:59:18 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// G4SmartVoxelProxy Inline implementation
@@ -21,7 +21,7 @@
// ********************************************************************
//
// $Id: G4SmartVoxelStat.hh,v 1.1 2001/10/22 16:08:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// --------------------------------------------------------------------
// GEANT 4 class header file
@@ -22,7 +22,7 @@
//
//
// $Id: G4SolidStore.hh,v 1.7 2002/04/19 08:20:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4SolidStore
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4TouchableHandle.hh,v 1.5 2001/11/06 17:06:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// Class G4TouchableHandle
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4VPVParameterisation.hh,v 1.4 2001/07/11 09:59:18 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4VPVParamterisation
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4VPhysicalVolume.hh,v 1.7 2002/10/14 07:42:25 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4VPhysicalVolume
@@ -22,7 +22,7 @@
//
//
// $Id: G4VPhysicalVolume.icc,v 1.5 2001/07/11 09:59:18 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4VPhysicalVolume Inline Implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4VSolid.hh,v 1.11 2002/10/28 11:25:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4VSolid
@@ -22,7 +22,7 @@
//
//
// $Id: G4VSolid.icc,v 1.6 2002/10/28 11:25:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// G4VSolid Inline implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4VTouchable.hh,v 1.5 2001/07/11 09:59:19 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4VTouchable
@@ -22,7 +22,7 @@
//
//
// $Id: G4VTouchable.icc,v 1.5 2001/07/11 09:59:19 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4VTouchable Inline implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4VoxelLimits.hh,v 1.6 2002/04/19 08:20:18 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4VoxelLimits
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4VoxelLimits.icc,v 1.2 2001/07/11 09:59:19 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// G4VoxelLimits Inline implementation
@@ -22,7 +22,7 @@
//
//
// $Id: meshdefs.hh,v 1.4 2001/07/11 09:59:19 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// Tube/Cone Meshing constants for extent calculations
@@ -22,7 +22,7 @@
//
//
// $Id: voxeldefs.hh,v 1.5 2001/07/11 09:59:19 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4AssemblyVolume.cc,v 1.13 2002/09/10 17:07:15 radoone Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// Class G4AssemblyVolume - implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4DrawVoxels.cc,v 1.15 2002/04/19 08:20:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4DrawVoxels
@@ -22,7 +22,7 @@
//
//
// $Id: G4GeometryManager.cc,v 1.12 2002/11/19 17:15:20 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4GeometryManager
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolume.cc,v 1.11 2002/11/08 22:45:25 japost Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4LogicalVolume.cc,v 1.15 2003/04/03 10:26:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4LogicalVolume Implementation
@@ -52,8 +52,9 @@ G4LogicalVolume::G4LogicalVolume( G4VSolid* pSolid,
G4UserLimits* pULimits,
G4bool optimise )
: fDaughters(0,(G4VPhysicalVolume*)0), fFieldManager(pFieldMgr),
fVoxel(0), fOptimise(optimise), fSmartless(2.), fVisAttributes (0),
fFastSimulationManager (0), fIsEnvelope(false)
fVoxel(0), fOptimise(optimise), fRootRegion(false), fSmartless(2.),
fVisAttributes(0), fFastSimulationManager(0), fRegion(0),
fCutsCouple(0), fIsEnvelope(false)
{
SetSolid(pSolid);
SetMaterial(pMaterial);
@@ -176,6 +177,30 @@ G4LogicalVolume::SetFieldManager(G4FieldManager* pNewFieldMgr,
}
// ********************************************************************
// IsAncestor
//
// Finds out if the current logical volume is an ancestor of a given
// physical volume
// ********************************************************************
//
G4bool
G4LogicalVolume::IsAncestor(const G4VPhysicalVolume* aVolume) const
{
G4bool isDaughter = IsDaughter(aVolume);
if (!isDaughter)
{
for (G4PhysicalVolumeList::const_iterator itDau = fDaughters.begin();
itDau != fDaughters.end(); itDau++)
{
isDaughter = (*itDau)->GetLogicalVolume()->IsAncestor(aVolume);
if (isDaughter) break;
}
}
return isDaughter;
}
// ********************************************************************
// FindMotherLogicalVolumeForEnvelope
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LogicalVolumeStore.cc,v 1.8 2002/04/26 16:24:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4LogicalVolumeStore.cc,v 1.9 2003/01/30 07:57:32 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
// G4LogicalVolumeStore
//
@@ -128,6 +128,8 @@ void G4LogicalVolumeStore::DeRegister(G4LogicalVolume* pVolume)
{
if (**i==*pVolume)
{
if (pVolume->IsRootRegion())
pVolume->GetRegion()->RemoveRootLogicalVolume(pVolume);
GetInstance()->erase(i);
break;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4PVParameterised.cc,v 1.7 2002/10/23 16:11:11 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4PVParameterised
+66 -73
View File
@@ -21,72 +21,66 @@
// ********************************************************************
//
//
// $Id: G4PVPlacement.cc,v 1.5 2002/10/14 07:42:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4PVPlacement.cc,v 1.7 2003/03/31 14:18:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4PVPlacement Implementation
#include "G4PVPlacement.hh"
// #include "G4Transform3D.hh"
#include "G4LogicalVolume.hh"
G4PVPlacement::G4PVPlacement(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String& pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo) :
G4VPhysicalVolume(pRot,tlate,pName,pLogical,pMother),
fmany(pMany), fallocatedRotM(false), fcopyNo(pCopyNo)
G4PVPlacement::G4PVPlacement( G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String& pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo )
: G4VPhysicalVolume(pRot,tlate,pName,pLogical,pMother),
fmany(pMany), fallocatedRotM(false), fcopyNo(pCopyNo)
{
}
G4PVPlacement::G4PVPlacement(const G4Transform3D &Transform3D,
const G4String& pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo) :
G4VPhysicalVolume( NewPtrRotMatrix(Transform3D.getRotation().inverse()),
Transform3D.getTranslation(),
pName,pLogical,pMother),
fmany(pMany), fcopyNo(pCopyNo)
G4PVPlacement::G4PVPlacement( const G4Transform3D &Transform3D,
const G4String& pName,
G4LogicalVolume *pLogical,
G4VPhysicalVolume *pMother,
G4bool pMany,
G4int pCopyNo)
: G4VPhysicalVolume(NewPtrRotMatrix(Transform3D.getRotation().inverse()),
Transform3D.getTranslation(),pName,pLogical,pMother),
fmany(pMany), fcopyNo(pCopyNo)
{
fallocatedRotM= (this->GetRotation() != 0);
}
//
// The logical volume of the mother is utilised (not the physical)
// [ The physical volume is needed, known and set only at tracking time. ]
// The logical volume of the mother is utilised (not the physical)
// The physical volume is needed, known and set only at tracking time.
//
G4PVPlacement::G4PVPlacement(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pCurrentLogical,
const G4String& pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo) :
G4VPhysicalVolume(pRot,tlate,pName,pCurrentLogical,0),
fmany(pMany), fallocatedRotM(false), fcopyNo(pCopyNo)
G4PVPlacement::G4PVPlacement( G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pCurrentLogical,
const G4String& pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo)
: G4VPhysicalVolume(pRot,tlate,pName,pCurrentLogical,0),
fmany(pMany), fallocatedRotM(false), fcopyNo(pCopyNo)
{
if (pMotherLogical) pMotherLogical->AddDaughter(this);
}
G4PVPlacement::G4PVPlacement( const G4Transform3D &Transform3D,
G4LogicalVolume *pCurrentLogical,
const G4String& pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo):
G4VPhysicalVolume( 0,
Transform3D.getTranslation(),
pName,
pCurrentLogical,
0),
G4LogicalVolume *pCurrentLogical,
const G4String& pName,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo)
: G4VPhysicalVolume(0,Transform3D.getTranslation(),pName,pCurrentLogical,0),
fmany(pMany), fcopyNo(pCopyNo)
{
this->SetRotation( NewPtrRotMatrix(Transform3D.getRotation().inverse()) );
@@ -95,8 +89,6 @@ G4PVPlacement::G4PVPlacement( const G4Transform3D &Transform3D,
if (pMotherLogical) pMotherLogical->AddDaughter(this);
}
G4PVPlacement::~G4PVPlacement()
{
if( fallocatedRotM ){ delete frot; }
@@ -104,68 +96,69 @@ G4PVPlacement::~G4PVPlacement()
G4bool G4PVPlacement::IsMany() const
{
return fmany;
return fmany;
}
G4int G4PVPlacement::GetCopyNo() const
{
return fcopyNo;
return fcopyNo;
}
void G4PVPlacement::SetCopyNo(G4int newCopyNo)
void G4PVPlacement::SetCopyNo(G4int newCopyNo)
{
fcopyNo= newCopyNo;
fcopyNo= newCopyNo;
}
G4bool G4PVPlacement::IsReplicated() const
{
return false;
return false;
}
G4bool G4PVPlacement::IsParameterised() const
{
return false;
return false;
}
G4VPVParameterisation* G4PVPlacement::GetParameterisation() const
{
return 0;
return 0;
}
void G4PVPlacement::GetReplicationData(EAxis& axis,
G4int& nReplicas,
G4double& width,
G4double& offset,
G4bool& consuming) const
void G4PVPlacement::GetReplicationData( EAxis&,
G4int&,
G4double&,
G4double&,
G4bool& ) const
{
// No-operations
// No-operations
}
void G4PVPlacement::Setup(G4VPhysicalVolume *pMother)
{
SetMother(pMother);
SetMother(pMother);
}
//
// Auxiliary function for 2nd & 4th constructors (the ones with G4Transform3D)
// Creates a new RotMatrix on the heap (using "new") and copies
// its argument into it.
// Creates a new RotMatrix on the heap (using "new") and copies
// its argument into it.
//
// No entity is currently responsible to delete this memory.
// This is a memory leak. <-- FIXME
// No entity is currently responsible to delete this memory.
// This is a memory leak. <-- FIXME
//
G4RotationMatrix* G4PVPlacement::NewPtrRotMatrix(const G4RotationMatrix &RotMat)
{
G4RotationMatrix *pRotMatrix;
if ( RotMat.isIdentity() )
pRotMatrix= 0;
else{
pRotMatrix= new G4RotationMatrix(RotMat);
}
// fallocatedRotM= ! (RotMat.isIdentity());
G4RotationMatrix *pRotMatrix;
if ( RotMat.isIdentity() )
{
pRotMatrix= 0;
}
else
{
pRotMatrix= new G4RotationMatrix(RotMat);
}
// fallocatedRotM= ! (RotMat.isIdentity());
return pRotMatrix;
return pRotMatrix;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4PVReplica.cc,v 1.9 2002/10/23 16:26:49 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4PVReplica Implementation
@@ -22,7 +22,7 @@
//
//
// $Id: G4PhysicalVolumeStore.cc,v 1.9 2002/04/26 16:24:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// G4PhysicalVolumeStore
//
+233
View File
@@ -0,0 +1,233 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4Region.cc,v 1.7 2003/03/24 10:17:54 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4Region Implementation
#include "G4RegionStore.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Region.hh"
#include "G4VPVParameterisation.hh"
// *******************************************************************
// Constructor:
// - Adds self to region Store
// *******************************************************************
//
G4Region::G4Region(const G4String& pName)
: fName(pName), fRegionMod(true), fCut(0)
{
G4RegionStore* rStore = G4RegionStore::GetInstance();
if (rStore->GetRegion(pName,false))
{
G4cerr << "WARNING - G4Region::G4Region()" << G4endl
<< " Region " << pName << " already existing in store !"
<< G4endl
<< " The region has NOT been registered !" << G4endl;
}
else
{
rStore->Register(this);
}
}
// *******************************************************************
// Destructor:
// - Removes self from region Store
// *******************************************************************
//
G4Region::~G4Region()
{
G4RegionStore::GetInstance()->DeRegister(this);
}
// *******************************************************************
// ScanVolumeTree:
// - Scans recursively the 'lv' logical volume tree, retrieves
// and places all materials in the list.
// - The boolean flag 'region' identifies if the volume tree must
// have region reset (false) or if the current region must be
// associated to the logical volume 'lv' and its tree (true).
// *******************************************************************
//
void G4Region::ScanVolumeTree(G4LogicalVolume* lv, G4bool region)
{
// If logical volume is going to become a region, add
// its material to the list if not already present
//
G4Region* currentRegion = 0;
size_t noDaughters = lv->GetNoDaughters();
G4Material* volMat = lv->GetMaterial();
G4MaterialList::iterator pos;
if (region)
{
currentRegion = this;
pos = G4std::find(fMaterials.begin(),fMaterials.end(),volMat);
if (pos == fMaterials.end())
{
fMaterials.push_back(volMat);
fRegionMod = true;
}
}
// Set the LV region to be either the current region or NULL,
// according to the boolean selector
//
lv->SetRegion(currentRegion);
// Stop recursion here if no further daughters are involved
//
if(noDaughters==0) return;
G4VPhysicalVolume* daughterPVol = lv->GetDaughter(0);
if (daughterPVol->IsParameterised())
{
// Adopt special treatment in case of parameterised volumes,
// where parameterisation involves a new material scan
//
G4VPVParameterisation* pParam = daughterPVol->GetParameterisation();
size_t repNo = daughterPVol->GetMultiplicity();
for (register size_t rep=0; rep<repNo; rep++)
{
volMat = pParam->ComputeMaterial(rep, daughterPVol);
pos = G4std::find(fMaterials.begin(),fMaterials.end(),volMat);
if (pos == fMaterials.end())
{
fMaterials.push_back(volMat);
fRegionMod = true;
}
}
G4LogicalVolume* daughterLVol = daughterPVol->GetLogicalVolume();
ScanVolumeTree(daughterLVol, region);
}
else
{
for (register size_t i=0; i<noDaughters; i++)
{
G4LogicalVolume* daughterLVol = lv->GetDaughter(i)->GetLogicalVolume();
if (!daughterLVol->IsRootRegion())
{
// Set daughter's LV to be a region and store materials in
// the materials list, if the LV is not already a root region
//
ScanVolumeTree(daughterLVol, region);
}
}
}
}
// *******************************************************************
// AddRootLogicalVolume:
// - Adds a root logical volume and sets its daughters flags as
// regions. It also recomputes the materials list for the region.
// *******************************************************************
//
void G4Region::AddRootLogicalVolume(G4LogicalVolume* lv)
{
// Check the logical volume is not already in the list
//
G4RootLVList::iterator pos;
pos = G4std::find(fRootVolumes.begin(),fRootVolumes.end(),lv);
if (pos == fRootVolumes.end())
{
// Insert the root volume in the list and set it as root region
//
fRootVolumes.push_back(lv);
lv->SetRegionRootFlag(true);
}
// Scan recursively the tree of daugther volumes and set regions
//
ScanVolumeTree(lv, true);
// Set region as modified
//
fRegionMod = true;
}
// *******************************************************************
// RemoveRootLogicalVolume:
// - Removes a root logical volume and resets its daughters flags as
// regions. It also recomputes the materials list for the region.
// *******************************************************************
//
void G4Region::RemoveRootLogicalVolume(G4LogicalVolume* lv)
{
// Find and remove logical volume from the list
//
G4RootLVList::iterator pos;
pos = G4std::find(fRootVolumes.begin(),fRootVolumes.end(),lv);
if (pos != fRootVolumes.end())
{
fRootVolumes.erase(pos);
lv->SetRegionRootFlag(false);
}
// Scan recursively the tree of daugther volumes and reset regions
//
ScanVolumeTree(lv, false);
// Update the materials list
//
UpdateMaterialList();
// Set region as modified
//
fRegionMod = true;
}
// *******************************************************************
// ClearMaterialList:
// - Clears the material list.
// *******************************************************************
//
void G4Region::ClearMaterialList()
{
fMaterials.clear();
}
// *******************************************************************
// UpdateMaterialList:
// - computes material list looping through
// each root logical volume in the region.
// *******************************************************************
//
void G4Region::UpdateMaterialList()
{
// Reset the materials list
//
ClearMaterialList();
// Loop over the root logical volumes and rebuild the list
// of materials from scratch
//
G4RootLVList::iterator pLV;
for (pLV=fRootVolumes.begin(); pLV!=fRootVolumes.end(); pLV++)
{
ScanVolumeTree(*pLV, true);
}
}
@@ -0,0 +1,225 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4RegionStore.cc,v 1.4 2003/02/07 11:46:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
// G4RegionStore
//
// Implementation for singleton container
//
// History:
// 18.09.02 G.Cosmo Initial version
// ********************************************************************
#include "G4Region.hh"
#include "G4RegionStore.hh"
#include "G4GeometryManager.hh"
// ***************************************************************************
// Static class variables
// ***************************************************************************
//
G4RegionStore* G4RegionStore::fgInstance = 0;
G4bool G4RegionStore::locked = false;
// ***************************************************************************
// Protected constructor: Construct underlying container with
// initial size of 20 entries
// ***************************************************************************
//
G4RegionStore::G4RegionStore()
: G4std::vector<G4Region*>()
{
reserve(20);
}
// ***************************************************************************
// Destructor
// ***************************************************************************
//
G4RegionStore::~G4RegionStore()
{
Clean();
}
// ***************************************************************************
// Delete all elements from the store
// ***************************************************************************
//
void G4RegionStore::Clean()
{
// Do nothing if geometry is closed
//
if (G4GeometryManager::GetInstance()->IsGeometryClosed())
{
G4cout << "WARNING - Attempt to delete the region store"
<< " while geometry closed !" << G4endl;
return;
}
// Locks store for deletion of regions. De-registration will be
// performed at this stage. G4Regions will not de-register themselves.
//
locked = true;
size_t i=0;
G4RegionStore* store = GetInstance();
G4std::vector<G4Region*>::iterator pos;
#ifdef G4GEOMETRY_VOXELDEBUG
G4cout << "Deleting Solids ... ";
#endif
for(pos=store->begin(); pos!=store->end(); pos++)
{
if (*pos) delete *pos; i++;
}
#ifdef G4GEOMETRY_VOXELDEBUG
if (store->size() < i-1)
{ G4cout << "No regions deleted. Already deleted by user ?" << G4endl; }
else
{ G4cout << i-1 << " regions deleted !" << G4endl; }
#endif
locked = false;
store->clear();
}
// ***************************************************************************
// Add Solid to container
// ***************************************************************************
//
void G4RegionStore::Register(G4Region* pRegion)
{
GetInstance()->push_back(pRegion);
}
// ***************************************************************************
// Remove Solid from container
// ***************************************************************************
//
void G4RegionStore::DeRegister(G4Region* pRegion)
{
if (!locked) // Do not de-register if locked !
{
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
if (**i==*pRegion)
{
GetInstance()->erase(i);
break;
}
}
}
}
// ***************************************************************************
// Return ptr to Store, setting if necessary
// ***************************************************************************
//
G4RegionStore* G4RegionStore::GetInstance()
{
static G4RegionStore worldStore;
if (!fgInstance)
{
fgInstance = &worldStore;
}
return fgInstance;
}
// ***************************************************************************
// Loops through all regions to verify if a region has been modified.
// It returns TRUE if just one region is modified.
// ***************************************************************************
//
G4bool G4RegionStore::IsModified() const
{
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
if ((*i)->IsModified()) return true;
}
return false;
}
// ***************************************************************************
// Loops through all regions to reset flag for modification to FALSE.
// Used by the run manager to notify that the physics table has been updated.
// ***************************************************************************
//
void G4RegionStore::ResetRegionModified()
{
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
(*i)->RegionModified(false);
}
}
// ***************************************************************************
// Forces recomputation of material lists in all regions in the store.
// ***************************************************************************
//
void G4RegionStore::UpdateMaterialList()
{
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
(*i)->UpdateMaterialList();
}
}
// ***************************************************************************
// Returns a region through its name specification.
// ***************************************************************************
//
G4Region* G4RegionStore::GetRegion(const G4String& name, G4bool verbose) const
{
for (iterator i=GetInstance()->begin(); i!=GetInstance()->end(); i++)
{
if ((*i)->GetName() == name)
return *i;
}
if (verbose)
{
G4cerr << "ERROR - G4RegionStore::GetRegion()" << G4endl
<< " Region " << name << " NOT found in store !" << G4endl;
}
return 0;
}
// ***************************************************************************
// Returns a region through its name specification, if it exists.
// If it does not exist it will allocate a new region with the given
// name, delegating the ownership to the caller client.
// ***************************************************************************
//
G4Region* G4RegionStore::FindOrCreateRegion(const G4String& name)
{
G4Region* target = GetRegion(name,false);
if (!target)
{
target = new G4Region(name);
}
return target;
}
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelHeader.cc,v 1.20 2002/05/17 17:59:47 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4SmartVoxelHeader
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelNode.cc,v 1.4 2002/04/19 08:20:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// Class G4SmartVoxelNode
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelProxy.cc,v 1.1 2002/04/19 08:20:22 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// Class G4SmartVoxelProxy
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4SmartVoxelStat.cc,v 1.1 2001/10/22 16:08:05 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// --------------------------------------------------------------------
// GEANT 4 class source file
@@ -22,7 +22,7 @@
//
//
// $Id: G4SolidStore.cc,v 1.9 2002/04/26 16:24:36 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// G4SolidStore
//
@@ -22,7 +22,7 @@
//
//
// $Id: G4VPVParameterisation.cc,v 1.3 2001/07/11 09:59:21 gunter Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// Default implementations for Parameterisations that do not
// parameterise solid and/or material
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VPhysicalVolume.cc,v 1.5 2002/10/14 07:42:26 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4VPhysicalVolume.cc,v 1.6 2003/03/05 18:06:58 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
//
// class G4VPhysicalVolume Implementation
@@ -36,25 +36,27 @@
#include "G4LogicalVolume.hh"
// Constructor: init parameters and register in Store
G4VPhysicalVolume::G4VPhysicalVolume(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMother)
//
G4VPhysicalVolume::G4VPhysicalVolume( G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
const G4String& pName,
G4LogicalVolume* pLogical,
G4VPhysicalVolume* pMother)
{
ftrans=tlate;
frot=pRot;
SetName(pName);
SetLogicalVolume(pLogical);
SetMother(pMother);
if (pMother) pMother->GetLogicalVolume()->AddDaughter(this);
G4PhysicalVolumeStore::Register(this);
ftrans=tlate;
frot=pRot;
SetName(pName);
SetLogicalVolume(pLogical);
SetMother(pMother);
if (pMother) pMother->GetLogicalVolume()->AddDaughter(this);
G4PhysicalVolumeStore::Register(this);
}
// Destructor - remove from Store
//
G4VPhysicalVolume::~G4VPhysicalVolume()
{
G4PhysicalVolumeStore::DeRegister(this);
G4PhysicalVolumeStore::DeRegister(this);
}
G4int G4VPhysicalVolume::GetMultiplicity() const
+39 -32
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VSolid.cc,v 1.14 2002/10/28 11:25:37 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// $Id: G4VSolid.cc,v 1.17 2003/03/31 14:18:51 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4VSolid
//
@@ -30,15 +30,14 @@
//
// History:
//
// 10.05.02 V.Grichine, bug fixed in ClipPoligon: clip only other axis and limited
// voxels
// 15.04.02 V.Grichine, bug fixed in ClipPoligon: clip only one axis
// 06.12.02 V.Grichine, restored original conditions in ClipPolygon()
// 10.05.02 V.Grichine, ClipPolygon(): clip only other axis and limited voxels
// 15.04.02 V.Grichine, bug fixed in ClipPolygon(): clip only one axis
// 13.03.02 V.Grichine, cosmetics of voxel limit functions
// 15.11.00 D.Williams, V.Grichine change in CalculateClippedPolygonExtent:
// else if(component>pMax) ---> if
// 15.11.00 D.Williams, V.Grichine fix in CalculateClippedPolygonExtent()
// 10.07.95 P.Kent Added == operator, solid Store entry
// 30.06.95 P.Kent
//
// 30.06.95 P.Kent Created.
//
#include "G4VSolid.hh"
#include "G4SolidStore.hh"
@@ -52,6 +51,7 @@
// Constructor
// - Copies name
// - Add ourselves to solid Store
G4VSolid::G4VSolid(const G4String& name)
: fshapeName(name)
{
@@ -62,6 +62,7 @@ G4VSolid::G4VSolid(const G4String& name)
//
// Destructor (virtual)
// - Remove ourselves from solid Store
G4VSolid::~G4VSolid()
{
G4SolidStore::GetInstance()->DeRegister(this);
@@ -70,6 +71,7 @@ G4VSolid::~G4VSolid()
//////////////////////////////////////////////////////////////////////////
//
// Streaming operator dumping solid contents
G4std::ostream& operator<< ( G4std::ostream& os, const G4VSolid& e )
{
return e.StreamInfo(os);
@@ -79,11 +81,15 @@ G4std::ostream& operator<< ( G4std::ostream& os, const G4VSolid& e )
//
// Throw exception if ComputeDimensions called for illegal derived class
void G4VSolid::ComputeDimensions(G4VPVParameterisation* p,
const G4int n,
const G4VPhysicalVolume* pRep)
void G4VSolid::ComputeDimensions(G4VPVParameterisation*,
const G4int,
const G4VPhysicalVolume*)
{
G4Exception("G4VSolid::ComputeDimensions called illegally: not overloaded by derived class");
G4cout << "ERROR - Illegal call to G4VSolid::ComputeDimensions()" << G4endl
<< " Method not overloaded by derived class !" << G4endl;
G4cerr << "ERROR - Illegal call to G4VSolid::ComputeDimensions()" << G4endl
<< " Method not overloaded by derived class !" << G4endl;
G4Exception("G4VSolid::ComputeDimensions() - Illegal call");
}
///////////////////////////////////////////////////////////////////////////
@@ -243,13 +249,13 @@ void G4VSolid::CalculateClippedPolygonExtent(G4ThreeVectorList& pPolygon,
void G4VSolid::ClipPolygon( G4ThreeVectorList& pPolygon,
const G4VoxelLimits& pVoxelLimit,
const EAxis pAxis ) const
const EAxis ) const
{
G4ThreeVectorList outputPolygon;
if ( pVoxelLimit.IsLimited() )
{
if (pVoxelLimit.IsXLimited() && pAxis != kXAxis)
if (pVoxelLimit.IsXLimited() ) // && pAxis != kXAxis)
{
G4VoxelLimits simpleLimit1;
simpleLimit1.AddLimit(kXAxis,pVoxelLimit.GetMinXExtent(),kInfinity);
@@ -268,14 +274,14 @@ void G4VSolid::ClipPolygon( G4ThreeVectorList& pPolygon,
if ( !pPolygon.size() ) return;
else outputPolygon.clear();
}
if ( pVoxelLimit.IsYLimited() && pAxis != kYAxis)
if ( pVoxelLimit.IsYLimited() ) // && pAxis != kYAxis)
{
G4VoxelLimits simpleLimit1;
simpleLimit1.AddLimit(kYAxis,pVoxelLimit.GetMinYExtent(),kInfinity);
ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
// Must always clear pPolygon - for clip to simpleLimit2 and in case of
// early exit
// Must always clear pPolygon - for clip to simpleLimit2 and in case of
// early exit
pPolygon.clear();
@@ -288,14 +294,14 @@ void G4VSolid::ClipPolygon( G4ThreeVectorList& pPolygon,
if ( !pPolygon.size() ) return;
else outputPolygon.clear();
}
if ( pVoxelLimit.IsZLimited() && pAxis != kZAxis)
if ( pVoxelLimit.IsZLimited() ) // && pAxis != kZAxis)
{
G4VoxelLimits simpleLimit1;
simpleLimit1.AddLimit(kZAxis,pVoxelLimit.GetMinZExtent(),kInfinity);
ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
// Must always clear pPolygon - for clip to simpleLimit2 and in case of
// early exit
// Must always clear pPolygon - for clip to simpleLimit2 and in case of
// early exit
pPolygon.clear();
@@ -305,7 +311,7 @@ void G4VSolid::ClipPolygon( G4ThreeVectorList& pPolygon,
simpleLimit2.AddLimit(kZAxis,-kInfinity,pVoxelLimit.GetMaxZExtent());
ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
// Return after final clip - no cleanup
// Return after final clip - no cleanup
}
}
}
@@ -326,7 +332,7 @@ void G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
for (i = 0 ; i < noVertices ; i++ )
{
vStart = pPolygon[i];
// G4cout<<"i = "<<i<<G4endl;
// G4cout << "i = " << i << G4endl;
if ( i == noVertices-1 ) vEnd = pPolygon[0];
else vEnd = pPolygon[i+1];
@@ -334,14 +340,15 @@ void G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
{
if (pVoxelLimit.Inside(vEnd))
{
// vStart and vEnd inside -> output end point
// vStart and vEnd inside -> output end point
//
outputPolygon.push_back(vEnd);
}
else
{
// vStart inside, vEnd outside -> output crossing point
// G4cout<<"vStart inside, vEnd outside"<<G4endl;
// vStart inside, vEnd outside -> output crossing point
//
// G4cout << "vStart inside, vEnd outside" << G4endl;
pVoxelLimit.ClipToLimits(vStart,vEnd);
outputPolygon.push_back(vEnd);
}
@@ -350,9 +357,9 @@ void G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
{
if (pVoxelLimit.Inside(vEnd))
{
// vStart outside, vEnd inside -> output inside section
// G4cout<<"vStart outside, vEnd inside"<<G4endl;
// vStart outside, vEnd inside -> output inside section
//
// G4cout << "vStart outside, vEnd inside" << G4endl;
pVoxelLimit.ClipToLimits(vStart,vEnd);
outputPolygon.push_back(vStart);
outputPolygon.push_back(vEnd);
@@ -366,10 +373,10 @@ void G4VSolid::ClipPolygonToSimpleLimits( G4ThreeVectorList& pPolygon,
}
}
const G4VSolid* G4VSolid::GetConstituentSolid(G4int no) const
const G4VSolid* G4VSolid::GetConstituentSolid(G4int) const
{ return 0; }
G4VSolid* G4VSolid::GetConstituentSolid(G4int no)
G4VSolid* G4VSolid::GetConstituentSolid(G4int)
{ return 0; }
const G4DisplacedSolid* G4VSolid::GetDisplacedSolidPtr() const
@@ -22,7 +22,7 @@
//
//
// $Id: G4VoxelLimits.cc,v 1.7 2002/04/19 08:20:23 gcosmo Exp $
// GEANT4 tag $Name: geant4-05-00 $
// GEANT4 tag $Name: geant4-05-01 $
//
// class G4VoxelLimits
//