Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Ultra Cold Neutron (UCN) Boundary Process Class Definition
0031 ////////////////////////////////////////////////////////////////////////
0032 //
0033 // File:         G4UCNBoundaryProcess.hh
0034 // Description:  Discrete Process -- Boundary Process of UCN
0035 // Version:      1.0
0036 // Created:      2014-06-04
0037 // Author:       Peter Gumplinger
0038 // Adopted from: UCNMaterialBoundary by Peter Fierlinger 4.9.2004
0039 // Updated:
0040 // mail:         gum@triumf.ca
0041 //
0042 ////////////////////////////////////////////////////////////////////////
0043 
0044 #ifndef G4UCNBOUNDARYPROCESS_HH
0045 #define G4UCNBOUNDARYPROCESS_HH 1
0046 
0047 /////////////
0048 // Includes
0049 /////////////
0050 
0051 #include "G4VDiscreteProcess.hh"
0052 
0053 #include "G4Neutron.hh"
0054 
0055 #include "G4UCNMaterialPropertiesTable.hh"
0056 
0057 class G4UCNBoundaryProcessMessenger;
0058 
0059 // Class Description:
0060 // Discrete Process -- Boundary Process of Ultra Cold Neutrons.
0061 // Reflects/Absorpts UCN at boundaries.
0062 // Class inherits publicly from G4VDiscreteProcess.
0063 // Class Description - End:
0064 
0065 /////////////////////
0066 // Class Definition
0067 /////////////////////
0068 
0069 
0070 enum G4UCNBoundaryProcessStatus { Undefined,
0071                                   NotAtBoundary,
0072                                   SameMaterial,
0073                                   StepTooSmall,
0074                                   NoMPT, NoMRT,
0075                                   NoMRCondition,
0076                                   Absorption, Ezero, Flip,
0077                                   SpecularReflection,
0078                                   LambertianReflection, MRDiffuseReflection,
0079                                   SnellTransmit, MRDiffuseTransmit
0080                                 };
0081 
0082 class G4UCNBoundaryProcess : public G4VDiscreteProcess
0083 {
0084 
0085 public:
0086 
0087         ////////////////////////////////
0088         // Constructors and Destructor
0089         ////////////////////////////////
0090 
0091         G4UCNBoundaryProcess(const G4String& processName = "UCNBoundaryProcess",
0092                              G4ProcessType type = fUCN);
0093     virtual ~G4UCNBoundaryProcess();
0094 
0095 private:
0096 
0097         G4UCNBoundaryProcess(const G4UCNBoundaryProcess &right);
0098 
0099         //////////////
0100         // Operators
0101         //////////////
0102 
0103         G4UCNBoundaryProcess& operator=(const G4UCNBoundaryProcess &right);
0104 
0105 public:
0106 
0107         ////////////
0108         // Methods
0109         ///////////
0110 
0111         G4bool IsApplicable(const G4ParticleDefinition& aParticleType);
0112         // Returns true -> 'is applicable' only for an UCN.
0113 
0114         G4double GetMeanFreePath(const G4Track& aTrack,
0115                                  G4double ,
0116                                  G4ForceCondition* condition);
0117 
0118         G4VParticleChange* PostStepDoIt(const G4Track& aTrack,
0119                                         const G4Step&  aStep);
0120 
0121 private:
0122 
0123         G4UCNBoundaryProcessMessenger* fMessenger;
0124 
0125         G4double neV;
0126 
0127         G4double kCarTolerance;
0128 
0129         G4UCNBoundaryProcessStatus theStatus;
0130 
0131         const G4Material* Material1;
0132         const G4Material* Material2;
0133 
0134         // the G4UCNMaterialPropertiesTable of PreStepPoint
0135         G4UCNMaterialPropertiesTable* aMaterialPropertiesTable1;
0136         // the G4UCNMaterialPropertiesTable of PostStepPoint
0137         G4UCNMaterialPropertiesTable* aMaterialPropertiesTable2;
0138 
0139         G4bool UseMicroRoughnessReflection;
0140         G4bool DoMicroRoughnessReflection;
0141 
0142         ////////////
0143         // Methods
0144         ///////////
0145 
0146         G4bool High(G4double , G4double );
0147 
0148         G4bool Loss(G4double , G4double , G4double );
0149 
0150         G4bool SpinFlip(G4double );
0151 
0152         G4double Reflectivity(G4double , G4double );
0153 
0154         G4ThreeVector Reflect(G4double , G4ThreeVector , G4ThreeVector );
0155 
0156         G4double Transmit(G4double, G4double );
0157 
0158         G4ThreeVector LDiffRefl(G4ThreeVector );
0159 
0160 public:
0161   
0162         G4ThreeVector MRreflect(G4double ,
0163                                 G4ThreeVector , G4ThreeVector ,
0164                                 G4double , G4double );
0165         G4ThreeVector MRreflectHigh(G4double , G4double , G4double ,
0166                                     G4ThreeVector , G4ThreeVector ,
0167                                     G4double , G4double , G4double& );
0168 
0169 private:
0170 
0171         G4ThreeVector MRDiffRefl(G4ThreeVector , G4double , G4double ,
0172                                  G4ThreeVector , G4double );
0173         G4ThreeVector MRDiffTrans(G4ThreeVector , G4double , G4double ,
0174                                   G4ThreeVector , G4double );
0175 
0176         G4RotationMatrix GetCoordinateTransformMatrix(G4ThreeVector ,
0177                                                       G4ThreeVector );
0178 
0179         void BoundaryProcessVerbose() const;
0180 
0181         // Invoke SD for post step point if the photon is 'detected'
0182         G4bool InvokeSD(const G4Step* step);
0183 
0184 private:
0185 
0186         G4int nNoMPT, nNoMRT, nNoMRCondition;
0187         G4int nAbsorption, nEzero, nFlip;
0188         G4int aSpecularReflection, bSpecularReflection;
0189         G4int bLambertianReflection;
0190         G4int aMRDiffuseReflection, bMRDiffuseReflection;
0191         G4int nSnellTransmit, mSnellTransmit;
0192         G4int aMRDiffuseTransmit;
0193 
0194         G4double ftheta_o, fphi_o;
0195 
0196 public:
0197 
0198         void SetMicroRoughness(G4bool );
0199         G4bool GetMicroRoughness();
0200 
0201         G4UCNBoundaryProcessStatus GetStatus() const;
0202 
0203         void BoundaryProcessSummary() const;
0204 
0205         void SetMaterialPropertiesTable1(G4UCNMaterialPropertiesTable* MPT)
0206              {aMaterialPropertiesTable1 = MPT;}
0207 
0208         void SetMaterialPropertiesTable2(G4UCNMaterialPropertiesTable* MPT)
0209              {aMaterialPropertiesTable2 = MPT;}
0210 
0211         G4double GetTheta_o() {return ftheta_o;};
0212         G4double GetPhi_o() {return fphi_o;};
0213 
0214 };
0215 
0216 ////////////////////
0217 // Inline methods
0218 ////////////////////
0219 
0220 inline G4bool
0221 G4UCNBoundaryProcess::IsApplicable(const G4ParticleDefinition& aParticleType)
0222 {
0223   return ( &aParticleType == G4Neutron::NeutronDefinition() );
0224 }
0225 
0226 inline
0227 G4UCNBoundaryProcessStatus G4UCNBoundaryProcess::GetStatus() const
0228 {
0229   return theStatus;
0230 }
0231 
0232 inline
0233 G4bool G4UCNBoundaryProcess::High(G4double Energy, G4double FermiPotDiff)
0234 {
0235   // Returns true for Energy > Fermi Potential Difference
0236 
0237   return (Energy > FermiPotDiff);
0238 }
0239 
0240 inline
0241 void G4UCNBoundaryProcess::SetMicroRoughness(G4bool active)
0242 {
0243    UseMicroRoughnessReflection = active;
0244 }
0245 
0246 inline
0247 G4bool G4UCNBoundaryProcess::GetMicroRoughness()
0248 {
0249   return UseMicroRoughnessReflection;
0250 }
0251 
0252 #endif /* G4UCNBOUNDARYPROCESS_HH */