Skip to content
Snippets Groups Projects
Commit caf798b3 authored by Chad Lantz's avatar Chad Lantz
Browse files

Merge branch 'SegmentedLG' into 'master'

Segmented lg

See merge request !1
parents ad112061 65eaff88
No related branches found
No related tags found
1 merge request!1Segmented lg
......@@ -58,7 +58,7 @@ set(lightGuide_SCRIPTS
vis.mac
run1.mac
beam.mac
geom.mac
geometry.mac
)
foreach(_script ${lightGuide_SCRIPTS})
......@@ -75,7 +75,7 @@ endforeach()
install(TARGETS lightGuide DESTINATION bin )
install(TARGETS plotHisto DESTINATION bin )
install(FILES run1.mac DESTINATION bin )
install(FILES geom.mac DESTINATION bin )
install(FILES geometry.mac DESTINATION bin )
install(FILES beam.mac DESTINATION bin )
install(FILES vis.mac DESTINATION bin)
install(FILES hist.mac DESTINATION bin)
......
......@@ -9,17 +9,17 @@
#----- Set the beam geometry -----
# Circular beam source. Simulates a single fiber optic
/gps/pos/type Beam
/gps/pos/shape Circle
#/gps/pos/type Beam
#/gps/pos/shape Circle
#/gps/pos/radius 0.75 mm
/gps/pos/radius 102 mm
#/gps/pos/radius 102 mm
#/gps/pos/sigma_r 0.002 mm
# Rectangular plane for infinite resolution
#/gps/pos/type Plane
#/gps/pos/shape Rectangle
#/gps/pos/halfx 40 mm
#/gps/pos/halfy 68 mm
/gps/pos/type Plane
/gps/pos/shape Rectangle
/gps/pos/halfx 40 mm
/gps/pos/halfy 68 mm
# the incident surface is in the x-z plane just below the gas
/gps/pos/rot1 1 0 0
......
/lightGuide/worldVolume 0.25 0.25 0.25 m
/lightGuide/envelope 89.75 113. 165. mm
/lightGuide/model/PMTDiameter 53 mm
/lightGuide/model/nSegmentsX 2
/lightGuide/model/nSegmentsZ 2
#----- Set the light guide to be used and position it -----
#If no model is selected, the program will default to a
#simplified version of the 2018 testbeam light guide
......@@ -22,10 +32,10 @@
#/lightGuide/model/translate 0 -250 -200 mm
#/lightGuide/model/translatePMT 0 131 0 mm
/lightGuide/model/CADmodel ../models/run2.stl
/lightGuide/model/rotate 0 0 0
/lightGuide/model/translate 200 -250 0 mm
/lightGuide/model/translatePMT 0 -119 0 mm
#/lightGuide/model/CADmodel ../models/run2.stl
#/lightGuide/model/rotate 0 0 0
#/lightGuide/model/translate 200 -250 0 mm
#/lightGuide/model/translatePMT 0 -119 0 mm
#/lightGuide/model/CADmodel ../models/run3wc.stl
#/lightGuide/model/rotate 0 0 90
......@@ -44,9 +54,9 @@
#----- Set surface properties of the light guide -----
/lightGuide/surface/Model unified
/lightGuide/surface/Type dielectric_metal
/lightGuide/surface/Finish ground
#/lightGuide/surface/Model unified
#/lightGuide/surface/Type dielectric_metal
#/lightGuide/surface/Finish ground
#/lightGuide/surface/SigmaAlpha .1
#/lightGuide/surface/Property SPECULARLOBECONSTANT 0.000002 .4 0.000008 .4
#/lightGuide/surface/Property SPECULARSPIKECONSTANT 0.000002 .1 0.000008 .1
......
......@@ -37,6 +37,7 @@
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4SubtractionSolid.hh"
#include "G4GDMLParser.hh"
#include "G4RunManager.hh"
......@@ -57,21 +58,42 @@ class DetectorConstruction : public G4VUserDetectorConstruction
public:
virtual G4VPhysicalVolume* Construct();
void UseCADModel (G4String fileName);
void OutputToGDML (G4String name);
void BuildWorld ();
void BuildTrapezoidLG ();
void BuildPMT ();
void PlaceGeometry ();
void SetWorldVolume (G4ThreeVector arg);
void SetEnvelope (G4ThreeVector arg);
void SetRotation (G4ThreeVector arg);
void SetTranslation (G4ThreeVector arg);
void SetPMTTranslation (G4ThreeVector arg);
void SetPMTDiameter (G4double arg);
void SetLGthickness (G4double arg);
void UseCADModel (G4String fileName);
void OutputToGDML (G4String name);
void SetNSegmentsX (G4int arg);
void SetNSegmentsZ (G4int arg);
void SetSurfaceSigmaAlpha (G4double v);
void SetSurfaceModel (const G4OpticalSurfaceModel model);
void SetSurfaceFinish (const G4OpticalSurfaceFinish finish);
void SetSurfaceType (const G4SurfaceType type);
void SetSurfaceModel (const G4OpticalSurfaceModel model);
void SetSurfaceSigmaAlpha (G4double v);
void AddSurfaceMPV (const char* c, G4MaterialPropertyVector* mpv);
void AddGasMPV (const char* c, G4MaterialPropertyVector* mpv);
private:
G4ThreeVector* m_worldDim;
G4ThreeVector* m_LGenvelope;
G4ThreeVector* m_LGpos;
G4ThreeVector* m_pmtPos;
G4RotationMatrix* m_rotation;
G4double m_pmtDia;
G4double m_PMTthickness;
G4double m_thickness;
G4int m_nSegmentsX;
G4int m_nSegmentsZ;
G4bool m_ConstructionHasBeenDone;
G4bool m_UsingCADmodel;
G4Box* m_solidWorld;
G4LogicalVolume* m_logicWorld;
......@@ -85,30 +107,25 @@ class DetectorConstruction : public G4VUserDetectorConstruction
CADMesh* m_mesh;
#endif
G4LogicalVolume* m_logicLightGuide;
G4VPhysicalVolume* m_physLightGuide;
G4Trd* m_inner;
G4Trd* m_outter;
G4SubtractionSolid* m_LightGuide;
G4LogicalVolume* m_logicLightGuide;
std::vector< G4VPhysicalVolume* > m_physLightGuide;
G4Tubs* m_solidPMT;
G4LogicalVolume* m_logicPMT;
G4VPhysicalVolume* m_physPMT;
G4Tubs* m_solidPMT;
G4LogicalVolume* m_logicPMT;
std::vector< G4VPhysicalVolume* > m_physPMT;
G4LogicalBorderSurface* m_SurfLGtoWorld;
G4LogicalBorderSurface* m_SurfLGtoInner;
G4double m_WorldSizeX;
G4double m_WorldSizeY;
G4double m_WorldSizeZ;
G4ThreeVector m_translation;
G4RotationMatrix* m_rotation;
std::vector< G4LogicalBorderSurface* > m_Surfvec;
Materials* materials;
G4Material* m_filler;
G4MaterialPropertiesTable* m_GasMPT;
Materials* materials;
G4Material* m_filler;
G4MaterialPropertiesTable* m_GasMPT;
G4GDMLParser m_Parser;
G4RunManager* m_runMan;
DetectorMessenger* m_DetectorMessenger;
G4GDMLParser m_Parser;
G4RunManager* m_runMan;
DetectorMessenger* m_DetectorMessenger;
};
#endif /*DetectorConstruction_h*/
......@@ -61,24 +61,28 @@ class DetectorMessenger: public G4UImessenger{
G4UIdirectory* fSurfaceDir;
G4UIdirectory* fModelDir;
// the surface
G4UIcmdWithAString* fSurfaceTypeCmd;
G4UIcmdWithAString* fSurfaceFinishCmd;
G4UIcmdWithAString* fSurfaceModelCmd;
G4UIcmdWithADouble* fSurfaceSigmaAlphaCmd;
G4UIcmdWithAString* fSurfaceMatPropVectorCmd;
// the gas
G4UIcmdWithAString* fGasPropVectorCmd;
// the model
G4UIcmdWithAString* fModelCmd;
G4UIcmdWith3VectorAndUnit* fWorldVolumeCmd;
G4UIcmdWith3VectorAndUnit* fEnvelopeCmd;
G4UIcmdWith3VectorAndUnit* fModelRotationCmd;
G4UIcmdWith3VectorAndUnit* fModelTranslationCmd;
G4UIcmdWith3VectorAndUnit* fPMTTranslationCmd;
G4UIcmdWithADoubleAndUnit* fPMTDiameterCmd;
G4UIcmdWithADoubleAndUnit* fLGThicknessCmd;
G4UIcmdWithAString* fOutputModelCmd;
G4UIcmdWithAnInteger* fNsegmentsXCmd;
G4UIcmdWithAnInteger* fNsegmentsZCmd;
// the surface
G4UIcmdWithAString* fSurfaceModelCmd;
G4UIcmdWithAString* fSurfaceFinishCmd;
G4UIcmdWithAString* fSurfaceTypeCmd;
G4UIcmdWithADouble* fSurfaceSigmaAlphaCmd;
G4UIcmdWithAString* fSurfaceMatPropVectorCmd;
// the gas
G4UIcmdWithAString* fGasPropVectorCmd;
};
#endif
......@@ -46,9 +46,7 @@ class SteppingAction : public G4UserSteppingAction
virtual void UserSteppingAction(const G4Step*);
private:
G4int fScintillationCounter;
G4int fCerenkovCounter;
G4int fEventNumber;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
......
......@@ -14,23 +14,16 @@
/hits/verbose 0
#Lightguide selection and properties can be set with geom.mac
/control/execute geom.mac
##############################################################
##############################################################
#Uncomment to generate events from ASCII file, set the file path here.
#make sure /run/beamOn is commented out below
/Input/FileName Out_target1.txt
#/Input/FileName Out_target1.txt
#Uncomment to use gps style of setting the beam profile
#/control/execute beam.mac
#set number of photons per event
#/gps/number 10
/control/execute beam.mac
# number of events
#/run/beamOn 1
/run/beamOn 100
##############################################################
##############################################################
This diff is collapsed.
......@@ -50,6 +50,7 @@
DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
:G4UImessenger(),fDetector(Det)
{
//Directories
flightGuideDir = new G4UIdirectory("/lightGuide/");
flightGuideDir->SetGuidance("Parameters for optical simulation.");
......@@ -59,52 +60,35 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
fModelDir = new G4UIdirectory("/lightGuide/model/");
fModelDir->SetGuidance("Model source, translation and rotation");
fSurfaceTypeCmd = new G4UIcmdWithAString("/lightGuide/surface/Type", this);
fSurfaceTypeCmd->SetGuidance("Surface type.");
fSurfaceTypeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSurfaceTypeCmd->SetToBeBroadcasted(false);
fSurfaceFinishCmd = new G4UIcmdWithAString("/lightGuide/surface/Finish", this);
fSurfaceFinishCmd->SetGuidance("Surface finish.");
fSurfaceFinishCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSurfaceFinishCmd->SetToBeBroadcasted(false);
fSurfaceModelCmd =
new G4UIcmdWithAString("/lightGuide/surface/Model", this);
fSurfaceModelCmd->SetGuidance("surface model.");
fSurfaceModelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSurfaceModelCmd->SetToBeBroadcasted(false);
fSurfaceSigmaAlphaCmd =
new G4UIcmdWithADouble("/lightGuide/surface/SigmaAlpha", this);
fSurfaceSigmaAlphaCmd->SetGuidance("surface sigma alpha");
fSurfaceSigmaAlphaCmd->SetGuidance(" parameter.");
fSurfaceSigmaAlphaCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSurfaceSigmaAlphaCmd->SetToBeBroadcasted(false);
fWorldVolumeCmd =
new G4UIcmdWith3VectorAndUnit("/lightGuide/worldVolume", this);
fWorldVolumeCmd->SetGuidance("Set the size of the world volume");
fWorldVolumeCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fWorldVolumeCmd->SetToBeBroadcasted(false);
fWorldVolumeCmd->SetParameterName("X","Y","Z",true);
fWorldVolumeCmd->SetDefaultValue(G4ThreeVector(0.25,0.25,0.5));
fWorldVolumeCmd->SetDefaultUnit("m");
fSurfaceMatPropVectorCmd =
new G4UIcmdWithAString("/lightGuide/surface/Property", this);
fSurfaceMatPropVectorCmd->SetGuidance("Set material property vector");
fSurfaceMatPropVectorCmd->SetGuidance(" for the surface.");
fSurfaceMatPropVectorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSurfaceMatPropVectorCmd->SetToBeBroadcasted(false);
fGasPropVectorCmd =
new G4UIcmdWithAString("/lightGuide/gasProperty", this);
fGasPropVectorCmd->SetGuidance("Set fill gas property vector");
fGasPropVectorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fGasPropVectorCmd->SetToBeBroadcasted(false);
fEnvelopeCmd =
new G4UIcmdWith3VectorAndUnit("/lightGuide/envelope", this);
fEnvelopeCmd->SetGuidance("Set the size light guide envelope");
fEnvelopeCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fEnvelopeCmd->SetToBeBroadcasted(false);
fEnvelopeCmd->SetParameterName("X","Y","Z",true);
fEnvelopeCmd->SetDefaultValue(G4ThreeVector(89.75*mm,113.*mm,339.*mm));
fEnvelopeCmd->SetDefaultUnit("m");
//Model commands
fModelCmd = new G4UIcmdWithAString("/lightGuide/model/CADmodel", this);
fModelCmd->SetGuidance("CAD model to be used");
fModelCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fModelCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fModelCmd->SetToBeBroadcasted(false);
fModelCmd->SetDefaultValue("models/Winston_cone.stl");
fModelRotationCmd =
new G4UIcmdWith3VectorAndUnit("/lightGuide/model/rotate", this);
fModelRotationCmd->SetGuidance("Set light guide first rotation");
fModelRotationCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fModelRotationCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fModelRotationCmd->SetToBeBroadcasted(false);
fModelRotationCmd->SetParameterName("rotationX","rotationY","rotationZ",true);
fModelRotationCmd->SetDefaultValue(G4ThreeVector(0.,0.,0.));
......@@ -113,7 +97,7 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
fModelTranslationCmd =
new G4UIcmdWith3VectorAndUnit("/lightGuide/model/translate", this);
fModelTranslationCmd->SetGuidance("Set light guide translation");
fModelTranslationCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fModelTranslationCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fModelTranslationCmd->SetToBeBroadcasted(false);
fModelTranslationCmd->SetParameterName("X","Y","Z",true);
fModelTranslationCmd->SetDefaultValue(G4ThreeVector(0.,0.,0.));
......@@ -122,7 +106,7 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
fPMTTranslationCmd =
new G4UIcmdWith3VectorAndUnit("/lightGuide/model/translatePMT", this);
fPMTTranslationCmd->SetGuidance("Set PMT translation");
fPMTTranslationCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fPMTTranslationCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fPMTTranslationCmd->SetToBeBroadcasted(false);
fPMTTranslationCmd->SetParameterName("X","Y","Z",true);
fPMTTranslationCmd->SetDefaultValue(G4ThreeVector(0.,0.,0.));
......@@ -131,35 +115,103 @@ DetectorMessenger::DetectorMessenger(DetectorConstruction * Det)
fPMTDiameterCmd =
new G4UIcmdWithADoubleAndUnit("/lightGuide/model/PMTDiameter",this);
fPMTDiameterCmd->SetGuidance("Set PMT diameter");
fPMTDiameterCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fPMTDiameterCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fPMTDiameterCmd->SetToBeBroadcasted(false);
fPMTDiameterCmd->SetParameterName("dia",true);
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_Idle);
fOutputModelCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fOutputModelCmd->SetToBeBroadcasted(false);
fNsegmentsXCmd =
new G4UIcmdWithAnInteger("/lightGuide/model/nSegmentsX",this);
fNsegmentsXCmd->SetGuidance("Set segmentation of the light guide envelope in x");
fNsegmentsXCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fNsegmentsXCmd->SetToBeBroadcasted(false);
fNsegmentsXCmd->SetParameterName("nSegmentsX",true);
fNsegmentsXCmd->SetDefaultValue( 1 );
fNsegmentsZCmd =
new G4UIcmdWithAnInteger("/lightGuide/model/nSegmentsZ",this);
fNsegmentsZCmd->SetGuidance("Set segmentation of the light guide envelope in z");
fNsegmentsZCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fNsegmentsZCmd->SetToBeBroadcasted(false);
fNsegmentsZCmd->SetParameterName("nSegmentsZ",true);
fNsegmentsZCmd->SetDefaultValue( 1 );
//Surface commands
fSurfaceTypeCmd = new G4UIcmdWithAString("/lightGuide/surface/Type", this);
fSurfaceTypeCmd->SetGuidance("Surface type.");
fSurfaceTypeCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fSurfaceTypeCmd->SetToBeBroadcasted(false);
fSurfaceFinishCmd = new G4UIcmdWithAString("/lightGuide/surface/Finish", this);
fSurfaceFinishCmd->SetGuidance("Surface finish.");
fSurfaceFinishCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fSurfaceFinishCmd->SetToBeBroadcasted(false);
fSurfaceModelCmd =
new G4UIcmdWithAString("/lightGuide/surface/Model", this);
fSurfaceModelCmd->SetGuidance("surface model.");
fSurfaceModelCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fSurfaceModelCmd->SetToBeBroadcasted(false);
fSurfaceSigmaAlphaCmd =
new G4UIcmdWithADouble("/lightGuide/surface/SigmaAlpha", this);
fSurfaceSigmaAlphaCmd->SetGuidance("surface sigma alpha");
fSurfaceSigmaAlphaCmd->SetGuidance(" parameter.");
fSurfaceSigmaAlphaCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fSurfaceSigmaAlphaCmd->SetToBeBroadcasted(false);
fSurfaceMatPropVectorCmd =
new G4UIcmdWithAString("/lightGuide/surface/Property", this);
fSurfaceMatPropVectorCmd->SetGuidance("Set material property vector");
fSurfaceMatPropVectorCmd->SetGuidance(" for the surface.");
fSurfaceMatPropVectorCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fSurfaceMatPropVectorCmd->SetToBeBroadcasted(false);
//Gas commands
fGasPropVectorCmd =
new G4UIcmdWithAString("/lightGuide/gasProperty", this);
fGasPropVectorCmd->SetGuidance("Set fill gas property vector");
fGasPropVectorCmd->AvailableForStates(G4State_PreInit, G4State_Init, G4State_Idle);
fGasPropVectorCmd->SetToBeBroadcasted(false);
}
/*
*
*/
DetectorMessenger::~DetectorMessenger(){
delete fSurfaceFinishCmd;
delete fSurfaceTypeCmd;
delete fSurfaceModelCmd;
delete fSurfaceSigmaAlphaCmd;
delete fSurfaceMatPropVectorCmd;
delete fGasPropVectorCmd;
delete fModelCmd;
delete fWorldVolumeCmd;
delete fEnvelopeCmd;
delete fModelRotationCmd;
delete fModelTranslationCmd;
delete fPMTTranslationCmd;
delete fPMTDiameterCmd;
delete fLGThicknessCmd;
delete fOutputModelCmd;
delete fNsegmentsXCmd;
delete fNsegmentsZCmd;
delete fSurfaceModelCmd;
delete fSurfaceFinishCmd;
delete fSurfaceTypeCmd;
delete fSurfaceSigmaAlphaCmd;
delete fSurfaceMatPropVectorCmd;
delete fGasPropVectorCmd;
}
/*
......@@ -167,8 +219,52 @@ DetectorMessenger::~DetectorMessenger(){
*/
void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
// MODEL FILE
if(command == fModelCmd){
fDetector->UseCADModel(newValue);
}
// WORLD VOLUME
else if(command == fWorldVolumeCmd){
fDetector->SetWorldVolume(fWorldVolumeCmd->GetNew3VectorValue(newValue));
}
// LIGHT GUIDE ENVELOPE
else if(command == fEnvelopeCmd){
fDetector->SetEnvelope(fEnvelopeCmd->GetNew3VectorValue(newValue));
}
// MODEL ROTATION
else if(command == fModelRotationCmd){
fDetector->SetRotation(fModelRotationCmd->GetNew3VectorValue(newValue));
}
// MODEL TRANSLATION
else if(command == fModelTranslationCmd){
fDetector->SetTranslation(fModelTranslationCmd->GetNew3VectorValue(newValue));
}
// PMT TRANSLATION
else if(command == fPMTTranslationCmd){
fDetector->SetPMTTranslation(fPMTTranslationCmd->GetNew3VectorValue(newValue));
}
// PMT DIAMETER
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 == fOutputModelCmd){
fDetector->OutputToGDML(newValue);
}
// X SEGMENTATION
else if(command == fNsegmentsXCmd){
fDetector->SetNSegmentsX(fNsegmentsXCmd->GetNewIntValue(newValue));
}
// Z SEGMENTATION
else if(command == fNsegmentsZCmd){
fDetector->SetNSegmentsZ(fNsegmentsZCmd->GetNewIntValue(newValue));
}
// FINISH
if (command == fSurfaceFinishCmd) {
else if (command == fSurfaceFinishCmd) {
if (newValue == "polished") {
fDetector->SetSurfaceFinish(polished);
}
......@@ -365,7 +461,7 @@ void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
fDetector->SetSurfaceSigmaAlpha(
G4UIcmdWithADouble::GetNewDoubleValue(newValue));
}
// SURFACE PROPERTY
// Gas property
else if (command == fGasPropVectorCmd) {
// Convert string to physics vector
// string format is property name, then pairs of energy, value
......@@ -388,28 +484,4 @@ void DetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
const char* c = prop.c_str();
fDetector->AddGasMPV(c, mpv);
}
// MODEL LOCATION
else if(command == fModelCmd){
fDetector->UseCADModel(newValue);
}
// MODEL ROTATION
else if(command == fModelRotationCmd){
fDetector->SetRotation(fModelRotationCmd->GetNew3VectorValue(newValue));
}
// MODEL TRANSLATION
else if(command == fModelTranslationCmd){
fDetector->SetTranslation(fModelTranslationCmd->GetNew3VectorValue(newValue));
}
// PMT TRANSLATION
else if(command == fPMTTranslationCmd){
fDetector->SetPMTTranslation(fPMTTranslationCmd->GetNew3VectorValue(newValue));
}
// PMT Diameter
else if(command == fPMTDiameterCmd){
fDetector->SetPMTDiameter(fPMTDiameterCmd->GetNewDoubleValue(newValue));
}
// PMT Diameter
else if(command == fOutputModelCmd){
fDetector->OutputToGDML(newValue);
}
}
......@@ -41,50 +41,19 @@
SteppingAction::SteppingAction()
: G4UserSteppingAction()
{
fScintillationCounter = 0;
fCerenkovCounter = 0;
fEventNumber = -1;
}
/*
*/
SteppingAction::~SteppingAction()
{ ; }
{
}
/*
*/
void SteppingAction::UserSteppingAction(const G4Step* step)
{
G4int eventNumber = G4RunManager::GetRunManager()->
GetCurrentEvent()->GetEventID();
if (eventNumber != fEventNumber) {
fEventNumber = eventNumber;
fScintillationCounter = 0;
fCerenkovCounter = 0;
}
G4Track* track = step->GetTrack();
G4String ParticleName = track->GetDynamicParticle()->
GetParticleDefinition()->GetParticleName();
if (ParticleName == "opticalphoton") return;
const std::vector<const G4Track*>* secondaries =
step->GetSecondaryInCurrentStep();
if (secondaries->size()>0) {
for(unsigned int i=0; i<secondaries->size(); ++i) {
if (secondaries->at(i)->GetParentID()>0) {
if(secondaries->at(i)->GetDynamicParticle()->GetParticleDefinition()
== G4OpticalPhoton::OpticalPhotonDefinition()){
if (secondaries->at(i)->GetCreatorProcess()->GetProcessName()
== "Scintillation")fScintillationCounter++;
if (secondaries->at(i)->GetCreatorProcess()->GetProcessName()
== "Cerenkov")fCerenkovCounter++;
}
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment