diff --git a/src/DetectorConstruction.cc b/src/DetectorConstruction.cc index 64ddcb5b150bc9b8eebfeedacbdbfe70f82d4cea..d1c8e246bde9e9fb9c3b31bda418c37a8562a03a 100644 --- a/src/DetectorConstruction.cc +++ b/src/DetectorConstruction.cc @@ -88,8 +88,11 @@ DetectorConstruction::DetectorConstruction() //Set default values + G4double PhotonEnergy[2] = {0.5*eV,8.0*eV}; + G4double RefractiveIndexAir[2] = {1.0,1.0}; m_filler = G4NistManager::Instance()->FindOrBuildMaterial("G4_AIR"); m_GasMPT = new G4MaterialPropertiesTable(); + m_GasMPT->AddProperty("RINDEX", PhotonEnergy, RefractiveIndexAir, 2); m_filler->SetMaterialPropertiesTable(m_GasMPT); #ifdef CADMESH @@ -120,6 +123,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct(){ } else { G4UImanager* UImanager = G4UImanager::GetUIpointer(); UImanager->ApplyCommand("/control/execute geometry.mac"); + BuildPMT(); } if(!m_logicWorld) BuildWorld(); @@ -199,24 +203,11 @@ void DetectorConstruction::BuildWorld(){ * Make the trapezoidal light guide logical volume */ void DetectorConstruction::BuildTrapezoidLG( ){ - if(m_inner) delete m_inner; - if(m_outter) delete m_outter; - if(m_LightGuide) delete m_LightGuide; - if(m_logicLightGuide) delete m_logicLightGuide; - //Divide the light guide envelope (cumulative) by the number //of light guides that will occupy it G4double xSize = (m_LGenvelope->x()/2.)/m_nSegmentsX; G4double zSize = (m_LGenvelope->z()/2.)/m_nSegmentsZ; - std::cout << "envelope z = " << m_LGenvelope->x() << std::endl; - std::cout << "xSize = " << xSize << std::endl; - std::cout << "x segments = " << m_nSegmentsX << std::endl; - - std::cout << "envelope z = " << m_LGenvelope->z() << std::endl; - std::cout << "zSize = " << zSize << std::endl; - std::cout << "z segments = " << m_nSegmentsZ << std::endl; - //Determine the size of the top of the trapezoid so the //square opening will be inscribed in the window of the PMT G4double PMTwindow = .707*m_pmtDia/2.; @@ -250,10 +241,6 @@ void DetectorConstruction::BuildTrapezoidLG( ){ materials->Al, "BasicLightGuide"); - - //Build the PMT to go along with this light guide - BuildPMT(); - } @@ -261,8 +248,6 @@ void DetectorConstruction::BuildTrapezoidLG( ){ * Make the PMT logical volume and Sensitvie Detector */ void DetectorConstruction::BuildPMT(){ - if(m_solidPMT) delete m_solidPMT; - if(m_logicPMT) delete m_logicPMT; G4SDManager* SDman = G4SDManager::GetSDMpointer(); PMTSD* PMT = new PMTSD("MyPMT"); @@ -295,10 +280,6 @@ void DetectorConstruction::PlaceGeometry(){ G4double yPos = m_LGenvelope->y()/2. + m_LGpos->y() - m_worldDim->y()/2.; G4double zPos = 0.; - std::cout << "envelope y = " << m_LGenvelope->y() << std::endl; - std::cout << "yPos = " << yPos << std::endl; - std::cout << "world y = " << m_worldDim->y() << std::endl; - G4double PMTx = 0.; G4double PMTy = m_LGenvelope->y() + m_pmtPos->y() + m_PMTthickness - m_worldDim->y()/2.; G4double PMTz = 0.; @@ -546,8 +527,6 @@ void DetectorConstruction::UseCADModel(G4String fileName){ } - //----------------- Build one PMT -----------------// - BuildPMT(); if(m_pmtPos == 0) m_pmtPos = new G4ThreeVector(); if(m_ConstructionHasBeenDone){ diff --git a/src/DetectorMessenger.cc b/src/DetectorMessenger.cc index 229dcce892a32fd3180f704c3f59444ab54d7dd2..5e72f47cbfff81f4eb31c52f1263e5c872344215 100644 --- a/src/DetectorMessenger.cc +++ b/src/DetectorMessenger.cc @@ -121,6 +121,15 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det) fPMTDiameterCmd->SetDefaultValue( 65.0*mm ); fPMTDiameterCmd->SetDefaultUnit("mm"); + fLGThicknessCmd = + new G4UIcmdWithADoubleAndUnit("/lightGuide/model/SkinThickness",this); + fLGThicknessCmd->SetGuidance("Set thickness of the light guide skin"); + fLGThicknessCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle); + fLGThicknessCmd->SetToBeBroadcasted(false); + fLGThicknessCmd->SetParameterName("thickness",true); + fLGThicknessCmd->SetDefaultValue( 1.0*mm ); + fLGThicknessCmd->SetDefaultUnit("mm"); + fOutputModelCmd = new G4UIcmdWithAString("/lightGuide/model/OutputModel",this); fOutputModelCmd->SetGuidance("Creates a .gdml file of the light guide with the given name"); fOutputModelCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle); @@ -193,6 +202,7 @@ DetectorMessenger::~DetectorMessenger(){ delete fModelTranslationCmd; delete fPMTTranslationCmd; delete fPMTDiameterCmd; + delete fLGThicknessCmd; delete fOutputModelCmd; delete fNsegmentsXCmd; delete fNsegmentsZCmd; @@ -237,8 +247,12 @@ void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue) else if(command == fPMTDiameterCmd){ fDetector->SetPMTDiameter(fPMTDiameterCmd->GetNewDoubleValue(newValue)); } + // PMT DIAMETER + else if(command == fLGThicknessCmd){ + fDetector->SetLGthickness(fLGThicknessCmd->GetNewDoubleValue(newValue)); + } // OUTPUT GEOMETRY TO GDML - else if(command == fNsegmentsXCmd){ + else if(command == fOutputModelCmd){ fDetector->OutputToGDML(newValue); } // X SEGMENTATION