Geant4 Cross Reference |
1 // 1 2 // ******************************************* 3 // * License and Disclaimer 4 // * 5 // * The Geant4 software is copyright of th 6 // * the Geant4 Collaboration. It is provided 7 // * conditions of the Geant4 Software License 8 // * LICENSE and available at http://cern.ch/ 9 // * include a list of copyright holders. 10 // * 11 // * Neither the authors of this software syst 12 // * institutes,nor the agencies providing fin 13 // * work make any representation or warran 14 // * regarding this software system or assum 15 // * use. Please see the license in the file 16 // * for the full disclaimer and the limitatio 17 // * 18 // * This code implementation is the result 19 // * technical work of the GEANT4 collaboratio 20 // * By using, copying, modifying or distri 21 // * any work based on the software) you ag 22 // * use in resulting scientific publicati 23 // * acceptance of all terms of the Geant4 Sof 24 // ******************************************* 25 // 26 /// \file g3tog4/clGeometry/src/G3toG4Detector 27 /// \brief Implementation of the G3toG4Detecto 28 // 29 // 30 // 31 //-------------------------------------------- 32 // G3toG4DetectorConstruction. Most the work i 33 // G4BuildGeom, which returns a G4LogicalVolum 34 // top-level logiical volume in the detector d 35 // inFile 36 //-------------------------------------------- 37 38 #include "G3toG4DetectorConstruction.hh" 39 40 #include "G4Box.hh" 41 #include "G4Colour.hh" 42 #include "G4Material.hh" 43 #include "G4SystemOfUnits.hh" 44 #include "G4VisAttributes.hh" 45 #include "G4ios.hh" 46 47 //....oooOO0OOooo........oooOO0OOooo........oo 48 49 G3toG4DetectorConstruction::G3toG4DetectorCons 50 : G4VUserDetectorConstruction(), fInFile(inF 51 { 52 G4cout << "Instantiated G3toG4DetectorConstr 53 << G4endl; 54 } 55 56 //....oooOO0OOooo........oooOO0OOooo........oo 57 58 G3toG4DetectorConstruction::~G3toG4DetectorCon 59 { 60 // G4cout << "Deleted G3toG4DetectorConstruc 61 } 62 63 //....oooOO0OOooo........oooOO0OOooo........oo 64 65 G4VPhysicalVolume* G3toG4DetectorConstruction: 66 { 67 G4LogicalVolume* lv = G4BuildGeom(fInFile); 68 // G4LogicalVolume* lv = SimpleConstruct(); 69 if (lv) { 70 G4VPhysicalVolume* pv = new G4PVPlacement( 71 G4cout << "Top-level G3toG4 logical volume 72 << *(lv->GetVisAttributes()) << G4e 73 return pv; 74 } 75 76 G4cerr << "creation of logical mother failed 77 return 0; 78 } 79 80 //....oooOO0OOooo........oooOO0OOooo........oo 81 82 G4LogicalVolume* G3toG4DetectorConstruction::S 83 { 84 G4String name, symbol; // a=mass of a mole; 85 G4double a, z, density, fractionmass; // z= 86 G4int ncomponents; // iz=number of protons 87 // n=number of nucleons in an isotope; 88 89 a = 14.01 * g / mole; 90 G4Element* eN = new G4Element(name = "Nitrog 91 92 a = 16.00 * g / mole; 93 G4Element* eO = new G4Element(name = "Oxygen 94 95 // 96 // define a material from elements. case 2 97 // 98 99 density = 1.290 * mg / cm3; 100 G4Material* air = new G4Material(name = "Air 101 air->AddElement(eN, fractionmass = 0.7); 102 air->AddElement(eO, fractionmass = 0.3); 103 G4VSolid* mother = new G4Box("TestMother", 104 100 * cm, 100 * 105 106 G4VSolid* daughter = new G4Box("TestDaughter 107 108 G4LogicalVolume* logicMother = new G4Logical 109 110 111 112 G4LogicalVolume* logicDaughter = new G4Logic 113 114 115 116 new G4PVPlacement(0, G4ThreeVector(), logicD 117 // 118 // Visualization attributes 119 // 120 121 logicMother->SetVisAttributes(G4VisAttribute 122 G4VisAttributes* daughterVisAtt = new G4VisA 123 daughterVisAtt->SetVisibility(true); 124 logicDaughter->SetVisAttributes(daughterVisA 125 return logicMother; 126 } 127 128 //....oooOO0OOooo........oooOO0OOooo........oo 129