Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:32

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 // G4IStore
0027 //
0028 // Class description:
0029 //
0030 // An implementation of an "importance store" with the interface
0031 // G4VIStore. See description in G4VIStore.
0032 // This implementation uses G4GeometryCellImportance as the container
0033 // to store the "cells" together with the importance values.
0034 // Giving a cell the importance 0 is allowed as a flagging that no biasing
0035 // should happen between this cell and its neighbors.
0036 // If a cell is not known by the importance store no biasing should be
0037 // applied between this cell and its nighbors.
0038 
0039 // Author: Michael Dressel (CERN), 2002
0040 // Modified: Alex Howard (CERN), 2013 - Changed class to a 'singleton'
0041 // ----------------------------------------------------------------------
0042 #ifndef G4ISTORE_HH
0043 #define G4ISTORE_HH 1
0044 
0045 #include "G4VIStore.hh"
0046 #include "G4GeometryCellImportance.hh"
0047 #include "G4TransportationManager.hh"
0048 
0049 class G4IStore : public G4VIStore
0050 {
0051   public:
0052 
0053     static G4IStore* GetInstance();
0054       // return ptr to singleton instance of the class.
0055 
0056     static G4IStore* GetInstance(const G4String& ParallelWorldName);
0057       // return ptr to singleton instance of the class.
0058 
0059     G4double GetImportance(const G4GeometryCell& gCell) const override;
0060       // derive an importance value of a "cell" addressed by a
0061       // G4GeometryCell from the store.
0062 
0063     G4bool IsKnown(const G4GeometryCell& gCell) const override;
0064       // returns true if the gCell is in the store, else false 
0065 
0066     void Clear();
0067 
0068     void SetWorldVolume();
0069       // set a reference to the world volume of the "importance" geometry
0070 
0071     void SetParallelWorldVolume(const G4String& paraName);
0072       // set a reference to parallel world volume of the "importance" geometry
0073 
0074     const G4VPhysicalVolume& GetWorldVolume() const override;
0075       // return a reference to the world volume of the "importance" geometry
0076 
0077     virtual const G4VPhysicalVolume* GetParallelWorldVolumePointer() const;
0078       // return a pointer to the world volume of the "importance" geometry
0079 
0080     void AddImportanceGeometryCell(G4double importance,
0081                              const G4GeometryCell &gCell);
0082     void AddImportanceGeometryCell(G4double importance,
0083                              const G4VPhysicalVolume &,
0084                              G4int aRepNum = 0);
0085       // add a "cell" together with a importance value to the store.
0086 
0087     void ChangeImportance(G4double importance, const G4GeometryCell& gCell);
0088     void ChangeImportance(G4double importance, const G4VPhysicalVolume&,
0089                           G4int aRepNum = 0);
0090       // change a importance value of a "cell".
0091 
0092     G4double GetImportance(const G4VPhysicalVolume&, G4int aRepNum = 0) const;
0093   
0094   protected:
0095 
0096     explicit G4IStore();
0097       // initialise the importance store for the given geometry
0098     explicit G4IStore(const G4String& ParallelWorldName);
0099       // initialise the importance store for the given geometry
0100 
0101     ~G4IStore() override;
0102       // destructor
0103 
0104   private:
0105 
0106     G4bool IsInWorld(const G4VPhysicalVolume&) const;
0107     void SetInternalIterator(const G4GeometryCell& gCell) const;
0108     void Error(const G4String& m) const;
0109 
0110   private:
0111  
0112     const G4VPhysicalVolume* fWorldVolume = nullptr;
0113     G4GeometryCellImportance fGeometryCelli;
0114 
0115     mutable G4GeometryCellImportance::const_iterator fCurrentIterator;
0116 
0117     static G4ThreadLocal G4IStore* fInstance;
0118 };
0119 
0120 #endif