Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:57:52

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 // G4AdjointPrimaryGenerator
0027 //
0028 // Class description:
0029 //
0030 // This class represents the Primary Generator that generates vertex
0031 // (energy, position and direction) of primary adjoint particles.
0032 // It is used by G4AdjointPrimaryGeneratorAction. If the adjoint source is
0033 // selected by the user as being on the external boundary of a volume,
0034 // it uses the class G4AdjointPosOnPhysVolGenerator to generate the vertex
0035 // positions and directions. Otherwise G4SingleParticleSource is used. 
0036 
0037 // Author: L. Desorgher, SpaceIT GmbH - November 2009
0038 // Contract: ESA contract 21435/08/NL/AT
0039 // Customer: ESA/ESTEC
0040 // --------------------------------------------------------------------
0041 #ifndef G4AdjointPrimaryGenerator_hh
0042 #define G4AdjointPrimaryGenerator_hh 1
0043 
0044 #include <vector>
0045 #include <map>
0046 #include <iterator>
0047 
0048 #include "globals.hh"
0049 #include "G4ThreeVector.hh"
0050 #include"G4PhysicsFreeVector.hh"
0051 
0052 class G4AdjointPosOnPhysVolGenerator;
0053 class G4Event;
0054 class G4SingleParticleSource;
0055 class G4ParticleDefinition;
0056 class G4Navigator;
0057 
0058 class G4AdjointPrimaryGenerator
0059 {
0060   public:
0061 
0062     G4AdjointPrimaryGenerator();    
0063    ~G4AdjointPrimaryGenerator();
0064 
0065     G4AdjointPrimaryGenerator(const G4AdjointPrimaryGenerator&) = delete;
0066     G4AdjointPrimaryGenerator& operator=(const G4AdjointPrimaryGenerator&) = delete;
0067 
0068   public:
0069     
0070     void GenerateAdjointPrimaryVertex(G4Event* anEvt,
0071                                       G4ParticleDefinition* adj_part,
0072                                       G4double E1, G4double E2);
0073     void GenerateFwdPrimaryVertex(G4Event* anEvt,
0074                                   G4ParticleDefinition* adj_part,
0075                                   G4double E1, G4double E2);
0076     void SetSphericalAdjointPrimarySource(G4double radius, G4ThreeVector pos);
0077     void SetAdjointPrimarySourceOnAnExtSurfaceOfAVolume(const G4String& v_name);
0078     void ComputeAccumulatedDepthVectorAlongBackRay(G4ThreeVector glob_pos,
0079                                                    G4ThreeVector direction,
0080                                                    G4double ekin,
0081                                                    G4ParticleDefinition* aPDef);
0082     G4double SampleDistanceAlongBackRayAndComputeWeightCorrection(G4double& weight_corr);
0083 
0084 
0085   private: // attributes
0086 
0087     // The class responsible for the random generation of  positions
0088     // and direction of primaries for adjoint source set on the external
0089     // surface of a G4 volume
0090     //
0091     G4AdjointPosOnPhysVolGenerator* theG4AdjointPosOnPhysVolGenerator = nullptr;
0092     
0093     G4SingleParticleSource* theSingleParticleSource = nullptr;
0094     
0095     // Type of adjoint source
0096     // ----------------------
0097     G4String type_of_adjoint_source; // Spherical ExtSurfaceOfAVolume
0098     G4double radius_spherical_source = 0.0;
0099     G4ThreeVector center_spherical_source;
0100     G4Navigator* fLinearNavigator = nullptr;
0101     G4PhysicsFreeVector* theAccumulatedDepthVector = nullptr;
0102 };
0103 
0104 #endif