Ignore:
Timestamp:
Feb 16, 2009, 10:14:30 AM (15 years ago)
Author:
garnier
Message:

en test de gl2ps. Problemes de libraries

Location:
trunk/source/global/management
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/global/management/include/G4LPhysicsFreeVector.hh

    r850 r921  
    2525//
    2626//
    27 // $Id: G4LPhysicsFreeVector.hh,v 1.10 2008/04/07 14:18:57 gcosmo Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4LPhysicsFreeVector.hh,v 1.11 2008/09/22 08:26:33 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    6262   ~G4LPhysicsFreeVector();
    6363
     64   G4LPhysicsFreeVector(const G4LPhysicsFreeVector&);
     65   G4LPhysicsFreeVector& operator=(const G4LPhysicsFreeVector&);
     66     // Copy constructor and assignment operator.
     67
    6468   void PutValues(size_t binNumber, G4double binValue, G4double dataValue);
    6569     // G4PhysicsVector has PutValue() but it is inconvenient.
  • trunk/source/global/management/include/G4LPhysicsFreeVector.icc

    r850 r921  
    2525//
    2626//
    27 // $Id: G4LPhysicsFreeVector.icc,v 1.11 2008/09/06 19:52:16 vnivanch Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4LPhysicsFreeVector.icc,v 1.13 2008/09/22 08:26:33 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    4040//
    4141// F.W. Jones, TRIUMF, 04-JUN-96
    42 // 05 Sep. 2008, V.Ivanchenko : added protections for zero-length vector
    4342// --------------------------------------------------------------------------
    4443
     
    4948  // Want to simultaneously fill the bin and data vectors.
    5049{
    51   if(binNumber <= numberOfBin) {
    52     binVector[binNumber] = binValue;
    53     dataVector[binNumber]= dataValue;
    54     if(0 == binNumber) edgeMin = binValue;
    55     else if( numberOfBin - 1 == binNumber) edgeMax = binValue;
    56   }
     50   binVector[binNumber] = binValue;
     51   dataVector[binNumber] = dataValue;
     52   if(binNumber == 0)
     53     { edgeMin = binValue; }
     54   else if( numberOfBin - 1 == binNumber)
     55     { edgeMax = binValue; }
    5756}
    5857
  • trunk/source/global/management/include/G4PhysicsFreeVector.hh

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsFreeVector.hh,v 1.10 2006/06/29 19:02:18 gunter Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsFreeVector.hh,v 1.12 2008/09/22 14:49:57 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
  • trunk/source/global/management/include/G4PhysicsLinearVector.hh

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsLinearVector.hh,v 1.10 2006/06/29 19:02:21 gunter Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsLinearVector.hh,v 1.11 2008/09/22 11:37:09 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    7373      // Destructor
    7474
     75    G4PhysicsLinearVector(const G4PhysicsLinearVector&);
     76    G4PhysicsLinearVector& operator=(const G4PhysicsLinearVector&);
     77      // Copy constructor and assignment operator.
     78
    7579    G4bool Retrieve(std::ifstream& fIn, G4bool ascii);
    7680
  • trunk/source/global/management/include/G4PhysicsLnVector.hh

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsLnVector.hh,v 1.12 2006/06/29 19:02:23 gunter Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsLnVector.hh,v 1.13 2008/09/22 11:37:09 vnivanch Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    7070      // Destructor.
    7171
     72    G4PhysicsLnVector(const G4PhysicsLnVector&);
     73    G4PhysicsLnVector& operator=(const G4PhysicsLnVector&);
     74      // Copy constructor and assignment operator.
     75
    7276    G4bool Retrieve(std::ifstream& fIn, G4bool ascii);
    7377      // To retrieve persistent data from file stream.
  • trunk/source/global/management/include/G4PhysicsLogVector.hh

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsLogVector.hh,v 1.11 2006/06/29 19:02:25 gunter Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsLogVector.hh,v 1.13 2008/09/22 08:26:33 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    7575      // Destructor
    7676
     77    G4PhysicsLogVector(const G4PhysicsLogVector&);
     78    G4PhysicsLogVector& operator=(const G4PhysicsLogVector&);
     79      // Copy constructor and assignment operator.
     80     
    7781    G4bool Retrieve(std::ifstream& fIn, G4bool ascii);
    7882      // To retrieve persistent data from file stream.
    79 
     83 
    8084  protected:
    8185
  • trunk/source/global/management/include/G4PhysicsOrderedFreeVector.hh

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsOrderedFreeVector.hh,v 1.9 2006/06/29 19:02:28 gunter Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsOrderedFreeVector.hh,v 1.11 2008/09/22 14:49:57 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
  • trunk/source/global/management/include/G4PhysicsVector.hh

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsVector.hh,v 1.17 2008/04/07 14:18:57 gcosmo Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsVector.hh,v 1.18 2008/09/22 08:26:33 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    144144         // Find the bin# in which theEnergy belongs - pure virtual function
    145145
     146    void DeleteData();
     147    void CopyData(const G4PhysicsVector& vec);
     148         // Internal methods for allowing copy of objects
     149
     150  protected:
     151
    146152    typedef std::vector<G4double> G4PVDataVector;
    147153
  • trunk/source/global/management/include/G4PhysicsVector.icc

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsVector.icc,v 1.14 2008/09/05 18:04:45 vnivanch Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsVector.icc,v 1.17 2008/09/22 08:26:33 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    4141//    energy scale, for example like 'log', 'linear', 'free', etc.
    4242//
    43 // Modified:
    44 // 05 Sep. 2008, V.Ivanchenko : added protections for zero-length vector
    4543//---------------------------------------------------------------
    4644
     
    127125  if( theEnergy == lastEnergy ) {
    128126
    129   } else if( theEnergy <= edgeMin ) {
    130      lastBin = 0;
    131      lastEnergy = theEnergy;
    132      lastValue  = dataVector[0];
    133 
    134127  } else if(theEnergy < lastEnergy && theEnergy >= binVector[lastBin]) {
    135128     lastEnergy = theEnergy;
    136129     Interpolation();
     130
     131  } else if( theEnergy <= edgeMin ) {
     132     lastBin = 0;
     133     lastEnergy = edgeMin;
     134     lastValue  = dataVector[0];
    137135
    138136  } else if(theEnergy < lastEnergy && theEnergy >= binVector[lastBin-1]) {
     
    168166 void G4PhysicsVector::PutValue(size_t binNumber, G4double theValue)
    169167{
    170   if(binNumber < numberOfBin) {
    171     dataVector[binNumber] = theValue;
    172 
    173     // Fill the bin which is hidden to user with theValue. This is to
    174     // handle correctly when Energy=theEmax in getValue.
    175 
    176     if(binNumber==numberOfBin-1) { dataVector[binNumber+1] = theValue; }
    177   }
     168  dataVector[binNumber] = theValue;
     169
     170  // Fill the bin which is hidden to user with theValue. This is to
     171  // handle correctly when Energy=theEmax in getValue.
     172
     173  if(binNumber==numberOfBin-1) { dataVector[binNumber+1] = theValue; }
    178174}
    179175
  • trunk/source/global/management/include/G4Version.hh

    r850 r921  
    2525//
    2626//
    27 // $Id: G4Version.hh,v 1.16 2008/06/26 06:38:51 gcosmo Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4Version.hh,v 1.17 2008/12/02 09:15:58 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030// Version information
     
    5151
    5252#ifndef G4VERSION_TAG
    53 #define G4VERSION_TAG "$Name: HEAD $"
     53#define G4VERSION_TAG "$Name: geant4-09-02-cand-01 $"
    5454#endif
    5555
     
    5858#include "G4String.hh"
    5959
    60 static const G4String G4Version = "$Name: HEAD $";
    61 static const G4String G4Date    = "(4-July-2008)";
     60static const G4String G4Version = "$Name: geant4-09-02-cand-01 $";
     61static const G4String G4Date    = "(19-December-2008)";
    6262
    6363#endif
  • trunk/source/global/management/src/G4LPhysicsFreeVector.cc

    r850 r921  
    2525//
    2626//
    27 // $Id: G4LPhysicsFreeVector.cc,v 1.17 2008/09/06 19:52:16 vnivanch Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4LPhysicsFreeVector.cc,v 1.22 2008/09/22 08:26:33 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    3636// F.W. Jones, TRIUMF, 04-JUN-96
    3737//
    38 // 27-MAR-97 FWJ: first version for Alpha release
    39 // 05-SEP-2008, V.Ivanchenko : added protections for zero-length vector
    4038// --------------------------------------------------------------------
    4139
     
    4947   : G4PhysicsVector(), verboseLevel(0)
    5048{
    51   type = T_G4LPhysicsFreeVector;
     49   type = T_G4LPhysicsFreeVector;
    5250}
    5351
     
    5957  : G4PhysicsVector(), verboseLevel(0)
    6058{
    61   type = T_G4LPhysicsFreeVector;
     59   type = T_G4LPhysicsFreeVector;
    6260   
    63   numberOfBin = nbin;
    64   if(nbin > 0) {
    65     binVector.resize(nbin+1);
    66     dataVector.resize(nbin+1);
    67     edgeMin = binmin;
    68     edgeMax = binmax;
    69     for (size_t i=0; i<=numberOfBin; i++) {
    70       binVector[i] = binmin;
    71       dataVector[i]= 0.0;
    72     }
    73   }
     61   edgeMin = binmin;
     62   edgeMax = binmax;
     63   numberOfBin = nbin;
     64   binVector.reserve(nbin+1);
     65   dataVector.reserve(nbin+1);
     66   for (size_t i=0; i<=numberOfBin; i++)
     67   {
     68     binVector.push_back(0.0);
     69     dataVector.push_back(0.0);
     70   }
    7471
    7572
     
    7875G4LPhysicsFreeVector::~G4LPhysicsFreeVector()
    7976{
     77}
     78
     79// --------------------------------------------------------------------
     80
     81G4LPhysicsFreeVector::G4LPhysicsFreeVector(const G4LPhysicsFreeVector& right)
     82  : G4PhysicsVector(right)
     83{
     84  verboseLevel = right.verboseLevel;
     85}
     86
     87// --------------------------------------------------------------------
     88
     89G4LPhysicsFreeVector&
     90G4LPhysicsFreeVector::operator=(const G4LPhysicsFreeVector& right)
     91{
     92  // Check assignment to self
     93  //
     94  if(this == &right) { return *this; }
     95
     96  DeleteData();
     97  CopyData(right);
     98
     99  verboseLevel = right.verboseLevel;
     100  return *this;
    80101}
    81102
  • trunk/source/global/management/src/G4PhysicsFreeVector.cc

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsFreeVector.cc,v 1.10 2006/06/29 19:04:10 gunter Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsFreeVector.cc,v 1.12 2008/09/22 14:49:57 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    4747
    4848
    49 G4PhysicsFreeVector::G4PhysicsFreeVector()
     49G4PhysicsFreeVector::G4PhysicsFreeVector()
     50  : G4PhysicsVector()
    5051{
    51   edgeMin = 0.0;
    52   edgeMax = 0.0;
    53   numberOfBin = 0;
    5452  type = T_G4PhysicsFreeVector;
    5553}
    5654
    57 
    5855G4PhysicsFreeVector::G4PhysicsFreeVector(size_t theNbin)
     56  : G4PhysicsVector()
    5957{
    6058  type = T_G4PhysicsFreeVector;
     
    7169     dataVector.push_back(0.0);
    7270  }
    73 
    74   edgeMin = 0.;
    75   edgeMax = 0.;
    76 
    77   lastBin = INT_MAX;
    78   lastEnergy = -DBL_MAX;
    79   lastValue = DBL_MAX;
    8071
    81 
    8272
    8373G4PhysicsFreeVector::G4PhysicsFreeVector(const G4DataVector& theBinVector,
     
    111101  edgeMin = binVector[0];
    112102  edgeMax = binVector[numberOfBin-1];
    113 
    114   lastBin = INT_MAX;
    115   lastEnergy = -DBL_MAX;
    116   lastValue = DBL_MAX;
    117103
    118104
    119 
    120 G4PhysicsFreeVector::~G4PhysicsFreeVector(){}
    121 
     105G4PhysicsFreeVector::~G4PhysicsFreeVector()
     106{
     107}
    122108
    123109void G4PhysicsFreeVector::PutValue( size_t theBinNumber, G4double theBinValue,
  • trunk/source/global/management/src/G4PhysicsLinearVector.cc

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsLinearVector.cc,v 1.12 2006/06/29 19:04:13 gunter Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsLinearVector.cc,v 1.14 2008/09/22 14:49:57 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    3434//  G4PhysicsLinearVector.cc
    3535//
    36 //  History:
    37 //    02 Dec. 1995, G.Cosmo : Structure created based on object model
    38 //    15 Feb. 1996, K.Amako : Implemented the 1st version
    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 //    9  Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve
     36//  15 Feb 1996 - K.Amako : 1st version
    4437//
    4538//--------------------------------------------------------------------
     
    4841
    4942G4PhysicsLinearVector::G4PhysicsLinearVector()
    50   : dBin(0.), baseBin(0.)
     43  : G4PhysicsVector(), dBin(0.), baseBin(0.)
    5144{
    52   edgeMin = 0.0;
    53   edgeMax = 0.0;
    54   numberOfBin = 0;
    5545  type = T_G4PhysicsLinearVector;
    5646}
    5747
    5848G4PhysicsLinearVector::G4PhysicsLinearVector(size_t theNbin)
    59   : dBin(0.), baseBin(0.)
     49  : G4PhysicsVector(), dBin(0.), baseBin(0.)
    6050{
    6151  type = T_G4PhysicsLinearVector;
     
    6858  numberOfBin = theNbin;
    6959
    70   edgeMin = 0.;
    71   edgeMax = 0.;
    72 
    73   lastBin = INT_MAX;
    74   lastEnergy = -DBL_MAX;
    75   lastValue = DBL_MAX;
    76 
    7760  for (size_t i=0; i<=numberOfBin; i++)
    7861  {
     
    8467G4PhysicsLinearVector::G4PhysicsLinearVector(G4double theEmin,
    8568                                             G4double theEmax, size_t theNbin)
    86   : dBin((theEmax-theEmin)/theNbin),
     69  : G4PhysicsVector(),
     70    dBin((theEmax-theEmin)/theNbin),
    8771    baseBin(theEmin/dBin)
    8872{
     
    10589  edgeMax = binVector[numberOfBin-1];
    10690
    107   lastBin = INT_MAX;
    108   lastEnergy = -DBL_MAX;
    109   lastValue = DBL_MAX;
    11091
    11192
     
    123104  return success;
    124105}
     106
     107G4PhysicsLinearVector::G4PhysicsLinearVector(const G4PhysicsLinearVector& right)
     108  : G4PhysicsVector(right)
     109{
     110  dBin = right.dBin;
     111  baseBin = right.baseBin;
     112}
     113
     114G4PhysicsLinearVector&
     115G4PhysicsLinearVector::operator=(const G4PhysicsLinearVector& right)
     116{
     117  // Check assignment to self
     118  //
     119  if(this == &right) { return *this; }
     120
     121  DeleteData();
     122  CopyData(right);
     123
     124  dBin    = right.dBin;
     125  baseBin = right.baseBin;
     126  return *this;
     127}
  • trunk/source/global/management/src/G4PhysicsLnVector.cc

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsLnVector.cc,v 1.15 2006/06/29 19:04:15 gunter Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsLnVector.cc,v 1.17 2008/09/22 14:49:57 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    3434//  G4PhysicsLnVector.cc
    3535//
    36 //  History:
    37 //    27 Apr. 1999, M.G. Pia: Created, copying from G4PhysicsLogVector
    38 //    11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector
    39 //    9  Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve
     36//  27 Apr 1999 - M.G.Pia: Created from G4PhysicsLogVector
    4037//
    4138// --------------------------------------------------------------
     
    4441
    4542G4PhysicsLnVector::G4PhysicsLnVector()
    46   : dBin(0.), baseBin(0.)
     43  : G4PhysicsVector(), dBin(0.), baseBin(0.)
    4744{
    4845  type = T_G4PhysicsLnVector;
     
    5047
    5148G4PhysicsLnVector::G4PhysicsLnVector(size_t theNbin)
    52   : dBin(0.), baseBin(0.)
     49  : G4PhysicsVector(), dBin(0.), baseBin(0.)
    5350{
    5451  type = T_G4PhysicsLnVector;
     
    6158  numberOfBin = theNbin;
    6259
    63   edgeMin = 0.;
    64   edgeMax = 0.;
    65 
    66   lastBin = INT_MAX;
    67   lastEnergy = -DBL_MAX;
    68   lastValue = DBL_MAX;
    69 
    7060  for (size_t i=0; i<=numberOfBin; i++)
    7161  {
     
    7767G4PhysicsLnVector::G4PhysicsLnVector(G4double theEmin,
    7868                                     G4double theEmax, size_t theNbin)
    79   : dBin(std::log(theEmax/theEmin)/theNbin),
     69  : G4PhysicsVector(),
     70    dBin(std::log(theEmax/theEmin)/theNbin),
    8071    baseBin(std::log(theEmin)/dBin)
    8172{
     
    9788  edgeMin = binVector[0];
    9889  edgeMax = binVector[numberOfBin-1];
    99 
    100   lastBin = INT_MAX;
    101   lastEnergy = -DBL_MAX;
    102   lastValue = DBL_MAX;
    10390}
    10491
     
    116103  return success;
    117104}
     105
     106G4PhysicsLnVector::G4PhysicsLnVector(const G4PhysicsLnVector& right)
     107  : G4PhysicsVector(right)
     108{
     109  dBin = right.dBin;
     110  baseBin = right.baseBin;
     111}
     112
     113G4PhysicsLnVector&
     114G4PhysicsLnVector::operator=(const G4PhysicsLnVector& right)
     115{
     116  // Check assignment to self
     117  //
     118  if(this == &right) { return *this; }
     119
     120  DeleteData();
     121  CopyData(right);
     122
     123  dBin    = right.dBin;
     124  baseBin = right.baseBin;
     125  return *this;
     126}
  • trunk/source/global/management/src/G4PhysicsLogVector.cc

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsLogVector.cc,v 1.16 2008/09/06 19:52:16 vnivanch Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsLogVector.cc,v 1.21 2008/09/22 08:26:33 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    4040//    26 Sep. 1996, K.Amako : Constructor with only 'bin size' added
    4141//    11 Nov. 2000, H.Kurashige : use STL vector for dataVector and binVector
    42 //    9  Mar. 2001, H.Kurashige : add PhysicsVector type and Retrieve
     42//    9  Mar. 2001, H.Kurashige : added PhysicsVector type and Retrieve
    4343//    05 Sep. 2008, V.Ivanchenko : added protections for zero-length vector
    4444//
     
    6060  // Add extra one bin (hidden to user) to handle correctly when
    6161  // Energy=theEmax in getValue.
     62  dataVector.reserve(theNbin+1);
     63  binVector.reserve(theNbin+1);
    6264
    6365  numberOfBin = theNbin;
    6466
    65   if(numberOfBin > 0) {
    66     dataVector.resize(theNbin+1);
    67     binVector.resize(theNbin+1);
    68     edgeMin = 1;
    69     edgeMax = numberOfBin;
    70     for (size_t i=0; i<=numberOfBin; i++) {
    71       binVector[i] = i + 1;
    72       dataVector[i]= 0.0;
    73     }
     67  for (size_t i=0; i<=numberOfBin; i++)
     68  {
     69     binVector.push_back(0.0);
     70     dataVector.push_back(0.0);
    7471  }
    7572
     
    8481  // Add extra one bin (hidden to user) to handle correctly when
    8582  // Energy=theEmax in getValue.
    86   dataVector.resize(theNbin+1);
    87   binVector.resize(theNbin+1);
     83  dataVector.reserve(theNbin+1);
     84  binVector.reserve(theNbin+1);
    8885
    8986  numberOfBin = theNbin;
    9087
    91   if(numberOfBin > 0) {
    92     for (size_t i=0; i<=numberOfBin; i++) {
    93       binVector[i] = std::pow(10., std::log10(theEmin)+i*dBin);
    94       dataVector[i]= 0.0;
    95     }
    96     edgeMin = binVector[0];
    97     edgeMax = binVector[numberOfBin-1];
     88  for (size_t i=0; i<numberOfBin+1; i++)
     89  {
     90    binVector.push_back(std::pow(10., std::log10(theEmin)+i*dBin));
     91    dataVector.push_back(0.0);
    9892  }
     93  edgeMin = binVector[0];
     94  edgeMax = binVector[numberOfBin-1];
    9995
    10096
    101 G4PhysicsLogVector::~G4PhysicsLogVector(){}
     97G4PhysicsLogVector::~G4PhysicsLogVector()
     98{
     99}
    102100
    103101G4bool G4PhysicsLogVector::Retrieve(std::ifstream& fIn, G4bool ascii)
     
    112110  return success;
    113111}
     112
     113G4PhysicsLogVector::G4PhysicsLogVector(const G4PhysicsLogVector& right)
     114  : G4PhysicsVector(right)
     115{
     116  dBin = right.dBin;
     117  baseBin = right.baseBin;
     118}
     119
     120G4PhysicsLogVector&
     121G4PhysicsLogVector::operator=(const G4PhysicsLogVector& right)
     122{
     123  // Check assignment to self
     124  //
     125  if(this == &right) { return *this; }
     126
     127  DeleteData();
     128  CopyData(right);
     129
     130  dBin    = right.dBin;
     131  baseBin = right.baseBin;
     132  return *this;
     133}
  • trunk/source/global/management/src/G4PhysicsOrderedFreeVector.cc

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsOrderedFreeVector.cc,v 1.10 2006/06/29 19:04:20 gunter Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsOrderedFreeVector.cc,v 1.12 2008/09/22 14:49:57 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030////////////////////////////////////////////////////////////////////////
     
    6161                                                       G4double *Values,
    6262                                                       size_t VectorLength)
     63  : G4PhysicsVector()
    6364{
    6465        type = T_G4PhysicsOrderedFreeVector;
    6566
    66         lastBin = INT_MAX;
    67 
    68         lastEnergy = -DBL_MAX;
    69         lastValue = DBL_MAX;
    70 
     67        dataVector.reserve(VectorLength+1);
     68        binVector.reserve(VectorLength+1);
    7169        numberOfBin = VectorLength;
    7270
     
    7876        edgeMin = binVector.front();
    7977        edgeMax = binVector.back();
     78        binVector.push_back ( binVector[numberOfBin-1] + 1.0 );
     79        dataVector.push_back( dataVector[numberOfBin-1] );
    8080}
    8181
    8282G4PhysicsOrderedFreeVector::G4PhysicsOrderedFreeVector()
     83  : G4PhysicsVector()
    8384{
    8485        type = T_G4PhysicsOrderedFreeVector;
    85 
    86         lastBin = INT_MAX;
    87         lastEnergy = -DBL_MAX;
    88         lastValue = DBL_MAX;
    89 
    90         edgeMin = 0.0;
    91         edgeMax = 0.0;
    92         numberOfBin = 0;
    9386}
    9487
  • trunk/source/global/management/src/G4PhysicsVector.cc

    r850 r921  
    2525//
    2626//
    27 // $Id: G4PhysicsVector.cc,v 1.22 2008/09/05 18:04:45 vnivanch Exp $
    28 // GEANT4 tag $Name: HEAD $
     27// $Id: G4PhysicsVector.cc,v 1.27 2008/10/16 12:14:36 gcosmo Exp $
     28// GEANT4 tag $Name: geant4-09-02-cand-01 $
    2929//
    3030//
     
    5252G4PhysicsVector::G4PhysicsVector(G4bool spline)
    5353 : type(T_G4PhysicsVector),
    54    edgeMin(DBL_MAX), edgeMax(0.), numberOfBin(0),
     54   edgeMin(0.), edgeMax(0.), numberOfBin(0),
    5555   lastEnergy(0.), lastValue(0.), lastBin(0),
    5656   secDerivative(0), useSpline(spline)
    57 {
    58   binVector.push_back(edgeMin);
    59   dataVector.push_back(0.0);
    60 }
     57{}
    6158
    6259// --------------------------------------------------------------
     
    6461G4PhysicsVector::~G4PhysicsVector()
    6562{
    66   delete [] secDerivative;
     63  DeleteData();
    6764}
    6865
     
    7168G4PhysicsVector::G4PhysicsVector(const G4PhysicsVector& right)
    7269{
    73   *this=right;
     70  CopyData(right);
    7471}
    7572
     
    8178  if (type != right.type)  { return *this; }
    8279
    83   type = right.type;
    84   edgeMin = right.edgeMin;
    85   edgeMax = right.edgeMax;
    86   numberOfBin = right.numberOfBin;
    87   lastEnergy = right.lastEnergy;
    88   lastValue = right.lastValue;
    89   lastBin = right.lastBin;
    90   dataVector = right.dataVector;
    91   binVector = right.binVector;
    92   secDerivative = right.secDerivative;
    93   useSpline = right.useSpline;
    94   comment = right.comment;
     80  DeleteData();
     81  CopyData(right);
     82
    9583  return *this;
    9684}
     
    10896{
    10997  return (this != &right);
     98}
     99
     100// --------------------------------------------------------------
     101
     102void G4PhysicsVector::DeleteData()
     103{
     104  delete [] secDerivative;
     105  secDerivative = 0;
     106}
     107
     108// --------------------------------------------------------------
     109
     110void G4PhysicsVector::CopyData(const G4PhysicsVector& vec)
     111{
     112  type = vec.type;
     113  edgeMin = vec.edgeMin;
     114  edgeMax = vec.edgeMax;
     115  numberOfBin = vec.numberOfBin;
     116  lastEnergy = vec.lastEnergy;
     117  lastValue = vec.lastValue;
     118  lastBin = vec.lastBin;
     119  dataVector = vec.dataVector;
     120  binVector = vec.binVector;
     121  useSpline = vec.useSpline;
     122  comment = vec.comment;
     123  if (vec.secDerivative)
     124  {
     125    secDerivative = new G4double [numberOfBin];
     126    for (size_t i=0; i<numberOfBin; i++)
     127    {
     128       secDerivative[i] = vec.secDerivative[i];
     129    }
     130  }
     131  else
     132  {
     133    secDerivative = 0;
     134  }
    110135}
    111136
     
    224249  secDerivative = new G4double [numberOfBin];
    225250
    226   secDerivative[0] = 0.0 ;
     251  size_t n = numberOfBin-1;
    227252
    228253  // cannot compute derivatives for less than 3 points
    229   if(3 > numberOfBin) {
    230     secDerivative[numberOfBin-1] = 0.0 ;
     254  if(3 > numberOfBin)
     255  {
     256    secDerivative[0] = 0.0;
     257    secDerivative[n] = 0.0;
    231258    return;
    232259  }
    233260
    234   G4double* u = new G4double [numberOfBin];
    235   u[0] = 0.0 ;
    236    
    237   // Decomposition loop for tridiagonal algorithm. secDerivative[i]
    238   // and u[i] are used for temporary storage of the decomposed factors.
    239    
    240   for(size_t i=1; i<numberOfBin-1; i++)
    241   {
    242     G4double sig = (binVector[i]-binVector[i-1])
    243                  / (binVector[i+1]-binVector[i-1]) ;
    244     G4double p = sig*secDerivative[i-1] + 2.0 ;
    245     secDerivative[i] = (sig - 1.0)/p ;
    246     u[i] = (dataVector[i+1]-dataVector[i])/(binVector[i+1]-binVector[i])
    247          - (dataVector[i]-dataVector[i-1])/(binVector[i]-binVector[i-1]) ;
    248     u[i] =(6.0*u[i]/(binVector[i+1]-binVector[i-1]) - sig*u[i-1])/p ;
    249   }
    250 
    251   G4double qn = 0.0 ;
    252   G4double un = 0.0 ;
    253 
    254   secDerivative[numberOfBin-1] = (un - qn*u[numberOfBin-2])
    255                                / (qn*secDerivative[numberOfBin-2] + 1.0) ;
    256    
    257   // The back-substitution loop for the triagonal algorithm of solving
    258   // a linear system of equations.
    259    
    260   for(G4int k=numberOfBin-2; k>=0; k--)
    261   {
    262     secDerivative[k] = secDerivative[k]*secDerivative[k+1] + u[k];
    263   }
    264   delete [] u;
     261  for(size_t i=1; i<n; i++)
     262  {
     263    secDerivative[i] =
     264      3.0*((dataVector[i+1]-dataVector[i])/(binVector[i+1]-binVector[i]) -
     265           (dataVector[i]-dataVector[i-1])/(binVector[i]-binVector[i-1]))
     266      /(binVector[i+1]-binVector[i-1]);
     267  }
     268  secDerivative[n] = secDerivative[n-1];
     269  secDerivative[0] = secDerivative[1];
    265270}
    266271   
Note: See TracChangeset for help on using the changeset viewer.