Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:21:09

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