Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-31 09:22:14

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 //  Gorad (Geant4 Open-source Radiation Analysis and Design)
0027 //
0028 //  Author : Makoto Asai (SLAC National Accelerator Laboratory)
0029 //
0030 //  Development of Gorad is funded by NASA Johnson Space Center (JSC)
0031 //  under the contract NNJ15HK11B.
0032 //
0033 // ********************************************************************
0034 //
0035 // GRGeomImpBiasWorld.hh
0036 //   Header file of a parallel world class that defines the geometry
0037 //   of the geometry improtance biasing.
0038 //
0039 // History
0040 //   September 8th, 2020 : first implementation
0041 //
0042 // ********************************************************************
0043 
0044 #ifndef GRGeomImpBiasWorld_H
0045 #define GRGeomImpBiasWorld_H 1
0046 
0047 #include "G4VUserParallelWorld.hh"
0048 #include "globals.hh"
0049 #include "G4ThreeVector.hh"
0050 
0051 class GRDetectorConstruction;
0052 class G4VPhysicalVolume;
0053 class G4Region;
0054 class GRGeomImpBiasWorldStateNotifier;
0055 
0056 class GRGeomImpBiasWorld : public G4VUserParallelWorld
0057 {
0058   friend class GRGeomImpBiasWorldStateNotifier;
0059 
0060   public:
0061     GRGeomImpBiasWorld(G4String&,GRDetectorConstruction*);
0062     virtual ~GRGeomImpBiasWorld();
0063     virtual void Construct();
0064     virtual void ConstructSD();
0065 
0066   private:
0067     GRDetectorConstruction* detector;
0068     G4VPhysicalVolume* fWorld = nullptr;
0069     G4Region* biasingRegion = nullptr;
0070     GRGeomImpBiasWorldStateNotifier* stateNotifier;
0071     G4bool constructed = false;
0072 
0073   private:
0074     void Update();
0075 };
0076 
0077 #include "G4VStateDependent.hh"
0078 #include "G4ApplicationState.hh"
0079 
0080 class GRGeomImpBiasWorldStateNotifier : public G4VStateDependent
0081 {
0082   public:
0083     GRGeomImpBiasWorldStateNotifier(GRGeomImpBiasWorld* bw)
0084     : biasWorld(bw)
0085     {;}
0086     virtual ~GRGeomImpBiasWorldStateNotifier()
0087     {;}
0088     virtual G4bool Notify(G4ApplicationState newState)
0089     {
0090       if(previousState == G4State_Idle && newState == G4State_GeomClosed)
0091       { biasWorld->Update(); }
0092       previousState = newState;
0093       return true;
0094     }
0095   private:
0096     GRGeomImpBiasWorld* biasWorld;
0097     G4ApplicationState previousState = G4State_PreInit;
0098 };
0099 
0100 #endif