Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:58:55

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 // G4PhysicsFreeVector
0027 //
0028 // Class description:
0029 //
0030 // A physics vector which has values of energy-loss, cross-section,
0031 // and other physics values of a particle in matter in a given
0032 // range of the energy, momentum, etc. The scale of energy/momentum
0033 // bins is in free, i.e. it is NOT need to be linear or log. Only
0034 // restriction is that bin values alway have to increase from
0035 // a lower bin to a higher bin. This is necessary for the binary
0036 // search to work correctly.
0037 
0038 // Authors:
0039 // - 02 Dec. 1995, G.Cosmo: Structure created based on object model
0040 // - 06 Jun. 1996, K.Amako: Implemented the 1st version
0041 // Revisions:
0042 // - 11 Nov. 2000, H.Kurashige: Use STL vector for dataVector and binVector
0043 // - 04 Feb. 2021, V.Ivanchenko moved implementation of all free vectors 
0044 //                 to this class
0045 // --------------------------------------------------------------------
0046 #ifndef G4PhysicsFreeVector_hh
0047 #define G4PhysicsFreeVector_hh 1
0048 
0049 #include "G4PhysicsVector.hh"
0050 #include "globals.hh"
0051 #include <vector>
0052 
0053 class G4PhysicsFreeVector : public G4PhysicsVector
0054 {
0055 public:
0056 
0057   // Constructors of a free vector without filling of data.
0058   // The vector will be filled using PutValues(..), Retrieve(..), or 
0059   // InsertValues(..) methods. 
0060   // If length > 0 energy and data vectors are initialized with zeros
0061   explicit G4PhysicsFreeVector(G4bool spline = false);
0062   explicit G4PhysicsFreeVector(G4int length);
0063   explicit G4PhysicsFreeVector(std::size_t length, G4bool spline = false);
0064 
0065   // Obsolete constructor - emin and emax are not used 
0066   explicit G4PhysicsFreeVector(std::size_t length, G4double emin,
0067                                G4double emax, G4bool spline = false);
0068 
0069   // The vector is filled in these constructor;
0070   // 'energies' and 'values' need to have the same vector length;
0071   // 'energies' assumed to increase, it is allowed to have consequtive
0072   // equal energies
0073   explicit G4PhysicsFreeVector(const std::vector<G4double>& energies,
0074                                const std::vector<G4double>& values,
0075                                G4bool spline = false);
0076   explicit G4PhysicsFreeVector(const G4double* energies, const G4double* values,
0077                                std::size_t length, G4bool spline = false);
0078 
0079   ~G4PhysicsFreeVector() override = default;
0080 
0081   // Filling of the vector with the check on index and energy
0082   void PutValues(const std::size_t index, 
0083                  const G4double energy, const G4double value);
0084 
0085   // Insert extra pair of energy and value
0086   // If energy coincide with previously added energy then
0087   // this new pair is added after 
0088   void InsertValues(const G4double energy, const G4double value);
0089 
0090   void EnableLogBinSearch(const G4int n = 1);
0091  
0092   // Obsolete method
0093   inline void PutValue(const std::size_t index, 
0094                        const G4double e, const G4double value);
0095 };
0096 
0097 inline void G4PhysicsFreeVector::PutValue(const std::size_t index, 
0098                                           const G4double e,
0099                                           const G4double value)
0100 {
0101   PutValues(index, e, value);
0102 }
0103 
0104 #endif