Back to home page

EIC code displayed by LXR

 
 

    


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

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 electromagnetic/TestEm10/src/DetectorConstruction.cc
0027 /// \brief Implementation of the DetectorConstruction class
0028 //
0029 //
0030 //
0031 //
0032 
0033 #include "DetectorConstruction.hh"
0034 
0035 #include "DetectorALICE06.hh"
0036 #include "DetectorBari05.hh"
0037 #include "DetectorBarr90.hh"
0038 #include "DetectorHarris73.hh"
0039 #include "DetectorMessenger.hh"
0040 #include "DetectorSimpleALICE.hh"
0041 #include "DetectorWatase86.hh"
0042 #include "Materials.hh"
0043 
0044 #include "G4LogicalVolume.hh"
0045 #include "G4LogicalVolumeStore.hh"
0046 #include "G4ProductionCuts.hh"
0047 #include "G4Region.hh"
0048 #include "G4RegionStore.hh"
0049 #include "G4SystemOfUnits.hh"
0050 #include "G4ios.hh"
0051 
0052 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0053 
0054 DetectorConstruction::DetectorConstruction()
0055   : G4VUserDetectorConstruction(), fRadiatorDescription(0), fSetUp("simpleALICE")
0056 {
0057   fDetectorMessenger = new DetectorMessenger(this);
0058 }
0059 
0060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0061 
0062 DetectorConstruction::~DetectorConstruction()
0063 {
0064   delete fRadiatorDescription;
0065   delete fDetectorMessenger;
0066   delete Materials::GetInstance();
0067 }
0068 
0069 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0070 
0071 G4VPhysicalVolume* DetectorConstruction::Construct()
0072 {
0073   G4VPhysicalVolume* world = nullptr;
0074   if (fSetUp == "simpleALICE") {
0075     DetectorSimpleALICE simpleALICE;
0076     world = simpleALICE.Construct();
0077     fRadiatorDescription = simpleALICE.GetRadiatorDescription();
0078   }
0079   else if (fSetUp == "alice06") {
0080     DetectorALICE06 alice06;
0081     world = alice06.Construct();
0082     fRadiatorDescription = alice06.GetRadiatorDescription();
0083   }
0084   else if (fSetUp == "bari05") {
0085     DetectorBari05 bari05;
0086     world = bari05.Construct();
0087     fRadiatorDescription = bari05.GetRadiatorDescription();
0088   }
0089   else if (fSetUp == "harris73") {
0090     DetectorHarris73 harris73;
0091     world = harris73.Construct();
0092     fRadiatorDescription = harris73.GetRadiatorDescription();
0093   }
0094   else if (fSetUp == "watase86") {
0095     DetectorWatase86 watase86;
0096     world = watase86.Construct();
0097     fRadiatorDescription = watase86.GetRadiatorDescription();
0098   }
0099   else if (fSetUp == "barr90") {
0100     DetectorBarr90 barr90;
0101     world = barr90.Construct();
0102     fRadiatorDescription = barr90.GetRadiatorDescription();
0103   }
0104   else {
0105     G4cout << "Experimental setup is unsupported. Check /XTRdetector/setup " << G4endl;
0106     G4cout << "Run default: simpleALICE" << G4endl;
0107 
0108     DetectorSimpleALICE simpleALICE;
0109     world = simpleALICE.Construct();
0110     fRadiatorDescription = simpleALICE.GetRadiatorDescription();
0111   }
0112   G4RegionStore* regionStore = G4RegionStore::GetInstance();
0113   size_t nRegions = regionStore->size();
0114   G4double cut = 1. * CLHEP::mm;
0115   for (size_t i = 0; i < nRegions; ++i) {
0116     G4Region* reg = (*regionStore)[i];
0117     if (!reg->GetProductionCuts()) {
0118       G4ProductionCuts* cuts = new G4ProductionCuts();
0119       cuts->SetProductionCut(cut, "gamma");
0120       cuts->SetProductionCut(cut, "e-");
0121       cuts->SetProductionCut(cut, "e+");
0122       cuts->SetProductionCut(cut, "proton");
0123       reg->SetProductionCuts(cuts);
0124     }
0125   }
0126   return world;
0127 }
0128 
0129 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0130 
0131 RadiatorDescription* DetectorConstruction::GetRadiatorDescription() const
0132 {
0133   if (!fRadiatorDescription) {
0134     G4cout << "RadiatorDescription is not defined" << G4endl;
0135   }
0136   return fRadiatorDescription;
0137 }
0138 
0139 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0140 
0141 G4Material* DetectorConstruction::GetAbsorberMaterial() const
0142 {
0143   G4LogicalVolume* lv = G4LogicalVolumeStore::GetInstance()->GetVolume("Absorber");
0144 
0145   if (!lv) {
0146     G4cerr << "Absorber logical volume is not defined." << G4endl;
0147     return 0;
0148   }
0149 
0150   return lv->GetMaterial();
0151 }
0152 
0153 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......