Import Geant4 4.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 16:18:25 +02:00
parent 36c080dca6
commit 921d3b1cda
3990 changed files with 185376 additions and 82884 deletions
@@ -0,0 +1,112 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4DataVector.cc,v 1.3 2001/11/29 18:59:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 class implementation file
//
// G4DataVector.cc
//
// History:
// 18 Sep. 2001, H.Kurashige : Structure created based on object model
// --------------------------------------------------------------
#include "G4DataVector.hh"
#include "g4std/iomanip"
G4bool G4DataVector::Store(G4std::ofstream& fOut, G4bool ascii)
{
// Ascii mode
if (ascii) {
fOut << *this;
return true;
}
// Binary Mode
size_t sizeV = size();
fOut.write((char*)(&sizeV), sizeof sizeV);
G4double* value = new G4double[sizeV];
size_t i=0;
for (const_iterator itr=begin(); itr!=end(); itr++, i++){
value[i] = *itr;
}
fOut.write((char*)(value), sizeV*(sizeof (G4double)) );
delete [] value;
return true;
}
G4bool G4DataVector::Retrieve(G4std::ifstream& fIn, G4bool ascii)
{
clear();
size_t sizeV;
// retrieve in ascii mode
if (ascii) {
// contents
fIn >> sizeV;
if (fIn.fail()) return false;
reserve(sizeV);
for(size_t i = 0; i < sizeV ; i++) {
G4double vData;
fIn >> vData;
if (fIn.fail()) return false;
push_back(vData);
}
return true ;
}
// retrieve in binary mode
fIn.read((char*)(&sizeV), sizeof sizeV);
G4double* value = new G4double[sizeV];
fIn.read((char*)(value), sizeV*(sizeof(G4double)) );
if (G4int(fIn.gcount()) != G4int(sizeV*(sizeof(G4double))) ){
delete [] value;
return false;
}
reserve(sizeV);
for(size_t i = 0; i < sizeV; i++) {
push_back(value[i]);
}
delete [] value;
return true;
}
G4std::ostream& operator<<(G4std::ostream& out, const G4DataVector& pv)
{
size_t i;
out << pv.size() << G4endl;
for(i = 0; i < pv.size(); i++) {
out << G4std::setprecision(12) << pv[i] << G4endl;
}
return out;
}
+10 -6
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Exception.cc,v 1.9.4.1 2001/06/28 19:10:05 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Exception.cc,v 1.12 2001/10/11 14:04:12 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ----------------------------------------------------------------------
@@ -36,7 +36,7 @@
#include "G4ios.hh"
#include <stdlib.h>
#include "g4rw/cstring.h"
#include "G4String.hh"
#include "G4StateManager.hh"
void G4Exception(const char* s)
@@ -45,9 +45,13 @@ void G4Exception(const char* s)
{
G4cerr << s << G4endl;
}
G4cerr << G4endl << "*** G4Exception: Aborting execution ***" << G4endl;
G4StateManager::GetStateManager()->SetNewState(Abort);
abort();
if(G4StateManager::GetStateManager()->SetNewState(Abort)) {
G4cerr << G4endl << "*** G4Exception: Aborting execution ***" << G4endl;
abort();
} else {
G4cerr << G4endl << "*** G4Exception: Abortion suppressed ***"
<< G4endl << "*** No guarantee for further execution ***" << G4endl;
}
}
void G4Exception(G4std::string s)
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4LPhysicsFreeVector.cc,v 1.7.2.1 2001/06/28 19:10:05 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4LPhysicsFreeVector.cc,v 1.8 2001/07/11 10:00:56 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// --------------------------------------------------------------------
@@ -0,0 +1,177 @@
//
// ********************************************************************
// * DISCLAIMER *
// * *
// * The following disclaimer summarizes all the specific disclaimers *
// * of contributors to this software. The specific disclaimers,which *
// * govern, are listed with their locations in: *
// * http://cern.ch/geant4/license *
// * *
// * Neither the authors of this software system, nor their employing *
// * institutes,nor the agencies providing financial support for this *
// * work make any representation or warranty, express or implied, *
// * regarding this software system or assume any liability for its *
// * use. *
// * *
// * This code implementation is the intellectual property of the *
// * GEANT4 collaboration. *
// * By copying, distributing or modifying the Program (or any work *
// * based on the Program) you indicate your acceptance of this *
// * statement, and all its terms. *
// ********************************************************************
//
//
// $Id: G4OrderedTable.cc,v 1.1 2001/09/17 08:17:58 kurasige Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class implementation
//
// G4OrderedTable
//
// ------------------------------------------------------------
#include "G4DataVector.hh"
#include "G4OrderedTable.hh"
#include "g4std/iostream"
#include "g4std/fstream"
#include "g4std/iomanip"
G4bool G4OrderedTable::Store(const G4String& fileName,
G4bool ascii)
{
G4std::ofstream fOut;
// open output file //
#ifdef G4USE_STD_NAMESPACE
if (!ascii)
fOut.open(fileName, G4std::ios::out|G4std::ios::binary);
else
#endif
fOut.open(fileName, G4std::ios::out);
// check if the file has been opened successfully
if (!fOut) {
#ifdef G4VERBOSE
G4cerr << "G4OrderedTable::::Store ";
G4cerr << " Can not open file " << fileName << G4endl;
#endif
fOut.close();
return false;
}
// Number of elements
size_t tableSize = size();
if (!ascii){
fOut.write( (char*)(&tableSize), sizeof tableSize);
} else {
fOut << tableSize << G4endl;
}
// Data Vector
G4OrderedTableIterator itr;
G4int vType = G4DataVector::T_G4DataVector;
for (itr=begin(); itr!=end(); ++itr) {
if (!ascii){
fOut.write( (char*)(&vType), sizeof vType);
} else {
fOut << vType << G4endl;
}
(*itr)->Store(fOut,ascii);
}
fOut.close();
return true;
}
G4bool G4OrderedTable::Retrieve(const G4String& fileName,
G4bool ascii)
{
G4std::ifstream fIn;
// open input file //
#ifdef G4USE_STD_NAMESPACE
if (ascii)
fIn.open(fileName,G4std::ios::in|G4std::ios::binary);
else
#endif
fIn.open(fileName,G4std::ios::in);
// check if the file has been opened successfully
if (!fIn) {
#ifdef G4VERBOSE
G4cerr << "G4OrderedTable::Retrieve ";
G4cerr << " Can not open file " << fileName << G4endl;
#endif
fIn.close();
return false;
}
// clear
clearAndDestroy();
// Number of elements
size_t tableSize;
if (!ascii){
fIn.read((char*)(&tableSize), sizeof tableSize);
} else {
fIn >> tableSize;
}
reserve(tableSize);
// Physics Vector
for (size_t idx=0; idx<tableSize; ++idx) {
G4int vType;
if (!ascii){
fIn.read( (char*)(&vType), sizeof vType);
} else {
fIn >> vType;
}
if (vType != G4DataVector::T_G4DataVector) {
#ifdef G4VERBOSE
G4cerr << "G4OrderedTable::Retrieve ";
G4cerr << " illegal Data Vector type " << vType << " in ";
G4cerr << fileName << G4endl;
#endif
fIn.close();
return false;
}
G4DataVector* pVec = new G4DataVector;
if (! (pVec->Retrieve(fIn,ascii)) ){
#ifdef G4VERBOSE
G4cerr << "G4OrderedTable::Retrieve ";
G4cerr << " error in retreiving " << idx << "-th Physics Vector from file ";
G4cerr << fileName << G4endl;
#endif
fIn.close();
return false;
}
// add a PhysicsVector to this OrderedTable
push_back(pVec);
}
fIn.close();
return true;
}
G4std::ostream& operator<<(G4std::ostream& out,
G4OrderedTable& right)
{
// Printout Data Vector
G4OrderedTableIterator itr;
size_t i=0;
for (itr=right.begin(); itr!=right.end(); ++itr) {
out << G4std::setw(8) << i << "-th Vector ";
out << ": Type " << G4DataVector::T_G4DataVector << G4endl;
out << *(*itr);
i +=1;
}
out << G4endl;
return out;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicsFreeVector.cc,v 1.7.2.1 2001/06/28 19:10:05 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PhysicsFreeVector.cc,v 1.8 2001/07/11 10:00:57 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//--------------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicsLinearVector.cc,v 1.8.2.1 2001/06/28 19:10:05 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PhysicsLinearVector.cc,v 1.9 2001/07/11 10:00:57 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
//--------------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicsLnVector.cc,v 1.10.2.1 2001/06/28 19:10:05 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PhysicsLnVector.cc,v 1.11 2001/07/11 10:00:57 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// --------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicsLogVector.cc,v 1.8.2.1 2001/06/28 19:10:05 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PhysicsLogVector.cc,v 1.9 2001/07/11 10:00:57 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// --------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicsOrderedFreeVector.cc,v 1.7.2.1 2001/06/28 19:10:05 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PhysicsOrderedFreeVector.cc,v 1.8 2001/07/11 10:00:57 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
////////////////////////////////////////////////////////////////////////
// PhysicsOrderedFreeVector Class Implementation
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicsTable.cc,v 1.5.2.1 2001/06/28 19:10:05 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PhysicsTable.cc,v 1.6 2001/07/11 10:00:58 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ------------------------------------------------------------
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4PhysicsVector.cc,v 1.11.2.1 2001/06/28 19:10:05 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4PhysicsVector.cc,v 1.14 2001/11/29 18:59:35 gcosmo Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// --------------------------------------------------------------
@@ -169,7 +169,7 @@ G4bool G4PhysicsVector::Retrieve(G4std::ifstream& fIn, G4bool ascii)
G4double* value = new G4double[2*size];
fIn.read((char*)(value), 2*size*(sizeof(G4double)) );
if (fIn.gcount() != 2*size*(sizeof(G4double)) ){
if (G4int(fIn.gcount()) != G4int(2*size*(sizeof(G4double))) ){
delete [] value;
return false;
}
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4StateManager.cc,v 1.3.2.2 2001/06/28 20:18:54 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4StateManager.cc,v 1.5 2001/07/18 17:59:23 asaim Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ------------------------------------------------------------
@@ -40,7 +40,8 @@ G4StateManager* G4StateManager::theStateManager = 0;
G4StateManager::G4StateManager()
: theCurrentState(PreInit),
thePreviousState(PreInit),
theBottomDependent(0)
theBottomDependent(0),
suppressAbortion(0)
{
}
@@ -159,6 +160,10 @@ G4StateManager::GetPreviousState() const
G4bool
G4StateManager::SetNewState(G4ApplicationState requestedState)
{
if(requestedState==Abort && suppressAbortion>0) {
if(suppressAbortion==2) return false;
if(theCurrentState==EventProc) return false;
}
size_t i=0;
G4bool ack = true;
G4ApplicationState savedState = thePreviousState;
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4Timer.cc,v 1.8.4.1 2001/06/28 19:10:06 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4Timer.cc,v 1.9 2001/07/11 10:00:59 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ----------------------------------------------------------------------
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4UnitsTable.cc,v 1.14.2.1 2001/06/28 19:10:06 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4UnitsTable.cc,v 1.15 2001/07/11 10:00:59 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4VStateDependent.cc,v 1.2.4.2 2001/06/28 20:18:54 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4VStateDependent.cc,v 1.3 2001/07/11 10:00:59 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// ------------------------------------------------------------
+2 -2
View File
@@ -21,8 +21,8 @@
// ********************************************************************
//
//
// $Id: G4ios.cc,v 1.4.8.1 2001/06/28 19:10:06 gunter Exp $
// GEANT4 tag $Name: $
// $Id: G4ios.cc,v 1.5 2001/07/11 10:00:59 gunter Exp $
// GEANT4 tag $Name: geant4-04-00 $
//
//
// --------------------------------------------------------------