Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /geant4/examples/advanced/underground_physics/src/DMXDetectorConstruction.cc was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 // --------------------------------------------------------------
0028 //   GEANT 4 - Underground Dark Matter Detector Advanced Example
0029 //
0030 //      For information related to this code contact: Alex Howard
0031 //      e-mail: alexander.howard@cern.ch
0032 // --------------------------------------------------------------
0033 // Comments
0034 //
0035 //                  Underground Advanced
0036 //               by A. Howard and H. Araujo 
0037 //                    (27th November 2001)
0038 //
0039 // DetectorConstruction program
0040 // --------------------------------------------------------------
0041 
0042 #include "DMXDetectorConstruction.hh"
0043 #include "DMXDetectorMessenger.hh"
0044 
0045 #include "DMXScintSD.hh"
0046 #include "DMXPmtSD.hh"
0047 
0048 
0049 #include "G4Material.hh"
0050 #include "G4MaterialTable.hh"
0051 #include "G4Element.hh"
0052 #include "G4Isotope.hh"
0053 #include "G4UnitsTable.hh"
0054 #include "G4Box.hh"
0055 #include "G4Tubs.hh"
0056 #include "G4Sphere.hh"
0057 #include "G4UnionSolid.hh"
0058 #include "G4SubtractionSolid.hh"
0059 
0060 #include "G4LogicalVolume.hh"
0061 #include "G4PVPlacement.hh"
0062 #include "G4ThreeVector.hh"
0063 #include "G4RotationMatrix.hh"
0064 #include "G4Transform3D.hh"
0065 #include "G4LogicalBorderSurface.hh"
0066 #include "G4LogicalSkinSurface.hh"
0067 #include "G4OpBoundaryProcess.hh"
0068 
0069 #include "G4FieldManager.hh"
0070 #include "G4UniformElectricField.hh"
0071 #include "G4TransportationManager.hh"
0072 #include "G4MagIntegratorStepper.hh"
0073 #include "G4EqMagElectricField.hh"
0074 #include "G4ClassicalRK4.hh"
0075 #include "G4ChordFinder.hh"
0076 
0077 #include "G4SDManager.hh"
0078 
0079 #include "G4VisAttributes.hh"
0080 #include "G4Colour.hh"
0081 
0082 #include "G4UserLimits.hh"
0083 
0084 #include "G4RunManager.hh"
0085 #include "G4SystemOfUnits.hh"
0086 
0087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0088 DMXDetectorConstruction::DMXDetectorConstruction()  
0089 {
0090   // create commands for interactive definition of time cuts:
0091   detectorMessenger = new DMXDetectorMessenger(this);
0092 
0093   theUserLimitsForRoom     = 0; 
0094   theUserLimitsForDetector = 0; 
0095   // default time cut = infinite
0096   //  - note also number of steps cut in stepping action = MaxNoSteps
0097   theMaxTimeCuts      = DBL_MAX;
0098   theMaxStepSize      = DBL_MAX;
0099   theDetectorStepSize = DBL_MAX;
0100   theRoomTimeCut      = 1000. * nanosecond;
0101   theMinEkine         = 250.0*eV; // minimum kinetic energy required in volume
0102   theRoomMinEkine     = 250.0*eV; // minimum kinetic energy required in volume
0103   
0104   //Zero the G4Cache objects to contain logical volumes
0105   LXeSD.Put(0);
0106   pmtSD.Put(0);
0107 }
0108 
0109 
0110 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0111 DMXDetectorConstruction::~DMXDetectorConstruction() 
0112 {
0113   delete theUserLimitsForRoom;
0114   delete theUserLimitsForDetector;
0115   delete detectorMessenger;
0116 }
0117 
0118 
0119 
0120 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0121 void DMXDetectorConstruction::DefineMaterials() 
0122 {
0123 
0124 #include "DMXDetectorMaterial.icc"
0125 
0126 }
0127 
0128 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0129 G4VPhysicalVolume* DMXDetectorConstruction::Construct() {
0130 
0131   DefineMaterials();
0132 
0133   // DefineField();
0134 
0135   // make colours
0136   G4Colour  white   (1.0, 1.0, 1.0) ;
0137   G4Colour  grey    (0.5, 0.5, 0.5) ;
0138   G4Colour  lgrey   (.85, .85, .85) ;
0139   G4Colour  red     (1.0, 0.0, 0.0) ;
0140   G4Colour  blue    (0.0, 0.0, 1.0) ;
0141   G4Colour  cyan    (0.0, 1.0, 1.0) ;
0142   G4Colour  magenta (1.0, 0.0, 1.0) ; 
0143   G4Colour  yellow  (1.0, 1.0, 0.0) ;
0144   G4Colour  orange  (.75, .55, 0.0) ;
0145   G4Colour  lblue   (0.0, 0.0, .75) ;
0146   G4Colour  lgreen  (0.0, .75, 0.0) ;
0147   G4Colour  green   (0.0, 1.0, 0.0) ;
0148   G4Colour  brown   (0.7, 0.4, 0.1) ;
0149   
0150 
0151   //  un-used colours:
0152   //  G4Colour  black   (0.0, 0.0, 0.0) ;
0153 
0154 
0155 
0156   // Universe - room wall - CONCRETE ****************************************
0157 
0158   //NB: measured INSIDE of lab, therefore have to add twice wall thickness
0159   G4double wallThick   = 24.*cm;
0160   G4double worldWidth  = 470.0*cm + 2.*wallThick; // "x"
0161   G4double worldLength = 690.0*cm + 2.*wallThick; // "y"
0162   G4double worldHeight = 280.0*cm + 2.*wallThick; // "z"
0163 
0164   G4Box* world_box = new G4Box
0165      ("world_box", 0.5*worldWidth, 0.5*worldLength, 0.5*worldHeight );
0166   world_log  = new G4LogicalVolume(world_box, world_mat, "world_log");
0167   world_phys = new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),
0168      "world_phys", world_log, NULL, false,0);
0169 
0170   //  G4VisAttributes* world_vat= new G4VisAttributes(white);
0171   world_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0172   //world_vat->SetVisibility(true);
0173   //world_vat->SetVisibility(false);
0174   //world_log->SetVisAttributes(world_vat);
0175 
0176 
0177   // Lab Space - AIR ********************************************************
0178 
0179   G4double labWidth  = worldWidth  - 2.*wallThick; //X
0180   G4double labLength = worldLength - 2.*wallThick; //Y
0181   G4double labHeight = worldHeight - 2.*wallThick; //Z
0182 
0183   G4Box* lab_box = new G4Box
0184      ("lab_box", 0.5*labWidth, 0.5*labLength, 0.5*labHeight );
0185   lab_log  = new G4LogicalVolume(lab_box, lab_mat, "lab_log");
0186   lab_phys = new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), "lab_phys", 
0187      lab_log, world_phys, false,0);
0188 
0189   G4VisAttributes* lab_vat= new G4VisAttributes(white);
0190   //  lab_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0191   //  lab_vat->SetVisibility(true);
0192   lab_vat->SetVisibility(false);
0193   lab_log->SetVisAttributes(lab_vat);
0194 
0195 // include room furniture: **************************************************
0196 
0197 #include "DMXDetectorRoom.icc"
0198 
0199   // Now start with detector assembly:
0200 
0201   // first LN2 cooling container: *******************************************
0202 
0203   G4double PosZ = -25.3*cm; // extra z-pos to correspond with height in lab
0204 
0205   G4double LN2jacketRadius    = 107.5*mm;
0206   G4double LN2jacketHeight    = 590.0*mm;
0207   G4double jacketHeight       = 680.0*mm;
0208   G4double jacketflangeHeight = 53.0*mm;
0209   G4double LN2PosZ            = 0.5*jacketHeight + 0.5*LN2jacketHeight 
0210                                 + jacketflangeHeight + PosZ;
0211 
0212   G4Tubs* LN2jacket_tube = new G4Tubs("LN2jacket_tube",
0213      0.*cm, LN2jacketRadius, 0.5*LN2jacketHeight, 0.*deg, 360.*deg);
0214   LN2jacket_log  = new G4LogicalVolume
0215     (LN2jacket_tube, LN2jacket_mat, "LN2jacket_log");
0216   LN2jacket_phys = new G4PVPlacement(0, G4ThreeVector(0.,0.,LN2PosZ),
0217      "LN2jacket_phys", LN2jacket_log, lab_phys, false,0);
0218 
0219   G4VisAttributes* LN2jacket_vat = new G4VisAttributes(lgrey);
0220   // LN2jacket_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0221   // LN2jacket_vat->SetVisibility(true);
0222   LN2jacket_log->SetVisAttributes(LN2jacket_vat);
0223 
0224   // LN2jacket vacuum: **********************
0225 
0226   G4double LN2jacketMetalThick = 2.0*mm;
0227   G4double LN2vacuumRadius     = LN2jacketRadius - LN2jacketMetalThick;
0228   G4double LN2vacuumHeight     = LN2jacketHeight - LN2jacketMetalThick;
0229 
0230   G4Tubs* LN2vacuum_tube = new G4Tubs("LN2vacuum_tube",
0231      0.*cm, LN2vacuumRadius, 0.5*LN2vacuumHeight, 0.*deg, 360.*deg);
0232   LN2vacuum_log  = new G4LogicalVolume
0233     (LN2vacuum_tube, vacuum_mat, "LN2vacuum_log");
0234   LN2vacuum_phys = new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),
0235      "LN2vacuum_phys", LN2vacuum_log, LN2jacket_phys, false,0);
0236 
0237   LN2vacuum_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0238 
0239   // LN2 vessel: ************************************************************
0240 
0241   G4double LN2Radius       = 76.0*mm;
0242   G4double LN2Height       = 590.0*mm - 2.*LN2jacketMetalThick;
0243   G4double LN2vesselRadius = LN2Radius + LN2jacketMetalThick;
0244   G4double LN2vesselHeight = LN2Height;
0245   G4double LN2vesselPosZ   = 0.5*LN2vacuumHeight - 0.5*LN2vesselHeight;
0246 
0247   G4Tubs* LN2vessel_tube = new G4Tubs("LN2vessel_tube",
0248      0.*cm, LN2vesselRadius, 0.5*LN2vesselHeight, 0.*deg, 360.*deg);
0249   LN2vessel_log  = new G4LogicalVolume
0250     (LN2vessel_tube, LN2jacket_mat, "LN2vessel_log");
0251   LN2vessel_phys = new G4PVPlacement(0, G4ThreeVector(0.,0.,LN2vesselPosZ),
0252      "LN2vessel_phys", LN2vessel_log, LN2vacuum_phys, false,0);
0253 
0254   G4VisAttributes* LN2vessel_vat = new G4VisAttributes(lgrey);
0255   // LN2vessel_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0256   // LN2vessel_vat->SetVisibility(true);
0257   LN2vessel_log->SetVisAttributes(LN2vessel_vat);
0258 
0259 
0260   // and finally LN2: *******************************************************
0261 
0262   G4Tubs* LN2_tube = new G4Tubs("LN2_tube",
0263      0.*cm, LN2Radius, 0.5*LN2Height, 0.*deg, 360.*deg);
0264   LN2_log  = new G4LogicalVolume(LN2_tube, LN2_mat, "LN2_log");
0265   LN2_phys = new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),
0266      "LN2_phys", LN2_log, LN2vessel_phys, false,0);
0267 
0268   G4VisAttributes* LN2_vat = new G4VisAttributes(green);
0269   LN2_vat->SetVisibility(true);
0270   LN2_log->SetVisAttributes(LN2_vat);
0271 
0272 
0273   // outer vacuum jacket volume: stainless steel ****************************
0274 
0275   G4double jacketRadius     = 127.5*mm;
0276   //  G4double jacketHeight     = 680.0*mm; // defined above to get full-height
0277   G4double jacketMetalThick = LN2jacketMetalThick;
0278 
0279   G4Tubs* jacket_tube = new G4Tubs("jacket_tube",
0280      0.*cm, jacketRadius, 0.5*jacketHeight, 0.*deg, 360.*deg);
0281   jacket_log  = new G4LogicalVolume(jacket_tube, jacket_mat, "jacket_log");
0282   jacket_phys = new G4PVPlacement(0, G4ThreeVector(0.,0.,PosZ),
0283      "jacket_phys", jacket_log, lab_phys, false,0);
0284 
0285   G4VisAttributes* jacket_vat = new G4VisAttributes(grey);
0286   // jacket_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0287   jacket_log->SetVisAttributes(jacket_vat);
0288 
0289 
0290   // outer vacuum jacket flanges: stainless steel *************************
0291 
0292   G4double jacketflangeRadius  = 127.5*mm;
0293   // G4double jacketflangeHeight = 53.0*mm; // defined above to get full-height
0294   G4double topjacketflangePosZ = 0.5*(jacketHeight+jacketflangeHeight);
0295 
0296   G4Tubs* jacketflange_tube = new G4Tubs("jacketflange_tube",
0297      0.*cm, jacketflangeRadius, 0.5*jacketflangeHeight, 0.*deg, 360.*deg);
0298   jacketflange_log     = new G4LogicalVolume
0299     (jacketflange_tube, jacketflange_mat, "jacketflange_log");
0300   topjacketflange_phys = new G4PVPlacement
0301     (0, G4ThreeVector(0.,0.,topjacketflangePosZ + PosZ),
0302      "topjacketflange_phys", jacketflange_log, lab_phys, false,0);
0303   bottomjacketflange_phys = new G4PVPlacement
0304     (0, G4ThreeVector(0.,0.,-topjacketflangePosZ + PosZ),
0305      "bottomjacketflange_phys", jacketflange_log, lab_phys, false,0);
0306 
0307   // jacketflange_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0308   jacketflange_log->SetVisAttributes(jacket_vat);
0309 
0310   // vacuum **************************************************************
0311 
0312   G4double vacuumRadius = jacketRadius - jacketMetalThick;
0313   G4double vacuumHeight = jacketHeight - jacketMetalThick;
0314 
0315   G4Tubs* vacuum_tube = new G4Tubs("vacuum_tube",
0316      0.*cm, vacuumRadius, 0.5*vacuumHeight, 0.*deg, 360.*deg);
0317   vacuum_log  = new G4LogicalVolume(vacuum_tube, vacuum_mat, "vacuum_log");
0318   vacuum_phys = new G4PVPlacement(0, G4ThreeVector(0.,0.,0.),
0319      "vacuum_phys", vacuum_log, jacket_phys, false,0);
0320 
0321   // G4VisAttributes* vacuum_vat= new G4VisAttributes(lgrey);
0322   vacuum_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0323 
0324 
0325   // copper cooling jacket volume: **************************************
0326 
0327   G4double copperMetalThick = 3.0*mm;
0328   G4double copperRadius     = 103.5*mm + copperMetalThick;
0329   G4double copperHeight     = 420.0*mm;
0330   G4double copperInner      = copperRadius - copperMetalThick;
0331   G4double vesselHeight     = 320.0*mm;
0332   G4double copperVPos       = 0.5*(vesselHeight-copperHeight) + 13.0*cm;
0333   G4double coppertopThick   = 1.0*cm;
0334   G4double coppertopVPos    = copperVPos + 0.5*(coppertopThick+copperHeight);
0335 
0336   G4Tubs* copper_tube = new G4Tubs("copper_tube",
0337      copperInner, copperRadius, 0.5*copperHeight, 0.*deg, 360.*deg);
0338   copper_log  = new G4LogicalVolume(copper_tube, copper_mat, "copper_log");
0339   copper_phys = new G4PVPlacement(0, G4ThreeVector(0.,0.,copperVPos), 
0340      "copper_phys", copper_log, vacuum_phys, false,0);
0341 
0342   G4Tubs* coppertop_tube = new G4Tubs("coppertop_tube",
0343      0.*cm, copperRadius, 0.5*coppertopThick, 0.*deg, 360.*deg);
0344   coppertop_log  = new G4LogicalVolume
0345     (coppertop_tube, copper_mat, "coppertop_log");  
0346   coppertop_phys = new G4PVPlacement(0,G4ThreeVector(0.,0.,coppertopVPos), 
0347      "coppertop_phys", coppertop_log, vacuum_phys, false,0);
0348 
0349   G4VisAttributes* copper_vat = new G4VisAttributes(orange);
0350   //  copper_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0351   copper_log->SetVisAttributes(copper_vat);
0352   coppertop_log->SetVisAttributes(copper_vat);
0353 
0354   // inner vessel jacket volume: stainless steel ************************
0355 
0356   //  G4double vesselHeight = 320.0*mm; // - moved earlier
0357   G4double vesselMetalThick      = jacketMetalThick;
0358   G4double vesselRadius          = 75.0*mm + vesselMetalThick;
0359   G4double vesselflangeRadius    = 101.5*mm;
0360   G4double vesselflangeThick     = 40.0*mm;
0361   G4double PMTvesselRadius       = 31.0*mm + vesselMetalThick;
0362   G4double PMTvesselHeight       = 152.0*mm;
0363   G4double pmtvesselflangeRadius = 52.0*mm;
0364   G4double pmtvesselflangeThick  = 32.0*mm;
0365   G4double vesselVPos            = 7.0*cm;
0366   G4double TotalvesselHeight     = PMTvesselHeight + vesselHeight;
0367 
0368   G4Tubs* vessel_tube    = new G4Tubs("vessel_tube",
0369      0.*cm, vesselRadius, 0.5*vesselHeight, 0.*deg, 360.*deg);
0370   G4Tubs* PMTvessel_tube = new G4Tubs("PMTvessel_tube",
0371      0.*cm, PMTvesselRadius, 0.5*PMTvesselHeight, 0.*deg, 360.*deg);
0372 
0373   G4UnionSolid* vessel_sol = new G4UnionSolid
0374     ("vessel_sol", vessel_tube, PMTvessel_tube,
0375      G4Transform3D(G4RotationMatrix(), 
0376            G4ThreeVector(0,0,-0.5*(vesselHeight+PMTvesselHeight))));
0377 
0378   vessel_log  = new G4LogicalVolume(vessel_sol, vessel_mat, "vessel_log");
0379   vessel_phys = new G4PVPlacement(0, G4ThreeVector(0.,0.,vesselVPos), 
0380      "vessel_phys", vessel_log, vacuum_phys, false,0);
0381 
0382 
0383   // flanges: 1=upper half (diff. inner diam.) 2=lower half
0384   G4Tubs* vesseltop_flange1 = new G4Tubs("vesseltop_flange1",
0385      0.*cm, vesselflangeRadius, 0.25*vesselflangeThick, 0.*deg, 360.*deg);
0386   vesseltop_log1  = new G4LogicalVolume
0387     (vesseltop_flange1, vessel_mat, "vesseltop_log1");  
0388   vesseltop_phys1 = new G4PVPlacement
0389     (0, 
0390      G4ThreeVector(0.,0.,0.5*(vesselHeight+0.5*vesselflangeThick)+vesselVPos), 
0391      "vesseltop_phys1", vesseltop_log1, vacuum_phys, false,0);
0392 
0393   G4Tubs* vesseltop_flange2 = new G4Tubs("vesseltop_flange2",vesselRadius, 
0394     vesselflangeRadius, 0.25*vesselflangeThick, 0.*deg, 360.*deg);
0395   vesseltop_log2  = new G4LogicalVolume
0396     (vesseltop_flange2, vessel_mat, "vesseltop_log2");  
0397   vesseltop_phys2 = new G4PVPlacement
0398     (0, 
0399      G4ThreeVector(0.,0.,0.5*(vesselHeight-0.5*vesselflangeThick)+vesselVPos), 
0400      "vesseltop_phys2", vesseltop_log2, vacuum_phys, false,0);
0401 
0402 
0403   G4Tubs* vesselbottom_flange1 = new G4Tubs
0404     ("vesselbottom_flange1",vesselRadius, vesselflangeRadius, 
0405      0.25*vesselflangeThick, 0.*deg, 360.*deg);
0406   vesselbottom_log1  = new G4LogicalVolume
0407     (vesselbottom_flange1, vessel_mat, "vesselbottom_log1");  
0408   vesselbottom_phys1 = new G4PVPlacement(0, 
0409      G4ThreeVector(0.,0.,-0.5*(vesselHeight-0.5*vesselflangeThick)+vesselVPos),
0410      "vesselbottom_phys1", vesselbottom_log1, vacuum_phys, false,0);
0411 
0412   G4Tubs* vesselbottom_flange2 = new G4Tubs
0413     ("vesselbottom_flange2",PMTvesselRadius, vesselflangeRadius, 
0414      0.25*vesselflangeThick, 0.*deg, 360.*deg);
0415   vesselbottom_log2  = new G4LogicalVolume
0416     (vesselbottom_flange2, vessel_mat, "vesselbottom_log2");  
0417   vesselbottom_phys2 = new G4PVPlacement(0, 
0418      G4ThreeVector(0.,0.,-0.5*(vesselHeight+0.5*vesselflangeThick)+vesselVPos),
0419      "vesselbottom_phys2", vesselbottom_log2, vacuum_phys, false,0);
0420 
0421 
0422   G4Tubs* pmtvesselbottom_flange1 = new G4Tubs
0423     ("pmtvesselbottom_flange1", PMTvesselRadius, pmtvesselflangeRadius, 
0424      0.25*pmtvesselflangeThick, 0.*deg, 360.*deg);
0425   pmtvesselbottom_log1  = new G4LogicalVolume
0426     (pmtvesselbottom_flange1, vessel_mat, "pmtvesselbottom_log1");  
0427   pmtvesselbottom_phys1 = new G4PVPlacement(0, G4ThreeVector(0.,0.,
0428     (-0.5*vesselHeight-PMTvesselHeight+vesselVPos+0.25*pmtvesselflangeThick)),
0429      "pmtvesselbottom_phys1", pmtvesselbottom_log1, vacuum_phys, false,0);
0430 
0431   G4Tubs* pmtvesselbottom_flange2 = new G4Tubs
0432     ("pmtvesselbottom_flange2", 0.*cm, pmtvesselflangeRadius, 
0433      0.25*pmtvesselflangeThick, 0.*deg, 360.*deg);
0434   pmtvesselbottom_log2  = new G4LogicalVolume
0435     (pmtvesselbottom_flange2, vessel_mat, "pmtvesselbottom_log2");  
0436   pmtvesselbottom_phys2 = new G4PVPlacement(0, G4ThreeVector(0.,0.,
0437      -0.5*vesselHeight-PMTvesselHeight+vesselVPos-0.25*pmtvesselflangeThick),
0438      "pmtvesselbottom_phys2", pmtvesselbottom_log2, vacuum_phys, false,0);
0439 
0440 
0441   G4VisAttributes* vessel_vat     = new G4VisAttributes(grey);
0442   G4VisAttributes* pmtvessel_vat  = new G4VisAttributes(yellow);
0443   G4VisAttributes* pmtvessel_vat2 = new G4VisAttributes(green);
0444   //  vessel_log->SetVisAttributes(G4VisAttributes::GetInvisible());
0445   //  vessel_vat->SetForceSolid(true);
0446   //  pmtvessel_vat->SetForceSolid(true);
0447   //  pmtvessel_vat2->SetForceSolid(true);
0448   vessel_log->SetVisAttributes(vessel_vat);
0449   vesseltop_log1->SetVisAttributes(vessel_vat);
0450   vesselbottom_log1->SetVisAttributes(vessel_vat);
0451   vesseltop_log2->SetVisAttributes(pmtvessel_vat);
0452   vesselbottom_log2->SetVisAttributes(pmtvessel_vat);
0453   //  pmtvesselbottom_log->SetVisAttributes(vessel_vat);
0454   pmtvesselbottom_log1->SetVisAttributes(vessel_vat);
0455   pmtvesselbottom_log2->SetVisAttributes(pmtvessel_vat2);
0456 
0457 
0458 
0459   // *********************************************************************
0460   // grid#1 to mirror surface: 21.75 mm
0461   // LXe height = 15.75 mm, gXe height = 6.00 mm
0462   // NB: Increased liquid height by 1mm - to take away problem with 
0463   // over-lapping volumes/ring pronounced from liquid phase..........
0464   // *********************************************************************
0465 
0466   // detector volume: gas phase ******************************************
0467 
0468   G4double mirrorVPos     = 21.3*cm;
0469   G4double gasGap         = 6.0*mm;
0470   G4double DetectorRadius = vesselRadius - vesselMetalThick;
0471   G4double GXeHeight      = TotalvesselHeight - mirrorVPos + gasGap;
0472   G4double GXeVPos        = 0.5*vesselHeight - 0.5*GXeHeight;
0473 
0474   G4Tubs* GXe_tube = new G4Tubs("GXe_tube",
0475      0.*cm, DetectorRadius, 0.5*GXeHeight, 0.*deg, 360.*deg);
0476   GXe_log  = new G4LogicalVolume(GXe_tube, GXe_mat, "GXe_log");
0477   GXe_phys = new G4PVPlacement(0, G4ThreeVector(0.,0.,GXeVPos), 
0478      "GXe_phys", GXe_log, vessel_phys, false,0);
0479 
0480   G4VisAttributes* GXe_vat = new G4VisAttributes(cyan);
0481   // GXe_vat->SetForceSolid(true);
0482   GXe_vat->SetVisibility(true);
0483   GXe_log->SetVisAttributes(GXe_vat);
0484 
0485 
0486   // liquid phase *******************************************************
0487 
0488   G4double LXeHeight         = mirrorVPos - gasGap;
0489   G4double PMTDetectorRadius = PMTvesselRadius - vesselMetalThick;
0490   G4double PMTDetectorHeight = PMTvesselHeight;
0491   G4double LXeTubeHeight     = LXeHeight - PMTDetectorHeight;
0492   G4double LXe_solVPos       = -0.5*(LXeTubeHeight+PMTDetectorHeight);
0493   G4double LXeVPos           = -0.5*TotalvesselHeight + 0.5*LXeHeight;
0494 
0495   G4Tubs* LXe_tube = new G4Tubs("GXe_tube",
0496      0.*cm, DetectorRadius, 0.5*LXeTubeHeight, 0.*deg, 360.*deg);
0497   G4Tubs* PMTdetector_tube = new G4Tubs("PMTdetector_tube",
0498    0.*cm, PMTDetectorRadius, 0.5*PMTDetectorHeight, 0.*deg, 360.*deg);
0499 
0500   G4UnionSolid* LXe_sol = new G4UnionSolid
0501     ("LXe_sol", LXe_tube, PMTdetector_tube,
0502     G4Transform3D(G4RotationMatrix(), G4ThreeVector(0,0,LXe_solVPos)));
0503 
0504   LXe_log  = new G4LogicalVolume(LXe_sol, LXe_mat, "LXe_log");
0505   LXe_phys = new G4PVPlacement(0, G4ThreeVector(0.*cm, 0.*cm, LXeVPos), 
0506     "LXe_phys", LXe_log, vessel_phys, false, 0);
0507 
0508   // attributes
0509   G4VisAttributes* LXe_vat = new G4VisAttributes(lblue);
0510   // LXe_vat->SetForceSolid(true);
0511   LXe_vat->SetVisibility(true);
0512   LXe_log->SetVisAttributes(LXe_vat);
0513 
0514   
0515   // Gas phase vessel lagging - for optical properties:
0516 
0517   G4double laggingThickness = 10.*micrometer;
0518   G4double laggingRadius    = DetectorRadius - laggingThickness;
0519 
0520   G4Tubs* gaslag_tube = new G4Tubs("gaslag_tube", laggingRadius, 
0521      DetectorRadius, 0.5*GXeHeight, 0.*deg, 360.*deg);
0522   gaslag_log  = new G4LogicalVolume(gaslag_tube, vessel_mat, "gaslag_log");
0523   gaslag_phys = new G4PVPlacement(0, G4ThreeVector(0.*cm, 0.*cm, 0.*cm),
0524     "gaslag_phys", gaslag_log, GXe_phys, false, 0);
0525 
0526   // attributes
0527   G4VisAttributes* gaslag_vat = new G4VisAttributes(lgreen);
0528   // gaslag_vat->SetForceSolid(true);
0529   gaslag_vat->SetVisibility(true);
0530   gaslag_log->SetVisAttributes(gaslag_vat);
0531 
0532 
0533   // liquid phase vessel lagging - for optical properties:
0534 
0535   G4double lagTubeRadius = DetectorRadius - laggingThickness;
0536   G4double lagTubeHeight = LXeHeight - PMTDetectorHeight;
0537   G4double lagPMTRadius  = PMTDetectorRadius - laggingThickness;
0538   G4double lagPMTHeight  = PMTDetectorHeight;
0539 
0540   G4Tubs* liqLag_tube = new G4Tubs("liqlag_tube", lagTubeRadius,
0541      DetectorRadius, 0.5*lagTubeHeight, 0.*deg, 360.*deg);
0542   G4Tubs* lagPMT_tube = new G4Tubs("lagPMT_tube", lagPMTRadius, 
0543      PMTDetectorRadius, 0.5*lagPMTHeight, 0.*deg, 360.*deg);
0544 
0545   G4UnionSolid* liqLag_sol = new G4UnionSolid
0546     ("liqLag_sol", liqLag_tube, lagPMT_tube,
0547     G4Transform3D(G4RotationMatrix(),G4ThreeVector(0,0,LXe_solVPos)));
0548 
0549   liqLag_log  = new G4LogicalVolume(liqLag_sol, vessel_mat, "liqLag_log");
0550   liqLag_phys = new G4PVPlacement(0, G4ThreeVector(0.*cm, 0.*cm, 0.*cm), 
0551     "liqLag_phys", liqLag_log, LXe_phys, false, 0);
0552 
0553   // attributes
0554   G4VisAttributes* liqLag_vat = new G4VisAttributes(magenta);
0555   // liqLag_vat->SetForceSolid(true);
0556   liqLag_vat->SetVisibility(true);
0557   liqLag_log->SetVisAttributes(liqLag_vat);
0558 
0559 
0560   // Vessel Wall Optical Surface definition:
0561   G4OpticalSurface* OpVesselSurface = new G4OpticalSurface
0562     ("VesselSurface", unified, polished, dielectric_metal);
0563 
0564   // created optical lagging onto vessel - to avoid clash between over-lapping
0565   // liquid and gas phase - so removed below:
0566   /*
0567   G4LogicalBorderSurface* VesselSurface;
0568   VesselSurface = new G4LogicalBorderSurface
0569     ("Vessel", liqPhase_phys, vessel_phys, OpVesselSurface);
0570   */
0571 
0572   std::vector<G4double> vessel_PP   = { 6.5*eV, 7.50*eV };
0573   std::vector<G4double> vessel_REFL = { 0.2, 0.2 };
0574   G4MaterialPropertiesTable* vessel_mt = new G4MaterialPropertiesTable();
0575   vessel_mt->AddProperty("REFLECTIVITY", vessel_PP, vessel_REFL);
0576   OpVesselSurface->SetMaterialPropertiesTable(vessel_mt);
0577 
0578   // G4LogicalBorderSurface* VesselTopSurface = 
0579   new G4LogicalBorderSurface
0580     ("VesselTop", GXe_phys, vesseltop_phys1, OpVesselSurface);
0581 
0582   //G4LogicalBorderSurface* VesselBottomSurface = 
0583   new G4LogicalBorderSurface
0584     ("VesselBottom", LXe_phys, vesselbottom_phys2, OpVesselSurface);
0585 
0586   //G4LogicalBorderSurface* GasVesselSurface = 
0587   new G4LogicalBorderSurface
0588     ("GasVessel", GXe_phys, gaslag_phys, OpVesselSurface);
0589 
0590   //G4LogicalBorderSurface* LiquidVesselSurface =
0591   new G4LogicalBorderSurface
0592     ("LiquidVessel", LXe_phys, liqLag_phys, OpVesselSurface);
0593 
0594 
0595 
0596   // Cu Shield **********************************************************
0597 
0598   G4double CuShieldHeight      = 17.7*cm;
0599   G4double CuShieldThickness   = 2.4*mm;
0600   G4double CuShieldOuterRadius = 3.0*cm;
0601   G4double CuShieldInnerRadius = CuShieldOuterRadius-CuShieldThickness;
0602   G4double CuShieldVPosition   = -0.5*LXeTubeHeight - PMTDetectorHeight 
0603                                 + 0.5*CuShieldHeight;
0604 
0605   // Zero co-ordinate of the union is the zero of the first volume, 
0606   // i.e. the offset is still present
0607 
0608   G4Tubs* CuShield_tube = new G4Tubs("CuShield_tube", CuShieldInnerRadius,
0609      CuShieldOuterRadius, 0.5*CuShieldHeight, 0.*deg, 360.*deg);
0610   CuShield_log  = new G4LogicalVolume(CuShield_tube, CuShield_mat, 
0611                      "CuShield_log");
0612   CuShield_phys = new G4PVPlacement(0, 
0613      G4ThreeVector(0.*cm, 0.*cm, CuShieldVPosition), 
0614      "CuShield_phys", CuShield_log, LXe_phys, false, 0);
0615 
0616   //  G4VisAttributes* CuShield_vat= new G4VisAttributes(magenta);
0617   G4VisAttributes* CuShield_vat = new G4VisAttributes(brown);
0618   //  CuShield_vat->SetForceSolid(true);
0619   CuShield_vat->SetVisibility(true);
0620   CuShield_log->SetVisAttributes(CuShield_vat);
0621 
0622   // Cu shield surface
0623   G4double sigalpha;
0624   G4OpticalSurface* OpCuShieldSurface = new G4OpticalSurface
0625     ("ShieldSurface", unified, ground, dielectric_metal, sigalpha=30.0*deg);
0626   //G4LogicalBorderSurface* ShieldSurface = 
0627   new G4LogicalBorderSurface
0628     ("Shield", LXe_phys, CuShield_phys, OpCuShieldSurface);
0629 
0630   std::vector<G4double> CuShield_PP   = { 7.0*eV, 7.50*eV };
0631   std::vector<G4double> CuShield_REFL = { 0.3, 0.2 };
0632   G4MaterialPropertiesTable *CuShield_mt = new G4MaterialPropertiesTable();
0633   CuShield_mt->AddProperty("REFLECTIVITY", CuShield_PP, CuShield_REFL);
0634   OpCuShieldSurface->SetMaterialPropertiesTable(CuShield_mt);
0635 
0636   // rings ***************************************************************
0637 
0638   G4double ringHeight      =  4.*mm;
0639   G4double ringOuterRadius =  4.0*cm;
0640   G4double ringInnerRadius =  CuShieldOuterRadius;
0641   G4double ringVOffset     =  0.5*ringHeight;
0642   G4double ringVPosition   =  -0.5*GXeHeight + gasGap +ringVOffset;
0643 
0644   G4Tubs* ring_tube=new G4Tubs("ring_tube", ringInnerRadius,
0645      ringOuterRadius, 0.5*ringHeight, 0.*deg, 360.*deg);
0646   ring_log = new G4LogicalVolume(ring_tube, ring_mat, "ring_log");
0647 
0648   // optical surface: ring materials table
0649   std::vector<G4double> ring_PP   = { 6.00*eV, 7.50*eV };
0650   std::vector<G4double> ring_REFL = { 0.7, 0.65 };
0651   G4MaterialPropertiesTable *ring_mt = new G4MaterialPropertiesTable();
0652   ring_mt->AddProperty("REFLECTIVITY", ring_PP, ring_REFL);
0653 
0654   G4OpticalSurface* OpRingSurface = new G4OpticalSurface
0655     ("RingSurface", unified, ground, dielectric_metal, sigalpha=10.*deg);
0656   // last argument is surface roughness if it's non-polished - i.e. ground
0657   OpRingSurface->SetMaterialPropertiesTable(ring_mt);
0658 
0659   // rings inside gas phase
0660   ring_phys_gas[0] = new G4PVPlacement(0, G4ThreeVector
0661     (0.*cm, 0.*cm, ringVPosition),"ring_phys0",ring_log,GXe_phys,false, 0);
0662   //G4LogicalBorderSurface* RingSurface_gas0 = 
0663   new G4LogicalBorderSurface
0664     ("Ring", GXe_phys, ring_phys_gas[0], OpRingSurface);
0665 
0666   ring_phys_gas[1] = new G4PVPlacement(0,
0667      G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight+1.0*mm),
0668      "ring_phys1",ring_log, GXe_phys, false, 0);
0669   //G4LogicalBorderSurface* RingSurface_gas1 = 
0670   new G4LogicalBorderSurface
0671      ("Ring", GXe_phys, ring_phys_gas[1], OpRingSurface);
0672 
0673 
0674   // rings inside liquid phase:
0675   ringVPosition = 0.5*LXeTubeHeight;
0676 
0677   ring_phys_liq[0] = new G4PVPlacement(0,
0678      G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=0.5*ringHeight),
0679      "ring_phys2",ring_log,LXe_phys, false, 0);
0680   //G4LogicalBorderSurface* RingSurface_liq0 = 
0681   new G4LogicalBorderSurface
0682     ("Ring", LXe_phys, ring_phys_liq[0], OpRingSurface);
0683 
0684   ring_phys_liq[1] = new G4PVPlacement(0,
0685      G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight+1.75*mm),
0686      "ring_phys3",ring_log, LXe_phys, false, 0);
0687   //G4LogicalBorderSurface* RingSurface_liq1 =
0688   new G4LogicalBorderSurface
0689     ("Ring", LXe_phys, ring_phys_liq[1], OpRingSurface);
0690 
0691   ring_phys_liq[2]=new G4PVPlacement(0,
0692      G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight),
0693      "ring_phys4",ring_log, LXe_phys, false, 0);
0694   //G4LogicalBorderSurface* RingSurface_liq2 =
0695   new G4LogicalBorderSurface
0696     ("Ring", LXe_phys, ring_phys_liq[2], OpRingSurface);
0697 
0698   ring_phys_liq[3]=new G4PVPlacement(0,
0699      G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight),
0700      "ring_phys5",ring_log, LXe_phys, false, 0);
0701   //G4LogicalBorderSurface* RingSurface_liq3 =
0702   new G4LogicalBorderSurface
0703     ("Ring", LXe_phys, ring_phys_liq[3], OpRingSurface);
0704 
0705   ring_phys_liq[4]=new G4PVPlacement(0,
0706      G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight+1.75*mm),
0707      "ring_phys6",ring_log, LXe_phys,false, 0);
0708   //G4LogicalBorderSurface* RingSurface_liq4 =
0709   new G4LogicalBorderSurface
0710     ("Ring", LXe_phys, ring_phys_liq[4], OpRingSurface);
0711 
0712   ring_phys_liq[5]=new G4PVPlacement(0,
0713      G4ThreeVector(0.*cm, 0.*cm, ringVPosition-=ringHeight+1.75*mm),
0714      "ring_phys7",ring_log, LXe_phys,false, 0);
0715   //G4LogicalBorderSurface* RingSurface_liq5 =
0716   new G4LogicalBorderSurface
0717     ("Ring", LXe_phys, ring_phys_liq[5], OpRingSurface);
0718 
0719 
0720   G4VisAttributes* ring_vat= new G4VisAttributes(lgrey);
0721   ring_vat->SetVisibility(true);
0722   ring_log->SetVisAttributes(ring_vat);
0723 
0724 
0725   // Mirror *************************************************************
0726 
0727   G4double mirrorHeight    = 2.0*mm;
0728   G4double mirrorRadius    = ringInnerRadius;
0729   G4double mirrorVOffset   = 0.5*ringHeight;
0730   G4double mirrorVPosition = -0.5*GXeHeight + gasGap +mirrorVOffset;
0731 
0732   G4Tubs* mirror_tube = new G4Tubs("mirror_tube", 0.*cm, mirrorRadius,
0733      0.5*mirrorHeight, 0.*deg, 360.*deg);
0734   mirror_log  = new G4LogicalVolume(mirror_tube, mirror_mat, "mirror_log");
0735   mirror_phys = new G4PVPlacement(0, 
0736      G4ThreeVector(0.*cm, 0.*cm, mirrorVPosition),
0737      "mirror_phys", mirror_log, GXe_phys, false, 0);
0738 
0739   G4VisAttributes* mirror_vat = new G4VisAttributes(cyan);
0740   mirror_vat->SetVisibility(true);
0741   //  mirror_vat->SetForceSolid(true);
0742   mirror_log->SetVisAttributes(mirror_vat);
0743 
0744 
0745   // mirror surface
0746   G4OpticalSurface * OpMirrorSurface = new G4OpticalSurface
0747     ("MirrorSurface", unified, ground, dielectric_metal, sigalpha=5.0*deg);
0748   //G4LogicalBorderSurface* MirrorSurface = 
0749   new G4LogicalBorderSurface
0750     ("Mirror", GXe_phys, mirror_phys, OpMirrorSurface);
0751 
0752   std::vector<G4double> mirror_PP   = { 6.00*eV, 7.50*eV };
0753   std::vector<G4double> mirror_REFL = { 0.83, 0.78 };
0754   G4MaterialPropertiesTable *mirror_mt = new G4MaterialPropertiesTable();
0755   mirror_mt->AddProperty("REFLECTIVITY", mirror_PP, mirror_REFL);
0756   OpMirrorSurface->SetMaterialPropertiesTable(mirror_mt);
0757 
0758   // Grids  *************************************************************
0759 
0760   G4double gridHeight     = 0.100*mm;
0761   G4double gridRadius     = ringInnerRadius;
0762   G4double grid1VOffset   = 3.5*ringHeight+1.75*mm;
0763   G4double grid1VPosition = 0.5*LXeTubeHeight - grid1VOffset;
0764   G4double grid2VOffset   = 4.5*ringHeight+3.50*mm;
0765   G4double grid2VPosition = 0.5*LXeTubeHeight - grid2VOffset;
0766 
0767   G4Tubs* grid_tube = new G4Tubs("grid_tube", 0.*cm, gridRadius,
0768      0.5*gridHeight, 0.*deg, 360.*deg);
0769 
0770   grid1_log  = new G4LogicalVolume(grid_tube, grid_mat, "grid1_log");
0771   grid1_phys = new G4PVPlacement(0,G4ThreeVector(0.*cm, 0.*cm, grid1VPosition),
0772      "grid1_phys", grid1_log, LXe_phys, false, 0);
0773   grid2_log  = new G4LogicalVolume(grid_tube, grid_mat, "grid2_log");
0774   grid2_phys = new G4PVPlacement(0,G4ThreeVector(0.*cm, 0.*cm, grid2VPosition),
0775      "grid2_phys", grid2_log, LXe_phys, false, 0);
0776 
0777   G4VisAttributes* grid_vat = new G4VisAttributes(red);
0778   grid_vat->SetVisibility(true);
0779   grid1_log->SetVisAttributes(grid_vat);
0780   grid2_log->SetVisAttributes(grid_vat);
0781   
0782   
0783   // alpha source holder ************************************************
0784   
0785   G4double alphaHeight     = 0.7*mm; // total lead thickness = 1.23 mm
0786   G4double recessHeight    = 0.3*mm;  // totals lead thickness = 1.23 mm
0787   G4double alphaRadius     = 1.2*mm; // was 0.8
0788   G4double recessRadius    = 0.35*mm; // was 0.5 was 0.2
0789   G4double recessVPosition = 0.5*(alphaHeight - recessHeight);
0790 
0791   G4double alphaVOffset    = grid1VOffset-0.5*alphaHeight - gridHeight;
0792   G4double americiumHeight = 3000.*nanometer; // assumes ~1% Am  
0793   G4double extra_offset    = (recessHeight +0.3*mm + 0.5*americiumHeight); 
0794   G4double alphaVPosition  = 0.5*LXeTubeHeight - alphaVOffset + extra_offset;
0795 
0796   G4Tubs* alpha_tube  = new G4Tubs("alpha_tube", 0.*cm, alphaRadius,
0797      0.5*alphaHeight,  0.*deg, 360.*deg);
0798   G4Tubs* recess_tube = new G4Tubs("recess_tube", 0.*cm, recessRadius,
0799      0.5*recessHeight, 0.*deg, 360.*deg);
0800 
0801   G4SubtractionSolid* alpha_sol = new G4SubtractionSolid
0802     ("alpha_sol", alpha_tube, recess_tube, G4Transform3D
0803      (G4RotationMatrix(), G4ThreeVector(0. ,0. , recessVPosition)));
0804   alpha_log  = new G4LogicalVolume(alpha_sol, alpha_mat, "alpha_log");
0805 
0806   alpha_phys = new G4PVPlacement(0, G4ThreeVector(0., 0., alphaVPosition),
0807                          "alpha_phys", alpha_log, LXe_phys, false, 0);
0808 
0809   G4VisAttributes* alpha_vat = new G4VisAttributes(white);
0810   alpha_vat->SetVisibility(true);
0811   alpha_log ->SetVisAttributes(alpha_vat);
0812 
0813   // alpha source HOLDER surface
0814   G4OpticalSurface* OpAlphaSurface = new G4OpticalSurface("AlphaSurface", 
0815   unified, ground, dielectric_metal, sigalpha=20.0*deg);
0816   //G4LogicalBorderSurface* AlphaSurface =
0817   new G4LogicalBorderSurface
0818     ("Alpha", LXe_phys, alpha_phys, OpAlphaSurface);
0819 
0820   std::vector<G4double> alpha_PP   = { 6.00*eV, 7.50*eV };
0821   std::vector<G4double> alpha_REFL = { 0.05, 0.05 };
0822   G4MaterialPropertiesTable *alpha_mt = new G4MaterialPropertiesTable();
0823   alpha_mt->AddProperty("REFLECTIVITY", alpha_PP, alpha_REFL);
0824   OpAlphaSurface->SetMaterialPropertiesTable(alpha_mt);
0825 
0826   // americium ***********************************************************
0827 
0828   // moved above for the "extra_offset":
0829   // G4double americiumHeight    = 600.*nanometer; // assumes ~1% Am
0830   G4double americiumRadius    = recessRadius - 50.0*micrometer;
0831   G4double americiumVOffset   = 0.5*(alphaHeight-americiumHeight)-recessHeight;
0832   G4double americiumVPosition = americiumVOffset;
0833 
0834   sourceZ = vesselVPos + LXeVPos + alphaVPosition + americiumVPosition + PosZ;
0835   G4cout << G4endl << "Calibration source centre (X,Y,Z):  0, 0, " 
0836      << sourceZ/mm << " mm" << G4endl;
0837 
0838   G4Tubs* americium_tube = new G4Tubs("americium_tube", 0.*cm,
0839      americiumRadius, 0.5*americiumHeight, 0.*deg, 360.*deg);
0840   americium_log  = new G4LogicalVolume(americium_tube, americium_mat,
0841      "americium_log");
0842   americium_phys = new G4PVPlacement(0, G4ThreeVector(0., 0.,
0843      americiumVPosition),"americium_phys", americium_log, alpha_phys,false,0);
0844 
0845   // americium optical properties:
0846   G4OpticalSurface* OpAmericiumSurface = new G4OpticalSurface
0847     ("AmericiumSurface", unified, ground, dielectric_metal, sigalpha=5.0*deg);
0848   //G4LogicalBorderSurface* AmericiumSurface =
0849   new G4LogicalBorderSurface
0850     ("Americium", LXe_phys, americium_phys, OpAmericiumSurface);
0851 
0852   std::vector<G4double> americium_PP   = { 6.00*eV, 7.50*eV };
0853   std::vector<G4double> americium_REFL = { 0.7, 0.65 };
0854   G4MaterialPropertiesTable *americium_mt = new G4MaterialPropertiesTable();
0855   americium_mt->AddProperty("REFLECTIVITY", americium_PP, americium_REFL);
0856   OpAlphaSurface->SetMaterialPropertiesTable(americium_mt);
0857 
0858   G4VisAttributes* americium_vat= new G4VisAttributes(cyan);
0859   americium_vat->SetVisibility(true);
0860   americium_vat->SetForceSolid(true);
0861   americium_log->SetVisAttributes(americium_vat);
0862 
0863 
0864   // Photomultiplier: ETL 9829 QA ****************************************
0865 
0866   G4double pmtHeight    = 12.0*cm;
0867   G4double pmtRadius    = 2.6*cm;
0868   G4double pmtVOffset   = 1.0*cm;
0869   G4double pmtVPosition = -0.5*(LXeTubeHeight+pmtHeight)+pmtVOffset;
0870 
0871   G4Sphere* pmt_window = new G4Sphere("pmt_sphere", 0.*cm, 2.*pmtRadius, 
0872      0.*deg, 360.*deg, 0.*deg, 30.0*deg);
0873   G4Tubs* pmt_tube = new G4Tubs("pmt_tube", 0.*cm,  pmtRadius, 0.5*pmtHeight,
0874      0.*deg, 360.*deg);
0875   
0876   G4UnionSolid* pmt_sol = new G4UnionSolid("pmt_sol", pmt_tube, pmt_window,
0877     G4Transform3D(G4RotationMatrix(), G4ThreeVector(0,0,0.5*pmtHeight
0878     -2.*pmtRadius*std::cos(30.0*deg))));
0879 
0880   pmt_log  = new G4LogicalVolume(pmt_sol, pmt_mat, "pmt_log");
0881   pmt_phys = new G4PVPlacement(0,G4ThreeVector(0.*cm, 0.*cm, pmtVPosition),
0882      "pmt_phys", pmt_log, LXe_phys, false, 0);
0883 
0884   G4OpticalSurface* pmt_opsurf = new G4OpticalSurface
0885     ("pmt_opsurf",unified, polished, dielectric_dielectric);
0886   //G4LogicalBorderSurface* pmt_surf = 
0887   new G4LogicalBorderSurface
0888     ("pmt_surf", LXe_phys, pmt_phys, pmt_opsurf);
0889 
0890   G4VisAttributes* pmt_vat= new G4VisAttributes(blue);
0891   pmt_vat->SetForceSolid(true);
0892   pmt_vat->SetVisibility(true);
0893   pmt_log->SetVisAttributes(pmt_vat);
0894 
0895 
0896   // photocathode *******************************************************
0897 
0898   G4double phcathVOffset     = 0.5*pmtHeight-2.*pmtRadius*std::cos(30.0*deg);
0899   G4double phcathVPosition   = phcathVOffset;
0900 
0901   G4Sphere* phcath_sol = new G4Sphere("phcath_sphere",
0902      2.*pmtRadius-1.6*mm, 2.*pmtRadius-1.59*mm, 0.*deg, 360.*deg, 0.*deg, 
0903      27.0*deg);
0904 
0905   phcath_log  = new G4LogicalVolume(phcath_sol, phcath_mat, "phcath_log");
0906   phcath_phys = new G4PVPlacement(0, G4ThreeVector(0., 0., phcathVPosition),
0907      "phcath_phys", phcath_log, pmt_phys, false, 0);
0908 
0909   G4OpticalSurface*  phcath_opsurf = new G4OpticalSurface("phcath_opsurf",
0910      unified, polished, dielectric_dielectric);
0911   //G4LogicalBorderSurface* phcath_surf = 
0912   new G4LogicalBorderSurface
0913     ("phcath_surf", pmt_phys, phcath_phys, phcath_opsurf);
0914 
0915   std::vector<G4double> phcath_PP   = { 6.00*eV, 7.50*eV };
0916   // std::vector<G4double> phcath_REFL = { 0.0, 0.0};
0917   // G4MaterialPropertiesTable* phcath_mt = new G4MaterialPropertiesTable();
0918   // phcath_mt->AddProperty("REFLECTIVITY", phcath_PP, phcath_REFL);
0919   // phcath_opsurf->SetMaterialPropertiesTable(phcath_mt);
0920 
0921 
0922   //**Photocathode surface properties
0923   std::vector<G4double> photocath_EFF={1.,1.}; //Enables 'detection' of photons
0924   std::vector<G4double> photocath_ReR={1.92,1.92};
0925   std::vector<G4double> photocath_ImR={1.69,1.69};
0926   G4MaterialPropertiesTable* photocath_mt = new G4MaterialPropertiesTable();
0927   photocath_mt->AddProperty("EFFICIENCY",phcath_PP,photocath_EFF);
0928   photocath_mt->AddProperty("REALRINDEX",phcath_PP,photocath_ReR);
0929   photocath_mt->AddProperty("IMAGINARYRINDEX",phcath_PP,photocath_ImR);
0930   G4OpticalSurface* photocath_opsurf=
0931     new G4OpticalSurface("photocath_opsurf",glisur,polished,
0932                          dielectric_metal);
0933   photocath_opsurf->SetMaterialPropertiesTable(photocath_mt);
0934 
0935   G4VisAttributes* phcath_vat= new G4VisAttributes(lblue);
0936   phcath_vat->SetForceSolid(true);
0937   phcath_vat->SetVisibility(true);
0938   phcath_log->SetVisAttributes(phcath_vat);
0939 
0940   new G4LogicalSkinSurface("photocath_surf",phcath_log,photocath_opsurf);
0941 
0942   // ......................................................................
0943   // attach user limits ...................................................
0944 
0945   
0946   G4cout << G4endl << "User Limits: " << G4endl 
0947      << "\t theMaxTimeCuts:     " << G4BestUnit(theMaxTimeCuts,"Time")  
0948      << G4endl
0949      << "\t theRoomTimeCut:     " << G4BestUnit(theRoomTimeCut,"Time")  
0950      << G4endl
0951      << "\t theMaxStepSize:     " << G4BestUnit(theMaxStepSize,"Length")
0952      << G4endl
0953      << "\t theMinEKine:        " << G4BestUnit(theMinEkine,"Energy")   
0954      << G4endl
0955      << "\t minRoomMinEKine:    " << G4BestUnit(theRoomMinEkine,"Energy")
0956      << G4endl << G4endl;
0957 
0958   if (theUserLimitsForRoom != 0) delete theUserLimitsForRoom;
0959   if (theUserLimitsForDetector != 0) delete theUserLimitsForDetector;
0960 
0961   theUserLimitsForRoom = new G4UserLimits(theMaxStepSize,   // step length max
0962                       DBL_MAX,          // track length max
0963                       theRoomTimeCut,   // Time cut
0964                       theRoomMinEkine); // min energy
0965 
0966 #include "DMXDetectorRoomLimits.icc"
0967 
0968   theUserLimitsForDetector = new G4UserLimits(theDetectorStepSize,
0969                           DBL_MAX, // Track Max
0970                           theMaxTimeCuts,
0971                           theMinEkine);
0972 
0973       world_log->SetUserLimits(theUserLimitsForRoom);
0974         lab_log->SetUserLimits(theUserLimitsForRoom);
0975      jacket_log->SetUserLimits(theUserLimitsForRoom);
0976      vacuum_log->SetUserLimits(theUserLimitsForRoom);
0977      vessel_log->SetUserLimits(theUserLimitsForRoom);
0978         GXe_log->SetUserLimits(theUserLimitsForDetector);
0979     //        LXe_log->SetUserLimits(theUserLimitsForXenon);
0980         LXe_log->SetUserLimits(theUserLimitsForDetector);
0981    CuShield_log->SetUserLimits(theUserLimitsForDetector);
0982        ring_log->SetUserLimits(theUserLimitsForDetector);
0983      mirror_log->SetUserLimits(theUserLimitsForDetector);
0984       grid1_log->SetUserLimits(theUserLimitsForDetector);
0985       grid2_log->SetUserLimits(theUserLimitsForDetector);
0986       alpha_log->SetUserLimits(theUserLimitsForDetector);
0987   americium_log->SetUserLimits(theUserLimitsForDetector);
0988         pmt_log->SetUserLimits(theUserLimitsForDetector);
0989      phcath_log->SetUserLimits(theUserLimitsForDetector);
0990 
0991  return world_phys;
0992 
0993 }
0994 
0995 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
0996 
0997 void DMXDetectorConstruction::ConstructSDandField()
0998 {
0999   // ......................................................................
1000   // sensitive detectors ..................................................
1001   // ......................................................................
1002 
1003   if (LXeSD.Get() == 0) 
1004     {    
1005       G4String name="/DMXDet/LXeSD";
1006       DMXScintSD* aSD = new DMXScintSD(name);
1007       LXeSD.Put(aSD);
1008     }
1009   G4SDManager::GetSDMpointer()->AddNewDetector(LXeSD.Get());  
1010   if (LXe_log)    
1011     SetSensitiveDetector(LXe_log,LXeSD.Get());
1012 
1013   if (pmtSD.Get() == 0)
1014     {
1015       G4String name="/DMXDet/pmtSD";
1016       DMXPmtSD* aSD = new DMXPmtSD(name);
1017       pmtSD.Put(aSD);
1018     }
1019   G4SDManager::GetSDMpointer()->AddNewDetector(pmtSD.Get()); 
1020   if (phcath_log)
1021     SetSensitiveDetector(phcath_log,pmtSD.Get());
1022 
1023   return;
1024 }
1025  
1026 
1027 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1028 
1029 // specific method to G4UserLimits:= SetUserMinEkine
1030 void DMXDetectorConstruction::SetRoomEnergyCut(G4double val)
1031 {
1032   // set minimum charged particle energy cut - NB: for ROOM
1033   theRoomMinEkine = val;
1034   if (theUserLimitsForRoom != 0) 
1035     {
1036       theUserLimitsForRoom->SetUserMinEkine(val); 
1037       G4cout << " Changing Room energy cut to: " << G4BestUnit(val,"Energy")
1038          << G4endl;
1039     }
1040 }  
1041 
1042 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1043 
1044 // specific method to G4UserLimits:= SetUserMinEkine
1045 void DMXDetectorConstruction::SetEnergyCut(G4double val)
1046 {
1047   // set minimum charged particle energy cut - NB: for Xenon Detector
1048   theMinEkine = val;
1049   if (theUserLimitsForDetector != 0) 
1050     {
1051       theUserLimitsForDetector->SetUserMinEkine(val);
1052       G4cout << "Changing Detector energy cut to: " << G4BestUnit(val,"Energy")
1053          << G4endl;
1054     }
1055 }  
1056 
1057 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1058 
1059 // specific method to G4UserLimits:= SetUserMaxTime
1060 void DMXDetectorConstruction::SetRoomTimeCut(G4double val)
1061 {
1062   // set room time cut:
1063   theRoomTimeCut = val;
1064   if (theUserLimitsForRoom != 0) 
1065     {
1066       theUserLimitsForRoom->SetUserMaxTime(val);
1067       G4cout << " Changing Room Time cut to: " << G4BestUnit(val,"Time")
1068          << G4endl;
1069     }
1070 }  
1071 
1072 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1073 
1074 // specific method to G4UserLimits:= SetUserMaxTime
1075 void DMXDetectorConstruction::SetTimeCut(G4double val)
1076 {
1077   // set detector time cut:
1078   theMaxTimeCuts = val;
1079   if (theUserLimitsForDetector != 0) 
1080     {
1081       theUserLimitsForDetector->SetUserMaxTime(val);
1082       G4cout << " Changing Detector Time cut to: " << G4BestUnit(val,"Time")
1083          << G4endl;
1084     }
1085 }  
1086 
1087 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
1088 
1089 
1090