Import Geant4 8.3.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 15:07:44 +02:00
parent fe73f43734
commit 75c7fd177d
764 changed files with 45230 additions and 95238 deletions
+7 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.27 2006/11/05 20:46:32 allison Exp $
$Id: History,v 1.29 2007/01/05 17:01:16 allison Exp $
-------------------------------------------------------------------
=========================================================
@@ -24,6 +24,12 @@ committal in the CVS repository !
History file for visualization/Tree sub-category
------------------------------------------------
5th January 2007 John Allison (vistree-V08-02-00)
- Bug fix: Format of total mass.
11th December 2006 John Allison
- Trapped sequential G4PVPlacements.
5th November 2006 John Allison (vistree-V08-01-02)
- Protected against zero material pointer.
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ASCIITreeSceneHandler.hh,v 1.16 2006/06/29 21:24:31 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4ASCIITreeSceneHandler.hh,v 1.17 2006/12/11 21:14:45 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// John Allison 5th April 2001
@@ -42,6 +42,7 @@
#include <vector>
#include <iostream>
#include <fstream>
#include <sstream>
class G4VPhysicalVolume;
@@ -59,10 +60,15 @@ protected:
void WriteHeader (std::ostream &);
const G4VPhysicalVolume* fpLastPV; // Records last physical volume.
G4int fPVPCount; // Counts parameterisations.
std::ostream* fpOutFile; // Pointer to output file.
std::ofstream fOutFile; // Actual output file (if not G4cout).
std::ostringstream fRestOfLine; // For accumulating rest of line
// pending arrival of new
// G4PVPlacement.
const G4VPhysicalVolume* fpLastPV;
G4String fLastPVName;
G4int fLastCopyNo;
G4int fLastNonSequentialCopyNo;
std::set<G4LogicalVolume*> fLVSet;
typedef std::set<G4LogicalVolume*>::iterator LVSetIterator;
+2 -2
View File
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ASCIITree.cc,v 1.10 2006/06/29 21:24:53 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4ASCIITree.cc,v 1.12 2007/01/05 16:59:43 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// John Allison 5th April 2001
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ASCIITreeMessenger.cc,v 1.16 2006/06/29 21:24:55 gunter Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4ASCIITreeMessenger.cc,v 1.19 2007/01/05 16:59:43 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// John Allison 5th April 2001
@@ -24,8 +24,8 @@
// ********************************************************************
//
//
// $Id: G4ASCIITreeSceneHandler.cc,v 1.32 2006/11/05 20:44:28 allison Exp $
// GEANT4 tag $Name: geant4-08-02 $
// $Id: G4ASCIITreeSceneHandler.cc,v 1.34 2007/01/05 17:00:27 allison Exp $
// GEANT4 tag $Name: geant4-08-03 $
//
//
// John Allison 5th April 2001
@@ -55,9 +55,10 @@ G4ASCIITreeSceneHandler::G4ASCIITreeSceneHandler
(G4VGraphicsSystem& system,
const G4String& name):
G4VTreeSceneHandler(system, name),
fpLastPV (0),
fPVPCount (0),
fpOutFile (0)
fpOutFile(0),
fpLastPV(0),
fLastCopyNo(-99),
fLastNonSequentialCopyNo(-99)
{}
G4ASCIITreeSceneHandler::~G4ASCIITreeSceneHandler () {}
@@ -116,6 +117,21 @@ void G4ASCIITreeSceneHandler::EndModeling () {
const G4int detail = verbosity % 10;
const G4String& outFileName = pSystem -> GetOutFileName();
// Output left over copy number, if any...
if (fLastCopyNo != fLastNonSequentialCopyNo) {
if (fLastCopyNo == fLastNonSequentialCopyNo + 1) *fpOutFile << ',';
else *fpOutFile << '-';
*fpOutFile << fLastCopyNo;
}
// Output outstanding rest of line, if any...
if (!fRestOfLine.str().empty()) *fpOutFile << fRestOfLine.str();
fRestOfLine.str("");
fpLastPV = 0;
fLastPVName.clear();
fLastCopyNo = -99;
fLastNonSequentialCopyNo = -99;
// This detail to G4cout regardless of outFileName...
if (detail >= 4) {
G4cout << "Calculating mass(es)..." << G4endl;
const std::vector<G4VModel*>& models = fpScene->GetRunDurationModelList();
@@ -164,8 +180,6 @@ void G4ASCIITreeSceneHandler::EndModeling () {
fOutFile.close();
G4cout << "Output file \"" << outFileName << "\" closed." << G4endl;
}
fpLastPV = 0;
fPVPCount = 0;
fLVSet.clear();
fReplicaSet.clear();
G4cout << "G4ASCIITreeSceneHandler::EndModeling" << G4endl;
@@ -195,12 +209,6 @@ void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
G4int verbosity = pSystem->GetVerbosity();
G4int detail = verbosity % 10;
const G4String& outFileName = pSystem -> GetOutFileName();
if (pCurrentPV != fpLastPV) {
fpLastPV = pCurrentPV;
fPVPCount = 0;
}
if (verbosity < 10 && pCurrentPV->IsReplicated()) {
// See if this has been a replica found before with same mother LV...
@@ -245,110 +253,149 @@ void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
}
}
// Print indented text...
if (pCurrentPV) {
for (size_t i = 0; i < drawnPVPath.size(); i++ ) *fpOutFile << " ";
*fpOutFile << "\"" << pCurrentPV->GetName()
<< "\":" << pCurrentPV->GetCopyNo();
const G4String& currentPVName = pCurrentPV->GetName();
const G4int currentCopyNo = pCurrentPV->GetCopyNo();
if (verbosity < 10 &&
currentPVName == fLastPVName &&
currentCopyNo != fLastCopyNo) {
// For low verbosity, trap series of G4PVPlacements with the same name but
// different copy number (replicas should have been taken out above)...
// Check...
if (pCurrentPV->IsReplicated()) {
if (verbosity < 10) {
// Add printing for replicas (when replicas are ignored)...
EAxis axis;
G4int nReplicas;
G4double width;
G4double offset;
G4bool consuming;
pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
G4VPVParameterisation* pP = pCurrentPV->GetParameterisation();
if (pP) {
if (detail < 3) {
fReplicaSet.insert(drawnPVPath);
*fpOutFile << " (" << nReplicas << " parametrised volumes)";
}
}
else {
fReplicaSet.insert(drawnPVPath);
*fpOutFile << " (" << nReplicas << " replicas)";
}
}
G4Exception("G4ASCIITreeSceneHandler::RequestPrimitives",
"",
JustWarning,
"Replica unexpected");
}
else {
if (fLVSet.find(pCurrentLV) != fLVSet.end()) {
if (verbosity < 10) {
// Add printing for repeated LV...
*fpOutFile << " (repeated LV)";
// ...and curtail descent.
pPVModel->CurtailDescent();
}
// Check mothers are identical...
else if (pCurrentLV == (fpLastPV? fpLastPV->GetLogicalVolume(): 0)) {
if (currentCopyNo != fLastCopyNo + 1) {
// Non-sequential copy number...
*fpOutFile << ',' << currentCopyNo;
fLastNonSequentialCopyNo = currentCopyNo;
}
fLastCopyNo = currentCopyNo;
pPVModel->CurtailDescent();
return;
}
}
fpLastPV = pCurrentPV;
if (detail >= 1) {
*fpOutFile << " / \""
<< pCurrentLV->GetName() << "\"";
G4VSensitiveDetector* sd = pCurrentLV->GetSensitiveDetector();
if (sd) {
*fpOutFile << " (SD=\"" << sd->GetName() << "\"";
G4VReadOutGeometry* roGeom = sd->GetROgeometry();
if (roGeom) {
*fpOutFile << ",RO=\"" << roGeom->GetName() << "\"";
// High verbosity or a new G4VPhysicalVolume...
// Output copy number, if any, from previous invocation...
if (fLastCopyNo != fLastNonSequentialCopyNo) {
if (fLastCopyNo == fLastNonSequentialCopyNo + 1) *fpOutFile << ',';
else *fpOutFile << '-';
*fpOutFile << fLastCopyNo;
}
// Output rest of line, if any, from previous invocation...
if (!fRestOfLine.str().empty()) *fpOutFile << fRestOfLine.str();
fRestOfLine.str("");
fLastPVName = currentPVName;
fLastCopyNo = currentCopyNo;
fLastNonSequentialCopyNo = currentCopyNo;
// Indent according to drawn path depth...
for (size_t i = 0; i < drawnPVPath.size(); i++ ) *fpOutFile << " ";
// Start next line...
*fpOutFile << "\"" << currentPVName
<< "\":" << currentCopyNo;
if (pCurrentPV->IsReplicated()) {
if (verbosity < 10) {
// Add printing for replicas (when replicas are ignored)...
EAxis axis;
G4int nReplicas;
G4double width;
G4double offset;
G4bool consuming;
pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
G4VPVParameterisation* pP = pCurrentPV->GetParameterisation();
if (pP) {
if (detail < 3) {
fReplicaSet.insert(drawnPVPath);
if (nReplicas > 2) fRestOfLine << '-';
else fRestOfLine << ',';
fRestOfLine << nReplicas - 1
<< " (" << nReplicas << " parametrised volumes)";
}
*fpOutFile << ")";
}
else {
fReplicaSet.insert(drawnPVPath);
if (nReplicas > 2) fRestOfLine << '-';
else fRestOfLine << ',';
fRestOfLine << nReplicas - 1
<< " (" << nReplicas << " replicas)";
}
}
} // if (pCurrentPV)
} else {
if (fLVSet.find(pCurrentLV) != fLVSet.end()) {
if (verbosity < 10) {
// Add printing for repeated LV (if it has daughters)...
if (pCurrentLV->GetNoDaughters()) fRestOfLine << " (repeated LV)";
// ...and curtail descent.
pPVModel->CurtailDescent();
}
}
}
if (detail >= 1) {
fRestOfLine << " / \""
<< pCurrentLV->GetName() << "\"";
G4VSensitiveDetector* sd = pCurrentLV->GetSensitiveDetector();
if (sd) {
fRestOfLine << " (SD=\"" << sd->GetName() << "\"";
G4VReadOutGeometry* roGeom = sd->GetROgeometry();
if (roGeom) {
fRestOfLine << ",RO=\"" << roGeom->GetName() << "\"";
}
fRestOfLine << ")";
}
}
if (detail >= 2) {
*fpOutFile << " / \""
fRestOfLine << " / \""
<< solid.GetName()
<< "\"("
<< solid.GetEntityType() << ")";
}
if (pCurrentPV) {
if (detail >= 3) {
*fpOutFile << ", "
<< G4BestUnit(((G4VSolid&)solid).GetCubicVolume(),"Volume")
<< ", ";
if (pCurrentMaterial) {
*fpOutFile
<< G4BestUnit(pCurrentMaterial->GetDensity(), "Volumic Mass")
<< " (" << pCurrentMaterial->GetName() << ")";
} else {
*fpOutFile << "(No material)";
}
if (detail >= 3) {
fRestOfLine << ", "
<< G4BestUnit(((G4VSolid&)solid).GetCubicVolume(),"Volume")
<< ", ";
if (pCurrentMaterial) {
fRestOfLine
<< G4BestUnit(pCurrentMaterial->GetDensity(), "Volumic Mass")
<< " (" << pCurrentMaterial->GetName() << ")";
} else {
fRestOfLine << "(No material)";
}
if (detail >= 5) {
if (pCurrentMaterial) {
G4Material* pMaterial = const_cast<G4Material*>(pCurrentMaterial);
// ...and find daughter-subtracted mass...
G4double daughter_subtracted_mass = pCurrentLV->GetMass
(pCurrentPV->IsParameterised(), // Force if parametrised.
false, // Do not propagate - calculate for this volume minus
// volume of daughters.
pMaterial);
G4double daughter_subtracted_volume =
daughter_subtracted_mass / pCurrentMaterial->GetDensity();
*fpOutFile << ", "
<< G4BestUnit(daughter_subtracted_volume,"Volume")
<< ", "
<< G4BestUnit(daughter_subtracted_mass,"Mass");
}
}
if (fLVSet.find(pCurrentLV) == fLVSet.end()) {
fLVSet.insert(pCurrentLV); // Record new logical volume.
}
} // if (pCurrentPV)
if (outFileName == "G4cout") {
G4cout << G4endl;
} else {
*fpOutFile << std::endl;
}
if (detail >= 5) {
if (pCurrentMaterial) {
G4Material* pMaterial = const_cast<G4Material*>(pCurrentMaterial);
// ...and find daughter-subtracted mass...
G4double daughter_subtracted_mass = pCurrentLV->GetMass
(pCurrentPV->IsParameterised(), // Force if parametrised.
false, // Do not propagate - calculate for this volume minus
// volume of daughters.
pMaterial);
G4double daughter_subtracted_volume =
daughter_subtracted_mass / pCurrentMaterial->GetDensity();
fRestOfLine << ", "
<< G4BestUnit(daughter_subtracted_volume,"Volume")
<< ", "
<< G4BestUnit(daughter_subtracted_mass,"Mass");
}
}
if (fLVSet.find(pCurrentLV) == fLVSet.end()) {
fLVSet.insert(pCurrentLV); // Record new logical volume.
}
fRestOfLine << std::endl;
return;
}