Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:20:46

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 /// \file GB07/src/GB07DetectorConstruction.cc
0027 /// \brief Implementation of the GB07DetectorConstruction class
0028 //
0029 #include "GB07DetectorConstruction.hh"
0030 
0031 #include "GB07BOptrLeadingParticle.hh"
0032 #include "GB07SD.hh"
0033 
0034 #include "G4Box.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4LogicalVolumeStore.hh"
0037 #include "G4Material.hh"
0038 #include "G4NistManager.hh"
0039 #include "G4PVPlacement.hh"
0040 #include "G4SDManager.hh"
0041 #include "G4SystemOfUnits.hh"
0042 
0043 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0044 
0045 GB07DetectorConstruction::GB07DetectorConstruction() : G4VUserDetectorConstruction() {}
0046 
0047 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0048 
0049 GB07DetectorConstruction::~GB07DetectorConstruction() {}
0050 
0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0052 
0053 G4VPhysicalVolume* GB07DetectorConstruction::Construct()
0054 {
0055   G4Material* worldMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
0056   G4Material* defaultMaterial = G4NistManager::Instance()->FindOrBuildMaterial("G4_CONCRETE");
0057 
0058   G4VSolid* solidWorld = new G4Box("World", 10 * m, 10 * m, 10 * m);
0059 
0060   G4LogicalVolume* logicWorld = new G4LogicalVolume(solidWorld,  // its solid
0061                                                     worldMaterial,  // its material
0062                                                     "World");  // its name
0063 
0064   G4PVPlacement* physiWorld = new G4PVPlacement(0,  // no rotation
0065                                                 G4ThreeVector(),  // at (0,0,0)
0066                                                 logicWorld,  // its logical volume
0067                                                 "World",  // its name
0068                                                 0,  // its mother  volume
0069                                                 false,  // no boolean operation
0070                                                 0);  // copy number
0071 
0072   // -----------------------------------
0073   // -- volume where biasing is applied:
0074   // -----------------------------------
0075   G4double halfZ = 1 * m;
0076   G4VSolid* solidTest = new G4Box("test.solid", 1 * m, 1 * m, halfZ);
0077 
0078   G4LogicalVolume* logicTest = new G4LogicalVolume(solidTest,  // its solid
0079                                                    defaultMaterial,  // its material
0080                                                    "test.logical");  // its name
0081 
0082   new G4PVPlacement(0,  // no rotation
0083                     G4ThreeVector(0, 0, halfZ),  // put entrance at (0,0,0)
0084                     logicTest,  // its logical volume
0085                     "test.physical",  // its name
0086                     logicWorld,  // its mother  volume
0087                     false,  // no boolean operation
0088                     0);  // copy number
0089 
0090   // ------------------------------------------------------------
0091   // -- volume to tally exiting particles, put next to above one:
0092   // ------------------------------------------------------------
0093   G4double halfZtally = 0.5 * mm;
0094   G4VSolid* solidTally = new G4Box("tally.solid", 1 * m, 1 * m, halfZtally);
0095   G4LogicalVolume* logicTally = new G4LogicalVolume(solidTally,  // its solid
0096                                                     worldMaterial,  // its material
0097                                                     "tally.logical");  // its name
0098 
0099   new G4PVPlacement(0,  // no rotation
0100                     G4ThreeVector(0, 0, 2 * halfZ + halfZtally),  // put next to test.phys
0101                     logicTally,  // its logical volume
0102                     "tally.physical",  // its name
0103                     logicWorld,  // its mother volume
0104                     false,  // no boolean operation
0105                     0);  // copy number
0106 
0107   return physiWorld;
0108 }
0109 
0110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0111 
0112 void GB07DetectorConstruction::ConstructSDandField()
0113 {
0114   // -- Fetch volume for biasing:
0115   G4LogicalVolume* logicTest = G4LogicalVolumeStore::GetInstance()->GetVolume("test.logical");
0116 
0117   // ----------------------------------------------
0118   // -- operator creation and attachment to volume:
0119   // ----------------------------------------------
0120   GB07BOptrLeadingParticle* testMany = new GB07BOptrLeadingParticle();
0121   testMany->AttachTo(logicTest);
0122   G4cout << " Attaching biasing operator " << testMany->GetName() << " to logical volume "
0123          << logicTest->GetName() << G4endl;
0124 
0125   // ---------------------------------------------------------------------------------
0126   // -- Attach sensitive detector to print information on particle exiting the shield:
0127   // ---------------------------------------------------------------------------------
0128   // -- create and register sensitive detector code module:
0129   G4SDManager* SDman = G4SDManager::GetSDMpointer();
0130   G4VSensitiveDetector* sd = new GB07SD("Tally");
0131   SDman->AddNewDetector(sd);
0132   // -- Fetch volume for sensitivity and attach sensitive module to it:
0133   G4LogicalVolume* logicSD = G4LogicalVolumeStore::GetInstance()->GetVolume("tally.logical");
0134   logicSD->SetSensitiveDetector(sd);
0135 }
0136 
0137 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......