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 | // $Id: G4LPhysicsFreeVector.icc,v 1.13 2008/09/22 08:26:33 gcosmo Exp $ |
---|
28 | // GEANT4 tag $Name: geant4-09-02-cand-01 $ |
---|
29 | // |
---|
30 | // |
---|
31 | // ------------------------------------------------------------------ |
---|
32 | // |
---|
33 | // Class G4LPhysicsFreeVector -- source file |
---|
34 | // |
---|
35 | // Derived from base class G4PhysicsVector |
---|
36 | // This is a free vector for Low Energy Physics cross section data. |
---|
37 | // The class name includes an "L" to distinguish it from other groups |
---|
38 | // who may wish to implement a free vector in a different way. |
---|
39 | // A subdivision method is used to find the energy|momentum bin. |
---|
40 | // |
---|
41 | // F.W. Jones, TRIUMF, 04-JUN-96 |
---|
42 | // -------------------------------------------------------------------------- |
---|
43 | |
---|
44 | inline |
---|
45 | void G4LPhysicsFreeVector::PutValues(size_t binNumber, |
---|
46 | G4double binValue, G4double dataValue) |
---|
47 | // G4PhysicsVector has PutValue() but it is inconvenient. |
---|
48 | // Want to simultaneously fill the bin and data vectors. |
---|
49 | { |
---|
50 | binVector[binNumber] = binValue; |
---|
51 | dataVector[binNumber] = dataValue; |
---|
52 | if(binNumber == 0) |
---|
53 | { edgeMin = binValue; } |
---|
54 | else if( numberOfBin - 1 == binNumber) |
---|
55 | { edgeMax = binValue; } |
---|
56 | } |
---|
57 | |
---|
58 | inline |
---|
59 | void G4LPhysicsFreeVector::SetVerboseLevel(G4int value) |
---|
60 | { |
---|
61 | verboseLevel = value; |
---|
62 | } |
---|
63 | |
---|
64 | inline |
---|
65 | G4int G4LPhysicsFreeVector::GetVerboseLevel(G4int) |
---|
66 | { |
---|
67 | return verboseLevel; |
---|
68 | } |
---|
69 | |
---|
70 | inline |
---|
71 | G4double G4LPhysicsFreeVector::GetLastEnergy() |
---|
72 | { |
---|
73 | return lastEnergy; |
---|
74 | } |
---|
75 | |
---|
76 | inline |
---|
77 | size_t G4LPhysicsFreeVector::GetLastBin() |
---|
78 | { |
---|
79 | return lastBin; |
---|
80 | } |
---|
81 | |
---|
82 | inline |
---|
83 | size_t G4LPhysicsFreeVector::FindBinLocation(G4double theEnergy) const |
---|
84 | { |
---|
85 | G4int n1 = 0; |
---|
86 | G4int n2 = numberOfBin/2; |
---|
87 | G4int n3 = numberOfBin - 1; |
---|
88 | while (n1 != n3 - 1) |
---|
89 | { |
---|
90 | if (theEnergy > binVector[n2]) |
---|
91 | { n1 = n2; } |
---|
92 | else |
---|
93 | { n3 = n2; } |
---|
94 | n2 = n1 + (n3 - n1 + 1)/2; |
---|
95 | } |
---|
96 | #ifdef G4VERBOSE |
---|
97 | if (verboseLevel > 1) |
---|
98 | { |
---|
99 | G4cout << "G4LPhysicsFreeVector::FindBinLocation: returning " |
---|
100 | << n1 << G4endl; |
---|
101 | } |
---|
102 | #endif |
---|
103 | return (size_t)n1; |
---|
104 | } |
---|