Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:59:28

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 // G4WeightWindowStore
0027 //
0028 // Class description:
0029 //
0030 // Implementation of a weight window store according to the
0031 // G4VWeightWindowStore interface.
0032 // See also G4VWeightWindowStore.
0033 
0034 // Author: Michael Dressel (CERN), 2003
0035 // Modified: Alex Howard (CERN), 2013 - Changed class to a 'singleton'
0036 // ----------------------------------------------------------------------
0037 #ifndef G4WEIGHTWINDOWSTORE_HH
0038 #define G4WEIGHTWINDOWSTORE_HH 1
0039 
0040 #include "G4VWeightWindowStore.hh"
0041 #include "G4GeometryCellWeight.hh"
0042 #include <set>
0043 #include <vector>
0044 
0045 class G4WeightWindowStore: public G4VWeightWindowStore
0046 {
0047   public:  // with description
0048 
0049     static G4WeightWindowStore* GetInstance();
0050       // return ptr to singleton instance of the class
0051 
0052     static G4WeightWindowStore* GetInstance(const G4String& ParallelWorldName);
0053       // return ptr to singleton instance of the class
0054 
0055     G4double GetLowerWeight(const G4GeometryCell& gCell, 
0056                                           G4double partEnergy) const override;
0057       // derive a lower weight bound value of a "cell" addressed by a 
0058       // G4GeometryCell and the corresponding energy from the store
0059 
0060     G4bool IsKnown(const G4GeometryCell &gCell) const override;
0061       // returns true if the gCell is in the store, else false 
0062 
0063     void Clear();
0064 
0065     void SetWorldVolume();
0066       // set a pointer to the world volume of the weightwindow geometry
0067     void SetParallelWorldVolume(const G4String& paraName);
0068       // set a pointer to parallel world volume of the weightwindow geometry
0069 
0070     const G4VPhysicalVolume& GetWorldVolume() const override;
0071       // return a reference to the world volume of the weightwindow geometry
0072     virtual const G4VPhysicalVolume* GetParallelWorldVolumePointer() const;
0073       // return a pointer to parallel world volume of the weightwindow geometry
0074 
0075     void AddLowerWeights(const G4GeometryCell& gCell,
0076                          const std::vector<G4double>& lowerWeights);
0077       // add lower weights. Only if general upper energy bounds have been set
0078 
0079     void AddUpperEboundLowerWeightPairs(const G4GeometryCell& gCell,
0080                                   const G4UpperEnergyToLowerWeightMap& enWeMap);
0081       // set upper energy - lower weight pairs for a cell
0082 
0083     void SetGeneralUpperEnergyBounds(const std::set<G4double,
0084                                           std::less<G4double> >& enBounds);
0085   protected:
0086 
0087     explicit G4WeightWindowStore();
0088       // initialise the weight window store for the given geometry
0089     explicit G4WeightWindowStore(const G4String& ParallelWorldName);
0090       // initialise the weight window store for the given geometry
0091 
0092    ~G4WeightWindowStore() override;
0093       // destructor
0094 
0095   private:
0096 
0097     G4bool IsInWorld(const G4VPhysicalVolume&) const;
0098     void Error(const G4String& m) const;
0099     void SetInternalIterator(const G4GeometryCell& gCell) const;
0100 
0101   private:
0102 
0103     const G4VPhysicalVolume* fWorldVolume = nullptr;  
0104 
0105     std::set<G4double, std::less<G4double> > fGeneralUpperEnergyBounds;
0106     G4GeometryCellWeight fCellToUpEnBoundLoWePairsMap;
0107     mutable G4GeometryCellWeight::const_iterator fCurrentIterator;
0108 
0109     static G4ThreadLocal G4WeightWindowStore* fInstance;
0110 };
0111 
0112 #endif