| 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: G4PhysicsFreeVector.cc,v 1.15 2010/05/28 05:13:43 kurasige Exp $
|
|---|
| 28 | // GEANT4 tag $Name: geant4-09-04-beta-01 $
|
|---|
| 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
|
|---|
| 43 | // 19 Jun. 2009, V.Ivanchenko : removed hidden bin
|
|---|
| 44 | //
|
|---|
| 45 | //--------------------------------------------------------------------
|
|---|
| 46 |
|
|---|
| 47 | #include "G4PhysicsFreeVector.hh"
|
|---|
| 48 |
|
|---|
| 49 |
|
|---|
| 50 | G4PhysicsFreeVector::G4PhysicsFreeVector()
|
|---|
| 51 | : G4PhysicsVector()
|
|---|
| 52 | {
|
|---|
| 53 | type = T_G4PhysicsFreeVector;
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 | G4PhysicsFreeVector::G4PhysicsFreeVector(size_t theNbin)
|
|---|
| 57 | : G4PhysicsVector()
|
|---|
| 58 | {
|
|---|
| 59 | type = T_G4PhysicsFreeVector;
|
|---|
| 60 | numberOfNodes = theNbin;
|
|---|
| 61 |
|
|---|
| 62 | dataVector.reserve(numberOfNodes);
|
|---|
| 63 | binVector.reserve(numberOfNodes);
|
|---|
| 64 |
|
|---|
| 65 | for (size_t i=0; i<numberOfNodes; i++)
|
|---|
| 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;
|
|---|
| 76 | numberOfNodes = theBinVector.size();
|
|---|
| 77 |
|
|---|
| 78 | dataVector.reserve(numberOfNodes);
|
|---|
| 79 | binVector.reserve(numberOfNodes);
|
|---|
| 80 |
|
|---|
| 81 | for (size_t i=0; i<numberOfNodes; i++)
|
|---|
| 82 | {
|
|---|
| 83 | binVector.push_back(theBinVector[i]);
|
|---|
| 84 | dataVector.push_back(theDataVector[i]);
|
|---|
| 85 | }
|
|---|
| 86 |
|
|---|
| 87 | edgeMin = binVector[0];
|
|---|
| 88 | edgeMax = binVector[numberOfNodes-1];
|
|---|
| 89 | }
|
|---|
| 90 |
|
|---|
| 91 | G4PhysicsFreeVector::~G4PhysicsFreeVector()
|
|---|
| 92 | {
|
|---|
| 93 | }
|
|---|
| 94 |
|
|---|
| 95 | void G4PhysicsFreeVector::PutValue( size_t theBinNumber,
|
|---|
| 96 | G4double theBinValue,
|
|---|
| 97 | G4double theDataValue )
|
|---|
| 98 | {
|
|---|
| 99 | binVector[theBinNumber] = theBinValue;
|
|---|
| 100 | dataVector[theBinNumber] = theDataValue;
|
|---|
| 101 |
|
|---|
| 102 | if( theBinNumber == numberOfNodes-1 )
|
|---|
| 103 | {
|
|---|
| 104 | edgeMax = binVector[numberOfNodes-1];
|
|---|
| 105 | }
|
|---|
| 106 |
|
|---|
| 107 | if( theBinNumber == 0 )
|
|---|
| 108 | {
|
|---|
| 109 | edgeMin = binVector[0];
|
|---|
| 110 | }
|
|---|
| 111 | }
|
|---|