ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
G4PhysicsFreeVector.hh
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file G4PhysicsFreeVector.hh
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 //
28 //
29 //--------------------------------------------------------------------
30 // GEANT 4 class header file
31 //
32 // G4PhysicsFreeVector.hh
33 //
34 // Class description:
35 //
36 // A physics vector which has values of energy-loss, cross-section,
37 // and other physics values of a particle in matter in a given
38 // range of the energy, momentum, etc. The scale of energy/momentum
39 // bins is in free, ie. it is NOT need to be linear or log. Only
40 // restrication is that bin values alway have to increase from
41 // a lower bin to a higher bin. This is necessary for the binary
42 // search to work correctly.
43 
44 // History:
45 // 02 Dec. 1995, G.Cosmo : Structure created based on object model
46 // 06 Jun. 1996, K.Amako : Implemented the 1st version
47 // 01 Jul. 1996, K.Amako : Cache mechanism and hidden bin from the
48 // user introduced
49 // 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added
50 // 11 Nov. 2000, H.Kurashige : Use STL vector for dataVector and binVector
51 // 02 Oct. 2013 V.Ivanchenko : Remove FindBinLocation method
52 //
53 //--------------------------------------------------------------------
54 
55 #ifndef G4PhysicsFreeVector_h
56 #define G4PhysicsFreeVector_h 1
57 
58 #include "globals.hh"
59 #include "G4PhysicsVector.hh"
60 #include "G4DataVector.hh"
61 
63 {
64 public: // with description
65 
67  // the vector will be filled from external file using Retrieve method
68 
69  explicit G4PhysicsFreeVector(size_t length);
70  // the vector with 'length' elements will be filled using PutValue method
71  // by default the vector is initialized with zeros
72 
73  G4PhysicsFreeVector(const G4DataVector& eVector,
74  const G4DataVector& dataVector);
75  // the vector is filled in this constructor
76  // 'eVector' and 'dataVector' need to have the same vector length
77  // 'eVector' assumed to be ordered
78 
79  virtual ~G4PhysicsFreeVector();
80 
81  inline void PutValue(size_t index, G4double energy, G4double dataValue);
82  // user code is responsible for correct filling of all elements
83 };
84 
85 inline
87 {
88  if(index >= numberOfNodes) { PrintPutValueError(index); }
89  binVector[index] = e;
90  dataVector[index] = value;
91  if(index == 0) { edgeMin = e; }
92  else if( numberOfNodes - 1 == index) { edgeMax = e; }
93 }
94 
95 #endif