Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-09-17 08:58:09

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 // Author:      Alexei Sytov
0027 // Co-author:   Gianfranco PaternĂ² (modifications & testing)
0028 
0029 #ifndef G4ChannelingFastSimCrystalData_h
0030 #define G4ChannelingFastSimCrystalData_h 1
0031 
0032 #include "G4ios.hh"
0033 #include "globals.hh"
0034 #include <CLHEP/Units/SystemOfUnits.h>
0035 #include "G4ThreeVector.hh"
0036 #include "Randomize.hh"
0037 #include "G4Material.hh"
0038 #include <unordered_map>
0039 
0040 #include "G4VChannelingFastSimCrystalData.hh"
0041 #include "G4ChannelingFastSimInterpolation.hh"
0042 
0043 /** \file G4ChannelingFastSimCrystalData.hh
0044 * \brief Definition of the G4ChannelingFastSimCrystalData class
0045 * The class inherits G4VChannelingFastSimCrystalData containing the data and properties
0046 * related to the crystal lattice.
0047 * The functions related to the crystal geometry (transformation of coordinates and angles
0048 * from the reference system of the bounding box of the local volume to
0049 * the crystal lattice co-rotating reference system and vice versa) and
0050 * initialization function SetMaterialProperties are compiled in this class.
0051 */
0052 
0053 class G4ChannelingFastSimCrystalData  : public G4VChannelingFastSimCrystalData
0054 {
0055 public:
0056 
0057     G4ChannelingFastSimCrystalData();
0058     virtual ~G4ChannelingFastSimCrystalData() = default;
0059 
0060 public:
0061 
0062     ///find and upload crystal lattice input files, calculate all the basic values
0063     ///(to do only once)
0064     void SetMaterialProperties(const G4Material* crystal,
0065                                const G4String &lattice,
0066                                const G4String &filePath);
0067 
0068     ///calculate the coordinates in the co-rotating reference system
0069     ///within a channel (periodic cell)
0070     ///(connected with crystal planes/axes either bent or straight)
0071     G4ThreeVector CoordinatesFromBoxToLattice(const G4ThreeVector &pos0);
0072 
0073     ///calculate the coordinates in the Box reference system
0074     ///(connected with the bounding box of the volume)
0075     G4ThreeVector CoordinatesFromLatticeToBox(const G4ThreeVector &pos);
0076 
0077     ///change the channel if necessary, recalculate x o y
0078     G4ThreeVector ChannelChange(G4double &x, G4double &y, G4double &z);
0079 
0080     ///calculate the horizontal angle in the co-rotating reference system
0081     ///within a channel (periodic cell)
0082     ///(connected with crystal planes/axes either bent or straight)
0083     G4double AngleXFromBoxToLattice(G4double tx, G4double z)
0084     {return tx-AngleXShift(z)-GetCUtetax(z);}
0085 
0086     ///calculate the horizontal angle in the Box reference system
0087     ///(connected with the bounding box of the volume)
0088     G4double AngleXFromLatticeToBox(G4double tx, G4double z)
0089     {return tx+AngleXShift(z)+GetCUtetax(z);}
0090 
0091     ///auxialiary function to transform the horizontal angle
0092     G4double AngleXShift(G4double z){return fMiscutAngle + z*fCurv;}
0093 
0094     ///get channel width in x and y
0095     G4double GetChannelWidthX(){return fDx;}
0096     G4double GetChannelWidthY(){return fDy;}
0097 
0098 private:
0099 
0100     ///variables
0101     G4int fNsteps=353;//number of steps per channeling oscillation
0102     G4double fR0=1.1*CLHEP::fermi;//*A^(1/3) - radius of nucleus
0103 
0104     ///Values related to coordinate transformation
0105     long long int fNChannelx=0;//horizontal number of channel
0106                              //(either straight of bent) inside the box
0107     long long int fNChannely=0;//vertical number of channel (either straight of bent)
0108                              //inside the box; =0 in the case of planes
0109 
0110     ///values related to the crystal lattice
0111     G4int fNpointsx=0,fNpointsy=0;// number of horizontal and vertical nodes of
0112                                   // interpolation
0113     G4double fDx=0, fDy=0;// channel (periodic cell)
0114                       //horizontal and vertical dimensions
0115 
0116     ///fundamental constants of material
0117     std::vector <G4double> fN0; // nuclear concentration
0118     std::vector <G4double> fU1; // amplitude of thermal oscillations
0119     std::vector <G4double> fZ1;//atomic number of each element
0120     std::vector <G4double> fAN; //atomic mass of each element
0121 };
0122 
0123 #endif