// // ******************************************************************** // * License and Disclaimer * // * * // * 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. 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 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. * // ******************************************************************** // // /// \file B1/src/DetectorConstruction.cc /// \brief Implementation of the B1::DetectorConstruction class #include "DetectorConstruction.hh" #include "G4RunManager.hh" #include "G4NistManager.hh" #include "G4Box.hh" #include "G4Cons.hh" #include "G4Orb.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4SystemOfUnits.hh" namespace B1 { //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* DetectorConstruction::Construct() { G4bool checkOverlaps = true; // Get nist material manager G4NistManager* nist = G4NistManager::Instance(); G4Material* air = nist->FindOrBuildMaterial("G4_AIR"); G4Material* material = nist->FindOrBuildMaterial("G4_WATER"); // World auto solidWorld = new G4Box("World", 10*m, 10*m, 10*m); auto logicWorld = new G4LogicalVolume(solidWorld, air, "World"); auto physWorld = new G4PVPlacement(nullptr, G4ThreeVector(), logicWorld, "World", nullptr, false, 0, checkOverlaps); // Cone G4double r = 5*m, rmin = 0.5*m , rmax = 1*m, z = 0.5*m;; auto solidDet = new G4Cons("Detector", 0*m, rmin, 0*m, rmax, z, 0*deg, 360*deg); auto logicDet = new G4LogicalVolume(solidDet, material, "Detector"); // Place boxes constexpr G4int ndet = 6; G4double theta[ndet] = { 15, 15, 15, 165, 165, 165 }; G4double phi[ndet] = { 0, 120, -120, 0, 120, -120 }; for (G4int i = 0; i < ndet; ++i) { G4int copyNumber = i + 1; auto transform = G4RotateX3D(-90*deg)* G4RotateZ3D(phi[i]*deg)* G4RotateY3D(theta[i]*deg)* G4TranslateZ3D(r); /* auto transform = G4RotateY3D(phi[i]*deg)* G4RotateX3D(theta[i]*deg)* G4TranslateY3D(r)* G4RotateX3D(-90*deg); */ new G4PVPlacement(transform, logicDet, "Detector", logicWorld, false, copyNumber, checkOverlaps); } //always return the physical World fScoringVolume = logicWorld; return physWorld; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... }