Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/visualization/Tree/src/G4ASCIITreeSceneHandler.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /visualization/Tree/src/G4ASCIITreeSceneHandler.cc (Version 11.3.0) and /visualization/Tree/src/G4ASCIITreeSceneHandler.cc (Version 10.2.p1)


  1 //                                                  1 //
  2 // *******************************************      2 // ********************************************************************
  3 // * License and Disclaimer                         3 // * License and Disclaimer                                           *
  4 // *                                                4 // *                                                                  *
  5 // * The  Geant4 software  is  copyright of th      5 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
  6 // * the Geant4 Collaboration.  It is provided      6 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
  7 // * conditions of the Geant4 Software License      7 // * conditions of the Geant4 Software License,  included in the file *
  8 // * LICENSE and available at  http://cern.ch/      8 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
  9 // * include a list of copyright holders.           9 // * include a list of copyright holders.                             *
 10 // *                                               10 // *                                                                  *
 11 // * Neither the authors of this software syst     11 // * Neither the authors of this software system, nor their employing *
 12 // * institutes,nor the agencies providing fin     12 // * institutes,nor the agencies providing financial support for this *
 13 // * work  make  any representation or  warran     13 // * work  make  any representation or  warranty, express or implied, *
 14 // * regarding  this  software system or assum     14 // * regarding  this  software system or assume any liability for its *
 15 // * use.  Please see the license in the file      15 // * use.  Please see the license in the file  LICENSE  and URL above *
 16 // * for the full disclaimer and the limitatio     16 // * for the full disclaimer and the limitation of liability.         *
 17 // *                                               17 // *                                                                  *
 18 // * This  code  implementation is the result      18 // * This  code  implementation is the result of  the  scientific and *
 19 // * technical work of the GEANT4 collaboratio     19 // * technical work of the GEANT4 collaboration.                      *
 20 // * By using,  copying,  modifying or  distri     20 // * By using,  copying,  modifying or  distributing the software (or *
 21 // * any work based  on the software)  you  ag     21 // * any work based  on the software)  you  agree  to acknowledge its *
 22 // * use  in  resulting  scientific  publicati     22 // * use  in  resulting  scientific  publications,  and indicate your *
 23 // * acceptance of all terms of the Geant4 Sof     23 // * acceptance of all terms of the Geant4 Software license.          *
 24 // *******************************************     24 // ********************************************************************
 25 //                                                 25 //
 26 //                                                 26 //
                                                   >>  27 // $Id: G4ASCIITreeSceneHandler.cc 88761 2015-03-09 12:23:46Z gcosmo $
 27 //                                                 28 //
 28 //                                                 29 // 
 29 // John Allison  5th April 2001                    30 // John Allison  5th April 2001
 30 // A scene handler to dump geometry hierarchy.     31 // A scene handler to dump geometry hierarchy.
 31 // Based on a provisional G4ASCIITreeGraphicsS     32 // Based on a provisional G4ASCIITreeGraphicsScene (was in modeling).
 32                                                    33 
 33 #include "G4ASCIITreeSceneHandler.hh"              34 #include "G4ASCIITreeSceneHandler.hh"
 34                                                    35 
 35 #include "G4ASCIITree.hh"                          36 #include "G4ASCIITree.hh"
 36 #include "G4ASCIITreeMessenger.hh"                 37 #include "G4ASCIITreeMessenger.hh"
 37 #include "G4VSolid.hh"                             38 #include "G4VSolid.hh"
 38 #include "G4PhysicalVolumeModel.hh"                39 #include "G4PhysicalVolumeModel.hh"
 39 #include "G4VPhysicalVolume.hh"                    40 #include "G4VPhysicalVolume.hh"
 40 #include "G4LogicalVolume.hh"                      41 #include "G4LogicalVolume.hh"
 41 #include "G4VPVParameterisation.hh"                42 #include "G4VPVParameterisation.hh"
 42 #include "G4Polyhedron.hh"                         43 #include "G4Polyhedron.hh"
 43 #include "G4UnitsTable.hh"                         44 #include "G4UnitsTable.hh"
 44 #include "G4Material.hh"                           45 #include "G4Material.hh"
 45 #include "G4Scene.hh"                              46 #include "G4Scene.hh"
 46 #include "G4ModelingParameters.hh"                 47 #include "G4ModelingParameters.hh"
 47 #include "G4PhysicalVolumeMassScene.hh"            48 #include "G4PhysicalVolumeMassScene.hh"
 48 #include "G4VSensitiveDetector.hh"                 49 #include "G4VSensitiveDetector.hh"
 49 #include "G4VReadOutGeometry.hh"                   50 #include "G4VReadOutGeometry.hh"
 50 #include "G4TransportationManager.hh"              51 #include "G4TransportationManager.hh"
 51 #include "G4AttCheck.hh"                           52 #include "G4AttCheck.hh"
 52 #include "G4AttValue.hh"                           53 #include "G4AttValue.hh"
 53                                                    54 
 54 G4ASCIITreeSceneHandler::G4ASCIITreeSceneHandl     55 G4ASCIITreeSceneHandler::G4ASCIITreeSceneHandler
 55 (G4VGraphicsSystem& system,                        56 (G4VGraphicsSystem& system,
 56  const G4String& name):                            57  const G4String& name):
 57   G4VTreeSceneHandler(system, name),               58   G4VTreeSceneHandler(system, name),
 58   fpOutFile(0),                                    59   fpOutFile(0),
 59   fpLastPV(0),                                     60   fpLastPV(0),
 60   fLastCopyNo(-99),                                61   fLastCopyNo(-99),
 61   fLastNonSequentialCopyNo(-99)                    62   fLastNonSequentialCopyNo(-99)
 62 {}                                                 63 {}
 63                                                    64 
 64 G4ASCIITreeSceneHandler::~G4ASCIITreeSceneHand     65 G4ASCIITreeSceneHandler::~G4ASCIITreeSceneHandler () {}
 65                                                    66 
 66 void G4ASCIITreeSceneHandler::BeginModeling ()     67 void G4ASCIITreeSceneHandler::BeginModeling () {
 67                                                    68 
 68   G4VTreeSceneHandler::BeginModeling ();  // T     69   G4VTreeSceneHandler::BeginModeling ();  // To re-use "culling off" code.
 69                                                    70 
 70   const G4ASCIITree* pSystem = (G4ASCIITree*)G     71   const G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
 71   const G4String& outFileName = pSystem -> Get     72   const G4String& outFileName = pSystem -> GetOutFileName();
 72   if (outFileName == "G4cout") {                   73   if (outFileName == "G4cout") {
 73     fpOutFile = &G4cout;                           74     fpOutFile = &G4cout;
 74   } else {                                         75   } else {
 75     fOutFile.open (outFileName);                   76     fOutFile.open (outFileName);
 76     fpOutFile = &fOutFile;                         77     fpOutFile = &fOutFile;
 77   }                                                78   }
 78                                                    79 
 79   static G4bool firstTime = true;              <<  80   G4cout << "G4ASCIITreeSceneHandler::BeginModeling: writing to ";
 80   if (firstTime) {                             <<  81   if (outFileName == "G4cout") {
 81     firstTime = false;                         <<  82     G4cout << "G4 standard output (G4cout)";
 82     G4cout << "G4ASCIITreeSceneHandler::BeginM <<  83   } else {
 83     if (outFileName == "G4cout") {             <<  84     G4cout << "file \"" << outFileName << "\"";
 84       G4cout << "G4 standard output (G4cout)"; << 
 85     } else {                                   << 
 86       G4cout << "file \"" << outFileName << "\ << 
 87     }                                          << 
 88     G4cout << G4endl;                          << 
 89                                                << 
 90     WriteHeader (G4cout); G4cout << G4endl;    << 
 91   }                                                85   }
 92                                                <<  86   G4cout << G4endl;
                                                   >>  87 
                                                   >>  88   WriteHeader (G4cout); G4cout << G4endl;
 93   if (outFileName != "G4cout") {                   89   if (outFileName != "G4cout") {
 94     WriteHeader (fOutFile); fOutFile << std::e     90     WriteHeader (fOutFile); fOutFile << std::endl;
 95   }                                                91   }
 96 }                                                  92 }
 97                                                    93 
 98 void G4ASCIITreeSceneHandler::WriteHeader (std     94 void G4ASCIITreeSceneHandler::WriteHeader (std::ostream& os)
 99 {                                                  95 {
100   const G4ASCIITree* pSystem = (G4ASCIITree*)G     96   const G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
101   const G4int verbosity = pSystem->GetVerbosit     97   const G4int verbosity = pSystem->GetVerbosity();
102   const G4int detail = verbosity % 10;             98   const G4int detail = verbosity % 10;
103   os << "#  Set verbosity with \"/vis/ASCIITre     99   os << "#  Set verbosity with \"/vis/ASCIITree/verbose <verbosity>\":";
104   for (size_t i = 0;                              100   for (size_t i = 0;
105        i < G4ASCIITreeMessenger::fVerbosityGui    101        i < G4ASCIITreeMessenger::fVerbosityGuidance.size(); ++i) {
106     os << "\n#  " << G4ASCIITreeMessenger::fVe    102     os << "\n#  " << G4ASCIITreeMessenger::fVerbosityGuidance[i];
107   }                                               103   }
108   os << "\n#  Now printing with verbosity " <<    104   os << "\n#  Now printing with verbosity " << verbosity;
109   os << "\n#  Format is: PV:n";                   105   os << "\n#  Format is: PV:n";
110   if (detail >= 1) os << " / LV (SD,RO)";         106   if (detail >= 1) os << " / LV (SD,RO)";
111   if (detail >= 2) os << " / Solid(type)";        107   if (detail >= 2) os << " / Solid(type)";
112   if (detail >= 3) os << ", volume, density";     108   if (detail >= 3) os << ", volume, density";
113   if (detail >= 5) os << ", daughter-subtracte    109   if (detail >= 5) os << ", daughter-subtracted volume and mass";
114   if (detail >= 6) os << ", physical volume du    110   if (detail >= 6) os << ", physical volume dump";
115   if (detail >= 7) os << ", polyhedron dump";     111   if (detail >= 7) os << ", polyhedron dump";
116   os <<                                           112   os <<
117     "\n#  Abbreviations: PV = Physical Volume,    113     "\n#  Abbreviations: PV = Physical Volume,     LV = Logical Volume,"
118     "\n#                 SD = Sensitive Detect    114     "\n#                 SD = Sensitive Detector,  RO = Read Out Geometry.";
119 }                                                 115 }
120                                                   116 
121 void G4ASCIITreeSceneHandler::EndModeling () {    117 void G4ASCIITreeSceneHandler::EndModeling () {
122   const G4ASCIITree* pSystem = (G4ASCIITree*)     118   const G4ASCIITree* pSystem = (G4ASCIITree*) GetGraphicsSystem();
123   const G4int verbosity = pSystem->GetVerbosit    119   const G4int verbosity = pSystem->GetVerbosity();
124   const G4int detail = verbosity % 10;            120   const G4int detail = verbosity % 10;
125   const G4String& outFileName = pSystem -> Get    121   const G4String& outFileName = pSystem -> GetOutFileName();
126                                                   122 
127   // Output left over copy number, if any...      123   // Output left over copy number, if any...
128   if (fLastCopyNo != fLastNonSequentialCopyNo)    124   if (fLastCopyNo != fLastNonSequentialCopyNo) {
129     if (fLastCopyNo == fLastNonSequentialCopyN    125     if (fLastCopyNo == fLastNonSequentialCopyNo + 1) *fpOutFile << ',';
130     else *fpOutFile << '-';                       126     else *fpOutFile << '-';
131     *fpOutFile << fLastCopyNo;                    127     *fpOutFile << fLastCopyNo;
132   }                                               128   }
133   // Output outstanding rest of line, if any..    129   // Output outstanding rest of line, if any...
134   if (!fRestOfLine.str().empty()) *fpOutFile <    130   if (!fRestOfLine.str().empty()) *fpOutFile << fRestOfLine.str();
135   fRestOfLine.str("");                            131   fRestOfLine.str("");
136   fpLastPV = 0;                                   132   fpLastPV = 0;
137   fLastPVName.clear();                            133   fLastPVName.clear();
138   fLastCopyNo = -99;                              134   fLastCopyNo = -99;
139   fLastNonSequentialCopyNo = -99;                 135   fLastNonSequentialCopyNo = -99;
140                                                   136 
141   // This detail to G4cout regardless of outFi    137   // This detail to G4cout regardless of outFileName...
142   if (detail >= 4) {                              138   if (detail >= 4) {
143     G4cout << "Calculating mass(es)..." << G4e    139     G4cout << "Calculating mass(es)..." << G4endl;
144     const std::vector<G4Scene::Model>& models     140     const std::vector<G4Scene::Model>& models = fpScene->GetRunDurationModelList();
145     std::vector<G4Scene::Model>::const_iterato    141     std::vector<G4Scene::Model>::const_iterator i;
146     for (i = models.begin(); i != models.end()    142     for (i = models.begin(); i != models.end(); ++i) {
147       G4PhysicalVolumeModel* pvModel =            143       G4PhysicalVolumeModel* pvModel =
148   dynamic_cast<G4PhysicalVolumeModel*>(i->fpMo    144   dynamic_cast<G4PhysicalVolumeModel*>(i->fpModel);
149       if (pvModel) {                              145       if (pvModel) {
150         const G4ModelingParameters* tempMP =   << 146   if (pvModel->GetTopPhysicalVolume() ==
151         pvModel->GetModelingParameters();      << 147       G4TransportationManager::GetTransportationManager()
152         G4ModelingParameters mp;  // Default - << 148       ->GetNavigatorForTracking()->GetWorldVolume()) {
153         pvModel->SetModelingParameters (&mp);  << 149     const G4ModelingParameters* tempMP =
154         G4PhysicalVolumeMassScene massScene(pv << 150       pvModel->GetModelingParameters();
155         pvModel->DescribeYourselfTo (massScene << 151     G4ModelingParameters mp;  // Default - no culling.
156         G4double volume = massScene.GetVolume( << 152     pvModel->SetModelingParameters (&mp);
157         G4double mass = massScene.GetMass();   << 153     G4PhysicalVolumeMassScene massScene(pvModel);
158                                                << 154     pvModel->DescribeYourselfTo (massScene);
159         G4cout << "Overall volume of \""       << 155     G4double volume = massScene.GetVolume();
160         << pvModel->GetTopPhysicalVolume()->Ge << 156     G4double mass = massScene.GetMass();
161         << "\":"                               << 157 
162         << pvModel->GetTopPhysicalVolume()->Ge << 158     G4cout << "Overall volume of \""
163         << ", is "                             << 159      << pvModel->GetTopPhysicalVolume()->GetName()
164         << G4BestUnit (volume, "Volume")       << 160      << "\":"
165         << " and the daughter-included mass";  << 161      << pvModel->GetTopPhysicalVolume()->GetCopyNo()
166         G4int requestedDepth = pvModel->GetReq << 162      << ", is "
167         if (requestedDepth == G4PhysicalVolume << 163      << G4BestUnit (volume, "Volume")
168           G4cout << " to unlimited depth";     << 164      << " and the daughter-included mass";
169         } else {                               << 165     G4int requestedDepth = pvModel->GetRequestedDepth();
170           G4cout << ", ignoring daughters at d << 166     if (requestedDepth == G4PhysicalVolumeModel::UNLIMITED) {
171           << requestedDepth                    << 167       G4cout << " to unlimited depth";
172           << " and below,";                    << 168     } else {
173         }                                      << 169       G4cout << ", ignoring daughters at depth "
174         G4cout << " is " << G4BestUnit (mass,  << 170        << requestedDepth
175         << G4endl;                             << 171        << " and below,";
176                                                << 172     }
177         pvModel->SetModelingParameters (tempMP << 173     G4cout << " is " << G4BestUnit (mass, "Mass")
                                                   >> 174      << G4endl;
                                                   >> 175 
                                                   >> 176     pvModel->SetModelingParameters (tempMP);
                                                   >> 177   }
178       }                                           178       }
179     }                                             179     }
180   }                                               180   }
181                                                   181 
182   if (outFileName != "G4cout") {                  182   if (outFileName != "G4cout") {
183     fOutFile.close();                             183     fOutFile.close();
184     G4cout << "Output file \"" << outFileName     184     G4cout << "Output file \"" << outFileName << "\" closed." << G4endl;
185   }                                               185   }
186   fLVSet.clear();                                 186   fLVSet.clear();
187   fReplicaSet.clear();                            187   fReplicaSet.clear();
188   G4cout << "G4ASCIITreeSceneHandler::EndModel    188   G4cout << "G4ASCIITreeSceneHandler::EndModeling" << G4endl;
189   G4VTreeSceneHandler::EndModeling ();  // To     189   G4VTreeSceneHandler::EndModeling ();  // To re-use "culling off" code.
190 }                                                 190 }
191                                                   191 
192 void G4ASCIITreeSceneHandler::RequestPrimitive    192 void G4ASCIITreeSceneHandler::RequestPrimitives(const G4VSolid& solid) {
193                                                   193   
194   G4PhysicalVolumeModel* pPVModel =               194   G4PhysicalVolumeModel* pPVModel =
195     dynamic_cast<G4PhysicalVolumeModel*>(fpMod    195     dynamic_cast<G4PhysicalVolumeModel*>(fpModel);
196   if (!pPVModel) return;  // Not from a G4Phys    196   if (!pPVModel) return;  // Not from a G4PhysicalVolumeModel.
197                                                   197 
198   // This call comes from a G4PhysicalVolumeMo    198   // This call comes from a G4PhysicalVolumeModel.  drawnPVPath is
199   // the path of the current drawn (non-culled    199   // the path of the current drawn (non-culled) volume in terms of
200   // drawn (non-culled) ancestors.  Each node  << 200   // drawn (non-culled) ancesters.  Each node is identified by a
201   // PVNodeID object, which is a physical volu    201   // PVNodeID object, which is a physical volume and copy number.  It
202   // is a vector of PVNodeIDs corresponding to    202   // is a vector of PVNodeIDs corresponding to the geometry hierarchy
203   // actually selected, i.e., not culled.         203   // actually selected, i.e., not culled.
204   // The following typedef's already set in he    204   // The following typedef's already set in header file...
205   //typedef G4PhysicalVolumeModel::G4PhysicalV    205   //typedef G4PhysicalVolumeModel::G4PhysicalVolumeNodeID PVNodeID;
206   //typedef std::vector<PVNodeID> PVPath;         206   //typedef std::vector<PVNodeID> PVPath;
207   const PVPath& drawnPVPath = pPVModel->GetDra    207   const PVPath& drawnPVPath = pPVModel->GetDrawnPVPath();
208   //G4int currentDepth = pPVModel->GetCurrentD    208   //G4int currentDepth = pPVModel->GetCurrentDepth();
209   G4VPhysicalVolume* pCurrentPV = pPVModel->Ge    209   G4VPhysicalVolume* pCurrentPV = pPVModel->GetCurrentPV();
210   const G4String& currentPVName = pCurrentPV-> << 
211   const G4int currentCopyNo = pCurrentPV->GetC << 
212   G4LogicalVolume* pCurrentLV = pPVModel->GetC    210   G4LogicalVolume* pCurrentLV = pPVModel->GetCurrentLV();
213   G4Material* pCurrentMaterial = pPVModel->Get    211   G4Material* pCurrentMaterial = pPVModel->GetCurrentMaterial();
214                                                   212 
215   G4ASCIITree* pSystem = (G4ASCIITree*)GetGrap    213   G4ASCIITree* pSystem = (G4ASCIITree*)GetGraphicsSystem();
216   G4int verbosity = pSystem->GetVerbosity();      214   G4int verbosity = pSystem->GetVerbosity();
217   G4int detail = verbosity % 10;                  215   G4int detail = verbosity % 10;
218                                                   216 
219   // If verbosity < 10 suppress unnecessary re << 217   if (verbosity < 10 && pCurrentPV->IsReplicated()) {
220   // Repeated simple replicas can always be su << 218     // See if this has been a replica found before with same mother LV...
221   // Paramaterisations can only be suppressed  << 
222   // size, density, etc., are in principle dif << 
223   const G4bool isParameterised = pCurrentPV->G << 
224   const G4bool isSimpleReplica = pCurrentPV->I << 
225   const G4bool isAmenableToSupression =        << 
226   (verbosity < 10 && isSimpleReplica) || (verb << 
227   if (isAmenableToSupression) {                << 
228     // See if this has been found before with  << 
229     PVPath::const_reverse_iterator thisID = dr    219     PVPath::const_reverse_iterator thisID = drawnPVPath.rbegin();
230     PVPath::const_reverse_iterator motherID =     220     PVPath::const_reverse_iterator motherID = ++drawnPVPath.rbegin();
231     G4bool ignore = false;                        221     G4bool ignore = false;
232     for (ReplicaSetIterator i = fReplicaSet.be    222     for (ReplicaSetIterator i = fReplicaSet.begin(); i != fReplicaSet.end();
233          ++i) {                                << 223    ++i) {
234       if (i->back().GetPhysicalVolume()->GetLo    224       if (i->back().GetPhysicalVolume()->GetLogicalVolume() ==
235           thisID->GetPhysicalVolume()->GetLogi << 225     thisID->GetPhysicalVolume()->GetLogicalVolume()) {
236         // For each one previously found (if m << 226   // For each one previously found (if more than one, they must
237         // have different mothers)...          << 227   // have different mothers)...
238         // To avoid compilation errors on VC++ << 228   // To avoid compilation errors on VC++ .Net 7.1...
239         // Previously:                         << 229   // Previously:
240         //   PVNodeID previousMotherID = ++(i- << 230   //   PVNodeID previousMotherID = ++(i->rbegin());
241         // (Should that have been: PVNodeID::c << 231   // (Should that have been: PVNodeID::const_iterator previousMotherID?)
242         // Replace                             << 232   // Replace
243         //   previousMotherID == i->rend()     << 233   //   previousMotherID == i->rend()
244         // by                                  << 234   // by
245         //   i->size() <= 1                    << 235   //   i->size() <= 1
246         // Replace                             << 236   // Replace
247         //   previousMotherID != i->rend()     << 237   //   previousMotherID != i->rend()
248         // by                                  << 238   // by
249         //   i->size() > 1                     << 239   //   i->size() > 1
250         // Replace                             << 240   // Replace
251         //   previousMotherID->                << 241   //   previousMotherID->
252         // by                                  << 242   // by
253         //   (*i)[i->size() - 2].              << 243   //   (*i)[i->size() - 2].
254         if (motherID == drawnPVPath.rend() &&  << 244   if (motherID == drawnPVPath.rend() &&
255             i->size() <= 1)                    << 245       i->size() <= 1)
256           ignore = true;  // Both have no moth << 246     ignore = true;  // Both have no mother.
257         if (motherID != drawnPVPath.rend() &&  << 247   if (motherID != drawnPVPath.rend() &&
258             i->size() > 1 &&                   << 248       i->size() > 1 &&
259             motherID->GetPhysicalVolume()->Get << 249       motherID->GetPhysicalVolume()->GetLogicalVolume() ==
260             (*i)[i->size() - 2].GetPhysicalVol << 250       (*i)[i->size() - 2].GetPhysicalVolume()->GetLogicalVolume())
261           ignore = true;  // Same mother LV... << 251     ignore = true;  // Same mother LV...
262       }                                           252       }
263     }                                             253     }
264     if (ignore) {                                 254     if (ignore) {
265       pPVModel->CurtailDescent();                 255       pPVModel->CurtailDescent();
266       return;                                     256       return;
267     }                                             257     }
268   }                                               258   }
269                                                   259 
270   // Now suppress printing for volumes with th << 260   const G4String& currentPVName = pCurrentPV->GetName();
271   // copy number - but not if they are paramet << 261   const G4int currentCopyNo = pCurrentPV->GetCopyNo();
272   // taken out above (those that are "amenable << 262 
273   // taken out).                               << 263   if (verbosity < 10 && 
274   if (verbosity < 10 && !isParameterised &&    << 
275       currentPVName == fLastPVName &&             264       currentPVName == fLastPVName &&
276       currentCopyNo != fLastCopyNo) {             265       currentCopyNo != fLastCopyNo) {
                                                   >> 266     // For low verbosity, trap series of G4PVPlacements with the same name but
                                                   >> 267     // different copy number (replicas should have been taken out above)...
277     // Check...                                   268     // Check...
278     if (isAmenableToSupression) {              << 269     if (pCurrentPV->IsReplicated()) {
279       G4Exception("G4ASCIITreeSceneHandler::Re    270       G4Exception("G4ASCIITreeSceneHandler::RequestPrimitives",
280       "vistree0001",                              271       "vistree0001",
281       JustWarning,                                272       JustWarning,
282       "Volume amenable to suppressed printing  << 273       "Replica unexpected");
283     }                                             274     }
284     // Check mothers are identical...             275     // Check mothers are identical...
285     else if (pCurrentLV == (fpLastPV? fpLastPV    276     else if (pCurrentLV == (fpLastPV? fpLastPV->GetLogicalVolume(): 0)) {
286       if (currentCopyNo != fLastCopyNo + 1) {     277       if (currentCopyNo != fLastCopyNo + 1) {
287   // Non-sequential copy number...                278   // Non-sequential copy number...
288   *fpOutFile << ',' << currentCopyNo;             279   *fpOutFile << ',' << currentCopyNo;
289   fLastNonSequentialCopyNo = currentCopyNo;       280   fLastNonSequentialCopyNo = currentCopyNo;
290       }                                           281       }
291       fLastCopyNo = currentCopyNo;                282       fLastCopyNo = currentCopyNo;
292       pPVModel->CurtailDescent();                 283       pPVModel->CurtailDescent();
293       return;                                     284       return;
294     }                                             285     }
295   }                                               286   }
296   fpLastPV = pCurrentPV;                          287   fpLastPV = pCurrentPV;
297                                                   288 
298   // High verbosity or a new or otherwise non- << 289   // High verbosity or a new G4VPhysicalVolume...
299   // Output copy number, if any, from previous    290   // Output copy number, if any, from previous invocation...
300   if (fLastCopyNo != fLastNonSequentialCopyNo)    291   if (fLastCopyNo != fLastNonSequentialCopyNo) {
301     if (fLastCopyNo == fLastNonSequentialCopyN    292     if (fLastCopyNo == fLastNonSequentialCopyNo + 1) *fpOutFile << ',';
302     else *fpOutFile << '-';                       293     else *fpOutFile << '-';
303     *fpOutFile << fLastCopyNo;                    294     *fpOutFile << fLastCopyNo;
304   }                                               295   }
305   // Output rest of line, if any, from previou    296   // Output rest of line, if any, from previous invocation...
306   if (!fRestOfLine.str().empty()) *fpOutFile <    297   if (!fRestOfLine.str().empty()) *fpOutFile << fRestOfLine.str();
307   fRestOfLine.str("");                            298   fRestOfLine.str("");
308   fLastPVName = currentPVName;                    299   fLastPVName = currentPVName;
309   fLastCopyNo = currentCopyNo;                    300   fLastCopyNo = currentCopyNo;
310   fLastNonSequentialCopyNo = currentCopyNo;       301   fLastNonSequentialCopyNo = currentCopyNo;
311   // Start next line...                        << 
312   // Indent according to drawn path depth...      302   // Indent according to drawn path depth...
313   for (size_t i = 0; i < drawnPVPath.size(); i    303   for (size_t i = 0; i < drawnPVPath.size(); i++ ) *fpOutFile << "  ";
                                                   >> 304   // Start next line...
314   *fpOutFile << "\"" << currentPVName             305   *fpOutFile << "\"" << currentPVName
315        << "\":" << currentCopyNo;                 306        << "\":" << currentCopyNo;
316                                                   307 
317   if (pCurrentPV->IsReplicated()) {               308   if (pCurrentPV->IsReplicated()) {
318     if (verbosity < 10) {                         309     if (verbosity < 10) {
319       // Add printing for replicas (when repli    310       // Add printing for replicas (when replicas are ignored)...
320       EAxis axis;                                 311       EAxis axis;
321       G4int nReplicas;                            312       G4int nReplicas;
322       G4double width;                             313       G4double width;
323       G4double offset;                            314       G4double offset;
324       G4bool consuming;                           315       G4bool consuming;
325       pCurrentPV->GetReplicationData(axis,nRep    316       pCurrentPV->GetReplicationData(axis,nReplicas,width,offset,consuming);
326       G4VPVParameterisation* pP = pCurrentPV->    317       G4VPVParameterisation* pP = pCurrentPV->GetParameterisation();
327       if (pP) {                                   318       if (pP) {
328   if (detail < 3) {                               319   if (detail < 3) {
329     fReplicaSet.insert(drawnPVPath);              320     fReplicaSet.insert(drawnPVPath);
330     if (nReplicas > 2) fRestOfLine << '-';        321     if (nReplicas > 2) fRestOfLine << '-';
331     else fRestOfLine << ',';                      322     else fRestOfLine << ',';
332     fRestOfLine << nReplicas - 1                  323     fRestOfLine << nReplicas - 1
333           << " (" << nReplicas << " parametris    324           << " (" << nReplicas << " parametrised volumes)";
334   }                                               325   }
335       }                                           326       }
336       else {                                      327       else {
337   fReplicaSet.insert(drawnPVPath);                328   fReplicaSet.insert(drawnPVPath);
338   if (nReplicas > 2) fRestOfLine << '-';          329   if (nReplicas > 2) fRestOfLine << '-';
339   else fRestOfLine << ',';                        330   else fRestOfLine << ',';
340   fRestOfLine << nReplicas - 1                    331   fRestOfLine << nReplicas - 1
341         << " (" << nReplicas << " replicas)";     332         << " (" << nReplicas << " replicas)";
342       }                                           333       }
343     }                                             334     }
344   } else {                                        335   } else {
345     if (fLVSet.find(pCurrentLV) != fLVSet.end(    336     if (fLVSet.find(pCurrentLV) != fLVSet.end()) {
346       if (verbosity <  10) {                      337       if (verbosity <  10) {
347   // Add printing for repeated LV (if it has d    338   // Add printing for repeated LV (if it has daughters)...
348   if (pCurrentLV->GetNoDaughters()) fRestOfLin    339   if (pCurrentLV->GetNoDaughters()) fRestOfLine << " (repeated LV)";
349   // ...and curtail descent.                      340   // ...and curtail descent.
350   pPVModel->CurtailDescent();                     341   pPVModel->CurtailDescent();
351       }                                           342       }
352     }                                             343     }
353   }                                               344   }
354                                                   345 
355   if (detail >= 1) {                              346   if (detail >= 1) {
356     fRestOfLine << " / \""                        347     fRestOfLine << " / \""
357     << pCurrentLV->GetName() << "\"";             348     << pCurrentLV->GetName() << "\"";
358     G4VSensitiveDetector* sd = pCurrentLV->Get    349     G4VSensitiveDetector* sd = pCurrentLV->GetSensitiveDetector();
359     if (sd) {                                     350     if (sd) {
360       fRestOfLine << " (SD=\"" << sd->GetName(    351       fRestOfLine << " (SD=\"" << sd->GetName() << "\"";
361       G4VReadOutGeometry* roGeom = sd->GetROge    352       G4VReadOutGeometry* roGeom = sd->GetROgeometry();
362       if (roGeom) {                               353       if (roGeom) {
363   fRestOfLine << ",RO=\"" << roGeom->GetName()    354   fRestOfLine << ",RO=\"" << roGeom->GetName() << "\"";
364       }                                           355       }
365       fRestOfLine << ")";                         356       fRestOfLine << ")";
366     }                                             357     }
367   }                                               358   }
368                                                   359 
369   if (detail >= 2) {                              360   if (detail >= 2) {
370     fRestOfLine << " / \""                        361     fRestOfLine << " / \""
371          << solid.GetName()                       362          << solid.GetName()
372          << "\"("                                 363          << "\"("
373          << solid.GetEntityType() << ")";         364          << solid.GetEntityType() << ")";
374   }                                               365   }
375                                                   366 
376   if (detail >= 3) {                              367   if (detail >= 3) {
377     fRestOfLine << ", "                           368     fRestOfLine << ", "
378     << G4BestUnit(((G4VSolid&)solid).GetCubicV    369     << G4BestUnit(((G4VSolid&)solid).GetCubicVolume(),"Volume")
379     << ", ";                                      370     << ", ";
380     if (pCurrentMaterial) {                       371     if (pCurrentMaterial) {
381       fRestOfLine                                 372       fRestOfLine
382   << G4BestUnit(pCurrentMaterial->GetDensity()    373   << G4BestUnit(pCurrentMaterial->GetDensity(), "Volumic Mass")
383   << " (" << pCurrentMaterial->GetName() << ")    374   << " (" << pCurrentMaterial->GetName() << ")";
384     } else {                                      375     } else {
385       fRestOfLine << "(No material)";             376       fRestOfLine << "(No material)";
386     }                                             377     }
387   }                                               378   }
388                                                   379 
389   if (detail >= 5) {                              380   if (detail >= 5) {
390     if (pCurrentMaterial) {                       381     if (pCurrentMaterial) {
391       G4Material* pMaterial = const_cast<G4Mat    382       G4Material* pMaterial = const_cast<G4Material*>(pCurrentMaterial);
392       // ...and find daughter-subtracted mass.    383       // ...and find daughter-subtracted mass...
393       G4double daughter_subtracted_mass = pCur    384       G4double daughter_subtracted_mass = pCurrentLV->GetMass
394   (pCurrentPV->IsParameterised(),  // Force if    385   (pCurrentPV->IsParameterised(),  // Force if parametrised.
395    false,  // Do not propagate - calculate for    386    false,  // Do not propagate - calculate for this volume minus
396    // volume of daughters.                        387    // volume of daughters.
397    pMaterial);                                    388    pMaterial);
398       G4double daughter_subtracted_volume =       389       G4double daughter_subtracted_volume =
399   daughter_subtracted_mass / pCurrentMaterial-    390   daughter_subtracted_mass / pCurrentMaterial->GetDensity();
400       fRestOfLine << ", "                         391       fRestOfLine << ", "
401       << G4BestUnit(daughter_subtracted_volume    392       << G4BestUnit(daughter_subtracted_volume,"Volume")
402       << ", "                                     393       << ", "
403       << G4BestUnit(daughter_subtracted_mass,"    394       << G4BestUnit(daughter_subtracted_mass,"Mass");
404     }                                             395     }
405   }                                               396   }
406                                                   397 
407   if (detail >= 6) {                              398   if (detail >= 6) {
408     std::vector<G4AttValue>* attValues = pPVMo    399     std::vector<G4AttValue>* attValues = pPVModel->CreateCurrentAttValues();
409     const std::map<G4String,G4AttDef>* attDefs    400     const std::map<G4String,G4AttDef>* attDefs = pPVModel->GetAttDefs();
410     fRestOfLine << '\n' << G4AttCheck(attValue    401     fRestOfLine << '\n' << G4AttCheck(attValues, attDefs);
411     delete attValues;                             402     delete attValues;
412   }                                               403   }
413                                                   404 
414   if (detail >= 7) {                              405   if (detail >= 7) {
415     G4Polyhedron* polyhedron = solid.GetPolyhe    406     G4Polyhedron* polyhedron = solid.GetPolyhedron();
416     fRestOfLine << "\nLocal polyhedron coordin    407     fRestOfLine << "\nLocal polyhedron coordinates:\n" << *polyhedron;
417     const G4Transform3D& transform = pPVModel- << 408     G4Transform3D* transform = pPVModel->GetCurrentTransform();
418     polyhedron->Transform(transform);          << 409     polyhedron->Transform(*transform);
419     fRestOfLine << "\nGlobal polyhedron coordi    410     fRestOfLine << "\nGlobal polyhedron coordinates:\n" << *polyhedron;
420   }                                               411   }
421                                                   412 
422   if (fLVSet.find(pCurrentLV) == fLVSet.end())    413   if (fLVSet.find(pCurrentLV) == fLVSet.end()) {
423     fLVSet.insert(pCurrentLV);  // Record new     414     fLVSet.insert(pCurrentLV);  // Record new logical volume.
424   }                                               415   }
425                                                   416 
426   fRestOfLine << std::endl;                       417   fRestOfLine << std::endl;
427                                                   418 
428   return;                                         419   return;
429 }                                                 420 }
430                                                   421