Back to home page

EIC code displayed by LXR

 
 

    


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

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 // GEANT4 Class file
0030 //
0031 //
0032 // File name:     G4RDBremsstrahlungCrossSectionHandler
0033 //
0034 // Author:        V.Ivanchenko (Vladimir.Ivanchenko@cern.ch)
0035 // 
0036 // Creation date: 25 September 2001
0037 //
0038 // Modifications: 
0039 // 10.10.2001 MGP Revision to improve code quality and consistency with design
0040 // 21.01.2003 VI  cut per region
0041 //
0042 // -------------------------------------------------------------------
0043 
0044 #include "G4RDBremsstrahlungCrossSectionHandler.hh"
0045 #include "G4RDeBremsstrahlungSpectrum.hh"
0046 #include "G4DataVector.hh"
0047 #include "G4RDCompositeEMDataSet.hh"
0048 #include "G4RDVDataSetAlgorithm.hh"
0049 #include "G4RDSemiLogInterpolation.hh"
0050 #include "G4RDVEMDataSet.hh"
0051 #include "G4RDEMDataSet.hh"
0052 #include "G4Material.hh"
0053 #include "G4ProductionCutsTable.hh"
0054 
0055 G4RDBremsstrahlungCrossSectionHandler::G4RDBremsstrahlungCrossSectionHandler(const G4RDVEnergySpectrum* spec,
0056                                      G4RDVDataSetAlgorithm* )
0057   : theBR(spec)
0058 {
0059   interp = new G4RDSemiLogInterpolation();
0060 }
0061 
0062 
0063 G4RDBremsstrahlungCrossSectionHandler::~G4RDBremsstrahlungCrossSectionHandler()
0064 {
0065   delete interp;
0066 }
0067 
0068 
0069 std::vector<G4RDVEMDataSet*>*
0070 G4RDBremsstrahlungCrossSectionHandler::BuildCrossSectionsForMaterials(const G4DataVector& energyVector,
0071                                     const G4DataVector* energyCuts)
0072 {
0073   std::vector<G4RDVEMDataSet*>* set = new std::vector<G4RDVEMDataSet*>;
0074 
0075   G4DataVector* energies;
0076   G4DataVector* cs;
0077   G4int nOfBins = energyVector.size();
0078 
0079   const G4ProductionCutsTable* theCoupleTable=
0080         G4ProductionCutsTable::GetProductionCutsTable();
0081   size_t numOfCouples = theCoupleTable->GetTableSize();
0082 
0083   for (size_t m=0; m<numOfCouples; m++) {
0084 
0085     const G4MaterialCutsCouple* couple = theCoupleTable->GetMaterialCutsCouple(m);
0086     const G4Material* material= couple->GetMaterial();
0087     const G4ElementVector* elementVector = material->GetElementVector();
0088     const G4double* nAtomsPerVolume = material->GetVecNbOfAtomsPerVolume();
0089     G4int nElements = material->GetNumberOfElements();
0090 
0091     G4double tcut  = (*energyCuts)[m];
0092 
0093     G4RDVDataSetAlgorithm* algo = interp->Clone();
0094     G4RDVEMDataSet* setForMat = new G4RDCompositeEMDataSet(algo,1.,1.);
0095 
0096     for (G4int i=0; i<nElements; i++) {
0097 
0098       G4int Z = (G4int) ((*elementVector)[i]->GetZ());
0099       energies = new G4DataVector;
0100       cs       = new G4DataVector;
0101       G4double density = nAtomsPerVolume[i];
0102 
0103       for (G4int bin=0; bin<nOfBins; bin++) {
0104 
0105         G4double e = energyVector[bin];
0106         energies->push_back(e);
0107         G4double value = 0.0;
0108 
0109         if(e > tcut) {
0110           G4double elemCs = FindValue(Z, e);
0111 
0112           value  = theBR->Probability(Z, tcut, e, e);
0113 
0114           value *= elemCs*density;
0115     }
0116         cs->push_back(value);
0117       }
0118       G4RDVDataSetAlgorithm* algol = interp->Clone();
0119       G4RDVEMDataSet* elSet = new G4RDEMDataSet(i,energies,cs,algol,1.,1.);
0120       setForMat->AddComponent(elSet);
0121     }
0122     set->push_back(setForMat);
0123   }
0124 
0125   return set;
0126 }