Back to home page

EIC code displayed by LXR

 
 

    


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

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 // G4ParallelWorldProcess
0027 //
0028 // Class description:
0029 //
0030 // This process takes a parallel world and limits a step
0031 // on the boundaries of volumes in the parallel world.
0032 // It invokes sensitive detectors assigned in the parallel world.
0033 // It switches a material (and a region if defined) in the
0034 // assigned parallel world over the material (and the region)
0035 // in the mass world.
0036 //
0037 // Author: M.Asai (SLAC), 2010.
0038 //---------------------------------------------------------------------
0039 #ifndef G4ParallelWorldProcess_h
0040 #define G4ParallelWorldProcess_h 1
0041 
0042 #include "G4FieldTrack.hh"
0043 #include "G4MultiNavigator.hh"
0044 #include "G4TouchableHandle.hh"
0045 #include "G4VProcess.hh"
0046 #include "globals.hh"
0047 
0048 class G4Step;
0049 class G4StepPoint;
0050 class G4Navigator;
0051 class G4TransportationManager;
0052 class G4PathFinder;
0053 class G4VPhysicalVolume;
0054 class G4ParticleChange;
0055 
0056 class G4ParallelWorldProcess : public G4VProcess
0057 {
0058   public:
0059 
0060     G4ParallelWorldProcess(const G4String& processName = "ParaWorld",
0061                            G4ProcessType theType = fParallel);
0062     ~G4ParallelWorldProcess() override;
0063 
0064     //--------------------------------------------------------------
0065     // Set Paralle World
0066     //--------------------------------------------------------------
0067 
0068     void SetParallelWorld(G4String parallelWorldName);
0069     void SetParallelWorld(G4VPhysicalVolume* parallelWorld);
0070 
0071     //--------------------------------------------------------------
0072     //     Process interface
0073     //--------------------------------------------------------------
0074 
0075     void StartTracking(G4Track*) override;
0076 
0077     //------------------------------------------------------------------------
0078     // GetPhysicalInteractionLength() and DoIt() methods for AtRest
0079     //------------------------------------------------------------------------
0080 
0081     G4double AtRestGetPhysicalInteractionLength(const G4Track&, G4ForceCondition*) override;
0082     G4VParticleChange* AtRestDoIt(const G4Track&, const G4Step&) override;
0083 
0084     //------------------------------------------------------------------------
0085     // GetPhysicalInteractionLength() and DoIt() methods for AlongStep
0086     //------------------------------------------------------------------------
0087 
0088     G4double AlongStepGetPhysicalInteractionLength(const G4Track&, G4double, G4double, G4double&,
0089                                                    G4GPILSelection*) override;
0090     G4VParticleChange* AlongStepDoIt(const G4Track&, const G4Step&) override;
0091 
0092     //-----------------------------------------------------------------------
0093     // GetPhysicalInteractionLength() and DoIt() methods for PostStep
0094     //-----------------------------------------------------------------------
0095 
0096     G4double PostStepGetPhysicalInteractionLength(const G4Track&, G4double,
0097                                                   G4ForceCondition*) override;
0098     G4VParticleChange* PostStepDoIt(const G4Track&, const G4Step&) override;
0099 
0100     //-----------------------------------------------------------------------
0101     // Flag for material switching
0102     //-----------------------------------------------------------------------
0103 
0104     inline void SetLayeredMaterialFlag(G4bool flg = true) { layeredMaterialFlag = flg; }
0105     inline G4bool GetLayeredMaterialFlag() const { return layeredMaterialFlag; }
0106 
0107     //--------------------------------------------------------------------
0108     // Returns whether a particular particle type requires AtRest process
0109     //--------------------------------------------------------------------
0110     G4bool IsAtRestRequired(G4ParticleDefinition*);
0111 
0112     //-----------------------------------------------------------------------
0113     // Static G4Step object for "Hyper-step"
0114     //-----------------------------------------------------------------------
0115     static const G4Step* GetHyperStep();
0116     static G4int GetHypNavigatorID();
0117 
0118   protected:
0119 
0120     void CopyStep(const G4Step& step);
0121     void SwitchMaterial(G4StepPoint*);
0122 
0123   protected:
0124 
0125     G4Step* fGhostStep;
0126     G4StepPoint* fGhostPreStepPoint;
0127     G4StepPoint* fGhostPostStepPoint;
0128 
0129     G4VParticleChange aDummyParticleChange;
0130     G4ParticleChange xParticleChange;
0131 
0132     G4TransportationManager* fTransportationManager;
0133     G4PathFinder* fPathFinder;
0134 
0135     // -------------------------------
0136     // Navigation in the Ghost World:
0137     // -------------------------------
0138     G4String fGhostWorldName;
0139     G4VPhysicalVolume* fGhostWorld{nullptr};
0140     G4Navigator* fGhostNavigator{nullptr};
0141     G4int fNavigatorID{-1};
0142     G4TouchableHandle fOldGhostTouchable;
0143     G4TouchableHandle fNewGhostTouchable;
0144     G4FieldTrack fFieldTrack;
0145     G4double fGhostSafety{0.};
0146     G4bool fOnBoundary{false};
0147 
0148     //-----------------------------------------------------------------------
0149     // Flag for material switching
0150     //-----------------------------------------------------------------------
0151     G4bool layeredMaterialFlag{false};
0152 
0153   private:
0154 
0155     static G4ThreadLocal G4Step* fpHyperStep;
0156     static G4ThreadLocal G4int nParallelWorlds;
0157     static G4ThreadLocal G4int fNavIDHyp;
0158     G4int iParallelWorld;
0159 };
0160 
0161 #endif