Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4FieldManagerStore
0027 //
0028 // Class description:
0029 //
0030 // Container for all FieldManagers, with functionality derived
0031 // from std::vector<T>. The class is a 'singleton', in that only
0032 // one can exist, and access is provided via the static function
0033 // G4FieldManagerStore::GetInstance().
0034 //
0035 // All FieldManagers should be registered with G4FieldManagerStore,
0036 // and removed on their destruction. 
0037 // Intended principally to enable resetting of 'state' at start of event.
0038 // The underlying container initially has a capacity of 100.
0039 
0040 // Author: J.Apostolakis, 07.12.2007 - Initial version
0041 // --------------------------------------------------------------------
0042 #ifndef G4FIELDMANAGERSTORE_HH
0043 #define G4FIELDMANAGERSTORE_HH
0044 
0045 #include <vector>
0046 
0047 #include "G4FieldManager.hh"
0048 
0049 class G4FieldManagerStore : public std::vector<G4FieldManager*>
0050 {
0051   public:  // with description
0052 
0053     static void Register(G4FieldManager* pVolume);
0054       // Add the logical volume to the collection.
0055     static void DeRegister(G4FieldManager* pVolume);
0056       // Remove the logical volume from the collection.
0057     static G4FieldManagerStore* GetInstance();
0058       // Get a ptr to the unique G4FieldManagerStore, creating it if necessary.
0059     static G4FieldManagerStore* GetInstanceIfExist();
0060       // Get a ptr to the unique G4FieldManagerStore.
0061     static void Clean();
0062       // Delete all volumes from the store.
0063 
0064     void ClearAllChordFindersState();
0065       // Looping over all field managers, call each one to reset step estimate
0066 
0067     ~G4FieldManagerStore();
0068       // Destructor: takes care to delete allocated field managers.
0069 
0070   protected:
0071   
0072     G4FieldManagerStore();
0073 
0074   private:
0075 
0076     static G4ThreadLocal G4FieldManagerStore* fgInstance;
0077     static G4ThreadLocal G4bool locked;
0078 };
0079 
0080 #endif