| 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.17 2010/05/28 05:13:43 kurasige Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-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( numberOfNodes - 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 |
|
|---|
| 71 | inline
|
|---|
| 72 | size_t G4LPhysicsFreeVector::FindBinLocation(G4double theEnergy) const
|
|---|
| 73 | {
|
|---|
| 74 | G4int n1 = 0;
|
|---|
| 75 | G4int n2 = numberOfNodes/2;
|
|---|
| 76 | G4int n3 = numberOfNodes - 1;
|
|---|
| 77 | while (n1 != n3 - 1)
|
|---|
| 78 | {
|
|---|
| 79 | if (theEnergy > binVector[n2])
|
|---|
| 80 | { n1 = n2; }
|
|---|
| 81 | else
|
|---|
| 82 | { n3 = n2; }
|
|---|
| 83 | n2 = n1 + (n3 - n1 + 1)/2;
|
|---|
| 84 | }
|
|---|
| 85 | #ifdef G4VERBOSE
|
|---|
| 86 | if (verboseLevel > 1)
|
|---|
| 87 | {
|
|---|
| 88 | G4cout << "G4LPhysicsFreeVector::FindBinLocation: returning "
|
|---|
| 89 | << n1 << G4endl;
|
|---|
| 90 | }
|
|---|
| 91 | #endif
|
|---|
| 92 | return (size_t)n1;
|
|---|
| 93 | }
|
|---|