Import Geant4 6.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-09 10:56:29 +02:00
parent 1d812b78b1
commit e083ffb441
1415 changed files with 111223 additions and 21207 deletions
@@ -0,0 +1,359 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeDetectorConstruction.hh"
#include "LXePMTSD.hh"
#include "LXeScintSD.hh"
#include "LXeDetectorMessenger.hh"
#include "LXeMainVolume.hh"
#include "LXeWLSSlab.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "G4LogicalBorderSurface.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4OpticalSurface.hh"
#include "G4MaterialTable.hh"
#include "G4VisAttributes.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4Sphere.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "globals.hh"
#include "G4SolidStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4GeometryManager.hh"
#include "G4UImanager.hh"
G4bool LXeDetectorConstruction::sphereOn = true;
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeDetectorConstruction::LXeDetectorConstruction(){
SetDefaults();
detectorMessenger = new LXeDetectorMessenger(this);
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeDetectorConstruction::~LXeDetectorConstruction(){
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeDetectorConstruction::DefineMaterials(){
G4double a; // atomic mass
G4double z; // atomic number
G4double density;
G4int polyPMMA = 1;
G4int nC_PMMA = 3+2*polyPMMA;
G4int nH_PMMA = 6+2*polyPMMA;
G4int polyeth = 1;
G4int nC_eth = 2*polyeth;
G4int nH_eth = 4*polyeth;
//***Elements
H = new G4Element("H", "H", z=1., a=1.01*g/mole);
C = new G4Element("C", "C", z=6., a=12.01*g/mole);
N = new G4Element("N", "N", z=7., a= 14.01*g/mole);
O = new G4Element("O" , "O", z=8., a= 16.00*g/mole);
//***Materials
//Liquid Xenon
LXe = new G4Material("LXe",z=54.,a=131.29*g/mole,density=3.020*g/cm3);
//Aluminum
Al = new G4Material("Al",z=13.,a=26.98*g/mole,density=2.7*g/cm3);
//Vacuum
Vacuum = new G4Material("Vacuum",z=1.,a=1.01*g/mole,
density=universe_mean_density,kStateGas,0.1*kelvin,
1.e-19*pascal);
//Air
Air = new G4Material("Air", density= 1.29*mg/cm3, 2);
Air->AddElement(N, 70*perCent);
Air->AddElement(O, 30*perCent);
//Glass
Glass = new G4Material("Glass", density=1.032*g/cm3,2);
Glass->AddElement(C,91.533*perCent);
Glass->AddElement(H,8.467*perCent);
//Polystyrene
Pstyrene = new G4Material("Polystyrene", density= 1.03*g/cm3, 2);
Pstyrene->AddElement(C, 8);
Pstyrene->AddElement(H, 8);
//Fiber(PMMA)
PMMA = new G4Material("PMMA", density=1190*kg/m3,3);
PMMA->AddElement(H,nH_PMMA);
PMMA->AddElement(C,nC_PMMA);
PMMA->AddElement(O,2);
//Cladding(polyethylene)
Pethylene = new G4Material("Pethylene", density=1200*kg/m3,2);
Pethylene->AddElement(H,nH_eth);
Pethylene->AddElement(C,nC_eth);
//Double cladding(flourinated polyethylene)
fPethylene = new G4Material("fPethylene", density=1400*kg/m3,2);
fPethylene->AddElement(H,nH_eth);
fPethylene->AddElement(C,nC_eth);
//***Material properties tables
const G4int LXe_NUMENTRIES = 3;
G4double LXe_Energy[LXe_NUMENTRIES] = { 7.0*eV , 7.07*eV, 7.14*eV };
G4double LXe_SCINT[LXe_NUMENTRIES] = { 0.1, 1.0, 0.1 };
G4double LXe_RIND[LXe_NUMENTRIES] = { 1.59 , 1.57, 1.54 };
G4double LXe_ABSL[LXe_NUMENTRIES] = { 35.*cm, 35.*cm, 35.*cm};
LXe_mt = new G4MaterialPropertiesTable();
LXe_mt->AddProperty("FASTCOMPONENT", LXe_Energy, LXe_SCINT, LXe_NUMENTRIES);
LXe_mt->AddProperty("SLOWCOMPONENT", LXe_Energy, LXe_SCINT, LXe_NUMENTRIES);
LXe_mt->AddProperty("RINDEX", LXe_Energy, LXe_RIND, LXe_NUMENTRIES);
LXe_mt->AddProperty("ABSLENGTH", LXe_Energy, LXe_ABSL, LXe_NUMENTRIES);
LXe_mt->AddConstProperty("SCINTILLATIONYIELD",12000./MeV);
LXe_mt->AddConstProperty("RESOLUTIONSCALE",1.0);
LXe_mt->AddConstProperty("FASTTIMECONSTANT",20.*ns);
LXe_mt->AddConstProperty("SLOWTIMECONSTANT",45.*ns);
LXe_mt->AddConstProperty("YIELDRATIO",1.0);
LXe->SetMaterialPropertiesTable(LXe_mt);
G4double Glass_RIND[LXe_NUMENTRIES]={1.49,1.49,1.49};
G4double Glass_AbsLength[LXe_NUMENTRIES]={420.*cm,420.*cm,420.*cm};
G4MaterialPropertiesTable *Glass_mt = new G4MaterialPropertiesTable();
Glass_mt->AddProperty("ABSLENGTH",LXe_Energy,Glass_AbsLength,LXe_NUMENTRIES);
Glass_mt->AddProperty("RINDEX",LXe_Energy,Glass_RIND,LXe_NUMENTRIES);
Glass->SetMaterialPropertiesTable(Glass_mt);
G4double Vacuum_Energy[LXe_NUMENTRIES]={2.0*eV,7.0*eV,7.14*eV};
G4double Vacuum_RIND[LXe_NUMENTRIES]={1.,1.,1.};
G4MaterialPropertiesTable *Vacuum_mt = new G4MaterialPropertiesTable();
Vacuum_mt->AddProperty("RINDEX", Vacuum_Energy, Vacuum_RIND,LXe_NUMENTRIES);
Vacuum->SetMaterialPropertiesTable(Vacuum_mt);
Air->SetMaterialPropertiesTable(Vacuum_mt);//Give air the same rindex
const G4int WLS_NUMENTRIES = 4;
G4double WLS_Energy[] = {2.00*eV,2.87*eV,2.90*eV,3.47*eV};
G4double RIndexPstyrene[WLS_NUMENTRIES]={ 1.5, 1.5, 1.5, 1.5};
G4double Absorption1[WLS_NUMENTRIES]={2.*cm, 2.*cm, 2.*cm, 2.*cm};
G4double ScintilFast[WLS_NUMENTRIES]={1.00, 1.00, 0.00, 0.00};
MPTPStyrene = new G4MaterialPropertiesTable();
MPTPStyrene->AddProperty("RINDEX",WLS_Energy,RIndexPstyrene,WLS_NUMENTRIES);
MPTPStyrene->AddProperty("ABSLENGTH",WLS_Energy,Absorption1,WLS_NUMENTRIES);
MPTPStyrene->AddProperty("FASTCOMPONENT",WLS_Energy, ScintilFast,
WLS_NUMENTRIES);
MPTPStyrene->AddConstProperty("SCINTILLATIONYIELD",10./keV);
MPTPStyrene->AddConstProperty("RESOLUTIONSCALE",1.0);
MPTPStyrene->AddConstProperty("FASTTIMECONSTANT", 10.*ns);
Pstyrene->SetMaterialPropertiesTable(MPTPStyrene);
G4double RefractiveIndexFiber[WLS_NUMENTRIES]={ 1.60, 1.60, 1.60, 1.60};
G4double AbsFiber[WLS_NUMENTRIES]={0.1*mm,0.1*mm,9.00*m,9.00*m};
G4double EmissionFib[WLS_NUMENTRIES]={0.0, 0.0,1.0, 1.0};
G4MaterialPropertiesTable* MPTFiber = new G4MaterialPropertiesTable();
MPTFiber->AddProperty("RINDEX",WLS_Energy,RefractiveIndexFiber,
WLS_NUMENTRIES);
MPTFiber->AddProperty("WLSABSLENGTH",WLS_Energy,AbsFiber,WLS_NUMENTRIES);
MPTFiber->AddProperty("WLSCOMPONENT",WLS_Energy,EmissionFib,WLS_NUMENTRIES);
MPTFiber->AddConstProperty("WLSTIMECONSTANT", 0.5*ns);
PMMA->SetMaterialPropertiesTable(MPTFiber);
G4double RefractiveIndexClad1[WLS_NUMENTRIES]={ 1.49, 1.49, 1.49, 1.49};
G4MaterialPropertiesTable* MPTClad1 = new G4MaterialPropertiesTable();
MPTClad1->AddProperty("RINDEX",WLS_Energy,RefractiveIndexClad1,
WLS_NUMENTRIES);
MPTClad1->AddProperty("ABSLENGTH",WLS_Energy,AbsFiber,WLS_NUMENTRIES);
Pethylene->SetMaterialPropertiesTable(MPTClad1);
G4double RefractiveIndexClad2[WLS_NUMENTRIES]={ 1.42, 1.42, 1.42, 1.42};
G4MaterialPropertiesTable* MPTClad2 = new G4MaterialPropertiesTable();
MPTClad2->AddProperty("RINDEX",WLS_Energy,RefractiveIndexClad2,
WLS_NUMENTRIES);
MPTClad2->AddProperty("ABSLENGTH",WLS_Energy,AbsFiber,WLS_NUMENTRIES);
fPethylene->SetMaterialPropertiesTable(MPTClad2);
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
G4VPhysicalVolume* LXeDetectorConstruction::Construct(){
DefineMaterials();
return ConstructDetector();
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
G4VPhysicalVolume* LXeDetectorConstruction::ConstructDetector()
{
//The experimental hall walls are all 1m away from housing walls
G4double expHall_x = scint_x+d_mtl+1.*m;
G4double expHall_y = scint_y+d_mtl+1.*m;
G4double expHall_z = scint_z+d_mtl+1.*m;
//Create experimental hall
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);
experimentalHall_log->SetVisAttributes(G4VisAttributes::Invisible);
//Place the main volume
if(mainVolume){
new LXeMainVolume(0,G4ThreeVector(),experimentalHall_log,false,0,this);
}
//Place the WLS slab
if(WLSslab){
G4VPhysicalVolume* slab = new LXeWLSSlab(0,G4ThreeVector(0.,0.,
-scint_z/2.-slab_z-1.*cm),
experimentalHall_log,false,0,
this);
//Surface properties for the WLS slab
G4OpticalSurface* ScintWrap = new G4OpticalSurface("ScintWrap");
new G4LogicalBorderSurface("ScintWrap", slab,
experimentalHall_phys,
ScintWrap);
ScintWrap->SetType(dielectric_metal);
ScintWrap->SetFinish(polished);
ScintWrap->SetModel(glisur);
const G4int NUM = 2;
G4double pp[NUM] = {2.0*eV, 3.5*eV};
G4double reflectivity[NUM] = {1., 1.};
G4double efficiency[NUM] = {0.0, 0.0};
G4MaterialPropertiesTable* ScintWrapProperty
= new G4MaterialPropertiesTable();
ScintWrapProperty->AddProperty("REFLECTIVITY",pp,reflectivity,NUM);
ScintWrapProperty->AddProperty("EFFICIENCY",pp,efficiency,NUM);
ScintWrap->SetMaterialPropertiesTable(ScintWrapProperty);
}
return experimentalHall_phys;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeDetectorConstruction::SetDimensions(G4ThreeVector dims){
this->scint_x=dims[0];
this->scint_y=dims[1];
this->scint_z=dims[2];
updated=true;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeDetectorConstruction::SetHousingThickness(G4double d_mtl){
this->d_mtl=d_mtl;
updated=true;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeDetectorConstruction::SetNX(G4int nx){
this->nx=nx;
updated=true;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeDetectorConstruction::SetNY(G4int ny){
this->ny=ny;
updated=true;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeDetectorConstruction::SetNZ(G4int nz){
this->nz=nz;
updated=true;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeDetectorConstruction::SetPMTRadius(G4double outerRadius_pmt){
this->outerRadius_pmt=outerRadius_pmt;
updated=true;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeDetectorConstruction::SetDefaults(){
//Resets to default values
d_mtl=0.0635*cm;
scint_x = 17.8*cm;
scint_y = 17.8*cm;
scint_z = 22.6*cm;
nx = 2;
ny = 2;
nz = 3;
outerRadius_pmt = 2.3*cm;
sphereOn = true;
refl=1.0;
nfibers=15;
WLSslab=false;
mainVolume=true;
slab_z=2.5*mm;
G4UImanager::GetUIpointer()
->ApplyCommand("/LXe/detector/scintYieldFactor 1.");
if(LXe_mt)LXe_mt->AddConstProperty("SCINTILLATIONYIELD",12000./MeV);
if(MPTPStyrene)MPTPStyrene->AddConstProperty("SCINTILLATIONYIELD",10./keV);
updated=true;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeDetectorConstruction::UpdateGeometry(){
// clean-up previous geometry
G4GeometryManager::GetInstance()->OpenGeometry();
G4PhysicalVolumeStore::GetInstance()->Clean();
G4LogicalVolumeStore::GetInstance()->Clean();
G4SolidStore::GetInstance()->Clean();
G4LogicalSkinSurface::CleanSurfaceTable();
G4LogicalBorderSurface::CleanSurfaceTable();
//define new one
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructDetector());
G4RunManager::GetRunManager()->GeometryHasBeenModified();
updated=false;
}
void LXeDetectorConstruction::SetMainScintYield(G4double y){
LXe_mt->AddConstProperty("SCINTILLATIONYIELD",y/MeV);
}
void LXeDetectorConstruction::SetWLSScintYield(G4double y){
MPTPStyrene->AddConstProperty("SCINTILLATIONYIELD",y/MeV);
}
@@ -0,0 +1,185 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeDetectorMessenger.hh"
#include "LXeDetectorConstruction.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4Scintillation.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeDetectorMessenger::LXeDetectorMessenger(LXeDetectorConstruction* LXeDetect)
:LXeDetector(LXeDetect)
{
//Setup a command directory for detector controls with guidance
detectorDir = new G4UIdirectory("/LXe/detector/");
detectorDir->SetGuidance("Detector geometry control");
volumesDir = new G4UIdirectory("/LXe/detector/volumes/");
volumesDir->SetGuidance("Enable/disable volumes");
//Various commands for modifying detector geometry
dimensionsCmd =
new G4UIcmdWith3VectorAndUnit("/LXe/detector/dimensions",this);
dimensionsCmd->SetGuidance("Set the dimensions of the detector volume.");
dimensionsCmd->SetParameterName("scint_x","scint_y","scint_z",false);
dimensionsCmd->SetDefaultUnit("cm");
housingThicknessCmd = new G4UIcmdWithADoubleAndUnit
("/LXe/detector/housingThickness",this);
housingThicknessCmd->SetGuidance("Set the thickness of the housing.");
housingThicknessCmd->SetParameterName("d_mtl",false);
housingThicknessCmd->SetDefaultUnit("cm");
pmtRadiusCmd = new G4UIcmdWithADoubleAndUnit
("/LXe/detector/pmtRadius",this);
pmtRadiusCmd->SetGuidance("Set the radius of the PMTs.");
pmtRadiusCmd->SetParameterName("radius",false);
pmtRadiusCmd->SetDefaultUnit("cm");
nxCmd = new G4UIcmdWithAnInteger("/LXe/detector/nx",this);
nxCmd->SetGuidance("Set the number of PMTs along the x-dimension.");
nxCmd->SetParameterName("nx",false);
nyCmd = new G4UIcmdWithAnInteger("/LXe/detector/ny",this);
nyCmd->SetGuidance("Set the number of PMTs along the y-dimension.");
nyCmd->SetParameterName("ny",false);
nzCmd = new G4UIcmdWithAnInteger("/LXe/detector/nz",this);
nzCmd->SetGuidance("Set the number of PMTs along the z-dimension.");
nzCmd->SetParameterName("nz",false);
sphereCmd = new G4UIcmdWithABool("/LXe/detector/volumes/sphere",this);
sphereCmd->SetGuidance("Enable/Disable the sphere.");
reflectivityCmd = new G4UIcmdWithADouble("/LXe/detector/reflectivity",this);
reflectivityCmd->SetGuidance("Set the reflectivity of the housing.");
wlsCmd = new G4UIcmdWithABool("/LXe/detector/volumes/wls",this);
wlsCmd->SetGuidance("Enable/Disable the WLS slab");
lxeCmd = new G4UIcmdWithABool("/LXe/detector/volumes/lxe",this);
wlsCmd->SetGuidance("Enable/Disable the main detector volume.");
nFibersCmd = new G4UIcmdWithAnInteger("/LXe/detector/nfibers",this);
nFibersCmd->SetGuidance("Set the number of WLS fibers in the WLS slab.");
updateCmd = new G4UIcommand("/LXe/detector/update",this);
updateCmd->SetGuidance("Update the detector geometry with changed values.");
updateCmd->SetGuidance
("Must be run before beamOn if detector has been changed.");
defaultsCmd = new G4UIcommand("/LXe/detector/defaults",this);
defaultsCmd->SetGuidance("Set all detector geometry values to defaults.");
defaultsCmd->SetGuidance("(Update still required)");
MainScintYield=new G4UIcmdWithADouble("/LXe/detector/MainScintYield",this);
MainScintYield->SetGuidance("Set scinitillation yield of main volume.");
MainScintYield->SetGuidance("Specified in photons/MeV");
WLSScintYield = new G4UIcmdWithADouble("/LXe/detector/WLSScintYield",this);
WLSScintYield->SetGuidance("Set scintillation yield of WLS Slab");
WLSScintYield->SetGuidance("Specified in photons/MeV");
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeDetectorMessenger::~LXeDetectorMessenger()
{
delete dimensionsCmd;
delete housingThicknessCmd;
delete pmtRadiusCmd;
delete nxCmd;
delete nyCmd;
delete nzCmd;
delete updateCmd;
delete detectorDir;
delete volumesDir;
delete defaultsCmd;
delete sphereCmd;
delete wlsCmd;
delete lxeCmd;
delete nFibersCmd;
delete reflectivityCmd;
delete MainScintYield;
delete WLSScintYield;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == dimensionsCmd ){
LXeDetector->SetDimensions(dimensionsCmd->GetNew3VectorValue(newValue));
}
else if (command == housingThicknessCmd){
LXeDetector->SetHousingThickness(housingThicknessCmd
->GetNewDoubleValue(newValue));
}
else if (command == pmtRadiusCmd){
LXeDetector->SetPMTRadius(pmtRadiusCmd->GetNewDoubleValue(newValue));
}
else if (command == nxCmd){
LXeDetector->SetNX(nxCmd->GetNewIntValue(newValue));
}
else if (command == nyCmd){
LXeDetector->SetNY(nyCmd->GetNewIntValue(newValue));
}
else if (command == nzCmd){
LXeDetector->SetNZ(nzCmd->GetNewIntValue(newValue));
}
else if (command == updateCmd){
LXeDetector->UpdateGeometry();
}
else if (command == defaultsCmd){
LXeDetector->SetDefaults();
}
else if (command == sphereCmd){
LXeDetector->SetSphereOn(sphereCmd->GetNewBoolValue(newValue));
}
else if (command == reflectivityCmd){
LXeDetector
->SetHousingReflectivity(reflectivityCmd->GetNewDoubleValue(newValue));
}
else if (command == wlsCmd){
LXeDetector->SetWLSSlabOn(wlsCmd->GetNewBoolValue(newValue));
}
else if (command == lxeCmd){
LXeDetector->SetMainVolumeOn(lxeCmd->GetNewBoolValue(newValue));
}
else if (command == nFibersCmd){
LXeDetector->SetNFibers(nFibersCmd->GetNewIntValue(newValue));
}
else if (command == MainScintYield){
LXeDetector->SetMainScintYield(MainScintYield->GetNewDoubleValue(newValue));
}
else if (command == WLSScintYield){
LXeDetector->SetWLSScintYield(WLSScintYield->GetNewDoubleValue(newValue));
}
}
@@ -0,0 +1,111 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeEMPhysics.hh"
#include "globals.hh"
#include "G4ios.hh"
#include <iomanip>
LXeEMPhysics::LXeEMPhysics(const G4String& name)
: G4VPhysicsConstructor(name)
{
}
LXeEMPhysics::~LXeEMPhysics()
{
}
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4Gamma.hh"
#include "G4Electron.hh"
#include "G4Positron.hh"
#include "G4NeutrinoE.hh"
#include "G4AntiNeutrinoE.hh"
void LXeEMPhysics::ConstructParticle()
{
// gamma
G4Gamma::GammaDefinition();
// electron
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
}
#include "G4ProcessManager.hh"
void LXeEMPhysics::ConstructProcess()
{
thePhotoEffect = new G4PhotoElectricEffect();
theComptonEffect = new G4ComptonScattering();
thePairProduction = new G4GammaConversion();
// Electron physics
theElectronMultipleScattering = new G4MultipleScattering();
theElectronIonisation = new G4eIonisation();
theElectronBremsStrahlung = new G4eBremsstrahlung();
//Positron physics
thePositronMultipleScattering = new G4MultipleScattering();
thePositronIonisation = new G4eIonisation();
thePositronBremsStrahlung = new G4eBremsstrahlung();
theAnnihilation = new G4eplusAnnihilation();
G4ProcessManager * pManager = 0;
// Gamma Physics
pManager = G4Gamma::Gamma()->GetProcessManager();
pManager->AddDiscreteProcess(thePhotoEffect);
pManager->AddDiscreteProcess(theComptonEffect);
pManager->AddDiscreteProcess(thePairProduction);
// Electron Physics
pManager = G4Electron::Electron()->GetProcessManager();
pManager->AddProcess(theElectronMultipleScattering, -1, 1, 1);
pManager->AddProcess(theElectronIonisation, -1, 2, 2);
pManager->AddProcess(theElectronBremsStrahlung, -1, 3, 3);
//Positron Physics
pManager = G4Positron::Positron()->GetProcessManager();
pManager->AddProcess(thePositronMultipleScattering, -1, 1, 1);
pManager->AddProcess(thePositronIonisation, -1, 2, 2);
pManager->AddProcess(thePositronBremsStrahlung, -1, 3, 3);
pManager->AddProcess(theAnnihilation, 0,-1, 4);
}
@@ -0,0 +1,207 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeEventAction.hh"
#include "LXeScintHit.hh"
#include "LXePMTHit.hh"
#include "LXeUserEventInformation.hh"
#include "LXeTrajectory.hh"
#include "RecorderBase.hh"
#include "G4EventManager.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "G4UImanager.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeEventAction::LXeEventAction(RecorderBase* r)
:recorder(r),saveThreshold(0),scintCollID(-1),pmtCollID(-1),verbose(0),
pmtThreshold(1),forcedrawphotons(false),forcenophotons(false)
{
eventMessenger=new LXeEventMessenger(this);
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeEventAction::~LXeEventAction(){}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeEventAction::BeginOfEventAction(const G4Event* anEvent){
//New event, add the user information object
G4EventManager::
GetEventManager()->SetUserInformation(new LXeUserEventInformation);
G4SDManager* SDman = G4SDManager::GetSDMpointer();
if(scintCollID<0)
scintCollID=SDman->GetCollectionID("scintCollection");
if(pmtCollID<0)
pmtCollID=SDman->GetCollectionID("pmtHitCollection");
if(recorder)recorder->RecordBeginOfEvent(anEvent);
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeEventAction::EndOfEventAction(const G4Event* anEvent){
LXeUserEventInformation* eventInformation
=(LXeUserEventInformation*)anEvent->GetUserInformation();
G4TrajectoryContainer* trajectoryContainer=anEvent->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
// extract the trajectories and draw them
if (G4VVisManager::GetConcreteInstance()){
for (G4int i=0; i<n_trajectories; i++){
LXeTrajectory* trj = (LXeTrajectory*)
((*(anEvent->GetTrajectoryContainer()))[i]);
if(trj->GetParticleName()=="opticalphoton"){
trj->SetForceDrawTrajectory(forcedrawphotons);
trj->SetForceNoDrawTrajectory(forcenophotons);
}
trj->DrawTrajectory(50);
}
}
LXeScintHitsCollection* SHC = 0;
LXePMTHitsCollection* PHC = 0;
G4HCofThisEvent* HCE = anEvent->GetHCofThisEvent();
//Get the hit collections
if(HCE){
if(scintCollID>=0)SHC = (LXeScintHitsCollection*)(HCE->GetHC(scintCollID));
if(pmtCollID>=0)PHC = (LXePMTHitsCollection*)(HCE->GetHC(pmtCollID));
}
//Hits in scintillator
if(SHC){
int n_hit = SHC->entries();
G4ThreeVector eWeightPos(0.);
G4double edep;
G4double edepMax=0;
for(int i=0;i<n_hit;i++){ //gather info on hits in scintillator
edep=(*SHC)[i]->GetEdep();
eventInformation->IncEDep(edep); //sum up the edep
eWeightPos += (*SHC)[i]->GetPos()*edep;//calculate energy weighted pos
if(edep>edepMax){
edepMax=edep;//store max energy deposit
G4ThreeVector posMax=(*SHC)[i]->GetPos();
eventInformation->SetPosMax(posMax,edep);
}
}
if(eventInformation->GetEDep()==0.){
if(verbose>0)G4cout<<"No hits in the scintillator this event."<<G4endl;
}
else{
//Finish calculation of energy weighted position
eWeightPos/=eventInformation->GetEDep();
eventInformation->SetEWeightPos(eWeightPos);
if(verbose>0){
G4cout << "\tEnergy weighted position of hits in LXe : "
<< eWeightPos/mm << G4endl;
}
}
if(verbose>0){
G4cout << "\tTotal energy deposition in scintillator : "
<< eventInformation->GetEDep() / keV << " (keV)" << G4endl;
}
}
if(PHC){
G4ThreeVector reconPos=0.;
G4int pmts=PHC->entries();
//Gather info from all PMTs
for(G4int i=0;i<pmts;i++){
eventInformation->IncHitCount((*PHC)[i]->GetPhotonCount());
reconPos+=(*PHC)[i]->GetPMTPos()*(*PHC)[i]->GetPhotonCount();
if((*PHC)[i]->GetPhotonCount()>=pmtThreshold){
eventInformation->IncPMTSAboveThreshold();
}
else{//wasnt above the threshold, turn it back off
(*PHC)[i]->SetDrawit(false);
}
}
if(eventInformation->GetHitCount()>0){//dont bother unless there were hits
reconPos/=eventInformation->GetHitCount();
if(verbose>0){
G4cout << "\tReconstructed position of hits in LXe : "
<< reconPos/mm << G4endl;
}
eventInformation->SetReconPos(reconPos);
}
PHC->DrawAllHits();
}
if(verbose>0){
//End of event output. later to be controlled by a verbose level
G4cout << "\tNumber of photons that hit PMTs in this event : "
<< eventInformation->GetHitCount() << G4endl;
G4cout << "\tNumber of PMTs above threshold("<<pmtThreshold<<") : "
<< eventInformation->GetPMTSAboveThreshold() << G4endl;
G4cout << "\tNumber of photons produced by scintillation in this event : "
<< eventInformation->GetPhotonCount_Scint() << G4endl;
G4cout << "\tNumber of photons produced by cerenkov in this event : "
<< eventInformation->GetPhotonCount_Ceren() << G4endl;
G4cout << "\tNumber of photons absorbed (OpAbsorption) in this event : "
<< eventInformation->GetAbsorptionCount() << G4endl;
G4cout << "\tNumber of photons absorbed at boundaries (OpBoundary) in "
<< "this event : " << eventInformation->GetBoundaryAbsorptionCount()
<< G4endl;
G4cout << "Unacounted for photons in this event : "
<< (eventInformation->GetPhotonCount_Scint() +
eventInformation->GetPhotonCount_Ceren() -
eventInformation->GetAbsorptionCount() -
eventInformation->GetHitCount() -
eventInformation->GetBoundaryAbsorptionCount())
<< G4endl;
}
//If we have set the flag to save 'special' events, save here
if(saveThreshold&&eventInformation->GetPhotonCount() <= saveThreshold)
G4RunManager::GetRunManager()->rndmSaveThisEvent();
if(recorder)recorder->RecordEndOfEvent(anEvent);
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeEventAction::SetSaveThreshold(G4int save){
/*Sets the save threshold for the random number seed. If the number of photons
generated in an event is lower than this, then save the seed for this event
in a file called run###evt###.rndm
*/
saveThreshold=save;
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
G4RunManager::GetRunManager()->SetRandomNumberStoreDir("random/");
// G4UImanager::GetUIpointer()->ApplyCommand("/random/setSavingFlag 1");
}
@@ -0,0 +1,92 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeEventMessenger.hh"
#include "LXeEventAction.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithAnInteger.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeEventMessenger::LXeEventMessenger(LXeEventAction* event)
:LXeEvent(event)
{
saveThresholdCmd = new G4UIcmdWithAnInteger("/LXe/saveThreshold",this);
saveThresholdCmd->SetGuidance("Set the photon count threshold for saving the random number seed for an event.");
saveThresholdCmd->SetParameterName("photons",true);
saveThresholdCmd->SetDefaultValue(4500);
saveThresholdCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
verboseCmd = new G4UIcmdWithAnInteger("/LXe/eventVerbose",this);
verboseCmd->SetGuidance("Set the verbosity of event data.");
verboseCmd->SetParameterName("verbose",true);
verboseCmd->SetDefaultValue(1);
pmtThresholdCmd = new G4UIcmdWithAnInteger("/LXe/pmtThreshold",this);
pmtThresholdCmd->SetGuidance("Set the pmtThreshold (in # of photons)");
forceDrawPhotonsCmd=new G4UIcmdWithABool("/LXe/forceDrawPhotons",this);
forceDrawPhotonsCmd->SetGuidance("Force drawing of photons.");
forceDrawPhotonsCmd
->SetGuidance("(Higher priority than /LXe/forceDrawNoPhotons)");
forceDrawNoPhotonsCmd=new G4UIcmdWithABool("/LXe/forceDrawNoPhotons",this);
forceDrawNoPhotonsCmd->SetGuidance("Force no drawing of photons.");
forceDrawNoPhotonsCmd
->SetGuidance("(Lower priority than /LXe/forceDrawPhotons)");
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeEventMessenger::~LXeEventMessenger(){
delete saveThresholdCmd;
delete verboseCmd;
delete pmtThresholdCmd;
delete forceDrawPhotonsCmd;
delete forceDrawNoPhotonsCmd;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeEventMessenger::SetNewValue(G4UIcommand* command, G4String newValue){
if( command == saveThresholdCmd ){
LXeEvent->SetSaveThreshold(saveThresholdCmd->GetNewIntValue(newValue));
}
else if( command == verboseCmd ){
LXeEvent->SetEventVerbose(verboseCmd->GetNewIntValue(newValue));
}
else if( command == pmtThresholdCmd ){
LXeEvent->SetPMTThreshold(pmtThresholdCmd->GetNewIntValue(newValue));
}
else if(command == forceDrawPhotonsCmd){
LXeEvent->SetForceDrawPhotons(forceDrawPhotonsCmd
->GetNewBoolValue(newValue));
}
else if(command == forceDrawNoPhotonsCmd){
LXeEvent->SetForceDrawNoPhotons(forceDrawNoPhotonsCmd
->GetNewBoolValue(newValue));
G4cout<<"TEST"<<G4endl;
}
}
@@ -0,0 +1,69 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeGeneralPhysics.hh"
#include "globals.hh"
#include "G4ios.hh"
#include <iomanip>
LXeGeneralPhysics::LXeGeneralPhysics(const G4String& name)
: G4VPhysicsConstructor(name)
{
}
LXeGeneralPhysics::~LXeGeneralPhysics()
{
}
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
// Bosons
#include "G4ChargedGeantino.hh"
#include "G4Geantino.hh"
void LXeGeneralPhysics::ConstructParticle()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
}
void LXeGeneralPhysics::ConstructProcess()
{
fDecayProcess = new G4Decay();
// Add Decay Process
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (fDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(fDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(fDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(fDecayProcess, idxAtRest);
}
}
}
@@ -0,0 +1,283 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeMainVolume.hh"
#include "globals.hh"
#include "G4SDManager.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4LogicalBorderSurface.hh"
#include "LXePMTSD.hh"
#include "LXeScintSD.hh"
LXeScintSD* LXeMainVolume::scint_SD;
LXePMTSD* LXeMainVolume::pmt_SD;
G4LogicalVolume* LXeMainVolume::housing_log=NULL;
LXeMainVolume::LXeMainVolume(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo,
LXeDetectorConstruction* c)
//Pass info to the G4PVPlacement constructor
:G4PVPlacement(pRot,tlate,
//Temp logical volume must be created here
new G4LogicalVolume(new G4Box("temp",1,1,1),
G4Material::GetMaterial("Vacuum"),
"temp",0,0,0),
"housing",pMotherLogical,pMany,pCopyNo),constructor(c)
{
CopyValues();
if(!housing_log || updated){
G4double housing_x=scint_x+d_mtl;
G4double housing_y=scint_y+d_mtl;
G4double housing_z=scint_z+d_mtl;
//*************************** housing and scintillator
scint_box = new G4Box("scint_box",scint_x/2.,scint_y/2.,scint_z/2.);
housing_box = new G4Box("housing_box",housing_x/2.,housing_y/2.,
housing_z/2.);
scint_log = new G4LogicalVolume(scint_box,G4Material::GetMaterial("LXe"),
"scint_log",0,0,0);
housing_log = new G4LogicalVolume(housing_box,
G4Material::GetMaterial("Al"),
"housing_log",0,0,0);
scint_phys = new G4PVPlacement(0,G4ThreeVector(),scint_log,"scintillator",
housing_log,false,0);
//*************** Miscellaneous sphere to demonstrate skin surfaces
sphere = new G4Sphere("sphere",0.*mm,2.*cm,0.*deg,360.*deg,0.*deg,
360.*deg);
sphere_log = new G4LogicalVolume(sphere,G4Material::GetMaterial("Al"),
"sphere_log");
if(sphereOn)
sphere_phys = new G4PVPlacement(0,G4ThreeVector(5.*cm,5.*cm,5.*cm),
sphere_log,"sphere",scint_log,false,0);
//****************** Build PMTs
G4double innerRadius_pmt = 0.*cm;
G4double height_pmt = d_mtl/2.;
G4double startAngle_pmt = 0.*deg;
G4double spanningAngle_pmt = 360.*deg;
pmt = new G4Tubs("pmt_tube",innerRadius_pmt,outerRadius_pmt,
height_pmt,startAngle_pmt,spanningAngle_pmt);
//the "photocathode" is a metal slab at the back of the glass that
//is only a very rough approximation of the real thing since it only
//absorbs or detects the photons based on the efficiency set below
photocath = new G4Tubs("photocath_tube",innerRadius_pmt,outerRadius_pmt,
height_pmt/2,startAngle_pmt,spanningAngle_pmt);
pmt_log = new G4LogicalVolume(pmt,G4Material::GetMaterial("Glass"),
"pmt_log");
photocath_log = new G4LogicalVolume(photocath,
G4Material::GetMaterial("Al"),
"photocath_log");
photocath_phys = new G4PVPlacement(0,G4ThreeVector(0,0,-height_pmt/2),
photocath_log,"photocath",
pmt_log,false,0);
//***********Arrange pmts around the outside of housing**********
//---pmt sensitive detector
G4SDManager* SDman = G4SDManager::GetSDMpointer();
if(!pmt_SD){
pmt_SD = new LXePMTSD("/LXeDet/pmtSD");
SDman->AddNewDetector(pmt_SD);
//Created here so it exists as pmts are being placed
}
pmt_SD->InitPMTs((nx*ny+nx*nz+ny*nz)*2); //let pmtSD know # of pmts
//-------
G4double dx = scint_x/nx;
G4double dy = scint_y/ny;
G4double dz = scint_z/nz;
G4double x,y,z;
G4double xmin = -scint_x/2. - dx/2.;
G4double ymin = -scint_y/2. - dy/2.;
G4double zmin = -scint_z/2. - dz/2.;
G4int k=0;
z = -scint_z/2. - height_pmt; //front
PlacePMTs(pmt_log,0,x,y,dx,dy,xmin,ymin,nx,ny,x,y,z,k,pmt_SD);
G4RotationMatrix* rm_z = new G4RotationMatrix();
rm_z->rotateY(180*deg);
z = scint_z/2. + height_pmt; //back
PlacePMTs(pmt_log,rm_z,x,y,dx,dy,xmin,ymin,nx,ny,x,y,z,k,pmt_SD);
G4RotationMatrix* rm_y1 = new G4RotationMatrix();
rm_y1->rotateY(-90*deg);
x = -scint_x/2. - height_pmt; //left
PlacePMTs(pmt_log,rm_y1,y,z,dy,dz,ymin,zmin,ny,nz,x,y,z,k,pmt_SD);
G4RotationMatrix* rm_y2 = new G4RotationMatrix();
rm_y2->rotateY(90*deg);
x = scint_x/2. + height_pmt; //right
PlacePMTs(pmt_log,rm_y2,y,z,dy,dz,ymin,zmin,ny,nz,x,y,z,k,pmt_SD);
G4RotationMatrix* rm_x1 = new G4RotationMatrix();
rm_x1->rotateX(90*deg);
y = -scint_y/2. - height_pmt; //bottom
PlacePMTs(pmt_log,rm_x1,x,z,dx,dz,xmin,zmin,nx,nz,x,y,z,k,pmt_SD);
G4RotationMatrix* rm_x2 = new G4RotationMatrix();
rm_x2->rotateX(-90*deg);
y = scint_y/2. + height_pmt; //top
PlacePMTs(pmt_log,rm_x2,x,z,dx,dz,xmin,zmin,nx,nz,x,y,z,k,pmt_SD);
//**********Setup Sensitive Detectors***************
if(!scint_SD){//determine if it has already been created
scint_SD = new LXeScintSD("/LXeDet/scintSD");
SDman->AddNewDetector(scint_SD);
}
scint_log->SetSensitiveDetector(scint_SD);
//sensitive detector is not actually on the photocathode.
//processHits gets done manually by the stepping action.
//It is used to detect when photons hit and get absorbed&detected at the
//boundary to the photocathode (which doesnt get done by attaching it to a
//logical volume.
//It does however need to be attached to something or else it doesnt get
//reset at the begining of events
photocath_log->SetSensitiveDetector(pmt_SD);
VisAttributes();
SurfaceProperties();
}
SetLogicalVolume(housing_log);
}
void LXeMainVolume::CopyValues(){
updated=constructor->GetUpdated();
scint_x=constructor->GetScintX();
scint_y=constructor->GetScintY();
scint_z=constructor->GetScintZ();
d_mtl=constructor->GetHousingThickness();
nx=constructor->GetNX();
ny=constructor->GetNY();
nz=constructor->GetNZ();
outerRadius_pmt=constructor->GetPMTRadius();
sphereOn=constructor->GetSphereOn();
refl=constructor->GetHousingReflectivity();
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeMainVolume::PlacePMTs(G4LogicalVolume* pmt_log,
G4RotationMatrix *rot,
G4double &a, G4double &b, G4double da,
G4double db, G4double amin,
G4double bmin, G4int na, G4int nb,
G4double &x, G4double &y, G4double &z,
G4int &k,LXePMTSD* sd){
/*PlacePMTs : a different way to parameterize placement that does not depend on
calculating the position from the copy number
pmt_log = logical volume for pmts to be placed
rot = rotation matrix to apply
a,b = coordinates to vary(ie. if varying in the xy plane then pass x,y)
da,db = value to increment a,b by
amin,bmin = start values for a,b
na,nb = number of repitions in a and b
x,y,z = just pass x,y, and z by reference (the same ones passed for a,b)
k = copy number to start with
sd = sensitive detector for pmts
*/
a=amin;
for(G4int j=1;j<=na;j++){
a+=da;
b=bmin;
for(G4int i=1;i<=nb;i++){
b+=db;
new G4PVPlacement(rot,G4ThreeVector(x,y,z),pmt_log,"pmt",
housing_log,false,k);
sd->SetPMTPos(k,x,y,z);
k++;
}
}
}
void LXeMainVolume::VisAttributes(){
G4VisAttributes* housing_va = new G4VisAttributes(G4Colour(0.8,0.8,0.8));
housing_log->SetVisAttributes(housing_va);
G4VisAttributes* sphere_va = new G4VisAttributes();
sphere_va->SetForceSolid(true);
sphere_log->SetVisAttributes(sphere_va);
}
void LXeMainVolume::SurfaceProperties(){
const G4int num = 2;
G4double Ephoton[num] = {7.0*eV, 7.14*eV};
//**Scintillator housing properties
G4double Reflectivity[num] = {refl, refl};
G4double Efficiency[num] = {0.0, 0.0};
G4MaterialPropertiesTable* scintHsngPT = new G4MaterialPropertiesTable();
scintHsngPT->AddProperty("REFLECTIVITY", Ephoton, Reflectivity, num);
scintHsngPT->AddProperty("EFFICIENCY", Ephoton, Efficiency, num);
G4OpticalSurface* OpScintHousingSurface =
new G4OpticalSurface("HousingSurface",unified,polished,dielectric_metal);
OpScintHousingSurface->SetMaterialPropertiesTable(scintHsngPT);
//**Sphere surface properties
G4double SphereReflectivity[num] = {1.0, 1.0};
G4double SphereEfficiency[num] = {0.0, 0.0};
G4MaterialPropertiesTable* spherePT = new G4MaterialPropertiesTable();
spherePT->AddProperty("REFLECTIVITY", Ephoton, SphereReflectivity, num);
spherePT->AddProperty("EFFICIENCY", Ephoton, SphereEfficiency, num);
G4OpticalSurface* OpSphereSurface =
new G4OpticalSurface("SphereSurface",unified,polished,dielectric_metal);
OpSphereSurface->SetMaterialPropertiesTable(spherePT);
//**Photocathode surface properties
G4double photocath_EFF[num]={1.,1.}; //Enables 'detection' of photons
G4double photocath_REFL[num]={0.,0.};
G4MaterialPropertiesTable* photocath_mt = new G4MaterialPropertiesTable();
photocath_mt->AddProperty("EFFICIENCY",Ephoton,photocath_EFF,num);
photocath_mt->AddProperty("REFLECTIVITY",Ephoton,photocath_REFL,num);
G4OpticalSurface* photocath_opsurf=
new G4OpticalSurface("photocath_opsurf",glisur,polished,
dielectric_metal);
photocath_opsurf->SetMaterialPropertiesTable(photocath_mt);
//**Create logical skin surfaces
new G4LogicalSkinSurface("photocath_surf",housing_log,
OpScintHousingSurface);
new G4LogicalSkinSurface("sphere_surface",sphere_log,OpSphereSurface);
new G4LogicalSkinSurface("photocath_surf",photocath_log,photocath_opsurf);
}
@@ -0,0 +1,96 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeMuonPhysics.hh"
#include "globals.hh"
#include "G4ios.hh"
#include <iomanip>
LXeMuonPhysics::LXeMuonPhysics(const G4String& name)
: G4VPhysicsConstructor(name)
{
}
LXeMuonPhysics::~LXeMuonPhysics()
{
}
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4MuonPlus.hh"
#include "G4MuonMinus.hh"
#include "G4NeutrinoMu.hh"
#include "G4AntiNeutrinoMu.hh"
void LXeMuonPhysics::ConstructParticle()
{
// Mu
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
#include "G4ProcessManager.hh"
void LXeMuonPhysics::ConstructProcess()
{
fMuPlusIonisation = new G4MuIonisation();
fMuPlusMultipleScattering = new G4MultipleScattering();
fMuPlusBremsstrahlung=new G4MuBremsstrahlung();
fMuPlusPairProduction= new G4MuPairProduction();
fMuMinusIonisation = new G4MuIonisation();
fMuMinusMultipleScattering = new G4MultipleScattering;
fMuMinusBremsstrahlung = new G4MuBremsstrahlung();
fMuMinusPairProduction = new G4MuPairProduction();
fMuMinusCaptureAtRest = new G4MuonMinusCaptureAtRest();
G4ProcessManager * pManager = 0;
// Muon Plus Physics
pManager = G4MuonPlus::MuonPlus()->GetProcessManager();
pManager->AddProcess(fMuPlusMultipleScattering,-1, 1, 1);
pManager->AddProcess(fMuPlusIonisation, -1, 2, 2);
pManager->AddProcess(fMuPlusBremsstrahlung, -1, 3, 3);
pManager->AddProcess(fMuPlusPairProduction, -1, 4, 4);
// Muon Minus Physics
pManager = G4MuonMinus::MuonMinus()->GetProcessManager();
pManager->AddProcess(fMuMinusMultipleScattering,-1, 1, 1);
pManager->AddProcess(fMuMinusIonisation, -1, 2, 2);
pManager->AddProcess(fMuMinusBremsstrahlung, -1, 3, 3);
pManager->AddProcess(fMuMinusPairProduction, -1, 4, 4);
pManager->AddRestProcess(fMuMinusCaptureAtRest);
}
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeOpPhysMessenger.hh"
#include "LXeOpticalPhysics.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4Scintillation.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeOpPhysMessenger::LXeOpPhysMessenger(LXeOpticalPhysics* LXeOpPhys)
:OpPhys(LXeOpPhys)
{
yieldCmd = new G4UIcmdWithADouble("/LXe/detector/scintYieldFactor",this);
yieldCmd->SetGuidance("Sets the yield factor for scintillation in all volumes");
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeOpPhysMessenger::~LXeOpPhysMessenger()
{
delete yieldCmd;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeOpPhysMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if (command == yieldCmd){
OpPhys->SetScintYieldFactor(yieldCmd->GetNewDoubleValue(newValue));
}
}
@@ -0,0 +1,100 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeOpticalPhysics.hh"
#include "LXeOpPhysMessenger.hh"
#include "globals.hh"
#include "G4ios.hh"
#include <iomanip>
#include "G4OpAbsorption.hh"
#include "G4OpRayleigh.hh"
#include "G4OpBoundaryProcess.hh"
#include "G4OpWLS.hh"
LXeOpticalPhysics::LXeOpticalPhysics(const G4String& name)
: G4VPhysicsConstructor(name)
{
// new LXeOpPhysMessenger(this);
}
LXeOpticalPhysics::~LXeOpticalPhysics()
{
}
#include "G4ParticleDefinition.hh"
#include "G4ParticleTable.hh"
#include "G4OpticalPhoton.hh"
void LXeOpticalPhysics::ConstructParticle()
{
G4OpticalPhoton::OpticalPhotonDefinition();
}
#include "G4ProcessManager.hh"
void LXeOpticalPhysics::ConstructProcess()
{
theScintProcess = new G4Scintillation();
theCerenkovProcess=new G4Cerenkov();
theAbsorptionProcess=new G4OpAbsorption();
theRayleighScattering=new G4OpRayleigh();
theBoundaryProcess=new G4OpBoundaryProcess();
theWLSProcess=new G4OpWLS();
G4ProcessManager * pManager = 0;
pManager = G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
pManager->AddDiscreteProcess(theAbsorptionProcess);
pManager->AddDiscreteProcess(theRayleighScattering);
theBoundaryProcess->SetModel(unified);
pManager->AddDiscreteProcess(theBoundaryProcess);
pManager->AddDiscreteProcess(theWLSProcess);
theScintProcess->SetScintillationYieldFactor(1.);
theScintProcess->SetScintillationExcitationRatio(0.0);
theScintProcess->SetTrackSecondariesFirst(true);
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
pManager = particle->GetProcessManager();
if(theCerenkovProcess->IsApplicable(*particle)){
pManager->AddContinuousProcess(theCerenkovProcess);
}
if(theScintProcess->IsApplicable(*particle)){
pManager->AddProcess(theScintProcess);
pManager->SetProcessOrderingToLast(theScintProcess,idxAtRest);
pManager->SetProcessOrderingToLast(theScintProcess,idxPostStep);
}
}
}
void LXeOpticalPhysics::SetScintYieldFactor(G4double yf){
if(theScintProcess)
theScintProcess->SetScintillationYieldFactor(yf);
}
@@ -0,0 +1,94 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXePMTHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
G4Allocator<LXePMTHit> LXePMTHitAllocator;
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXePMTHit::LXePMTHit()
:pmtNumber(-1),photons(0),physVol(0),drawit(false)
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXePMTHit::~LXePMTHit()
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXePMTHit::LXePMTHit(const LXePMTHit &right)
: G4VHit()
{
pmtNumber=right.pmtNumber;
photons=right.photons;
physVol=right.physVol;
drawit=right.drawit;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
const LXePMTHit& LXePMTHit::operator=(const LXePMTHit &right){
pmtNumber = right.pmtNumber;
photons=right.photons;
physVol=right.physVol;
drawit=right.drawit;
return *this;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
G4int LXePMTHit::operator==(const LXePMTHit &right) const{
return (pmtNumber==right.pmtNumber);
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXePMTHit::Draw(){
if(drawit&&physVol){ //ReDraw only the PMTs that have hit counts > 0
//Also need a physical volume to be able to draw anything
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager){//Make sure that the VisManager exists
G4VisAttributes attribs(G4Colour(1.,0.,0.));
attribs.SetForceSolid(true);
G4RotationMatrix rot;
if(physVol->GetRotation())//If a rotation is defined use it
rot=*(physVol->GetRotation());
G4Transform3D trans(rot,physVol->GetTranslation());//Create transform
pVVisManager->Draw(*physVol,attribs,trans);//Draw it
}
}
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXePMTHit::Print(){
}
@@ -0,0 +1,138 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXePMTSD.hh"
#include "LXePMTHit.hh"
#include "LXeDetectorConstruction.hh"
#include "LXeUserTrackInformation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4ios.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleDefinition.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXePMTSD::LXePMTSD(G4String name)
:G4VSensitiveDetector(name),pmtHitCollection(0),pmtPositionsX(0)
,pmtPositionsY(0),pmtPositionsZ(0)
{
collectionName.insert("pmtHitCollection");
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXePMTSD::~LXePMTSD()
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXePMTSD::Initialize(G4HCofThisEvent* HCE){
pmtHitCollection = new LXePMTHitsCollection
(SensitiveDetectorName,collectionName[0]);
//Store collection with event and keep ID
static G4int HCID = -1;
if(HCID<0){
HCID = GetCollectionID(0);
}
HCE->AddHitsCollection( HCID, pmtHitCollection );
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
G4bool LXePMTSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist){
return ProcessHits_constStep(aStep,ROhist);
}
//Generates a hit and uses the postStepPoint's mother volume replica number
//PostStepPoint because the hit is generated manually when the photon is
//absorbed by the photocathode
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
G4bool LXePMTSD::ProcessHits_constStep(const G4Step* aStep,
G4TouchableHistory* ROhist){
//need to know if this is an optical photon
if(aStep->GetTrack()->GetDefinition()
!= G4OpticalPhoton::OpticalPhotonDefinition()) return false;
//User replica number 1 since photocathode is a daughter volume
//to the pmt which was replicated
G4int pmtNumber=
aStep->GetPostStepPoint()->GetTouchable()->GetReplicaNumber(1);
G4VPhysicalVolume* physVol=
aStep->GetPostStepPoint()->GetTouchable()->GetVolume(1);
//Find the correct hit collection
G4int n=pmtHitCollection->entries();
LXePMTHit* hit=NULL;
for(G4int i=0;i<n;i++){
if((*pmtHitCollection)[i]->GetPMTNumber()==pmtNumber){
hit=(*pmtHitCollection)[i];
break;
}
}
if(hit==NULL){//this pmt wasnt previously hit in this event
hit = new LXePMTHit(); //so create new hit
hit->SetPMTNumber(pmtNumber);
hit->SetPMTPhysVol(physVol);
pmtHitCollection->insert(hit);
hit->SetPMTPos((*pmtPositionsX)[pmtNumber],(*pmtPositionsY)[pmtNumber],
(*pmtPositionsZ)[pmtNumber]);
}
hit->IncPhotonCount(); //increment hit for the selected pmt
if(!LXeDetectorConstruction::GetSphereOn()){
hit->SetDrawit(true);
//If the sphere is disabled then this hit is automaticaly drawn
}
else{//sphere enabled
LXeUserTrackInformation* trackInfo=
(LXeUserTrackInformation*)aStep->GetTrack()->GetUserInformation();
if(trackInfo->GetTrackStatus()&hitSphere)
//only draw this hit if the photon has hit the sphere first
hit->SetDrawit(true);
}
return true;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXePMTSD::EndOfEvent(G4HCofThisEvent* HCE){
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXePMTSD::clear(){
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXePMTSD::DrawAll(){
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXePMTSD::PrintAll(){
}
@@ -0,0 +1,74 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXePhysicsList.hh"
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include <iomanip>
#include "LXeGeneralPhysics.hh"
#include "LXeEMPhysics.hh"
#include "LXeMuonPhysics.hh"
#include "LXeOpticalPhysics.hh"
LXePhysicsList::LXePhysicsList(): G4VModularPhysicsList()
{
// default cut value (1.0mm)
defaultCutValue = 1.0*mm;
// SetVerboseLevel(1);
// General Physics
RegisterPhysics( new LXeGeneralPhysics("general") );
// EM Physics
RegisterPhysics( new LXeEMPhysics("standard EM"));
// Muon Physics
RegisterPhysics( new LXeMuonPhysics("muon"));
// Optical Physics
RegisterPhysics( new LXeOpticalPhysics("optical"));
}
LXePhysicsList::~LXePhysicsList()
{
}
void LXePhysicsList::SetCuts(){
// " G4VUserPhysicsList::SetCutsWithDefault" method sets
// the default cut value for all particle types
SetCutsWithDefault();
}
@@ -0,0 +1,57 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXePrimaryGeneratorAction.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "globals.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXePrimaryGeneratorAction::LXePrimaryGeneratorAction(){
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
particleGun->SetParticleDefinition(particleTable->
FindParticle(particleName="gamma"));
//Default energy,position,momentum
particleGun->SetParticleEnergy(511.*keV);
particleGun->SetParticlePosition(G4ThreeVector(0.0 , 0.0, -20.0*cm));
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXePrimaryGeneratorAction::~LXePrimaryGeneratorAction(){
delete particleGun;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXePrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent){
particleGun->GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,43 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeRunAction.hh"
#include "RecorderBase.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeRunAction::LXeRunAction(RecorderBase* r)
:recorder(r)
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeRunAction::~LXeRunAction()
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeRunAction::BeginOfRunAction(const G4Run* aRun){
if(recorder)recorder->RecordBeginOfRun(aRun);
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeRunAction::EndOfRunAction(const G4Run* aRun){
if(recorder)recorder->RecordEndOfRun(aRun);
}
@@ -0,0 +1,85 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeScintHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
G4Allocator<LXeScintHit> LXeScintHitAllocator;
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeScintHit::LXeScintHit()
:physVol(0)
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeScintHit::LXeScintHit(G4VPhysicalVolume* pVol)
:physVol(pVol)
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeScintHit::~LXeScintHit()
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeScintHit::LXeScintHit(const LXeScintHit &right)
: G4VHit()
{
edep = right.edep;
pos = right.pos;
physVol = right.physVol;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
const LXeScintHit& LXeScintHit::operator=(const LXeScintHit &right){
edep = right.edep;
pos = right.pos;
physVol = right.physVol;
return *this;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
G4int LXeScintHit::operator==(const LXeScintHit &right) const{
return false;
//returns false because there currently isnt need to check for equality yet
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeScintHit::Draw(){
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeScintHit::Print(){
}
@@ -0,0 +1,99 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeScintSD.hh"
#include "LXeScintHit.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4ios.hh"
#include "G4VProcess.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeScintSD::LXeScintSD(G4String name)
:G4VSensitiveDetector(name)
{
collectionName.insert("scintCollection");
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeScintSD::~LXeScintSD()
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeScintSD::Initialize(G4HCofThisEvent* HCE){
scintCollection = new LXeScintHitsCollection
(SensitiveDetectorName,collectionName[0]);
//A way to keep all the hits of this event in one place if needed
static G4int HCID = -1;
if(HCID<0){
HCID = GetCollectionID(0);
}
HCE->AddHitsCollection( HCID, scintCollection );
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
G4bool LXeScintSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist){
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return false; //No edep so dont count as hit
G4StepPoint* thePrePoint = aStep->GetPreStepPoint();
G4TouchableHistory* theTouchable =
(G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
G4VPhysicalVolume* thePrePV = theTouchable->GetVolume();
G4StepPoint* thePostPoint = aStep->GetPostStepPoint();
//Get the average position of the hit
G4ThreeVector pos = thePrePoint->GetPosition() + thePostPoint->GetPosition();
pos/=2.;
LXeScintHit* scintHit = new LXeScintHit(thePrePV);
scintHit->SetEdep(edep);
scintHit->SetPos(pos);
scintCollection->insert(scintHit);
return true;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeScintSD::EndOfEvent(G4HCofThisEvent* HCE){
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeScintSD::clear(){
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeScintSD::DrawAll(){
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeScintSD::PrintAll(){
}
@@ -0,0 +1,81 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeStackingAction.hh"
#include "LXeUserEventInformation.hh"
#include "LXeSteppingAction.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4Track.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeStackingAction::LXeStackingAction()
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeStackingAction::~LXeStackingAction()
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
G4ClassificationOfNewTrack
LXeStackingAction::ClassifyNewTrack(const G4Track * aTrack){
LXeUserEventInformation* eventInformation=
(LXeUserEventInformation*)G4EventManager::GetEventManager()
->GetConstCurrentEvent()->GetUserInformation();
//Count what process generated the optical photons
if(aTrack->GetDefinition()==G4OpticalPhoton::OpticalPhotonDefinition()){
// particle is optical photon
if(aTrack->GetParentID()>0){
// particle is secondary
if(aTrack->GetCreatorProcess()->GetProcessName()=="Scintillation")
eventInformation->IncPhotonCount_Scint();
else if(aTrack->GetCreatorProcess()->GetProcessName()=="Cerenkov")
eventInformation->IncPhotonCount_Ceren();
}
}
else{
}
return fUrgent;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeStackingAction::NewStage(){
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeStackingAction::PrepareNewEvent(){
}
@@ -0,0 +1,201 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeSteppingAction.hh"
#include "LXeEventAction.hh"
#include "LXeTrackingAction.hh"
#include "LXeTrajectory.hh"
#include "LXePMTSD.hh"
#include "LXeUserTrackInformation.hh"
#include "LXeUserEventInformation.hh"
#include "LXeSteppingMessenger.hh"
#include "RecorderBase.hh"
#include "G4SteppingManager.hh"
#include "G4SDManager.hh"
#include "G4EventManager.hh"
#include "G4ProcessManager.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4Event.hh"
#include "G4StepPoint.hh"
#include "G4TrackStatus.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4OpBoundaryProcess.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeSteppingAction::LXeSteppingAction(RecorderBase* r)
:recorder(r),oneStepPrimaries(false)
{
steppingMessenger = new LXeSteppingMessenger(this);
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeSteppingAction::~LXeSteppingAction()
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeSteppingAction::UserSteppingAction(const G4Step * theStep){
G4Track* theTrack = theStep->GetTrack();
LXeUserTrackInformation* trackInformation
=(LXeUserTrackInformation*)theTrack->GetUserInformation();
LXeUserEventInformation* eventInformation
=(LXeUserEventInformation*)G4EventManager::GetEventManager()
->GetConstCurrentEvent()->GetUserInformation();
G4StepPoint* thePrePoint = theStep->GetPreStepPoint();
G4VPhysicalVolume* thePrePV = thePrePoint->GetPhysicalVolume();
G4StepPoint* thePostPoint = theStep->GetPostStepPoint();
G4VPhysicalVolume* thePostPV = thePostPoint->GetPhysicalVolume();
G4OpBoundaryProcessStatus boundaryStatus=Undefined;
static G4OpBoundaryProcess* boundary=NULL;
//find the boundary process only once
if(!boundary){
G4ProcessManager* pm
= theStep->GetTrack()->GetDefinition()->GetProcessManager();
G4int nprocesses = pm->GetProcessListLength();
G4ProcessVector* pv = pm->GetProcessList();
G4int i;
for( i=0;i<nprocesses;i++){
if((*pv)[i]->GetProcessName()=="OpBoundary"){
boundary = (G4OpBoundaryProcess*)(*pv)[i];
break;
}
}
}
if(theTrack->GetParentID()==0){
//This is a primary track
G4TrackVector* fSecondary=fpSteppingManager->GetfSecondary();
G4int tN2ndariesTot = fpSteppingManager->GetfN2ndariesAtRestDoIt()
+ fpSteppingManager->GetfN2ndariesAlongStepDoIt()
+ fpSteppingManager->GetfN2ndariesPostStepDoIt();
//If we havent already found the conversion position and there were
//secondaries generated, then search for it
if(!eventInformation->IsConvPosSet() && tN2ndariesTot>0 ){
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
const G4VProcess* creator=(*fSecondary)[lp1]->GetCreatorProcess();
if(creator){
G4String creatorName=creator->GetProcessName();
if(creatorName=="phot"||creatorName=="compt"||creatorName=="conv"){
//since this is happening before the secondary is being tracked
//the Vertex position has not been set yet(set in initial step)
eventInformation->SetConvPos((*fSecondary)[lp1]->GetPosition());
}
}
}
}
if(oneStepPrimaries&&thePrePV->GetName()=="scintillator")
theTrack->SetTrackStatus(fStopAndKill);
}
if(!thePostPV){//out of world
return;
}
G4ParticleDefinition* particleType = theTrack->GetDefinition();
if(particleType==G4OpticalPhoton::OpticalPhotonDefinition()){
//Optical photon only
if(thePrePV->GetName()=="Slab")
//force drawing of photons in WLS slab
trackInformation->SetForceDrawTrajectory(true);
else if(thePostPV->GetName()=="expHall")
//Kill photons entering expHall from something other than Slab
theTrack->SetTrackStatus(fStopAndKill);
//Was the photon absorbed by the absorption process
if(thePostPoint->GetProcessDefinedStep()->GetProcessName()
=="OpAbsorption"){
eventInformation->IncAbsorption();
trackInformation->AddTrackStatusFlag(absorbed);
}
boundaryStatus=boundary->GetStatus();
//Check to see if the partcile was actually at a boundary
//Otherwise the boundary status may not be valid
//Prior to Geant4.6.0-p1 this would not have been enough to check
if(thePostPoint->GetStepStatus()==fGeomBoundary){
switch(boundaryStatus){
case Absorption:
trackInformation->AddTrackStatusFlag(boundaryAbsorbed);
eventInformation->IncBoundaryAbsorption();
break;
case Detection: //Note, this assumes that the volume causing detection
//is the photocathode because it is the only one with
//non-zero efficiency
{
//Triger sensitive detector manually since photon is
//absorbed but status was Detection
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String sdName="/LXeDet/pmtSD";
LXePMTSD* pmtSD = (LXePMTSD*)SDman
->FindSensitiveDetector(sdName);
if(pmtSD)
pmtSD->ProcessHits_constStep(theStep,NULL);
trackInformation->AddTrackStatusFlag(hitPMT);
break;
}
case FresnelReflection:
case TotalInternalReflection:
case SpikeReflection:
trackInformation->IncReflections();
break;
default:
break;
}
if(thePostPV->GetName()=="sphere")
trackInformation->AddTrackStatusFlag(hitSphere);
}
}
if(recorder)recorder->RecordStep(theStep);
}
@@ -0,0 +1,51 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeSteppingMessenger.hh"
#include "LXeSteppingAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeSteppingMessenger::LXeSteppingMessenger(LXeSteppingAction* step)
:stepping(step)
{
oneStepPrimariesCmd = new G4UIcmdWithABool("/LXe/oneStepPrimaries",this);
oneStepPrimariesCmd->SetGuidance("Only allows primaries to go one step in the scintillator volume before being killed.");
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeSteppingMessenger::~LXeSteppingMessenger(){
delete oneStepPrimariesCmd;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void
LXeSteppingMessenger::SetNewValue(G4UIcommand* command,G4String newValue){
if( command == oneStepPrimariesCmd ){
stepping->SetOneStepPrimaries(oneStepPrimariesCmd
->GetNewBoolValue(newValue));
}
}
@@ -0,0 +1,217 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeSteppingVerbose.hh"
#include "G4SteppingManager.hh"
#include "G4UnitsTable.hh"
#include<strstream>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeSteppingVerbose::LXeSteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeSteppingVerbose::~LXeSteppingVerbose()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeSteppingVerbose::StepInfo()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel >= 1 ){
G4int lengthLen=+G4UnitDefinition::GetUnitsTable()[G4BestUnit(0,"Length").GetIndexOfCategory()]->GetSymbMxLen();
G4int energyLen=+G4UnitDefinition::GetUnitsTable()[G4BestUnit(0,"Energy").GetIndexOfCategory()]->GetSymbMxLen();
if( verboseLevel >= 4 ) VerboseTrack();
if( verboseLevel >= 3 ){
G4cout << G4endl;
G4cout << std::setw( 5) << "Step#"
<< std::setw( 6) << "X" << std::setw(lengthLen+1)<<" "
<< std::setw( 6) << "Y" << std::setw(lengthLen+1)<<" "
<< std::setw( 6) << "Z" << std::setw(lengthLen+1)<<" "
<< std::setw( 7) << "KineE" << std::setw(energyLen+1)<<" "
<< std::setw( 7) << "dEStep"<< std::setw(energyLen+1)<<" "
<< std::setw(10) << "StepLeng"<< std::setw(lengthLen+1)<<" "
<< std::setw(10) << "TrakLeng"<< std::setw(lengthLen+1)<<" "
<< std::setw(10) << "Volume"
<< std::setw(10) << "Process" << G4endl;
}
//This is a less clean way of outputing the data than normal but it
//produces nicer colums since G4BestUnit doesnt cooperate too well with
//field widths.
G4cout << std::setw(5) << fTrack->GetCurrentStepNumber();
strstream out;
out.precision(3);
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fTrack->GetPosition().x(),"Length")<<'\0';
G4cout<<std::setw(7+lengthLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fTrack->GetPosition().y(),"Length")<<'\0';
G4cout<<std::setw(7+lengthLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fTrack->GetPosition().z(),"Length")<<'\0';
G4cout<<std::setw(7+lengthLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fTrack->GetKineticEnergy(),"Energy")<<'\0';
G4cout<<std::setw(7+energyLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")<<'\0';
G4cout<<std::setw(7+energyLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fStep->GetStepLength(),"Length")<<'\0';
G4cout<<std::setw(10+lengthLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fTrack->GetTrackLength(),"Length")<<'\0';
G4cout<<std::setw(10+lengthLen)<<out.str();
// if( fStepStatus != fWorldBoundary){
if( fTrack->GetNextVolume() != 0 ) {
G4cout << " "<<fTrack->GetVolume()->GetName();
} else {
G4cout << " OutOfWorld";
}
if(fStep->GetPostStepPoint()->GetProcessDefinedStep() != 0){
G4cout << " "
<< std::setw(10)
<< fStep->GetPostStepPoint()->GetProcessDefinedStep()
->GetProcessName();
} else {
G4cout << " UserLimit";
}
G4cout << G4endl;
if( verboseLevel == 2 ){
G4int tN2ndariesTot = fN2ndariesAtRestDoIt +
fN2ndariesAlongStepDoIt +
fN2ndariesPostStepDoIt;
if(tN2ndariesTot>0){
G4cout << " :----- List of 2ndaries - "
<< "#SpawnInStep=" << std::setw(3) << tN2ndariesTot
<< "(Rest=" << std::setw(2) << fN2ndariesAtRestDoIt
<< ",Along=" << std::setw(2) << fN2ndariesAlongStepDoIt
<< ",Post=" << std::setw(2) << fN2ndariesPostStepDoIt
<< "), "
<< "#SpawnTotal=" << std::setw(3) << (*fSecondary).size()
<< " ---------------"
<< G4endl;
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
G4cout << " : "
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().x(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().y(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetPosition().z(),"Length")
<< std::setw(6)
<< G4BestUnit((*fSecondary)[lp1]->GetKineticEnergy(),"Energy")
<< std::setw(10)
<< (*fSecondary)[lp1]->GetDefinition()->GetParticleName();
G4cout << G4endl;
}
G4cout << " :-----------------------------"
<< "----------------------------------"
<< "-- EndOf2ndaries Info ---------------"
<< G4endl;
}
}
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeSteppingVerbose::TrackingStarted()
{
CopyState();
G4int prec = G4cout.precision(3);
if( verboseLevel > 0 ){
G4int lengthLen=+G4UnitDefinition::GetUnitsTable()[G4BestUnit(0,"Length").GetIndexOfCategory()]->GetSymbMxLen();
G4int energyLen=+G4UnitDefinition::GetUnitsTable()[G4BestUnit(0,"Energy").GetIndexOfCategory()]->GetSymbMxLen();
G4cout << std::setw( 5) << "Step#"
<< std::setw( 6) << "X" << std::setw(lengthLen+1)<<" "
<< std::setw( 6) << "Y" << std::setw(lengthLen+1)<<" "
<< std::setw( 6) << "Z" << std::setw(lengthLen+1)<<" "
<< std::setw( 7) << "KineE" << std::setw(energyLen+1)<<" "
<< std::setw( 7) << "dEStep"<< std::setw(energyLen+1)<<" "
<< std::setw(10) << "StepLeng"<< std::setw(lengthLen+1)<<" "
<< std::setw(10) << "TrakLeng"<< std::setw(lengthLen+1)<<" "
<< std::setw(10) << "Volume"
<< std::setw(10) << "Process" << G4endl;
//This is a less clean way of outputing the data than normal but it
//produces nicer colums since G4BestUnit doesnt cooperate too well with
//field widths.
G4cout << std::setw( 5) << fTrack->GetCurrentStepNumber();
strstream out;
out.precision(3);
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fTrack->GetPosition().x(),"Length")<<'\0';
G4cout<<std::setw(7+lengthLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fTrack->GetPosition().y(),"Length")<<'\0';
G4cout<<std::setw(7+lengthLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fTrack->GetPosition().z(),"Length")<<'\0';
G4cout<<std::setw(7+lengthLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fTrack->GetKineticEnergy(),"Energy")<<'\0';
G4cout<<std::setw(7+energyLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fStep->GetTotalEnergyDeposit(),"Energy")<<'\0';
G4cout<<std::setw(7+energyLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fStep->GetStepLength(),"Length")<<'\0';
G4cout<<std::setw(10+lengthLen)<<out.str();
out.rdbuf()->seekpos(0);
out<<G4BestUnit(fTrack->GetTrackLength(),"Length")<<'\0';
G4cout<<std::setw(10+lengthLen)<<out.str();
if(fTrack->GetNextVolume()){
G4cout << " "<< fTrack->GetVolume()->GetName();
} else {
G4cout << std::setw(11+lengthLen)<< "OutOfWorld";
}
G4cout << " initStep" << G4endl;
}
G4cout.precision(prec);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -0,0 +1,105 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeTrajectory.hh"
#include "LXeTrackingAction.hh"
#include "LXeUserTrackInformation.hh"
#include "LXeDetectorConstruction.hh"
#include "RecorderBase.hh"
#include "G4TrackingManager.hh"
#include "G4Track.hh"
#include "G4ParticleTypes.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeTrackingAction::LXeTrackingAction(RecorderBase* r)
:recorder(r)
{}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeTrackingAction::PreUserTrackingAction(const G4Track* aTrack)
{
//Let this be up to the user via vis.mac
// fpTrackingManager->SetStoreTrajectory(true);
//Use custom trajectory class
fpTrackingManager->SetTrajectory(new LXeTrajectory(aTrack));
//This user track information is only relevant to the photons
fpTrackingManager->SetUserTrackInformation(new LXeUserTrackInformation);
/* const G4VProcess* creator = aTrack->GetCreatorProcess();
if(creator)
G4cout<<creator->GetProcessName()<<G4endl;
*/
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeTrackingAction::PostUserTrackingAction(const G4Track* aTrack){
LXeTrajectory* trajectory=(LXeTrajectory*)fpTrackingManager->GimmeTrajectory();
LXeUserTrackInformation*
trackInformation=(LXeUserTrackInformation*)aTrack->GetUserInformation();
//Lets choose to draw only the photons that hit the sphere and a pmt
if(aTrack->GetDefinition()==G4OpticalPhoton::OpticalPhotonDefinition()){
const G4VProcess* creator=aTrack->GetCreatorProcess();
if(creator && creator->GetProcessName()=="OpWLS"){
trajectory->WLS();
trajectory->SetDrawTrajectory(true);
}
if(LXeDetectorConstruction::GetSphereOn()){
if((trackInformation->GetTrackStatus()&hitPMT)&&
(trackInformation->GetTrackStatus()&hitSphere)){
trajectory->SetDrawTrajectory(true);
}
}
else{
if(trackInformation->GetTrackStatus()&hitPMT)
trajectory->SetDrawTrajectory(true);
}
}
else //draw all other trajectories
trajectory->SetDrawTrajectory(true);
if(trackInformation->GetForceDrawTrajectory())
trajectory->SetDrawTrajectory(true);
if(recorder)recorder->RecordTrack(aTrack);
}
@@ -0,0 +1,151 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeTrajectory.hh"
#include "G4TrajectoryPoint.hh"
#include "G4Trajectory.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleTypes.hh"
#include "G4ThreeVector.hh"
#include "G4Polyline.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4VVisManager.hh"
#include "G4Polymarker.hh"
G4Allocator<LXeTrajectory> LXeTrajectoryAllocator;
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeTrajectory::LXeTrajectory()
:G4Trajectory(),wls(false),drawit(false),forceNoDraw(false),forceDraw(false)
{
particleDefinition=0;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeTrajectory::LXeTrajectory(const G4Track* aTrack)
:G4Trajectory(aTrack),wls(false),drawit(false)
{
particleDefinition=aTrack->GetDefinition();
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeTrajectory::LXeTrajectory(LXeTrajectory &right)
:G4Trajectory(right),wls(right.wls),drawit(right.drawit)
{
particleDefinition=right.particleDefinition;
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeTrajectory::~LXeTrajectory()
{
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeTrajectory::DrawTrajectory(G4int i_mode) const{
//Taken from G4VTrajectory and modified to select colours based on particle
//type and to selectively eliminate drawing of certain trajectories.
if(!forceDraw && (!drawit || forceNoDraw))
return;
// If i_mode>=0, draws a trajectory as a polyline and, if i_mode!=0,
// adds markers - yellow circles for step points and magenta squares
// for auxiliary points, if any - whose screen size in pixels is
// given by abs(i_mode)/1000. E.g: i_mode = 5000 gives easily
// visible markers.
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (!pVVisManager) return;
const G4double markerSize = abs(i_mode)/1000;
G4bool lineRequired (i_mode >= 0);
G4bool markersRequired (markerSize > 0.);
G4Polyline trajectoryLine;
G4Polymarker stepPoints;
G4Polymarker auxiliaryPoints;
for (G4int i = 0; i < GetPointEntries() ; i++) {
G4VTrajectoryPoint* aTrajectoryPoint = GetPoint(i);
const std::vector<G4ThreeVector>* auxiliaries
= aTrajectoryPoint->GetAuxiliaryPoints();
if (auxiliaries) {
for (size_t iAux = 0; iAux < auxiliaries->size(); ++iAux) {
const G4ThreeVector pos((*auxiliaries)[iAux]);
if (lineRequired) {
trajectoryLine.push_back(pos);
}
if (markersRequired) {
auxiliaryPoints.push_back(pos);
}
}
}
const G4ThreeVector pos(aTrajectoryPoint->GetPosition());
if (lineRequired) {
trajectoryLine.push_back(pos);
}
if (markersRequired) {
stepPoints.push_back(pos);
}
}
if (lineRequired) {
G4Colour colour;
if(particleDefinition==G4OpticalPhoton::OpticalPhotonDefinition()){
if(wls) //WLS photons are red
colour = G4Colour(1.,0.,0.);
else{ //Scintillation and Cerenkov photons are green
colour = G4Colour(0.,1.,0.);
}
}
else //All other particles are blue
colour = G4Colour(0.,0.,1.);
G4VisAttributes trajectoryLineAttribs(colour);
trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
pVVisManager->Draw(trajectoryLine);
}
if (markersRequired) {
auxiliaryPoints.SetMarkerType(G4Polymarker::squares);
auxiliaryPoints.SetScreenSize(markerSize);
auxiliaryPoints.SetFillStyle(G4VMarker::filled);
G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.)); // Magenta
auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
pVVisManager->Draw(auxiliaryPoints);
stepPoints.SetMarkerType(G4Polymarker::circles);
stepPoints.SetScreenSize(markerSize);
stepPoints.SetFillStyle(G4VMarker::filled);
G4VisAttributes stepPointsAttribs(G4Colour(1.,1.,0.)); // Yellow.
stepPoints.SetVisAttributes(&stepPointsAttribs);
pVVisManager->Draw(stepPoints);
}
}
@@ -0,0 +1,37 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeUserEventInformation.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeUserEventInformation::LXeUserEventInformation()
:hitCount(0),photonCount_Scint(0),photonCount_Ceren(0),absorptionCount(0),
boundaryAbsorptionCount(0),totE(0.),eWeightPos(0.),reconPos(0.),convPos(0.),
convPosSet(false),posMax(0.),pmtsAboveThreshold(0)
{
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeUserEventInformation::~LXeUserEventInformation()
{
}
@@ -0,0 +1,44 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeUserTrackInformation.hh"
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeUserTrackInformation::LXeUserTrackInformation()
:status(active),reflections(0),forcedraw(false)
{
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeUserTrackInformation::~LXeUserTrackInformation()
{
}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeUserTrackInformation::AddTrackStatusFlag(int s)
{
if(s&active) //track is now active
status&=~inactive; //remove any flags indicating it is inactive
else if(s&inactive) //track is now inactive
status&=~active; //remove any flags indicating it is active
status|=s; //add new flags
}
+137
View File
@@ -0,0 +1,137 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#ifdef G4VIS_USE
#include "LXeVisManager.hh"
// Supported drivers...
// Not needing external packages or libraries...
#include "G4ASCIITree.hh"
#include "G4DAWNFILE.hh"
#include "G4GAGTree.hh"
#include "G4HepRepFile.hh"
#include "G4HepRep.hh"
#include "G4RayTracer.hh"
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
// Needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.hh"
#endif
#ifdef G4VIS_USE_OPENGLX
#include "G4OpenGLImmediateX.hh"
#include "G4OpenGLStoredX.hh"
#endif
#ifdef G4VIS_USE_OPENGLWIN32
#include "G4OpenGLImmediateWin32.hh"
#include "G4OpenGLStoredWin32.hh"
#endif
#ifdef G4VIS_USE_OPENGLXM
#include "G4OpenGLImmediateXm.hh"
#include "G4OpenGLStoredXm.hh"
#endif
#ifdef G4VIS_USE_OIX
#include "G4OpenInventorX.hh"
#endif
#ifdef G4VIS_USE_OIWIN32
#include "G4OpenInventorWin32.hh"
#endif
#ifdef G4VIS_USE_VRML
#include "G4VRML1.hh"
#include "G4VRML2.hh"
#endif
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
LXeVisManager::LXeVisManager () {}
//_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_
void LXeVisManager::RegisterGraphicsSystems () {
// Graphics Systems not needing external packages or libraries...
RegisterGraphicsSystem (new G4ASCIITree);
RegisterGraphicsSystem (new G4DAWNFILE);
RegisterGraphicsSystem (new G4GAGTree);
RegisterGraphicsSystem (new G4HepRepFile);
RegisterGraphicsSystem (new G4HepRep);
RegisterGraphicsSystem (new G4RayTracer);
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
// Graphics systems needing external packages or libraries...
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
#ifdef G4VIS_USE_OPENGLX
RegisterGraphicsSystem (new G4OpenGLImmediateX);
RegisterGraphicsSystem (new G4OpenGLStoredX);
#endif
#ifdef G4VIS_USE_OPENGLWIN32
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
#endif
#ifdef G4VIS_USE_OPENGLXM
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
RegisterGraphicsSystem (new G4OpenGLStoredXm);
#endif
#ifdef G4VIS_USE_OIX
RegisterGraphicsSystem (new G4OpenInventorX);
#endif
#ifdef G4VIS_USE_OIWIN32
RegisterGraphicsSystem (new G4OpenInventorWin32);
#endif
#ifdef G4VIS_USE_VRML
RegisterGraphicsSystem (new G4VRML1);
RegisterGraphicsSystem (new G4VRML2);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< G4endl;
PrintAvailableGraphicsSystems ();
}
}
#endif
@@ -0,0 +1,106 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeWLSFiber.hh"
#include "globals.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4LogicalBorderSurface.hh"
G4LogicalVolume* LXeWLSFiber::clad2_log=NULL;
LXeWLSFiber::LXeWLSFiber(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo,
LXeDetectorConstruction* c)
:G4PVPlacement(pRot,tlate,
new G4LogicalVolume(new G4Box("temp",1,1,1),
G4Material::GetMaterial("Vacuum"),
"temp",0,0,0),
"Cladding2",pMotherLogical,pMany,pCopyNo),constructor(c)
{
CopyValues();
if(!clad2_log || updated){
// The Fiber
//
G4Tubs* Fiber_tube =
new G4Tubs("Fiber",fiber_rmin,fiber_rmax,fiber_z,fiber_sphi,fiber_ephi);
G4LogicalVolume* Fiber_log =
new G4LogicalVolume(Fiber_tube,G4Material::GetMaterial("PMMA"),
"Fiber",0,0,0);
// Cladding (first layer)
//
G4Tubs* clad1_tube =
new G4Tubs("Cladding1",clad1_rmin,clad1_rmax,clad1_z,clad1_sphi,
clad1_ephi);
G4LogicalVolume* clad1_log =
new G4LogicalVolume(clad1_tube,G4Material::GetMaterial("Pethylene"),
"Cladding1",0,0,0);
// Cladding (second layer)
//
G4Tubs* clad2_tube =
new G4Tubs("Cladding2",clad2_rmin,clad2_rmax,clad2_z,clad2_sphi,
clad2_ephi);
clad2_log =
new G4LogicalVolume(clad2_tube,G4Material::GetMaterial("fPethylene"),
"Cladding2",0,0,0);
new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),Fiber_log,
"Fiber", clad1_log,false,0);
new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),clad1_log,
"Cladding1",clad2_log,false,0);
}
SetLogicalVolume(clad2_log);
}
void LXeWLSFiber::CopyValues(){
updated=constructor->GetUpdated();
fiber_rmin = 0.00*cm;
fiber_rmax = 0.10*cm;
fiber_z = constructor->GetScintX()/2;
fiber_sphi = 0.00*deg;
fiber_ephi = 360.*deg;
clad1_rmin = 0.;// fiber_rmax;
clad1_rmax = fiber_rmax + 0.015*fiber_rmax;
clad1_z = fiber_z;
clad1_sphi = fiber_sphi;
clad1_ephi = fiber_ephi;
clad2_rmin = 0.;//clad1_rmax;
clad2_rmax = clad1_rmax + 0.015*fiber_rmax;
clad2_z = fiber_z;
clad2_sphi = fiber_sphi;
clad2_ephi = fiber_ephi;
}
@@ -0,0 +1,86 @@
//
// ********************************************************************
// * 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. *
// ********************************************************************
//
#include "LXeWLSSlab.hh"
#include "LXeWLSFiber.hh"
#include "globals.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4LogicalBorderSurface.hh"
G4LogicalVolume* LXeWLSSlab::ScintSlab_log=NULL;
LXeWLSSlab::LXeWLSSlab(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo,
LXeDetectorConstruction* c)
:G4PVPlacement(pRot,tlate,
new G4LogicalVolume(new G4Box("temp",1,1,1),
G4Material::GetMaterial("Vacuum"),
"temp",0,0,0),
"Slab",pMotherLogical,pMany,pCopyNo),constructor(c)
{
CopyValues();
if(!ScintSlab_log || updated){
G4double slab_x = scint_x/2.;
G4double slab_y = scint_y/2.;
G4Box* ScintSlab_box = new G4Box("Slab",slab_x,slab_y,slab_z);
ScintSlab_log
= new G4LogicalVolume(ScintSlab_box,
G4Material::GetMaterial("Polystyrene"),
"Slab",0,0,0);
G4double spacing = 2*slab_y/nfibers;
G4RotationMatrix* rm = new G4RotationMatrix();
rm->rotateY(90*deg);
//Place fibers
for(G4int i=0;i<nfibers;i++){
G4double Y=-(spacing)*(nfibers-1)*0.5 + i*spacing;
new LXeWLSFiber(rm,G4ThreeVector(0.,Y,0.),ScintSlab_log,false,0,
constructor);
}
}
SetLogicalVolume(ScintSlab_log);
}
void LXeWLSSlab::CopyValues(){
updated=constructor->GetUpdated();
scint_x=constructor->GetScintX();
scint_y=constructor->GetScintY();
scint_z=constructor->GetScintZ();
nfibers=constructor->GetNFibers();
slab_z=constructor->GetSlabZ();
}