Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-17 07:52:11

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 // --------------------------------------------------------------
0030 //      GEANT 4 - DetectorConstruction class
0031 // --------------------------------------------------------------
0032 //
0033 // Author: Witold POKORSKI (Witold.Pokorski@cern.ch)
0034 //
0035 // --------------------------------------------------------------
0036 //
0037 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0038 
0039 #include "DetectorConstruction.hh"
0040 
0041 #include "G4Box.hh"
0042 #include "G4LogicalVolume.hh"
0043 #include "G4Material.hh"
0044 #include "G4NistManager.hh"
0045 #include "G4PVPlacement.hh"
0046 #include "G4PhysicalConstants.hh"
0047 #include "G4SystemOfUnits.hh"
0048 #include "G4ThreeVector.hh"
0049 #include "globals.hh"
0050 
0051 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0052 
0053 DetectorConstruction::DetectorConstruction() : G4VUserDetectorConstruction(), fAbsorberMaterial(0)
0054 {}
0055 
0056 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0057 
0058 DetectorConstruction::~DetectorConstruction() {}
0059 
0060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0061 
0062 G4VPhysicalVolume* DetectorConstruction::Construct()
0063 {
0064   //------------------- materials ------------------------
0065 
0066   //--- simple materials
0067 
0068   G4NistManager* nistManager = G4NistManager::Instance();
0069 
0070   // Iron has a  X0 = 1.7585 cm  and  lambda_I = 16.760 cm.
0071   G4Material* iron = nistManager->FindOrBuildMaterial("G4_Fe");
0072 
0073   // Copper has a  X0 = 1.4353 cm  and  lambda_I = 15.056 cm.
0074   G4Material* copper = nistManager->FindOrBuildMaterial("G4_Cu");
0075 
0076   // Tungsten has a  X0 = 0.35 cm  and  lambda_I = 9.5855 cm.
0077   G4Material* tungsten = nistManager->FindOrBuildMaterial("G4_W");
0078 
0079   // Lead has a  X0 = 0.56120 cm  and  lambda_I = 17.092 cm.
0080   G4Material* lead = nistManager->FindOrBuildMaterial("G4_Pb");
0081 
0082   // Uranium has a  X0 = 0.31662 cm  and  lambda_I = 10.501 cm.
0083   G4Material* uranium = nistManager->FindOrBuildMaterial("G4_U");
0084 
0085   // Liquid Argon has a  X0 = 10.971 cm  and  lambda_I = 65.769 cm.
0086   G4double a, z, density;
0087   density = 1.4 * g / cm3;
0088   a = 39.95 * g / mole;
0089   G4Material* liquidArgon = new G4Material("LiquidArgon", z = 18., a, density);
0090 
0091   //--- mixtures
0092 
0093   G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
0094 
0095   // 4-May-2006 : We rename "Vacuum" as "G4vacuum" to avoid
0096   //              problems with Flugg.
0097   G4double pressure, temperature, fractionMass;
0098   G4int nel;
0099   density = 1.e-5 * g / cm3;
0100   pressure = 2.e-2 * bar;
0101   temperature = STP_Temperature;  // From PhysicalConstants.h .
0102   G4Material* vacuum =
0103     new G4Material("G4vacuum", density, nel = 1, kStateGas, temperature, pressure);
0104   vacuum->AddMaterial(air, fractionMass = 1.);
0105 
0106   // Plastic scintillator tiles (used both in CMS hadron calorimeter
0107   // and ATLAS hadron barrel calorimeter):
0108   //     X0 = 42.4 cm  and  lambda_I = 79.360 cm.
0109   G4int natoms;
0110   G4Element* elH = nistManager->FindOrBuildElement("H");
0111   G4Element* elC = nistManager->FindOrBuildElement("C");
0112   density = 1.032 * g / cm3;
0113   G4Material* polystyrene = new G4Material("Polystyrene", density, nel = 2);
0114   polystyrene->AddElement(elC, natoms = 19);
0115   polystyrene->AddElement(elH, natoms = 21);
0116 
0117   // PbWO4 CMS crystals. It has a  X0 = 0.89 cm  and  lambda_I = 22.4 cm.
0118   G4Element* elPb = nistManager->FindOrBuildElement("Pb");
0119   G4Element* elW = nistManager->FindOrBuildElement("W");
0120   G4Element* elO = nistManager->FindOrBuildElement("O");
0121   density = 8.28 * g / cm3;
0122   G4Material* pbWO4 = new G4Material("PbWO4", density, nel = 3);
0123   pbWO4->AddElement(elPb, natoms = 1);
0124   pbWO4->AddElement(elW, natoms = 1);
0125   pbWO4->AddElement(elO, natoms = 4);
0126 
0127   //------------------- volumes --------------------------
0128 
0129   // --- experimental hall (world volume)
0130   //     beam line along z axis
0131 
0132   //***LOOKHERE***
0133   const G4double sizeExpHall = 4.0 * m;  // For normal calorimeter
0134   // const G4double sizeExpHall = 10.0*m;     // For Scintillator calorimeter
0135 
0136   G4double expHall_x = sizeExpHall / 2.0;  // half dimension along x
0137   G4double expHall_y = sizeExpHall / 2.0;  // half dimension along y
0138   G4double expHall_z = sizeExpHall / 2.0;  // half dimension along z
0139 
0140   G4Box* experimentalHall_box = new G4Box("expHall_box", expHall_x, expHall_y, expHall_z);
0141 
0142   G4LogicalVolume* experimentalHallLog = new G4LogicalVolume(experimentalHall_box,  // solid
0143                                                              vacuum,  // material
0144                                                              "expHall_log",  // name
0145                                                              0,  // field manager
0146                                                              0,  // sensitive detector
0147                                                              0);  // user limits
0148 
0149   G4VPhysicalVolume* experimentalHallPhys =
0150     new G4PVPlacement(0,  // rotation
0151                       G4ThreeVector(),  // translation
0152                       "expHall",  // name
0153                       experimentalHallLog,  // logical volume
0154                       0,  // mother physical volume
0155                       false,  // boolean operation
0156                       0);  // copy number
0157 
0158   // --- Detector
0159 
0160   //***LOOKHERE***
0161   const G4double sizeCalo = 2.0 * m;  // For normal calorimeter
0162   // const G4double sizeCalo = 8.0*m;         // For Scintillator calorimeter
0163 
0164   G4double xAbsorber = sizeCalo / 2.0;  // half dimension along x
0165   G4double yAbsorber = sizeCalo / 2.0;  // half dimension along y
0166   G4double zAbsorber = sizeCalo / 2.0;  // half dimension along z
0167 
0168   G4Box* solidAbsorber = new G4Box("solidAbsorber", xAbsorber, yAbsorber, zAbsorber);
0169 
0170   G4LogicalVolume* logicAbsorber = new G4LogicalVolume(solidAbsorber,  // solid
0171                                                        fAbsorberMaterial,  // material
0172                                                        "logicAbsorber",  // name
0173                                                        0,  // field manager
0174                                                        0,  // sensitive detector
0175                                                        0);  // user limits
0176 
0177   new G4PVPlacement(0,  // rotation
0178                     G4ThreeVector(),  // translation
0179                     "physiAbsorber",  // its name
0180                     logicAbsorber,  // logical volume
0181                     experimentalHallPhys,  // mother physical volume
0182                     false,  // boolean operation
0183                     100);  // copy number
0184 
0185   // --- Check if all materials were built
0186   if ((!iron) || (!copper) || (!tungsten) || (!lead) || (!uranium) || (!pbWO4) || (!polystyrene)
0187       || (!liquidArgon))
0188   {
0189     G4cerr << "Failure in building materials." << G4endl;
0190   }
0191 
0192   // --- Set default values    ***LOOKHERE***
0193   fAbsorberMaterial = iron;
0194   // fAbsorberMaterial = copper;
0195   // fAbsorberMaterial = tungsten;
0196   // fAbsorberMaterial = lead;
0197   // fAbsorberMaterial = uranium;
0198   // fAbsorberMaterial = pbWO4;
0199   // fAbsorberMaterial = polystyrene;
0200   // fAbsorberMaterial = liquidArgon;
0201 
0202   logicAbsorber->SetMaterial(fAbsorberMaterial);
0203 
0204   PrintParameters();
0205 
0206   return experimentalHallPhys;
0207 }
0208 
0209 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0210 
0211 void DetectorConstruction::PrintParameters()
0212 {
0213   G4cout << G4endl << G4endl << " ------  DetectorConstruction::PrintParameters() ------ " << G4endl
0214          << " Absorber Material = ";
0215   if (fAbsorberMaterial) {
0216     G4cout << fAbsorberMaterial->GetName();
0217   }
0218   else {
0219     G4cout << " UNDEFINED ";
0220   }
0221   G4cout << G4endl << " -------------------------------------------------------- " << G4endl
0222          << G4endl;
0223 }
0224 
0225 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....