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