Back to home page

EIC code displayed by LXR

 
 

    


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

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 biasing/ReverseMC01/src/RMC01DetectorConstruction.cc
0027 /// \brief Implementation of the RMC01DetectorConstruction class
0028 //
0029 //
0030 //////////////////////////////////////////////////////////////
0031 //      Class Name:        RMC01DetectorConstruction
0032 //        Author:               L. Desorgher
0033 //         Organisation:         SpaceIT GmbH
0034 //        Contract:        ESA contract 21435/08/NL/AT
0035 //         Customer:             ESA/ESTEC
0036 //////////////////////////////////////////////////////////////
0037 
0038 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0039 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0040 
0041 #include "RMC01DetectorConstruction.hh"
0042 
0043 #include "RMC01DetectorMessenger.hh"
0044 #include "RMC01SD.hh"
0045 
0046 #include "G4Box.hh"
0047 #include "G4Colour.hh"
0048 #include "G4GeometryManager.hh"
0049 #include "G4LogicalVolume.hh"
0050 #include "G4LogicalVolumeStore.hh"
0051 #include "G4Material.hh"
0052 #include "G4Orb.hh"
0053 #include "G4PVPlacement.hh"
0054 #include "G4PhysicalConstants.hh"
0055 #include "G4PhysicalVolumeStore.hh"
0056 #include "G4RunManager.hh"
0057 #include "G4SDManager.hh"
0058 #include "G4SolidStore.hh"
0059 #include "G4SystemOfUnits.hh"
0060 #include "G4Tubs.hh"
0061 #include "G4VisAttributes.hh"
0062 
0063 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0064 
0065 RMC01DetectorConstruction::RMC01DetectorConstruction()
0066   : G4VUserDetectorConstruction(),
0067     fDetectorMessenger(0),
0068     fShield_Thickness(5. * mm),
0069     fSensitive_cylinder_H(1. * mm),
0070     fSensitive_cylinder_Rout(1. * mm)
0071 {
0072   fDetectorMessenger = new RMC01DetectorMessenger(this);
0073 }
0074 
0075 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0076 
0077 RMC01DetectorConstruction::~RMC01DetectorConstruction()
0078 {
0079   delete fDetectorMessenger;
0080 }
0081 
0082 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0083 
0084 G4VPhysicalVolume* RMC01DetectorConstruction::Construct()
0085 {
0086   DefineMaterials();
0087   return ConstructSimpleGeometry();
0088 }
0089 
0090 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0091 
0092 void RMC01DetectorConstruction::DefineMaterials()
0093 {
0094   G4String symbol;  // a=mass of a mole;
0095   G4double a, z, density;  // z=mean number of protons;
0096   G4double fractionmass;
0097   G4int ncomponents;
0098 
0099   //
0100   // define Elements
0101   //
0102 
0103   G4Element* N = new G4Element("Nitrogen", symbol = "N", z = 7., a = 14.01 * g / mole);
0104   G4Element* O = new G4Element("Oxygen", symbol = "O", z = 8., a = 16.00 * g / mole);
0105 
0106   //
0107   // define simple materials
0108   //
0109 
0110   new G4Material("Aluminum", z = 13., a = 26.98 * g / mole, density = 2.700 * g / cm3);
0111   new G4Material("Silicon", z = 14., a = 28.09 * g / mole, density = 2.33 * g / cm3);
0112   new G4Material("Tantalum", z = 73., a = 180.9479 * g / mole, density = 16.654 * g / cm3);
0113 
0114   //
0115   // define air
0116   //
0117 
0118   G4Material* Air = new G4Material("Air", density = 1.290 * mg / cm3, ncomponents = 2);
0119   Air->AddElement(N, fractionmass = 0.7);
0120   Air->AddElement(O, fractionmass = 0.3);
0121 
0122   //
0123   // Example of Vacuum
0124   //
0125 
0126   new G4Material("Vacuum", z = 1., a = 1.01 * g / mole, density = universe_mean_density, kStateGas,
0127                  3.e-18 * pascal, 2.73 * kelvin);
0128 }
0129 
0130 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0131 
0132 G4VPhysicalVolume* RMC01DetectorConstruction::ConstructSimpleGeometry()
0133 {
0134   // Clean old geometry, if any
0135 
0136   G4GeometryManager::GetInstance()->OpenGeometry();
0137   G4PhysicalVolumeStore::GetInstance()->Clean();
0138   G4LogicalVolumeStore::GetInstance()->Clean();
0139   G4SolidStore::GetInstance()->Clean();
0140 
0141   // World
0142   //-----------
0143 
0144   G4Box* solidWorld = new G4Box("World", 15. * cm, 15. * cm, 15. * cm);
0145   G4LogicalVolume* logicWorld =
0146     new G4LogicalVolume(solidWorld, G4Material::GetMaterial("Vacuum"), "World");
0147 
0148   G4VPhysicalVolume* physiWorld = new G4PVPlacement(0,  // no rotation
0149                                                     G4ThreeVector(),  // at (0,0,0)
0150                                                     logicWorld,  // its logical volume
0151                                                     "World",  // its name
0152                                                     0,  // its mother  volume
0153                                                     false,  // no boolean operation
0154                                                     0);
0155 
0156   // Shielding Aluminum Sphere
0157   //-------------------
0158 
0159   G4double radiusShieldingSphere = 10. * cm;
0160 
0161   G4Orb* solidShieldingSphere = new G4Orb("Shielding", radiusShieldingSphere);
0162   G4LogicalVolume* logicShieldingSphere =
0163     new G4LogicalVolume(solidShieldingSphere, G4Material::GetMaterial("Aluminum"),
0164                         "Shielding");  // its name;
0165 
0166   new G4PVPlacement(0,  // no rotation
0167                     G4ThreeVector(),  // at (0,0,0)
0168                     logicShieldingSphere,  // its logical volume
0169                     "Shielding",  // its name
0170                     logicWorld,  // its mother  volume
0171                     false,  // no boolean operation
0172                     0);
0173 
0174   // Bulk Sphere
0175   //-------------------
0176 
0177   G4Orb* solidBulkSphere = new G4Orb("Bulk", radiusShieldingSphere - fShield_Thickness);
0178   G4LogicalVolume* logicBulkSphere =
0179     new G4LogicalVolume(solidBulkSphere,  // its solid
0180                         G4Material::GetMaterial("Air"),  // its material
0181                         "Bulk");  // its name;
0182 
0183   new G4PVPlacement(0,  // no rotation
0184                     G4ThreeVector(),  // at (0,0,0)
0185                     logicBulkSphere,  // its logical volume
0186                     "Bulk",  // its name
0187                     logicShieldingSphere,  // its mother  volume
0188                     false,  // no boolean operation
0189                     0);
0190 
0191   // Detecting cylinder
0192   //-------------------
0193 
0194   G4Tubs* solidDetecting = new G4Tubs("SensitiveVolume", 0., fSensitive_cylinder_Rout,
0195                                       fSensitive_cylinder_H / 2., 0., twopi);
0196 
0197   G4LogicalVolume* logicDetectingCylinder =
0198     new G4LogicalVolume(solidDetecting, G4Material::GetMaterial("Silicon"), "SensitiveVolume");
0199 
0200   new G4PVPlacement(0,  // no rotation
0201                     G4ThreeVector(0., 0., 0.),  // at (0,0,0)
0202                     logicDetectingCylinder,  // its logical volume
0203                     "SensitiveVolume",  // its name
0204                     logicBulkSphere,  // its mother  volume
0205                     false,  // no boolean operation
0206                     0);
0207 
0208   RMC01SD* theSensitiveDetector = new RMC01SD("/SensitiveCylinder");
0209 
0210   G4SDManager::GetSDMpointer()->AddNewDetector(theSensitiveDetector);
0211   logicDetectingCylinder->SetSensitiveDetector(theSensitiveDetector);
0212 
0213   // Tantalum Plates on the top and beside
0214   //-------------------------------------
0215   G4Box* solidPlate = new G4Box("TantalumPlate", 4. * cm, 4. * cm, 0.25 * mm);
0216   G4LogicalVolume* logicPlate =
0217     new G4LogicalVolume(solidPlate,  // its solid
0218                         G4Material::GetMaterial("Tantalum"),  // its material
0219                         "TantalumPlate");  // its name;
0220 
0221   new G4PVPlacement(0,  // no rotation
0222                     G4ThreeVector(0., 0., 6. * cm),  // at (0,0,0)
0223                     logicPlate,  // its logical volume
0224                     "TantalumPlate1",  // its name
0225                     logicBulkSphere,  // its mother  volume
0226                     false,  // no boolean operation
0227                     0);
0228 
0229   new G4PVPlacement(0,  // no rotation
0230                     G4ThreeVector(0., 0., -6. * cm),  // at (0,0,0)
0231                     logicPlate,  // its logical volume
0232                     "TantalumPlate2",  // its name
0233                     logicBulkSphere,  // its mother  volume
0234                     false,  // no boolean operation
0235                     0);
0236 
0237   return physiWorld;
0238 }
0239 
0240 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0241 
0242 void RMC01DetectorConstruction::SetSensitiveVolumeRadius(G4double r)
0243 {
0244   fSensitive_cylinder_Rout = r;
0245 }
0246 
0247 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0248 
0249 void RMC01DetectorConstruction::SetSensitiveVolumeHeight(G4double h)
0250 {
0251   fSensitive_cylinder_H = h;
0252 }
0253 
0254 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0255 
0256 void RMC01DetectorConstruction::SetShieldingThickness(G4double d)
0257 {
0258   fShield_Thickness = d;
0259 }
0260 
0261 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......