Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Z
zdcLG
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniel R. MacLean
zdcLG
Commits
70468820
Commit
70468820
authored
5 years ago
by
clantz
Browse files
Options
Downloads
Patches
Plain Diff
Updated the README again. Renamed some variables in Detector construction
parent
4f8e8ddd
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.README.txt
+0
-124
0 additions, 124 deletions
.README.txt
include/DetectorConstruction.hh
+13
-7
13 additions, 7 deletions
include/DetectorConstruction.hh
src/DetectorConstruction.cc
+35
-53
35 additions, 53 deletions
src/DetectorConstruction.cc
with
48 additions
and
184 deletions
.README.txt
deleted
100644 → 0
+
0
−
124
View file @
4f8e8ddd
///\file "zdclg/.README.txt"
///\brief LightGuide README page
This simulation is based on OpNovice and OpNovice2
Build requirements
Geant4 compiled with GDML and additional datasets
ROOT
-CADMesh is required to read CAD models (i.e. stl, step), but is optional for compiling
\section lightGuide_s1 main()
define Random Number Engine, initial seed, CAD input and GDML output
\section lightGuide_s2 G4VUserPhysicsList
- Define particles; including - *** G4OpticalPhoton ***
- Define processes; including
- *** G4Cerenkov ***
- *** G4Scintillation ***
- *** G4OpAbsorption ***
- *** G4OpRayleigh ***
- *** G4OpBoundaryProcess ***
\section lightGuide_s3 Materials
defines many materials for potential use
For our purposes the G4OpticalSurface AlSurface and the G4Material Al and Air
will be given optical properties and used for construction.
\section lightGuide_s4 G4VUserDetectorConstruction
A light guide is made either by simple G4trd or by importing a model
via CADMesh.
define G4LogicalBorderSurface between the light guide and world volume
defines a PMT window sensitive detector at the top of the light guide
AlSurface properties can be modified via DetectorMessenger via the following commands
/lightGuide/surfaceModel
/lightGuide/surfaceType
/lightGuide/surfaceFinish
/lightGuide/surfaceSigmaAlpha
/lightGuide/surfaceProperty
examples can be found in run1.mac
\section lightGuide_s5 G4VUserPrimaryGeneratorAction
Use G4GeneralParticleSource to shoot an optical photon into the light guide
Particle type and distribution is set in run1.mac
\section lightGuide_s6 G4UserRunAction
define G4Timer (start/stop)
define G4AnalysisManager (output .root file)
set verbose levels
\section lightGuide_s7 PMTHit
stores G4int trackID,
G4ThreeVector pos; // Origin position of the photon
G4ThreeVector hit; // Location where the photon hit the PMT window
G4double energy; // Energy of the photon
G4ThreeVector momentum; // Momentum of the photon (direction)
G4double time; // Time of arrival of the photon
for each hit on the PMT sensitive detector
\section lightGuide_s8 PMTSD
Records a PMTHit if the photon strikes the PMT window
\section lightGuide_s9 G4UserEventAction
Show how to count the number of secondary particles in an event
\section lightGuide_s10 Visualisation
The Visualization Manager is set in the main().
The initialisation of the drawing is done via a set of /vis/ commands
in the macro vis.mac. This macro is automatically read from
the main in case of interactive running mode.
\section lightGuide_s11 How to start
- compile and link to generate an executable
\verbatim
% mkdir zdclg-build zdclg-install
% cd zdclg-build
% cmake -DCMAKE_INSTALL_PREFIX=../zdclg-install /path/to/zdclg
\endverbatim
This example handles the program arguments in a new way.
It can be run with the following optional arguments:
\verbatim
% ./lightGuide [-m macro ]
[-u UIsession]
[-t nThreads]
[-r seed]
[-o outputFileName]
[-c CADmodelName filetype]
[-co GDMLoutFileName]
\endverbatim
The -t option is available only in multi-threading mode
and it allows the user to override the Geant4 default number of
threads. The number of threads can be also set via G4FORCENUMBEROFTHREADS
environment variable which has the top priority.
- execute lightGuide in 'batch' mode from macro files
\verbatim
% ./lightGuide -m run1.mac
\endverbatim
- execute lightGuide in 'interactive mode' with visualization
\verbatim
% lightGuide
....
Idle> type your commands. For instance:
Idle> /control/execute run1.mac
....
Idle> exit
\endverbatim
*/
This diff is collapsed.
Click to expand it.
include/DetectorConstruction.hh
+
13
−
7
View file @
70468820
...
...
@@ -52,7 +52,7 @@ class DetectorConstruction : public G4VUserDetectorConstruction
public:
virtual
G4VPhysicalVolume
*
Construct
();
void
SetCADFilename
(
std
::
string
name
);
void
SetCADFiletype
(
std
::
string
type
){
filetype
=
type
;}
void
SetCADFiletype
(
std
::
string
type
){
m_
filetype
=
type
;}
void
SetGDMLoutName
(
std
::
string
name
){
GDMLoutput
=
name
;}
void
SetSurfaceSigmaAlpha
(
G4double
v
);
...
...
@@ -74,24 +74,30 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4LogicalVolume
*
m_logicWorld
;
G4VPhysicalVolume
*
m_physWorld
;
G4LogicalVolume
*
cad_logical
;
G4VPhysicalVolume
*
cad_physical
;
G4LogicalVolume
*
m_logicLightGuide
;
G4VPhysicalVolume
*
m_physLightGuide
;
G4Box
*
m_solidFillGas
;
G4LogicalVolume
*
m_logicFillGas
;
G4VPhysicalVolume
*
m_physFillGas
;
G4int
m_rotX
;
G4int
m_rotY
;
G4int
m_rotZ
;
G4double
m_offsetX
;
G4double
m_offsetY
;
G4double
m_offsetZ
;
Materials
*
materials
;
std
::
string
filename
=
""
;
std
::
string
filetype
=
""
;
std
::
string
m_
filename
;
std
::
string
m_
filetype
;
std
::
string
GDMLoutput
;
G4GDMLParser
f
Parser
;
DetectorMessenger
*
f
DetectorMessenger
;
G4GDMLParser
m_
Parser
;
DetectorMessenger
*
m_
DetectorMessenger
;
};
#endif
/*DetectorConstruction_h*/
This diff is collapsed.
Click to expand it.
src/DetectorConstruction.cc
+
35
−
53
View file @
70468820
...
...
@@ -66,9 +66,11 @@
*
*/
DetectorConstruction
::
DetectorConstruction
()
:
G4VUserDetectorConstruction
(),
f
DetectorMessenger
(
nullptr
){
:
G4VUserDetectorConstruction
(),
m_
DetectorMessenger
(
nullptr
){
materials
=
Materials
::
getInstance
();
fDetectorMessenger
=
new
DetectorMessenger
(
this
);
m_DetectorMessenger
=
new
DetectorMessenger
(
this
);
m_filename
=
m_filetype
=
""
;
}
...
...
@@ -126,7 +128,7 @@ G4VPhysicalVolume* DetectorConstruction::Construct(){
//----------------- Make the light guide -----------------//
//If we have defined a CAD file, use it
if
(
filename
!=
""
){
if
(
m_
filename
!=
""
){
// CAD model rotation.
G4RotationMatrix
*
rot
=
new
G4RotationMatrix
();
...
...
@@ -136,32 +138,32 @@ G4VPhysicalVolume* DetectorConstruction::Construct(){
#ifdef CADMESH
if
(
filetype
==
"stl"
){
CADMesh
*
mesh
=
new
CADMesh
((
char
*
)
filename
.
c_str
());
if
(
m_
filetype
==
"stl"
){
CADMesh
*
mesh
=
new
CADMesh
((
char
*
)
m_
filename
.
c_str
());
mesh
->
SetScale
(
mm
);
mesh
->
SetOffset
(
G4ThreeVector
(
-
20
*
cm
,
0
,
0
)
);
mesh
->
SetReverse
(
false
);
cad
_logic
al
=
m
_logic
LightGuide
=
new
G4LogicalVolume
(
mesh
->
TessellatedMesh
(),
//solid
Al
,
//material
"LightGuide"
);
//name
}
#endif
if
(
filetype
==
"gdml"
){
f
Parser
.
Read
(
filename
);
if
(
m_
filetype
==
"gdml"
){
m_
Parser
.
Read
(
m_
filename
);
}
if
(
filetype
==
"step"
){
cad
_logic
al
=
f
Parser
.
ParseST
(
filename
,
Air
,
Al
);
if
(
m_
filetype
==
"step"
){
m
_logic
LightGuide
=
m_
Parser
.
ParseST
(
m_
filename
,
Air
,
Al
);
}
if
(
cad
_logic
al
!=
0
){
cad
_phys
ical
=
if
(
m
_logic
LightGuide
!=
0
){
m
_phys
LightGuide
=
new
G4PVPlacement
(
rot
,
G4ThreeVector
(
0
,
0
,
lgHeight
-
(
3
*
cm
)),
cad
_logic
al
,
"
cad_physical
"
,
m
_logic
LightGuide
,
"
physLightGuide
"
,
m_logicWorld
,
false
,
0
);
...
...
@@ -169,26 +171,9 @@ G4VPhysicalVolume* DetectorConstruction::Construct(){
if
(
GDMLoutput
!=
""
){
G4GDMLParser
*
gdml
=
new
G4GDMLParser
();
gdml
->
Write
(
"GDMLoutput"
,
cad
_phys
ical
);
gdml
->
Write
(
"GDMLoutput"
,
m
_phys
LightGuide
);
}
//Make the surface optically reflective
/*G4LogicalSkinSurface* alumLSS =
new G4LogicalSkinSurface("AlSkinSurface",
cad_logical,
materials->AlSurface );*/
G4LogicalBorderSurface
*
alumLSS
=
new
G4LogicalBorderSurface
(
"AlSurface"
,
m_physWorld
,
cad_physical
,
materials
->
AlSurface
);
G4LogicalBorderSurface
*
alumLSS1
=
new
G4LogicalBorderSurface
(
"AlSurface"
,
cad_physical
,
m_physWorld
,
materials
->
AlSurface
);
}
else
{
//Create a trapezoidal air light guide made of aluminum sheet
G4double
thickness
=
1.0
*
mm
;
...
...
@@ -220,38 +205,35 @@ G4VPhysicalVolume* DetectorConstruction::Construct(){
outter
,
inner
);
G4LogicalVolume
*
logicLightGuide
=
G4LogicalVolume
*
m_
logicLightGuide
=
new
G4LogicalVolume
(
LightGuide
,
Al
,
"BasicLightGuide"
);
G4VPhysicalVolume
*
physLightGuide
=
G4VPhysicalVolume
*
m_
physLightGuide
=
new
G4PVPlacement
(
0
,
G4ThreeVector
(
0
,
0
,
HeightZ
),
logicLightGuide
,
m_
logicLightGuide
,
"BasicLightGuide"
,
m_logicWorld
,
false
,
0
);
(
void
)
physLightGuide
;
/*G4LogicalSkinSurface* alumLSS =
new G4LogicalSkinSurface("AlSkinSurface",
logicLightGuide,
materials->AlSurface );*/
G4LogicalBorderSurface
*
alumLSS1
=
new
G4LogicalBorderSurface
(
"AlSurface"
,
physLightGuide
,
m_physWorld
,
materials
->
AlSurface
);
G4LogicalBorderSurface
*
alumLSS2
=
new
G4LogicalBorderSurface
(
"AlSurface"
,
m_physWorld
,
physLightGuide
,
materials
->
AlSurface
);
}
//end else
//----------------- Define Optical Borders -----------------//
G4LogicalBorderSurface
*
alumLSS1
=
new
G4LogicalBorderSurface
(
"AlSurface"
,
m_physLightGuide
,
m_physWorld
,
materials
->
AlSurface
);
G4LogicalBorderSurface
*
alumLSS2
=
new
G4LogicalBorderSurface
(
"AlSurface"
,
m_physWorld
,
m_physLightGuide
,
materials
->
AlSurface
);
//----------------- Define PMT window -----------------//
double
PMTradius
=
65.0
/
2
*
mm
;
...
...
@@ -336,8 +318,8 @@ void DetectorConstruction::SetSurfaceModel(const G4OpticalSurfaceModel model){
}
void
DetectorConstruction
::
SetCADFilename
(
std
::
string
name
){
filename
=
name
;
G4cout
<<
"Using "
<<
filename
<<
G4endl
;
m_
filename
=
name
;
G4cout
<<
"Using "
<<
m_
filename
<<
G4endl
;
delete
G4SDManager
::
GetSDMpointer
()
->
FindSensitiveDetector
(
"MyPMT"
);
G4RunManager
::
GetRunManager
()
->
GeometryHasBeenModified
();
//G4RunManager::GetRunManager()->ResetNavigator();
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment