Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-10-14 08:09:01

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 //
0027 /// @file DetectorConstruction.cc
0028 /// @brief Define geometry
0029 
0030 #include "DetectorConstruction.hh"
0031 
0032 #include "Materials.hh"
0033 
0034 #include "G4Box.hh"
0035 #include "G4LogicalVolume.hh"
0036 #include "G4Material.hh"
0037 #include "G4PVPlacement.hh"
0038 #include "G4SystemOfUnits.hh"
0039 #include "G4Tubs.hh"
0040 #include "G4VisAttributes.hh"
0041 
0042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0043 DetectorConstruction::DetectorConstruction() {}
0044 
0045 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0046 DetectorConstruction::~DetectorConstruction() {}
0047 
0048 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0049 G4VPhysicalVolume* DetectorConstruction::Construct()
0050 {
0051   // material definition
0052   Materials* materialConstruction = new Materials;
0053   materialConstruction->Construct();
0054 
0055   G4Material* mate;
0056   G4VisAttributes* va;
0057 
0058   // world volume
0059   const G4double DXYZ_AREA = 32. * cm;
0060   G4Box* areaSolid = new G4Box("AREA", DXYZ_AREA / 2., DXYZ_AREA / 2., DXYZ_AREA / 2.);
0061 
0062   G4Material* vacuum = G4Material::GetMaterial("Vacuum");
0063   G4LogicalVolume* areaLV = new G4LogicalVolume(areaSolid, vacuum, "AREA_LV");
0064   G4PVPlacement* area = new G4PVPlacement(0, G4ThreeVector(), "AREA_PV", areaLV, 0, false, 0);
0065   // vis. attributes
0066   va = new G4VisAttributes(G4Color(1., 1., 1.));
0067   va->SetVisibility(false);
0068   areaLV->SetVisAttributes(va);
0069 
0070   // detectors
0071   // voxel
0072   const G4double dvoxel = 10. * mm;
0073   const G4double dl = 10. * cm;
0074 
0075   G4Box* svoxel = new G4Box("voxel", dvoxel, dl, dvoxel);
0076   mate = G4Material::GetMaterial("Vacuum");
0077   G4LogicalVolume* lvoxel = new G4LogicalVolume(svoxel, mate, "voxel");
0078   va = new G4VisAttributes(G4Color(0., 0.8, 0.8));
0079   va->SetVisibility(false);
0080   lvoxel->SetVisAttributes(va);
0081 
0082   G4int ix, iz;
0083   G4int index = 0;
0084   for (iz = 0; iz < 5; iz++) {
0085     for (ix = -7; ix <= 7; ix++) {
0086       G4double x0 = (2. * ix) * cm;
0087       G4double z0 = (-13. + 2. * iz) * cm;
0088       new G4PVPlacement(0, G4ThreeVector(x0, 0., z0), lvoxel, "voxel", areaLV, false, index);
0089       index++;
0090     }
0091   }
0092 
0093   // tube
0094   G4Tubs* stube = new G4Tubs("tube", 0. * mm, 19. / 2. * mm, dl, 0., 360. * deg);
0095   mate = G4Material::GetMaterial("Al");
0096   G4LogicalVolume* ltube = new G4LogicalVolume(stube, mate, "tube");
0097   va = new G4VisAttributes(G4Color(0., 0.8, 0.8));
0098   ltube->SetVisAttributes(va);
0099 
0100   G4RotationMatrix* rmtube = new G4RotationMatrix;
0101   rmtube->rotateX(-90. * deg);
0102   new G4PVPlacement(rmtube, G4ThreeVector(), ltube, "tube", lvoxel, false, 0);
0103 
0104   // cal
0105   const G4double dxycal = 25. * mm;
0106   const G4double dzcal = 3. * cm;
0107 
0108   G4Box* scal = new G4Box("cal", dxycal, dxycal, dzcal);
0109   mate = G4Material::GetMaterial("CsI");
0110   G4LogicalVolume* lcal = new G4LogicalVolume(scal, mate, "cal");
0111   va = new G4VisAttributes(G4Color(0.5, 0.5, 0.));
0112   lcal->SetVisAttributes(va);
0113 
0114   index = 0;
0115   for (ix = -2; ix <= 2; ix++) {
0116     G4double x0 = (5. * ix) * cm;
0117     new G4PVPlacement(0, G4ThreeVector(x0, 0., 2. * cm), lcal, "cal", areaLV, false, index);
0118     index++;
0119   }
0120 
0121   return area;
0122 }
0123 
0124 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0125 void DetectorConstruction::ConstructSDandField() {}