[833] | 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 | // |
---|
[1193] | 27 | // $Id: G4PhysicsFreeVector.cc,v 1.13 2009/06/25 10:05:26 vnivanch Exp $ |
---|
[1228] | 28 | // GEANT4 tag $Name: geant4-09-03 $ |
---|
[833] | 29 | // |
---|
| 30 | // |
---|
| 31 | //-------------------------------------------------------------------- |
---|
| 32 | // GEANT 4 class implementation file |
---|
| 33 | // |
---|
| 34 | // G4PhysicsFreeVector.cc |
---|
| 35 | // |
---|
| 36 | // History: |
---|
| 37 | // 02 Dec. 1995, G.Cosmo : Structure created based on object model |
---|
| 38 | // 06 June 1996, K.Amako : The 1st version of implemented |
---|
| 39 | // 01 Jul. 1996, K.Amako : Cache mechanism and hidden bin from the |
---|
| 40 | // user introduced |
---|
| 41 | // 26 Sep. 1996, K.Amako : Constructor with only 'bin size' added |
---|
| 42 | // 11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector |
---|
[1193] | 43 | // 19 Jun. 2009, V.Ivanchenko : removed hidden bin |
---|
[833] | 44 | // |
---|
| 45 | //-------------------------------------------------------------------- |
---|
| 46 | |
---|
| 47 | #include "G4PhysicsFreeVector.hh" |
---|
| 48 | |
---|
| 49 | |
---|
[921] | 50 | G4PhysicsFreeVector::G4PhysicsFreeVector() |
---|
| 51 | : G4PhysicsVector() |
---|
[833] | 52 | { |
---|
| 53 | type = T_G4PhysicsFreeVector; |
---|
| 54 | } |
---|
| 55 | |
---|
| 56 | G4PhysicsFreeVector::G4PhysicsFreeVector(size_t theNbin) |
---|
[921] | 57 | : G4PhysicsVector() |
---|
[833] | 58 | { |
---|
| 59 | type = T_G4PhysicsFreeVector; |
---|
[1193] | 60 | numberOfNodes = theNbin; |
---|
[833] | 61 | |
---|
[1193] | 62 | dataVector.reserve(numberOfNodes); |
---|
| 63 | binVector.reserve(numberOfNodes); |
---|
[833] | 64 | |
---|
[1193] | 65 | for (size_t i=0; i<numberOfNodes; i++) |
---|
[833] | 66 | { |
---|
| 67 | binVector.push_back(0.0); |
---|
| 68 | dataVector.push_back(0.0); |
---|
| 69 | } |
---|
| 70 | } |
---|
| 71 | |
---|
| 72 | G4PhysicsFreeVector::G4PhysicsFreeVector(const G4DataVector& theBinVector, |
---|
| 73 | const G4DataVector& theDataVector) |
---|
| 74 | { |
---|
| 75 | type = T_G4PhysicsFreeVector; |
---|
[1193] | 76 | numberOfNodes = theBinVector.size(); |
---|
[833] | 77 | |
---|
[1193] | 78 | dataVector.reserve(numberOfNodes); |
---|
| 79 | binVector.reserve(numberOfNodes); |
---|
[833] | 80 | |
---|
[1193] | 81 | for (size_t i=0; i<numberOfNodes; i++) |
---|
[833] | 82 | { |
---|
| 83 | binVector.push_back(theBinVector[i]); |
---|
| 84 | dataVector.push_back(theDataVector[i]); |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | edgeMin = binVector[0]; |
---|
[1193] | 88 | edgeMax = binVector[numberOfNodes-1]; |
---|
[833] | 89 | } |
---|
| 90 | |
---|
[921] | 91 | G4PhysicsFreeVector::~G4PhysicsFreeVector() |
---|
| 92 | { |
---|
| 93 | } |
---|
[833] | 94 | |
---|
| 95 | void G4PhysicsFreeVector::PutValue( size_t theBinNumber, G4double theBinValue, |
---|
| 96 | G4double theDataValue ) |
---|
| 97 | { |
---|
| 98 | binVector[theBinNumber] = theBinValue; |
---|
| 99 | dataVector[theBinNumber] = theDataValue; |
---|
| 100 | |
---|
[1193] | 101 | if( theBinNumber == numberOfNodes-1 ) |
---|
[833] | 102 | { |
---|
[1193] | 103 | edgeMax = binVector[numberOfNodes-1]; |
---|
[833] | 104 | } |
---|
| 105 | |
---|
| 106 | if( theBinNumber == 0 ) |
---|
| 107 | { |
---|
| 108 | edgeMin = binVector[0]; |
---|
| 109 | } |
---|
| 110 | } |
---|