Import Geant4 8.1.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 14:44:26 +02:00
parent 8a51e0bc40
commit 216a75eeb1
8717 changed files with 360418 additions and 141343 deletions
+16 -13
View File
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and 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 *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * 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. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ASCIITree.cc,v 1.9 2005/06/02 17:43:46 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ASCIITree.cc,v 1.10 2006/06/29 21:24:53 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 5th April 2001
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and 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 *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * 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. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ASCIITreeMessenger.cc,v 1.15 2005/11/22 16:21:26 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ASCIITreeMessenger.cc,v 1.16 2006/06/29 21:24:55 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 5th April 2001
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and 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 *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * 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. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ASCIITreeSceneHandler.cc,v 1.22 2005/11/22 16:21:26 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ASCIITreeSceneHandler.cc,v 1.29 2006/06/29 21:24:57 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 5th April 2001
@@ -116,14 +119,14 @@ void G4ASCIITreeSceneHandler::EndModeling () {
G4cout << "Calculating mass(es)..." << G4endl;
const std::vector<G4VModel*>& models = fpScene->GetRunDurationModelList();
std::vector<G4VModel*>::const_iterator i;
G4PhysicalVolumeModel* pvModel;
for (i = models.begin(); i != models.end(); ++i) {
if ((pvModel = (*i)->GetG4PhysicalVolumeModel())) {
G4PhysicalVolumeModel* pvModel =
dynamic_cast<G4PhysicalVolumeModel*>(*i);
if (pvModel) {
const G4ModelingParameters* tempMP = pvModel->GetModelingParameters();
G4ModelingParameters mp; // Default - no culling.
pvModel->SetModelingParameters (&mp);
G4PhysicalVolumeMassScene massScene;
massScene.EstablishSpecials (*pvModel);
G4PhysicalVolumeMassScene massScene(pvModel);
pvModel->DescribeYourselfTo (massScene);
G4double volume = massScene.GetVolume();
G4double mass = massScene.GetMass();
@@ -165,37 +168,83 @@ void G4ASCIITreeSceneHandler::EndModeling () {
void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
const G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
const G4int verbosity = pSystem->GetVerbosity();
const G4int detail = verbosity % 10;
G4PhysicalVolumeModel* pPVModel =
dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
if (!pPVModel) return; // Not from a G4PhysicalVolumeModel.
// This call comes from a G4PhysicalVolumeModel. drawnPVPath is
// the path of the current drawn (non-culled) volume in terms of
// drawn (non-culled) ancesters. Each node is identified by a
// PVNodeID object, which is a physical volume and copy number. It
// is a vector of PVNodeIDs corresponding to the geometry hierarchy
// actually selected, i.e., not culled.
typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
typedef std::vector<PVNodeID> PVPath;
const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
G4int currentDepth = pPVModel->GetCurrentDepth();
G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
G4int verbosity = pSystem->GetVerbosity();
G4int detail = verbosity % 10;
const G4String& outFileName = pSystem -> GetOutFileName();
if (fpCurrentPV != fpLastPV) {
fpLastPV = fpCurrentPV;
if (pCurrentPV != fpLastPV) {
fpLastPV = pCurrentPV;
fPVPCount = 0;
}
if (verbosity < 10 && fReplicaSet.find(fpCurrentPV) != fReplicaSet.end()) {
// Ignore if an already treated replica.
G4PhysicalVolumeModel* pPVM = fpModel->GetG4PhysicalVolumeModel();
if (pPVM) {
pPVM->CurtailDescent();
if (verbosity < 10 && pCurrentPV->IsReplicated()) {
// See if this has been a replica found before with same mother LV...
PVPath::const_reverse_iterator thisID = drawnPVPath.rbegin();
PVPath::const_reverse_iterator motherID = ++drawnPVPath.rbegin();
G4bool ignore = false;
for (ReplicaSetIterator i = fReplicaSet.begin(); i != fReplicaSet.end();
++i) {
if (i->back().GetPhysicalVolume()->GetLogicalVolume() ==
thisID->GetPhysicalVolume()->GetLogicalVolume()) {
// For each one previously found (if more than one, they must
// have different mothers)...
// Previously:
// PVNodeID previousMotherID = ++(i->rbegin());
// Replace
// previousMotherID == i->rend()
// by
// i->size() <= 1
// Replace
// previousMotherID != i->rend()
// by
// i->size() > 1
// Replace
// previousMotherID->
// by
// (*i)[i->size() - 2].
if (motherID == drawnPVPath.rend() &&
i->size() <= 1)
ignore = true; // Both have no mother.
if (motherID != drawnPVPath.rend() &&
i->size() > 1 &&
motherID->GetPhysicalVolume()->GetLogicalVolume() ==
(*i)[i->size() - 2].GetPhysicalVolume()->GetLogicalVolume())
ignore = true; // Same mother LV...
}
}
if (ignore) {
pPVModel->CurtailDescent();
return;
} else {
G4Exception
("G4ASCIITreeSceneHandler::RequestPrimitives:"
"not a physical volume model"); // Shouldn't happen.
}
}
// Print indented text...
if (fpCurrentPV) {
for (G4int i = 0; i < fCurrentDepth; i++ ) *fpOutFile << " ";
if (pCurrentPV) {
for (G4int i = 0; i < currentDepth; i++ ) *fpOutFile << " ";
*fpOutFile << "\"" << fpCurrentPV->GetName()
<< "\":" << fpCurrentPV->GetCopyNo();
*fpOutFile << "\"" << pCurrentPV->GetName()
<< "\":" << pCurrentPV->GetCopyNo();
if (fpCurrentPV->IsReplicated()) {
if (pCurrentPV->IsReplicated()) {
if (verbosity < 10) {
// Add printing for replicas (when replicas are ignored)...
EAxis axis;
@@ -203,35 +252,35 @@ void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
G4double width;
G4double offset;
G4bool consuming;
fpCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
G4VPVParameterisation* pP = fpCurrentPV->GetParameterisation();
pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
G4VPVParameterisation* pP = pCurrentPV->GetParameterisation();
if (pP) {
if (detail < 3) {
fReplicaSet.insert(fpCurrentPV);
fReplicaSet.insert(drawnPVPath);
*fpOutFile << " (" << nReplicas << " parametrised volumes)";
}
}
else {
fReplicaSet.insert(fpCurrentPV);
fReplicaSet.insert(drawnPVPath);
*fpOutFile << " (" << nReplicas << " replicas)";
}
}
}
else {
if (fLVSet.find(fpCurrentLV) != fLVSet.end()) {
if (fLVSet.find(pCurrentLV) != fLVSet.end()) {
if (verbosity < 10) {
// Add printing for repeated placement...
*fpOutFile << " (repeated placement)";
// Add printing for repeated LV...
*fpOutFile << " (repeated LV)";
// ...and curtail descent.
((G4PhysicalVolumeModel*)fpModel)->CurtailDescent();
pPVModel->CurtailDescent();
}
}
}
if (detail >= 1) {
*fpOutFile << " / \""
<< fpCurrentLV->GetName() << "\"";
G4VSensitiveDetector* sd = fpCurrentLV->GetSensitiveDetector();
<< pCurrentLV->GetName() << "\"";
G4VSensitiveDetector* sd = pCurrentLV->GetSensitiveDetector();
if (sd) {
*fpOutFile << " (SD=\"" << sd->GetName() << "\"";
G4VReadOutGeometry* roGeom = sd->GetROgeometry();
@@ -241,7 +290,7 @@ void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
*fpOutFile << ")";
}
}
} // if (fpCurrentPV)
} // if (pCurrentPV)
if (detail >= 2) {
*fpOutFile << " / \""
@@ -250,32 +299,34 @@ void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
<< solid.GetEntityType() << ")";
}
if (fpCurrentPV) {
if (pCurrentPV) {
if (detail >= 3) {
*fpOutFile << ", "
<< G4BestUnit(((G4VSolid&)solid).GetCubicVolume(),"Volume")
<< ", "
<< G4BestUnit(fpCurrentMaterial->GetDensity(), "Volumic Mass");
<< G4BestUnit(pCurrentMaterial->GetDensity(), "Volumic Mass");
}
if (detail >= 5) {
G4double daughter_subtracted_mass = fpCurrentLV->GetMass
(fpCurrentPV->IsParameterised(), // Force if parametrised.
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.
fpCurrentMaterial);
pMaterial);
G4double daughter_subtracted_volume =
daughter_subtracted_mass / fpCurrentMaterial->GetDensity();
daughter_subtracted_mass / pCurrentMaterial->GetDensity();
*fpOutFile << ", "
<< G4BestUnit(daughter_subtracted_volume,"Volume")
<< ", "
<< G4BestUnit(daughter_subtracted_mass,"Mass");
}
if (fLVSet.find(fpCurrentLV) == fLVSet.end()) {
fLVSet.insert(fpCurrentLV); // Record new logical volume.
if (fLVSet.find(pCurrentLV) == fLVSet.end()) {
fLVSet.insert(pCurrentLV); // Record new logical volume.
}
} // if (fpCurrentPV)
} // if (pCurrentPV)
if (outFileName == "G4cout") {
G4cout << G4endl;
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and 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 *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * 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. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4ASCIITreeViewer.cc,v 1.7 2005/10/13 17:39:21 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4ASCIITreeViewer.cc,v 1.8 2006/06/29 21:24:59 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
#include "G4ASCIITreeViewer.hh"
+14 -11
View File
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and 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 *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * 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. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Satoshi Tanaka 31th May 2001
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and 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 *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * 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. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Satoshi Tanaka 31th May 2001
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and 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 *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * 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. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Satoshi Tanaka 31th May 2001
@@ -133,25 +136,27 @@ void G4GAGTreeSceneHandler::EndModeling ()
void G4GAGTreeSceneHandler::RequestPrimitives (const G4VSolid&)
{
// Protection if solid drawn not from physical volume tree...(JA)
if (!fpCurrentPV) return;
G4PhysicalVolumeModel* pPVModel =
dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
if (!pPVModel) return;
G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
G4int currentDepth = pPVModel->GetCurrentDepth();
//////////////////////////////
G4String cur_abs_pv_name ;
G4String pv_name_tmp ;
G4String cur_pv_name ( fpCurrentPV->GetName() ) ;
G4String cur_pv_name ( pCurrentPV->GetName() ) ;
//////////////////////////////
const G4GAGTree* pSystem = (G4GAGTree*)GetGraphicsSystem();
const G4int verbosity = pSystem->GetVerbosity();
const G4int detail = verbosity % 10;
if (verbosity < 10 && fReplicaSet.find(fpCurrentPV) != fReplicaSet.end()) {
if (verbosity < 10 && fReplicaSet.find(pCurrentPV) != fReplicaSet.end()) {
// Ignore if an already treated replica.
G4PhysicalVolumeModel* pPVM = fpModel->GetG4PhysicalVolumeModel();
if (pPVM) {
pPVM->CurtailDescent();
return;
}
pPVModel->CurtailDescent();
return;
}
@@ -163,15 +168,15 @@ void G4GAGTreeSceneHandler::RequestPrimitives (const G4VSolid&)
// Step 2: Generate the extension
// copy number
ost << "." << fpCurrentPV->GetCopyNo() ;
ost << "." << pCurrentPV->GetCopyNo() ;
if (detail >= 1) {
// LV name
ost << "." << fpCurrentLV->GetName() ;
ost << "." << pCurrentLV->GetName() ;
}
if (detail >= 2) {
// Solid info
ost << "." << fpCurrentLV->GetSolid()->GetName();
ost << "." << fpCurrentLV->GetSolid()->GetEntityType() ;
ost << "." << pCurrentLV->GetSolid()->GetName();
ost << "." << pCurrentLV->GetSolid()->GetEntityType() ;
}
// Tree index (0 for the world)
ost << "." << fPVCounter;
@@ -185,7 +190,7 @@ void G4GAGTreeSceneHandler::RequestPrimitives (const G4VSolid&)
// Search a mother PV node for the current PV
// in the direction to the root node.
// depth_mother = depth_current - 1
if( fCurrentDepth > fPrevDepth )
if( currentDepth > fPrevDepth )
{
// Do nothing (The mother is the previous PV node)
@@ -202,7 +207,7 @@ void G4GAGTreeSceneHandler::RequestPrimitives (const G4VSolid&)
// and so the list becomes empty with the popping above.
G4int trial_mother_depth = fPVNameList.GetHeadIndex() ;
if ( fCurrentDepth > trial_mother_depth ) break ;
if ( currentDepth > trial_mother_depth ) break ;
}
} // if-else
@@ -223,7 +228,7 @@ void G4GAGTreeSceneHandler::RequestPrimitives (const G4VSolid&)
if( fPrevAbsPVName != "" )
{
// Add "/"
if( fCurrentDepth > fPrevDepth ) {fPrevAbsPVName += "/" ;}
if( currentDepth > fPrevDepth ) {fPrevAbsPVName += "/" ;}
}
// Print the PREVIOUS node after node/leaf distiction
@@ -232,8 +237,8 @@ void G4GAGTreeSceneHandler::RequestPrimitives (const G4VSolid&)
///////////////////////////////////////////////////////////
if (fpCurrentPV->IsReplicated()) {
fReplicaSet.insert(fpCurrentPV); // Record new replica volume.
if (pCurrentPV->IsReplicated()) {
fReplicaSet.insert(pCurrentPV); // Record new replica volume.
if (verbosity < 10) {
// Add printing for replicas (when replicas are ignored)...
EAxis axis;
@@ -241,8 +246,8 @@ void G4GAGTreeSceneHandler::RequestPrimitives (const G4VSolid&)
G4double width;
G4double offset;
G4bool consuming;
fpCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
G4VPVParameterisation* pP = fpCurrentPV->GetParameterisation();
pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
G4VPVParameterisation* pP = pCurrentPV->GetParameterisation();
#if defined DEBUG_GAG_TREE
G4cout << "_(" << nReplicas;
#endif
@@ -259,24 +264,22 @@ void G4GAGTreeSceneHandler::RequestPrimitives (const G4VSolid&)
}
}
else {
if (fLVSet.find(fpCurrentLV) != fLVSet.end()) {
if (fLVSet.find(pCurrentLV) != fLVSet.end()) {
if (verbosity < 10) {
// Add printing for repeated placement...
#if defined DEBUG_GAG_TREE
G4cout << " (repeated placement)";
#endif
// Ignore if an already treated logical volume.
if (fpCurrentPV) {
((G4PhysicalVolumeModel*)fpModel)->CurtailDescent();
G4cout << G4endl;
return;
}
pPVModel->CurtailDescent();
G4cout << G4endl;
return;
}
}
}
if (fLVSet.find(fpCurrentLV) == fLVSet.end()) {
fLVSet.insert(fpCurrentLV); // Record new logical volume.
if (fLVSet.find(pCurrentLV) == fLVSet.end()) {
fLVSet.insert(pCurrentLV); // Record new logical volume.
}
@@ -285,7 +288,7 @@ void G4GAGTreeSceneHandler::RequestPrimitives (const G4VSolid&)
if( fPrevAbsPVName != "" ) { G4cout << G4endl;}
// Prepare for the next call, i.e. the next PV.
fPrevDepth = fCurrentDepth ;
fPrevDepth = currentDepth ;
fPrevAbsPVName = cur_abs_pv_name ;
fPVCounter++ ;
////////////////////////
@@ -1,23 +1,26 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and 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 *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * 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. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
// Satoshi Tanaka 31th May 2001
+16 -13
View File
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and 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 *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * 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. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VTree.cc,v 1.4 2001/07/11 10:09:08 gunter Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VTree.cc,v 1.5 2006/06/29 21:25:09 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 5th April 2001
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and 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 *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * 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. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VTreeSceneHandler.cc,v 1.9 2005/06/02 17:43:47 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VTreeSceneHandler.cc,v 1.14 2006/06/29 21:25:11 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
//
//
// John Allison 5th April 2001
@@ -35,7 +38,6 @@
#include "G4PhysicalVolumeModel.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4ModelingParameters.hh"
G4int G4VTreeSceneHandler::fSceneIdCount = 0;
// Counter for Tree scene handlers.
@@ -53,5 +55,65 @@ void G4VTreeSceneHandler::BeginModeling() {
}
void G4VTreeSceneHandler::EndModeling() {
fDrawnLVStore.clear();
G4VSceneHandler::EndModeling(); // Required: see G4VSceneHandler.hh.
}
void G4VTreeSceneHandler::PreAddSolid
(const G4Transform3D& objectTransformation, const G4VisAttributes& visAttribs)
{
G4VSceneHandler::PreAddSolid (objectTransformation, visAttribs);
G4PhysicalVolumeModel* pPVModel =
dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
if (!pPVModel) return; // Not from a G4PhysicalVolumeModel.
// This call comes from a G4PhysicalVolumeModel, drawnPVPath is
// the path of the current drawn (non-culled) volume in terms of
// drawn (non-culled) ancesters. Each node is identified by a
// PVNodeID object, which is a physical volume and copy number. It
// is a vector of PVNodeIDs corresponding to the geometry hierarchy
// actually selected, i.e., not culled.
typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
typedef std::vector<PVNodeID> PVPath;
const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
//G4int currentDepth = pPVModel->GetCurrentDepth();
//G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
//G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
//G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
// Actually, it is enough to store the logical volume of current
// physical volume...
fDrawnLVStore.insert
(drawnPVPath.back().GetPhysicalVolume()->GetLogicalVolume());
// Find mother. ri points to drawn mother, if any.
PVPath::const_reverse_iterator ri = ++drawnPVPath.rbegin();
if (ri != drawnPVPath.rend()) {
// This volume has a mother.
G4LogicalVolume* drawnMotherLV =
ri->GetPhysicalVolume()->GetLogicalVolume();
if (fDrawnLVStore.find(drawnMotherLV) != fDrawnLVStore.end()) {
// Mother previously encountered. Add this volume to
// appropriate node in scene graph tree.
// ...
} else {
// Mother not previously encountered. Shouldn't happen, since
// G4PhysicalVolumeModel sends volumes as it encounters them,
// i.e., mothers before daughters, in its descent of the
// geometry tree. Error!
G4cout << "ERROR: G4XXXSceneHandler::PreAddSolid: Mother "
<< ri->GetPhysicalVolume()->GetName()
<< ':' << ri->GetCopyNo()
<< " not previously encountered."
"\nShouldn't happen! Please report to visualization coordinator."
<< G4endl;
// Continue anyway. Add to root of scene graph tree.
// ...
}
} else {
// This volume has no mother. Must be a top level un-culled
// volume. Add to root of scene graph tree.
// ...
}
}
+16 -13
View File
@@ -1,28 +1,31 @@
//
// ********************************************************************
// * DISCLAIMER *
// * License and 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 *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration. It is provided under the terms and *
// * conditions of the Geant4 Software License, included in the file *
// * LICENSE and available at http://cern.ch/geant4/license . These *
// * include a list of copyright holders. *
// * *
// * 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. *
// * use. Please see the license in the file LICENSE and URL above *
// * for the full disclaimer and the limitation of liability. *
// * *
// * 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. *
// * This code implementation is the result of the scientific and *
// * technical work of the GEANT4 collaboration. *
// * By using, copying, modifying or distributing the software (or *
// * any work based on the software) you agree to acknowledge its *
// * use in resulting scientific publications, and indicate your *
// * acceptance of all terms of the Geant4 Software license. *
// ********************************************************************
//
//
// $Id: G4VTreeViewer.cc,v 1.6 2005/10/13 17:39:21 allison Exp $
// GEANT4 tag $Name: geant4-08-00 $
// $Id: G4VTreeViewer.cc,v 1.7 2006/06/29 21:25:13 gunter Exp $
// GEANT4 tag $Name: geant4-08-01 $
#include "G4VTreeViewer.hh"