Back to home page

EIC code displayed by LXR

 
 

    


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

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 //
0027 //
0028 //
0029 //---------------------------------------------------------------
0030 //
0031 //  G4GlobalFastSimulationManager.hh
0032 //
0033 //  Description:
0034 //    A singleton class which manages the Fast Simulation managers
0035 //    attached to envelopes.
0036 //
0037 //  History:
0038 //    June 98: Verderi && MoraDeFreitas - "G4ParallelWorld" becomes
0039 //             "G4FlavoredParallelWorld"; some method name changes;
0040 //             GetFlavoredWorldForThis now returns a
0041 //             G4FlavoredParallelWorld pointer.
0042 //    Feb 98: Verderi && MoraDeFreitas - First Implementation.
0043 //
0044 //---------------------------------------------------------------
0045 
0046 #ifndef G4GLOBALFASTSIMULATIONMANAGER_HH
0047 #define G4GLOBALFASTSIMULATIONMANAGER_HH
0048 
0049 #include "G4FastSimulationManager.hh"
0050 #include "G4FastSimulationManagerProcess.hh"
0051 #include "G4FastSimulationVector.hh"
0052 #include "G4VGlobalFastSimulationManager.hh"
0053 #include "globals.hh"
0054 
0055 class G4FastSimulationMessenger;
0056 template <class T>
0057 class G4ThreadLocalSingleton;
0058 
0059 enum listType
0060 {
0061   NAMES_ONLY,
0062   MODELS,
0063   ISAPPLICABLE
0064 };
0065 
0066 // Class Description:
0067 // This a singleton class which provides the management of the G4FastSimulationManager
0068 // objects and some ghost facilities.
0069 //
0070 // You can get access to it by:
0071 //
0072 // #include "G4GlobalFastSimulationManager.hh"
0073 // ...
0074 // ...
0075 // G4GlobalFastSimulationManager* globalFSM;
0076 // globalFSM = G4GlobalFastSimulationManager::getGlobalFastSimulationManager();
0077 // ...
0078 // ...
0079 //
0080 // Presently, you will mainly need to use the GlobalFastSimulationManager if you use ghost
0081 // geometries.
0082 //
0083 
0084 class G4GlobalFastSimulationManager
0085 {
0086   friend class G4ThreadLocalSingleton<G4GlobalFastSimulationManager>;
0087 
0088   public:
0089     // Destructor
0090     ~G4GlobalFastSimulationManager();
0091 
0092     // Provides a global access to the GlobalFastSimulationManager
0093     static G4GlobalFastSimulationManager* GetGlobalFastSimulationManager();
0094 
0095     // Same as GetGlobalFastSimulationManager()
0096     static G4GlobalFastSimulationManager* GetInstance();
0097 
0098     // Iterative fetch of G4VFastSimulationModel objects by name:
0099     //    o returns the G4VFastSimulationModel* of model with name modelName;
0100     //    o returns 0 if no model found;
0101     //    o usage:
0102     //        myModel = gblManager->GetFastSimulationModel("MyModel");
0103     //    o note for the case of several models having the same name:
0104     //        - to get the first "MyModel" model:
0105     //             myModel1 = gblManager->GetFastSimulationModel("MyModel", 0);
0106     //        - to get the next one:
0107     //             myModel2 = gblManager->GetFastSimulationModel("MyModel", myModel1);
0108     //        - and so on.
0109     //        - When gblManager->GetFastSimulationModel("MyModel", myModel_n)
0110     //          returns a null pointer, no extra model with name "MyModel" exist.
0111     G4VFastSimulationModel*
0112     GetFastSimulationModel(const G4String& modelName,
0113                            const G4VFastSimulationModel* previousFound = nullptr) const;
0114 
0115     //
0116     // G4FastSimulationManager(Process)'s management, no intended for general use.
0117     //
0118     // Methods for a G4FastSimulationManager to register itself
0119     //
0120     void AddFastSimulationManager(G4FastSimulationManager*);
0121     void RemoveFastSimulationManager(G4FastSimulationManager*);
0122     //
0123     // G4FastSimulationManagerProcess bookeeping:
0124     //
0125     void AddFSMP(G4FastSimulationManagerProcess*);
0126     void RemoveFSMP(G4FastSimulationManagerProcess*);
0127 
0128     // Flag that the Parameterisation must be closed.
0129     void FastSimulationNeedsToBeClosed();
0130 
0131     // Show the fast simulation setup : world(s), region(s), model(s) and links between them.
0132     // Requires the geometry to be closed.
0133     void ShowSetup();
0134 
0135     void ListEnvelopes(const G4String& aName = "all", listType aListType = NAMES_ONLY);
0136     void ListEnvelopes(const G4ParticleDefinition*);
0137 
0138     void ActivateFastSimulationModel(const G4String&);
0139     void InActivateFastSimulationModel(const G4String&);
0140 
0141     void Flush();
0142 
0143   private:
0144     // Private construtor insures singleton class
0145     G4GlobalFastSimulationManager();
0146 
0147     // recursive display of regions, models, etc...
0148     void DisplayRegion(G4Region* motherRegion, G4int depth,
0149                        std::vector<G4ParticleDefinition*>& particles) const;
0150 
0151     G4FastSimulationMessenger* fTheFastSimulationMessenger;
0152     G4FastSimulationVector<G4FastSimulationManager> ManagedManagers;
0153     G4FastSimulationVector<G4FastSimulationManagerProcess> fFSMPVector;
0154 };
0155 
0156 #endif