Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -28,28 +28,25 @@
|
||||
/// \brief Implementation of the WLSActionInitialization class
|
||||
|
||||
#include "WLSActionInitialization.hh"
|
||||
|
||||
#include "WLSDetectorConstruction.hh"
|
||||
|
||||
#include "WLSPrimaryGeneratorAction.hh"
|
||||
|
||||
#include "WLSRunAction.hh"
|
||||
#include "WLSEventAction.hh"
|
||||
#include "WLSTrackingAction.hh"
|
||||
#include "WLSSteppingAction.hh"
|
||||
#include "WLSPrimaryGeneratorAction.hh"
|
||||
#include "WLSRunAction.hh"
|
||||
#include "WLSStackingAction.hh"
|
||||
#include "WLSSteppingAction.hh"
|
||||
#include "WLSTrackingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSActionInitialization::WLSActionInitialization(WLSDetectorConstruction* det)
|
||||
: G4VUserActionInitialization(), fDetector(det)
|
||||
{
|
||||
}
|
||||
: G4VUserActionInitialization()
|
||||
, fDetector(det)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSActionInitialization::~WLSActionInitialization()
|
||||
{
|
||||
}
|
||||
WLSActionInitialization::~WLSActionInitialization() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -63,16 +60,14 @@ void WLSActionInitialization::BuildForMaster() const
|
||||
void WLSActionInitialization::Build() const
|
||||
{
|
||||
SetUserAction(new WLSPrimaryGeneratorAction(fDetector));
|
||||
SetUserAction(new WLSRunAction());
|
||||
|
||||
WLSRunAction* runAction = new WLSRunAction();
|
||||
WLSEventAction* eventAction = new WLSEventAction(runAction);
|
||||
|
||||
SetUserAction(runAction);
|
||||
WLSEventAction* eventAction = new WLSEventAction();
|
||||
SetUserAction(eventAction);
|
||||
|
||||
SetUserAction(new WLSTrackingAction());
|
||||
SetUserAction(new WLSSteppingAction(fDetector));
|
||||
SetUserAction(new WLSSteppingAction(fDetector, eventAction));
|
||||
SetUserAction(new WLSStackingAction());
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -30,209 +30,209 @@
|
||||
//
|
||||
#include "WLSDetectorMessenger.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithoutParameter.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSDetectorMessenger::WLSDetectorMessenger(WLSDetectorConstruction * det)
|
||||
WLSDetectorMessenger::WLSDetectorMessenger(WLSDetectorConstruction* det)
|
||||
: fDetector(det)
|
||||
{
|
||||
fDetDir = new G4UIdirectory("/WLS/");
|
||||
fDetDir->SetGuidance(" Geometry Setup ");
|
||||
|
||||
fSetPhotonDetGeometryCmd =
|
||||
new G4UIcmdWithAString("/WLS/setPhotonDetGeometry",this);
|
||||
fSetPhotonDetGeometryCmd->
|
||||
SetGuidance("Select the geometry of the PhotonDet detector");
|
||||
new G4UIcmdWithAString("/WLS/setPhotonDetGeometry", this);
|
||||
fSetPhotonDetGeometryCmd->SetGuidance(
|
||||
"Select the geometry of the PhotonDet detector");
|
||||
fSetPhotonDetGeometryCmd->SetGuidance("Only Accepts 'Circle' and 'Square'");
|
||||
fSetPhotonDetGeometryCmd->SetCandidates("Circle Square");
|
||||
fSetPhotonDetGeometryCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetPhotonDetGeometryCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetPhotonDetGeometryCmd->SetToBeBroadcasted(false);
|
||||
|
||||
|
||||
fSetNumOfCladLayersCmd =
|
||||
new G4UIcmdWithAnInteger("/WLS/setNumOfLayers", this);
|
||||
new G4UIcmdWithAnInteger("/WLS/setNumOfLayers", this);
|
||||
fSetNumOfCladLayersCmd->SetGuidance("Select the number of cladding layers");
|
||||
fSetNumOfCladLayersCmd->SetGuidance("Maximum number is 2");
|
||||
fSetNumOfCladLayersCmd->SetParameterName("numberOfLayers",false);
|
||||
fSetNumOfCladLayersCmd->SetParameterName("numberOfLayers", false);
|
||||
fSetNumOfCladLayersCmd->SetRange("numberOfLayers>=0 && numberOfLayers<=2");
|
||||
fSetNumOfCladLayersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetNumOfCladLayersCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetNumOfCladLayersCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetSurfaceRoughnessCmd =
|
||||
new G4UIcmdWithADouble("/WLS/setSurfaceRoughness", this);
|
||||
fSetSurfaceRoughnessCmd->
|
||||
SetGuidance("Set the roughness between Clad1 and WLS Fiber");
|
||||
fSetSurfaceRoughnessCmd->SetParameterName("roughness",false);
|
||||
new G4UIcmdWithADouble("/WLS/setSurfaceRoughness", this);
|
||||
fSetSurfaceRoughnessCmd->SetGuidance(
|
||||
"Set the roughness between Clad1 and WLS Fiber");
|
||||
fSetSurfaceRoughnessCmd->SetParameterName("roughness", false);
|
||||
fSetSurfaceRoughnessCmd->SetRange("roughness>0 && roughness<=1");
|
||||
fSetSurfaceRoughnessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetSurfaceRoughnessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetSurfaceRoughnessCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetXYRatioCmd = new G4UIcmdWithADouble("/WLS/setXYRatio", this);
|
||||
fSetXYRatioCmd->SetGuidance("Set the ratio between x and y axis (x/y)");
|
||||
fSetXYRatioCmd->SetParameterName("ratio",false);
|
||||
fSetXYRatioCmd->SetParameterName("ratio", false);
|
||||
fSetXYRatioCmd->SetRange("ratio>0 && ratio<=1");
|
||||
fSetXYRatioCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetXYRatioCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetXYRatioCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetMirrorPolishCmd = new G4UIcmdWithADouble("/WLS/setMirrorPolish", this);
|
||||
fSetMirrorPolishCmd->SetGuidance("Set the polish of the mirror");
|
||||
fSetMirrorPolishCmd->SetParameterName("polish",false);
|
||||
fSetMirrorPolishCmd->SetParameterName("polish", false);
|
||||
fSetMirrorPolishCmd->SetRange("polish>0 && polish<=1");
|
||||
fSetMirrorPolishCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetMirrorPolishCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetMirrorPolishCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetMirrorReflectivityCmd =
|
||||
new G4UIcmdWithADouble("/WLS/setMirrorReflectivity", this);
|
||||
new G4UIcmdWithADouble("/WLS/setMirrorReflectivity", this);
|
||||
fSetMirrorReflectivityCmd->SetGuidance("Set the reflectivity of the mirror");
|
||||
fSetMirrorReflectivityCmd->SetParameterName("reflectivity",false);
|
||||
fSetMirrorReflectivityCmd->SetParameterName("reflectivity", false);
|
||||
fSetMirrorReflectivityCmd->SetRange("reflectivity>=0 && reflectivity<=1");
|
||||
fSetMirrorReflectivityCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetMirrorReflectivityCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetMirrorReflectivityCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetPhotonDetPolishCmd =
|
||||
new G4UIcmdWithADouble("/WLS/setPhotonDetPolish", this);
|
||||
new G4UIcmdWithADouble("/WLS/setPhotonDetPolish", this);
|
||||
fSetPhotonDetPolishCmd->SetGuidance("Set the polish of the mirror");
|
||||
fSetPhotonDetPolishCmd->SetParameterName("polish",false);
|
||||
fSetPhotonDetPolishCmd->SetParameterName("polish", false);
|
||||
fSetPhotonDetPolishCmd->SetRange("polish>0 && polish<=1");
|
||||
fSetPhotonDetPolishCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetPhotonDetPolishCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetPhotonDetPolishCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetPhotonDetReflectivityCmd =
|
||||
new G4UIcmdWithADouble("/WLS/setPhotonDetReflectivity", this);
|
||||
fSetPhotonDetReflectivityCmd->
|
||||
SetGuidance("Set the reflectivity of the mirror");
|
||||
fSetPhotonDetReflectivityCmd->SetParameterName("reflectivity",false);
|
||||
new G4UIcmdWithADouble("/WLS/setPhotonDetReflectivity", this);
|
||||
fSetPhotonDetReflectivityCmd->SetGuidance(
|
||||
"Set the reflectivity of the mirror");
|
||||
fSetPhotonDetReflectivityCmd->SetParameterName("reflectivity", false);
|
||||
fSetPhotonDetReflectivityCmd->SetRange("reflectivity>=0 && reflectivity<=1");
|
||||
fSetPhotonDetReflectivityCmd->AvailableForStates(G4State_PreInit);
|
||||
fSetPhotonDetReflectivityCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetWLSLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setWLSLength",this);
|
||||
fSetWLSLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setWLSLength", this);
|
||||
fSetWLSLengthCmd->SetGuidance("Set the half length of the WLS fiber");
|
||||
fSetWLSLengthCmd->SetParameterName("length",false);
|
||||
fSetWLSLengthCmd->SetParameterName("length", false);
|
||||
fSetWLSLengthCmd->SetRange("length>0.");
|
||||
fSetWLSLengthCmd->SetUnitCategory("Length");
|
||||
fSetWLSLengthCmd->SetDefaultUnit("mm");
|
||||
fSetWLSLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetWLSLengthCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetWLSLengthCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetWLSRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setWLSRadius",this);
|
||||
fSetWLSRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setWLSRadius", this);
|
||||
fSetWLSRadiusCmd->SetGuidance("Set the radius of the WLS fiber");
|
||||
fSetWLSRadiusCmd->SetParameterName("radius",false);
|
||||
fSetWLSRadiusCmd->SetParameterName("radius", false);
|
||||
fSetWLSRadiusCmd->SetRange("radius>0.");
|
||||
fSetWLSRadiusCmd->SetUnitCategory("Length");
|
||||
fSetWLSRadiusCmd->SetDefaultUnit("mm");
|
||||
fSetWLSRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetWLSRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetWLSRadiusCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetClad1RadiusCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setClad1Radius",this);
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setClad1Radius", this);
|
||||
fSetClad1RadiusCmd->SetGuidance("Set the radius of Cladding 1");
|
||||
fSetClad1RadiusCmd->SetParameterName("radius",false);
|
||||
fSetClad1RadiusCmd->SetParameterName("radius", false);
|
||||
fSetClad1RadiusCmd->SetRange("radius>0.");
|
||||
fSetClad1RadiusCmd->SetUnitCategory("Length");
|
||||
fSetClad1RadiusCmd->SetDefaultUnit("mm");
|
||||
fSetClad1RadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetClad1RadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetClad1RadiusCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetClad2RadiusCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setClad2Radius",this);
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setClad2Radius", this);
|
||||
fSetClad2RadiusCmd->SetGuidance("Set the radius of Cladding 2");
|
||||
fSetClad2RadiusCmd->SetParameterName("radius",false);
|
||||
fSetClad2RadiusCmd->SetParameterName("radius", false);
|
||||
fSetClad2RadiusCmd->SetRange("radius>0.");
|
||||
fSetClad2RadiusCmd->SetUnitCategory("Length");
|
||||
fSetClad2RadiusCmd->SetDefaultUnit("mm");
|
||||
fSetClad2RadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetClad2RadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetClad2RadiusCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetPhotonDetHalfLengthCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setPhotonDetHalfLength",this);
|
||||
fSetPhotonDetHalfLengthCmd->
|
||||
SetGuidance("Set the half length of PhotonDet detector");
|
||||
fSetPhotonDetHalfLengthCmd->SetParameterName("halfL",false);
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setPhotonDetHalfLength", this);
|
||||
fSetPhotonDetHalfLengthCmd->SetGuidance(
|
||||
"Set the half length of PhotonDet detector");
|
||||
fSetPhotonDetHalfLengthCmd->SetParameterName("halfL", false);
|
||||
fSetPhotonDetHalfLengthCmd->SetRange("halfL>0.");
|
||||
fSetPhotonDetHalfLengthCmd->SetUnitCategory("Length");
|
||||
fSetPhotonDetHalfLengthCmd->SetDefaultUnit("mm");
|
||||
fSetPhotonDetHalfLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetPhotonDetHalfLengthCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetPhotonDetHalfLengthCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetGapCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setGap",this);
|
||||
fSetGapCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setGap", this);
|
||||
fSetGapCmd->SetGuidance("Set the distance between PhotonDet and fiber end");
|
||||
fSetGapCmd->SetParameterName("theta",false);
|
||||
fSetGapCmd->SetParameterName("theta", false);
|
||||
fSetGapCmd->SetUnitCategory("Length");
|
||||
fSetGapCmd->SetDefaultUnit("mm");
|
||||
fSetGapCmd->SetRange("theta>=0.");
|
||||
fSetGapCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetGapCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetGapCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetPhotonDetAlignmentCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setAlignment",this);
|
||||
fSetPhotonDetAlignmentCmd->
|
||||
SetGuidance("Set the deviation of PhotonDet from z axis");
|
||||
fSetPhotonDetAlignmentCmd->SetParameterName("theta",false);
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setAlignment", this);
|
||||
fSetPhotonDetAlignmentCmd->SetGuidance(
|
||||
"Set the deviation of PhotonDet from z axis");
|
||||
fSetPhotonDetAlignmentCmd->SetParameterName("theta", false);
|
||||
fSetPhotonDetAlignmentCmd->SetUnitCategory("Angle");
|
||||
fSetPhotonDetAlignmentCmd->SetDefaultUnit("deg");
|
||||
fSetPhotonDetAlignmentCmd->SetRange("theta>-90. && theta<90.");
|
||||
fSetPhotonDetAlignmentCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetPhotonDetAlignmentCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetPhotonDetAlignmentCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetMirrorCmd = new G4UIcmdWithABool("/WLS/setMirror", this);
|
||||
fSetMirrorCmd->SetGuidance("Place a mirror at the end of the fiber");
|
||||
fSetMirrorCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetMirrorCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetMirrorCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetBarLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setBarLength",this);
|
||||
fSetBarLengthCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setBarLength", this);
|
||||
fSetBarLengthCmd->SetGuidance("Set the length of the scintillator bar");
|
||||
fSetBarLengthCmd->SetParameterName("length",false);
|
||||
fSetBarLengthCmd->SetParameterName("length", false);
|
||||
fSetBarLengthCmd->SetRange("length>0.");
|
||||
fSetBarLengthCmd->SetUnitCategory("Length");
|
||||
fSetBarLengthCmd->SetDefaultUnit("mm");
|
||||
fSetBarLengthCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetBarLengthCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetBarLengthCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetBarBaseCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setBarBase",this);
|
||||
fSetBarBaseCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setBarBase", this);
|
||||
fSetBarBaseCmd->SetGuidance("Set the side length of the scintillator bar");
|
||||
fSetBarBaseCmd->SetParameterName("length",false);
|
||||
fSetBarBaseCmd->SetParameterName("length", false);
|
||||
fSetBarBaseCmd->SetRange("length>0.");
|
||||
fSetBarBaseCmd->SetUnitCategory("Length");
|
||||
fSetBarBaseCmd->SetDefaultUnit("mm");
|
||||
fSetBarBaseCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetBarBaseCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetBarBaseCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetHoleRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setHoleRadius",this);
|
||||
fSetHoleRadiusCmd = new G4UIcmdWithADoubleAndUnit("/WLS/setHoleRadius", this);
|
||||
fSetHoleRadiusCmd->SetGuidance("Set the radius of the fiber hole");
|
||||
fSetHoleRadiusCmd->SetParameterName("radius",false);
|
||||
fSetHoleRadiusCmd->SetParameterName("radius", false);
|
||||
fSetHoleRadiusCmd->SetRange("radius>0.");
|
||||
fSetHoleRadiusCmd->SetUnitCategory("Length");
|
||||
fSetHoleRadiusCmd->SetDefaultUnit("mm");
|
||||
fSetHoleRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetHoleRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetHoleRadiusCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetCoatingThicknessCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setCoatingThickness",this);
|
||||
fSetCoatingThicknessCmd->
|
||||
SetGuidance("Set thickness of the coating on the bars");
|
||||
fSetCoatingThicknessCmd->SetParameterName("thick",false);
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setCoatingThickness", this);
|
||||
fSetCoatingThicknessCmd->SetGuidance(
|
||||
"Set thickness of the coating on the bars");
|
||||
fSetCoatingThicknessCmd->SetParameterName("thick", false);
|
||||
fSetCoatingThicknessCmd->SetUnitCategory("Length");
|
||||
fSetCoatingThicknessCmd->SetDefaultUnit("mm");
|
||||
fSetCoatingThicknessCmd->SetRange("thick>=0.");
|
||||
fSetCoatingThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetCoatingThicknessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetCoatingThicknessCmd->SetToBeBroadcasted(false);
|
||||
|
||||
fSetCoatingRadiusCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setCoatingRadius",this);
|
||||
fSetCoatingRadiusCmd->
|
||||
SetGuidance("Set inner radius of the corner bar coating");
|
||||
fSetCoatingRadiusCmd->SetParameterName("cradius",false);
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/setCoatingRadius", this);
|
||||
fSetCoatingRadiusCmd->SetGuidance(
|
||||
"Set inner radius of the corner bar coating");
|
||||
fSetCoatingRadiusCmd->SetParameterName("cradius", false);
|
||||
fSetCoatingRadiusCmd->SetUnitCategory("Length");
|
||||
fSetCoatingRadiusCmd->SetDefaultUnit("mm");
|
||||
fSetCoatingRadiusCmd->SetRange("cradius>=0.");
|
||||
fSetCoatingRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
fSetCoatingRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
|
||||
fSetCoatingRadiusCmd->SetToBeBroadcasted(false);
|
||||
}
|
||||
|
||||
@@ -242,119 +242,124 @@ WLSDetectorMessenger::~WLSDetectorMessenger()
|
||||
{
|
||||
delete fDetDir;
|
||||
|
||||
delete fSetPhotonDetGeometryCmd;
|
||||
delete fSetNumOfCladLayersCmd;
|
||||
delete fSetWLSLengthCmd;
|
||||
delete fSetWLSRadiusCmd;
|
||||
delete fSetClad1RadiusCmd;
|
||||
delete fSetClad2RadiusCmd;
|
||||
delete fSetPhotonDetHalfLengthCmd;
|
||||
delete fSetGapCmd;
|
||||
delete fSetPhotonDetAlignmentCmd;
|
||||
delete fSetSurfaceRoughnessCmd;
|
||||
delete fSetMirrorPolishCmd;
|
||||
delete fSetMirrorReflectivityCmd;
|
||||
delete fSetXYRatioCmd;
|
||||
delete fSetMirrorCmd;
|
||||
delete fSetBarLengthCmd;
|
||||
delete fSetBarBaseCmd;
|
||||
delete fSetHoleRadiusCmd;
|
||||
delete fSetClad1RadiusCmd;
|
||||
delete fSetClad2RadiusCmd;
|
||||
delete fSetCoatingThicknessCmd;
|
||||
delete fSetCoatingRadiusCmd;
|
||||
delete fSetGapCmd;
|
||||
delete fSetHoleRadiusCmd;
|
||||
delete fSetMirrorCmd;
|
||||
delete fSetMirrorPolishCmd;
|
||||
delete fSetMirrorReflectivityCmd;
|
||||
delete fSetNumOfCladLayersCmd;
|
||||
delete fSetPhotonDetAlignmentCmd;
|
||||
delete fSetPhotonDetGeometryCmd;
|
||||
delete fSetPhotonDetHalfLengthCmd;
|
||||
delete fSetPhotonDetPolishCmd;
|
||||
delete fSetPhotonDetReflectivityCmd;
|
||||
delete fSetSurfaceRoughnessCmd;
|
||||
delete fSetWLSLengthCmd;
|
||||
delete fSetWLSRadiusCmd;
|
||||
delete fSetXYRatioCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSDetectorMessenger::SetNewValue(G4UIcommand* command,G4String val)
|
||||
void WLSDetectorMessenger::SetNewValue(G4UIcommand* command, G4String val)
|
||||
{
|
||||
if( command == fSetPhotonDetGeometryCmd ) {
|
||||
|
||||
if(command == fSetPhotonDetGeometryCmd)
|
||||
{
|
||||
fDetector->SetPhotonDetGeometry(val);
|
||||
}
|
||||
else if( command == fSetNumOfCladLayersCmd ) {
|
||||
|
||||
else if(command == fSetNumOfCladLayersCmd)
|
||||
{
|
||||
fDetector->SetNumberOfCladding(G4UIcmdWithAnInteger::GetNewIntValue(val));
|
||||
}
|
||||
else if( command == fSetSurfaceRoughnessCmd ) {
|
||||
|
||||
else if(command == fSetSurfaceRoughnessCmd)
|
||||
{
|
||||
fDetector->SetSurfaceRoughness(G4UIcmdWithADouble::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetXYRatioCmd ) {
|
||||
|
||||
else if(command == fSetXYRatioCmd)
|
||||
{
|
||||
fDetector->SetXYRatio(G4UIcmdWithADouble::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetMirrorPolishCmd ) {
|
||||
|
||||
else if(command == fSetMirrorPolishCmd)
|
||||
{
|
||||
fDetector->SetMirrorPolish(G4UIcmdWithADouble::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetMirrorReflectivityCmd ) {
|
||||
|
||||
fDetector->
|
||||
SetMirrorReflectivity(G4UIcmdWithADouble::GetNewDoubleValue(val));
|
||||
else if(command == fSetMirrorReflectivityCmd)
|
||||
{
|
||||
fDetector->SetMirrorReflectivity(
|
||||
G4UIcmdWithADouble::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetPhotonDetPolishCmd ) {
|
||||
|
||||
else if(command == fSetPhotonDetPolishCmd)
|
||||
{
|
||||
fDetector->SetPhotonDetPolish(G4UIcmdWithADouble::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetPhotonDetReflectivityCmd ) {
|
||||
|
||||
fDetector->
|
||||
SetPhotonDetReflectivity(G4UIcmdWithADouble::GetNewDoubleValue(val));
|
||||
else if(command == fSetPhotonDetReflectivityCmd)
|
||||
{
|
||||
fDetector->SetPhotonDetReflectivity(
|
||||
G4UIcmdWithADouble::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetWLSLengthCmd ) {
|
||||
|
||||
else if(command == fSetWLSLengthCmd)
|
||||
{
|
||||
fDetector->SetWLSLength(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetWLSRadiusCmd ) {
|
||||
|
||||
else if(command == fSetWLSRadiusCmd)
|
||||
{
|
||||
fDetector->SetWLSRadius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetClad1RadiusCmd ) {
|
||||
|
||||
fDetector->
|
||||
SetClad1Radius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
else if(command == fSetClad1RadiusCmd)
|
||||
{
|
||||
fDetector->SetClad1Radius(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetClad2RadiusCmd ) {
|
||||
|
||||
fDetector->
|
||||
SetClad2Radius(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
else if(command == fSetClad2RadiusCmd)
|
||||
{
|
||||
fDetector->SetClad2Radius(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetPhotonDetHalfLengthCmd ) {
|
||||
|
||||
fDetector->
|
||||
SetPhotonDetHalfLength(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
else if(command == fSetPhotonDetHalfLengthCmd)
|
||||
{
|
||||
fDetector->SetPhotonDetHalfLength(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetGapCmd ) {
|
||||
|
||||
fDetector->SetGap(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
else if(command == fSetGapCmd)
|
||||
{
|
||||
fDetector->SetGap(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetPhotonDetAlignmentCmd ) {
|
||||
|
||||
fDetector->
|
||||
SetPhotonDetAlignment(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
else if(command == fSetPhotonDetAlignmentCmd)
|
||||
{
|
||||
fDetector->SetPhotonDetAlignment(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetMirrorCmd ) {
|
||||
|
||||
fDetector->SetMirror(G4UIcmdWithABool::GetNewBoolValue(val));
|
||||
else if(command == fSetMirrorCmd)
|
||||
{
|
||||
fDetector->SetMirror(G4UIcmdWithABool::GetNewBoolValue(val));
|
||||
}
|
||||
else if( command == fSetBarLengthCmd ) {
|
||||
|
||||
fDetector->SetBarLength(G4UIcmdWithABool::GetNewBoolValue(val));
|
||||
else if(command == fSetBarLengthCmd)
|
||||
{
|
||||
fDetector->SetBarLength(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetBarBaseCmd ) {
|
||||
|
||||
fDetector->SetBarBase(G4UIcmdWithABool::GetNewBoolValue(val));
|
||||
else if(command == fSetBarBaseCmd)
|
||||
{
|
||||
fDetector->SetBarBase(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetHoleRadiusCmd ) {
|
||||
|
||||
fDetector->SetHoleRadius(G4UIcmdWithABool::GetNewBoolValue(val));
|
||||
else if(command == fSetHoleRadiusCmd)
|
||||
{
|
||||
fDetector->SetHoleRadius(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetCoatingThicknessCmd ) {
|
||||
|
||||
fDetector->SetCoatingThickness(G4UIcmdWithABool::GetNewBoolValue(val));
|
||||
else if(command == fSetCoatingThicknessCmd)
|
||||
{
|
||||
fDetector->SetCoatingThickness(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
else if( command == fSetCoatingRadiusCmd ) {
|
||||
|
||||
fDetector->SetCoatingRadius(G4UIcmdWithABool::GetNewBoolValue(val));
|
||||
else if(command == fSetCoatingRadiusCmd)
|
||||
{
|
||||
fDetector->SetCoatingRadius(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,21 +28,21 @@
|
||||
/// \brief Implementation of the WLSEventAction class
|
||||
//
|
||||
//
|
||||
|
||||
#include "WLSEventAction.hh"
|
||||
|
||||
#include "WLSRunAction.hh"
|
||||
|
||||
#include "WLSEventActionMessenger.hh"
|
||||
|
||||
#include "WLSPhotonDetHit.hh"
|
||||
#include "WLSRun.hh"
|
||||
#include "WLSRunAction.hh"
|
||||
#include "WLSTrajectory.hh"
|
||||
|
||||
#include "G4Event.hh"
|
||||
#include "G4EventManager.hh"
|
||||
#include "WLSTrajectory.hh"
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4TrajectoryContainer.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
// Purpose: Accumulates statistics regarding hits
|
||||
@@ -50,8 +50,8 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSEventAction::WLSEventAction(WLSRunAction* runaction)
|
||||
: fRunAction(runaction), fVerboseLevel(0)
|
||||
WLSEventAction::WLSEventAction()
|
||||
: fVerboseLevel(0)
|
||||
{
|
||||
fMPPCCollID = 0;
|
||||
|
||||
@@ -60,57 +60,87 @@ WLSEventAction::WLSEventAction(WLSRunAction* runaction)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSEventAction::~WLSEventAction()
|
||||
{
|
||||
delete fEventMessenger;
|
||||
}
|
||||
WLSEventAction::~WLSEventAction() { delete fEventMessenger; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSEventAction::BeginOfEventAction(const G4Event* evt)
|
||||
void WLSEventAction::BeginOfEventAction(const G4Event*)
|
||||
{
|
||||
G4int evtNb = evt->GetEventID();
|
||||
|
||||
if(fVerboseLevel>0)
|
||||
G4cout << "<<< Event " << evtNb << " started." << G4endl;
|
||||
fNTIR = 0;
|
||||
fNExiting = 0;
|
||||
fEscapedEnd = 0;
|
||||
fEscapedMid = 0;
|
||||
fBounce = 0;
|
||||
fWLSBounce = 0;
|
||||
fClad1Bounce = 0;
|
||||
fClad2Bounce = 0;
|
||||
fReflected = 0;
|
||||
fDetected = 0;
|
||||
fEscaped = 0;
|
||||
fMirror = 0;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
#include "G4Threading.hh"
|
||||
|
||||
void WLSEventAction::EndOfEventAction(const G4Event* evt)
|
||||
{
|
||||
if (fVerboseLevel>0)
|
||||
G4cout << "<<< Event " << evt->GetEventID() << " ended." << G4endl;
|
||||
|
||||
if (fRunAction->GetRndmFreq() == 2)
|
||||
{
|
||||
std::ostringstream os;
|
||||
os<<"endOfEvent_"<<G4Threading::G4GetThreadId()<<".rndm";
|
||||
G4Random::saveEngineStatus(os.str().c_str());
|
||||
}
|
||||
|
||||
// Get Hits from the detector if any
|
||||
G4SDManager * SDman = G4SDManager::GetSDMpointer();
|
||||
G4String colName = "PhotonDetHitCollection";
|
||||
fMPPCCollID = SDman->GetCollectionID(colName);
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
G4String colName = "PhotonDetHitCollection";
|
||||
fMPPCCollID = SDman->GetCollectionID(colName);
|
||||
|
||||
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
|
||||
WLSPhotonDetHitsCollection* mppcHC = 0;
|
||||
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
|
||||
WLSPhotonDetHitsCollection* mppcHC = nullptr;
|
||||
|
||||
// Get the hit collections
|
||||
if (HCE)
|
||||
if(HCE)
|
||||
{
|
||||
if (fMPPCCollID>=0) mppcHC =
|
||||
(WLSPhotonDetHitsCollection*)(HCE->GetHC(fMPPCCollID));
|
||||
if(fMPPCCollID >= 0)
|
||||
{
|
||||
mppcHC = (WLSPhotonDetHitsCollection*) (HCE->GetHC(fMPPCCollID));
|
||||
}
|
||||
}
|
||||
|
||||
// Get hit information about photons that reached the detector in this event
|
||||
if (mppcHC)
|
||||
G4int n_hit = 0;
|
||||
if(mppcHC)
|
||||
{
|
||||
// G4int n_hit = mppcHC->entries();
|
||||
n_hit = mppcHC->entries();
|
||||
}
|
||||
|
||||
if(fVerboseLevel > 1)
|
||||
{
|
||||
G4cout << "-------------------------------------" << G4endl
|
||||
<< " In this event, number of:" << G4endl
|
||||
<< " TIR: " << fNTIR << G4endl
|
||||
<< " Exiting: " << fNExiting << G4endl
|
||||
<< " Escaped Mid: " << fEscapedMid << G4endl
|
||||
<< " Escaped End: " << fEscapedEnd << G4endl
|
||||
<< " Bounced: " << fBounce << G4endl
|
||||
<< " WLS Bounce: " << fWLSBounce << G4endl
|
||||
<< " Clad1 Bounce: " << fClad1Bounce << G4endl
|
||||
<< " Clad2 Bounce: " << fClad2Bounce << G4endl
|
||||
<< " Reflected: " << fReflected << G4endl
|
||||
<< " Detected: " << fDetected << G4endl
|
||||
<< " Escaped: " << fEscaped << G4endl
|
||||
<< " Mirror: " << fMirror << G4endl
|
||||
<< " Detector hit: " << n_hit << G4endl;
|
||||
}
|
||||
|
||||
WLSRun* run = static_cast<WLSRun*>(
|
||||
G4RunManager::GetRunManager()->GetNonConstCurrentRun());
|
||||
|
||||
run->AddTIR(fNTIR);
|
||||
run->AddExiting(fNExiting);
|
||||
run->AddEscapedEnd(fEscapedEnd);
|
||||
run->AddEscapedMid(fEscapedMid);
|
||||
run->AddBounce(fBounce);
|
||||
run->AddClad1Bounce(fClad1Bounce);
|
||||
run->AddClad2Bounce(fClad2Bounce);
|
||||
run->AddReflected(fReflected);
|
||||
run->AddEscaped(fEscaped);
|
||||
run->AddMirror(fMirror);
|
||||
run->AddDetectorHits(n_hit);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -122,7 +152,4 @@ G4int WLSEventAction::GetEventNo()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSEventAction::SetEventVerbose(G4int level)
|
||||
{
|
||||
fVerboseLevel = level;
|
||||
}
|
||||
void WLSEventAction::SetEventVerbose(G4int level) { fVerboseLevel = level; }
|
||||
|
||||
@@ -28,36 +28,33 @@
|
||||
/// \brief Implementation of the WLSEventActionMessenger class
|
||||
//
|
||||
//
|
||||
#include "globals.hh"
|
||||
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "WLSEventActionMessenger.hh"
|
||||
|
||||
#include "WLSEventAction.hh"
|
||||
#include "WLSEventActionMessenger.hh"
|
||||
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSEventActionMessenger::WLSEventActionMessenger(WLSEventAction* eventaction)
|
||||
: fEventAction(eventaction)
|
||||
{
|
||||
fSetVerboseCmd = new G4UIcmdWithAnInteger("/event/setverbose",this);
|
||||
fSetVerboseCmd->SetGuidance("Set verbose level ." );
|
||||
fSetVerboseCmd->SetParameterName("level",true);
|
||||
fSetVerboseCmd = new G4UIcmdWithAnInteger("/WLS/eventVerbose", this);
|
||||
fSetVerboseCmd->SetGuidance("Set verbose level .");
|
||||
fSetVerboseCmd->SetParameterName("level", true);
|
||||
fSetVerboseCmd->SetDefaultValue(0);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSEventActionMessenger::~WLSEventActionMessenger()
|
||||
{
|
||||
delete fSetVerboseCmd;
|
||||
}
|
||||
WLSEventActionMessenger::~WLSEventActionMessenger() { delete fSetVerboseCmd; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSEventActionMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if (command == fSetVerboseCmd)
|
||||
if(command == fSetVerboseCmd)
|
||||
fEventAction->SetEventVerbose(fSetVerboseCmd->GetNewIntValue(newValue));
|
||||
}
|
||||
|
||||
@@ -30,16 +30,16 @@
|
||||
//
|
||||
#include "WLSMaterials.hh"
|
||||
|
||||
#include "G4NistManager.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
WLSMaterials* WLSMaterials::fInstance = 0;
|
||||
WLSMaterials* WLSMaterials::fInstance = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSMaterials::WLSMaterials()
|
||||
{
|
||||
fNistMan = G4NistManager::Instance();
|
||||
|
||||
fNistMan->SetVerbose(2);
|
||||
|
||||
CreateMaterials();
|
||||
@@ -49,21 +49,21 @@ WLSMaterials::WLSMaterials()
|
||||
|
||||
WLSMaterials::~WLSMaterials()
|
||||
{
|
||||
delete fPMMA;
|
||||
delete fPethylene;
|
||||
delete fFPethylene;
|
||||
delete fPolystyrene;
|
||||
delete fSilicone;
|
||||
delete fPMMA;
|
||||
delete fPethylene;
|
||||
delete fFPethylene;
|
||||
delete fPolystyrene;
|
||||
delete fSilicone;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSMaterials* WLSMaterials::GetInstance()
|
||||
{
|
||||
if (fInstance == 0)
|
||||
{
|
||||
fInstance = new WLSMaterials();
|
||||
}
|
||||
if(!fInstance)
|
||||
{
|
||||
fInstance = new WLSMaterials();
|
||||
}
|
||||
return fInstance;
|
||||
}
|
||||
|
||||
@@ -71,14 +71,15 @@ WLSMaterials* WLSMaterials::GetInstance()
|
||||
|
||||
G4Material* WLSMaterials::GetMaterial(const G4String material)
|
||||
{
|
||||
G4Material* mat = fNistMan->FindOrBuildMaterial(material);
|
||||
G4Material* mat = fNistMan->FindOrBuildMaterial(material);
|
||||
|
||||
if (!mat) mat = G4Material::GetMaterial(material);
|
||||
if (!mat) {
|
||||
std::ostringstream o;
|
||||
o << "Material " << material << " not found!";
|
||||
G4Exception("WLSMaterials::GetMaterial","",
|
||||
FatalException,o.str().c_str());
|
||||
if(!mat)
|
||||
mat = G4Material::GetMaterial(material);
|
||||
if(!mat)
|
||||
{
|
||||
G4ExceptionDescription ed;
|
||||
ed << "Material " << material << " not found!";
|
||||
G4Exception("WLSMaterials::GetMaterial", "", FatalException, ed);
|
||||
}
|
||||
|
||||
return mat;
|
||||
@@ -114,14 +115,16 @@ void WLSMaterials::CreateMaterials()
|
||||
// WLSfiber PMMA
|
||||
//--------------------------------------------------
|
||||
|
||||
elements.push_back("C"); natoms.push_back(5);
|
||||
elements.push_back("H"); natoms.push_back(8);
|
||||
elements.push_back("O"); natoms.push_back(2);
|
||||
elements.push_back("C");
|
||||
natoms.push_back(5);
|
||||
elements.push_back("H");
|
||||
natoms.push_back(8);
|
||||
elements.push_back("O");
|
||||
natoms.push_back(2);
|
||||
|
||||
density = 1.190*g/cm3;
|
||||
density = 1.190 * g / cm3;
|
||||
|
||||
fPMMA = fNistMan->
|
||||
ConstructNewMaterial("PMMA", elements, natoms, density);
|
||||
fPMMA = fNistMan->ConstructNewMaterial("PMMA", elements, natoms, density);
|
||||
|
||||
elements.clear();
|
||||
natoms.clear();
|
||||
@@ -130,13 +133,15 @@ void WLSMaterials::CreateMaterials()
|
||||
// Cladding (polyethylene)
|
||||
//--------------------------------------------------
|
||||
|
||||
elements.push_back("C"); natoms.push_back(2);
|
||||
elements.push_back("H"); natoms.push_back(4);
|
||||
elements.push_back("C");
|
||||
natoms.push_back(2);
|
||||
elements.push_back("H");
|
||||
natoms.push_back(4);
|
||||
|
||||
density = 1.200*g/cm3;
|
||||
density = 1.200 * g / cm3;
|
||||
|
||||
fPethylene = fNistMan->
|
||||
ConstructNewMaterial("Pethylene", elements, natoms, density);
|
||||
fPethylene =
|
||||
fNistMan->ConstructNewMaterial("Pethylene", elements, natoms, density);
|
||||
|
||||
elements.clear();
|
||||
natoms.clear();
|
||||
@@ -145,13 +150,15 @@ void WLSMaterials::CreateMaterials()
|
||||
// Double Cladding (fluorinated polyethylene)
|
||||
//--------------------------------------------------
|
||||
|
||||
elements.push_back("C"); natoms.push_back(2);
|
||||
elements.push_back("H"); natoms.push_back(4);
|
||||
elements.push_back("C");
|
||||
natoms.push_back(2);
|
||||
elements.push_back("H");
|
||||
natoms.push_back(4);
|
||||
|
||||
density = 1.400*g/cm3;
|
||||
density = 1.400 * g / cm3;
|
||||
|
||||
fFPethylene = fNistMan->
|
||||
ConstructNewMaterial("FPethylene", elements, natoms, density);
|
||||
fFPethylene =
|
||||
fNistMan->ConstructNewMaterial("FPethylene", elements, natoms, density);
|
||||
|
||||
elements.clear();
|
||||
natoms.clear();
|
||||
@@ -159,14 +166,16 @@ void WLSMaterials::CreateMaterials()
|
||||
//--------------------------------------------------
|
||||
// Polystyrene
|
||||
//--------------------------------------------------
|
||||
|
||||
elements.push_back("C"); natoms.push_back(8);
|
||||
elements.push_back("H"); natoms.push_back(8);
|
||||
|
||||
density = 1.050*g/cm3;
|
||||
elements.push_back("C");
|
||||
natoms.push_back(8);
|
||||
elements.push_back("H");
|
||||
natoms.push_back(8);
|
||||
|
||||
fPolystyrene = fNistMan->
|
||||
ConstructNewMaterial("Polystyrene", elements, natoms, density);
|
||||
density = 1.050 * g / cm3;
|
||||
|
||||
fPolystyrene =
|
||||
fNistMan->ConstructNewMaterial("Polystyrene", elements, natoms, density);
|
||||
|
||||
elements.clear();
|
||||
natoms.clear();
|
||||
@@ -175,13 +184,15 @@ void WLSMaterials::CreateMaterials()
|
||||
// Silicone (Template for Optical Grease)
|
||||
//--------------------------------------------------
|
||||
|
||||
elements.push_back("C"); natoms.push_back(2);
|
||||
elements.push_back("H"); natoms.push_back(6);
|
||||
|
||||
density = 1.060*g/cm3;
|
||||
elements.push_back("C");
|
||||
natoms.push_back(2);
|
||||
elements.push_back("H");
|
||||
natoms.push_back(6);
|
||||
|
||||
fSilicone = fNistMan->
|
||||
ConstructNewMaterial("Silicone", elements, natoms, density);
|
||||
density = 1.060 * g / cm3;
|
||||
|
||||
fSilicone =
|
||||
fNistMan->ConstructNewMaterial("Silicone", elements, natoms, density);
|
||||
|
||||
elements.clear();
|
||||
natoms.clear();
|
||||
@@ -196,13 +207,15 @@ void WLSMaterials::CreateMaterials()
|
||||
// TiO2
|
||||
//--------------------------------------------------
|
||||
|
||||
elements.push_back("Ti"); natoms.push_back(1);
|
||||
elements.push_back("O"); natoms.push_back(2);
|
||||
elements.push_back("Ti");
|
||||
natoms.push_back(1);
|
||||
elements.push_back("O");
|
||||
natoms.push_back(2);
|
||||
|
||||
density = 4.26*g/cm3;
|
||||
density = 4.26 * g / cm3;
|
||||
|
||||
G4Material* TiO2 = fNistMan->
|
||||
ConstructNewMaterial("TiO2", elements, natoms, density);
|
||||
G4Material* TiO2 =
|
||||
fNistMan->ConstructNewMaterial("TiO2", elements, natoms, density);
|
||||
|
||||
elements.clear();
|
||||
natoms.clear();
|
||||
@@ -211,47 +224,38 @@ void WLSMaterials::CreateMaterials()
|
||||
// Scintillator Coating - 15% TiO2 and 85% polystyrene by weight.
|
||||
//--------------------------------------------------
|
||||
|
||||
density = 1.52*g/cm3;
|
||||
density = 1.52 * g / cm3;
|
||||
|
||||
fCoating =
|
||||
new G4Material("Coating", density, ncomponents=2);
|
||||
fCoating = new G4Material("Coating", density, ncomponents = 2);
|
||||
|
||||
fCoating->AddMaterial(TiO2, fractionmass = 15*perCent);
|
||||
fCoating->AddMaterial(fPolystyrene, fractionmass = 85*perCent);
|
||||
fCoating->AddMaterial(TiO2, fractionmass = 15 * perCent);
|
||||
fCoating->AddMaterial(fPolystyrene, fractionmass = 85 * perCent);
|
||||
|
||||
//
|
||||
// ------------ Generate & Add Material Properties Table ------------
|
||||
//
|
||||
|
||||
G4double photonEnergy[] =
|
||||
{2.00*eV,2.03*eV,2.06*eV,2.09*eV,2.12*eV,
|
||||
2.15*eV,2.18*eV,2.21*eV,2.24*eV,2.27*eV,
|
||||
2.30*eV,2.33*eV,2.36*eV,2.39*eV,2.42*eV,
|
||||
2.45*eV,2.48*eV,2.51*eV,2.54*eV,2.57*eV,
|
||||
2.60*eV,2.63*eV,2.66*eV,2.69*eV,2.72*eV,
|
||||
2.75*eV,2.78*eV,2.81*eV,2.84*eV,2.87*eV,
|
||||
2.90*eV,2.93*eV,2.96*eV,2.99*eV,3.02*eV,
|
||||
3.05*eV,3.08*eV,3.11*eV,3.14*eV,3.17*eV,
|
||||
3.20*eV,3.23*eV,3.26*eV,3.29*eV,3.32*eV,
|
||||
3.35*eV,3.38*eV,3.41*eV,3.44*eV,3.47*eV};
|
||||
std::vector<G4double> energy = {
|
||||
2.00 * eV, 2.03 * eV, 2.06 * eV, 2.09 * eV, 2.12 * eV, 2.15 * eV, 2.18 * eV,
|
||||
2.21 * eV, 2.24 * eV, 2.27 * eV, 2.30 * eV, 2.33 * eV, 2.36 * eV, 2.39 * eV,
|
||||
2.42 * eV, 2.45 * eV, 2.48 * eV, 2.51 * eV, 2.54 * eV, 2.57 * eV, 2.60 * eV,
|
||||
2.63 * eV, 2.66 * eV, 2.69 * eV, 2.72 * eV, 2.75 * eV, 2.78 * eV, 2.81 * eV,
|
||||
2.84 * eV, 2.87 * eV, 2.90 * eV, 2.93 * eV, 2.96 * eV, 2.99 * eV, 3.02 * eV,
|
||||
3.05 * eV, 3.08 * eV, 3.11 * eV, 3.14 * eV, 3.17 * eV, 3.20 * eV, 3.23 * eV,
|
||||
3.26 * eV, 3.29 * eV, 3.32 * eV, 3.35 * eV, 3.38 * eV, 3.41 * eV, 3.44 * eV,
|
||||
3.47 * eV
|
||||
};
|
||||
|
||||
const G4int nEntries = sizeof(photonEnergy)/sizeof(G4double);
|
||||
std::vector<G4double> energySmall = { 2.0 * eV, 3.47 * eV };
|
||||
|
||||
//--------------------------------------------------
|
||||
// Air
|
||||
//--------------------------------------------------
|
||||
|
||||
G4double refractiveIndex[] =
|
||||
{ 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00,
|
||||
1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00, 1.00};
|
||||
|
||||
assert(sizeof(refractiveIndex) == sizeof(photonEnergy));
|
||||
std::vector<G4double> refractiveIndex = { 1.0, 1.0 };
|
||||
|
||||
G4MaterialPropertiesTable* mpt = new G4MaterialPropertiesTable();
|
||||
mpt->AddProperty("RINDEX", photonEnergy, refractiveIndex, nEntries);
|
||||
mpt->AddProperty("RINDEX", energySmall, refractiveIndex);
|
||||
|
||||
fAir->SetMaterialPropertiesTable(mpt);
|
||||
|
||||
@@ -259,41 +263,33 @@ void WLSMaterials::CreateMaterials()
|
||||
// PMMA for WLSfibers
|
||||
//--------------------------------------------------
|
||||
|
||||
G4double refractiveIndexWLSfiber[] =
|
||||
{ 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60,
|
||||
1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60,
|
||||
1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60,
|
||||
1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60,
|
||||
1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60, 1.60};
|
||||
std::vector<G4double> refractiveIndexWLSfiber = { 1.60, 1.60 };
|
||||
|
||||
assert(sizeof(refractiveIndexWLSfiber) == sizeof(photonEnergy));
|
||||
std::vector<G4double> absWLSfiber = {
|
||||
5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m,
|
||||
5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m,
|
||||
5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m,
|
||||
5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m, 5.40 * m,
|
||||
5.40 * m, 1.10 * m, 1.10 * m, 1.10 * m, 1.10 * m, 1.10 * m, 1.10 * m,
|
||||
1.10 * m, 1. * mm, 1. * mm, 1. * mm, 1. * mm, 1. * mm, 1. * mm,
|
||||
1. * mm, 1. * mm, 1. * mm, 1. * mm, 1. * mm, 1. * mm, 1. * mm,
|
||||
1. * mm
|
||||
};
|
||||
|
||||
G4double absWLSfiber[] =
|
||||
{5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,
|
||||
5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,
|
||||
5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,5.40*m,1.10*m,
|
||||
1.10*m,1.10*m,1.10*m,1.10*m,1.10*m,1.10*m, 1.*mm, 1.*mm, 1.*mm, 1.*mm,
|
||||
1.*mm, 1.*mm, 1.*mm, 1.*mm, 1.*mm, 1.*mm, 1.*mm, 1.*mm, 1.*mm, 1.*mm};
|
||||
|
||||
assert(sizeof(absWLSfiber) == sizeof(photonEnergy));
|
||||
|
||||
G4double emissionFib[] =
|
||||
{0.05, 0.10, 0.30, 0.50, 0.75, 1.00, 1.50, 1.85, 2.30, 2.75,
|
||||
3.25, 3.80, 4.50, 5.20, 6.00, 7.00, 8.50, 9.50, 11.1, 12.4,
|
||||
12.9, 13.0, 12.8, 12.3, 11.1, 11.0, 12.0, 11.0, 17.0, 16.9,
|
||||
15.0, 9.00, 2.50, 1.00, 0.05, 0.00, 0.00, 0.00, 0.00, 0.00,
|
||||
0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00};
|
||||
|
||||
assert(sizeof(emissionFib) == sizeof(photonEnergy));
|
||||
std::vector<G4double> emissionFib = {
|
||||
0.05, 0.10, 0.30, 0.50, 0.75, 1.00, 1.50, 1.85, 2.30, 2.75,
|
||||
3.25, 3.80, 4.50, 5.20, 6.00, 7.00, 8.50, 9.50, 11.1, 12.4,
|
||||
12.9, 13.0, 12.8, 12.3, 11.1, 11.0, 12.0, 11.0, 17.0, 16.9,
|
||||
15.0, 9.00, 2.50, 1.00, 0.05, 0.00, 0.00, 0.00, 0.00, 0.00,
|
||||
0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00, 0.00
|
||||
};
|
||||
|
||||
// Add entries into properties table
|
||||
G4MaterialPropertiesTable* mptWLSfiber = new G4MaterialPropertiesTable();
|
||||
mptWLSfiber->
|
||||
AddProperty("RINDEX",photonEnergy,refractiveIndexWLSfiber,nEntries);
|
||||
// mptWLSfiber->AddProperty("ABSLENGTH",photonEnergy,absWLSfiber,nEntries);
|
||||
mptWLSfiber->AddProperty("WLSABSLENGTH",photonEnergy,absWLSfiber,nEntries);
|
||||
mptWLSfiber->AddProperty("WLSCOMPONENT",photonEnergy,emissionFib,nEntries);
|
||||
mptWLSfiber->AddConstProperty("WLSTIMECONSTANT", 0.5*ns);
|
||||
mptWLSfiber->AddProperty("RINDEX", energySmall, refractiveIndexWLSfiber);
|
||||
mptWLSfiber->AddProperty("WLSABSLENGTH", energy, absWLSfiber);
|
||||
mptWLSfiber->AddProperty("WLSCOMPONENT", energy, emissionFib);
|
||||
mptWLSfiber->AddConstProperty("WLSTIMECONSTANT", 0.5 * ns);
|
||||
|
||||
fPMMA->SetMaterialPropertiesTable(mptWLSfiber);
|
||||
|
||||
@@ -301,28 +297,14 @@ void WLSMaterials::CreateMaterials()
|
||||
// Polyethylene
|
||||
//--------------------------------------------------
|
||||
|
||||
G4double refractiveIndexClad1[] =
|
||||
{ 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49,
|
||||
1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49,
|
||||
1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49,
|
||||
1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49,
|
||||
1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49, 1.49};
|
||||
std::vector<G4double> refractiveIndexClad1 = { 1.49, 1.49 };
|
||||
|
||||
assert(sizeof(refractiveIndexClad1) == sizeof(photonEnergy));
|
||||
|
||||
G4double absClad[] =
|
||||
{20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,
|
||||
20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,
|
||||
20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,
|
||||
20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,
|
||||
20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m,20.0*m};
|
||||
|
||||
assert(sizeof(absClad) == sizeof(photonEnergy));
|
||||
std::vector<G4double> absClad = { 20.0 * m, 20.0 * m };
|
||||
|
||||
// Add entries into properties table
|
||||
G4MaterialPropertiesTable* mptClad1 = new G4MaterialPropertiesTable();
|
||||
mptClad1->AddProperty("RINDEX",photonEnergy,refractiveIndexClad1,nEntries);
|
||||
mptClad1->AddProperty("ABSLENGTH",photonEnergy,absClad,nEntries);
|
||||
mptClad1->AddProperty("RINDEX", energySmall, refractiveIndexClad1);
|
||||
mptClad1->AddProperty("ABSLENGTH", energySmall, absClad);
|
||||
|
||||
fPethylene->SetMaterialPropertiesTable(mptClad1);
|
||||
|
||||
@@ -330,19 +312,12 @@ void WLSMaterials::CreateMaterials()
|
||||
// Fluorinated Polyethylene
|
||||
//--------------------------------------------------
|
||||
|
||||
G4double refractiveIndexClad2[] =
|
||||
{ 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42,
|
||||
1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42,
|
||||
1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42,
|
||||
1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42,
|
||||
1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42, 1.42};
|
||||
|
||||
assert(sizeof(refractiveIndexClad2) == sizeof(photonEnergy));
|
||||
std::vector<G4double> refractiveIndexClad2 = { 1.42, 1.42 };
|
||||
|
||||
// Add entries into properties table
|
||||
G4MaterialPropertiesTable* mptClad2 = new G4MaterialPropertiesTable();
|
||||
mptClad2->AddProperty("RINDEX",photonEnergy,refractiveIndexClad2,nEntries);
|
||||
mptClad2->AddProperty("ABSLENGTH",photonEnergy,absClad,nEntries);
|
||||
mptClad2->AddProperty("RINDEX", energySmall, refractiveIndexClad2);
|
||||
mptClad2->AddProperty("ABSLENGTH", energySmall, absClad);
|
||||
|
||||
fFPethylene->SetMaterialPropertiesTable(mptClad2);
|
||||
|
||||
@@ -350,20 +325,12 @@ void WLSMaterials::CreateMaterials()
|
||||
// Silicone
|
||||
//--------------------------------------------------
|
||||
|
||||
G4double refractiveIndexSilicone[] =
|
||||
{ 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46,
|
||||
1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46,
|
||||
1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46,
|
||||
1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46,
|
||||
1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46, 1.46};
|
||||
|
||||
assert(sizeof(refractiveIndexSilicone) == sizeof(photonEnergy));
|
||||
std::vector<G4double> refractiveIndexSilicone = { 1.46, 1.46 };
|
||||
|
||||
// Add entries into properties table
|
||||
G4MaterialPropertiesTable* mptSilicone = new G4MaterialPropertiesTable();
|
||||
mptSilicone->
|
||||
AddProperty("RINDEX",photonEnergy,refractiveIndexSilicone,nEntries);
|
||||
mptSilicone->AddProperty("ABSLENGTH",photonEnergy,absClad,nEntries);
|
||||
mptSilicone->AddProperty("RINDEX", energySmall, refractiveIndexSilicone);
|
||||
mptSilicone->AddProperty("ABSLENGTH", energySmall, absClad);
|
||||
|
||||
fSilicone->SetMaterialPropertiesTable(mptSilicone);
|
||||
|
||||
@@ -371,47 +338,28 @@ void WLSMaterials::CreateMaterials()
|
||||
// Polystyrene
|
||||
//--------------------------------------------------
|
||||
|
||||
G4double refractiveIndexPS[] =
|
||||
{ 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50,
|
||||
1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50,
|
||||
1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50,
|
||||
1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50,
|
||||
1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50, 1.50};
|
||||
std::vector<G4double> refractiveIndexPS = { 1.50, 1.50 };
|
||||
|
||||
assert(sizeof(refractiveIndexPS) == sizeof(photonEnergy));
|
||||
std::vector<G4double> absPS = { 2. * cm, 2. * cm };
|
||||
|
||||
G4double absPS[] =
|
||||
{2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,
|
||||
2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,
|
||||
2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,
|
||||
2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,
|
||||
2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm,2.*cm};
|
||||
|
||||
assert(sizeof(absPS) == sizeof(photonEnergy));
|
||||
|
||||
G4double scintilFast[] =
|
||||
{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
|
||||
|
||||
assert(sizeof(scintilFast) == sizeof(photonEnergy));
|
||||
std::vector<G4double> scintilFast = {
|
||||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
|
||||
0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0
|
||||
};
|
||||
|
||||
// Add entries into properties table
|
||||
G4MaterialPropertiesTable* mptPolystyrene = new G4MaterialPropertiesTable();
|
||||
mptPolystyrene->AddProperty("RINDEX",photonEnergy,refractiveIndexPS,nEntries);
|
||||
mptPolystyrene->AddProperty("ABSLENGTH",photonEnergy,absPS,nEntries);
|
||||
mptPolystyrene->
|
||||
AddProperty("FASTCOMPONENT",photonEnergy, scintilFast,nEntries);
|
||||
mptPolystyrene->AddConstProperty("SCINTILLATIONYIELD",10./keV);
|
||||
mptPolystyrene->AddConstProperty("RESOLUTIONSCALE",1.0);
|
||||
mptPolystyrene->AddConstProperty("FASTTIMECONSTANT", 10.*ns);
|
||||
|
||||
mptPolystyrene->AddProperty("RINDEX", energySmall, refractiveIndexPS);
|
||||
mptPolystyrene->AddProperty("ABSLENGTH", energySmall, absPS);
|
||||
mptPolystyrene->AddProperty("FASTCOMPONENT", energy, scintilFast);
|
||||
mptPolystyrene->AddConstProperty("SCINTILLATIONYIELD", 10. / keV);
|
||||
mptPolystyrene->AddConstProperty("RESOLUTIONSCALE", 1.0);
|
||||
mptPolystyrene->AddConstProperty("FASTTIMECONSTANT", 10. * ns);
|
||||
|
||||
fPolystyrene->SetMaterialPropertiesTable(mptPolystyrene);
|
||||
|
||||
// Set the Birks Constant for the Polystyrene scintillator
|
||||
|
||||
fPolystyrene->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
|
||||
|
||||
fPolystyrene->GetIonisation()->SetBirksConstant(0.126 * mm / MeV);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
//
|
||||
#include "WLSPhotonDetHit.hh"
|
||||
|
||||
G4ThreadLocal G4Allocator<WLSPhotonDetHit>* WLSPhotonDetHitAllocator=0;
|
||||
G4ThreadLocal G4Allocator<WLSPhotonDetHit>* WLSPhotonDetHitAllocator = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -43,8 +43,7 @@ WLSPhotonDetHit::WLSPhotonDetHit()
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSPhotonDetHit::WLSPhotonDetHit(G4ThreeVector pExit,
|
||||
G4ThreeVector pArrive,
|
||||
WLSPhotonDetHit::WLSPhotonDetHit(G4ThreeVector pExit, G4ThreeVector pArrive,
|
||||
G4double pTime)
|
||||
{
|
||||
fPosExit = pExit;
|
||||
@@ -54,11 +53,11 @@ WLSPhotonDetHit::WLSPhotonDetHit(G4ThreeVector pExit,
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSPhotonDetHit::~WLSPhotonDetHit() { }
|
||||
WLSPhotonDetHit::~WLSPhotonDetHit() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSPhotonDetHit::WLSPhotonDetHit(const WLSPhotonDetHit &right)
|
||||
WLSPhotonDetHit::WLSPhotonDetHit(const WLSPhotonDetHit& right)
|
||||
: G4VHit()
|
||||
{
|
||||
*this = right;
|
||||
@@ -66,7 +65,7 @@ WLSPhotonDetHit::WLSPhotonDetHit(const WLSPhotonDetHit &right)
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const WLSPhotonDetHit& WLSPhotonDetHit::operator=(const WLSPhotonDetHit &right)
|
||||
const WLSPhotonDetHit& WLSPhotonDetHit::operator=(const WLSPhotonDetHit& right)
|
||||
{
|
||||
fPosExit = right.fPosExit;
|
||||
fPosArrive = right.fPosArrive;
|
||||
@@ -79,7 +78,6 @@ const WLSPhotonDetHit& WLSPhotonDetHit::operator=(const WLSPhotonDetHit &right)
|
||||
|
||||
G4bool WLSPhotonDetHit::operator==(const WLSPhotonDetHit& right) const
|
||||
{
|
||||
return fPosExit == right.fPosExit &&
|
||||
fPosArrive == right.fPosArrive &&
|
||||
fArrivalTime == right.fArrivalTime;
|
||||
return fPosExit == right.fPosExit && fPosArrive == right.fPosArrive &&
|
||||
fArrivalTime == right.fArrivalTime;
|
||||
}
|
||||
|
||||
@@ -29,85 +29,92 @@
|
||||
//
|
||||
//
|
||||
#include "WLSPhotonDetSD.hh"
|
||||
|
||||
#include "WLSPhotonDetHit.hh"
|
||||
#include "WLSUserTrackInformation.hh"
|
||||
|
||||
#include "G4Track.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4OpticalPhoton.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4TouchableHistory.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4VTouchable.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSPhotonDetSD::WLSPhotonDetSD(G4String name)
|
||||
: G4VSensitiveDetector(name), fPhotonDetHitCollection(0)
|
||||
: G4VSensitiveDetector(name)
|
||||
, fPhotonDetHitCollection(nullptr)
|
||||
, fHCID(-1)
|
||||
{
|
||||
collectionName.insert("PhotonDetHitCollection");
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSPhotonDetSD::~WLSPhotonDetSD() { }
|
||||
WLSPhotonDetSD::~WLSPhotonDetSD() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSPhotonDetSD::Initialize(G4HCofThisEvent* HCE)
|
||||
{
|
||||
fPhotonDetHitCollection =
|
||||
new WLSPhotonDetHitsCollection(SensitiveDetectorName,collectionName[0]);
|
||||
//Store collection with event and keep ID
|
||||
static G4int HCID = -1;
|
||||
if (HCID<0) HCID = GetCollectionID(0);
|
||||
HCE->AddHitsCollection( HCID, fPhotonDetHitCollection );
|
||||
new WLSPhotonDetHitsCollection(SensitiveDetectorName, collectionName[0]);
|
||||
|
||||
if(fHCID < 0)
|
||||
{
|
||||
fHCID =
|
||||
G4SDManager::GetSDMpointer()->GetCollectionID(fPhotonDetHitCollection);
|
||||
}
|
||||
HCE->AddHitsCollection(fHCID, fPhotonDetHitCollection);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool WLSPhotonDetSD::ProcessHits(G4Step* , G4TouchableHistory* )
|
||||
G4bool WLSPhotonDetSD::ProcessHits(G4Step*, G4TouchableHistory*)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4bool WLSPhotonDetSD::ProcessHits_constStep(const G4Step* aStep,
|
||||
G4TouchableHistory* )
|
||||
//Generates a hit and uses the postStepPoint; PostStepPoint because the hit
|
||||
//is generated manually when the photon hits the detector
|
||||
G4bool WLSPhotonDetSD::ProcessHits_boundary(const G4Step* aStep,
|
||||
G4TouchableHistory*)
|
||||
// Generates a hit and uses the postStepPoint; PostStepPoint because the hit
|
||||
// is generated manually when the photon hits the detector
|
||||
{
|
||||
if (aStep == NULL) return false;
|
||||
if(!aStep)
|
||||
return false;
|
||||
G4Track* theTrack = aStep->GetTrack();
|
||||
|
||||
// Need to know if this is an optical photon
|
||||
if(theTrack->GetDefinition()
|
||||
!= G4OpticalPhoton::OpticalPhotonDefinition()) return false;
|
||||
if(theTrack->GetDefinition() != G4OpticalPhoton::OpticalPhotonDefinition())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Find out information regarding the hit
|
||||
G4StepPoint* thePostPoint = aStep->GetPostStepPoint();
|
||||
|
||||
WLSUserTrackInformation* trackInformation
|
||||
= (WLSUserTrackInformation*)theTrack->GetUserInformation();
|
||||
|
||||
G4TouchableHistory* theTouchable
|
||||
= (G4TouchableHistory*)(thePostPoint->GetTouchable());
|
||||
|
||||
G4ThreeVector photonExit = trackInformation -> GetExitPosition();
|
||||
G4ThreeVector photonArrive = thePostPoint -> GetPosition();
|
||||
G4double arrivalTime = theTrack -> GetGlobalTime();
|
||||
|
||||
WLSUserTrackInformation* trackInformation =
|
||||
(WLSUserTrackInformation*) theTrack->GetUserInformation();
|
||||
|
||||
G4TouchableHistory* theTouchable =
|
||||
(G4TouchableHistory*) (thePostPoint->GetTouchable());
|
||||
|
||||
G4ThreeVector photonExit = trackInformation->GetExitPosition();
|
||||
G4ThreeVector photonArrive = thePostPoint->GetPosition();
|
||||
G4double arrivalTime = theTrack->GetGlobalTime();
|
||||
|
||||
// Convert the global coordinate for arriving photons into
|
||||
// the local coordinate of the detector
|
||||
photonArrive = theTouchable->GetHistory()->
|
||||
GetTopTransform().TransformPoint(photonArrive);
|
||||
photonArrive =
|
||||
theTouchable->GetHistory()->GetTopTransform().TransformPoint(photonArrive);
|
||||
|
||||
// Creating the hit and add it to the collection
|
||||
fPhotonDetHitCollection->
|
||||
insert(new WLSPhotonDetHit(photonExit, photonArrive, arrivalTime));
|
||||
fPhotonDetHitCollection->insert(
|
||||
new WLSPhotonDetHit(photonExit, photonArrive, arrivalTime));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,31 +28,25 @@
|
||||
/// \brief Implementation of the WLSPrimaryGeneratorAction class
|
||||
//
|
||||
//
|
||||
#include "G4ios.hh"
|
||||
#include "G4Event.hh"
|
||||
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
|
||||
#include "G4Material.hh"
|
||||
#include "G4MaterialPropertiesTable.hh"
|
||||
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
#include "G4PhysicsTable.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "WLSPrimaryGeneratorAction.hh"
|
||||
|
||||
#include "WLSDetectorConstruction.hh"
|
||||
#include "WLSPrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "G4SystemOfUnits.hh"
|
||||
|
||||
#include "G4AutoLock.hh"
|
||||
#include "G4Event.hh"
|
||||
#include "G4GeneralParticleSource.hh"
|
||||
#include "G4Material.hh"
|
||||
#include "G4MaterialPropertiesTable.hh"
|
||||
#include "G4OpticalPhoton.hh"
|
||||
#include "G4PhysicsTable.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
namespace {
|
||||
namespace
|
||||
{
|
||||
G4Mutex gen_mutex = G4MUTEX_INITIALIZER;
|
||||
}
|
||||
|
||||
@@ -60,23 +54,18 @@ namespace {
|
||||
|
||||
G4bool WLSPrimaryGeneratorAction::fFirst = false;
|
||||
|
||||
WLSPrimaryGeneratorAction::
|
||||
WLSPrimaryGeneratorAction(WLSDetectorConstruction* dc)
|
||||
WLSPrimaryGeneratorAction::WLSPrimaryGeneratorAction(
|
||||
WLSDetectorConstruction* dc)
|
||||
{
|
||||
fDetector = dc;
|
||||
fIntegralTable = NULL;
|
||||
fDetector = dc;
|
||||
fIntegralTable = nullptr;
|
||||
|
||||
fParticleGun = new G4GeneralParticleSource();
|
||||
|
||||
|
||||
fGunMessenger = new WLSPrimaryGeneratorMessenger(this);
|
||||
|
||||
// G4String particleName;
|
||||
// G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
|
||||
|
||||
fTimeConstant = 0.;
|
||||
|
||||
// fParticleGun->SetParticleDefinition(particleTable->
|
||||
// FindParticle(particleName="opticalphoton"));
|
||||
fTimeConstant = 0.;
|
||||
fUseSampledEnergy = false;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -85,9 +74,10 @@ WLSPrimaryGeneratorAction::~WLSPrimaryGeneratorAction()
|
||||
{
|
||||
delete fParticleGun;
|
||||
delete fGunMessenger;
|
||||
if (fIntegralTable) {
|
||||
fIntegralTable->clearAndDestroy();
|
||||
delete fIntegralTable;
|
||||
if(fIntegralTable)
|
||||
{
|
||||
fIntegralTable->clearAndDestroy();
|
||||
delete fIntegralTable;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,102 +92,105 @@ void WLSPrimaryGeneratorAction::SetDecayTimeConstant(G4double time)
|
||||
|
||||
void WLSPrimaryGeneratorAction::BuildEmissionSpectrum()
|
||||
{
|
||||
if (fIntegralTable) return;
|
||||
if(fIntegralTable)
|
||||
return;
|
||||
|
||||
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
|
||||
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
|
||||
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
|
||||
|
||||
G4int numOfMaterials = G4Material::GetNumberOfMaterials();
|
||||
if(!fIntegralTable)
|
||||
fIntegralTable = new G4PhysicsTable(numOfMaterials);
|
||||
|
||||
if(!fIntegralTable)fIntegralTable = new G4PhysicsTable(numOfMaterials);
|
||||
for(G4int i = 0; i < numOfMaterials; ++i)
|
||||
{
|
||||
G4PhysicsOrderedFreeVector* vec = new G4PhysicsOrderedFreeVector();
|
||||
|
||||
for (G4int i=0 ; i < numOfMaterials; i++) {
|
||||
G4MaterialPropertiesTable* MPT =
|
||||
(*theMaterialTable)[i]->GetMaterialPropertiesTable();
|
||||
|
||||
G4PhysicsOrderedFreeVector* aPhysicsOrderedFreeVector =
|
||||
new G4PhysicsOrderedFreeVector();
|
||||
if(MPT)
|
||||
{
|
||||
G4MaterialPropertyVector* theWLSVector = MPT->GetProperty("WLSCOMPONENT");
|
||||
|
||||
G4Material* aMaterial = (*theMaterialTable)[i];
|
||||
if(theWLSVector)
|
||||
{
|
||||
G4double currentIN = (*theWLSVector)[0];
|
||||
if(currentIN >= 0.0)
|
||||
{
|
||||
G4double currentPM = theWLSVector->Energy(0);
|
||||
G4double currentCII = 0.0;
|
||||
vec->InsertValues(currentPM, currentCII);
|
||||
G4double prevPM = currentPM;
|
||||
G4double prevCII = currentCII;
|
||||
G4double prevIN = currentIN;
|
||||
|
||||
G4MaterialPropertiesTable* aMaterialPropertiesTable =
|
||||
aMaterial->GetMaterialPropertiesTable();
|
||||
|
||||
if (aMaterialPropertiesTable) {
|
||||
G4MaterialPropertyVector* theWLSVector =
|
||||
aMaterialPropertiesTable->GetProperty("WLSCOMPONENT");
|
||||
|
||||
if (theWLSVector) {
|
||||
G4double currentIN = (*theWLSVector)[0];
|
||||
if (currentIN >= 0.0) {
|
||||
G4double currentPM = theWLSVector->Energy(0);
|
||||
G4double currentCII = 0.0;
|
||||
aPhysicsOrderedFreeVector->
|
||||
InsertValues(currentPM , currentCII);
|
||||
G4double prevPM = currentPM;
|
||||
G4double prevCII = currentCII;
|
||||
G4double prevIN = currentIN;
|
||||
|
||||
for (size_t j = 1;
|
||||
j < theWLSVector->GetVectorLength();
|
||||
j++)
|
||||
{
|
||||
currentPM = theWLSVector->Energy(j);
|
||||
currentIN = (*theWLSVector)[j];
|
||||
currentCII = 0.5 * (prevIN + currentIN);
|
||||
currentCII = prevCII + (currentPM - prevPM) * currentCII;
|
||||
aPhysicsOrderedFreeVector->
|
||||
InsertValues(currentPM, currentCII);
|
||||
prevPM = currentPM;
|
||||
prevCII = currentCII;
|
||||
prevIN = currentIN;
|
||||
}
|
||||
}
|
||||
for(size_t j = 1; j < theWLSVector->GetVectorLength(); ++j)
|
||||
{
|
||||
currentPM = theWLSVector->Energy(j);
|
||||
currentIN = (*theWLSVector)[j];
|
||||
currentCII = 0.5 * (prevIN + currentIN);
|
||||
currentCII = prevCII + (currentPM - prevPM) * currentCII;
|
||||
vec->InsertValues(currentPM, currentCII);
|
||||
prevPM = currentPM;
|
||||
prevCII = currentCII;
|
||||
prevIN = currentIN;
|
||||
}
|
||||
}
|
||||
fIntegralTable->insertAt(i,aPhysicsOrderedFreeVector);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
fIntegralTable->insertAt(i, vec);
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
{
|
||||
if (!fFirst) {
|
||||
fFirst = true;
|
||||
BuildEmissionSpectrum();
|
||||
if(!fFirst)
|
||||
{
|
||||
fFirst = true;
|
||||
BuildEmissionSpectrum();
|
||||
}
|
||||
|
||||
#ifdef use_sampledEnergy
|
||||
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
|
||||
if(fUseSampledEnergy)
|
||||
{
|
||||
const G4MaterialTable* theMaterialTable = G4Material::GetMaterialTable();
|
||||
|
||||
G4double sampledEnergy = 3*eV;
|
||||
G4double sampledEnergy = 3. * eV;
|
||||
|
||||
for (size_t j=0 ; j<theMaterialTable->size() ; j++) {
|
||||
for(size_t j = 0; j < theMaterialTable->size(); ++j)
|
||||
{
|
||||
G4Material* fMaterial = (*theMaterialTable)[j];
|
||||
if (fMaterial->GetName() == "PMMA" ) {
|
||||
G4MaterialPropertiesTable* aMaterialPropertiesTable =
|
||||
fMaterial->GetMaterialPropertiesTable();
|
||||
const G4MaterialPropertyVector* WLSIntensity =
|
||||
aMaterialPropertiesTable->GetProperty("WLSCOMPONENT");
|
||||
if(fMaterial->GetName() == "PMMA")
|
||||
{
|
||||
auto WLSIntensity =
|
||||
fMaterial->GetMaterialPropertiesTable()->GetProperty("WLSCOMPONENT");
|
||||
|
||||
if (WLSIntensity) {
|
||||
G4int MaterialIndex = fMaterial->GetIndex();
|
||||
G4PhysicsOrderedFreeVector* WLSIntegral =
|
||||
(G4PhysicsOrderedFreeVector*)((*fIntegralTable)(MaterialIndex));
|
||||
if(WLSIntensity)
|
||||
{
|
||||
G4PhysicsOrderedFreeVector* WLSIntegral =
|
||||
(G4PhysicsOrderedFreeVector*) ((*fIntegralTable)(
|
||||
fMaterial->GetIndex()));
|
||||
|
||||
G4double CIImax = WLSIntegral->GetMaxValue();
|
||||
G4double CIIvalue = G4UniformRand()*CIImax;
|
||||
G4double CIImax = WLSIntegral->GetMaxValue();
|
||||
G4double CIIvalue = G4UniformRand() * CIImax;
|
||||
|
||||
sampledEnergy = WLSIntegral->GetEnergy(CIIvalue);
|
||||
}
|
||||
sampledEnergy = WLSIntegral->GetEnergy(CIIvalue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// this does not work.
|
||||
G4String cmd = "/gun/energy " + G4String(sampledEnergy / eV) + " eV";
|
||||
G4UImanager::GetUIpointer()->ApplyCommand(cmd);
|
||||
}
|
||||
|
||||
//fParticleGun->SetParticleEnergy(sampledEnergy);
|
||||
#endif
|
||||
// The code behind this line is not thread safe because polarization
|
||||
// and time are randomly selected and GPS properties are global
|
||||
|
||||
//The code behing this line is not thread safe because polarization
|
||||
//and time are randomly selected and GPS properties are global
|
||||
G4AutoLock l(&gen_mutex);
|
||||
if(fParticleGun->GetParticleDefinition()->GetParticleName()=="opticalphoton"){
|
||||
if(fParticleGun->GetParticleDefinition() == G4OpticalPhoton::Definition())
|
||||
{
|
||||
SetOptPhotonPolar();
|
||||
SetOptPhotonTime();
|
||||
}
|
||||
@@ -209,7 +202,7 @@ void WLSPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
|
||||
|
||||
void WLSPrimaryGeneratorAction::SetOptPhotonPolar()
|
||||
{
|
||||
G4double angle = G4UniformRand() * 360.0*deg;
|
||||
G4double angle = G4UniformRand() * 360.0 * deg;
|
||||
SetOptPhotonPolar(angle);
|
||||
}
|
||||
|
||||
@@ -217,31 +210,33 @@ void WLSPrimaryGeneratorAction::SetOptPhotonPolar()
|
||||
|
||||
void WLSPrimaryGeneratorAction::SetOptPhotonPolar(G4double angle)
|
||||
{
|
||||
if (fParticleGun->GetParticleDefinition()->GetParticleName()!="opticalphoton")
|
||||
if(fParticleGun->GetParticleDefinition()->GetParticleName() !=
|
||||
"opticalphoton")
|
||||
{
|
||||
G4cout << "-> warning from WLSPrimaryGeneratorAction::SetOptPhotonPolar()"
|
||||
<< ": the ParticleGun is not an opticalphoton" << G4endl;
|
||||
return;
|
||||
G4cout << "-> warning from WLSPrimaryGeneratorAction::SetOptPhotonPolar()"
|
||||
<< ": the ParticleGun is not an opticalphoton" << G4endl;
|
||||
return;
|
||||
}
|
||||
|
||||
G4ThreeVector normal (1., 0., 0.);
|
||||
G4ThreeVector normal(1., 0., 0.);
|
||||
G4ThreeVector kphoton = fParticleGun->GetParticleMomentumDirection();
|
||||
G4ThreeVector product = normal.cross(kphoton);
|
||||
G4double modul2 = product*product;
|
||||
G4double modul2 = product * product;
|
||||
|
||||
G4ThreeVector e_perpend (0., 0., 1.);
|
||||
if (modul2 > 0.) e_perpend = (1./std::sqrt(modul2))*product;
|
||||
G4ThreeVector e_paralle = e_perpend.cross(kphoton);
|
||||
G4ThreeVector e_perpend(0., 0., 1.);
|
||||
if(modul2 > 0.)
|
||||
e_perpend = (1. / std::sqrt(modul2)) * product;
|
||||
G4ThreeVector e_paralle = e_perpend.cross(kphoton);
|
||||
|
||||
G4ThreeVector polar = std::cos(angle)*e_paralle + std::sin(angle)*e_perpend;
|
||||
G4ThreeVector polar =
|
||||
std::cos(angle) * e_paralle + std::sin(angle) * e_perpend;
|
||||
fParticleGun->SetParticlePolarization(polar);
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSPrimaryGeneratorAction::SetOptPhotonTime()
|
||||
{
|
||||
G4double time = -std::log(G4UniformRand())*fTimeConstant;
|
||||
fParticleGun->SetParticleTime(time);
|
||||
G4double time = -std::log(G4UniformRand()) * fTimeConstant;
|
||||
fParticleGun->SetParticleTime(time);
|
||||
}
|
||||
|
||||
@@ -28,39 +28,45 @@
|
||||
/// \brief Implementation of the WLSPrimaryGeneratorMessenger class
|
||||
//
|
||||
//
|
||||
#include "G4UIdirectory.hh"
|
||||
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "WLSPrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "WLSPrimaryGeneratorAction.hh"
|
||||
#include "WLSPrimaryGeneratorMessenger.hh"
|
||||
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
#include "G4UIdirectory.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSPrimaryGeneratorMessenger::
|
||||
WLSPrimaryGeneratorMessenger(WLSPrimaryGeneratorAction* gun)
|
||||
WLSPrimaryGeneratorMessenger::WLSPrimaryGeneratorMessenger(
|
||||
WLSPrimaryGeneratorAction* gun)
|
||||
: fAction(gun)
|
||||
{
|
||||
fGunDir = new G4UIdirectory("/WLS/gun/");
|
||||
fGunDir->SetGuidance("WLSPrimaryGenerator control");
|
||||
|
||||
fSetPolarizationCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/gun/optPhotonPolar",this);
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/gun/optPhotonPolar", this);
|
||||
fSetPolarizationCmd->SetGuidance("Set linear polarization");
|
||||
fSetPolarizationCmd->SetGuidance(" angle w.r.t. (k,n) plane");
|
||||
fSetPolarizationCmd->SetParameterName("angle",true);
|
||||
fSetPolarizationCmd->SetParameterName("angle", true);
|
||||
fSetPolarizationCmd->SetUnitCategory("Angle");
|
||||
fSetPolarizationCmd->SetDefaultValue(0.);
|
||||
fSetPolarizationCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
|
||||
fSetDecayTimeConstantCmd =
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/gun/setDecayTimeConstant",this);
|
||||
new G4UIcmdWithADoubleAndUnit("/WLS/gun/setDecayTimeConstant", this);
|
||||
fSetDecayTimeConstantCmd->SetGuidance("Set the decay time constant");
|
||||
fSetDecayTimeConstantCmd->SetGuidance("for the starting time of each photon");
|
||||
fSetDecayTimeConstantCmd->SetParameterName("time_const",false);
|
||||
fSetDecayTimeConstantCmd->SetParameterName("time_const", false);
|
||||
fSetDecayTimeConstantCmd->SetUnitCategory("Time");
|
||||
fSetDecayTimeConstantCmd->SetRange("time_const>=0");
|
||||
fSetDecayTimeConstantCmd->AvailableForStates(G4State_Idle);
|
||||
|
||||
// fSetUseSampledEnergyCmd = new G4UIcmdWithABool("/WLS/gun/useSampledEnergy",
|
||||
// this); fSetUseSampledEnergyCmd->SetGuidance("Enable sampling of primary
|
||||
// energy."); fSetUseSampledEnergyCmd->SetGuidance("This is currently
|
||||
// disabled."); fSetUseSampledEnergyCmd->AvailableForStates();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -70,17 +76,21 @@ WLSPrimaryGeneratorMessenger::~WLSPrimaryGeneratorMessenger()
|
||||
delete fGunDir;
|
||||
delete fSetPolarizationCmd;
|
||||
delete fSetDecayTimeConstantCmd;
|
||||
// delete fSetUseSampledEnergyCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSPrimaryGeneratorMessenger::
|
||||
SetNewValue(G4UIcommand * command,G4String val)
|
||||
void WLSPrimaryGeneratorMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String val)
|
||||
{
|
||||
if ( command == fSetPolarizationCmd )
|
||||
fAction->
|
||||
SetOptPhotonPolar(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
else if ( command == fSetDecayTimeConstantCmd )
|
||||
fAction->
|
||||
SetDecayTimeConstant(G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
if(command == fSetPolarizationCmd)
|
||||
fAction->SetOptPhotonPolar(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
else if(command == fSetDecayTimeConstantCmd)
|
||||
fAction->SetDecayTimeConstant(
|
||||
G4UIcmdWithADoubleAndUnit::GetNewDoubleValue(val));
|
||||
// else if ( command == fSetUseSampledEnergyCmd )
|
||||
// fAction->
|
||||
// SetUseSampledEnergy(G4UIcmdWithABool::GetNewBoolValue(val));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,240 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file optical/wls/src/WLSRun.cc
|
||||
/// \brief Implementation of the WLSRun class
|
||||
//
|
||||
//
|
||||
|
||||
#include "WLSRun.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSRun::WLSRun()
|
||||
: G4Run()
|
||||
{
|
||||
fNTIR = 0.;
|
||||
fNTIR2 = 0.;
|
||||
fNExiting = 0.;
|
||||
fNExiting2 = 0.;
|
||||
fEscapedEnd = 0.;
|
||||
fEscapedEnd2 = 0.;
|
||||
fEscapedMid = 0.;
|
||||
fEscapedMid2 = 0.;
|
||||
fBounce = 0.;
|
||||
fBounce2 = 0.;
|
||||
fWLSBounce = 0.;
|
||||
fWLSBounce2 = 0.;
|
||||
fClad1Bounce = 0.;
|
||||
fClad1Bounce2 = 0.;
|
||||
fClad2Bounce = 0.;
|
||||
fClad2Bounce2 = 0.;
|
||||
fReflected = 0.;
|
||||
fReflected2 = 0.;
|
||||
fDetected = 0.;
|
||||
fDetected2 = 0.;
|
||||
fEscaped = 0.;
|
||||
fEscaped2 = 0.;
|
||||
fMirror = 0.;
|
||||
fMirror2 = 0.;
|
||||
fDetectorHits = 0.;
|
||||
fDetectorHits2 = 0.;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSRun::~WLSRun() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSRun::Merge(const G4Run* run)
|
||||
{
|
||||
const WLSRun* localRun = static_cast<const WLSRun*>(run);
|
||||
|
||||
fNTIR += localRun->fNTIR;
|
||||
fNTIR2 += localRun->fNTIR2;
|
||||
fNExiting += localRun->fNExiting;
|
||||
fNExiting2 += localRun->fNExiting2;
|
||||
fEscapedEnd += localRun->fEscapedEnd;
|
||||
fEscapedEnd2 += localRun->fEscapedEnd2;
|
||||
fEscapedMid += localRun->fEscapedMid;
|
||||
fEscapedMid2 += localRun->fEscapedMid2;
|
||||
fBounce += localRun->fBounce;
|
||||
fBounce2 += localRun->fBounce2;
|
||||
fWLSBounce += localRun->fWLSBounce;
|
||||
fWLSBounce2 += localRun->fWLSBounce2;
|
||||
fClad1Bounce += localRun->fClad1Bounce;
|
||||
fClad1Bounce2 += localRun->fClad1Bounce2;
|
||||
fClad2Bounce += localRun->fClad2Bounce;
|
||||
fClad2Bounce2 += localRun->fClad2Bounce2;
|
||||
fReflected += localRun->fReflected;
|
||||
fReflected2 += localRun->fReflected2;
|
||||
fDetected += localRun->fDetected;
|
||||
fDetected2 += localRun->fDetected2;
|
||||
fEscaped += localRun->fEscaped;
|
||||
fEscaped2 += localRun->fEscaped2;
|
||||
fMirror += localRun->fMirror;
|
||||
fMirror2 += localRun->fMirror2;
|
||||
fDetectorHits += localRun->fDetectorHits;
|
||||
fDetectorHits2 += localRun->fDetectorHits2;
|
||||
|
||||
G4Run::Merge(run);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSRun::EndOfRun()
|
||||
{
|
||||
if(numberOfEvent == 0)
|
||||
return;
|
||||
G4double TotNbofEvents = G4double(numberOfEvent);
|
||||
|
||||
fNTIR = fNTIR / TotNbofEvents;
|
||||
fNTIR2 = fNTIR2 / TotNbofEvents;
|
||||
G4double rmsTIR = fNTIR2 - fNTIR * fNTIR;
|
||||
if(rmsTIR > 0.)
|
||||
rmsTIR = std::sqrt(rmsTIR);
|
||||
else
|
||||
rmsTIR = 0.;
|
||||
|
||||
fNExiting = fNExiting / TotNbofEvents;
|
||||
fNExiting2 = fNExiting2 / TotNbofEvents;
|
||||
G4double rmsExiting = fNExiting2 - fNExiting * fNExiting;
|
||||
if(rmsExiting > 0.)
|
||||
rmsExiting = std::sqrt(rmsExiting);
|
||||
else
|
||||
rmsExiting = 0.;
|
||||
|
||||
fEscapedEnd = fEscapedEnd / TotNbofEvents;
|
||||
fEscapedEnd2 = fEscapedEnd2 / TotNbofEvents;
|
||||
G4double rmsEscapedEnd = fEscapedEnd2 - fEscapedEnd * fEscapedEnd;
|
||||
if(rmsEscapedEnd > 0.)
|
||||
rmsEscapedEnd = std::sqrt(rmsEscapedEnd);
|
||||
else
|
||||
rmsEscapedEnd = 0.;
|
||||
|
||||
fEscapedMid = fEscapedMid / TotNbofEvents;
|
||||
fEscapedMid2 = fEscapedMid2 / TotNbofEvents;
|
||||
G4double rmsEscapedMid = fEscapedMid2 - fEscapedMid * fEscapedMid;
|
||||
if(rmsEscapedMid > 0.)
|
||||
rmsEscapedMid = std::sqrt(rmsEscapedMid);
|
||||
else
|
||||
rmsEscapedMid = 0.;
|
||||
|
||||
fBounce = fBounce / TotNbofEvents;
|
||||
fBounce2 = fBounce2 / TotNbofEvents;
|
||||
G4double rmsBounce = fBounce2 - fBounce * fBounce;
|
||||
if(rmsBounce > 0.)
|
||||
rmsBounce = std::sqrt(rmsBounce);
|
||||
else
|
||||
rmsBounce = 0.;
|
||||
|
||||
fWLSBounce = fWLSBounce / TotNbofEvents;
|
||||
fWLSBounce2 = fWLSBounce2 / TotNbofEvents;
|
||||
G4double rmsWLSBounce = fWLSBounce2 - fWLSBounce * fWLSBounce;
|
||||
if(rmsWLSBounce > 0.)
|
||||
rmsWLSBounce = std::sqrt(rmsWLSBounce);
|
||||
else
|
||||
rmsWLSBounce = 0.;
|
||||
|
||||
fClad1Bounce = fClad1Bounce / TotNbofEvents;
|
||||
fClad1Bounce2 = fClad1Bounce2 / TotNbofEvents;
|
||||
G4double rmsClad1Bounce = fClad1Bounce2 - fClad1Bounce * fClad1Bounce;
|
||||
if(rmsClad1Bounce > 0.)
|
||||
rmsClad1Bounce = std::sqrt(rmsClad1Bounce);
|
||||
else
|
||||
rmsClad1Bounce = 0.;
|
||||
|
||||
fClad2Bounce = fClad2Bounce / TotNbofEvents;
|
||||
fClad2Bounce2 = fClad2Bounce2 / TotNbofEvents;
|
||||
G4double rmsClad2Bounce = fClad2Bounce2 - fClad2Bounce * fClad2Bounce;
|
||||
if(rmsClad2Bounce > 0.)
|
||||
rmsClad2Bounce = std::sqrt(rmsClad2Bounce);
|
||||
else
|
||||
rmsClad2Bounce = 0.;
|
||||
|
||||
fReflected = fReflected / TotNbofEvents;
|
||||
fReflected2 = fReflected2 / TotNbofEvents;
|
||||
G4double rmsReflected = fReflected2 - fReflected * fReflected;
|
||||
if(rmsReflected > 0.)
|
||||
rmsReflected = std::sqrt(rmsReflected);
|
||||
else
|
||||
rmsReflected = 0.;
|
||||
|
||||
fDetected = fDetected / TotNbofEvents;
|
||||
fDetected2 = fDetected2 / TotNbofEvents;
|
||||
G4double rmsDetected = fDetected2 - fDetected * fDetected;
|
||||
if(rmsDetected > 0.)
|
||||
rmsDetected = std::sqrt(rmsDetected);
|
||||
else
|
||||
rmsDetected = 0.;
|
||||
|
||||
fEscaped = fEscaped / TotNbofEvents;
|
||||
fEscaped2 = fEscaped2 / TotNbofEvents;
|
||||
G4double rmsEscaped = fEscaped2 - fEscaped * fEscaped;
|
||||
if(rmsEscaped > 0.)
|
||||
rmsEscaped = std::sqrt(rmsEscaped);
|
||||
else
|
||||
rmsEscaped = 0.;
|
||||
|
||||
fMirror = fMirror / TotNbofEvents;
|
||||
fMirror2 = fMirror2 / TotNbofEvents;
|
||||
G4double rmsMirror = fMirror2 - fMirror * fMirror;
|
||||
if(rmsMirror > 0.)
|
||||
rmsMirror = std::sqrt(rmsMirror);
|
||||
else
|
||||
rmsMirror = 0.;
|
||||
|
||||
fDetectorHits = fDetectorHits / TotNbofEvents;
|
||||
fDetectorHits2 = fDetectorHits2 / TotNbofEvents;
|
||||
G4double rmsDetectorHits = fDetectorHits2 - fDetectorHits * fDetectorHits;
|
||||
if(rmsDetectorHits > 0.)
|
||||
rmsDetectorHits = std::sqrt(rmsDetectorHits);
|
||||
else
|
||||
rmsDetectorHits = 0.;
|
||||
|
||||
G4int prec = G4cout.precision(3);
|
||||
G4cout << "\n ======================== run summary =====================\n";
|
||||
G4cout << "Average number per event:" << G4endl;
|
||||
G4cout << " TIR: " << fNTIR << " +- " << rmsTIR << G4endl
|
||||
<< " Exiting: " << fNExiting << " +- " << rmsExiting << G4endl
|
||||
<< " Escaped Mid: " << fEscapedMid << " +- " << rmsEscapedMid
|
||||
<< G4endl << " Escaped End: " << fEscapedEnd << " +- "
|
||||
<< rmsEscapedEnd << G4endl << " Bounced: " << fBounce << " +- "
|
||||
<< rmsBounce << G4endl << " WLS Bounce: " << fWLSBounce << " +- "
|
||||
<< rmsWLSBounce << G4endl << " Clad1 Bounce: " << fClad1Bounce
|
||||
<< " +- " << rmsClad1Bounce << G4endl
|
||||
<< " Clad2 Bounce: " << fClad2Bounce << " +- " << rmsClad2Bounce
|
||||
<< G4endl << " Reflected: " << fReflected << " +- " << rmsReflected
|
||||
<< G4endl << " Detected: " << fDetected << " +- " << rmsDetected
|
||||
<< G4endl << " Escaped: " << fEscaped << " +- " << rmsEscaped
|
||||
<< G4endl << " Mirror: " << fMirror << " +- " << rmsMirror
|
||||
<< G4endl << " Detector hit: " << fDetectorHits << " +- "
|
||||
<< rmsDetectorHits << G4endl;
|
||||
|
||||
G4cout << G4endl;
|
||||
G4cout.precision(prec);
|
||||
}
|
||||
@@ -28,68 +28,41 @@
|
||||
/// \brief Implementation of the WLSRunAction class
|
||||
//
|
||||
//
|
||||
|
||||
#include "WLSRunAction.hh"
|
||||
#include "WLSRunActionMessenger.hh"
|
||||
|
||||
#include "WLSDetectorConstruction.hh"
|
||||
#include "WLSRun.hh"
|
||||
#include "WLSSteppingAction.hh"
|
||||
|
||||
#include "G4Run.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "WLSDetectorConstruction.hh"
|
||||
#include "WLSSteppingAction.hh"
|
||||
|
||||
#include <ctime>
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSRunAction::WLSRunAction()
|
||||
: fSaveRndm(0), fAutoSeed(false)
|
||||
: fRun(nullptr)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSRunAction::~WLSRunAction() {}
|
||||
|
||||
G4Run* WLSRunAction::GenerateRun()
|
||||
{
|
||||
fRunMessenger = new WLSRunActionMessenger(this);
|
||||
fRun = new WLSRun();
|
||||
return fRun;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSRunAction::~WLSRunAction()
|
||||
{
|
||||
delete fRunMessenger;
|
||||
}
|
||||
void WLSRunAction::BeginOfRunAction(const G4Run*) {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSRunAction::BeginOfRunAction(const G4Run* aRun)
|
||||
void WLSRunAction::EndOfRunAction(const G4Run*)
|
||||
{
|
||||
G4cout << "### Run " << aRun->GetRunID() << " start." << G4endl;
|
||||
|
||||
G4RunManager::GetRunManager()->SetRandomNumberStore(false);
|
||||
|
||||
if (fAutoSeed) {
|
||||
// automatic (time-based) random seeds for each run
|
||||
G4cout << "*******************" << G4endl;
|
||||
G4cout << "*** AUTOSEED ON ***" << G4endl;
|
||||
G4cout << "*******************" << G4endl;
|
||||
long seeds[2];
|
||||
time_t systime = time(NULL);
|
||||
seeds[0] = (long) systime;
|
||||
seeds[1] = (long) (systime*G4UniformRand());
|
||||
G4Random::setTheSeeds(seeds);
|
||||
G4Random::showEngineStatus();
|
||||
} else {
|
||||
G4Random::showEngineStatus();
|
||||
}
|
||||
|
||||
if (fSaveRndm > 0) G4Random::saveEngineStatus("BeginOfRun.rndm");
|
||||
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSRunAction::EndOfRunAction(const G4Run* )
|
||||
{
|
||||
if (fSaveRndm == 1)
|
||||
{
|
||||
G4Random::showEngineStatus();
|
||||
G4Random::saveEngineStatus("endOfRun.rndm");
|
||||
}
|
||||
if(isMaster)
|
||||
fRun->EndOfRun();
|
||||
}
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
//
|
||||
// ********************************************************************
|
||||
// * License and Disclaimer *
|
||||
// * *
|
||||
// * The Geant4 software is copyright of the Copyright Holders of *
|
||||
// * the Geant4 Collaboration. It is provided under the terms and *
|
||||
// * conditions of the Geant4 Software License, included in the file *
|
||||
// * LICENSE and available at http://cern.ch/geant4/license . These *
|
||||
// * include a list of copyright holders. *
|
||||
// * *
|
||||
// * 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. Please see the license in the file LICENSE and URL above *
|
||||
// * for the full disclaimer and the limitation of liability. *
|
||||
// * *
|
||||
// * This code implementation is the result of the scientific and *
|
||||
// * technical work of the GEANT4 collaboration. *
|
||||
// * By using, copying, modifying or distributing the software (or *
|
||||
// * any work based on the software) you agree to acknowledge its *
|
||||
// * use in resulting scientific publications, and indicate your *
|
||||
// * acceptance of all terms of the Geant4 Software license. *
|
||||
// ********************************************************************
|
||||
//
|
||||
//
|
||||
/// \file optical/wls/src/WLSRunActionMessenger.cc
|
||||
/// \brief Implementation of the WLSRunActionMessenger class
|
||||
//
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "Randomize.hh"
|
||||
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#include "G4UIdirectory.hh"
|
||||
#include "G4UIcmdWithABool.hh"
|
||||
#include "G4UIcmdWithAString.hh"
|
||||
#include "G4UIcmdWithADouble.hh"
|
||||
#include "G4UIcmdWithAnInteger.hh"
|
||||
#include "G4UIcmdWithADoubleAndUnit.hh"
|
||||
|
||||
#include "WLSRunAction.hh"
|
||||
#include "WLSRunActionMessenger.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSRunActionMessenger::WLSRunActionMessenger(WLSRunAction* runaction)
|
||||
: fRunAction (runaction)
|
||||
{
|
||||
fRndmDir = new G4UIdirectory("/rndm/");
|
||||
fRndmDir->SetGuidance("Rndm status control.");
|
||||
|
||||
fRndmSaveCmd = new G4UIcmdWithAnInteger("/rndm/save",this);
|
||||
fRndmSaveCmd->
|
||||
SetGuidance("set frequency to save rndm status on external files.");
|
||||
fRndmSaveCmd->SetGuidance("freq = 0 not saved");
|
||||
fRndmSaveCmd->SetGuidance("freq > 0 saved on: beginOfRun.rndm");
|
||||
fRndmSaveCmd->SetGuidance("freq = 1 saved on: endOfRun.rndm");
|
||||
fRndmSaveCmd->SetGuidance("freq = 2 saved on: endOfEvent.rndm");
|
||||
fRndmSaveCmd->SetParameterName("frequency",false);
|
||||
fRndmSaveCmd->SetRange("frequency>=0 && frequency<=2");
|
||||
fRndmSaveCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fRndmReadCmd = new G4UIcmdWithAString("/rndm/read",this);
|
||||
fRndmReadCmd->SetGuidance("get rndm status from an external file.");
|
||||
fRndmReadCmd->SetParameterName("fileName",true);
|
||||
fRndmReadCmd->SetDefaultValue ("beginOfRun.rndm");
|
||||
fRndmReadCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
|
||||
fSetAutoSeedCmd = new G4UIcmdWithABool("/rndm/autoSeed",this);
|
||||
fSetAutoSeedCmd->SetGuidance("Switch on/off time-based random seeds");
|
||||
fSetAutoSeedCmd->SetGuidance(" true: run seeds determined by system time");
|
||||
fSetAutoSeedCmd->SetGuidance("false: use command 'random/resetEngineFrom'");
|
||||
fSetAutoSeedCmd->SetGuidance("Default = false");
|
||||
fSetAutoSeedCmd->SetParameterName("autoSeed", false);
|
||||
fSetAutoSeedCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSRunActionMessenger::~WLSRunActionMessenger()
|
||||
{
|
||||
delete fRndmDir; delete fRndmSaveCmd;
|
||||
delete fRndmReadCmd; delete fSetAutoSeedCmd;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSRunActionMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
|
||||
{
|
||||
if (command == fRndmSaveCmd)
|
||||
fRunAction->SetRndmFreq(fRndmSaveCmd->GetNewIntValue(newValue));
|
||||
|
||||
if (command == fRndmReadCmd)
|
||||
{ G4cout << "\n---> rndm status restored from file: " << newValue << G4endl;
|
||||
G4Random::restoreEngineStatus(newValue);
|
||||
G4Random::showEngineStatus();
|
||||
}
|
||||
|
||||
if(command == fSetAutoSeedCmd)
|
||||
fRunAction->SetAutoSeed(fSetAutoSeedCmd->GetNewBoolValue(newValue));
|
||||
}
|
||||
@@ -30,44 +30,49 @@
|
||||
//
|
||||
#include "WLSStackingAction.hh"
|
||||
|
||||
#include "G4OpticalPhoton.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "G4Track.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSStackingAction::WLSStackingAction() : fPhotonCounter(0) { }
|
||||
WLSStackingAction::WLSStackingAction()
|
||||
: fPhotonCounter(0)
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSStackingAction::~WLSStackingAction() { }
|
||||
WLSStackingAction::~WLSStackingAction() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ClassificationOfNewTrack
|
||||
WLSStackingAction::ClassifyNewTrack(const G4Track * aTrack)
|
||||
G4ClassificationOfNewTrack WLSStackingAction::ClassifyNewTrack(
|
||||
const G4Track* aTrack)
|
||||
{
|
||||
G4ParticleDefinition* particleType = aTrack->GetDefinition();
|
||||
|
||||
// keep primary particle
|
||||
if (aTrack->GetParentID() == 0) return fUrgent;
|
||||
if(aTrack->GetParentID() == 0)
|
||||
return fUrgent;
|
||||
|
||||
if (particleType == G4OpticalPhoton::OpticalPhotonDefinition()) {
|
||||
// keep optical photon
|
||||
fPhotonCounter++;
|
||||
return fUrgent;
|
||||
} else {
|
||||
// discard all other secondaries
|
||||
// return fKill;
|
||||
if(particleType == G4OpticalPhoton::OpticalPhotonDefinition())
|
||||
{
|
||||
// keep optical photon
|
||||
++fPhotonCounter;
|
||||
return fUrgent;
|
||||
}
|
||||
else
|
||||
{
|
||||
// discard all other secondaries
|
||||
// return fKill;
|
||||
}
|
||||
return fUrgent;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSStackingAction::NewStage() {
|
||||
void WLSStackingAction::NewStage()
|
||||
{
|
||||
// G4cout << "Number of optical photons produces in this event : "
|
||||
// << fPhotonCounter << G4endl;
|
||||
}
|
||||
|
||||
@@ -28,116 +28,86 @@
|
||||
/// \brief Implementation of the WLSSteppingAction class
|
||||
//
|
||||
//
|
||||
#include "G4Run.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
#include "G4TrackStatus.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
#include "G4ParticleDefinition.hh"
|
||||
|
||||
#include "WLSSteppingAction.hh"
|
||||
|
||||
#include "WLSDetectorConstruction.hh"
|
||||
#include "WLSSteppingActionMessenger.hh"
|
||||
#include "WLSEventAction.hh"
|
||||
#include "WLSPhotonDetSD.hh"
|
||||
|
||||
#include "G4ParticleTypes.hh"
|
||||
|
||||
#include "WLSSteppingActionMessenger.hh"
|
||||
#include "WLSUserTrackInformation.hh"
|
||||
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4OpBoundaryProcess.hh"
|
||||
|
||||
#include "G4RunManager.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4UImanager.hh"
|
||||
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4ios.hh"
|
||||
#include "G4OpBoundaryProcess.hh"
|
||||
#include "G4OpticalPhoton.hh"
|
||||
#include "G4ProcessManager.hh"
|
||||
#include "G4Run.hh"
|
||||
#include "G4SDManager.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4StepPoint.hh"
|
||||
#include "G4SystemOfUnits.hh"
|
||||
#include <sstream>
|
||||
#include "G4ThreeVector.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4TrackStatus.hh"
|
||||
#include "G4UImanager.hh"
|
||||
#include "G4VPhysicalVolume.hh"
|
||||
|
||||
// Purpose: Save relevant information into User Track Information
|
||||
|
||||
static const G4ThreeVector ZHat = G4ThreeVector(0.0,0.0,1.0);
|
||||
|
||||
G4int WLSSteppingAction::fMaxRndmSave = 10000;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSSteppingAction::WLSSteppingAction(WLSDetectorConstruction* detector)
|
||||
WLSSteppingAction::WLSSteppingAction(WLSDetectorConstruction* detector,
|
||||
WLSEventAction* event)
|
||||
: fDetector(detector)
|
||||
, fEventAction(event)
|
||||
{
|
||||
fSteppingMessenger = new WLSSteppingActionMessenger(this);
|
||||
|
||||
fCounterEnd = 0;
|
||||
fCounterMid = 0;
|
||||
fCounterEnd = 0;
|
||||
fCounterMid = 0;
|
||||
fBounceLimit = 100000;
|
||||
|
||||
fOpProcess = NULL;
|
||||
|
||||
fOpProcess = nullptr;
|
||||
|
||||
ResetCounters();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSSteppingAction::~WLSSteppingAction()
|
||||
WLSSteppingAction::~WLSSteppingAction() { delete fSteppingMessenger; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSSteppingAction::SetBounceLimit(G4int i) { fBounceLimit = i; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int WLSSteppingAction::GetNumberOfBounces() { return fCounterBounce; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int WLSSteppingAction::GetNumberOfClad1Bounces()
|
||||
{
|
||||
delete fSteppingMessenger;
|
||||
return fCounterClad1Bounce;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSSteppingAction::SetBounceLimit(G4int i) {fBounceLimit = i;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int WLSSteppingAction::GetNumberOfBounces() {return fCounterBounce;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int WLSSteppingAction::GetNumberOfClad1Bounces() {return fCounterClad1Bounce;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int WLSSteppingAction::GetNumberOfClad2Bounces() {return fCounterClad2Bounce;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int WLSSteppingAction::GetNumberOfWLSBounces() {return fCounterWLSBounce;}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int WLSSteppingAction::ResetSuccessCounter() {
|
||||
G4int temp = fCounterEnd; fCounterEnd = 0; return temp;
|
||||
G4int WLSSteppingAction::GetNumberOfClad2Bounces()
|
||||
{
|
||||
return fCounterClad2Bounce;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
inline void WLSSteppingAction::SaveRandomStatus(G4String subDir)
|
||||
// save the random status into a sub-directory
|
||||
// Pre: subDir must be empty or ended with "/"
|
||||
G4int WLSSteppingAction::GetNumberOfWLSBounces() { return fCounterWLSBounce; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4int WLSSteppingAction::ResetSuccessCounter()
|
||||
{
|
||||
|
||||
// don't save if the maximum amount has been reached
|
||||
if (WLSSteppingAction::fMaxRndmSave == 0) return;
|
||||
|
||||
G4RunManager* theRunManager = G4RunManager::GetRunManager();
|
||||
G4String randomNumberStatusDir = theRunManager->GetRandomNumberStoreDir();
|
||||
|
||||
G4String fileIn = randomNumberStatusDir + "currentEvent.rndm";
|
||||
|
||||
std::ostringstream os;
|
||||
|
||||
os << "run" << theRunManager->GetCurrentRun()->GetRunID() << "evt"
|
||||
<< theRunManager->GetCurrentEvent()->GetEventID() << ".rndm" << '\0';
|
||||
|
||||
G4String fileOut = randomNumberStatusDir + subDir + os.str();
|
||||
|
||||
G4String copCmd = "/control/shell cp "+fileIn+" "+fileOut;
|
||||
G4UImanager::GetUIpointer()->ApplyCommand(copCmd);
|
||||
|
||||
WLSSteppingAction::fMaxRndmSave--;
|
||||
G4int temp = fCounterEnd;
|
||||
fCounterEnd = 0;
|
||||
return temp;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -145,8 +115,8 @@ inline void WLSSteppingAction::SaveRandomStatus(G4String subDir)
|
||||
void WLSSteppingAction::UserSteppingAction(const G4Step* theStep)
|
||||
{
|
||||
G4Track* theTrack = theStep->GetTrack();
|
||||
WLSUserTrackInformation* trackInformation
|
||||
= (WLSUserTrackInformation*)theTrack->GetUserInformation();
|
||||
WLSUserTrackInformation* trackInformation =
|
||||
(WLSUserTrackInformation*) theTrack->GetUserInformation();
|
||||
|
||||
G4StepPoint* thePrePoint = theStep->GetPreStepPoint();
|
||||
G4StepPoint* thePostPoint = theStep->GetPostStepPoint();
|
||||
@@ -157,209 +127,238 @@ void WLSSteppingAction::UserSteppingAction(const G4Step* theStep)
|
||||
G4String thePrePVname = " ";
|
||||
G4String thePostPVname = " ";
|
||||
|
||||
if (thePostPV) {
|
||||
thePrePVname = thePrePV->GetName();
|
||||
thePostPVname = thePostPV->GetName();
|
||||
if(thePostPV)
|
||||
{
|
||||
thePrePVname = thePrePV->GetName();
|
||||
thePostPVname = thePostPV->GetName();
|
||||
}
|
||||
|
||||
//Recording data for start
|
||||
if (theTrack->GetParentID()==0) {
|
||||
//This is a primary track
|
||||
if ( theTrack->GetCurrentStepNumber() == 1 ) {
|
||||
// G4double x = theTrack->GetVertexPosition().x();
|
||||
// G4double y = theTrack->GetVertexPosition().y();
|
||||
// G4double z = theTrack->GetVertexPosition().z();
|
||||
// G4double pz = theTrack->GetVertexMomentumDirection().z();
|
||||
// G4double fInitTheta =
|
||||
// theTrack->GetVertexMomentumDirection().angle(ZHat);
|
||||
}
|
||||
// Recording data for start
|
||||
// static const G4ThreeVector ZHat = G4ThreeVector(0.0,0.0,1.0);
|
||||
if(theTrack->GetParentID() == 0)
|
||||
{
|
||||
// This is a primary track
|
||||
if(theTrack->GetCurrentStepNumber() == 1)
|
||||
{
|
||||
// G4double x = theTrack->GetVertexPosition().x();
|
||||
// G4double y = theTrack->GetVertexPosition().y();
|
||||
// G4double z = theTrack->GetVertexPosition().z();
|
||||
// G4double pz = theTrack->GetVertexMomentumDirection().z();
|
||||
// G4double fInitTheta =
|
||||
// theTrack->GetVertexMomentumDirection().angle(ZHat);
|
||||
}
|
||||
}
|
||||
|
||||
// Retrieve the status of the photon
|
||||
G4OpBoundaryProcessStatus theStatus = Undefined;
|
||||
|
||||
G4ProcessManager* OpManager =
|
||||
G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
|
||||
static G4ThreadLocal G4ProcessManager* OpManager =
|
||||
G4OpticalPhoton::OpticalPhoton()->GetProcessManager();
|
||||
|
||||
if (OpManager) {
|
||||
G4int MAXofPostStepLoops =
|
||||
OpManager->GetPostStepProcessVector()->entries();
|
||||
G4ProcessVector* fPostStepDoItVector =
|
||||
OpManager->GetPostStepProcessVector(typeDoIt);
|
||||
if(OpManager)
|
||||
{
|
||||
G4int nproc = OpManager->GetPostStepProcessVector()->entries();
|
||||
G4ProcessVector* fPostStepDoItVector =
|
||||
OpManager->GetPostStepProcessVector(typeDoIt);
|
||||
|
||||
for ( G4int i=0; i<MAXofPostStepLoops; i++) {
|
||||
G4VProcess* fCurrentProcess = (*fPostStepDoItVector)[i];
|
||||
fOpProcess = dynamic_cast<G4OpBoundaryProcess*>(fCurrentProcess);
|
||||
if (fOpProcess) { theStatus = fOpProcess->GetStatus(); break;}
|
||||
}
|
||||
for(G4int i = 0; i < nproc; ++i)
|
||||
{
|
||||
G4VProcess* fCurrentProcess = (*fPostStepDoItVector)[i];
|
||||
fOpProcess = dynamic_cast<G4OpBoundaryProcess*>(fCurrentProcess);
|
||||
if(fOpProcess)
|
||||
{
|
||||
theStatus = fOpProcess->GetStatus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find the skewness of the ray at first change of boundary
|
||||
if ( fInitGamma == -1 &&
|
||||
(theStatus == TotalInternalReflection
|
||||
|| theStatus == FresnelReflection
|
||||
|| theStatus == FresnelRefraction)
|
||||
&& trackInformation->IsStatus(InsideOfFiber) ) {
|
||||
if(fInitGamma == -1 &&
|
||||
(theStatus == TotalInternalReflection || theStatus == FresnelReflection ||
|
||||
theStatus == FresnelRefraction) &&
|
||||
trackInformation->IsStatus(InsideOfFiber))
|
||||
{
|
||||
G4double px = theTrack->GetVertexMomentumDirection().x();
|
||||
G4double py = theTrack->GetVertexMomentumDirection().y();
|
||||
G4double x = theTrack->GetPosition().x();
|
||||
G4double y = theTrack->GetPosition().y();
|
||||
|
||||
G4double px = theTrack->GetVertexMomentumDirection().x();
|
||||
G4double py = theTrack->GetVertexMomentumDirection().y();
|
||||
G4double x = theTrack->GetPosition().x();
|
||||
G4double y = theTrack->GetPosition().y();
|
||||
fInitGamma = x * px + y * py;
|
||||
|
||||
fInitGamma = x * px + y * py;
|
||||
fInitGamma =
|
||||
fInitGamma / std::sqrt(px * px + py * py) / std::sqrt(x * x + y * y);
|
||||
|
||||
fInitGamma =
|
||||
fInitGamma / std::sqrt(px*px + py*py) / std::sqrt(x*x + y*y);
|
||||
fInitGamma = std::acos(fInitGamma * rad);
|
||||
|
||||
fInitGamma = std::acos(fInitGamma*rad);
|
||||
|
||||
if ( fInitGamma / deg > 90.0) { fInitGamma = 180 * deg - fInitGamma;}
|
||||
if(fInitGamma / deg > 90.0)
|
||||
{
|
||||
fInitGamma = 180 * deg - fInitGamma;
|
||||
}
|
||||
}
|
||||
// Record Photons that missed the photon detector but escaped from readout
|
||||
if ( !thePostPV && trackInformation->IsStatus(EscapedFromReadOut) ) {
|
||||
// UpdateHistogramSuccess(thePostPoint,theTrack);
|
||||
ResetCounters();
|
||||
|
||||
return;
|
||||
if(!thePostPV && trackInformation->IsStatus(EscapedFromReadOut))
|
||||
{
|
||||
G4cout << "SteppingAction: status = EscapedFromReadOut" << G4endl;
|
||||
fEventAction->AddEscaped();
|
||||
// UpdateHistogramSuccess(thePostPoint,theTrack);
|
||||
ResetCounters();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Assumed photons are originated at the fiber OR
|
||||
// the fiber is the first material the photon hits
|
||||
switch (theStatus) {
|
||||
|
||||
// Exiting the fiber
|
||||
case FresnelRefraction:
|
||||
case SameMaterial:
|
||||
|
||||
G4bool isFiber;
|
||||
isFiber = thePostPVname == "WLSFiber"
|
||||
|| thePostPVname == "Clad1"
|
||||
|| thePostPVname == "Clad2";
|
||||
|
||||
if ( isFiber ) {
|
||||
|
||||
if (trackInformation->IsStatus(OutsideOfFiber))
|
||||
trackInformation->AddStatusFlag(InsideOfFiber);
|
||||
|
||||
// Set the Exit flag when the photon refracted out of the fiber
|
||||
} else if (trackInformation->IsStatus(InsideOfFiber)) {
|
||||
|
||||
// EscapedFromReadOut if the z position is the same as fiber's end
|
||||
if (theTrack->GetPosition().z() == fDetector->GetWLSFiberEnd())
|
||||
{
|
||||
trackInformation->AddStatusFlag(EscapedFromReadOut);
|
||||
fCounterEnd++;
|
||||
}
|
||||
else // Escaped from side
|
||||
{
|
||||
trackInformation->AddStatusFlag(EscapedFromSide);
|
||||
trackInformation->SetExitPosition(theTrack->GetPosition());
|
||||
|
||||
// UpdateHistogramEscape(thePostPoint,theTrack);
|
||||
|
||||
fCounterMid++;
|
||||
ResetCounters();
|
||||
}
|
||||
|
||||
trackInformation->AddStatusFlag(OutsideOfFiber);
|
||||
trackInformation->SetExitPosition(theTrack->GetPosition());
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
// Internal Reflections
|
||||
case TotalInternalReflection:
|
||||
|
||||
// Kill the track if it's number of bounces exceeded the limit
|
||||
if (fBounceLimit > 0 && fCounterBounce >= fBounceLimit)
|
||||
{
|
||||
theTrack->SetTrackStatus(fStopAndKill);
|
||||
trackInformation->AddStatusFlag(murderee);
|
||||
ResetCounters();
|
||||
G4cout << "\n Bounce Limit Exceeded" << G4endl;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case FresnelReflection:
|
||||
|
||||
fCounterBounce++;
|
||||
|
||||
if ( thePrePVname == "WLSFiber") fCounterWLSBounce++;
|
||||
|
||||
else if ( thePrePVname == "Clad1") fCounterClad1Bounce++;
|
||||
|
||||
else if ( thePrePVname == "Clad2") fCounterClad2Bounce++;
|
||||
|
||||
// Determine if the photon has reflected off the read-out end
|
||||
if (theTrack->GetPosition().z() == fDetector->GetWLSFiberEnd())
|
||||
{
|
||||
if (!trackInformation->IsStatus(ReflectedAtReadOut) &&
|
||||
trackInformation->IsStatus(InsideOfFiber))
|
||||
{
|
||||
trackInformation->AddStatusFlag(ReflectedAtReadOut);
|
||||
|
||||
if (fDetector->IsPerfectFiber() &&
|
||||
theStatus == TotalInternalReflection)
|
||||
{
|
||||
theTrack->SetTrackStatus(fStopAndKill);
|
||||
trackInformation->AddStatusFlag(murderee);
|
||||
// UpdateHistogramReflect(thePostPoint,theTrack);
|
||||
ResetCounters();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
// Reflection of the mirror
|
||||
case LambertianReflection:
|
||||
case LobeReflection:
|
||||
case SpikeReflection:
|
||||
|
||||
// Check if it hits the mirror
|
||||
if ( thePostPVname == "Mirror" )
|
||||
trackInformation->AddStatusFlag(ReflectedAtMirror);
|
||||
|
||||
return;
|
||||
|
||||
// Detected by a detector
|
||||
case Detection:
|
||||
|
||||
// Check if the photon hits the detector and process the hit if it does
|
||||
if ( thePostPVname == "PhotonDet" ) {
|
||||
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
G4String SDname="WLS/PhotonDet";
|
||||
WLSPhotonDetSD* mppcSD =
|
||||
(WLSPhotonDetSD*)SDman->FindSensitiveDetector(SDname);
|
||||
|
||||
if (mppcSD) mppcSD->ProcessHits_constStep(theStep,NULL);
|
||||
|
||||
// Record Photons that escaped at the end
|
||||
// if (trackInformation->IsStatus(EscapedFromReadOut))
|
||||
// UpdateHistogramSuccess(thePostPoint,theTrack);
|
||||
|
||||
// Stop Tracking when it hits the detector's surface
|
||||
ResetCounters();
|
||||
theTrack->SetTrackStatus(fStopAndKill);
|
||||
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default: break;
|
||||
|
||||
}
|
||||
|
||||
// Check for absorbed photons
|
||||
if (theTrack->GetTrackStatus() != fAlive &&
|
||||
trackInformation->IsStatus(InsideOfFiber))
|
||||
switch(theStatus)
|
||||
{
|
||||
// UpdateHistogramAbsorb(thePostPoint,theTrack);
|
||||
ResetCounters();
|
||||
return;
|
||||
// Exiting the fiber
|
||||
case FresnelRefraction:
|
||||
case SameMaterial:
|
||||
fEventAction->AddExiting();
|
||||
|
||||
if(thePostPVname == "WLSFiber" || thePostPVname == "Clad1" ||
|
||||
thePostPVname == "Clad2")
|
||||
{
|
||||
if(trackInformation->IsStatus(OutsideOfFiber))
|
||||
trackInformation->AddStatusFlag(InsideOfFiber);
|
||||
|
||||
// Set the Exit flag when the photon refracted out of the fiber
|
||||
}
|
||||
else if(trackInformation->IsStatus(InsideOfFiber))
|
||||
{
|
||||
// EscapedFromReadOut if the z position is the same as fiber's end
|
||||
if(theTrack->GetPosition().z() == fDetector->GetWLSFiberEnd())
|
||||
{
|
||||
trackInformation->AddStatusFlag(EscapedFromReadOut);
|
||||
fCounterEnd++;
|
||||
fEventAction->AddEscapedEnd();
|
||||
}
|
||||
else // Escaped from side
|
||||
{
|
||||
trackInformation->AddStatusFlag(EscapedFromSide);
|
||||
trackInformation->SetExitPosition(theTrack->GetPosition());
|
||||
// UpdateHistogramEscape(thePostPoint,theTrack);
|
||||
|
||||
fCounterMid++;
|
||||
fEventAction->AddEscapedMid();
|
||||
ResetCounters();
|
||||
}
|
||||
|
||||
trackInformation->AddStatusFlag(OutsideOfFiber);
|
||||
trackInformation->SetExitPosition(theTrack->GetPosition());
|
||||
}
|
||||
|
||||
return;
|
||||
|
||||
// Internal Reflections
|
||||
case TotalInternalReflection:
|
||||
|
||||
fEventAction->AddTIR();
|
||||
|
||||
// Kill the track if it's number of bounces exceeded the limit
|
||||
if(fBounceLimit > 0 && fCounterBounce >= fBounceLimit)
|
||||
{
|
||||
theTrack->SetTrackStatus(fStopAndKill);
|
||||
trackInformation->AddStatusFlag(murderee);
|
||||
ResetCounters();
|
||||
G4cout << "\n Bounce Limit Exceeded" << G4endl;
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case FresnelReflection:
|
||||
|
||||
fCounterBounce++;
|
||||
fEventAction->AddBounce();
|
||||
|
||||
if(thePrePVname == "WLSFiber")
|
||||
{
|
||||
fCounterWLSBounce++;
|
||||
fEventAction->AddWLSBounce();
|
||||
}
|
||||
else if(thePrePVname == "Clad1")
|
||||
{
|
||||
fCounterClad1Bounce++;
|
||||
fEventAction->AddClad1Bounce();
|
||||
}
|
||||
else if(thePrePVname == "Clad2")
|
||||
{
|
||||
fCounterClad2Bounce++;
|
||||
fEventAction->AddClad1Bounce();
|
||||
}
|
||||
|
||||
// Determine if the photon has reflected off the read-out end
|
||||
if(theTrack->GetPosition().z() == fDetector->GetWLSFiberEnd())
|
||||
{
|
||||
if(!trackInformation->IsStatus(ReflectedAtReadOut) &&
|
||||
trackInformation->IsStatus(InsideOfFiber))
|
||||
{
|
||||
trackInformation->AddStatusFlag(ReflectedAtReadOut);
|
||||
|
||||
if(fDetector->IsPerfectFiber() &&
|
||||
theStatus == TotalInternalReflection)
|
||||
{
|
||||
theTrack->SetTrackStatus(fStopAndKill);
|
||||
trackInformation->AddStatusFlag(murderee);
|
||||
// UpdateHistogramReflect(thePostPoint,theTrack);
|
||||
ResetCounters();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
||||
// Reflection of the mirror
|
||||
case LambertianReflection:
|
||||
case LobeReflection:
|
||||
case SpikeReflection:
|
||||
|
||||
fEventAction->AddReflected();
|
||||
// Check if it hits the mirror
|
||||
if(thePostPVname == "Mirror")
|
||||
{
|
||||
trackInformation->AddStatusFlag(ReflectedAtMirror);
|
||||
fEventAction->AddMirror();
|
||||
}
|
||||
return;
|
||||
|
||||
// Detected by a detector
|
||||
case Detection:
|
||||
|
||||
// Check if the photon hits the detector and process the hit if it does
|
||||
if(thePostPVname == "PhotonDet")
|
||||
{
|
||||
// G4cout << "Detection" << G4endl;
|
||||
fEventAction->AddDetected();
|
||||
G4SDManager* SDman = G4SDManager::GetSDMpointer();
|
||||
G4String SDname = "WLS/PhotonDet";
|
||||
WLSPhotonDetSD* mppcSD =
|
||||
(WLSPhotonDetSD*) SDman->FindSensitiveDetector(SDname);
|
||||
|
||||
if(mppcSD)
|
||||
mppcSD->ProcessHits_boundary(theStep, nullptr);
|
||||
|
||||
// Record Photons that escaped at the end
|
||||
// if (trackInformation->IsStatus(EscapedFromReadOut))
|
||||
// UpdateHistogramSuccess(thePostPoint,theTrack);
|
||||
|
||||
// Stop Tracking when it hits the detector's surface
|
||||
ResetCounters();
|
||||
theTrack->SetTrackStatus(fStopAndKill);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Check for absorbed photons
|
||||
if(theTrack->GetTrackStatus() != fAlive &&
|
||||
trackInformation->IsStatus(InsideOfFiber))
|
||||
{
|
||||
// UpdateHistogramAbsorb(thePostPoint,theTrack);
|
||||
ResetCounters();
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -37,20 +37,20 @@
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSSteppingActionMessenger::
|
||||
WLSSteppingActionMessenger(WLSSteppingAction* steppingaction)
|
||||
: fSteppingAction (steppingaction)
|
||||
WLSSteppingActionMessenger::WLSSteppingActionMessenger(
|
||||
WLSSteppingAction* steppingaction)
|
||||
: fSteppingAction(steppingaction)
|
||||
{
|
||||
fSteppingDir = new G4UIdirectory("/stepping/");
|
||||
fSteppingDir->SetGuidance("stepping control");
|
||||
|
||||
fSetBounceLimitCmd =
|
||||
new G4UIcmdWithAnInteger("/stepping/setBounceLimit", this);
|
||||
fSetBounceLimitCmd->
|
||||
SetGuidance("Select the maximum number of allowed bounce");
|
||||
fSetBounceLimitCmd->
|
||||
SetGuidance("Set this number to zero if you don't want to limit");
|
||||
fSetBounceLimitCmd->SetParameterName("limit",false);
|
||||
new G4UIcmdWithAnInteger("/stepping/setBounceLimit", this);
|
||||
fSetBounceLimitCmd->SetGuidance(
|
||||
"Select the maximum number of allowed bounce");
|
||||
fSetBounceLimitCmd->SetGuidance(
|
||||
"Set this number to zero if you don't want to limit");
|
||||
fSetBounceLimitCmd->SetParameterName("limit", false);
|
||||
fSetBounceLimitCmd->SetRange("limit>=0");
|
||||
fSetBounceLimitCmd->AvailableForStates(G4State_Idle);
|
||||
}
|
||||
@@ -68,9 +68,9 @@ WLSSteppingActionMessenger::~WLSSteppingActionMessenger()
|
||||
void WLSSteppingActionMessenger::SetNewValue(G4UIcommand* command,
|
||||
G4String newValue)
|
||||
{
|
||||
if ( command == fSetBounceLimitCmd ) {
|
||||
|
||||
fSteppingAction->
|
||||
SetBounceLimit(G4UIcmdWithAnInteger::GetNewIntValue(newValue));
|
||||
if(command == fSetBounceLimitCmd)
|
||||
{
|
||||
fSteppingAction->SetBounceLimit(
|
||||
G4UIcmdWithAnInteger::GetNewIntValue(newValue));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,41 +28,40 @@
|
||||
/// \brief Implementation of the WLSTrackingAction class
|
||||
//
|
||||
//
|
||||
#include "globals.hh"
|
||||
#include "G4RunManager.hh"
|
||||
|
||||
#include "WLSTrackingAction.hh"
|
||||
|
||||
#include "WLSTrajectory.hh"
|
||||
|
||||
#include "WLSUserTrackInformation.hh"
|
||||
|
||||
#include "G4Track.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
#include "G4TrackingManager.hh"
|
||||
|
||||
#include "WLSTrackingAction.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSTrackingAction::PreUserTrackingAction(const G4Track* aTrack)
|
||||
{
|
||||
//Let this be up to the user via vis.mac
|
||||
// Let this be up to the user via vis.mac
|
||||
// fpTrackingManager->SetStoreTrajectory(true);
|
||||
|
||||
//Use custom trajectory class
|
||||
// Use custom trajectory class
|
||||
fpTrackingManager->SetTrajectory(new WLSTrajectory(aTrack));
|
||||
|
||||
WLSUserTrackInformation* trackInformation = new WLSUserTrackInformation();
|
||||
|
||||
if (aTrack->GetMomentumDirection().z()>0.0) {
|
||||
trackInformation->AddStatusFlag(right);
|
||||
} else {
|
||||
trackInformation->AddStatusFlag(left);
|
||||
if(aTrack->GetMomentumDirection().z() > 0.0)
|
||||
{
|
||||
trackInformation->AddStatusFlag(right);
|
||||
}
|
||||
else
|
||||
{
|
||||
trackInformation->AddStatusFlag(left);
|
||||
}
|
||||
|
||||
G4String PVName = aTrack->GetVolume()->GetName();
|
||||
|
||||
if (PVName == "WLSFiber" || PVName == "Clad1" || PVName == "Clad2")
|
||||
trackInformation->AddStatusFlag(InsideOfFiber);
|
||||
if(PVName == "WLSFiber" || PVName == "Clad1" || PVName == "Clad2")
|
||||
trackInformation->AddStatusFlag(InsideOfFiber);
|
||||
|
||||
fpTrackingManager->SetUserTrackInformation(trackInformation);
|
||||
}
|
||||
|
||||
@@ -28,168 +28,169 @@
|
||||
/// \brief Implementation of the WLSTrajectory class
|
||||
//
|
||||
//
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
|
||||
#include "WLSTrajectory.hh"
|
||||
|
||||
#include "WLSTrajectoryPoint.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4ParticleTable.hh"
|
||||
#include "G4ParticleTypes.hh"
|
||||
|
||||
#include "G4Polyline.hh"
|
||||
#include "G4Colour.hh"
|
||||
#include "G4Polymarker.hh"
|
||||
#include "G4UIcommand.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VisAttributes.hh"
|
||||
#include "G4VVisManager.hh"
|
||||
#include "G4Polymarker.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4ThreadLocal G4Allocator<WLSTrajectory>* WLSTrajectoryAllocator=0;
|
||||
G4ThreadLocal G4Allocator<WLSTrajectory>* WLSTrajectoryAllocator = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSTrajectory::WLSTrajectory()
|
||||
: fpPointsContainer(0), fTrackID(0), fParentID(0),
|
||||
fPDGCharge(0.0), fPDGEncoding(0), fParticleName(""),
|
||||
fInitialMomentum(G4ThreeVector())
|
||||
: fpPointsContainer(0)
|
||||
, fTrackID(0)
|
||||
, fParentID(0)
|
||||
, fPDGCharge(0.0)
|
||||
, fPDGEncoding(0)
|
||||
, fParticleName("")
|
||||
, fInitialMomentum(G4ThreeVector())
|
||||
{
|
||||
fParticleDefinition = NULL;
|
||||
fParticleDefinition = nullptr;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSTrajectory::WLSTrajectory(const G4Track* aTrack)
|
||||
{
|
||||
fParticleDefinition = aTrack->GetDefinition();
|
||||
fParticleName = fParticleDefinition->GetParticleName();
|
||||
fPDGCharge = fParticleDefinition->GetPDGCharge();
|
||||
fPDGEncoding = fParticleDefinition->GetPDGEncoding();
|
||||
fTrackID = aTrack->GetTrackID();
|
||||
fParentID = aTrack->GetParentID();
|
||||
fInitialMomentum = aTrack->GetMomentum();
|
||||
fpPointsContainer = new WLSTrajectoryPointContainer();
|
||||
// Following is for the first trajectory point
|
||||
fpPointsContainer->push_back(new WLSTrajectoryPoint(aTrack));
|
||||
fParticleDefinition = aTrack->GetDefinition();
|
||||
fParticleName = fParticleDefinition->GetParticleName();
|
||||
fPDGCharge = fParticleDefinition->GetPDGCharge();
|
||||
fPDGEncoding = fParticleDefinition->GetPDGEncoding();
|
||||
fTrackID = aTrack->GetTrackID();
|
||||
fParentID = aTrack->GetParentID();
|
||||
fInitialMomentum = aTrack->GetMomentum();
|
||||
fpPointsContainer = new WLSTrajectoryPointContainer();
|
||||
// Following is for the first trajectory point
|
||||
fpPointsContainer->push_back(new WLSTrajectoryPoint(aTrack));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSTrajectory::WLSTrajectory(WLSTrajectory & right) : G4VTrajectory()
|
||||
WLSTrajectory::WLSTrajectory(WLSTrajectory& right)
|
||||
: G4VTrajectory()
|
||||
{
|
||||
fParticleDefinition=right.fParticleDefinition;
|
||||
fParticleName = right.fParticleName;
|
||||
fPDGCharge = right.fPDGCharge;
|
||||
fPDGEncoding = right.fPDGEncoding;
|
||||
fTrackID = right.fTrackID;
|
||||
fParentID = right.fParentID;
|
||||
fInitialMomentum = right.fInitialMomentum;
|
||||
fpPointsContainer = new WLSTrajectoryPointContainer();
|
||||
fParticleDefinition = right.fParticleDefinition;
|
||||
fParticleName = right.fParticleName;
|
||||
fPDGCharge = right.fPDGCharge;
|
||||
fPDGEncoding = right.fPDGEncoding;
|
||||
fTrackID = right.fTrackID;
|
||||
fParentID = right.fParentID;
|
||||
fInitialMomentum = right.fInitialMomentum;
|
||||
fpPointsContainer = new WLSTrajectoryPointContainer();
|
||||
|
||||
for(size_t i=0;i<right.fpPointsContainer->size();++i) {
|
||||
WLSTrajectoryPoint* rightPoint
|
||||
= (WLSTrajectoryPoint*)((*(right.fpPointsContainer))[i]);
|
||||
fpPointsContainer->push_back(new WLSTrajectoryPoint(*rightPoint));
|
||||
}
|
||||
for(size_t i = 0; i < right.fpPointsContainer->size(); ++i)
|
||||
{
|
||||
WLSTrajectoryPoint* rightPoint =
|
||||
(WLSTrajectoryPoint*) ((*(right.fpPointsContainer))[i]);
|
||||
fpPointsContainer->push_back(new WLSTrajectoryPoint(*rightPoint));
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSTrajectory::~WLSTrajectory()
|
||||
{
|
||||
for(size_t i=0;i<fpPointsContainer->size();++i){
|
||||
delete (*fpPointsContainer)[i];
|
||||
}
|
||||
fpPointsContainer->clear();
|
||||
|
||||
delete fpPointsContainer;
|
||||
for(size_t i = 0; i < fpPointsContainer->size(); ++i)
|
||||
{
|
||||
delete(*fpPointsContainer)[i];
|
||||
}
|
||||
fpPointsContainer->clear();
|
||||
delete fpPointsContainer;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSTrajectory::ShowTrajectory(std::ostream& os) const
|
||||
{
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
G4VTrajectory::ShowTrajectory(os);
|
||||
// ... or override with your own code here.
|
||||
// Invoke the default implementation in G4VTrajectory...
|
||||
G4VTrajectory::ShowTrajectory(os);
|
||||
// ... or override with your own code here.
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSTrajectory::AppendStep(const G4Step* aStep)
|
||||
{
|
||||
fpPointsContainer->push_back(new WLSTrajectoryPoint(aStep));
|
||||
fpPointsContainer->push_back(new WLSTrajectoryPoint(aStep));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
G4ParticleDefinition* WLSTrajectory::GetParticleDefinition()
|
||||
{
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(fParticleName));
|
||||
return (G4ParticleTable::GetParticleTable()->FindParticle(fParticleName));
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
void WLSTrajectory::MergeTrajectory(G4VTrajectory* secondTrajectory)
|
||||
{
|
||||
if(!secondTrajectory) return;
|
||||
if(!secondTrajectory)
|
||||
return;
|
||||
|
||||
WLSTrajectory* second = (WLSTrajectory*)secondTrajectory;
|
||||
G4int ent = second->GetPointEntries();
|
||||
// initial point of the second trajectory should not be merged
|
||||
for(G4int i=1; i<ent; ++i) {
|
||||
fpPointsContainer->push_back((*(second->fpPointsContainer))[i]);
|
||||
}
|
||||
delete (*second->fpPointsContainer)[0];
|
||||
second->fpPointsContainer->clear();
|
||||
WLSTrajectory* second = (WLSTrajectory*) secondTrajectory;
|
||||
G4int ent = second->GetPointEntries();
|
||||
// initial point of the second trajectory should not be merged
|
||||
for(G4int i = 1; i < ent; ++i)
|
||||
{
|
||||
fpPointsContainer->push_back((*(second->fpPointsContainer))[i]);
|
||||
}
|
||||
delete(*second->fpPointsContainer)[0];
|
||||
second->fpPointsContainer->clear();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const std::map<G4String,G4AttDef>* WLSTrajectory::GetAttDefs() const
|
||||
const std::map<G4String, G4AttDef>* WLSTrajectory::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("Trajectory",isNew);
|
||||
G4bool isNew;
|
||||
std::map<G4String, G4AttDef>* store =
|
||||
G4AttDefStore::GetInstance("Trajectory", isNew);
|
||||
|
||||
if (isNew) {
|
||||
if(isNew)
|
||||
{
|
||||
G4String ID("ID");
|
||||
(*store)[ID] = G4AttDef(ID, "Track ID", "Bookkeeping", "", "G4int");
|
||||
|
||||
G4String ID("ID");
|
||||
(*store)[ID] = G4AttDef(ID,"Track ID","Bookkeeping","","G4int");
|
||||
G4String PID("PID");
|
||||
(*store)[PID] = G4AttDef(PID, "Parent ID", "Bookkeeping", "", "G4int");
|
||||
|
||||
G4String PID("PID");
|
||||
(*store)[PID] = G4AttDef(PID,"Parent ID","Bookkeeping","","G4int");
|
||||
G4String PN("PN");
|
||||
(*store)[PN] = G4AttDef(PN, "Particle Name", "Physics", "", "G4String");
|
||||
|
||||
G4String PN("PN");
|
||||
(*store)[PN] = G4AttDef(PN,"Particle Name","Physics","","G4String");
|
||||
G4String Ch("Ch");
|
||||
(*store)[Ch] = G4AttDef(Ch, "Charge", "Physics", "e+", "G4double");
|
||||
|
||||
G4String Ch("Ch");
|
||||
(*store)[Ch] = G4AttDef(Ch,"Charge","Physics","e+","G4double");
|
||||
G4String PDG("PDG");
|
||||
(*store)[PDG] = G4AttDef(PDG, "PDG Encoding", "Physics", "", "G4int");
|
||||
|
||||
G4String PDG("PDG");
|
||||
(*store)[PDG] = G4AttDef(PDG,"PDG Encoding","Physics","","G4int");
|
||||
G4String IMom("IMom");
|
||||
(*store)[IMom] = G4AttDef(IMom, "Momentum of track at start of trajectory",
|
||||
"Physics", "G4BestUnit", "G4ThreeVector");
|
||||
|
||||
G4String IMom("IMom");
|
||||
(*store)[IMom] = G4AttDef(IMom,
|
||||
"Momentum of track at start of trajectory",
|
||||
"Physics","G4BestUnit","G4ThreeVector");
|
||||
G4String IMag("IMag");
|
||||
(*store)[IMag] =
|
||||
G4AttDef(IMag, "Magnitude of momentum of track at start of trajectory",
|
||||
"Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String IMag("IMag");
|
||||
(*store)[IMag] = G4AttDef(IMag,
|
||||
"Magnitude of momentum of track at start of trajectory",
|
||||
"Physics","G4BestUnit","G4double");
|
||||
|
||||
G4String NTP("NTP");
|
||||
(*store)[NTP] = G4AttDef(NTP,"No. of points","Bookkeeping","","G4int");
|
||||
|
||||
}
|
||||
return store;
|
||||
G4String NTP("NTP");
|
||||
(*store)[NTP] = G4AttDef(NTP, "No. of points", "Bookkeeping", "", "G4int");
|
||||
}
|
||||
return store;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
@@ -198,31 +199,28 @@ std::vector<G4AttValue>* WLSTrajectory::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("ID",G4UIcommand::ConvertToString(fTrackID),""));
|
||||
values->push_back(
|
||||
G4AttValue("ID", G4UIcommand::ConvertToString(fTrackID), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PID",G4UIcommand::ConvertToString(fParentID),""));
|
||||
values->push_back(
|
||||
G4AttValue("PID", G4UIcommand::ConvertToString(fParentID), ""));
|
||||
|
||||
values->push_back(G4AttValue("PN",fParticleName,""));
|
||||
values->push_back(G4AttValue("PN", fParticleName, ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("Ch",G4UIcommand::ConvertToString(fPDGCharge),""));
|
||||
values->push_back(
|
||||
G4AttValue("Ch", G4UIcommand::ConvertToString(fPDGCharge), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("PDG",G4UIcommand::ConvertToString(fPDGEncoding),""));
|
||||
values->push_back(
|
||||
G4AttValue("PDG", G4UIcommand::ConvertToString(fPDGEncoding), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMom",G4BestUnit(fInitialMomentum,"Energy"),""));
|
||||
values->push_back(
|
||||
G4AttValue("IMom", G4BestUnit(fInitialMomentum, "Energy"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("IMag",G4BestUnit(fInitialMomentum.mag(),"Energy"),""));
|
||||
values->push_back(
|
||||
G4AttValue("IMag", G4BestUnit(fInitialMomentum.mag(), "Energy"), ""));
|
||||
|
||||
values->push_back
|
||||
(G4AttValue("NTP",G4UIcommand::ConvertToString(GetPointEntries()),""));
|
||||
values->push_back(
|
||||
G4AttValue("NTP", G4UIcommand::ConvertToString(GetPointEntries()), ""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
#endif
|
||||
return values;
|
||||
return values;
|
||||
}
|
||||
|
||||
@@ -30,92 +30,91 @@
|
||||
//
|
||||
#include "WLSTrajectoryPoint.hh"
|
||||
|
||||
#include "G4Step.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4VProcess.hh"
|
||||
#include "G4StepStatus.hh"
|
||||
|
||||
#include "G4AttDef.hh"
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4AttDefStore.hh"
|
||||
|
||||
#include "G4AttValue.hh"
|
||||
#include "G4Step.hh"
|
||||
#include "G4StepStatus.hh"
|
||||
#include "G4Track.hh"
|
||||
#include "G4UnitsTable.hh"
|
||||
#include "G4VProcess.hh"
|
||||
|
||||
//#define G4ATTDEBUG
|
||||
#ifdef G4ATTDEBUG
|
||||
#include "G4AttCheck.hh"
|
||||
#endif
|
||||
|
||||
G4ThreadLocal G4Allocator<WLSTrajectoryPoint>* WLSTrajPointAllocator=0;
|
||||
G4ThreadLocal G4Allocator<WLSTrajectoryPoint>* WLSTrajPointAllocator = nullptr;
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSTrajectoryPoint::WLSTrajectoryPoint()
|
||||
: fTime(0.), fMomentum(0.,0.,0.),
|
||||
fStepStatus(fUndefined), fVolumeName("") { }
|
||||
: fTime(0.)
|
||||
, fMomentum(0., 0., 0.)
|
||||
, fStepStatus(fUndefined)
|
||||
, fVolumeName("")
|
||||
{}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSTrajectoryPoint::WLSTrajectoryPoint(const G4Step* aStep)
|
||||
: G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition())
|
||||
: G4TrajectoryPoint(aStep->GetPostStepPoint()->GetPosition())
|
||||
{
|
||||
fTime = aStep->GetPostStepPoint()->GetGlobalTime();
|
||||
fMomentum = aStep->GetPostStepPoint()->GetMomentum();
|
||||
fStepStatus = aStep->GetPostStepPoint()->GetStepStatus();
|
||||
if (aStep->GetPostStepPoint()->GetPhysicalVolume())
|
||||
{
|
||||
fVolumeName = aStep->GetPostStepPoint()->
|
||||
GetPhysicalVolume()->GetName();
|
||||
} else {
|
||||
fVolumeName = " ";
|
||||
}
|
||||
auto postStepPoint = aStep->GetPostStepPoint();
|
||||
fTime = postStepPoint->GetGlobalTime();
|
||||
fMomentum = postStepPoint->GetMomentum();
|
||||
fStepStatus = postStepPoint->GetStepStatus();
|
||||
if(postStepPoint->GetPhysicalVolume())
|
||||
{
|
||||
fVolumeName = postStepPoint->GetPhysicalVolume()->GetName();
|
||||
}
|
||||
else
|
||||
{
|
||||
fVolumeName = " ";
|
||||
}
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSTrajectoryPoint::WLSTrajectoryPoint(const G4Track* aTrack)
|
||||
: G4TrajectoryPoint(aTrack->GetPosition())
|
||||
: G4TrajectoryPoint(aTrack->GetPosition())
|
||||
{
|
||||
fTime = aTrack->GetGlobalTime();
|
||||
fMomentum = aTrack->GetMomentum();
|
||||
fStepStatus = fUndefined;
|
||||
fVolumeName = aTrack->GetVolume()->GetName();
|
||||
fTime = aTrack->GetGlobalTime();
|
||||
fMomentum = aTrack->GetMomentum();
|
||||
fStepStatus = fUndefined;
|
||||
fVolumeName = aTrack->GetVolume()->GetName();
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSTrajectoryPoint::WLSTrajectoryPoint(const WLSTrajectoryPoint &right)
|
||||
: G4TrajectoryPoint(right)
|
||||
WLSTrajectoryPoint::WLSTrajectoryPoint(const WLSTrajectoryPoint& right)
|
||||
: G4TrajectoryPoint(right)
|
||||
{
|
||||
fTime = right.fTime;
|
||||
fMomentum = right.fMomentum;
|
||||
fStepStatus = right.fStepStatus;
|
||||
fVolumeName = right.fVolumeName;
|
||||
fTime = right.fTime;
|
||||
fMomentum = right.fMomentum;
|
||||
fStepStatus = right.fStepStatus;
|
||||
fVolumeName = right.fVolumeName;
|
||||
}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSTrajectoryPoint::~WLSTrajectoryPoint() { }
|
||||
WLSTrajectoryPoint::~WLSTrajectoryPoint() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
const std::map<G4String,G4AttDef>* WLSTrajectoryPoint::GetAttDefs() const
|
||||
const std::map<G4String, G4AttDef>* WLSTrajectoryPoint::GetAttDefs() const
|
||||
{
|
||||
G4bool isNew;
|
||||
std::map<G4String,G4AttDef>* store
|
||||
= G4AttDefStore::GetInstance("TrajectoryPoint",isNew);
|
||||
if (isNew) {
|
||||
std::map<G4String, G4AttDef>* store =
|
||||
G4AttDefStore::GetInstance("TrajectoryPoint", isNew);
|
||||
if(isNew)
|
||||
{
|
||||
G4String Pos("Pos");
|
||||
(*store)[Pos] =
|
||||
G4AttDef(Pos, "Position", "Physics","G4BestUnit","G4ThreeVector");
|
||||
G4AttDef(Pos, "Position", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
|
||||
G4String Time("Time");
|
||||
(*store)[Time] =
|
||||
G4AttDef(Time, "Time", "Physics","G4BestUnit","G4double");
|
||||
G4AttDef(Time, "Time", "Physics", "G4BestUnit", "G4double");
|
||||
|
||||
G4String Momentum("Momentum");
|
||||
(*store)[Momentum] =
|
||||
G4AttDef(Momentum, "Momentum", "Physics","G4BestUnit","G4ThreeVector");
|
||||
G4AttDef(Momentum, "Momentum", "Physics", "G4BestUnit", "G4ThreeVector");
|
||||
|
||||
G4String StepStatus("StepStatus");
|
||||
(*store)[StepStatus] =
|
||||
@@ -124,7 +123,6 @@ const std::map<G4String,G4AttDef>* WLSTrajectoryPoint::GetAttDefs() const
|
||||
G4String VolumeName("VolumeName");
|
||||
(*store)[VolumeName] =
|
||||
G4AttDef(VolumeName, "VolumeName", "Physics", "", "G4String");
|
||||
|
||||
}
|
||||
return store;
|
||||
}
|
||||
@@ -135,17 +133,11 @@ std::vector<G4AttValue>* WLSTrajectoryPoint::CreateAttValues() const
|
||||
{
|
||||
std::vector<G4AttValue>* values = new std::vector<G4AttValue>;
|
||||
|
||||
values->push_back(G4AttValue("Time",G4BestUnit(fTime,"Time"),""));
|
||||
|
||||
values->push_back(G4AttValue("Momentum",G4BestUnit(fMomentum,"Momentum"),""));
|
||||
|
||||
values->push_back(G4AttValue("StepStatus",fStepStatus,""));
|
||||
|
||||
values->push_back(G4AttValue("VolumeName",fVolumeName,""));
|
||||
|
||||
#ifdef G4ATTDEBUG
|
||||
G4cout << G4AttCheck(values,GetAttDefs());
|
||||
#endif
|
||||
values->push_back(G4AttValue("Time", G4BestUnit(fTime, "Time"), ""));
|
||||
values->push_back(
|
||||
G4AttValue("Momentum", G4BestUnit(fMomentum, "Momentum"), ""));
|
||||
values->push_back(G4AttValue("StepStatus", fStepStatus, ""));
|
||||
values->push_back(G4AttValue("VolumeName", fVolumeName, ""));
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
@@ -28,22 +28,16 @@
|
||||
/// \brief Implementation of the WLSUserTrackInformation class
|
||||
//
|
||||
//
|
||||
#include "G4ios.hh"
|
||||
#include "G4ThreeVector.hh"
|
||||
|
||||
#include "WLSUserTrackInformation.hh"
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSUserTrackInformation::WLSUserTrackInformation ()
|
||||
{
|
||||
fStatus = undefined;
|
||||
fExitPosition = G4ThreeVector(0.,0.,0.);
|
||||
}
|
||||
WLSUserTrackInformation::WLSUserTrackInformation() { fStatus = undefined; }
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
WLSUserTrackInformation::~WLSUserTrackInformation () { }
|
||||
WLSUserTrackInformation::~WLSUserTrackInformation() {}
|
||||
|
||||
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
|
||||
|
||||
@@ -52,44 +46,47 @@ G4bool WLSUserTrackInformation::AddStatusFlag(TrackStatus s)
|
||||
// Cannot Add Undefine or a flag that conflicts with another flag
|
||||
// Return true if the addition of flag is successful, false otherwise
|
||||
{
|
||||
switch (s) {
|
||||
|
||||
case left:
|
||||
case right:
|
||||
|
||||
// Allow the user to set left or right
|
||||
// only if the track is undefined
|
||||
if (fStatus == undefined) return fStatus |= s;
|
||||
|
||||
return false;
|
||||
|
||||
case EscapedFromSide:
|
||||
case EscapedFromReadOut:
|
||||
|
||||
// Allow the user to set escaped flag
|
||||
// only if the photon hasn't exited the fiber yet
|
||||
|
||||
if ((fStatus == undefined) || (fStatus & OutsideOfFiber)) return false;
|
||||
|
||||
return fStatus |= s;
|
||||
|
||||
case ReflectedAtMirror:
|
||||
case ReflectedAtReadOut:
|
||||
case murderee:
|
||||
switch(s)
|
||||
{
|
||||
case left:
|
||||
case right:
|
||||
|
||||
// Allow the user to set left or right
|
||||
// only if the track is undefined
|
||||
if(fStatus == undefined)
|
||||
return fStatus |= s;
|
||||
|
||||
case InsideOfFiber:
|
||||
|
||||
return ( fStatus =
|
||||
(fStatus & ~(EscapedFromSide + EscapedFromReadOut + OutsideOfFiber)) | s);
|
||||
return false;
|
||||
|
||||
case OutsideOfFiber:
|
||||
case EscapedFromSide:
|
||||
case EscapedFromReadOut:
|
||||
|
||||
return ( fStatus = (fStatus & ~InsideOfFiber) | s );
|
||||
|
||||
default:
|
||||
|
||||
// Allow the user to set escaped flag
|
||||
// only if the photon hasn't exited the fiber yet
|
||||
|
||||
if((fStatus == undefined) || (fStatus & OutsideOfFiber))
|
||||
return false;
|
||||
}
|
||||
|
||||
return fStatus |= s;
|
||||
|
||||
case ReflectedAtMirror:
|
||||
case ReflectedAtReadOut:
|
||||
case murderee:
|
||||
|
||||
return fStatus |= s;
|
||||
|
||||
case InsideOfFiber:
|
||||
|
||||
return (fStatus = (fStatus & ~(EscapedFromSide + EscapedFromReadOut +
|
||||
OutsideOfFiber)) |
|
||||
s);
|
||||
|
||||
case OutsideOfFiber:
|
||||
|
||||
return (fStatus = (fStatus & ~InsideOfFiber) | s);
|
||||
|
||||
default:
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user