Import Geant4 11.4.1 source tree
This commit is contained in:
@@ -6,6 +6,12 @@ be used as a substitute for writing good git commit messages!
|
||||
|
||||
--------------------------------------------------------------------
|
||||
|
||||
## 2026-02-11 John Allison (vistree-V11-03-00)
|
||||
- Move fVerbosityGuidance to G4ASCIITree factory.
|
||||
- It was a static variable in G4ASCIITreeMessenger - static to allow access - but
|
||||
it gives "AddressSanitizer: container-overflow" with "-fsanitize=address,undefined"
|
||||
(as discovered by user Davide Terzani, Bug Report 2699).
|
||||
|
||||
## 2023-02-06 Ben Morgan (vistree-V11-01-00)
|
||||
- Isolate private headers and update dependencies
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
|
||||
#include "G4VTree.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4ASCIITreeMessenger;
|
||||
|
||||
class G4ASCIITree: public G4VTree {
|
||||
@@ -44,12 +46,14 @@ public:
|
||||
G4VSceneHandler* CreateSceneHandler (const G4String& name = "");
|
||||
G4VViewer* CreateViewer (G4VSceneHandler&, const G4String& name = "");
|
||||
G4int GetVerbosity() const {return fVerbosity;}
|
||||
const std::vector<G4String>& GetVerbosityGuidance() const {return fVerbosityGuidance;}
|
||||
G4String GetOutFileName () const {return fOutFileName;}
|
||||
void SetVerbosity (G4int verbosity) {fVerbosity = verbosity;}
|
||||
void SetOutFileName (const G4String& name) {fOutFileName = name;}
|
||||
protected:
|
||||
G4int fVerbosity;
|
||||
G4ASCIITreeMessenger* fpMessenger;
|
||||
std::vector<G4String> fVerbosityGuidance;
|
||||
G4String fOutFileName;
|
||||
};
|
||||
|
||||
|
||||
@@ -36,8 +36,6 @@
|
||||
|
||||
#include "G4UImessenger.hh"
|
||||
|
||||
#include <vector>
|
||||
|
||||
class G4ASCIITree;
|
||||
class G4UIcommand;
|
||||
class G4UIcmdWithAnInteger;
|
||||
@@ -49,7 +47,6 @@ public:
|
||||
virtual ~G4ASCIITreeMessenger();
|
||||
G4String GetCurrentValue (G4UIcommand* command);
|
||||
void SetNewValue (G4UIcommand* command, G4String newValue);
|
||||
static std::vector<G4String> fVerbosityGuidance;
|
||||
private:
|
||||
G4ASCIITree* fpASCIITree;
|
||||
G4UIcommand* fpDirectory;
|
||||
|
||||
@@ -45,6 +45,57 @@ G4ASCIITree::G4ASCIITree ():
|
||||
fVerbosity(1),
|
||||
fOutFileName ("G4cout")
|
||||
{
|
||||
fVerbosityGuidance.push_back
|
||||
(" < 10: notifies but does not print details of repeated volumes.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 10: prints all physical volumes (touchables).");
|
||||
fVerbosityGuidance.push_back
|
||||
("The level of detail is given by verbosity%10:");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 0: physical volume name.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 1: logical volume name (and names of sensitive detector"
|
||||
" and readout geometry, if any).");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 2: solid name and type.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 3: volume and density.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 5: daughter-subtracted volume and mass.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 6: physical volume dump.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 7: polyhedron dump.");
|
||||
fVerbosityGuidance.push_back
|
||||
("and in the summary at the end of printing:");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 4: daughter-included mass of top physical volume(s) in scene"
|
||||
" to depth specified.");
|
||||
fVerbosityGuidance.push_back
|
||||
("Note: by default, culling is switched off so all volumes are seen.");
|
||||
fVerbosityGuidance.push_back
|
||||
("Note: the mass calculation takes into account daughters, which can be"
|
||||
" time consuming. If you want the mass of a particular subtree try:");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/drawTree <subtree-physical-volume-name>");
|
||||
fVerbosityGuidance.push_back
|
||||
("Or if you want more control, for example:");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/open ATree");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/ASCIITree/verbose 14");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/scene/create");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/scene/add/volume <subtree-physical-volume-name> ! <depth>");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/sceneHandler/attach");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/viewer/flush");
|
||||
fVerbosityGuidance.push_back
|
||||
("Note: dumping the physical volumes produces a lot of output. It is"
|
||||
" advisable to select the volume of interest, as for a sub-tree above.");
|
||||
|
||||
fpMessenger = new G4ASCIITreeMessenger(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
|
||||
std::vector<G4String> G4ASCIITreeMessenger::fVerbosityGuidance;
|
||||
|
||||
G4ASCIITreeMessenger::G4ASCIITreeMessenger
|
||||
(G4ASCIITree* ASCIITree):
|
||||
fpASCIITree(ASCIITree) {
|
||||
@@ -53,58 +51,8 @@ fpASCIITree(ASCIITree) {
|
||||
fpDirectorySet -> SetGuidance ("Settings for ASCIITree control.");
|
||||
|
||||
fpCommandVerbose = new G4UIcmdWithAnInteger ("/vis/ASCIITree/verbose", this);
|
||||
fVerbosityGuidance.push_back
|
||||
(" < 10: notifies but does not print details of repeated volumes.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 10: prints all physical volumes (touchables).");
|
||||
fVerbosityGuidance.push_back
|
||||
("The level of detail is given by verbosity%10:");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 0: physical volume name.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 1: logical volume name (and names of sensitive detector"
|
||||
" and readout geometry, if any).");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 2: solid name and type.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 3: volume and density.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 5: daughter-subtracted volume and mass.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 6: physical volume dump.");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 7: polyhedron dump.");
|
||||
fVerbosityGuidance.push_back
|
||||
("and in the summary at the end of printing:");
|
||||
fVerbosityGuidance.push_back
|
||||
(" >= 4: daughter-included mass of top physical volume(s) in scene"
|
||||
" to depth specified.");
|
||||
fVerbosityGuidance.push_back
|
||||
("Note: by default, culling is switched off so all volumes are seen.");
|
||||
fVerbosityGuidance.push_back
|
||||
("Note: the mass calculation takes into account daughters, which can be"
|
||||
" time consuming. If you want the mass of a particular subtree try:");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/drawTree <subtree-physical-volume-name>");
|
||||
fVerbosityGuidance.push_back
|
||||
("Or if you want more control, for example:");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/open ATree");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/ASCIITree/verbose 14");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/scene/create");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/scene/add/volume <subtree-physical-volume-name> ! <depth>");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/sceneHandler/attach");
|
||||
fVerbosityGuidance.push_back
|
||||
(" /vis/viewer/flush");
|
||||
fVerbosityGuidance.push_back
|
||||
("Note: dumping the physical volumes produces a lot of output. It is"
|
||||
" advisable to select the volume of interest, as for a sub-tree above.");
|
||||
for (size_t i = 0; i < fVerbosityGuidance.size(); ++i) {
|
||||
fpCommandVerbose -> SetGuidance(fVerbosityGuidance[i]);
|
||||
for (size_t i = 0; i < fpASCIITree->GetVerbosityGuidance().size(); ++i) {
|
||||
fpCommandVerbose -> SetGuidance(fpASCIITree->GetVerbosityGuidance()[i]);
|
||||
}
|
||||
fpCommandVerbose -> SetParameterName ("verbosity",omitable = true);
|
||||
fpCommandVerbose -> SetDefaultValue(1);
|
||||
|
||||
@@ -86,11 +86,12 @@ void G4ASCIITreeSceneHandler::BeginModeling () {
|
||||
G4cout << "file \"" << outFileName << "\"";
|
||||
}
|
||||
G4cout << G4endl;
|
||||
|
||||
WriteHeader (G4cout); G4cout << G4endl;
|
||||
}
|
||||
|
||||
if (outFileName != "G4cout") {
|
||||
|
||||
if (outFileName == "G4cout") {
|
||||
WriteHeader (G4cout); G4cout << G4endl;
|
||||
} else {
|
||||
G4cout << "Writing to output file \"" << outFileName << "\"" << G4endl;
|
||||
WriteHeader (fOutFile); fOutFile << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -101,9 +102,13 @@ void G4ASCIITreeSceneHandler::WriteHeader (std::ostream& os)
|
||||
const G4int verbosity = pSystem->GetVerbosity();
|
||||
const G4int detail = verbosity % 10;
|
||||
os << "# Set verbosity with \"/vis/ASCIITree/verbose <verbosity>\":";
|
||||
for (size_t i = 0;
|
||||
i < G4ASCIITreeMessenger::fVerbosityGuidance.size(); ++i) {
|
||||
os << "\n# " << G4ASCIITreeMessenger::fVerbosityGuidance[i];
|
||||
static G4bool firstTime = true;
|
||||
if (firstTime) {
|
||||
firstTime = false;
|
||||
for (size_t i = 0;
|
||||
i < pSystem->GetVerbosityGuidance().size(); ++i) {
|
||||
os << "\n# " << pSystem->GetVerbosityGuidance()[i];
|
||||
}
|
||||
}
|
||||
os << "\n# Now printing with verbosity " << verbosity;
|
||||
os << "\n# Format is: PV:n";
|
||||
|
||||
Reference in New Issue
Block a user