Back to home page

EIC code displayed by LXR

 
 

    


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

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 exoticphysics/phonon/src/XDetectorConstruction.cc
0027 /// \brief Implementation of the XDetectorConstruction class
0028 //
0029 //
0030 // 20141006  For MT compatibility, move SD handling to ConstructSDandField()
0031 
0032 #include "XDetectorConstruction.hh"
0033 
0034 #include "XAluminumElectrodeSensitivity.hh"
0035 
0036 #include "G4Box.hh"
0037 #include "G4Colour.hh"
0038 #include "G4LatticeLogical.hh"
0039 #include "G4LatticeManager.hh"
0040 #include "G4LatticePhysical.hh"
0041 #include "G4LogicalVolume.hh"
0042 #include "G4Material.hh"
0043 #include "G4NistManager.hh"
0044 #include "G4PVPlacement.hh"
0045 #include "G4SDManager.hh"
0046 #include "G4Sphere.hh"
0047 #include "G4SystemOfUnits.hh"
0048 #include "G4Tubs.hh"
0049 #include "G4UserLimits.hh"
0050 #include "G4VisAttributes.hh"
0051 #include "G4ios.hh"
0052 
0053 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0054 
0055 XDetectorConstruction::XDetectorConstruction() : fConstructed(false), fIfField(false)
0056 {
0057   fLiquidHelium = NULL;
0058   fGermanium = NULL;
0059   fAluminum = NULL;
0060   fTungsten = NULL;
0061   fWorldPhys = NULL;
0062 }
0063 
0064 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0065 
0066 XDetectorConstruction::~XDetectorConstruction()
0067 {
0068   ;
0069 }
0070 
0071 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0072 
0073 G4VPhysicalVolume* XDetectorConstruction::Construct()
0074 {
0075   if (!fConstructed) {
0076     fConstructed = true;
0077     DefineMaterials();
0078     SetupGeometry();
0079   }
0080   return fWorldPhys;
0081 }
0082 
0083 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0084 
0085 void XDetectorConstruction::DefineMaterials()
0086 {
0087   G4NistManager* nistManager = G4NistManager::Instance();
0088 
0089   fLiquidHelium = nistManager->FindOrBuildMaterial("G4_AIR");  // to be corrected
0090   fGermanium = nistManager->FindOrBuildMaterial("G4_Ge");
0091   fAluminum = nistManager->FindOrBuildMaterial("G4_Al");
0092   fTungsten = nistManager->FindOrBuildMaterial("G4_W");
0093 }
0094 
0095 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0096 
0097 void XDetectorConstruction::SetupGeometry()
0098 {
0099   //
0100   // World
0101   //
0102   G4VSolid* worldSolid = new G4Box("World", 16. * cm, 16. * cm, 16. * cm);
0103   G4LogicalVolume* worldLogical = new G4LogicalVolume(worldSolid, fLiquidHelium, "World");
0104   worldLogical->SetUserLimits(new G4UserLimits(10 * mm, DBL_MAX, DBL_MAX, 0, 0));
0105   fWorldPhys = new G4PVPlacement(0, G4ThreeVector(), worldLogical, "World", 0, false, 0);
0106 
0107   //
0108   // Germanium cylinder - this is the volume in which we will propagate phonons
0109   //
0110   G4VSolid* fGermaniumSolid =
0111     new G4Tubs("fGermaniumSolid", 0. * cm, 3.81 * cm, 1.27 * cm, 0. * deg, 360. * deg);
0112   G4LogicalVolume* fGermaniumLogical =
0113     new G4LogicalVolume(fGermaniumSolid, fGermanium, "fGermaniumLogical");
0114   G4VPhysicalVolume* GePhys = new G4PVPlacement(0, G4ThreeVector(), fGermaniumLogical,
0115                                                 "fGermaniumPhysical", worldLogical, false, 0);
0116 
0117   //
0118   // Germanium lattice information
0119   //
0120 
0121   // G4LatticeManager gives physics processes access to lattices by volume
0122   G4LatticeManager* LM = G4LatticeManager::GetLatticeManager();
0123   G4LatticeLogical* GeLogical = LM->LoadLattice(fGermanium, "Ge");
0124 
0125   // G4LatticePhysical assigns G4LatticeLogical a physical orientation
0126   G4LatticePhysical* GePhysical = new G4LatticePhysical(GeLogical, GePhys->GetFrameRotation());
0127   LM->RegisterLattice(GePhys, GePhysical);
0128 
0129   // NOTE:  Above registration can also be done in single step:
0130   // G4LatticlePhysical* GePhysical = LM->LoadLattice(GePhys, "Ge");
0131 
0132   //
0133   // Aluminum - crystal end caps. This is where phonon hits are registered
0134   //
0135   G4VSolid* fAluminumSolid =
0136     new G4Tubs("aluminiumSolid", 0. * cm, 3.81 * cm, 0.01 * cm, 0. * deg, 360. * deg);
0137 
0138   G4LogicalVolume* fAluminumLogical =
0139     new G4LogicalVolume(fAluminumSolid, fAluminum, "fAluminumLogical");
0140   new G4PVPlacement(0, G4ThreeVector(0., 0., 1.28 * cm), fAluminumLogical, "fAluminumPhysical",
0141                     worldLogical, false, 0);
0142   new G4PVPlacement(0, G4ThreeVector(0., 0., -1.28 * cm), fAluminumLogical, "fAluminumPhysical",
0143                     worldLogical, false, 1);
0144 
0145   //
0146   // Visualization attributes
0147   //
0148   worldLogical->SetVisAttributes(G4VisAttributes::GetInvisible());
0149   G4VisAttributes* simpleBoxVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
0150   simpleBoxVisAtt->SetVisibility(true);
0151   fGermaniumLogical->SetVisAttributes(simpleBoxVisAtt);
0152   fAluminumLogical->SetVisAttributes(simpleBoxVisAtt);
0153 }
0154 
0155 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0156 
0157 void XDetectorConstruction::ConstructSDandField()
0158 {
0159   //
0160   // detector -- Note : Aluminum electrode sensitivity is attached to Germanium
0161   //
0162   XAluminumElectrodeSensitivity* electrodeSensitivity =
0163     new XAluminumElectrodeSensitivity("XAluminumElectrode");
0164   G4SDManager::GetSDMpointer()->AddNewDetector(electrodeSensitivity);
0165   SetSensitiveDetector("fGermaniumLogical", electrodeSensitivity);
0166 }
0167 
0168 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....