Import Geant4 11.2.0 source tree

This commit is contained in:
Gabriele Cosmo
2023-12-08 10:43:34 +01:00
parent dd1f179cda
commit 860a2b92bf
3962 changed files with 139318 additions and 164259 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 3.16...3.21)
cmake_minimum_required(VERSION 3.16...3.27)
project(B5)
#----------------------------------------------------------------------------
@@ -47,12 +47,12 @@ set(B5_SCRIPTS
icons.mac
gui.mac
run.png
init.mac
init_vis.mac
run1.mac
run2.mac
vis.mac
plotter.mac
tsg_offscreen.mac
)
foreach(_script ${B5_SCRIPTS})
+18
View File
@@ -5,6 +5,24 @@ which **must** added in reverse chronological order (newest at the top). It must
be used as a substitute for writing good git commit messages!
## 2023-11-18 I. Hrivnacova (exampleB5-V11-01-03)
- Updated vis.mac macro:
Changed "/vis/open OGL [600x600-0+0]" to "/vis/open" to allow run-time choices
and simplified comments
## 2023-11-07 I. Hrivnacova (exampleB5-V11-01-02)
- Fixed and improved setting of G4VisAttribute
- Do not create vis attributes with new
- Use Geant4 predefined colours (for clarity)
## 2023-11-03 I. Hrivnacova (exampleB5-V11-01-01)
- Applied auto in main where suitable and not done by clang-tidy
- Added initialization of DetectorConstruction::fMessenger
## 2023-09-18 I. Hrivnacova (exampleB5-V11-01-00)
- Added tsg_offscreen.mac (moved from example B1)
- Removed unused init.mac
## 2021-12-10 Ben Morgan (exampleB5-V11-00-00)
- Change to new Markdown History format
+2 -2
View File
@@ -54,7 +54,7 @@ int main(int argc,char** argv)
// Construct the default run manager
//
auto* runManager =
auto runManager =
G4RunManagerFactory::CreateRunManager(G4RunManagerType::Default);
// Mandatory user initialization classes
@@ -70,7 +70,7 @@ int main(int argc,char** argv)
// Visualization manager construction
auto visManager = new G4VisExecutive;
// G4VisExecutive can take a verbosity argument - see /vis/verbose guidance.
// G4VisManager* visManager = new G4VisExecutive("Quiet");
// auto visManager = new G4VisExecutive("Quiet");
visManager->Initialize();
// Get the pointer to the User Interface manager
File diff suppressed because it is too large Load Diff
@@ -40,7 +40,6 @@
class G4VPhysicalVolume;
class G4Material;
class G4VSensitiveDetector;
class G4VisAttributes;
class G4GenericMessenger;
namespace B5
@@ -67,11 +66,11 @@ class DetectorConstruction : public G4VUserDetectorConstruction
private:
void DefineCommands();
G4GenericMessenger* fMessenger;
static G4ThreadLocal MagneticField* fMagneticField;
static G4ThreadLocal G4FieldManager* fFieldMgr;
G4GenericMessenger* fMessenger = nullptr;
G4LogicalVolume* fHodoscope1Logical = nullptr;
G4LogicalVolume* fHodoscope2Logical = nullptr;
G4LogicalVolume* fWirePlane1Logical = nullptr;
@@ -80,8 +79,6 @@ class DetectorConstruction : public G4VUserDetectorConstruction
G4LogicalVolume* fHadCalScintiLogical = nullptr;
G4LogicalVolume* fMagneticLogical = nullptr;
std::vector<G4VisAttributes*> fVisAttributes;
G4double fArmAngle = 30.*CLHEP::deg;
G4RotationMatrix* fArmRotation = nullptr;
G4VPhysicalVolume* fSecondArmPhys = nullptr;
-13
View File
@@ -1,13 +0,0 @@
# Macro file for the initialization of example B1
# when running in interactive mode without visualization
#
# Set some default verbose
/control/verbose 2
/control/saveHistory
/run/verbose 2
#
# Change the default number of threads (in multi-threaded mode)
#/run/numberOfThreads 4
#
# Initialize kernel
/run/initialize
+26 -50
View File
@@ -90,10 +90,6 @@ DetectorConstruction::~DetectorConstruction()
{
delete fArmRotation;
delete fMessenger;
for (auto visAttributes: fVisAttributes) {
delete visAttributes;
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -286,57 +282,37 @@ G4VPhysicalVolume* DetectorConstruction::Construct()
// visualization attributes ------------------------------------------------
auto visAttributes = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
visAttributes->SetVisibility(false);
worldLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
G4VisAttributes invisible(G4VisAttributes::GetInvisible());
G4VisAttributes invisibleBlue(false, G4Colour::Blue());
G4VisAttributes invisibleGreen(false, G4Colour::Green());
G4VisAttributes invisibleYellow(false, G4Colour::Yellow());
G4VisAttributes blue(G4Colour::Blue());
G4VisAttributes cgray(G4Colour::Gray());
G4VisAttributes green(G4Colour::Green());
G4VisAttributes red(G4Colour::Red());
G4VisAttributes yellow(G4Colour::Yellow());
visAttributes = new G4VisAttributes(G4Colour(0.9,0.9,0.9)); // LightGray
fMagneticLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
worldLogical->SetVisAttributes(invisible);
firstArmLogical->SetVisAttributes(invisible);
secondArmLogical->SetVisAttributes(invisible);
visAttributes = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
visAttributes->SetVisibility(false);
firstArmLogical->SetVisAttributes(visAttributes);
secondArmLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
fMagneticLogical->SetVisAttributes(cgray);
fHodoscope1Logical->SetVisAttributes(red);
fHodoscope2Logical->SetVisAttributes(red);
visAttributes = new G4VisAttributes(G4Colour(0.8888,0.0,0.0));
fHodoscope1Logical->SetVisAttributes(visAttributes);
fHodoscope2Logical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
chamber1Logical->SetVisAttributes(green);
chamber2Logical->SetVisAttributes(green);
fWirePlane1Logical->SetVisAttributes(invisibleGreen);
fWirePlane2Logical->SetVisAttributes(invisibleGreen);
visAttributes = new G4VisAttributes(G4Colour(0.0,1.0,0.0));
chamber1Logical->SetVisAttributes(visAttributes);
chamber2Logical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
emCalorimeterLogical->SetVisAttributes(invisibleYellow);
fCellLogical->SetVisAttributes(yellow);
visAttributes = new G4VisAttributes(G4Colour(0.0,0.8888,0.0));
visAttributes->SetVisibility(false);
fWirePlane1Logical->SetVisAttributes(visAttributes);
fWirePlane2Logical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.8888,0.8888,0.0));
visAttributes->SetVisibility(false);
emCalorimeterLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.9,0.9,0.0));
fCellLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9));
hadCalorimeterLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
visAttributes = new G4VisAttributes(G4Colour(0.0, 0.0, 0.9));
visAttributes->SetVisibility(false);
HadCalColumnLogical->SetVisAttributes(visAttributes);
HadCalCellLogical->SetVisAttributes(visAttributes);
HadCalLayerLogical->SetVisAttributes(visAttributes);
fHadCalScintiLogical->SetVisAttributes(visAttributes);
fVisAttributes.push_back(visAttributes);
hadCalorimeterLogical->SetVisAttributes(blue);
HadCalColumnLogical->SetVisAttributes(invisibleBlue);
HadCalCellLogical->SetVisAttributes(invisibleBlue);
HadCalLayerLogical->SetVisAttributes(invisibleBlue);
fHadCalScintiLogical->SetVisAttributes(invisibleBlue);
// return the world physical volume ----------------------------------------
+1 -2
View File
@@ -71,8 +71,7 @@ void DriftChamberHit::Draw()
G4Circle circle(fWorldPos);
circle.SetScreenSize(2);
circle.SetFillStyle(G4Circle::filled);
G4Colour colour(1.,1.,0.);
G4VisAttributes attribs(colour);
G4VisAttributes attribs(G4Colour::Yellow());
circle.SetVisAttributes(attribs);
visManager->Draw(circle);
}
+1 -2
View File
@@ -72,8 +72,7 @@ void HadCalorimeterHit::Draw()
// Draw a calorimeter cell with depth propotional to the energy deposition
G4Transform3D trans(fRot.inverse(),fPos);
G4VisAttributes attribs;
G4Colour colour(1.,0.,0.);
attribs.SetColour(colour);
attribs.SetColour(G4Colour::Red());
attribs.SetForceSolid(true);
G4Box box("dummy",15.*cm,15.*cm,1.*m*fEdep/(0.1*GeV));
visManager->Draw(box,attribs,trans);
+1 -2
View File
@@ -72,8 +72,7 @@ void HodoscopeHit::Draw()
G4VisAttributes attribs;
auto pVA = fPLogV->GetVisAttributes();
if (pVA) attribs = *pVA;
G4Colour colour(0.,1.,1.);
attribs.SetColour(colour);
attribs.SetColour(G4Colour::Cyan());
attribs.SetForceSolid(true);
visManager->Draw(*fPLogV,attribs,trans);
}
+102
View File
@@ -0,0 +1,102 @@
#//////////////////////////////////////////////////////////////////////
#//////////////////////////////////////////////////////////////////////
#//////////////////////////////////////////////////////////////////////
# Default file format is zb_png. Then a picture produced by using the
# tools::sg offscreen zbuffer, and put in a png file with the tools::fpng png
# file writer.
# Default file name is:
# g4tsg_offscreen_[format]_[index].[suffix]
# with:
# - index: starting at one and incremented at each file production.
# - format:
# zb_png: tools::sg offscreen zbuffer put in a png file.
# zb_jpeg: tools::sg offscreen zbuffer put in a jpeg file.
# zb_ps: tools::sg offscreen zbuffer put in a PostScript file.
# gl2ps_eps: gl2ps producing eps
# gl2ps_ps: gl2ps producing ps
# gl2ps_pdf: gl2ps producing pdf
# gl2ps_svg: gl2ps producing svg
# gl2ps_tex: gl2ps producing tex
# gl2ps_pgf: gl2ps producing pgf
# - suffix: according to the choosen file format: eps, ps, pdf, svg, tex, pgf, png, jpeg.
# You can change the file name with:
# /vis/tsg/offscreen/set/file <file name>
# You can change the automatic file name construction with:
# /vis/tsg/offscreen/set/file auto <prefix> <true|false to reset the index>
# Default picture size, in pixels, is the one given when doing a:
# /vis/open TSG_OFFSCREEN [width]x[height]
# for example:
# /vis/open TSG_OFFSCREEN 1200x1200
# or by taking the default G4/vis viewer size (600x600):
# /vis/open TSG_OFFSCREEN
# About the picture size, note that the gl2ps files will grow with the number of primitives
# (gl2ps does not have a zbuffer logic). The "zb" files will not grow with the number of
# primitives, but with the size of the viewer. It should be preferred for scenes with
# a lot of objects to render. With zb, to have a better rendering, do not hesitate to
# have a large viewer size.
# About transparency, the zb formats handle it. The gl2ps formats don't, in this case you can use:
# /vis/tsg/offscreen/set/transparency false
# to not draw the transparent objects.
#//////////////////////////////////////////////////////////////////////
#//////////////////////////////////////////////////////////////////////
#//////////////////////////////////////////////////////////////////////
# Below is a sequence to produce files at the various formats
# (execute vis.mac first to have some scene to visualize).
# Note that a TSG offscreen viewer is not an "auto refresh" one, then
# to produce a picture, you have to do:
# /vis/viewer/rebuild
# (a /vis/viewer/refresh or flush may not be sufficient, for example with plotting).
/vis/verbose confirmations
/vis/open TSG_OFFSCREEN
/vis/viewer/rebuild # to produce the default g4tsg_offscreen_zb_png_1.png file.
/run/beamOn 10
/vis/viewer/rebuild # to produce g4tsg_offscreen_zb_png_2.png file.
/vis/tsg/offscreen/set/file auto B5_ true #true is to reset the index.
/vis/viewer/rebuild # to produce B5_1.png file.
/run/beamOn 10
/vis/viewer/rebuild # to produce B5_2.png file.
/vis/tsg/offscreen/set/format zb_png
/vis/tsg/offscreen/set/file B5_zb.png
/vis/viewer/rebuild
/vis/tsg/offscreen/set/format zb_jpeg
/vis/tsg/offscreen/set/file B5_zb.jpeg
/vis/viewer/rebuild
/vis/tsg/offscreen/set/format gl2ps_ps
/vis/tsg/offscreen/set/file B5_gl2ps.ps
/vis/viewer/rebuild
# gl2ps does not handle transparency, it could
# be usefull to not draw the transparent objects:
/vis/tsg/offscreen/set/transparency false
/vis/tsg/offscreen/set/file B5_no_transparency_gl2ps.ps
/vis/viewer/rebuild
/vis/tsg/offscreen/set/transparency true
# change picture size:
/vis/tsg/offscreen/set/size 2000 1500
/vis/tsg/offscreen/set/format zb_jpeg
/vis/tsg/offscreen/set/file B5_2000_1500_zb.jpeg
/vis/viewer/rebuild
# return to the "/vis/open" (/vis/viewer/create in fact) picture size:
/vis/tsg/offscreen/set/size 0 0
/vis/tsg/offscreen/set/format zb_jpeg
/vis/tsg/offscreen/set/file B5_600_600_zb.jpeg
/vis/viewer/rebuild
/vis/verbose warnings
+5 -18
View File
@@ -1,24 +1,11 @@
#
# Macro file for exampleB5
#
# Set verbosity
#
/control/verbose 2
#
# Use this open statement to create an OpenGL view:
/vis/open OGL 600x600-0+0
#
# Use this open statement to create a .prim file suitable for
# viewing in DAWN:
#/vis/open DAWNFILE
#
# Use this open statement to create a .heprep file suitable for
# viewing in HepRApp:
#/vis/open HepRepFile
#
# Use this open statement to create a .wrl file suitable for
# viewing in a VRML viewer:
#/vis/open VRML2FILE
# Open a viewer
/vis/open
# This opens the default viewer - see examples/basic/B1/vis.mac for a
# more comprehensive overview of options. Also the documentation.
#
# Disable auto refresh and quieten vis messages whilst scene and
# trajectories are established: