Skip to content
Snippets Groups Projects
Commit 70468820 authored by clantz's avatar clantz
Browse files

Updated the README again. Renamed some variables in Detector construction

parent 4f8e8ddd
No related branches found
No related tags found
No related merge requests found
///\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
*/
......@@ -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 fParser;
DetectorMessenger* fDetectorMessenger;
G4GDMLParser m_Parser;
DetectorMessenger* m_DetectorMessenger;
};
#endif /*DetectorConstruction_h*/
......@@ -66,9 +66,11 @@
*
*/
DetectorConstruction::DetectorConstruction()
: G4VUserDetectorConstruction(),fDetectorMessenger(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_logical =
m_logicLightGuide =
new G4LogicalVolume(mesh->TessellatedMesh(), //solid
Al, //material
"LightGuide"); //name
}
#endif
if(filetype == "gdml"){
fParser.Read(filename);
if(m_filetype == "gdml"){
m_Parser.Read(m_filename);
}
if(filetype == "step"){
cad_logical = fParser.ParseST(filename,Air,Al);
if(m_filetype == "step"){
m_logicLightGuide = m_Parser.ParseST(m_filename,Air,Al);
}
if(cad_logical !=0 ){
cad_physical =
if(m_logicLightGuide !=0 ){
m_physLightGuide =
new G4PVPlacement(rot,
G4ThreeVector(0,0,lgHeight-(3*cm)),
cad_logical,
"cad_physical",
m_logicLightGuide,
"physLightGuide",
m_logicWorld,
false,
0);
......@@ -169,26 +171,9 @@ G4VPhysicalVolume* DetectorConstruction::Construct(){
if(GDMLoutput != ""){
G4GDMLParser* gdml = new G4GDMLParser();
gdml->Write("GDMLoutput",cad_physical);
gdml->Write("GDMLoutput",m_physLightGuide);
}
//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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment