⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 #mt01detectorconstruction.cc#

📁 利用linux环境下蒙特卡罗计算工具geant4实现伽玛射线与探测器乘积能量的模拟过程
💻 CC#
字号:
//// ********************************************************************// * DISCLAIMER                                                       *// *                                                                  *// * The following disclaimer summarizes all the specific disclaimers *// * of contributors to this software. The specific disclaimers,which *// * govern, are listed with their locations in:                      *// *   http://cern.ch/geant4/license                                  *// *                                                                  *// * Neither the authors of this software system, nor their employing *// * institutes,nor the agencies providing financial support for this *// * work  make  any representation or  warranty, express or implied, *// * regarding  this  software system or assume any liability for its *// * use.                                                             *// *                                                                  *// * This  code  implementation is the  intellectual property  of the *// * GEANT4 collaboration.                                            *// * By copying,  distributing  or modifying the Program (or any work *// * based  on  the Program)  you indicate  your  acceptance of  this *// * statement, and all its terms.                                    *// ********************************************************************////// $Id: ExN01DetectorConstruction.cc,v 1.8 2003/10/06 08:59:11 maire Exp $// GEANT4 tag $Name: geant4-07-00-patch-01 $// #include "mt01DetectorConstruction.hh"//#include "mt01DetectorMessenger.hh"//#include "mt01ChamberParameterisation.hh"//#include "mt01MagneticField.hh"#include "mt01TrackerSD.hh"#include "G4Material.hh"#include "G4Box.hh"#include "G4Tubs.hh"#include "G4LogicalVolume.hh"#include "G4PVPlacement.hh"#include "G4PVParameterised.hh"#include "G4SDManager.hh"#include "globals.hh"#include "G4UserLimits.hh"#include "G4VisAttributes.hh"#include "G4Colour.hh"#include "G4ios.hh"mt01DetectorConstruction::mt01DetectorConstruction()  :  experimentalHall_log(0), tracker_log(0),windowAl_log(0),windowGlass_log(0),windowWater_log(0),     calorimeterBlock_log(0), calorimeterLayer_log(0),moon_log(0),antitracker1_log(0),antitracker2_log(0),    experimentalHall_phys(0), calorimeterLayer_phys(0),     calorimeterBlock_phys(0), tracker_phys(0),moon_phys(0),antitracker1_phys(0),antitracker2_phys(0),windowAl_phys(0),windowGlass_phys(0),windowWater_phys(0){;}mt01DetectorConstruction::~mt01DetectorConstruction(){}G4VPhysicalVolume* mt01DetectorConstruction::Construct(){  //------------------------------------------------------ materials  G4double a;  // atomic mass  G4double z;  // atomic number  G4double density,temperature,pressure;  G4int nel;  // G4Material* Gas =   // new G4Material("ArgonGas", z= 18., a= 39.95*g/mole, density= 1.782*mg/cm3);  density     = universe_mean_density;  pressure    = 3.e-18*pascal;  temperature = 2.73*kelvin;  G4Material* Vacuum = new G4Material("Galactic", z=1., a=1.01*g/mole,                                    density,kStateGas,temperature,pressure);  //new G4Material("Gas", z= 1., a= 1*g/mole, density= (1e-25)*mg/cm3);  G4Element* N = new G4Element("Nitrogen", "N", z=7., a= 14.01*g/mole);  G4Element* H  =new G4Element("Hydrogen","H",z=1.,a=1*g/mole);  G4Element* C = new G4Element("Carbon", "C", z=6, a=12.01*g/mole);  G4Element* O = new G4Element("Oxygen"  , "O", z=8., a= 16.00*g/mole);  a = 126.904*g/mole;  G4Element* I  = new G4Element("Iodine"  ,"I" , z= 53., a);  G4Element* Si = new G4Element("Silicon", "Si", z=14, a=28.09*g/mole);  G4Element* Ti = new G4Element("Titanium", "Ti", z=22, a=47.88*g/mole);  G4Element* Cr = new G4Element("Chromium", "Cr", z=24, a=52*g/mole);  G4Element* Fe = new G4Element("Ferrum", "Fe", z=26, a=55.85*g/mole);  G4Element* Mn = new G4Element("Manganese", "Mn", z=25, a=54.94*g/mole);  G4Element* Mg = new G4Element("Magnesium", "Mg", z=12, a=24.31*g/mole);  G4Element* Ca = new G4Element("Calcium", "Ca", z=20, a=40.08*g/mole);  G4Element* Na = new G4Element("Sodium", "Na", z=11, a=22.99*g/mole);  G4Element* K = new G4Element("Potassium", "K", z=19, a=39.10*g/mole);  G4Element* P = new G4Element("Phosphorus", "P", z=15, a=30.97*g/mole);  G4Element* S = new G4Element("Sulphur", "S", z=16, a=32.07*g/mole);  G4Element* Al1 = new G4Element("Aluminium1", "AL1", z=13, a=26.98*g/mole);a = 132.905*g/mole;  G4Element* Cs  = new G4Element("Cesium"  ,"Cs" , z= 55., a);  density = 4.53*g/cm3;  G4Material* CsI = new G4Material("CesiumIodide", density, nel=2);  CsI->AddElement(Cs, 5);  CsI->AddElement(I, 5);  G4Material* Air = new G4Material("Air", density= 1.29*mg/cm3, nel=2);  Air->AddElement(N, 70*perCent);  Air->AddElement(O, 30*perCent);G4Material* Glass = new G4Material("Glass", density=2.2*mg/cm3, nel=2); Glass -> AddElement(Si, 1); Glass -> AddElement(O,  2);G4Material* Water = new G4Material("Water", density=1*g/cm3, nel=2); Water -> AddElement(H, 2); Water -> AddElement(O, 1);   G4Material *Plastic=new G4Material("Plastic",density=2*g/cm3,nel=2); Plastic->AddElement(C,4); Plastic->AddElement(H,12); G4Element* La=new G4Element("Lanthanum","La",z=51,a=138.90*g/mole); G4Element* Br=new G4Element("Bromine","Br",z=35,a=79.90*g/mole); G4Material* LaBr3=new G4Material("LaBr3",density=5.29*g/cm3,nel=2); LaBr3->AddElement(La,1); LaBr3->AddElement(Br,3);       G4Material* Al =  new G4Material("Aluminum", z= 13., a= 26.98*g/mole, density= 2.7*g/cm3);  G4Material* Pb =   new G4Material("Lead", z= 82., a= 207.19*g/mole, density= 11.35*g/cm3);G4Material* FAN=new G4Material("FAN",density=2.85*g/cm3,nel=13);FAN->AddElement(Si,20.86*perCent);FAN->AddElement(O,43.47*perCent);FAN->AddElement(Ti,1.46*perCent);FAN->AddElement(Al1,9.63*perCent);FAN->AddElement(Cr,0.22*perCent);FAN->AddElement(Fe,9.08*perCent);FAN->AddElement(Mn,0.16*perCent);FAN->AddElement(Mg,5.54*perCent);FAN->AddElement(Ca,8.93*perCent);FAN->AddElement(Na,0.32*perCent);FAN->AddElement(K,0.15*perCent);FAN->AddElement(P,0.09*perCent);FAN->AddElement(S,0.09*perCent);  //------------------------------------------------------ volumes  //------------------------------ experimental hall (world volume)  //------------------------------ beam line along x axis  G4double expHall_x = 20.0*m;  G4double expHall_y = 20.0*m;  G4double expHall_z = 20.0*m;  G4Box* experimentalHall_box    = new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);  experimentalHall_log = new G4LogicalVolume(experimentalHall_box,                                          Vacuum,"expHall_log",0,0,0);  experimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(),                                      experimentalHall_log,"expHall",0,false,0);  //------------------------------ a tracker tube  G4double innerRadiusOfThemoon = 0.*m;  G4double outerRadiusOfThemoon = 1.74*m;  G4double hightOfThemoon =1.74*m;  G4double startAngleOfThemoon = 0.*deg;  G4double spanningAngleOfThemoon = 360.*deg;  G4Tubs* moon_tube = new G4Tubs("moon_tube",innerRadiusOfThemoon,                                    outerRadiusOfThemoon,hightOfThemoon,                                    startAngleOfThemoon,spanningAngleOfThemoon);  moon_log = new G4LogicalVolume(moon_tube,FAN,"moon_log",0,0,0);  G4double moon_x1 = 0*m;  G4double moon_y1 = 0.*m;  G4double moon_z1 =0.*m;  moon_phys = new G4PVPlacement(0,             G4ThreeVector(moon_x1,moon_y1,moon_z1),             moon_log,"Fan",experimentalHall_log,false,0);     //-----------------------------------------------------moon tube    G4double innerRadiusOfTheTube1 = 0.*cm;  G4double outerRadiusOfTheTube1 = 59.*mm;  G4double hightOfTheTube1 =6.*mm;  G4double startAngleOfTheTube = 0.*deg;  G4double spanningAngleOfTheTube = 360.*deg;  G4Tubs* windowAl_tube = new G4Tubs("windowAl_tube",innerRadiusOfTheTube1,                                    outerRadiusOfTheTube1,hightOfTheTube1,                                    startAngleOfTheTube,spanningAngleOfTheTube);  windowAl_log = new G4LogicalVolume(windowAl_tube,Al,"windowAl_log",0,0,0);  G4double window_x1 = 0*m;  G4double window_y1 = 0.*m;  G4double window_z1 =(3.74*m+25*mm) ;     windowAl_phys = new G4PVPlacement(0,             G4ThreeVector(window_x1,window_y1,window_z1),             windowAl_log,"windowAl",experimentalHall_log,false,0);    //----------------------------------------------------------------------  innerRadiusOfTheTube1 = 0.*cm;  outerRadiusOfTheTube1 = 59.*mm;  hightOfTheTube1 = 3.5*mm;  startAngleOfTheTube = 0.*deg;  spanningAngleOfTheTube = 360.*deg;  G4Tubs* windowGlass_tube = new G4Tubs("windowGlass_tube",innerRadiusOfTheTube1,                                    outerRadiusOfTheTube1,hightOfTheTube1,                                    startAngleOfTheTube,spanningAngleOfTheTube);  windowGlass_log = new G4LogicalVolume(windowGlass_tube,Glass,"windowGlass_log",0,0,0); G4double window_x2 = 0*mm; G4double  window_y2 = 0.*m; G4double  window_z2 =(3.74*m+3.5*mm);      windowGlass_phys = new G4PVPlacement(0,            G4ThreeVector(window_x2,window_y2,window_z2),         windowGlass_log,"windowGlass",experimentalHall_log,false,0);  //----------------------------------------------------------  innerRadiusOfTheTube1 = 0.*cm;  outerRadiusOfTheTube1 = 59.*mm;  hightOfTheTube1 = 6*mm;  startAngleOfTheTube = 0.*deg;  spanningAngleOfTheTube = 360.*deg;  G4Tubs* windowWater_tube = new G4Tubs("windowWater_tube",innerRadiusOfTheTube1,                                    outerRadiusOfTheTube1,hightOfTheTube1,                                    startAngleOfTheTube,spanningAngleOfTheTube);  windowWater_log = new G4LogicalVolume(windowWater_tube,Plastic,"windowWater_log",0,0,0);  G4double window_x3 = 0.0*mm;  G4double window_y3 = 0.0*m;  G4double window_z3 =(3.74*m+13*mm);    windowWater_phys = new G4PVPlacement(0,            G4ThreeVector(window_x3,window_y3,window_z3),             windowWater_log,"windowWater",experimentalHall_log,false,0);  //----------------------------------------------------------------------   innerRadiusOfTheTube1 = 0.*cm;   outerRadiusOfTheTube1 = 59.*mm;   hightOfTheTube1 = 38.*mm;   startAngleOfTheTube = 0.*deg;   spanningAngleOfTheTube = 360.*deg;   G4Tubs* tracker_tube = new G4Tubs("tracker_tube",innerRadiusOfTheTube1,                                    outerRadiusOfTheTube1,hightOfTheTube1,                                    startAngleOfTheTube,spanningAngleOfTheTube);  tracker_log = new G4LogicalVolume(tracker_tube,CsI,"tracker_log",0,0,0);  G4double trackerPos_x = 0*mm;  G4double trackerPos_y = 0.*m;  G4double trackerPos_z =(3.74*m+69*mm);  tracker_phys = new G4PVPlacement(0,             G4ThreeVector(trackerPos_x,trackerPos_y,trackerPos_z),             tracker_log,"tracker",experimentalHall_log,false,0);  //--------------------------------------------------------------------  innerRadiusOfTheTube1 = 59.*mm;  outerRadiusOfTheTube1 =89.*mm;  hightOfTheTube1 = 38.*mm;   startAngleOfTheTube = 0.*deg;   spanningAngleOfTheTube = 360.*deg;   G4Tubs*antitracker_tube1 = new G4Tubs("antitracker_tube1",innerRadiusOfTheTube1,                                    outerRadiusOfTheTube1,hightOfTheTube1,                                    startAngleOfTheTube,spanningAngleOfTheTube);  antitracker1_log = new G4LogicalVolume(antitracker_tube1,Pb,"antitracker1_log",0,0,0);  G4double antitracker1Pos_x = 0*mm;  G4double antitracker1Pos_y = 0.*m;  G4double antitracker1Pos_z =(3.74*m+69*mm);  antitracker1_phys = new G4PVPlacement(0,             G4ThreeVector(antitracker1Pos_x,antitracker1Pos_y,antitracker1Pos_z),             antitracker1_log,"antitracker1",experimentalHall_log,false,0);  //---------------------------------------------------------------------------   innerRadiusOfTheTube1 = 0.*cm;   outerRadiusOfTheTube1 =89.*mm;   hightOfTheTube1 = 15.*mm;   startAngleOfTheTube = 0.*deg;   spanningAngleOfTheTube = 360.*deg;   G4Tubs*antitracker_tube2 = new G4Tubs("antitracker_tube2",innerRadiusOfTheTube1,                                    outerRadiusOfTheTube1,hightOfTheTube1,                                    startAngleOfTheTube,spanningAngleOfTheTube);  antitracker2_log = new G4LogicalVolume(antitracker_tube2,Pb,"antitracker2_log",0,0,0);  G4double antitracker2Pos_x = 0*mm;  G4double antitracker2Pos_y = 0.*m;  G4double antitracker2Pos_z =(3.74*m+112*mm);  antitracker2_phys = new G4PVPlacement(0,             G4ThreeVector(antitracker2Pos_x,antitracker2Pos_y,antitracker2Pos_z),             antitracker2_log,"antitracker2",experimentalHall_log,false,0);  //-------------------------------------------------------------------------------	       G4SDManager* SDman = G4SDManager::GetSDMpointer();  G4String trackerChamberSDname = "mt01/mt01TrackerSD";  mt01TrackerSD* aTrackerSD = new mt01TrackerSD( trackerChamberSDname );  SDman->AddNewDetector( aTrackerSD );  tracker_log->SetSensitiveDetector( aTrackerSD );//--------- Visualization attributes -------------------------------  G4VisAttributes* BoxVisAtt= new G4VisAttributes(G4Colour(1.0,1.0,1.0));  experimentalHall_log->SetVisAttributes(BoxVisAtt);    //logicTarget ->SetVisAttributes(BoxVisAtt);  //logicTracker->SetVisAttributes(BoxVisAtt);    G4VisAttributes* ChamberVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,0.0));  tracker_log->SetVisAttributes(ChamberVisAtt);	       //------------------------------------------------------------------  return experimentalHall_phys;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -