// // ******************************************************************** // * 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 "G4Tubs.hh" #include "G4TwistedBox.hh" #include "G4SubtractionSolid.hh" #include "G4IntersectionSolid.hh" #include "G4LogicalVolume.hh" #include "G4PVPlacement.hh" #include "G4SystemOfUnits.hh" namespace B1 { //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... G4VPhysicalVolume* DetectorConstruction::Construct() { // Get nist material manager G4NistManager* nist = G4NistManager::Instance(); G4Material* air_mat = nist->FindOrBuildMaterial("G4_AIR"); G4Material* plastic_mat = nist->FindOrBuildMaterial("G4_PLASTIC_SC_VINYLTOLUENE"); // Option to switch on/off checking of volumes overlaps G4bool checkOverlaps = false; // World G4Box* solidWorld = new G4Box("World",1000*mm,1000*mm,1000*mm); G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld,air_mat,"World"); G4VPhysicalVolume* physWorld = new G4PVPlacement(0,G4ThreeVector(),logicWorld,"World",0,false,0,checkOverlaps); // Construct fiber G4double dx, dy, dz, twist, rmin, rmax, dh; G4VSolid* box1 = new G4TwistedBox("TwistedBox1", twist=-60*deg, dx=1000*mm, dy=50*mm, dz=500*mm); G4VSolid* box2 = new G4TwistedBox("TwistedBox2", twist, dx-2*dy, dy+10*mm, dz+1*mm); G4VSolid* sector = new G4Tubs("Sector", rmin=dx-2*dy, rmax=dx+10*mm, dh=2*dz+10*mm, -90*deg, 180*deg); //G4VSolid* fiber = new G4IntersectionSolid("Fiber", box1, sector); G4VSolid* fiber = new G4SubtractionSolid("Fiber", box1, box2); G4LogicalVolume* logicFiber = new G4LogicalVolume(fiber,plastic_mat,"Fiber"); // Place fibers G4int nn = 20; for (G4int i=0; i < nn; ++i) { G4RotationMatrix* rot = new G4RotationMatrix(); rot->rotateZ(i*180*deg/nn); new G4PVPlacement(rot,G4ThreeVector(),logicFiber,"Twisted",logicWorld,false,0,checkOverlaps); } // Always return the physical World fScoringVolume = logicWorld; return physWorld; } //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... }