Back to home page

EIC code displayed by LXR

 
 

    


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

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 // Author: Maria Grazia Pia (Maria.Grazia.Pia@cern.ch)
0029 //
0030 // History:
0031 // -----------
0032 // 16 Sep 2001   MGP                Created
0033 // 26 Sep 2001   V.Ivanchenko       Hide copy constructor and assignement operator
0034 // 18 Apr 2002   V.Ivanchenko       Move member function ValueForMaterial to public
0035 // 21 Jan 2003   V.Ivanchenko       Cut per region
0036 // 15 Jul 2009   N.A.Karakatsanis   New methods added for loading logarithmic data
0037 //                                  to enhance computing performance of interpolation
0038 //
0039 // -------------------------------------------------------------------
0040 
0041 // Class description:
0042 // Low Energy Electromagnetic Physics
0043 // Base class for cross section manager for an electromagnetic physics process
0044 
0045 // -------------------------------------------------------------------
0046 
0047 #ifndef G4VCROSSSECTIONHANDLER_HH
0048 #define G4VCROSSSECTIONHANDLER_HH 1
0049 
0050 #include <map>
0051 #include <vector>
0052 #include <CLHEP/Units/SystemOfUnits.h>
0053 
0054 #include "globals.hh"
0055 #include "G4DataVector.hh"
0056 #include "G4MaterialCutsCouple.hh"
0057 
0058 class G4VDataSetAlgorithm;
0059 class G4VEMDataSet;
0060 class G4Material;
0061 class G4Element;
0062 
0063 class G4VCrossSectionHandler {
0064 
0065 public:
0066   explicit G4VCrossSectionHandler();
0067   explicit G4VCrossSectionHandler(G4VDataSetAlgorithm* interpolation,
0068              G4double minE = 250*CLHEP::eV,
0069                          G4double maxE = 100*CLHEP::GeV,
0070              G4int nBins = 200,
0071              G4double unitE = CLHEP::MeV,
0072                          G4double unitData = CLHEP::barn,
0073              G4int minZ = 1, G4int maxZ = 99);
0074 
0075   virtual ~G4VCrossSectionHandler();
0076 
0077   void Initialise(G4VDataSetAlgorithm* interpolation = nullptr,
0078           G4double minE = 250*CLHEP::eV,
0079                   G4double maxE = 100*CLHEP::GeV,
0080           G4int numberOfBins = 200,
0081           G4double unitE = CLHEP::MeV,
0082                   G4double unitData = CLHEP::barn,
0083           G4int minZ = 1, G4int maxZ = 99);
0084 
0085   G4int SelectRandomAtom(const G4MaterialCutsCouple* couple, G4double e) const;
0086   const G4Element* SelectRandomElement(const G4MaterialCutsCouple* material,
0087                              G4double e) const;
0088 
0089   G4int SelectRandomShell(G4int Z, G4double e) const;
0090   G4VEMDataSet* BuildMeanFreePathForMaterials(const G4DataVector* energyCuts = nullptr);
0091   G4double FindValue(G4int Z, G4double e) const;
0092   G4double FindValue(G4int Z, G4double e, G4int shellIndex) const;
0093   G4double ValueForMaterial(const G4Material* material, G4double e) const;
0094   void LoadData(const G4String& dataFile);
0095   void LoadNonLogData(const G4String& dataFile);
0096   void LoadShellData(const G4String& dataFile);
0097   void PrintData() const;
0098   void Clear();
0099 
0100   G4VCrossSectionHandler(const G4VCrossSectionHandler&) = delete;
0101   G4VCrossSectionHandler & operator=(const G4VCrossSectionHandler &right) = delete;
0102 
0103 protected:
0104 
0105   G4int NumberOfComponents(G4int Z) const;
0106   void ActiveElements();
0107 
0108   // Factory method
0109   virtual std::vector<G4VEMDataSet*>* BuildCrossSectionsForMaterials(const G4DataVector& energyVector,
0110                                        const G4DataVector* energyCuts = nullptr) = 0;
0111 
0112   // Factory method
0113   virtual G4VDataSetAlgorithm* CreateInterpolation();
0114   const G4VDataSetAlgorithm* GetInterpolation() const { return interpolation; }
0115 
0116 private:
0117   G4VDataSetAlgorithm* interpolation;
0118   G4DataVector activeZ;
0119 
0120   std::map<G4int,G4VEMDataSet*,std::less<G4int> > dataMap;
0121   std::vector<G4VEMDataSet*>* crossSections;
0122 
0123   G4double eMin;
0124   G4double eMax;
0125   G4double unit1;
0126   G4double unit2;
0127 
0128   G4int zMin;
0129   G4int zMax;
0130   G4int nBins;
0131 };
0132 
0133 #endif
0134 
0135 
0136 
0137 
0138 
0139 
0140 
0141 
0142 
0143 
0144