Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-15 08:28:56

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 DetectorConstruction.cc
0027 /// \brief Implementation of the DetectorConstruction class
0028 
0029 #include "DetectorConstruction.hh"
0030 
0031 #include "BiasingOperator.hh"
0032 
0033 #include "G4Box.hh"
0034 #include "G4Element.hh"
0035 #include "G4ElementTable.hh"
0036 #include "G4LogicalVolume.hh"
0037 #include "G4Material.hh"
0038 #include "G4MaterialTable.hh"
0039 #include "G4NistManager.hh"
0040 #include "G4PVPlacement.hh"
0041 #include "G4ProductionCuts.hh"
0042 #include "G4Region.hh"
0043 #include "G4RegionStore.hh"
0044 #include "G4SDManager.hh"
0045 #include "G4SystemOfUnits.hh"
0046 #include "G4ThreeVector.hh"
0047 #include "G4Tubs.hh"
0048 
0049 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0050 
0051 DetectorConstruction::DetectorConstruction()
0052   : G4VUserDetectorConstruction(),
0053     fSiliconTrackerLogical(nullptr),
0054     fEmCaloLogical(nullptr),
0055     fHadCaloLogical(nullptr)
0056 {}
0057 
0058 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0059 
0060 DetectorConstruction::~DetectorConstruction() {}
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0063 
0064 G4VPhysicalVolume* DetectorConstruction::Construct()
0065 {
0066   G4cout << "\nDetectorConstruction....\n" << G4endl;
0067 
0068   //--------- Material definition ---------
0069   G4NistManager* nistManager = G4NistManager::Instance();
0070   G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
0071   G4Material* csi = nistManager->FindOrBuildMaterial("G4_CESIUM_IODIDE");
0072   G4Material* silicon = nistManager->FindOrBuildMaterial("G4_Si");
0073   G4Material* iron = nistManager->FindOrBuildMaterial("G4_Fe");
0074 
0075   // World
0076   G4Box* worldBox = new G4Box("WorldBox", 200.0 * cm, 200.0 * cm, 200.0 * cm);
0077   G4LogicalVolume* worldLogical = new G4LogicalVolume(worldBox, air, "WorldLogical", 0, 0, 0);
0078   G4PVPlacement* worldPhys =
0079     new G4PVPlacement(0, G4ThreeVector(), "WorldPhysical", worldLogical, 0, false, 0);
0080 
0081   // Silicon Tracker: for simplicity and to have more hadronic interactions,
0082   //                  it is single layer of silicon (20 cm thick)
0083   G4double halfDetectorXYsize = 100.0 * cm;
0084   G4Box* siliconBox = new G4Box("siliconBox", halfDetectorXYsize, halfDetectorXYsize, 10.0 * cm);
0085   fSiliconTrackerLogical =
0086     new G4LogicalVolume(siliconBox, silicon, "SiliconTrackerLogical", 0, 0, 0);
0087   new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 0.0), "SiliconTrackerPhysical",
0088                     fSiliconTrackerLogical, worldPhys, false, 0);
0089 
0090   // Electromagnetic (EM) calorimeter: an homogeneous crystal (40 cm thick)
0091   G4Box* emCaloBox = new G4Box("EmCaloBox", halfDetectorXYsize, halfDetectorXYsize, 20.0 * cm);
0092   fEmCaloLogical = new G4LogicalVolume(emCaloBox, csi, "EmCalorimeterLogical", 0, 0, 0);
0093   new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 35.0 * cm), "EmCalorimeterPhysical", fEmCaloLogical,
0094                     worldPhys, false, 0);
0095 
0096   // The hadronic (HAD) calorimeter: an homogeneous block of metal (100 cm thick)
0097   G4Box* hadCaloBox = new G4Box("HadCaloBox", halfDetectorXYsize, halfDetectorXYsize, 50.0 * cm);
0098   fHadCaloLogical = new G4LogicalVolume(hadCaloBox, iron, "HadCaloLogical", 0, 0, 0);
0099   new G4PVPlacement(0, G4ThreeVector(0.0, 0.0, 110.0 * cm), "HadCaloPhysical", fHadCaloLogical,
0100                     worldPhys, false, 0);
0101 
0102   // Define the tracker region
0103   G4Region* trackerRegion = new G4Region("Tracker_region");
0104   trackerRegion->AddRootLogicalVolume(fSiliconTrackerLogical);
0105   std::vector<double> cuts;
0106   cuts.push_back(10.0 * cm);
0107   cuts.push_back(10.0 * cm);
0108   cuts.push_back(10.0 * cm);
0109   cuts.push_back(10.0 * cm);
0110   trackerRegion->SetProductionCuts(new G4ProductionCuts);
0111   trackerRegion->GetProductionCuts()->SetProductionCuts(cuts);
0112 
0113   // Define the EM calorimeter region
0114   G4Region* emCaloRegion = new G4Region("EM_calo_region");
0115   emCaloRegion->AddRootLogicalVolume(fEmCaloLogical);
0116   cuts.clear();
0117   cuts.push_back(20.0 * cm);
0118   cuts.push_back(20.0 * cm);
0119   cuts.push_back(20.0 * cm);
0120   cuts.push_back(20.0 * cm);
0121   emCaloRegion->SetProductionCuts(new G4ProductionCuts);
0122   emCaloRegion->GetProductionCuts()->SetProductionCuts(cuts);
0123 
0124   // Define the HAD calorimeter region
0125   G4Region* hadCaloRegion = new G4Region("HAD_calo_region");
0126   hadCaloRegion->AddRootLogicalVolume(fHadCaloLogical);
0127   cuts.clear();
0128   cuts.push_back(50.0 * cm);
0129   cuts.push_back(50.0 * cm);
0130   cuts.push_back(50.0 * cm);
0131   cuts.push_back(50.0 * cm);
0132   hadCaloRegion->SetProductionCuts(new G4ProductionCuts);
0133   hadCaloRegion->GetProductionCuts()->SetProductionCuts(cuts);
0134 
0135   return worldPhys;
0136 }
0137 
0138 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0139 
0140 void DetectorConstruction::ConstructSDandField()
0141 {
0142   // Instanciate the biasing operator and specify the particles of interest (i.e. p, n, pi+, pi-)
0143   // and the logical volume(s) where this operator should be applied.
0144   BiasingOperator* biasingOperator = new BiasingOperator;
0145   biasingOperator->AddParticle("proton");
0146   biasingOperator->AddParticle("neutron");
0147   biasingOperator->AddParticle("pi+");
0148   biasingOperator->AddParticle("pi-");
0149   biasingOperator->AttachTo(fSiliconTrackerLogical);
0150 }
0151 
0152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......