Import Geant4 10.7.0 source tree

This commit is contained in:
Gabriele Cosmo
2020-12-04 12:30:43 +01:00
parent 67ba86d073
commit dab42d2018
3770 changed files with 226369 additions and 286486 deletions
+20 -6
View File
@@ -52,7 +52,21 @@ wls.mac implements a scintillating slab and wavelength shifting fibers.
Then type commands, for instance
Session: /run/beamOn 1
\section LXe_s7 Detailed Explanation of Geometry Implementation
\section LXe_s7 Macros included
Several macros are include in the distribution:
cerenkov.mac: Shoot a 200 MeV mu+ and only allow it to take one step. The
Cerenkov cone and PMTs hit are visible. (Reduce the number
of particles for visualization.)
LXe.mac: Shoot a 511 keV gamma with the default geometry.
photon.mac: Primary beam is an optical photon, with the default geometry.
wls.mac: Geometry includes 15 WLS fibers. A 511 keV electron is the
primary.
-
\section LXe_s8 Detailed Explanation of Geometry Implementation
The way the geometry is constructed is an experiment for a new, more object
oriented, way to construct geometry. It separates the concept of how a volume
@@ -100,7 +114,7 @@ and defined only once.
The updated variable is to signal that the volume needs to be updated and a new
logical volume made.
\section LXe_s8 Modifying the geometry at runtime
\section LXe_s9 Modifying the geometry at runtime
This example allows the user to modify the geometry definition at runtime. This
is accomplished through LXeDetectorMessenger, a derived class of G4UImessenger.
@@ -120,7 +134,7 @@ are used when constructing the geometry.
}
\endverbatim
\section LXe_s9 PMT sensitive detector
\section LXe_s10 PMT sensitive detector
The PMT sensitive detector cannot be triggered like a normal sensitive detector
because the sensitive volume does not allow photons to pass through it. Rather,
@@ -173,7 +187,7 @@ from G4SDManager and call its ProcessHits function.
}
\endverbatim
\section LXe_s10 Selectively drawing trajectories or highlighting volumes
\section LXe_s11 Selectively drawing trajectories or highlighting volumes
In a simulation such as this one, where an average of 6000 trajectories are
generated in a small space, there is little use in drawing all of them. There
@@ -219,7 +233,7 @@ the logic used in choosing which trajectories to draw.
See /LXe/detector/volumes/sphere in "UI commands" below for info on what
trajectories are drawn in this simulation.
\section LXe_s11 Saving random engine seeds
\section LXe_s12 Saving random engine seeds
At times it may be necessary to review a particular event of interest. To do
this without redoing an entire run, which may take a long time, you must store
@@ -252,7 +266,7 @@ directory to save in must exist first. GEANT4 will not create it for you.
G4RunManager::SetRandomNumberStoreDir(G4String)
\endverbatim
\section LXe_s12 UI commands
\section LXe_s13 UI commands
Directories:
\verbatim
+5 -3
View File
@@ -1,6 +1,9 @@
#----------------------------------------------------------------------------
# Setup the project
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)
cmake_minimum_required(VERSION 3.8...3.18)
if(${CMAKE_VERSION} VERSION_LESS 3.12)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
endif()
project(LXe)
#----------------------------------------------------------------------------
@@ -41,11 +44,10 @@ target_link_libraries(LXe ${Geant4_LIBRARIES} )
#
set(LXe_SCRIPTS
LXe.out
LXe.in
LXe.mac
cerenkov.mac
wls.mac
photon.mac
reviewEvent.mac
gui.mac
vis.mac
)
+18
View File
@@ -14,6 +14,24 @@ track of all tags.
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
November 5, 2020 D. Sawkey (LXe-V10-06-03)
- Apply clang-format style
- update macros
- Rename ProcessHits_constStep to ProcessHits_boundary
- remove unused #includes, empty methods
October 16, 2020 D. Sawkey (LXe-V10-06-02)
- fix valgrind errors: add 'delete's, fix initialization of hits counters
October 8, 2020 D. Sawkey (LXe-V10-06-01)
- macros: rename LXe.in to LXe.mac; store random seed in LXe.mac; set
optical verbosity to 1
September 24, 2020 D. Sawkey (LXe-V10-06-00)
- Set optical parameters in G4OpticalParameters class
- use new scintillation material property names
- use std::vector to specify material property names
November 28, 2019 I. Hrivnacova (LXe-V10-05-05)
- Fixed Doxygen warnings in .README.txt
+39 -43
View File
@@ -29,86 +29,82 @@
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "G4Types.hh"
#ifdef G4MULTITHREADED
#include "G4MTRunManager.hh"
#else
#include "G4RunManager.hh"
#endif
#include "G4UImanager.hh"
#include "G4String.hh"
#include "LXeActionInitialization.hh"
#include "LXeDetectorConstruction.hh"
#include "FTFP_BERT.hh"
#include "G4OpticalPhysics.hh"
#include "G4EmStandardPhysics_option4.hh"
#include "LXeDetectorConstruction.hh"
#include "LXeActionInitialization.hh"
#include "G4VisExecutive.hh"
#include "G4OpticalParameters.hh"
#include "G4OpticalPhysics.hh"
#include "G4RunManagerFactory.hh"
#include "G4String.hh"
#include "G4Types.hh"
#include "G4UIExecutive.hh"
#include "G4UImanager.hh"
#include "G4VisExecutive.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
int main(int argc, char** argv)
{
//detect interactive mode (if no arguments) and define UI session
// detect interactive mode (if no arguments) and define UI session
G4UIExecutive* ui = nullptr;
if (argc == 1) { ui = new G4UIExecutive(argc,argv); }
if(argc == 1)
{
ui = new G4UIExecutive(argc, argv);
}
auto runManager = G4RunManagerFactory::CreateRunManager();
#ifdef G4MULTITHREADED
G4MTRunManager * runManager = new G4MTRunManager;
G4int nThreads = std::min(G4Threading::G4GetNumberOfCores(), 4);
runManager->SetNumberOfThreads(nThreads);
G4cout << "===== LXe is started with "
<< runManager->GetNumberOfThreads() << " threads =====" << G4endl;
#else
G4RunManager * runManager = new G4RunManager;
#endif
LXeDetectorConstruction* det = new LXeDetectorConstruction();
runManager->SetUserInitialization(det);
G4VModularPhysicsList* physicsList = new FTFP_BERT;
physicsList->ReplacePhysics(new G4EmStandardPhysics_option4());
G4OpticalPhysics* opticalPhysics = new G4OpticalPhysics();
opticalPhysics->SetWLSTimeProfile("delta");
auto opticalParams = G4OpticalParameters::Instance();
opticalPhysics->SetScintillationYieldFactor(1.0);
opticalPhysics->SetScintillationExcitationRatio(0.0);
opticalParams->SetWLSTimeProfile("delta");
opticalPhysics->SetMaxNumPhotonsPerStep(100);
opticalPhysics->SetMaxBetaChangePerStep(10.0);
opticalParams->SetScintYieldFactor(1.0);
opticalParams->SetScintExcitationRatio(0.0);
opticalParams->SetScintTrackSecondariesFirst(true);
opticalParams->SetScintEnhancedTimeConstants(true);
opticalPhysics->SetTrackSecondariesFirst(kCerenkov, true);
opticalPhysics->SetTrackSecondariesFirst(kScintillation, true);
opticalParams->SetCerenkovMaxPhotonsPerStep(100);
opticalParams->SetCerenkovMaxBetaChange(10.0);
opticalParams->SetCerenkovTrackSecondariesFirst(true);
physicsList->RegisterPhysics(opticalPhysics);
runManager->SetUserInitialization(physicsList);
runManager->SetUserInitialization(new LXeActionInitialization(det));
//initialize visualization
// initialize visualization
G4VisManager* visManager = new G4VisExecutive;
visManager->Initialize();
//get the pointer to the User Interface manager
// get the pointer to the User Interface manager
G4UImanager* UImanager = G4UImanager::GetUIpointer();
if (ui) {
//interactive mode
if(ui)
{
// interactive mode
UImanager->ApplyCommand("/control/execute vis.mac");
if (ui->IsGUI()) {
if(ui->IsGUI())
{
UImanager->ApplyCommand("/control/execute gui.mac");
}
ui->SessionStart();
delete ui;
} else {
//batch mode
G4String command = "/control/execute ";
}
else
{
// batch mode
G4String command = "/control/execute ";
G4String fileName = argv[1];
UImanager->ApplyCommand(command+fileName);
UImanager->ApplyCommand(command + fileName);
}
// job termination
-20
View File
@@ -1,20 +0,0 @@
#**************
#**
#** Demonstrates the basic functionality of this example by running a
#** a single event with the default configuration
#**
#**************
/run/verbose 1
#/control/verbose 1
#/tracking/verbose 1
#/LXe/detector/MainScintYield 100
#/process/optical/verbose 1
/process/optical/processActivation Cerenkov false
/run/initialize
/LXe/saveThreshold 1000
/LXe/pmtThreshold 2
/LXe/eventVerbose 1
#/LXe/forceDrawPhotons true #/LXe/forceDrawNoPhotons false
/run/beamOn 1
/process/optical/scintillation/setTrackSecondariesFirst false
/run/beamOn 10
+37
View File
@@ -0,0 +1,37 @@
#**************
#**
#** Demonstrates the basic functionality of this example
#**
#**************
/run/verbose 1
/control/verbose 1
/tracking/verbose 0
/process/optical/verbose 1
/LXe/detector/MainScintYield 10000
#/process/optical/processActivation Cerenkov false
/run/initialize
/gun/particle gamma
/gun/energy 511 keV
/run/printProgress 10
/vis/disable
/random/setSavingFlag true
/LXe/saveThreshold 1400
/LXe/pmtThreshold 4
/LXe/forceDrawNoPhotons true
/run/beamOn 200
/vis/enable
/LXe/eventVerbose 1
/process/optical/scintillation/setTrackSecondariesFirst false
/run/beamOn 5
#
/tracking/verbose 1
/LXe/forceDrawPhotons true
/LXe/detector/MainScintYield 100
/process/optical/scintillation/setTrackSecondariesFirst true
/run/beamOn 1
File diff suppressed because it is too large Load Diff
+13
View File
@@ -64,6 +64,19 @@ How to start?
Then type commands, for instance
Session: /run/beamOn 1
---------------
Macros included
---------------
Several macros are include in the distribution:
cerenkov.mac: Shoot a 200 MeV mu+ and only allow it to take one step. The
Cerenkov cone and PMTs hit are visible. (Reduce the number
of particles for visualization.)
LXe.mac: Shoot a 511 keV gamma with the default geometry.
photon.mac: Primary beam is an optical photon, with the default geometry.
wls.mac: Geometry includes 15 WLS fibers. A 511 keV electron is the
primary.
-----------------------------------------------
Detailed Explanation of Geometry Implementation
+8 -7
View File
@@ -9,13 +9,14 @@
/control/verbose 1
/tracking/verbose 0
/run/verbose 1
/process/optical/processActivation Scintillation false
/control/cout/ignoreThreadsExcept 0
/process/optical/verbose 1
#/process/optical/processActivation Scintillation false
/run/initialize
/LXe/eventVerbose 0
/LXe/detector/defaults
/LXe/oneStepPrimaries false
/LXe/detector/MainScintYield 0
@@ -39,11 +40,11 @@
#/random/resetEngineFrom random/goodCerenkov.rndm
/analysis/setFileName cerenkov
/analysis/h1/set 1 100 -1 50
/analysis/h1/set 2 100 -1 50
/analysis/h1/set 4 100 -1 200
/analysis/h1/set 5 100 -1 200
/analysis/h1/set 6 100 -1 50
/analysis/h1/set 1 50 0 50
/analysis/h1/set 2 50 0 50
/analysis/h1/set 4 100 0 200
/analysis/h1/set 5 100 0 200
/analysis/h1/set 6 50 0 50
/analysis/h1/set 7 100 0 20 MeV
/run/printProgress 1000
+3 -5
View File
@@ -14,14 +14,12 @@
# Run menu :
/gui/addMenu run Run
/gui/addButton run "beamOn 1" "/run/beamOn 1"
#/gui/addButton run run1 "/control/execute run1.mac"
#/gui/addButton run run2 "/control/execute run2.mac"
#
# Gun menu :
/gui/addMenu gun Gun
/gui/addButton gun "50 MeV" "/gun/energy 50 MeV"
/gui/addButton gun "1 GeV" "/gun/energy 1 GeV"
/gui/addButton gun "10 GeV" "/gun/energy 10 GeV"
/gui/addButton gun "511 keV" "/gun/energy 511 keV"
/gui/addButton gun "5 MeV" "/gun/energy 5 MeV"
/gui/addButton gun "50 MeV" "/gun/energy 50 MeV"
/gui/addButton gun "e-" "/gun/particle e-"
/gui/addButton gun "pi0" "/gun/particle pi0"
/gui/addButton gun "pi+" "/gun/particle pi+"
@@ -34,21 +34,17 @@
class LXeDetectorConstruction;
/// Action initialization class.
///
class LXeActionInitialization : public G4VUserActionInitialization
{
public:
LXeActionInitialization(const LXeDetectorConstruction* det);
virtual ~LXeActionInitialization();
public:
LXeActionInitialization(const LXeDetectorConstruction* det);
~LXeActionInitialization();
virtual void BuildForMaster() const;
virtual void Build() const;
void BuildForMaster() const override;
void Build() const override;
private:
const LXeDetectorConstruction* fDetector;
private:
const LXeDetectorConstruction* fDetector;
};
#endif
@@ -28,128 +28,125 @@
/// \brief Definition of the LXeDetectorConstruction class
//
//
#ifndef LXeDetectorConstruction_H
#define LXeDetectorConstruction_H 1
#ifndef LXeDetectorConstruction_h
#define LXeDetectorConstruction_h 1
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Box;
class G4Tubs;
class LXeMainVolume;
class G4Sphere;
#include "G4Material.hh"
#include "LXeDetectorMessenger.hh"
#include "G4VisAttributes.hh"
#include "G4RotationMatrix.hh"
#include "LXeScintSD.hh"
#include "LXePMTSD.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4Cache.hh"
#include "G4VUserDetectorConstruction.hh"
class LXeMainVolume;
class LXePMTSD;
class LXeScintSD;
class G4Box;
class G4Element;
class G4LogicalVolume;
class G4Material;
class G4MaterialPropertiesTable;
class G4Sphere;
class G4Tubs;
class G4VPhysicalVolume;
class LXeDetectorConstruction : public G4VUserDetectorConstruction
{
public:
public:
LXeDetectorConstruction();
~LXeDetectorConstruction();
LXeDetectorConstruction();
virtual ~LXeDetectorConstruction();
G4VPhysicalVolume* Construct() override;
void ConstructSDandField() override;
virtual G4VPhysicalVolume* Construct();
virtual void ConstructSDandField();
// Functions to modify the geometry
void SetDimensions(G4ThreeVector);
void SetHousingThickness(G4double);
void SetNX(G4int);
void SetNY(G4int);
void SetNZ(G4int);
void SetPMTRadius(G4double);
void SetDefaults();
void SetSaveThreshold(G4int);
//Functions to modify the geometry
void SetDimensions(G4ThreeVector );
void SetHousingThickness(G4double );
void SetNX(G4int );
void SetNY(G4int );
void SetNZ(G4int );
void SetPMTRadius(G4double );
void SetDefaults();
void SetSaveThreshold(G4int );
// Get values
G4int GetNX() const { return fNx; };
G4int GetNY() const { return fNy; };
G4int GetNZ() const { return fNz; };
G4int GetSaveThreshold() const { return fSaveThreshold; };
G4double GetScintX() const { return fScint_x; }
G4double GetScintY() const { return fScint_y; }
G4double GetScintZ() const { return fScint_z; }
G4double GetHousingThickness() const { return fD_mtl; }
G4double GetPMTRadius() const { return fOuterRadius_pmt; }
G4double GetSlabZ() const { return fSlab_z; }
//Get values
G4int GetNX() const {return fNx;};
G4int GetNY() const {return fNy;};
G4int GetNZ() const {return fNz;};
G4int GetSaveThreshold() const {return fSaveThreshold;};
G4double GetScintX() const {return fScint_x;}
G4double GetScintY() const {return fScint_y;}
G4double GetScintZ() const {return fScint_z;}
G4double GetHousingThickness() const {return fD_mtl;}
G4double GetPMTRadius() const {return fOuterRadius_pmt;}
G4double GetSlabZ() const {return fSlab_z;}
void SetSphereOn(G4bool );
static G4bool GetSphereOn(){return fSphereOn;}
void SetSphereOn(G4bool);
static G4bool GetSphereOn() { return fSphereOn; }
void SetHousingReflectivity(G4double );
G4double GetHousingReflectivity() const {return fRefl;}
void SetHousingReflectivity(G4double);
G4double GetHousingReflectivity() const { return fRefl; }
void SetWLSSlabOn(G4bool b);
G4bool GetWLSSlabOn() const {return fWLSslab;}
void SetWLSSlabOn(G4bool b);
G4bool GetWLSSlabOn() const { return fWLSslab; }
void SetMainVolumeOn(G4bool b);
G4bool GetMainVolumeOn() const {return fMainVolumeOn;}
void SetMainVolumeOn(G4bool b);
G4bool GetMainVolumeOn() const { return fMainVolumeOn; }
void SetNFibers(G4int n);
G4int GetNFibers() const {return fNfibers;}
void SetNFibers(G4int n);
G4int GetNFibers() const { return fNfibers; }
void SetMainScintYield(G4double );
void SetWLSScintYield(G4double );
void SetMainScintYield(G4double);
void SetWLSScintYield(G4double);
private:
private:
void DefineMaterials();
void DefineMaterials();
LXeDetectorMessenger* fDetectorMessenger;
LXeDetectorMessenger* fDetectorMessenger;
G4Box* fExperimentalHall_box;
G4LogicalVolume* fExperimentalHall_log;
G4VPhysicalVolume* fExperimentalHall_phys;
G4Box* fExperimentalHall_box;
G4LogicalVolume* fExperimentalHall_log;
G4VPhysicalVolume* fExperimentalHall_phys;
// Materials & Elements
G4Material* fLXe;
G4Material* fAl;
G4Element* fN;
G4Element* fO;
G4Material* fAir;
G4Material* fVacuum;
G4Element* fC;
G4Element* fH;
G4Material* fGlass;
G4Material* fPstyrene;
G4Material* fPMMA;
G4Material* fPethylene1;
G4Material* fPethylene2;
//Materials & Elements
G4Material* fLXe;
G4Material* fAl;
G4Element* fN;
G4Element* fO;
G4Material* fAir;
G4Material* fVacuum;
G4Element* fC;
G4Element* fH;
G4Material* fGlass;
G4Material* fPstyrene;
G4Material* fPMMA;
G4Material* fPethylene1;
G4Material* fPethylene2;
// Geometry
G4double fScint_x;
G4double fScint_y;
G4double fScint_z;
G4double fD_mtl;
G4int fNx;
G4int fNy;
G4int fNz;
G4int fSaveThreshold;
G4double fOuterRadius_pmt;
G4int fNfibers;
static G4bool fSphereOn;
G4double fRefl;
G4bool fWLSslab;
G4bool fMainVolumeOn;
G4double fSlab_z;
//Geometry
G4double fScint_x;
G4double fScint_y;
G4double fScint_z;
G4double fD_mtl;
G4int fNx;
G4int fNy;
G4int fNz;
G4int fSaveThreshold;
G4double fOuterRadius_pmt;
G4int fNfibers;
static G4bool fSphereOn;
G4double fRefl;
G4bool fWLSslab;
G4bool fMainVolumeOn;
G4double fSlab_z;
LXeMainVolume* fMainVolume;
LXeMainVolume* fMainVolume;
G4MaterialPropertiesTable* fLXe_mt;
G4MaterialPropertiesTable* fMPTPStyrene;
//Sensitive Detectors
G4Cache<LXeScintSD*> fScint_SD;
G4Cache<LXePMTSD*> fPmt_SD;
G4MaterialPropertiesTable* fLXe_mt;
G4MaterialPropertiesTable* fMPTPStyrene;
// Sensitive Detectors
G4Cache<LXeScintSD*> fScint_SD;
G4Cache<LXePMTSD*> fPmt_SD;
};
#endif
@@ -31,47 +31,46 @@
#ifndef LXeDetectorMessenger_h
#define LXeDetectorMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
#include "G4UImessenger.hh"
class LXeDetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWith3VectorAndUnit;
class G4UIcmdWithAnInteger;
class G4UIcommand;
class G4UIcmdWithABool;
class G4UIcmdWithADouble;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithAnInteger;
class G4UIcmdWith3VectorAndUnit;
class G4UIcommand;
class G4UIdirectory;
class LXeDetectorMessenger: public G4UImessenger
class LXeDetectorMessenger : public G4UImessenger
{
public:
public:
LXeDetectorMessenger(LXeDetectorConstruction*);
~LXeDetectorMessenger();
LXeDetectorMessenger(LXeDetectorConstruction*);
virtual ~LXeDetectorMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
void SetNewValue(G4UIcommand*, G4String) override;
LXeDetectorConstruction* fLXeDetector;
G4UIdirectory* fDetectorDir;
G4UIdirectory* fVolumesDir;
G4UIcmdWith3VectorAndUnit* fDimensionsCmd;
G4UIcmdWithADoubleAndUnit* fHousingThicknessCmd;
G4UIcmdWithADoubleAndUnit* fPmtRadiusCmd;
G4UIcmdWithAnInteger* fNxCmd;
G4UIcmdWithAnInteger* fNyCmd;
G4UIcmdWithAnInteger* fNzCmd;
G4UIcmdWithABool* fSphereCmd;
G4UIcmdWithADouble* fReflectivityCmd;
G4UIcmdWithABool* fWlsCmd;
G4UIcmdWithABool* fLxeCmd;
G4UIcmdWithAnInteger* fNFibersCmd;
G4UIcommand* fDefaultsCmd;
G4UIcmdWithADouble* fMainScintYield;
G4UIcmdWithADouble* fWLSScintYield;
G4UIcmdWithAnInteger* fSaveThresholdCmd;
private:
LXeDetectorConstruction* fLXeDetector;
G4UIdirectory* fDetectorDir;
G4UIdirectory* fVolumesDir;
G4UIcmdWith3VectorAndUnit* fDimensionsCmd;
G4UIcmdWithADoubleAndUnit* fHousingThicknessCmd;
G4UIcmdWithADoubleAndUnit* fPmtRadiusCmd;
G4UIcmdWithAnInteger* fNxCmd;
G4UIcmdWithAnInteger* fNyCmd;
G4UIcmdWithAnInteger* fNzCmd;
G4UIcmdWithABool* fSphereCmd;
G4UIcmdWithADouble* fReflectivityCmd;
G4UIcmdWithABool* fWlsCmd;
G4UIcmdWithABool* fLxeCmd;
G4UIcmdWithAnInteger* fNFibersCmd;
G4UIcommand* fDefaultsCmd;
G4UIcmdWithADouble* fMainScintYield;
G4UIcmdWithADouble* fWLSScintYield;
G4UIcmdWithAnInteger* fSaveThresholdCmd;
};
#endif
@@ -32,100 +32,103 @@
#define LXeEventAction_h 1
#include "LXeEventMessenger.hh"
#include "G4UserEventAction.hh"
#include "globals.hh"
#include "G4ThreeVector.hh"
#include "G4UserEventAction.hh"
class G4Event;
class LXeDetectorConstruction;
class LXeEventAction : public G4UserEventAction
{
public:
public:
LXeEventAction(const LXeDetectorConstruction*);
~LXeEventAction();
LXeEventAction(const LXeDetectorConstruction*);
virtual ~LXeEventAction();
public:
void BeginOfEventAction(const G4Event*) override;
void EndOfEventAction(const G4Event*) override;
public:
void SetEventVerbose(G4int v) { fVerbose = v; }
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
void SetPMTThreshold(G4int t) { fPMTThreshold = t; }
void SetEventVerbose(G4int v){fVerbose=v;}
void SetForceDrawPhotons(G4bool b) { fForcedrawphotons = b; }
void SetForceDrawNoPhotons(G4bool b) { fForcenophotons = b; }
void SetPMTThreshold(G4int t){fPMTThreshold=t;}
void IncPhotonCount_Scint() { ++fPhotonCount_Scint; }
void IncPhotonCount_Ceren() { ++fPhotonCount_Ceren; }
void IncEDep(G4double dep) { fTotE += dep; }
void IncAbsorption() { ++fAbsorptionCount; }
void IncBoundaryAbsorption() { ++fBoundaryAbsorptionCount; }
void IncHitCount(G4int i = 1) { fHitCount += i; }
void SetForceDrawPhotons(G4bool b){fForcedrawphotons=b;}
void SetForceDrawNoPhotons(G4bool b){fForcenophotons=b;}
void SetEWeightPos(const G4ThreeVector& p) { fEWeightPos = p; }
void SetReconPos(const G4ThreeVector& p) { fReconPos = p; }
void SetConvPos(const G4ThreeVector& p)
{
fConvPos = p;
fConvPosSet = true;
}
void SetPosMax(const G4ThreeVector& p, G4double edep)
{
fPosMax = p;
fEdepMax = edep;
}
void IncPhotonCount_Scint(){fPhotonCount_Scint++;}
void IncPhotonCount_Ceren(){fPhotonCount_Ceren++;}
void IncEDep(G4double dep){fTotE+=dep;}
void IncAbsorption(){fAbsorptionCount++;}
void IncBoundaryAbsorption(){fBoundaryAbsorptionCount++;}
void IncHitCount(G4int i=1){fHitCount+=i;}
G4int GetPhotonCount_Scint() const { return fPhotonCount_Scint; }
G4int GetPhotonCount_Ceren() const { return fPhotonCount_Ceren; }
G4int GetHitCount() const { return fHitCount; }
G4double GetEDep() const { return fTotE; }
G4int GetAbsorptionCount() const { return fAbsorptionCount; }
G4int GetBoundaryAbsorptionCount() const { return fBoundaryAbsorptionCount; }
void SetEWeightPos(const G4ThreeVector& p){fEWeightPos=p;}
void SetReconPos(const G4ThreeVector& p){fReconPos=p;}
void SetConvPos(const G4ThreeVector& p){fConvPos=p;fConvPosSet=true;}
void SetPosMax(const G4ThreeVector& p,G4double edep) {
fPosMax = p;
fEdepMax = edep;
}
G4ThreeVector GetEWeightPos() { return fEWeightPos; }
G4ThreeVector GetReconPos() { return fReconPos; }
G4ThreeVector GetConvPos() { return fConvPos; }
G4ThreeVector GetPosMax() { return fPosMax; }
G4double GetEDepMax() { return fEdepMax; }
G4double IsConvPosSet() { return fConvPosSet; }
G4int GetPhotonCount_Scint()const {return fPhotonCount_Scint;}
G4int GetPhotonCount_Ceren()const {return fPhotonCount_Ceren;}
G4int GetHitCount()const {return fHitCount;}
G4double GetEDep()const {return fTotE;}
G4int GetAbsorptionCount()const {return fAbsorptionCount;}
G4int GetBoundaryAbsorptionCount() const {return fBoundaryAbsorptionCount;}
// Gets the total photon count produced
G4int GetPhotonCount() { return fPhotonCount_Scint + fPhotonCount_Ceren; }
G4ThreeVector GetEWeightPos(){return fEWeightPos;}
G4ThreeVector GetReconPos(){return fReconPos;}
G4ThreeVector GetConvPos(){return fConvPos;}
G4ThreeVector GetPosMax(){return fPosMax;}
G4double GetEDepMax(){return fEdepMax;}
G4double IsConvPosSet(){return fConvPosSet;}
void IncPMTSAboveThreshold() { ++fPMTsAboveThreshold; }
G4int GetPMTSAboveThreshold() { return fPMTsAboveThreshold; }
//Gets the total photon count produced
G4int GetPhotonCount(){return fPhotonCount_Scint+fPhotonCount_Ceren;}
private:
LXeEventMessenger* fEventMessenger;
const LXeDetectorConstruction* fDetector;
void IncPMTSAboveThreshold(){fPMTsAboveThreshold++;}
G4int GetPMTSAboveThreshold(){return fPMTsAboveThreshold;}
G4int fScintCollID;
G4int fPMTCollID;
private:
G4int fVerbose;
LXeEventMessenger* fEventMessenger;
const LXeDetectorConstruction* fDetector;
G4int fPMTThreshold;
G4int fScintCollID;
G4int fPMTCollID;
G4bool fForcedrawphotons;
G4bool fForcenophotons;
G4int fVerbose;
G4int fHitCount;
G4int fPhotonCount_Scint;
G4int fPhotonCount_Ceren;
G4int fAbsorptionCount;
G4int fBoundaryAbsorptionCount;
G4int fPMTThreshold;
G4double fTotE;
G4bool fForcedrawphotons;
G4bool fForcenophotons;
// These only have meaning if totE > 0
// If totE = 0 then these won't be set by EndOfEventAction
G4ThreeVector fEWeightPos;
G4ThreeVector fReconPos; // Also relies on hitCount>0
G4ThreeVector fConvPos; // true (initial) converstion position
G4bool fConvPosSet;
G4ThreeVector fPosMax;
G4double fEdepMax;
G4int fHitCount;
G4int fPhotonCount_Scint;
G4int fPhotonCount_Ceren;
G4int fAbsorptionCount;
G4int fBoundaryAbsorptionCount;
G4double fTotE;
//These only have meaning if totE > 0
//If totE = 0 then these wont be set by EndOfEventAction
G4ThreeVector fEWeightPos;
G4ThreeVector fReconPos; //Also relies on hitCount>0
G4ThreeVector fConvPos;//true (initial) converstion position
G4bool fConvPosSet;
G4ThreeVector fPosMax;
G4double fEdepMax;
G4int fPMTsAboveThreshold;
G4int fPMTsAboveThreshold;
};
#endif
@@ -31,29 +31,27 @@
#ifndef LXeEventMessenger_h
#define LXeEventMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
#include "G4UImessenger.hh"
class LXeEventAction;
class G4UIcmdWithAnInteger;
class G4UIcmdWithABool;
class G4UIcmdWithAnInteger;
class LXeEventMessenger: public G4UImessenger
class LXeEventMessenger : public G4UImessenger
{
public:
public:
LXeEventMessenger(LXeEventAction*);
~LXeEventMessenger();
LXeEventMessenger(LXeEventAction*);
virtual ~LXeEventMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
private:
void SetNewValue(G4UIcommand*, G4String) override;
LXeEventAction* fLXeEvent;
G4UIcmdWithAnInteger* fVerboseCmd;
G4UIcmdWithAnInteger* fPmtThresholdCmd;
G4UIcmdWithABool* fForceDrawPhotonsCmd;
G4UIcmdWithABool* fForceDrawNoPhotonsCmd;
private:
LXeEventAction* fLXeEvent;
G4UIcmdWithAnInteger* fVerboseCmd;
G4UIcmdWithAnInteger* fPmtThresholdCmd;
G4UIcmdWithABool* fForceDrawPhotonsCmd;
G4UIcmdWithABool* fForceDrawNoPhotonsCmd;
};
#endif
@@ -27,7 +27,7 @@
/// \brief Definition of the LXeHistoManager class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -38,21 +38,21 @@
#include "g4root.hh"
//#include "g4xml.hh"
//#include "g4csv.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class LXeHistoManager
{
public:
LXeHistoManager();
~LXeHistoManager();
public:
LXeHistoManager();
~LXeHistoManager();
private:
void Book();
G4String fFileName;
private:
void Book();
G4String fFileName;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#endif
@@ -27,81 +27,72 @@
/// \file optical/LXe/include/LXeMainVolume.hh
/// \brief Definition of the LXeMainVolume class
//
#ifndef LXeMainVolume_H
#define LXeMainVolume_H 1
#include "G4PVPlacement.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4Sphere.hh"
#include "G4Material.hh"
#include "G4LogicalVolume.hh"
#include "G4OpticalSurface.hh"
#ifndef LXeMainVolume_h
#define LXeMainVolume_h 1
#include "LXeDetectorConstruction.hh"
#include "G4PVPlacement.hh"
class G4Box;
class G4LogicalVolume;
class G4Sphere;
class G4Tubs;
class LXeMainVolume : public G4PVPlacement
{
public:
public:
LXeMainVolume(G4RotationMatrix* pRot, const G4ThreeVector& tlate,
G4LogicalVolume* pMotherLogical, G4bool pMany, G4int pCopyNo,
LXeDetectorConstruction* c);
LXeMainVolume(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo,
LXeDetectorConstruction* c);
G4LogicalVolume* GetLogPhotoCath() { return fPhotocath_log; }
G4LogicalVolume* GetLogScint() { return fScint_log; }
G4LogicalVolume* GetLogPhotoCath() {return fPhotocath_log;}
G4LogicalVolume* GetLogScint() {return fScint_log;}
std::vector<G4ThreeVector> GetPmtPositions() { return fPmtPositions; }
std::vector<G4ThreeVector> GetPmtPositions() {return fPmtPositions;}
private:
void VisAttributes();
void SurfaceProperties();
private:
void PlacePMTs(G4LogicalVolume* pmt_Log, G4RotationMatrix* rot, G4double& a,
G4double& b, G4double da, G4double db, G4double amin,
G4double bmin, G4int na, G4int nb, G4double& x, G4double& y,
G4double& z, G4int& k);
void VisAttributes();
void SurfaceProperties();
void CopyValues();
void PlacePMTs(G4LogicalVolume* pmt_Log,
G4RotationMatrix* rot,
G4double &a, G4double &b, G4double da,
G4double db, G4double amin, G4double bmin,
G4int na, G4int nb,
G4double &x, G4double &y, G4double &z, G4int &k);
LXeDetectorConstruction* fConstructor;
void CopyValues();
G4double fScint_x;
G4double fScint_y;
G4double fScint_z;
G4double fD_mtl;
G4int fNx;
G4int fNy;
G4int fNz;
G4double fOuterRadius_pmt;
G4bool fSphereOn;
G4double fRefl;
LXeDetectorConstruction* fConstructor;
// Basic Volumes
//
G4Box* fScint_box;
G4Box* fHousing_box;
G4Tubs* fPmt;
G4Tubs* fPhotocath;
G4Sphere* fSphere;
G4double fScint_x;
G4double fScint_y;
G4double fScint_z;
G4double fD_mtl;
G4int fNx;
G4int fNy;
G4int fNz;
G4double fOuterRadius_pmt;
G4bool fSphereOn;
G4double fRefl;
//Basic Volumes
//
G4Box* fScint_box;
G4Box* fHousing_box;
G4Tubs* fPmt;
G4Tubs* fPhotocath;
G4Sphere* fSphere;
// Logical volumes
//
G4LogicalVolume* fScint_log;
G4LogicalVolume* fHousing_log;
G4LogicalVolume* fPmt_log;
G4LogicalVolume* fPhotocath_log;
G4LogicalVolume* fSphere_log;
// Sensitive Detectors positions
std::vector<G4ThreeVector> fPmtPositions;
// Logical volumes
//
G4LogicalVolume* fScint_log;
G4LogicalVolume* fHousing_log;
G4LogicalVolume* fPmt_log;
G4LogicalVolume* fPhotocath_log;
G4LogicalVolume* fSphere_log;
// Sensitive Detectors positions
std::vector<G4ThreeVector> fPmtPositions;
};
#endif
@@ -31,75 +31,71 @@
#ifndef LXePMTHit_h
#define LXePMTHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4THitsCollection.hh"
#include "G4VHit.hh"
#include "G4VPhysicalVolume.hh"
#include "tls.hh"
class G4VTouchable;
class LXePMTHit : public G4VHit
{
public:
LXePMTHit();
virtual ~LXePMTHit();
LXePMTHit(const LXePMTHit &right);
public:
LXePMTHit();
LXePMTHit(const LXePMTHit& right);
~LXePMTHit();
const LXePMTHit& operator=(const LXePMTHit &right);
G4bool operator==(const LXePMTHit &right) const;
const LXePMTHit& operator=(const LXePMTHit& right);
G4bool operator==(const LXePMTHit& right) const;
inline void *operator new(size_t);
inline void operator delete(void *aHit);
virtual void Draw();
virtual void Print();
inline void* operator new(size_t);
inline void operator delete(void* aHit);
inline void SetDrawit(G4bool b){fDrawit=b;}
inline G4bool GetDrawit(){return fDrawit;}
virtual void Draw();
virtual void Print();
inline void IncPhotonCount(){fPhotons++;}
inline G4int GetPhotonCount(){return fPhotons;}
inline void SetDrawit(G4bool b) { fDrawit = b; }
inline G4bool GetDrawit() { return fDrawit; }
inline void SetPMTNumber(G4int n) { fPmtNumber = n; }
inline G4int GetPMTNumber() { return fPmtNumber; }
inline void IncPhotonCount() { ++fPhotons; }
inline G4int GetPhotonCount() { return fPhotons; }
inline void SetPMTPhysVol(G4VPhysicalVolume* physVol){this->fPhysVol=physVol;}
inline G4VPhysicalVolume* GetPMTPhysVol(){return fPhysVol;}
inline void SetPMTNumber(G4int n) { fPmtNumber = n; }
inline G4int GetPMTNumber() { return fPmtNumber; }
inline void SetPMTPos(G4double x,G4double y,G4double z){
fPos=G4ThreeVector(x,y,z);
}
inline G4ThreeVector GetPMTPos(){return fPos;}
inline void SetPMTPhysVol(G4VPhysicalVolume* physVol)
{
this->fPhysVol = physVol;
}
inline G4VPhysicalVolume* GetPMTPhysVol() { return fPhysVol; }
private:
inline void SetPMTPos(G4double x, G4double y, G4double z)
{
fPos = G4ThreeVector(x, y, z);
}
G4int fPmtNumber;
G4int fPhotons;
G4ThreeVector fPos;
G4VPhysicalVolume* fPhysVol;
G4bool fDrawit;
inline G4ThreeVector GetPMTPos() { return fPos; }
private:
G4int fPmtNumber;
G4int fPhotons;
G4ThreeVector fPos;
G4VPhysicalVolume* fPhysVol;
G4bool fDrawit;
};
typedef G4THitsCollection<LXePMTHit> LXePMTHitsCollection;
extern G4ThreadLocal G4Allocator<LXePMTHit>* LXePMTHitAllocator;
inline void* LXePMTHit::operator new(size_t){
inline void* LXePMTHit::operator new(size_t)
{
if(!LXePMTHitAllocator)
LXePMTHitAllocator = new G4Allocator<LXePMTHit>;
return (void *) LXePMTHitAllocator->MallocSingle();
LXePMTHitAllocator = new G4Allocator<LXePMTHit>;
return (void*) LXePMTHitAllocator->MallocSingle();
}
inline void LXePMTHit::operator delete(void *aHit){
inline void LXePMTHit::operator delete(void* aHit)
{
LXePMTHitAllocator->FreeSingle((LXePMTHit*) aHit);
}
@@ -31,54 +31,53 @@
#ifndef LXePMTSD_h
#define LXePMTSD_h 1
#include "G4DataVector.hh"
#include "G4VSensitiveDetector.hh"
#include "LXePMTHit.hh"
#include "G4VSensitiveDetector.hh"
#include <vector>
class G4Step;
class G4DataVector;
class G4HCofThisEvent;
class G4Step;
class LXePMTSD : public G4VSensitiveDetector
{
public:
LXePMTSD(G4String name);
~LXePMTSD();
public:
void Initialize(G4HCofThisEvent*) override;
G4bool ProcessHits(G4Step* aStep, G4TouchableHistory*) override;
LXePMTSD(G4String name);
virtual ~LXePMTSD();
virtual void Initialize(G4HCofThisEvent* );
virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* );
//A version of processHits that keeps aStep constant
G4bool ProcessHits_constStep(const G4Step* ,
G4TouchableHistory* );
virtual void EndOfEvent(G4HCofThisEvent* );
virtual void clear();
void DrawAll();
void PrintAll();
//Initialize the arrays to store pmt possitions
inline void InitPMTs(){
if(fPMTPositionsX)delete fPMTPositionsX;
if(fPMTPositionsY)delete fPMTPositionsY;
if(fPMTPositionsZ)delete fPMTPositionsZ;
fPMTPositionsX = new G4DataVector();
fPMTPositionsY = new G4DataVector();
fPMTPositionsZ = new G4DataVector();
}
// A version of processHits active on boundary
G4bool ProcessHits_boundary(const G4Step*, G4TouchableHistory*);
//Store a pmt position
void SetPmtPositions(const std::vector<G4ThreeVector>& positions);
// Initialize the arrays to store pmt possitions
inline void InitPMTs()
{
if(fPMTPositionsX)
delete fPMTPositionsX;
if(fPMTPositionsY)
delete fPMTPositionsY;
if(fPMTPositionsZ)
delete fPMTPositionsZ;
fPMTPositionsX = new G4DataVector();
fPMTPositionsY = new G4DataVector();
fPMTPositionsZ = new G4DataVector();
}
private:
// Store a pmt position
void SetPmtPositions(const std::vector<G4ThreeVector>& positions);
LXePMTHitsCollection* fPMTHitCollection;
private:
LXePMTHitsCollection* fPMTHitCollection;
G4DataVector* fPMTPositionsX;
G4DataVector* fPMTPositionsY;
G4DataVector* fPMTPositionsZ;
G4DataVector* fPMTPositionsX;
G4DataVector* fPMTPositionsY;
G4DataVector* fPMTPositionsZ;
G4int fHitCID;
};
#endif
@@ -38,18 +38,14 @@ class G4Event;
class LXePrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
public:
LXePrimaryGeneratorAction();
~LXePrimaryGeneratorAction();
LXePrimaryGeneratorAction();
virtual ~LXePrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event* anEvent) override;
virtual void GeneratePrimaries(G4Event* anEvent);
private:
G4ParticleGun* fParticleGun;
private:
G4ParticleGun* fParticleGun;
};
#endif
+57 -44
View File
@@ -33,60 +33,73 @@
#ifndef LXeRun_h
#define LXeRun_h 1
#include "G4Run.hh"
#include "globals.hh"
#include "G4Run.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
class LXeRun : public G4Run
{
public:
LXeRun();
~LXeRun();
public:
LXeRun();
~LXeRun();
void IncPhotonCount_Scint(G4int count) {
fPhotonCount_Scint += count;
fPhotonCount_Scint2 += count*count;
}
void IncPhotonCount_Ceren(G4int count) {
fPhotonCount_Ceren += count;
fPhotonCount_Ceren2 += count*count;
}
void IncEDep(G4double dep) {
fTotE += dep;
fTotE2 += dep*dep;
}
void IncAbsorption(G4int count) {
fAbsorptionCount += count;
fAbsorptionCount2 += count*count;
}
void IncBoundaryAbsorption(G4int count) {
fBoundaryAbsorptionCount += count;
fBoundaryAbsorptionCount2 += count*count;
}
void IncHitCount(G4int count) {
fHitCount += count;
fHitCount2 += count*count;
}
void IncHitsAboveThreshold(G4int count) {
fPMTsAboveThreshold += count;
fPMTsAboveThreshold2 += count*count;
}
void IncPhotonCount_Scint(G4int count)
{
fPhotonCount_Scint += count;
fPhotonCount_Scint2 += count * count;
}
void IncPhotonCount_Ceren(G4int count)
{
fPhotonCount_Ceren += count;
fPhotonCount_Ceren2 += count * count;
}
void IncEDep(G4double dep)
{
fTotE += dep;
fTotE2 += dep * dep;
}
void IncAbsorption(G4int count)
{
fAbsorptionCount += count;
fAbsorptionCount2 += count * count;
}
void IncBoundaryAbsorption(G4int count)
{
fBoundaryAbsorptionCount += count;
fBoundaryAbsorptionCount2 += count * count;
}
void IncHitCount(G4int count)
{
fHitCount += count;
fHitCount2 += count * count;
}
void IncHitsAboveThreshold(G4int count)
{
fPMTsAboveThreshold += count;
fPMTsAboveThreshold2 += count * count;
}
virtual void Merge(const G4Run* run);
void Merge(const G4Run* run) override;
void EndOfRun();
void EndOfRun();
private:
G4int fHitCount;
G4int fHitCount2;
G4int fPhotonCount_Scint;
G4int fPhotonCount_Scint2;
G4int fPhotonCount_Ceren;
G4int fPhotonCount_Ceren2;
G4int fAbsorptionCount;
G4int fAbsorptionCount2;
G4int fBoundaryAbsorptionCount;
G4int fBoundaryAbsorptionCount2;
G4int fPMTsAboveThreshold;
G4int fPMTsAboveThreshold2;
private:
G4int fHitCount, fHitCount2;
G4int fPhotonCount_Scint, fPhotonCount_Scint2;
G4int fPhotonCount_Ceren, fPhotonCount_Ceren2;
G4int fAbsorptionCount, fAbsorptionCount2;
G4int fBoundaryAbsorptionCount, fBoundaryAbsorptionCount2;
G4int fPMTsAboveThreshold, fPMTsAboveThreshold2;
G4double fTotE, fTotE2;
G4double fTotE;
G4double fTotE2;
};
#endif // LXeRun_h
#endif // LXeRun_h
@@ -31,27 +31,26 @@
#include "G4UserRunAction.hh"
#ifndef LXeRunAction_h
#define LXeRunAction_h 1
# define LXeRunAction_h 1
class LXeRun;
class LXeHistoManager;
class G4Run;
class LXeRunAction : public G4UserRunAction
{
public:
public:
LXeRunAction();
~LXeRunAction();
LXeRunAction();
virtual ~LXeRunAction();
G4Run* GenerateRun() override;
void BeginOfRunAction(const G4Run*) override;
void EndOfRunAction(const G4Run*) override;
virtual G4Run* GenerateRun();
virtual void BeginOfRunAction(const G4Run*);
virtual void EndOfRunAction(const G4Run*);
private:
LXeRun* fRun;
LXeHistoManager* fHistoManager;
private:
LXeRun* fRun;
LXeHistoManager* fHistoManager;
};
#endif
@@ -35,44 +35,35 @@
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4VPhysicalVolume.hh"
#include "tls.hh"
class LXeScintHit : public G4VHit
{
public:
LXeScintHit();
LXeScintHit(G4VPhysicalVolume* pVol);
virtual ~LXeScintHit();
LXeScintHit(const LXeScintHit &right);
const LXeScintHit& operator=(const LXeScintHit &right);
G4bool operator==(const LXeScintHit &right) const;
public:
LXeScintHit();
LXeScintHit(G4VPhysicalVolume* pVol);
~LXeScintHit();
inline void *operator new(size_t);
inline void operator delete(void *aHit);
virtual void Draw();
virtual void Print();
LXeScintHit(const LXeScintHit& right);
const LXeScintHit& operator=(const LXeScintHit& right);
G4bool operator==(const LXeScintHit& right) const;
inline void SetEdep(G4double de) { fEdep = de; }
inline void AddEdep(G4double de) { fEdep += de; }
inline G4double GetEdep() { return fEdep; }
inline void* operator new(size_t);
inline void operator delete(void* aHit);
inline void SetPos(G4ThreeVector xyz) { fPos = xyz; }
inline G4ThreeVector GetPos() { return fPos; }
inline void SetEdep(G4double de) { fEdep = de; }
inline void AddEdep(G4double de) { fEdep += de; }
inline G4double GetEdep() { return fEdep; }
inline const G4VPhysicalVolume * GetPhysV() { return fPhysVol; }
inline void SetPos(G4ThreeVector xyz) { fPos = xyz; }
inline G4ThreeVector GetPos() { return fPos; }
private:
G4double fEdep;
G4ThreeVector fPos;
const G4VPhysicalVolume* fPhysVol;
inline const G4VPhysicalVolume* GetPhysV() { return fPhysVol; }
private:
G4double fEdep;
G4ThreeVector fPos;
const G4VPhysicalVolume* fPhysVol;
};
typedef G4THitsCollection<LXeScintHit> LXeScintHitsCollection;
@@ -82,11 +73,11 @@ extern G4ThreadLocal G4Allocator<LXeScintHit>* LXeScintHitAllocator;
inline void* LXeScintHit::operator new(size_t)
{
if(!LXeScintHitAllocator)
LXeScintHitAllocator = new G4Allocator<LXeScintHit>;
return (void *) LXeScintHitAllocator->MallocSingle();
LXeScintHitAllocator = new G4Allocator<LXeScintHit>;
return (void*) LXeScintHitAllocator->MallocSingle();
}
inline void LXeScintHit::operator delete(void *aHit)
inline void LXeScintHit::operator delete(void* aHit)
{
LXeScintHitAllocator->FreeSingle((LXeScintHit*) aHit);
}
@@ -40,22 +40,16 @@ class G4HCofThisEvent;
class LXeScintSD : public G4VSensitiveDetector
{
public:
public:
LXeScintSD(G4String name);
~LXeScintSD();
LXeScintSD(G4String name);
virtual ~LXeScintSD();
void Initialize(G4HCofThisEvent*) override;
G4bool ProcessHits(G4Step* aStep, G4TouchableHistory*) override;
virtual void Initialize(G4HCofThisEvent* );
virtual G4bool ProcessHits(G4Step* aStep, G4TouchableHistory* );
virtual void EndOfEvent(G4HCofThisEvent* );
virtual void clear();
virtual void DrawAll();
virtual void PrintAll();
private:
LXeScintHitsCollection* fScintCollection;
private:
LXeScintHitsCollection* fScintCollection;
G4int fHitsCID;
};
#endif
@@ -28,27 +28,23 @@
/// \brief Definition of the LXeStackingAction class
//
//
#ifndef LXeStackingAction_H
#define LXeStackingAction_H 1
#ifndef LXeStackingAction_h
#define LXeStackingAction_h 1
#include "globals.hh"
#include "G4UserStackingAction.hh"
class LXeEventAction;
class LXeStackingAction : public G4UserStackingAction
{
public:
public:
LXeStackingAction(LXeEventAction*);
~LXeStackingAction();
LXeStackingAction(LXeEventAction*);
virtual ~LXeStackingAction();
virtual G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack);
virtual void NewStage();
virtual void PrepareNewEvent();
private:
LXeEventAction* fEventAction;
G4ClassificationOfNewTrack ClassifyNewTrack(const G4Track* aTrack) override;
private:
LXeEventAction* fEventAction;
};
#endif
@@ -27,13 +27,12 @@
/// \file optical/LXe/include/LXeSteppingAction.hh
/// \brief Definition of the LXeSteppingAction class
//
#ifndef LXeSteppingAction_H
#define LXeSteppingACtion_H 1
#ifndef LXeSteppingAction_h
#define LXeSteppingACtion_h 1
#include "globals.hh"
#include "G4UserSteppingAction.hh"
#include "G4OpBoundaryProcess.hh"
#include "G4UserSteppingAction.hh"
class LXeEventAction;
class LXeTrackingAction;
@@ -41,22 +40,21 @@ class LXeSteppingMessenger;
class LXeSteppingAction : public G4UserSteppingAction
{
public:
public:
LXeSteppingAction(LXeEventAction*);
~LXeSteppingAction();
LXeSteppingAction(LXeEventAction*);
virtual ~LXeSteppingAction();
virtual void UserSteppingAction(const G4Step*);
void UserSteppingAction(const G4Step*) override;
void SetOneStepPrimaries(G4bool b){fOneStepPrimaries=b;}
G4bool GetOneStepPrimaries(){return fOneStepPrimaries;}
private:
void SetOneStepPrimaries(G4bool b) { fOneStepPrimaries = b; }
G4bool GetOneStepPrimaries() { return fOneStepPrimaries; }
G4bool fOneStepPrimaries;
LXeSteppingMessenger* fSteppingMessenger;
LXeEventAction* fEventAction;
private:
G4bool fOneStepPrimaries;
LXeSteppingMessenger* fSteppingMessenger;
LXeEventAction* fEventAction;
G4OpBoundaryProcessStatus fExpectedNextStatus;
G4OpBoundaryProcessStatus fExpectedNextStatus;
};
#endif
@@ -32,24 +32,22 @@
#define LXeSteppingMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class LXeSteppingAction;
class G4UIcmdWithABool;
class LXeSteppingMessenger: public G4UImessenger
class LXeSteppingMessenger : public G4UImessenger
{
public:
LXeSteppingMessenger(LXeSteppingAction*);
virtual ~LXeSteppingMessenger();
virtual void SetNewValue(G4UIcommand*, G4String);
public:
LXeSteppingMessenger(LXeSteppingAction*);
~LXeSteppingMessenger();
private:
void SetNewValue(G4UIcommand*, G4String) override;
LXeSteppingAction* fStepping;
G4UIcmdWithABool* fOneStepPrimariesCmd;
private:
LXeSteppingAction* fStepping;
G4UIcmdWithABool* fOneStepPrimariesCmd;
};
#endif
@@ -31,21 +31,19 @@
#ifndef LXeTrackingAction_h
#define LXeTrackingAction_h 1
#include "G4UserTrackingAction.hh"
#include "globals.hh"
#include "G4UserTrackingAction.hh"
class LXeTrackingAction : public G4UserTrackingAction {
class LXeTrackingAction : public G4UserTrackingAction
{
public:
LXeTrackingAction();
~LXeTrackingAction(){};
public:
LXeTrackingAction();
virtual ~LXeTrackingAction() {};
virtual void PreUserTrackingAction(const G4Track*);
virtual void PostUserTrackingAction(const G4Track*);
private:
void PreUserTrackingAction(const G4Track*) override;
void PostUserTrackingAction(const G4Track*) override;
private:
};
#endif
@@ -30,43 +30,37 @@
#ifndef LXeTrajectory_h
#define LXeTrajectory_h 1
#include "G4Trajectory.hh"
#include "G4Allocator.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "G4ParticleDefinition.hh"
#include "G4TrajectoryPoint.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4Trajectory.hh"
class G4Polyline; // Forward declaration.
class G4Polyline;
class G4ParticleDefinition;
class LXeTrajectory : public G4Trajectory
{
public:
public:
LXeTrajectory();
LXeTrajectory(const G4Track* aTrack);
LXeTrajectory(LXeTrajectory&);
~LXeTrajectory();
LXeTrajectory();
LXeTrajectory(const G4Track* aTrack);
LXeTrajectory(LXeTrajectory &);
virtual ~LXeTrajectory();
virtual void DrawTrajectory() const;
inline void* operator new(size_t);
inline void operator delete(void*);
void DrawTrajectory() const override;
void SetDrawTrajectory(G4bool b){fDrawit=b;}
void WLS(){fWls=true;}
void SetForceDrawTrajectory(G4bool b){fForceDraw=b;}
void SetForceNoDrawTrajectory(G4bool b){fForceNoDraw=b;}
inline void* operator new(size_t);
inline void operator delete(void*);
private:
void SetDrawTrajectory(G4bool b) { fDrawit = b; }
void WLS() { fWls = true; }
void SetForceDrawTrajectory(G4bool b) { fForceDraw = b; }
void SetForceNoDrawTrajectory(G4bool b) { fForceNoDraw = b; }
G4bool fWls;
G4bool fDrawit;
G4bool fForceNoDraw;
G4bool fForceDraw;
G4ParticleDefinition* fParticleDefinition;
private:
G4bool fWls;
G4bool fDrawit;
G4bool fForceNoDraw;
G4bool fForceDraw;
G4ParticleDefinition* fParticleDefinition;
};
extern G4ThreadLocal G4Allocator<LXeTrajectory>* LXeTrajectoryAllocator;
@@ -74,13 +68,13 @@ extern G4ThreadLocal G4Allocator<LXeTrajectory>* LXeTrajectoryAllocator;
inline void* LXeTrajectory::operator new(size_t)
{
if(!LXeTrajectoryAllocator)
LXeTrajectoryAllocator = new G4Allocator<LXeTrajectory>;
return (void*)LXeTrajectoryAllocator->MallocSingle();
LXeTrajectoryAllocator = new G4Allocator<LXeTrajectory>;
return (void*) LXeTrajectoryAllocator->MallocSingle();
}
inline void LXeTrajectory::operator delete(void* aTrajectory)
{
LXeTrajectoryAllocator->FreeSingle((LXeTrajectory*)aTrajectory);
LXeTrajectoryAllocator->FreeSingle((LXeTrajectory*) aTrajectory);
}
#endif
@@ -31,10 +31,17 @@
#include "globals.hh"
#ifndef LXeUserTrackInformation_h
#define LXeUserTrackInformation_h 1
# define LXeUserTrackInformation_h 1
enum LXeTrackStatus { active=1, hitPMT=2, absorbed=4, boundaryAbsorbed=8,
hitSphere=16, inactive=14};
enum LXeTrackStatus
{
active = 1,
hitPMT = 2,
absorbed = 4,
boundaryAbsorbed = 8,
hitSphere = 16,
inactive = 14
};
/*LXeTrackStatus:
active: still being tracked
@@ -44,37 +51,35 @@ enum LXeTrackStatus { active=1, hitPMT=2, absorbed=4, boundaryAbsorbed=8,
hitSphere: track hit the sphere at some point
inactive: track is stopped for some reason
-This is the sum of all stopped flags so can be used to remove stopped flags
*/
class LXeUserTrackInformation : public G4VUserTrackInformation
{
public:
public:
LXeUserTrackInformation();
~LXeUserTrackInformation();
LXeUserTrackInformation();
virtual ~LXeUserTrackInformation();
// Sets the track status to s (does not check validity of flags)
void SetTrackStatusFlags(int s) { fStatus = s; }
// Does a smart add of track status flags (disabling old flags that conflict)
// If s conflicts with itself it will not be detected
void AddTrackStatusFlag(int s);
//Sets the track status to s (does not check validity of flags)
void SetTrackStatusFlags(int s){fStatus=s;}
//Does a smart add of track status flags (disabling old flags that conflict)
//If s conflicts with itself it will not be detected
void AddTrackStatusFlag(int s);
int GetTrackStatus()const {return fStatus;}
void IncReflections(){fReflections++;}
G4int GetReflectionCount()const {return fReflections;}
int GetTrackStatus() const { return fStatus; }
void SetForceDrawTrajectory(G4bool b){fForcedraw=b;}
G4bool GetForceDrawTrajectory(){return fForcedraw;}
void IncReflections() { ++fReflections; }
G4int GetReflectionCount() const { return fReflections; }
inline virtual void Print() const{};
void SetForceDrawTrajectory(G4bool b) { fForcedraw = b; }
G4bool GetForceDrawTrajectory() { return fForcedraw; }
private:
inline virtual void Print() const {};
int fStatus;
G4int fReflections;
G4bool fForcedraw;
private:
int fStatus;
G4int fReflections;
G4bool fForcedraw;
};
#endif
@@ -27,55 +27,46 @@
/// \file optical/LXe/include/LXeWLSFiber.hh
/// \brief Definition of the LXeWLSFiber class
//
#ifndef LXeWLSFiber_H
#define LXeWLSFiber_H 1
#include "G4PVPlacement.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4Sphere.hh"
#include "G4Material.hh"
#include "G4LogicalVolume.hh"
#include "G4OpticalSurface.hh"
#ifndef LXeWLSFiber_h
#define LXeWLSFiber_h 1
#include "LXeDetectorConstruction.hh"
#include "G4PVPlacement.hh"
class G4LogicalVolume;
class LXeWLSFiber : public G4PVPlacement
{
public:
public:
LXeWLSFiber(G4RotationMatrix* pRot, const G4ThreeVector& tlate,
G4LogicalVolume* pMotherLogical, G4bool pMany, G4int pCopyNo,
LXeDetectorConstruction* c);
LXeWLSFiber(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo,
LXeDetectorConstruction* c);
private:
void CopyValues();
private:
static G4LogicalVolume* fClad2_log;
void CopyValues();
G4double fFiber_rmin;
G4double fFiber_rmax;
G4double fFiber_z;
G4double fFiber_sphi;
G4double fFiber_ephi;
static G4LogicalVolume* fClad2_log;
G4double fClad1_rmin;
G4double fClad1_rmax;
G4double fClad1_z;
G4double fClad1_sphi;
G4double fClad1_ephi;
G4double fFiber_rmin;
G4double fFiber_rmax;
G4double fFiber_z;
G4double fFiber_sphi;
G4double fFiber_ephi;
G4double fClad2_rmin;
G4double fClad2_rmax;
G4double fClad2_z;
G4double fClad2_sphi;
G4double fClad2_ephi;
G4double fClad1_rmin;
G4double fClad1_rmax;
G4double fClad1_z;
G4double fClad1_sphi;
G4double fClad1_ephi;
G4double fClad2_rmin;
G4double fClad2_rmax;
G4double fClad2_z;
G4double fClad2_sphi;
G4double fClad2_ephi;
LXeDetectorConstruction* fConstructor;
LXeDetectorConstruction* fConstructor;
};
#endif
@@ -28,42 +28,32 @@
/// \brief Definition of the LXeWLSSlab class
//
//
#ifndef LXeWLSSlab_H
#define LXeWLSSlab_H 1
#ifndef LXeWLSSlab_h
#define LXeWLSSlab_h 1
#include "G4PVPlacement.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4Material.hh"
#include "G4LogicalVolume.hh"
#include "G4OpticalSurface.hh"
#include "LXeDetectorConstruction.hh"
class LXeWLSSlab : public G4PVPlacement
{
public:
public:
LXeWLSSlab(G4RotationMatrix* pRot, const G4ThreeVector& tlate,
G4LogicalVolume* pMotherLogical, G4bool pMany, G4int pCopyNo,
LXeDetectorConstruction* c);
LXeWLSSlab(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo,
LXeDetectorConstruction* c);
private:
void CopyValues();
private:
LXeDetectorConstruction* fConstructor;
void CopyValues();
static G4LogicalVolume* fScintSlab_log;
LXeDetectorConstruction* fConstructor;
static G4LogicalVolume* fScintSlab_log;
G4int fNfibers;
G4double fScint_x;
G4double fScint_y;
G4double fScint_z;
G4double fSlab_z;
G4int fNfibers;
G4double fScint_x;
G4double fScint_y;
G4double fScint_z;
G4double fSlab_z;
};
#endif
+2 -2
View File
@@ -1,4 +1,4 @@
#This sets the gun up to shoot an optical photon
# shoot optical photons
/run/initialize
/gun/particle opticalphoton
@@ -7,5 +7,5 @@
/gun/direction 0 0 1
/gun/polarization 0 1 0
/tracking/verbose 1
/run/beamOn 1
/run/beamOn 10
@@ -1,7 +0,0 @@
#quickly review a particular event
#replace file name with that of the correct event
/run/initialize
/random/resetEngineFrom random/run0.rndm
/tracking/verbose 1
/run/beamOn
@@ -29,26 +29,25 @@
#include "LXeActionInitialization.hh"
#include "LXePrimaryGeneratorAction.hh"
#include "LXeDetectorConstruction.hh"
#include "LXeRunAction.hh"
#include "LXeEventAction.hh"
#include "LXeTrackingAction.hh"
#include "LXeSteppingAction.hh"
#include "LXePrimaryGeneratorAction.hh"
#include "LXeRunAction.hh"
#include "LXeStackingAction.hh"
#include "LXeSteppingAction.hh"
#include "LXeTrackingAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeActionInitialization::LXeActionInitialization(
const LXeDetectorConstruction* det)
: G4VUserActionInitialization(), fDetector(det)
const LXeDetectorConstruction* det)
: G4VUserActionInitialization()
, fDetector(det)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeActionInitialization::~LXeActionInitialization()
{}
LXeActionInitialization::~LXeActionInitialization() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -29,46 +29,46 @@
//
//
#include "LXeDetectorConstruction.hh"
#include "LXePMTSD.hh"
#include "LXeScintSD.hh"
#include "LXeDetectorMessenger.hh"
#include "LXeMainVolume.hh"
#include "LXePMTSD.hh"
#include "LXeScintSD.hh"
#include "LXeWLSSlab.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "globals.hh"
#include "G4Box.hh"
#include "G4GeometryManager.hh"
#include "G4SolidStore.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4LogicalBorderSurface.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4OpticalSurface.hh"
#include "G4MaterialTable.hh"
#include "G4VisAttributes.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4Sphere.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "globals.hh"
#include "G4UImanager.hh"
#include "G4LogicalVolumeStore.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4OpticalSurface.hh"
#include "G4PhysicalConstants.hh"
#include "G4PhysicalVolumeStore.hh"
#include "G4PVPlacement.hh"
#include "G4RunManager.hh"
#include "G4SDManager.hh"
#include "G4SolidStore.hh"
#include "G4Sphere.hh"
#include "G4SystemOfUnits.hh"
#include "G4ThreeVector.hh"
#include "G4Tubs.hh"
#include "G4UImanager.hh"
#include "G4VisAttributes.hh"
G4bool LXeDetectorConstruction::fSphereOn = true;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeDetectorConstruction::LXeDetectorConstruction()
: fLXe_mt(nullptr), fMPTPStyrene(nullptr)
: fLXe_mt(nullptr)
, fMPTPStyrene(nullptr)
{
fExperimentalHall_box = nullptr;
fExperimentalHall_log = nullptr;
fExperimentalHall_box = nullptr;
fExperimentalHall_log = nullptr;
fExperimentalHall_phys = nullptr;
fLXe = fAl = fAir = fVacuum = fGlass = nullptr;
@@ -85,214 +85,206 @@ LXeDetectorConstruction::LXeDetectorConstruction()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeDetectorConstruction::~LXeDetectorConstruction() {}
LXeDetectorConstruction::~LXeDetectorConstruction()
{
if(fMainVolume)
{
delete fMainVolume;
}
delete fLXe_mt;
delete fDetectorMessenger;
delete fMPTPStyrene;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::DefineMaterials(){
void LXeDetectorConstruction::DefineMaterials()
{
G4double a; // atomic mass
G4double z; // atomic number
G4double density;
G4int polyPMMA = 1;
G4int nC_PMMA = 3+2*polyPMMA;
G4int nH_PMMA = 6+2*polyPMMA;
G4int nC_PMMA = 3 + 2 * polyPMMA;
G4int nH_PMMA = 6 + 2 * polyPMMA;
G4int polyeth = 1;
G4int nC_eth = 2*polyeth;
G4int nH_eth = 4*polyeth;
G4int nC_eth = 2 * polyeth;
G4int nH_eth = 4 * polyeth;
//***Elements
fH = new G4Element("H", "H", z=1., a=1.01*g/mole);
fC = new G4Element("C", "C", z=6., a=12.01*g/mole);
fN = new G4Element("N", "N", z=7., a= 14.01*g/mole);
fO = new G4Element("O" , "O", z=8., a= 16.00*g/mole);
fH = new G4Element("H", "H", z = 1., a = 1.01 * g / mole);
fC = new G4Element("C", "C", z = 6., a = 12.01 * g / mole);
fN = new G4Element("N", "N", z = 7., a = 14.01 * g / mole);
fO = new G4Element("O", "O", z = 8., a = 16.00 * g / mole);
//***Materials
//Liquid Xenon
fLXe = new G4Material("LXe",z=54.,a=131.29*g/mole,density=3.020*g/cm3);
//Aluminum
fAl = new G4Material("Al",z=13.,a=26.98*g/mole,density=2.7*g/cm3);
//Vacuum
fVacuum = new G4Material("Vacuum",z=1.,a=1.01*g/mole,
density=universe_mean_density,kStateGas,0.1*kelvin,
1.e-19*pascal);
//Air
fAir = new G4Material("Air", density= 1.29*mg/cm3, 2);
fAir->AddElement(fN, 70*perCent);
fAir->AddElement(fO, 30*perCent);
//Glass
fGlass = new G4Material("Glass", density=1.032*g/cm3,2);
fGlass->AddElement(fC,91.533*perCent);
fGlass->AddElement(fH,8.467*perCent);
//Polystyrene
fPstyrene = new G4Material("Polystyrene", density= 1.03*g/cm3, 2);
// Liquid Xenon
fLXe = new G4Material("LXe", z = 54., a = 131.29 * g / mole,
density = 3.020 * g / cm3);
// Aluminum
fAl = new G4Material("Al", z = 13., a = 26.98 * g / mole,
density = 2.7 * g / cm3);
// Vacuum
fVacuum = new G4Material("Vacuum", z = 1., a = 1.01 * g / mole,
density = universe_mean_density, kStateGas,
0.1 * kelvin, 1.e-19 * pascal);
// Air
fAir = new G4Material("Air", density = 1.29 * mg / cm3, 2);
fAir->AddElement(fN, 70 * perCent);
fAir->AddElement(fO, 30 * perCent);
// Glass
fGlass = new G4Material("Glass", density = 1.032 * g / cm3, 2);
fGlass->AddElement(fC, 91.533 * perCent);
fGlass->AddElement(fH, 8.467 * perCent);
// Polystyrene
fPstyrene = new G4Material("Polystyrene", density = 1.03 * g / cm3, 2);
fPstyrene->AddElement(fC, 8);
fPstyrene->AddElement(fH, 8);
//Fiber(PMMA)
fPMMA = new G4Material("PMMA", density=1190*kg/m3,3);
fPMMA->AddElement(fH,nH_PMMA);
fPMMA->AddElement(fC,nC_PMMA);
fPMMA->AddElement(fO,2);
//Cladding(polyethylene)
fPethylene1 = new G4Material("Pethylene1", density=1200*kg/m3,2);
fPethylene1->AddElement(fH,nH_eth);
fPethylene1->AddElement(fC,nC_eth);
//Double cladding(flourinated polyethylene)
fPethylene2 = new G4Material("Pethylene2", density=1400*kg/m3,2);
fPethylene2->AddElement(fH,nH_eth);
fPethylene2->AddElement(fC,nC_eth);
// Fiber(PMMA)
fPMMA = new G4Material("PMMA", density = 1190. * kg / m3, 3);
fPMMA->AddElement(fH, nH_PMMA);
fPMMA->AddElement(fC, nC_PMMA);
fPMMA->AddElement(fO, 2);
// Cladding(polyethylene)
fPethylene1 = new G4Material("Pethylene1", density = 1200. * kg / m3, 2);
fPethylene1->AddElement(fH, nH_eth);
fPethylene1->AddElement(fC, nC_eth);
// Double cladding(flourinated polyethylene)
fPethylene2 = new G4Material("Pethylene2", density = 1400. * kg / m3, 2);
fPethylene2->AddElement(fH, nH_eth);
fPethylene2->AddElement(fC, nC_eth);
//***Material properties tables
G4double lxe_Energy[] = { 7.0*eV , 7.07*eV, 7.14*eV };
const G4int lxenum = sizeof(lxe_Energy)/sizeof(G4double);
std::vector<G4double> lxe_Energy = { 7.0 * eV, 7.07 * eV, 7.14 * eV };
G4double lxe_SCINT[] = { 0.1, 1.0, 0.1 };
assert(sizeof(lxe_SCINT) == sizeof(lxe_Energy));
G4double lxe_RIND[] = { 1.59 , 1.57, 1.54 };
assert(sizeof(lxe_RIND) == sizeof(lxe_Energy));
G4double lxe_ABSL[] = { 35.*cm, 35.*cm, 35.*cm};
assert(sizeof(lxe_ABSL) == sizeof(lxe_Energy));
std::vector<G4double> lxe_SCINT = { 0.1, 1.0, 0.1 };
std::vector<G4double> lxe_RIND = { 1.59, 1.57, 1.54 };
std::vector<G4double> lxe_ABSL = { 35. * cm, 35. * cm, 35. * cm };
fLXe_mt = new G4MaterialPropertiesTable();
fLXe_mt->AddProperty("FASTCOMPONENT", lxe_Energy, lxe_SCINT, lxenum);
fLXe_mt->AddProperty("SLOWCOMPONENT", lxe_Energy, lxe_SCINT, lxenum);
fLXe_mt->AddProperty("RINDEX", lxe_Energy, lxe_RIND, lxenum);
fLXe_mt->AddProperty("ABSLENGTH", lxe_Energy, lxe_ABSL, lxenum);
fLXe_mt->AddConstProperty("SCINTILLATIONYIELD",12000./MeV);
fLXe_mt->AddConstProperty("RESOLUTIONSCALE",1.0);
fLXe_mt->AddConstProperty("FASTTIMECONSTANT",20.*ns);
fLXe_mt->AddConstProperty("SLOWTIMECONSTANT",45.*ns);
fLXe_mt->AddConstProperty("YIELDRATIO",1.0);
fLXe_mt->AddProperty("SCINTILLATIONCOMPONENT1", lxe_Energy, lxe_SCINT);
fLXe_mt->AddProperty("SCINTILLATIONCOMPONENT2", lxe_Energy, lxe_SCINT);
fLXe_mt->AddProperty("RINDEX", lxe_Energy, lxe_RIND);
fLXe_mt->AddProperty("ABSLENGTH", lxe_Energy, lxe_ABSL);
fLXe_mt->AddConstProperty("SCINTILLATIONYIELD", 12000. / MeV);
fLXe_mt->AddConstProperty("RESOLUTIONSCALE", 1.0);
fLXe_mt->AddConstProperty("SCINTILLATIONTIMECONSTANT1", 20. * ns);
fLXe_mt->AddConstProperty("SCINTILLATIONTIMECONSTANT2", 45. * ns);
fLXe_mt->AddConstProperty("SCINTILLATIONYIELD1", 1.0);
fLXe_mt->AddConstProperty("SCINTILLATIONYIELD2", 0.0);
fLXe->SetMaterialPropertiesTable(fLXe_mt);
// Set the Birks Constant for the LXe scintillator
fLXe->GetIonisation()->SetBirksConstant(0.126 * mm / MeV);
fLXe->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
G4double glass_RIND[]={1.49,1.49,1.49};
assert(sizeof(glass_RIND) == sizeof(lxe_Energy));
G4double glass_AbsLength[]={420.*cm,420.*cm,420.*cm};
assert(sizeof(glass_AbsLength) == sizeof(lxe_Energy));
G4MaterialPropertiesTable *glass_mt = new G4MaterialPropertiesTable();
glass_mt->AddProperty("ABSLENGTH",lxe_Energy,glass_AbsLength,lxenum);
glass_mt->AddProperty("RINDEX",lxe_Energy,glass_RIND,lxenum);
std::vector<G4double> glass_RIND = { 1.49, 1.49, 1.49 };
std::vector<G4double> glass_AbsLength = { 420. * cm, 420. * cm, 420. * cm };
G4MaterialPropertiesTable* glass_mt = new G4MaterialPropertiesTable();
glass_mt->AddProperty("ABSLENGTH", lxe_Energy, glass_AbsLength);
glass_mt->AddProperty("RINDEX", lxe_Energy, glass_RIND);
fGlass->SetMaterialPropertiesTable(glass_mt);
G4double vacuum_Energy[]={2.0*eV,7.0*eV,7.14*eV};
const G4int vacnum = sizeof(vacuum_Energy)/sizeof(G4double);
G4double vacuum_RIND[]={1.,1.,1.};
assert(sizeof(vacuum_RIND) == sizeof(vacuum_Energy));
G4MaterialPropertiesTable *vacuum_mt = new G4MaterialPropertiesTable();
vacuum_mt->AddProperty("RINDEX", vacuum_Energy, vacuum_RIND,vacnum);
std::vector<G4double> vacuum_Energy = { 2.0 * eV, 7.0 * eV, 7.14 * eV };
std::vector<G4double> vacuum_RIND = { 1., 1., 1. };
G4MaterialPropertiesTable* vacuum_mt = new G4MaterialPropertiesTable();
vacuum_mt->AddProperty("RINDEX", vacuum_Energy, vacuum_RIND);
fVacuum->SetMaterialPropertiesTable(vacuum_mt);
fAir->SetMaterialPropertiesTable(vacuum_mt);//Give air the same rindex
fAir->SetMaterialPropertiesTable(vacuum_mt); // Give air the same rindex
G4double wls_Energy[] = {2.00*eV,2.87*eV,2.90*eV,3.47*eV};
const G4int wlsnum = sizeof(wls_Energy)/sizeof(G4double);
G4double rIndexPstyrene[]={ 1.5, 1.5, 1.5, 1.5};
assert(sizeof(rIndexPstyrene) == sizeof(wls_Energy));
G4double absorption1[]={2.*cm, 2.*cm, 2.*cm, 2.*cm};
assert(sizeof(absorption1) == sizeof(wls_Energy));
G4double scintilFast[]={0.00, 0.00, 1.00, 1.00};
assert(sizeof(scintilFast) == sizeof(wls_Energy));
std::vector<G4double> wls_Energy = { 2.00 * eV, 2.87 * eV, 2.90 * eV,
3.47 * eV };
std::vector<G4double> rIndexPstyrene = { 1.5, 1.5, 1.5, 1.5 };
std::vector<G4double> absorption1 = { 2. * cm, 2. * cm, 2. * cm, 2. * cm };
std::vector<G4double> scintilFast = { 0.0, 0.0, 1.0, 1.0 };
fMPTPStyrene = new G4MaterialPropertiesTable();
fMPTPStyrene->AddProperty("RINDEX",wls_Energy,rIndexPstyrene,wlsnum);
fMPTPStyrene->AddProperty("ABSLENGTH",wls_Energy,absorption1,wlsnum);
fMPTPStyrene->AddProperty("FASTCOMPONENT",wls_Energy, scintilFast,wlsnum);
fMPTPStyrene->AddConstProperty("SCINTILLATIONYIELD",10./keV);
fMPTPStyrene->AddConstProperty("RESOLUTIONSCALE",1.0);
fMPTPStyrene->AddConstProperty("FASTTIMECONSTANT", 10.*ns);
fMPTPStyrene->AddProperty("RINDEX", wls_Energy, rIndexPstyrene);
fMPTPStyrene->AddProperty("ABSLENGTH", wls_Energy, absorption1);
fMPTPStyrene->AddProperty("SCINTILLATIONCOMPONENT1", wls_Energy, scintilFast);
fMPTPStyrene->AddConstProperty("SCINTILLATIONYIELD", 10. / keV);
fMPTPStyrene->AddConstProperty("RESOLUTIONSCALE", 1.0);
fMPTPStyrene->AddConstProperty("SCINTILLATIONTIMECONSTANT1", 10. * ns);
fPstyrene->SetMaterialPropertiesTable(fMPTPStyrene);
// Set the Birks Constant for the Polystyrene scintillator
fPstyrene->GetIonisation()->SetBirksConstant(0.126 * mm / MeV);
fPstyrene->GetIonisation()->SetBirksConstant(0.126*mm/MeV);
G4double RefractiveIndexFiber[]={ 1.60, 1.60, 1.60, 1.60};
assert(sizeof(RefractiveIndexFiber) == sizeof(wls_Energy));
G4double AbsFiber[]={9.00*m,9.00*m,0.1*mm,0.1*mm};
assert(sizeof(AbsFiber) == sizeof(wls_Energy));
G4double EmissionFib[]={1.0, 1.0, 0.0, 0.0};
assert(sizeof(EmissionFib) == sizeof(wls_Energy));
std::vector<G4double> RefractiveIndexFiber = { 1.6, 1.6, 1.6, 1.6 };
std::vector<G4double> AbsFiber = { 9.0 * m, 9.0 * m, 0.1 * mm, 0.1 * mm };
std::vector<G4double> EmissionFib = { 1.0, 1.0, 0.0, 0.0 };
G4MaterialPropertiesTable* fiberProperty = new G4MaterialPropertiesTable();
fiberProperty->AddProperty("RINDEX",wls_Energy,RefractiveIndexFiber,wlsnum);
fiberProperty->AddProperty("WLSABSLENGTH",wls_Energy,AbsFiber,wlsnum);
fiberProperty->AddProperty("WLSCOMPONENT",wls_Energy,EmissionFib,wlsnum);
fiberProperty->AddConstProperty("WLSTIMECONSTANT", 0.5*ns);
fiberProperty->AddProperty("RINDEX", wls_Energy, RefractiveIndexFiber);
fiberProperty->AddProperty("WLSABSLENGTH", wls_Energy, AbsFiber);
fiberProperty->AddProperty("WLSCOMPONENT", wls_Energy, EmissionFib);
fiberProperty->AddConstProperty("WLSTIMECONSTANT", 0.5 * ns);
fPMMA->SetMaterialPropertiesTable(fiberProperty);
G4double RefractiveIndexClad1[]={ 1.49, 1.49, 1.49, 1.49};
assert(sizeof(RefractiveIndexClad1) == sizeof(wls_Energy));
G4MaterialPropertiesTable* clad1Property = new G4MaterialPropertiesTable();
clad1Property->AddProperty("RINDEX",wls_Energy,RefractiveIndexClad1,wlsnum);
clad1Property->AddProperty("ABSLENGTH",wls_Energy,AbsFiber,wlsnum);
std::vector<G4double> RefractiveIndexClad1 = { 1.49, 1.49, 1.49, 1.49 };
G4MaterialPropertiesTable* clad1Property = new G4MaterialPropertiesTable();
clad1Property->AddProperty("RINDEX", wls_Energy, RefractiveIndexClad1);
clad1Property->AddProperty("ABSLENGTH", wls_Energy, AbsFiber);
fPethylene1->SetMaterialPropertiesTable(clad1Property);
G4double RefractiveIndexClad2[]={ 1.42, 1.42, 1.42, 1.42};
assert(sizeof(RefractiveIndexClad2) == sizeof(wls_Energy));
G4MaterialPropertiesTable* clad2Property = new G4MaterialPropertiesTable();
clad2Property->AddProperty("RINDEX",wls_Energy,RefractiveIndexClad2,wlsnum);
clad2Property->AddProperty("ABSLENGTH",wls_Energy,AbsFiber,wlsnum);
std::vector<G4double> RefractiveIndexClad2 = { 1.42, 1.42, 1.42, 1.42 };
G4MaterialPropertiesTable* clad2Property = new G4MaterialPropertiesTable();
clad2Property->AddProperty("RINDEX", wls_Energy, RefractiveIndexClad2);
clad2Property->AddProperty("ABSLENGTH", wls_Energy, AbsFiber);
fPethylene2->SetMaterialPropertiesTable(clad2Property);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4VPhysicalVolume* LXeDetectorConstruction::Construct(){
G4VPhysicalVolume* LXeDetectorConstruction::Construct()
{
// The experimental hall walls are all 1m away from housing walls
G4double expHall_x = fScint_x + fD_mtl + 1. * m;
G4double expHall_y = fScint_y + fD_mtl + 1. * m;
G4double expHall_z = fScint_z + fD_mtl + 1. * m;
//The experimental hall walls are all 1m away from housing walls
G4double expHall_x = fScint_x+fD_mtl+1.*m;
G4double expHall_y = fScint_y+fD_mtl+1.*m;
G4double expHall_z = fScint_z+fD_mtl+1.*m;
//Create experimental hall
fExperimentalHall_box
= new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);
fExperimentalHall_log = new G4LogicalVolume(fExperimentalHall_box,
fVacuum,"expHall_log",0,0,0);
fExperimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(),
fExperimentalHall_log,"expHall",0,false,0);
// Create experimental hall
fExperimentalHall_box =
new G4Box("expHall_box", expHall_x, expHall_y, expHall_z);
fExperimentalHall_log =
new G4LogicalVolume(fExperimentalHall_box, fVacuum, "expHall_log", 0, 0, 0);
fExperimentalHall_phys = new G4PVPlacement(
0, G4ThreeVector(), fExperimentalHall_log, "expHall", 0, false, 0);
fExperimentalHall_log->SetVisAttributes(G4VisAttributes::GetInvisible());
//Place the main volume
if(fMainVolumeOn){
fMainVolume
= new LXeMainVolume(0,G4ThreeVector(),fExperimentalHall_log,false,0,this);
// Place the main volume
if(fMainVolumeOn)
{
fMainVolume = new LXeMainVolume(0, G4ThreeVector(), fExperimentalHall_log,
false, 0, this);
}
//Place the WLS slab
if(fWLSslab){
G4VPhysicalVolume* slab = new LXeWLSSlab(0,G4ThreeVector(0.,0.,
-fScint_z/2.-fSlab_z-1.*cm),
fExperimentalHall_log,false,0,
this);
// Place the WLS slab
if(fWLSslab)
{
G4VPhysicalVolume* slab = new LXeWLSSlab(
0, G4ThreeVector(0., 0., -fScint_z / 2. - fSlab_z - 1. * cm),
fExperimentalHall_log, false, 0, this);
//Surface properties for the WLS slab
// Surface properties for the WLS slab
G4OpticalSurface* scintWrap = new G4OpticalSurface("ScintWrap");
new G4LogicalBorderSurface("ScintWrap", slab,
fExperimentalHall_phys,
new G4LogicalBorderSurface("ScintWrap", slab, fExperimentalHall_phys,
scintWrap);
scintWrap->SetType(dielectric_metal);
scintWrap->SetFinish(polished);
scintWrap->SetModel(glisur);
G4double pp[] = {2.0*eV, 3.5*eV};
const G4int num = sizeof(pp)/sizeof(G4double);
G4double reflectivity[] = {1., 1.};
assert(sizeof(reflectivity) == sizeof(pp));
G4double efficiency[] = {0.0, 0.0};
assert(sizeof(efficiency) == sizeof(pp));
G4MaterialPropertiesTable* scintWrapProperty
= new G4MaterialPropertiesTable();
std::vector<G4double> pp = { 2.0 * eV, 3.5 * eV };
std::vector<G4double> reflectivity = { 1.0, 1.0 };
std::vector<G4double> efficiency = { 0.0, 0.0 };
scintWrapProperty->AddProperty("REFLECTIVITY",pp,reflectivity,num);
scintWrapProperty->AddProperty("EFFICIENCY",pp,efficiency,num);
G4MaterialPropertiesTable* scintWrapProperty =
new G4MaterialPropertiesTable();
scintWrapProperty->AddProperty("REFLECTIVITY", pp, reflectivity);
scintWrapProperty->AddProperty("EFFICIENCY", pp, efficiency);
scintWrap->SetMaterialPropertiesTable(scintWrapProperty);
}
@@ -301,15 +293,17 @@ G4VPhysicalVolume* LXeDetectorConstruction::Construct(){
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::ConstructSDandField() {
if (!fMainVolume) return;
void LXeDetectorConstruction::ConstructSDandField()
{
if(!fMainVolume)
return;
// PMT SD
LXePMTSD* pmt = fPmt_SD.Get();
if (!pmt) {
//Created here so it exists as pmts are being placed
if(!pmt)
{
// Created here so it exists as pmts are being placed
G4cout << "Construction /LXeDet/pmtSD" << G4endl;
LXePMTSD* pmt_SD = new LXePMTSD("/LXeDet/pmtSD");
fPmt_SD.Put(pmt_SD);
@@ -317,24 +311,26 @@ void LXeDetectorConstruction::ConstructSDandField() {
pmt_SD->InitPMTs();
pmt_SD->SetPmtPositions(fMainVolume->GetPmtPositions());
}
else {
else
{
pmt->InitPMTs();
pmt->SetPmtPositions(fMainVolume->GetPmtPositions());
}
G4SDManager::GetSDMpointer()->AddNewDetector(fPmt_SD.Get());
//sensitive detector is not actually on the photocathode.
//processHits gets done manually by the stepping action.
//It is used to detect when photons hit and get absorbed&detected at the
//boundary to the photocathode (which doesnt get done by attaching it to a
//logical volume.
//It does however need to be attached to something or else it doesnt get
//reset at the begining of events
// sensitive detector is not actually on the photocathode.
// processHits gets done manually by the stepping action.
// It is used to detect when photons hit and get absorbed & detected at the
// boundary to the photocathode (which doesn't get done by attaching it to a
// logical volume.
// It does however need to be attached to something or else it doesn't get
// reset at the begining of events
SetSensitiveDetector(fMainVolume->GetLogPhotoCath(), fPmt_SD.Get());
// Scint SD
if (!fScint_SD.Get()) {
if(!fScint_SD.Get())
{
G4cout << "Construction /LXeDet/scintSD" << G4endl;
LXeScintSD* scint_SD = new LXeScintSD("/LXeDet/scintSD");
fScint_SD.Put(scint_SD);
@@ -345,137 +341,152 @@ void LXeDetectorConstruction::ConstructSDandField() {
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetDimensions(G4ThreeVector dims) {
fScint_x=dims[0];
fScint_y=dims[1];
fScint_z=dims[2];
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetHousingThickness(G4double d_mtl) {
fD_mtl=d_mtl;
void LXeDetectorConstruction::SetDimensions(G4ThreeVector dims)
{
fScint_x = dims[0];
fScint_y = dims[1];
fScint_z = dims[2];
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetNX(G4int nx) {
fNx=nx;
void LXeDetectorConstruction::SetHousingThickness(G4double d_mtl)
{
fD_mtl = d_mtl;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetNY(G4int ny) {
fNy=ny;
void LXeDetectorConstruction::SetNX(G4int nx)
{
fNx = nx;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetNZ(G4int nz) {
fNz=nz;
void LXeDetectorConstruction::SetNY(G4int ny)
{
fNy = ny;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetPMTRadius(G4double outerRadius_pmt) {
fOuterRadius_pmt=outerRadius_pmt;
void LXeDetectorConstruction::SetNZ(G4int nz)
{
fNz = nz;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetDefaults() {
void LXeDetectorConstruction::SetPMTRadius(G4double outerRadius_pmt)
{
fOuterRadius_pmt = outerRadius_pmt;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//Resets to default values
fD_mtl=0.0635*cm;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
fScint_x = 17.8*cm;
fScint_y = 17.8*cm;
fScint_z = 22.6*cm;
void LXeDetectorConstruction::SetDefaults()
{
// Resets to default values
fD_mtl = 0.0635 * cm;
fScint_x = 17.8 * cm;
fScint_y = 17.8 * cm;
fScint_z = 22.6 * cm;
fNx = 2;
fNy = 2;
fNz = 3;
fOuterRadius_pmt = 2.3*cm;
fOuterRadius_pmt = 2.3 * cm;
fSphereOn = true;
fRefl = 1.0;
fRefl = 1.0;
fNfibers = 15;
fWLSslab = false;
fNfibers = 15;
fWLSslab = false;
fMainVolumeOn = true;
fMainVolume = nullptr;
fSlab_z = 2.5*mm;
fMainVolume = nullptr;
fSlab_z = 2.5 * mm;
G4UImanager::GetUIpointer()
->ApplyCommand("/LXe/detector/scintYieldFactor 1.");
if(fLXe_mt)fLXe_mt->AddConstProperty("SCINTILLATIONYIELD",12000./MeV);
if(fMPTPStyrene)fMPTPStyrene->AddConstProperty("SCINTILLATIONYIELD",10./keV);
G4UImanager::GetUIpointer()->ApplyCommand(
"/LXe/detector/scintYieldFactor 1.");
if(fLXe_mt)
fLXe_mt->AddConstProperty("SCINTILLATIONYIELD", 12000. / MeV);
if(fMPTPStyrene)
fMPTPStyrene->AddConstProperty("SCINTILLATIONYIELD", 10. / keV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetSphereOn(G4bool b) {
fSphereOn=b;
void LXeDetectorConstruction::SetSphereOn(G4bool b)
{
fSphereOn = b;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetHousingReflectivity(G4double r) {
fRefl=r;
void LXeDetectorConstruction::SetHousingReflectivity(G4double r)
{
fRefl = r;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetWLSSlabOn(G4bool b) {
fWLSslab=b;
void LXeDetectorConstruction::SetWLSSlabOn(G4bool b)
{
fWLSslab = b;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetMainVolumeOn(G4bool b) {
fMainVolumeOn=b;
void LXeDetectorConstruction::SetMainVolumeOn(G4bool b)
{
fMainVolumeOn = b;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetNFibers(G4int n) {
fNfibers=n;
void LXeDetectorConstruction::SetNFibers(G4int n)
{
fNfibers = n;
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetMainScintYield(G4double y) {
fLXe_mt->AddConstProperty("SCINTILLATIONYIELD",y/MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetWLSScintYield(G4double y) {
fMPTPStyrene->AddConstProperty("SCINTILLATIONYIELD",y/MeV);
void LXeDetectorConstruction::SetMainScintYield(G4double y)
{
fLXe_mt->AddConstProperty("SCINTILLATIONYIELD", y / MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetSaveThreshold(G4int save){
/*Sets the save threshold for the random number seed. If the number of photons
generated in an event is lower than this, then save the seed for this event
in a file called run###evt###.rndm
*/
fSaveThreshold=save;
void LXeDetectorConstruction::SetWLSScintYield(G4double y)
{
fMPTPStyrene->AddConstProperty("SCINTILLATIONYIELD", y / MeV);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorConstruction::SetSaveThreshold(G4int save)
{
// Sets the save threshold for the random number seed. If the number of
// photons generated in an event is lower than this, then save the seed for
// this event in a file called run###evt###.rndm
fSaveThreshold = save;
G4RunManager::GetRunManager()->SetRandomNumberStore(true);
}
@@ -29,121 +29,122 @@
//
//
#include "LXeDetectorMessenger.hh"
#include "LXeDetectorConstruction.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
#include "G4RunManager.hh"
#include "G4Scintillation.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIcmdWithADouble.hh"
#include "G4Scintillation.hh"
#include "G4RunManager.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWith3VectorAndUnit.hh"
#include "G4UIcommand.hh"
#include "G4UIdirectory.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeDetectorMessenger::LXeDetectorMessenger(LXeDetectorConstruction* detector)
: fLXeDetector(detector)
: fLXeDetector(detector)
{
//Setup a command directory for detector controls with guidance
// Setup a command directory for detector controls with guidance
fDetectorDir = new G4UIdirectory("/LXe/detector/");
fDetectorDir->SetGuidance("Detector geometry control");
fVolumesDir = new G4UIdirectory("/LXe/detector/volumes/");
fVolumesDir->SetGuidance("Enable/disable volumes");
//Various commands for modifying detector geometry
// Various commands for modifying detector geometry
fDimensionsCmd =
new G4UIcmdWith3VectorAndUnit("/LXe/detector/dimensions",this);
new G4UIcmdWith3VectorAndUnit("/LXe/detector/dimensions", this);
fDimensionsCmd->SetGuidance("Set the dimensions of the detector volume.");
fDimensionsCmd->SetParameterName("scint_x","scint_y","scint_z",false);
fDimensionsCmd->SetParameterName("scint_x", "scint_y", "scint_z", false);
fDimensionsCmd->SetDefaultUnit("cm");
fDimensionsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fDimensionsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fDimensionsCmd->SetToBeBroadcasted(false);
fHousingThicknessCmd = new G4UIcmdWithADoubleAndUnit
("/LXe/detector/housingThickness",this);
fHousingThicknessCmd =
new G4UIcmdWithADoubleAndUnit("/LXe/detector/housingThickness", this);
fHousingThicknessCmd->SetGuidance("Set the thickness of the housing.");
fHousingThicknessCmd->SetParameterName("d_mtl",false);
fHousingThicknessCmd->SetParameterName("d_mtl", false);
fHousingThicknessCmd->SetDefaultUnit("cm");
fHousingThicknessCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fHousingThicknessCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fHousingThicknessCmd->SetToBeBroadcasted(false);
fPmtRadiusCmd = new G4UIcmdWithADoubleAndUnit
("/LXe/detector/pmtRadius",this);
fPmtRadiusCmd =
new G4UIcmdWithADoubleAndUnit("/LXe/detector/pmtRadius", this);
fPmtRadiusCmd->SetGuidance("Set the radius of the PMTs.");
fPmtRadiusCmd->SetParameterName("radius",false);
fPmtRadiusCmd->SetParameterName("radius", false);
fPmtRadiusCmd->SetDefaultUnit("cm");
fPmtRadiusCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fPmtRadiusCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fPmtRadiusCmd->SetToBeBroadcasted(false);
fNxCmd = new G4UIcmdWithAnInteger("/LXe/detector/nx",this);
fNxCmd = new G4UIcmdWithAnInteger("/LXe/detector/nx", this);
fNxCmd->SetGuidance("Set the number of PMTs along the x-dimension.");
fNxCmd->SetParameterName("nx",false);
fNxCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fNxCmd->SetParameterName("nx", false);
fNxCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fNxCmd->SetToBeBroadcasted(false);
fNyCmd = new G4UIcmdWithAnInteger("/LXe/detector/ny",this);
fNyCmd = new G4UIcmdWithAnInteger("/LXe/detector/ny", this);
fNyCmd->SetGuidance("Set the number of PMTs along the y-dimension.");
fNyCmd->SetParameterName("ny",false);
fNyCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fNyCmd->SetParameterName("ny", false);
fNyCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fNyCmd->SetToBeBroadcasted(false);
fNzCmd = new G4UIcmdWithAnInteger("/LXe/detector/nz",this);
fNzCmd = new G4UIcmdWithAnInteger("/LXe/detector/nz", this);
fNzCmd->SetGuidance("Set the number of PMTs along the z-dimension.");
fNzCmd->SetParameterName("nz",false);
fNzCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fNzCmd->SetParameterName("nz", false);
fNzCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fNzCmd->SetToBeBroadcasted(false);
fSphereCmd = new G4UIcmdWithABool("/LXe/detector/volumes/sphere",this);
fSphereCmd = new G4UIcmdWithABool("/LXe/detector/volumes/sphere", this);
fSphereCmd->SetGuidance("Enable/Disable the sphere.");
fSphereCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSphereCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fSphereCmd->SetToBeBroadcasted(false);
fReflectivityCmd = new G4UIcmdWithADouble("/LXe/detector/reflectivity",this);
fReflectivityCmd = new G4UIcmdWithADouble("/LXe/detector/reflectivity", this);
fReflectivityCmd->SetGuidance("Set the reflectivity of the housing.");
fReflectivityCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fReflectivityCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fReflectivityCmd->SetToBeBroadcasted(false);
fWlsCmd = new G4UIcmdWithABool("/LXe/detector/volumes/wls",this);
fWlsCmd = new G4UIcmdWithABool("/LXe/detector/volumes/wls", this);
fWlsCmd->SetGuidance("Enable/Disable the WLS slab");
fWlsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fWlsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fWlsCmd->SetToBeBroadcasted(false);
fLxeCmd = new G4UIcmdWithABool("/LXe/detector/volumes/lxe",this);
fLxeCmd = new G4UIcmdWithABool("/LXe/detector/volumes/lxe", this);
fLxeCmd->SetGuidance("Enable/Disable the main detector volume.");
fLxeCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fLxeCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fLxeCmd->SetToBeBroadcasted(false);
fNFibersCmd = new G4UIcmdWithAnInteger("/LXe/detector/nfibers",this);
fNFibersCmd = new G4UIcmdWithAnInteger("/LXe/detector/nfibers", this);
fNFibersCmd->SetGuidance("Set the number of WLS fibers in the WLS slab.");
fNFibersCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fNFibersCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fNFibersCmd->SetToBeBroadcasted(false);
fMainScintYield=new G4UIcmdWithADouble("/LXe/detector/MainScintYield",this);
fMainScintYield =
new G4UIcmdWithADouble("/LXe/detector/MainScintYield", this);
fMainScintYield->SetGuidance("Set scinitillation yield of main volume.");
fMainScintYield->SetGuidance("Specified in photons/MeV");
fMainScintYield->AvailableForStates(G4State_PreInit,G4State_Idle);
fMainScintYield->AvailableForStates(G4State_PreInit, G4State_Idle);
fMainScintYield->SetToBeBroadcasted(false);
fWLSScintYield = new G4UIcmdWithADouble("/LXe/detector/WLSScintYield",this);
fWLSScintYield = new G4UIcmdWithADouble("/LXe/detector/WLSScintYield", this);
fWLSScintYield->SetGuidance("Set scintillation yield of WLS Slab");
fWLSScintYield->SetGuidance("Specified in photons/MeV");
fWLSScintYield->AvailableForStates(G4State_PreInit,G4State_Idle);
fWLSScintYield->AvailableForStates(G4State_PreInit, G4State_Idle);
fWLSScintYield->SetToBeBroadcasted(false);
fSaveThresholdCmd = new G4UIcmdWithAnInteger("/LXe/saveThreshold",this);
fSaveThresholdCmd->
SetGuidance("Set the photon count threshold for saving the random number seed");
fSaveThresholdCmd->SetParameterName("photons",true);
fSaveThresholdCmd = new G4UIcmdWithAnInteger("/LXe/saveThreshold", this);
fSaveThresholdCmd->SetGuidance(
"Set the photon count threshold for saving the random number seed");
fSaveThresholdCmd->SetParameterName("photons", true);
fSaveThresholdCmd->SetDefaultValue(4500);
fSaveThresholdCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fSaveThresholdCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fDefaultsCmd = new G4UIcommand("/LXe/detector/defaults",this);
fDefaultsCmd = new G4UIcommand("/LXe/detector/defaults", this);
fDefaultsCmd->SetGuidance("Set all detector geometry values to defaults.");
fDefaultsCmd->AvailableForStates(G4State_PreInit,G4State_Idle);
fDefaultsCmd->AvailableForStates(G4State_PreInit, G4State_Idle);
fDefaultsCmd->SetToBeBroadcasted(false);
}
@@ -157,8 +158,6 @@ LXeDetectorMessenger::~LXeDetectorMessenger()
delete fNxCmd;
delete fNyCmd;
delete fNzCmd;
delete fDetectorDir;
delete fVolumesDir;
delete fSphereCmd;
delete fWlsCmd;
delete fLxeCmd;
@@ -168,60 +167,76 @@ LXeDetectorMessenger::~LXeDetectorMessenger()
delete fWLSScintYield;
delete fSaveThresholdCmd;
delete fDefaultsCmd;
delete fDetectorDir;
delete fVolumesDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeDetectorMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if( command == fDimensionsCmd ){
if(command == fDimensionsCmd)
{
fLXeDetector->SetDimensions(fDimensionsCmd->GetNew3VectorValue(newValue));
}
else if (command == fHousingThicknessCmd){
fLXeDetector->SetHousingThickness(fHousingThicknessCmd
->GetNewDoubleValue(newValue));
else if(command == fHousingThicknessCmd)
{
fLXeDetector->SetHousingThickness(
fHousingThicknessCmd->GetNewDoubleValue(newValue));
}
else if (command == fPmtRadiusCmd){
else if(command == fPmtRadiusCmd)
{
fLXeDetector->SetPMTRadius(fPmtRadiusCmd->GetNewDoubleValue(newValue));
}
else if (command == fNxCmd){
else if(command == fNxCmd)
{
fLXeDetector->SetNX(fNxCmd->GetNewIntValue(newValue));
}
else if (command == fNyCmd){
else if(command == fNyCmd)
{
fLXeDetector->SetNY(fNyCmd->GetNewIntValue(newValue));
}
else if (command == fNzCmd){
else if(command == fNzCmd)
{
fLXeDetector->SetNZ(fNzCmd->GetNewIntValue(newValue));
}
else if (command == fSphereCmd){
else if(command == fSphereCmd)
{
fLXeDetector->SetSphereOn(fSphereCmd->GetNewBoolValue(newValue));
}
else if (command == fReflectivityCmd){
fLXeDetector
->SetHousingReflectivity(fReflectivityCmd->GetNewDoubleValue(newValue));
else if(command == fReflectivityCmd)
{
fLXeDetector->SetHousingReflectivity(
fReflectivityCmd->GetNewDoubleValue(newValue));
}
else if (command == fWlsCmd){
else if(command == fWlsCmd)
{
fLXeDetector->SetWLSSlabOn(fWlsCmd->GetNewBoolValue(newValue));
}
else if (command == fLxeCmd){
else if(command == fLxeCmd)
{
fLXeDetector->SetMainVolumeOn(fLxeCmd->GetNewBoolValue(newValue));
}
else if (command == fNFibersCmd){
else if(command == fNFibersCmd)
{
fLXeDetector->SetNFibers(fNFibersCmd->GetNewIntValue(newValue));
}
else if (command == fMainScintYield){
fLXeDetector->
SetMainScintYield(fMainScintYield->GetNewDoubleValue(newValue));
else if(command == fMainScintYield)
{
fLXeDetector->SetMainScintYield(
fMainScintYield->GetNewDoubleValue(newValue));
}
else if (command == fWLSScintYield){
else if(command == fWLSScintYield)
{
fLXeDetector->SetWLSScintYield(fWLSScintYield->GetNewDoubleValue(newValue));
}
else if( command == fSaveThresholdCmd ){
else if(command == fSaveThresholdCmd)
{
fLXeDetector->SetSaveThreshold(fSaveThresholdCmd->GetNewIntValue(newValue));
}
else if (command == fDefaultsCmd){
else if(command == fDefaultsCmd)
{
fLXeDetector->SetDefaults();
G4RunManager::GetRunManager()->ReinitializeGeometry(); //Add here this line
G4RunManager::GetRunManager()->ReinitializeGeometry();
}
}
@@ -29,159 +29,185 @@
//
//
#include "LXeEventAction.hh"
#include "LXeScintHit.hh"
#include "LXePMTHit.hh"
#include "LXeTrajectory.hh"
#include "LXeRun.hh"
#include "LXeHistoManager.hh"
#include "LXeDetectorConstruction.hh"
#include "G4EventManager.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "LXeDetectorConstruction.hh"
#include "LXeHistoManager.hh"
#include "LXePMTHit.hh"
#include "LXeRun.hh"
#include "LXeScintHit.hh"
#include "LXeTrajectory.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "G4UImanager.hh"
#include "G4RunManager.hh"
#include "G4SDManager.hh"
#include "G4SystemOfUnits.hh"
#include "G4Trajectory.hh"
#include "G4TrajectoryContainer.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeEventAction::LXeEventAction(const LXeDetectorConstruction* det)
: fDetector(det),fScintCollID(-1),fPMTCollID(-1),fVerbose(0),
fPMTThreshold(1),fForcedrawphotons(false),fForcenophotons(false)
: fDetector(det)
, fScintCollID(-1)
, fPMTCollID(-1)
, fVerbose(0)
, fPMTThreshold(1)
, fForcedrawphotons(false)
, fForcenophotons(false)
{
fEventMessenger = new LXeEventMessenger(this);
fHitCount = 0;
fPhotonCount_Scint = 0;
fPhotonCount_Ceren = 0;
fAbsorptionCount = 0;
fHitCount = 0;
fPhotonCount_Scint = 0;
fPhotonCount_Ceren = 0;
fAbsorptionCount = 0;
fBoundaryAbsorptionCount = 0;
fTotE = 0.0;
fTotE = 0.0;
fConvPosSet = false;
fEdepMax = 0.0;
fEdepMax = 0.0;
fPMTsAboveThreshold = 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeEventAction::~LXeEventAction(){}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeEventAction::BeginOfEventAction(const G4Event*) {
fHitCount = 0;
fPhotonCount_Scint = 0;
fPhotonCount_Ceren = 0;
fAbsorptionCount = 0;
LXeEventAction::~LXeEventAction() { delete fEventMessenger; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeEventAction::BeginOfEventAction(const G4Event*)
{
fHitCount = 0;
fPhotonCount_Scint = 0;
fPhotonCount_Ceren = 0;
fAbsorptionCount = 0;
fBoundaryAbsorptionCount = 0;
fTotE = 0.0;
fTotE = 0.0;
fConvPosSet = false;
fEdepMax = 0.0;
fEdepMax = 0.0;
fPMTsAboveThreshold = 0;
G4SDManager* SDman = G4SDManager::GetSDMpointer();
if(fScintCollID<0)
fScintCollID=SDman->GetCollectionID("scintCollection");
if(fPMTCollID<0)
fPMTCollID=SDman->GetCollectionID("pmtHitCollection");
if(fScintCollID < 0)
fScintCollID = SDman->GetCollectionID("scintCollection");
if(fPMTCollID < 0)
fPMTCollID = SDman->GetCollectionID("pmtHitCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeEventAction::EndOfEventAction(const G4Event* anEvent){
void LXeEventAction::EndOfEventAction(const G4Event* anEvent)
{
G4TrajectoryContainer* trajectoryContainer =
anEvent->GetTrajectoryContainer();
G4TrajectoryContainer* trajectoryContainer=anEvent->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
if(trajectoryContainer)
n_trajectories = trajectoryContainer->entries();
// extract the trajectories and draw them
if (G4VVisManager::GetConcreteInstance()){
for (G4int i=0; i<n_trajectories; i++){
LXeTrajectory* trj = (LXeTrajectory*)
((*(anEvent->GetTrajectoryContainer()))[i]);
if(trj->GetParticleName()=="opticalphoton"){
if(G4VVisManager::GetConcreteInstance())
{
for(G4int i = 0; i < n_trajectories; ++i)
{
LXeTrajectory* trj =
(LXeTrajectory*) ((*(anEvent->GetTrajectoryContainer()))[i]);
if(trj->GetParticleName() == "opticalphoton")
{
trj->SetForceDrawTrajectory(fForcedrawphotons);
trj->SetForceNoDrawTrajectory(fForcenophotons);
}
trj->DrawTrajectory();
}
}
LXeScintHitsCollection* scintHC = nullptr;
LXePMTHitsCollection* pmtHC = nullptr;
G4HCofThisEvent* hitsCE = anEvent->GetHCofThisEvent();
//Get the hit collections
if(hitsCE){
if(fScintCollID>=0) {
scintHC = (LXeScintHitsCollection*)(hitsCE->GetHC(fScintCollID));
LXePMTHitsCollection* pmtHC = nullptr;
G4HCofThisEvent* hitsCE = anEvent->GetHCofThisEvent();
// Get the hit collections
if(hitsCE)
{
if(fScintCollID >= 0)
{
scintHC = (LXeScintHitsCollection*) (hitsCE->GetHC(fScintCollID));
}
if(fPMTCollID>=0) {
pmtHC = (LXePMTHitsCollection*)(hitsCE->GetHC(fPMTCollID));
if(fPMTCollID >= 0)
{
pmtHC = (LXePMTHitsCollection*) (hitsCE->GetHC(fPMTCollID));
}
}
//Hits in scintillator
if(scintHC){
int n_hit = scintHC->entries();
G4ThreeVector eWeightPos(0.);
// Hits in scintillator
if(scintHC)
{
size_t n_hit = scintHC->entries();
G4ThreeVector eWeightPos(0.);
G4double edep;
G4double edepMax=0;
G4double edepMax = 0;
for(int i=0;i<n_hit;i++){ //gather info on hits in scintillator
edep=(*scintHC)[i]->GetEdep();
for(size_t i = 0; i < n_hit; ++i)
{ // gather info on hits in scintillator
edep = (*scintHC)[i]->GetEdep();
fTotE += edep;
eWeightPos += (*scintHC)[i]->GetPos()*edep;//calculate energy weighted pos
if(edep>edepMax){
edepMax=edep;//store max energy deposit
G4ThreeVector posMax=(*scintHC)[i]->GetPos();
fPosMax = posMax;
fEdepMax = edep;
eWeightPos +=
(*scintHC)[i]->GetPos() * edep; // calculate energy weighted pos
if(edep > edepMax)
{
edepMax = edep; // store max energy deposit
G4ThreeVector posMax = (*scintHC)[i]->GetPos();
fPosMax = posMax;
fEdepMax = edep;
}
}
G4AnalysisManager::Instance()->FillH1(7, fTotE);
if(fTotE == 0.){
if(fVerbose>0)G4cout<<"No hits in the scintillator this event."<<G4endl;
if(fTotE == 0.)
{
if(fVerbose > 0)
G4cout << "No hits in the scintillator this event." << G4endl;
}
else{
//Finish calculation of energy weighted position
else
{
// Finish calculation of energy weighted position
eWeightPos /= fTotE;
fEWeightPos = eWeightPos;
if(fVerbose>0){
fEWeightPos = eWeightPos;
if(fVerbose > 0)
{
G4cout << "\tEnergy weighted position of hits in LXe : "
<< eWeightPos/mm << G4endl;
<< eWeightPos / mm << G4endl;
}
}
if(fVerbose>0){
G4cout << "\tTotal energy deposition in scintillator : "
<< fTotE / keV << " (keV)" << G4endl;
if(fVerbose > 0)
{
G4cout << "\tTotal energy deposition in scintillator : " << fTotE / keV
<< " (keV)" << G4endl;
}
}
if(pmtHC){
G4ThreeVector reconPos(0.,0.,0.);
G4int pmts=pmtHC->entries();
//Gather info from all PMTs
for(G4int i=0;i<pmts;i++){
if(pmtHC)
{
G4ThreeVector reconPos(0., 0., 0.);
size_t pmts = pmtHC->entries();
// Gather info from all PMTs
for(size_t i = 0; i < pmts; ++i)
{
fHitCount += (*pmtHC)[i]->GetPhotonCount();
reconPos+=(*pmtHC)[i]->GetPMTPos()*(*pmtHC)[i]->GetPhotonCount();
if((*pmtHC)[i]->GetPhotonCount()>=fPMTThreshold){
fPMTsAboveThreshold++;
reconPos += (*pmtHC)[i]->GetPMTPos() * (*pmtHC)[i]->GetPhotonCount();
if((*pmtHC)[i]->GetPhotonCount() >= fPMTThreshold)
{
++fPMTsAboveThreshold;
}
else{//wasnt above the threshold, turn it back off
else
{ // wasn't above the threshold, turn it back off
(*pmtHC)[i]->SetDrawit(false);
}
}
@@ -189,11 +215,13 @@ void LXeEventAction::EndOfEventAction(const G4Event* anEvent){
G4AnalysisManager::Instance()->FillH1(1, fHitCount);
G4AnalysisManager::Instance()->FillH1(2, fPMTsAboveThreshold);
if(fHitCount > 0) {//dont bother unless there were hits
reconPos/=fHitCount;
if(fVerbose>0){
G4cout << "\tReconstructed position of hits in LXe : "
<< reconPos/mm << G4endl;
if(fHitCount > 0)
{ // don't bother unless there were hits
reconPos /= fHitCount;
if(fVerbose > 0)
{
G4cout << "\tReconstructed position of hits in LXe : " << reconPos / mm
<< G4endl;
}
fReconPos = reconPos;
}
@@ -205,12 +233,13 @@ void LXeEventAction::EndOfEventAction(const G4Event* anEvent){
G4AnalysisManager::Instance()->FillH1(5, fAbsorptionCount);
G4AnalysisManager::Instance()->FillH1(6, fBoundaryAbsorptionCount);
if(fVerbose>0){
//End of event output. later to be controlled by a verbose level
G4cout << "\tNumber of photons that hit PMTs in this event : "
<< fHitCount << G4endl;
G4cout << "\tNumber of PMTs above threshold("<<fPMTThreshold<<") : "
<< fPMTsAboveThreshold << G4endl;
if(fVerbose > 0)
{
// End of event output. later to be controlled by a verbose level
G4cout << "\tNumber of photons that hit PMTs in this event : " << fHitCount
<< G4endl;
G4cout << "\tNumber of PMTs above threshold(" << fPMTThreshold
<< ") : " << fPMTsAboveThreshold << G4endl;
G4cout << "\tNumber of photons produced by scintillation in this event : "
<< fPhotonCount_Scint << G4endl;
G4cout << "\tNumber of photons produced by cerenkov in this event : "
@@ -220,8 +249,8 @@ void LXeEventAction::EndOfEventAction(const G4Event* anEvent){
G4cout << "\tNumber of photons absorbed at boundaries (OpBoundary) in "
<< "this event : " << fBoundaryAbsorptionCount << G4endl;
G4cout << "Unaccounted for photons in this event : "
<< (fPhotonCount_Scint + fPhotonCount_Ceren -
fAbsorptionCount - fHitCount - fBoundaryAbsorptionCount)
<< (fPhotonCount_Scint + fPhotonCount_Ceren - fAbsorptionCount -
fHitCount - fBoundaryAbsorptionCount)
<< G4endl;
}
@@ -237,7 +266,7 @@ void LXeEventAction::EndOfEventAction(const G4Event* anEvent){
run->IncBoundaryAbsorption(fBoundaryAbsorptionCount);
run->IncHitsAboveThreshold(fPMTsAboveThreshold);
//If we have set the flag to save 'special' events, save here
// If we have set the flag to save 'special' events, save here
if(fPhotonCount_Scint + fPhotonCount_Ceren < fDetector->GetSaveThreshold())
{
G4RunManager::GetRunManager()->rndmSaveThisEvent();
@@ -29,6 +29,7 @@
//
//
#include "LXeEventMessenger.hh"
#include "LXeEventAction.hh"
#include "G4UIcmdWithABool.hh"
@@ -37,30 +38,32 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeEventMessenger::LXeEventMessenger(LXeEventAction* event)
: fLXeEvent(event)
: fLXeEvent(event)
{
fVerboseCmd = new G4UIcmdWithAnInteger("/LXe/eventVerbose",this);
fVerboseCmd = new G4UIcmdWithAnInteger("/LXe/eventVerbose", this);
fVerboseCmd->SetGuidance("Set the verbosity of event data.");
fVerboseCmd->SetParameterName("verbose",true);
fVerboseCmd->SetParameterName("verbose", true);
fVerboseCmd->SetDefaultValue(1);
fPmtThresholdCmd = new G4UIcmdWithAnInteger("/LXe/pmtThreshold",this);
fPmtThresholdCmd = new G4UIcmdWithAnInteger("/LXe/pmtThreshold", this);
fPmtThresholdCmd->SetGuidance("Set the pmtThreshold (in # of photons)");
fForceDrawPhotonsCmd=new G4UIcmdWithABool("/LXe/forceDrawPhotons",this);
fForceDrawPhotonsCmd = new G4UIcmdWithABool("/LXe/forceDrawPhotons", this);
fForceDrawPhotonsCmd->SetGuidance("Force drawing of photons.");
fForceDrawPhotonsCmd
->SetGuidance("(Higher priority than /LXe/forceDrawNoPhotons)");
fForceDrawPhotonsCmd->SetGuidance(
"(Higher priority than /LXe/forceDrawNoPhotons)");
fForceDrawNoPhotonsCmd=new G4UIcmdWithABool("/LXe/forceDrawNoPhotons",this);
fForceDrawNoPhotonsCmd =
new G4UIcmdWithABool("/LXe/forceDrawNoPhotons", this);
fForceDrawNoPhotonsCmd->SetGuidance("Force no drawing of photons.");
fForceDrawNoPhotonsCmd
->SetGuidance("(Lower priority than /LXe/forceDrawPhotons)");
fForceDrawNoPhotonsCmd->SetGuidance(
"(Lower priority than /LXe/forceDrawPhotons)");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeEventMessenger::~LXeEventMessenger(){
LXeEventMessenger::~LXeEventMessenger()
{
delete fVerboseCmd;
delete fPmtThresholdCmd;
delete fForceDrawPhotonsCmd;
@@ -69,19 +72,24 @@ LXeEventMessenger::~LXeEventMessenger(){
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeEventMessenger::SetNewValue(G4UIcommand* command, G4String newValue){
if( command == fVerboseCmd ){
void LXeEventMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if(command == fVerboseCmd)
{
fLXeEvent->SetEventVerbose(fVerboseCmd->GetNewIntValue(newValue));
}
else if( command == fPmtThresholdCmd ){
else if(command == fPmtThresholdCmd)
{
fLXeEvent->SetPMTThreshold(fPmtThresholdCmd->GetNewIntValue(newValue));
}
else if(command == fForceDrawPhotonsCmd){
fLXeEvent->SetForceDrawPhotons(fForceDrawPhotonsCmd
->GetNewBoolValue(newValue));
else if(command == fForceDrawPhotonsCmd)
{
fLXeEvent->SetForceDrawPhotons(
fForceDrawPhotonsCmd->GetNewBoolValue(newValue));
}
else if(command == fForceDrawNoPhotonsCmd){
fLXeEvent->SetForceDrawNoPhotons(fForceDrawNoPhotonsCmd
->GetNewBoolValue(newValue));
else if(command == fForceDrawNoPhotonsCmd)
{
fLXeEvent->SetForceDrawNoPhotons(
fForceDrawNoPhotonsCmd->GetNewBoolValue(newValue));
}
}
@@ -27,14 +27,11 @@
/// \brief Implementation of the LXeHistoManager class
//
//
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "LXeHistoManager.hh"
#include "G4UnitsTable.hh"
//#include<vector>
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -46,10 +43,7 @@ LXeHistoManager::LXeHistoManager()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeHistoManager::~LXeHistoManager()
{
delete G4AnalysisManager::Instance();
}
LXeHistoManager::~LXeHistoManager() { delete G4AnalysisManager::Instance(); }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -61,32 +55,44 @@ void LXeHistoManager::Book()
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
analysisManager->SetFileName(fFileName);
analysisManager->SetVerboseLevel(1);
analysisManager->SetActivation(true); // enable inactivation of histograms
analysisManager->SetActivation(true); // enable inactivation of histograms
// Define histogram indices, titles
std::vector<std::pair<G4String, G4String> > histograms =
{ std::pair<G4String, G4String>("0", "dummy"),
std::pair<G4String, G4String>("1", "hits per event"),
std::pair<G4String, G4String>("2", "hits per event above threshold"),
std::pair<G4String, G4String>("3", "scintillation photons per event"),
std::pair<G4String, G4String>("4", "Cerenkov photons per event"),
std::pair<G4String, G4String>("5", "absorbed photons per event"),
std::pair<G4String, G4String>
("6", "photons absorbed at boundary per event"),
std::pair<G4String, G4String>
("7", "energy deposition in scintillator per event"),
};
// Default values (to be reset via /analysis/h1/set command)
G4int nbins = 100;
G4int nbins = 100;
G4double vmin = 0.;
G4double vmax = 100.;
// Create all histograms as inactivated
// as we have not yet set nbins, vmin, vmax
for (auto histogram : histograms) {
G4int ih = analysisManager->
CreateH1("h" + histogram.first, histogram.second, nbins, vmin, vmax);
analysisManager->SetH1Activation(ih, false);
// 0
analysisManager->CreateH1("0", "dummy", nbins, vmin, vmax);
// 1
analysisManager->CreateH1("hits per event", "hits per event", nbins, vmin,
vmax);
// 2
analysisManager->CreateH1("hits above threshold",
"hits per event above threshold", nbins, vmin,
vmax);
// 3
analysisManager->CreateH1("scintillation", "scintillation photons per event",
nbins, vmin, vmax);
// 4
analysisManager->CreateH1("Cerenkov", "Cerenkov photons per event", nbins,
vmin, vmax);
// 5
analysisManager->CreateH1("absorbed", "absorbed photons per event", nbins,
vmin, vmax);
// 6
analysisManager->CreateH1("boundary absorbed",
"photons absorbed at boundary per event", nbins,
vmin, vmax);
// 7
analysisManager->CreateH1(
"E dep", "energy deposition in scintillator per event", nbins, vmin, vmax);
// Create all histograms as inactivated
for(G4int i = 0; i < analysisManager->GetNofH1s(); ++i)
{
analysisManager->SetH1Activation(i, false);
}
}
+170 -171
View File
@@ -28,124 +28,128 @@
/// \brief Implementation of the LXeMainVolume class
//
//
#include "globals.hh"
#include "LXeMainVolume.hh"
#include "globals.hh"
#include "G4Box.hh"
#include "G4Colour.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4LogicalBorderSurface.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4OpticalSurface.hh"
#include "G4Sphere.hh"
#include "G4SystemOfUnits.hh"
#include "G4Tubs.hh"
#include "G4VisAttributes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeMainVolume::LXeMainVolume(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo,
LXeDetectorConstruction* c)
//Pass info to the G4PVPlacement constructor
:G4PVPlacement(pRot,tlate,
//Temp logical volume must be created here
new G4LogicalVolume(new G4Box("temp",1,1,1),
G4Material::GetMaterial("Vacuum"),
"temp",0,0,0),
"housing",pMotherLogical,pMany,pCopyNo),fConstructor(c)
LXeMainVolume::LXeMainVolume(G4RotationMatrix* pRot, const G4ThreeVector& tlate,
G4LogicalVolume* pMotherLogical, G4bool pMany,
G4int pCopyNo, LXeDetectorConstruction* c)
// Pass info to the G4PVPlacement constructor
: G4PVPlacement(pRot, tlate,
// Temp logical volume must be created here
new G4LogicalVolume(new G4Box("temp", 1, 1, 1),
G4Material::GetMaterial("Vacuum"), "temp",
0, 0, 0),
"housing", pMotherLogical, pMany, pCopyNo)
, fConstructor(c)
{
CopyValues();
G4double housing_x=fScint_x+2.*fD_mtl;
G4double housing_y=fScint_y+2.*fD_mtl;
G4double housing_z=fScint_z+2.*fD_mtl;
G4double housing_x = fScint_x + 2. * fD_mtl;
G4double housing_y = fScint_y + 2. * fD_mtl;
G4double housing_z = fScint_z + 2. * fD_mtl;
//*************************** housing and scintillator
fScint_box = new G4Box("scint_box",fScint_x/2.,fScint_y/2.,fScint_z/2.);
fHousing_box = new G4Box("housing_box",housing_x/2.,housing_y/2.,
housing_z/2.);
fScint_log = new G4LogicalVolume(fScint_box,G4Material::GetMaterial("LXe"),
"scint_log",0,0,0);
fHousing_log = new G4LogicalVolume(fHousing_box,
G4Material::GetMaterial("Al"),
"housing_log",0,0,0);
new G4PVPlacement(0,G4ThreeVector(),fScint_log,"scintillator",
fHousing_log,false,0);
fScint_box =
new G4Box("scint_box", fScint_x / 2., fScint_y / 2., fScint_z / 2.);
fHousing_box =
new G4Box("housing_box", housing_x / 2., housing_y / 2., housing_z / 2.);
fScint_log = new G4LogicalVolume(fScint_box, G4Material::GetMaterial("LXe"),
"scint_log", 0, 0, 0);
fHousing_log = new G4LogicalVolume(
fHousing_box, G4Material::GetMaterial("Al"), "housing_log", 0, 0, 0);
new G4PVPlacement(0, G4ThreeVector(), fScint_log, "scintillator",
fHousing_log, false, 0);
//*************** Miscellaneous sphere to demonstrate skin surfaces
fSphere = new G4Sphere("sphere",0.*mm,2.*cm,0.*deg,360.*deg,0.*deg,360.*deg);
fSphere_log = new G4LogicalVolume(fSphere,G4Material::GetMaterial("Al"),
"sphere_log");
fSphere = new G4Sphere("sphere", 0., 2. * cm, 0. * deg, 360. * deg, 0. * deg,
360. * deg);
fSphere_log =
new G4LogicalVolume(fSphere, G4Material::GetMaterial("Al"), "sphere_log");
if(fSphereOn)
new G4PVPlacement(0,G4ThreeVector(5.*cm,5.*cm,5.*cm),
fSphere_log,"sphere",fScint_log,false,0);
new G4PVPlacement(0, G4ThreeVector(5. * cm, 5. * cm, 5. * cm), fSphere_log,
"sphere", fScint_log, false, 0);
//****************** Build PMTs
G4double innerRadius_pmt = 0.*cm;
G4double height_pmt = fD_mtl/2.;
G4double startAngle_pmt = 0.*deg;
G4double spanningAngle_pmt = 360.*deg;
fPmt = new G4Tubs("pmt_tube",innerRadius_pmt,fOuterRadius_pmt,
height_pmt,startAngle_pmt,spanningAngle_pmt);
//the "photocathode" is a metal slab at the back of the glass that
//is only a very rough approximation of the real thing since it only
//absorbs or detects the photons based on the efficiency set below
fPhotocath = new G4Tubs("photocath_tube",innerRadius_pmt,fOuterRadius_pmt,
height_pmt/2,startAngle_pmt,spanningAngle_pmt);
fPmt_log = new G4LogicalVolume(fPmt,G4Material::GetMaterial("Glass"),
"pmt_log");
fPhotocath_log = new G4LogicalVolume(fPhotocath,
G4Material::GetMaterial("Al"),
"photocath_log");
new G4PVPlacement(0,G4ThreeVector(0,0,-height_pmt/2),
fPhotocath_log,"photocath",
fPmt_log,false,0);
G4double innerRadius_pmt = 0.;
G4double height_pmt = fD_mtl / 2.;
G4double startAngle_pmt = 0.;
G4double spanningAngle_pmt = 360. * deg;
fPmt = new G4Tubs("pmt_tube", innerRadius_pmt, fOuterRadius_pmt, height_pmt,
startAngle_pmt, spanningAngle_pmt);
// the "photocathode" is a metal slab at the back of the glass that
// is only a very rough approximation of the real thing since it only
// absorbs or detects the photons based on the efficiency set below
fPhotocath = new G4Tubs("photocath_tube", innerRadius_pmt, fOuterRadius_pmt,
height_pmt / 2., startAngle_pmt, spanningAngle_pmt);
fPmt_log =
new G4LogicalVolume(fPmt, G4Material::GetMaterial("Glass"), "pmt_log");
fPhotocath_log = new G4LogicalVolume(
fPhotocath, G4Material::GetMaterial("Al"), "photocath_log");
new G4PVPlacement(0, G4ThreeVector(0., 0., -height_pmt / 2.), fPhotocath_log,
"photocath", fPmt_log, false, 0);
//***********Arrange pmts around the outside of housing**********
G4double dx = fScint_x/fNx;
G4double dy = fScint_y/fNy;
G4double dz = fScint_z/fNz;
G4double x,y,z;
G4double xmin = -fScint_x/2. - dx/2.;
G4double ymin = -fScint_y/2. - dy/2.;
G4double zmin = -fScint_z/2. - dz/2.;
G4int k=0;
z = -fScint_z/2. - height_pmt; //front
PlacePMTs(fPmt_log,0,x,y,dx,dy,xmin,ymin,fNx,fNy,x,y,z,k);
G4double dx = fScint_x / fNx;
G4double dy = fScint_y / fNy;
G4double dz = fScint_z / fNz;
G4double x, y, z;
G4double xmin = -fScint_x / 2. - dx / 2.;
G4double ymin = -fScint_y / 2. - dy / 2.;
G4double zmin = -fScint_z / 2. - dz / 2.;
G4int k = 0;
z = -fScint_z / 2. - height_pmt; // front
PlacePMTs(fPmt_log, nullptr, x, y, dx, dy, xmin, ymin, fNx, fNy, x, y, z, k);
G4RotationMatrix* rm_z = new G4RotationMatrix();
rm_z->rotateY(180*deg);
z = fScint_z/2. + height_pmt; //back
PlacePMTs(fPmt_log,rm_z,x,y,dx,dy,xmin,ymin,fNx,fNy,x,y,z,k);
rm_z->rotateY(180. * deg);
z = fScint_z / 2. + height_pmt; // back
PlacePMTs(fPmt_log, rm_z, x, y, dx, dy, xmin, ymin, fNx, fNy, x, y, z, k);
G4RotationMatrix* rm_y1 = new G4RotationMatrix();
rm_y1->rotateY(-90*deg);
x = -fScint_x/2. - height_pmt; //left
PlacePMTs(fPmt_log,rm_y1,y,z,dy,dz,ymin,zmin,fNy,fNz,x,y,z,k);
rm_y1->rotateY(-90. * deg);
x = -fScint_x / 2. - height_pmt; // left
PlacePMTs(fPmt_log, rm_y1, y, z, dy, dz, ymin, zmin, fNy, fNz, x, y, z, k);
G4RotationMatrix* rm_y2 = new G4RotationMatrix();
rm_y2->rotateY(90*deg);
x = fScint_x/2. + height_pmt; //right
PlacePMTs(fPmt_log,rm_y2,y,z,dy,dz,ymin,zmin,fNy,fNz,x,y,z,k);
rm_y2->rotateY(90. * deg);
x = fScint_x / 2. + height_pmt; // right
PlacePMTs(fPmt_log, rm_y2, y, z, dy, dz, ymin, zmin, fNy, fNz, x, y, z, k);
G4RotationMatrix* rm_x1 = new G4RotationMatrix();
rm_x1->rotateX(90*deg);
y = -fScint_y/2. - height_pmt; //bottom
PlacePMTs(fPmt_log,rm_x1,x,z,dx,dz,xmin,zmin,fNx,fNz,x,y,z,k);
rm_x1->rotateX(90. * deg);
y = -fScint_y / 2. - height_pmt; // bottom
PlacePMTs(fPmt_log, rm_x1, x, z, dx, dz, xmin, zmin, fNx, fNz, x, y, z, k);
G4RotationMatrix* rm_x2 = new G4RotationMatrix();
rm_x2->rotateX(-90*deg);
y = fScint_y/2. + height_pmt; //top
PlacePMTs(fPmt_log,rm_x2,x,z,dx,dz,xmin,zmin,fNx,fNz,x,y,z,k);
rm_x2->rotateX(-90. * deg);
y = fScint_y / 2. + height_pmt; // top
PlacePMTs(fPmt_log, rm_x2, x, z, dx, dz, xmin, zmin, fNx, fNz, x, y, z, k);
VisAttributes();
SurfaceProperties();
@@ -154,59 +158,62 @@ LXeMainVolume::LXeMainVolume(G4RotationMatrix *pRot,
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeMainVolume::CopyValues(){
fScint_x=fConstructor->GetScintX();
fScint_y=fConstructor->GetScintY();
fScint_z=fConstructor->GetScintZ();
fD_mtl=fConstructor->GetHousingThickness();
fNx=fConstructor->GetNX();
fNy=fConstructor->GetNY();
fNz=fConstructor->GetNZ();
fOuterRadius_pmt=fConstructor->GetPMTRadius();
fSphereOn=fConstructor->GetSphereOn();
fRefl=fConstructor->GetHousingReflectivity();
void LXeMainVolume::CopyValues()
{
fScint_x = fConstructor->GetScintX();
fScint_y = fConstructor->GetScintY();
fScint_z = fConstructor->GetScintZ();
fD_mtl = fConstructor->GetHousingThickness();
fNx = fConstructor->GetNX();
fNy = fConstructor->GetNY();
fNz = fConstructor->GetNZ();
fOuterRadius_pmt = fConstructor->GetPMTRadius();
fSphereOn = fConstructor->GetSphereOn();
fRefl = fConstructor->GetHousingReflectivity();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeMainVolume::PlacePMTs(G4LogicalVolume* pmt_log,
G4RotationMatrix *rot,
G4double &a, G4double &b, G4double da,
G4double db, G4double amin,
G4double bmin, G4int na, G4int nb,
G4double &x, G4double &y, G4double &z,
G4int &k){
/*PlacePMTs : a different way to parameterize placement that does not depend on
calculating the position from the copy number
pmt_log = logical volume for pmts to be placed
rot = rotation matrix to apply
a,b = coordinates to vary(ie. if varying in the xy plane then pass x,y)
da,db = value to increment a,b by
amin,bmin = start values for a,b
na,nb = number of repitions in a and b
x,y,z = just pass x,y, and z by reference (the same ones passed for a,b)
k = copy number to start with
sd = sensitive detector for pmts
*/
a=amin;
for(G4int j=1;j<=na;j++){
a+=da;
b=bmin;
for(G4int i=1;i<=nb;i++){
b+=db;
new G4PVPlacement(rot,G4ThreeVector(x,y,z),pmt_log,"pmt",
fHousing_log,false,k);
fPmtPositions.push_back(G4ThreeVector(x,y,z));
k++;
void LXeMainVolume::PlacePMTs(G4LogicalVolume* pmt_log, G4RotationMatrix* rot,
G4double& a, G4double& b, G4double da,
G4double db, G4double amin, G4double bmin,
G4int na, G4int nb, G4double& x, G4double& y,
G4double& z, G4int& k)
{
/* PlacePMTs : a different way to parameterize placement that does not depend
* on calculating the position from the copy number
*
* pmt_log = logical volume for pmts to be placed
* rot = rotation matrix to apply
* a,b = coordinates to vary(ie. if varying in the xy plane then pass x,y)
* da,db = value to increment a,b by
* amin,bmin = start values for a,b
* na,nb = number of repitions in a and b
* x,y,z = just pass x,y, and z by reference (the same ones passed for a,b)
* k = copy number to start with
* sd = sensitive detector for pmts
*/
a = amin;
for(G4int j = 1; j <= na; ++j)
{
a += da;
b = bmin;
for(G4int i = 1; i <= nb; ++i)
{
b += db;
new G4PVPlacement(rot, G4ThreeVector(x, y, z), pmt_log, "pmt",
fHousing_log, false, k);
fPmtPositions.push_back(G4ThreeVector(x, y, z));
++k;
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeMainVolume::VisAttributes(){
G4VisAttributes* housing_va = new G4VisAttributes(G4Colour(0.8,0.8,0.8));
void LXeMainVolume::VisAttributes()
{
G4VisAttributes* housing_va = new G4VisAttributes(G4Colour(0.8, 0.8, 0.8));
fHousing_log->SetVisAttributes(housing_va);
G4VisAttributes* sphere_va = new G4VisAttributes();
@@ -216,53 +223,45 @@ void LXeMainVolume::VisAttributes(){
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeMainVolume::SurfaceProperties(){
G4double ephoton[] = {7.0*eV, 7.14*eV};
const G4int num = sizeof(ephoton)/sizeof(G4double);
void LXeMainVolume::SurfaceProperties()
{
std::vector<G4double> ephoton = { 7.0 * eV, 7.14 * eV };
//**Scintillator housing properties
G4double reflectivity[] = {fRefl, fRefl};
assert(sizeof(reflectivity) == sizeof(ephoton));
G4double efficiency[] = {0.0, 0.0};
assert(sizeof(efficiency) == sizeof(ephoton));
std::vector<G4double> reflectivity = { fRefl, fRefl };
std::vector<G4double> efficiency = { 0.0, 0.0 };
G4MaterialPropertiesTable* scintHsngPT = new G4MaterialPropertiesTable();
scintHsngPT->AddProperty("REFLECTIVITY", ephoton, reflectivity, num);
scintHsngPT->AddProperty("EFFICIENCY", ephoton, efficiency, num);
scintHsngPT->AddProperty("REFLECTIVITY", ephoton, reflectivity);
scintHsngPT->AddProperty("EFFICIENCY", ephoton, efficiency);
G4OpticalSurface* OpScintHousingSurface =
new G4OpticalSurface("HousingSurface",unified,polished,dielectric_metal);
new G4OpticalSurface("HousingSurface", unified, polished, dielectric_metal);
OpScintHousingSurface->SetMaterialPropertiesTable(scintHsngPT);
//**Sphere surface properties
G4double sphereReflectivity[] = {1.0, 1.0};
assert(sizeof(sphereReflectivity) == sizeof(ephoton));
G4double sphereEfficiency[] = {0.0, 0.0};
assert(sizeof(sphereEfficiency) == sizeof(ephoton));
G4MaterialPropertiesTable* spherePT = new G4MaterialPropertiesTable();
spherePT->AddProperty("REFLECTIVITY", ephoton, sphereReflectivity, num);
spherePT->AddProperty("EFFICIENCY", ephoton, sphereEfficiency, num);
std::vector<G4double> sphereReflectivity = { 1.0, 1.0 };
std::vector<G4double> sphereEfficiency = { 0.0, 0.0 };
G4MaterialPropertiesTable* spherePT = new G4MaterialPropertiesTable();
spherePT->AddProperty("REFLECTIVITY", ephoton, sphereReflectivity);
spherePT->AddProperty("EFFICIENCY", ephoton, sphereEfficiency);
G4OpticalSurface* OpSphereSurface =
new G4OpticalSurface("SphereSurface",unified,polished,dielectric_metal);
new G4OpticalSurface("SphereSurface", unified, polished, dielectric_metal);
OpSphereSurface->SetMaterialPropertiesTable(spherePT);
//**Photocathode surface properties
G4double photocath_EFF[]={1.,1.}; //Enables 'detection' of photons
assert(sizeof(photocath_EFF) == sizeof(ephoton));
G4double photocath_ReR[]={1.92,1.92};
assert(sizeof(photocath_ReR) == sizeof(ephoton));
G4double photocath_ImR[]={1.69,1.69};
assert(sizeof(photocath_ImR) == sizeof(ephoton));
std::vector<G4double> photocath_EFF = { 1., 1. };
std::vector<G4double> photocath_ReR = { 1.92, 1.92 };
std::vector<G4double> photocath_ImR = { 1.69, 1.69 };
G4MaterialPropertiesTable* photocath_mt = new G4MaterialPropertiesTable();
photocath_mt->AddProperty("EFFICIENCY",ephoton,photocath_EFF,num);
photocath_mt->AddProperty("REALRINDEX",ephoton,photocath_ReR,num);
photocath_mt->AddProperty("IMAGINARYRINDEX",ephoton,photocath_ImR,num);
G4OpticalSurface* photocath_opsurf=
new G4OpticalSurface("photocath_opsurf",glisur,polished,
dielectric_metal);
photocath_mt->AddProperty("EFFICIENCY", ephoton, photocath_EFF);
photocath_mt->AddProperty("REALRINDEX", ephoton, photocath_ReR);
photocath_mt->AddProperty("IMAGINARYRINDEX", ephoton, photocath_ImR);
G4OpticalSurface* photocath_opsurf = new G4OpticalSurface(
"photocath_opsurf", glisur, polished, dielectric_metal);
photocath_opsurf->SetMaterialPropertiesTable(photocath_mt);
//**Create logical skin surfaces
new G4LogicalSkinSurface("photocath_surf",fHousing_log,
new G4LogicalSkinSurface("photocath_surf", fHousing_log,
OpScintHousingSurface);
new G4LogicalSkinSurface("sphere_surface",fSphere_log,OpSphereSurface);
new G4LogicalSkinSurface("photocath_surf",fPhotocath_log,photocath_opsurf);
new G4LogicalSkinSurface("sphere_surface", fSphere_log, OpSphereSurface);
new G4LogicalSkinSurface("photocath_surf", fPhotocath_log, photocath_opsurf);
}
+39 -28
View File
@@ -29,19 +29,24 @@
//
//
#include "LXePMTHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
G4ThreadLocal G4Allocator<LXePMTHit>* LXePMTHitAllocator=0;
#include "G4Colour.hh"
#include "G4ios.hh"
#include "G4LogicalVolume.hh"
#include "G4VisAttributes.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VVisManager.hh"
G4ThreadLocal G4Allocator<LXePMTHit>* LXePMTHitAllocator = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXePMTHit::LXePMTHit()
: fPmtNumber(-1),fPhotons(0),fPhysVol(nullptr),fDrawit(false) {}
: fPmtNumber(-1)
, fPhotons(0)
, fPhysVol(nullptr)
, fDrawit(false)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -49,44 +54,50 @@ LXePMTHit::~LXePMTHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXePMTHit::LXePMTHit(const LXePMTHit &right) : G4VHit()
LXePMTHit::LXePMTHit(const LXePMTHit& right)
: G4VHit()
{
fPmtNumber=right.fPmtNumber;
fPhotons=right.fPhotons;
fPhysVol=right.fPhysVol;
fDrawit=right.fDrawit;
fPmtNumber = right.fPmtNumber;
fPhotons = right.fPhotons;
fPhysVol = right.fPhysVol;
fDrawit = right.fDrawit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const LXePMTHit& LXePMTHit::operator=(const LXePMTHit &right){
const LXePMTHit& LXePMTHit::operator=(const LXePMTHit& right)
{
fPmtNumber = right.fPmtNumber;
fPhotons=right.fPhotons;
fPhysVol=right.fPhysVol;
fDrawit=right.fDrawit;
fPhotons = right.fPhotons;
fPhysVol = right.fPhysVol;
fDrawit = right.fDrawit;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool LXePMTHit::operator==(const LXePMTHit &right) const{
return (fPmtNumber==right.fPmtNumber);
G4bool LXePMTHit::operator==(const LXePMTHit& right) const
{
return (fPmtNumber == right.fPmtNumber);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXePMTHit::Draw(){
if(fDrawit&&fPhysVol){ //ReDraw only the PMTs that have hit counts > 0
//Also need a physical volume to be able to draw anything
void LXePMTHit::Draw()
{
if(fDrawit && fPhysVol)
{ // Redraw only the PMTs that have hit counts > 0
// Also need a physical volume to be able to draw anything
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if(pVVisManager){//Make sure that the VisManager exists
G4VisAttributes attribs(G4Colour(1.,0.,0.));
if(pVVisManager)
{ // Make sure that the VisManager exists
G4VisAttributes attribs(G4Colour(1., 0., 0.));
attribs.SetForceSolid(true);
G4RotationMatrix rot;
if(fPhysVol->GetRotation())//If a rotation is defined use it
rot=*(fPhysVol->GetRotation());
G4Transform3D trans(rot,fPhysVol->GetTranslation());//Create transform
pVVisManager->Draw(*fPhysVol,attribs,trans);//Draw it
if(fPhysVol->GetRotation()) // If a rotation is defined use it
rot = *(fPhysVol->GetRotation());
G4Transform3D trans(rot, fPhysVol->GetTranslation()); // Create transform
pVVisManager->Draw(*fPhysVol, attribs, trans); // Draw it
}
}
}
+76 -73
View File
@@ -29,131 +29,134 @@
//
//
#include "LXePMTSD.hh"
#include "LXePMTHit.hh"
#include "LXeDetectorConstruction.hh"
#include "LXePMTHit.hh"
#include "LXeUserTrackInformation.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4ios.hh"
#include "G4ParticleTypes.hh"
#include "G4LogicalVolume.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "G4SDManager.hh"
#include "G4Step.hh"
#include "G4TouchableHistory.hh"
#include "G4Track.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VTouchable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXePMTSD::LXePMTSD(G4String name)
: G4VSensitiveDetector(name),fPMTHitCollection(nullptr),
fPMTPositionsX(nullptr),fPMTPositionsY(nullptr),fPMTPositionsZ(nullptr)
: G4VSensitiveDetector(name)
, fPMTHitCollection(nullptr)
, fPMTPositionsX(nullptr)
, fPMTPositionsY(nullptr)
, fPMTPositionsZ(nullptr)
, fHitCID(-1)
{
collectionName.insert("pmtHitCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXePMTSD::~LXePMTSD() {}
LXePMTSD::~LXePMTSD()
{
delete fPMTPositionsX;
delete fPMTPositionsY;
delete fPMTPositionsZ;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXePMTSD::SetPmtPositions(const std::vector<G4ThreeVector>& positions)
{
for (G4int i=0; i<G4int(positions.size()); ++i) {
if(fPMTPositionsX)fPMTPositionsX->push_back(positions[i].x());
if(fPMTPositionsY)fPMTPositionsY->push_back(positions[i].y());
if(fPMTPositionsZ)fPMTPositionsZ->push_back(positions[i].z());
for(size_t i = 0; i < positions.size(); ++i)
{
if(fPMTPositionsX)
fPMTPositionsX->push_back(positions[i].x());
if(fPMTPositionsY)
fPMTPositionsY->push_back(positions[i].y());
if(fPMTPositionsZ)
fPMTPositionsZ->push_back(positions[i].z());
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXePMTSD::Initialize(G4HCofThisEvent* hitsCE){
fPMTHitCollection = new LXePMTHitsCollection
(SensitiveDetectorName,collectionName[0]);
//Store collection with event and keep ID
static G4int hitCID = -1;
if(hitCID<0){
hitCID = GetCollectionID(0);
void LXePMTSD::Initialize(G4HCofThisEvent* hitsCE)
{
fPMTHitCollection =
new LXePMTHitsCollection(SensitiveDetectorName, collectionName[0]);
if(fHitCID < 0)
{
fHitCID = G4SDManager::GetSDMpointer()->GetCollectionID(fPMTHitCollection);
}
hitsCE->AddHitsCollection( hitCID, fPMTHitCollection );
hitsCE->AddHitsCollection(fHitCID, fPMTHitCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool LXePMTSD::ProcessHits(G4Step* ,G4TouchableHistory* ){
return false;
}
G4bool LXePMTSD::ProcessHits(G4Step*, G4TouchableHistory*) { return false; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
//Generates a hit and uses the postStepPoint's mother volume replica number
//PostStepPoint because the hit is generated manually when the photon is
//absorbed by the photocathode
// Generates a hit and uses the postStepPoint's mother volume replica number
// PostStepPoint because the hit is generated manually when the photon is
// absorbed by the photocathode
G4bool LXePMTSD::ProcessHits_constStep(const G4Step* aStep,
G4TouchableHistory* ){
G4bool LXePMTSD::ProcessHits_boundary(const G4Step* aStep, G4TouchableHistory*)
{
// need to know if this is an optical photon
if(aStep->GetTrack()->GetDefinition() !=
G4OpticalPhoton::OpticalPhotonDefinition())
return false;
//need to know if this is an optical photon
if(aStep->GetTrack()->GetDefinition()
!= G4OpticalPhoton::OpticalPhotonDefinition()) return false;
//User replica number 1 since photocathode is a daughter volume
//to the pmt which was replicated
G4int pmtNumber=
// User replica number 1 since photocathode is a daughter volume
// to the pmt which was replicated
G4int pmtNumber =
aStep->GetPostStepPoint()->GetTouchable()->GetReplicaNumber(1);
G4VPhysicalVolume* physVol=
G4VPhysicalVolume* physVol =
aStep->GetPostStepPoint()->GetTouchable()->GetVolume(1);
//Find the correct hit collection
G4int n=fPMTHitCollection->entries();
// Find the correct hit collection
size_t n = fPMTHitCollection->entries();
LXePMTHit* hit = nullptr;
for(G4int i=0;i<n;i++){
if((*fPMTHitCollection)[i]->GetPMTNumber()==pmtNumber){
hit=(*fPMTHitCollection)[i];
for(size_t i = 0; i < n; ++i)
{
if((*fPMTHitCollection)[i]->GetPMTNumber() == pmtNumber)
{
hit = (*fPMTHitCollection)[i];
break;
}
}
if (hit == nullptr) {//this pmt wasnt previously hit in this event
hit = new LXePMTHit(); //so create new hit
if(hit == nullptr)
{ // this pmt wasn't previously hit in this event
hit = new LXePMTHit(); // so create new hit
hit->SetPMTNumber(pmtNumber);
hit->SetPMTPhysVol(physVol);
fPMTHitCollection->insert(hit);
hit->SetPMTPos((*fPMTPositionsX)[pmtNumber],(*fPMTPositionsY)[pmtNumber],
hit->SetPMTPos((*fPMTPositionsX)[pmtNumber], (*fPMTPositionsY)[pmtNumber],
(*fPMTPositionsZ)[pmtNumber]);
}
hit->IncPhotonCount(); //increment hit for the selected pmt
if(!LXeDetectorConstruction::GetSphereOn()){
hit->IncPhotonCount(); // increment hit for the selected pmt
if(!LXeDetectorConstruction::GetSphereOn())
{
hit->SetDrawit(true);
//If the sphere is disabled then this hit is automaticaly drawn
// If the sphere is disabled then this hit is automaticaly drawn
}
else{//sphere enabled
LXeUserTrackInformation* trackInfo=
(LXeUserTrackInformation*)aStep->GetTrack()->GetUserInformation();
if(trackInfo->GetTrackStatus()&hitSphere)
//only draw this hit if the photon has hit the sphere first
else
{ // sphere enabled
LXeUserTrackInformation* trackInfo =
(LXeUserTrackInformation*) aStep->GetTrack()->GetUserInformation();
if(trackInfo->GetTrackStatus() & hitSphere)
// only draw this hit if the photon has hit the sphere first
hit->SetDrawit(true);
}
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXePMTSD::EndOfEvent(G4HCofThisEvent* ) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXePMTSD::clear() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXePMTSD::DrawAll() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXePMTSD::PrintAll() {}
@@ -30,38 +30,38 @@
//
#include "LXePrimaryGeneratorAction.hh"
#include "globals.hh"
#include "G4Event.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "G4SystemOfUnits.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXePrimaryGeneratorAction::LXePrimaryGeneratorAction(){
LXePrimaryGeneratorAction::LXePrimaryGeneratorAction()
{
G4int n_particle = 1;
fParticleGun = new G4ParticleGun(n_particle);
fParticleGun = new G4ParticleGun(n_particle);
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
fParticleGun->SetParticleDefinition(particleTable->
FindParticle(particleName="gamma"));
//Default energy,position,momentum
fParticleGun->SetParticleEnergy(511.*keV);
fParticleGun->SetParticlePosition(G4ThreeVector(0.0 , 0.0, -20.0*cm));
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,1.));
fParticleGun->SetParticleDefinition(
particleTable->FindParticle(particleName = "gamma"));
// Default energy,position,momentum
fParticleGun->SetParticleEnergy(511. * keV);
fParticleGun->SetParticlePosition(G4ThreeVector(0., 0., -20. * cm));
fParticleGun->SetParticleMomentumDirection(G4ThreeVector(0., 0., 1.));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXePrimaryGeneratorAction::~LXePrimaryGeneratorAction(){
delete fParticleGun;
}
LXePrimaryGeneratorAction::~LXePrimaryGeneratorAction() { delete fParticleGun; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXePrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent){
void LXePrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
fParticleGun->GeneratePrimaryVertex(anEvent);
}
+81 -67
View File
@@ -31,26 +31,27 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
#include "LXeRun.hh"
#include "G4SystemOfUnits.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeRun::LXeRun() : G4Run()
LXeRun::LXeRun()
: G4Run()
{
fHitCount = fHitCount2 = 0;
fPhotonCount_Scint = fPhotonCount_Scint2 = 0;
fPhotonCount_Ceren = fPhotonCount_Ceren2 = 0;
fAbsorptionCount = fAbsorptionCount2 = 0;
fHitCount = fHitCount2 = 0;
fPhotonCount_Scint = fPhotonCount_Scint2 = 0;
fPhotonCount_Ceren = fPhotonCount_Ceren2 = 0;
fAbsorptionCount = fAbsorptionCount2 = 0;
fBoundaryAbsorptionCount = fBoundaryAbsorptionCount2 = 0;
fPMTsAboveThreshold = fPMTsAboveThreshold2 = 0;
fPMTsAboveThreshold = fPMTsAboveThreshold2 = 0;
fTotE = fTotE2 = 0.0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeRun::~LXeRun()
{}
LXeRun::~LXeRun() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -58,20 +59,20 @@ void LXeRun::Merge(const G4Run* run)
{
const LXeRun* localRun = static_cast<const LXeRun*>(run);
fHitCount += localRun->fHitCount;
fHitCount2 += localRun->fHitCount2;
fPMTsAboveThreshold += localRun->fPMTsAboveThreshold;
fPMTsAboveThreshold2 += localRun->fPMTsAboveThreshold2;
fPhotonCount_Scint += localRun->fPhotonCount_Scint;
fPhotonCount_Scint2 += localRun->fPhotonCount_Scint2;
fPhotonCount_Ceren += localRun->fPhotonCount_Ceren;
fPhotonCount_Ceren2 += localRun->fPhotonCount_Ceren2;
fAbsorptionCount += localRun->fAbsorptionCount;
fAbsorptionCount2 += localRun->fAbsorptionCount2;
fBoundaryAbsorptionCount += localRun->fBoundaryAbsorptionCount;
fHitCount += localRun->fHitCount;
fHitCount2 += localRun->fHitCount2;
fPMTsAboveThreshold += localRun->fPMTsAboveThreshold;
fPMTsAboveThreshold2 += localRun->fPMTsAboveThreshold2;
fPhotonCount_Scint += localRun->fPhotonCount_Scint;
fPhotonCount_Scint2 += localRun->fPhotonCount_Scint2;
fPhotonCount_Ceren += localRun->fPhotonCount_Ceren;
fPhotonCount_Ceren2 += localRun->fPhotonCount_Ceren2;
fAbsorptionCount += localRun->fAbsorptionCount;
fAbsorptionCount2 += localRun->fAbsorptionCount2;
fBoundaryAbsorptionCount += localRun->fBoundaryAbsorptionCount;
fBoundaryAbsorptionCount2 += localRun->fBoundaryAbsorptionCount2;
fTotE += localRun->fTotE;
fTotE2 += localRun->fTotE2;
fTotE += localRun->fTotE;
fTotE2 += localRun->fTotE2;
G4Run::Merge(run);
}
@@ -84,72 +85,85 @@ void LXeRun::EndOfRun()
G4int prec = G4cout.precision();
G4int n_evt = numberOfEvent;
G4cout << "The run was " << n_evt << " events." << G4endl;
G4double n_evt = (G4double) numberOfEvent;
G4cout << "The run was " << numberOfEvent << " events." << G4endl;
G4cout.precision(4);
G4double hits = G4double(fHitCount)/n_evt;
G4double hits2 = G4double(fHitCount2)/n_evt;
G4double rms_hits = hits2 - hits*hits;
if (rms_hits > 0.) rms_hits = std::sqrt(rms_hits/n_evt);
else rms_hits = 0.;
G4cout << "Number of hits per event:\t " << hits << " +- " << rms_hits
G4double hits = G4double(fHitCount) / n_evt;
G4double hits2 = G4double(fHitCount2) / n_evt;
G4double rms_hits = hits2 - hits * hits;
if(rms_hits > 0.)
rms_hits = std::sqrt(rms_hits / n_evt);
else
rms_hits = 0.;
G4cout << "Number of hits per event:\t " << hits << " +- " << rms_hits
<< G4endl;
G4double hitsAbove = G4double(fPMTsAboveThreshold)/n_evt;
G4double hitsAbove2 = G4double(fPMTsAboveThreshold2)/n_evt;
G4double rms_hitsAbove = hitsAbove2 - hitsAbove*hitsAbove;
if (rms_hitsAbove > 0.) rms_hitsAbove = std::sqrt(rms_hitsAbove/n_evt);
else rms_hitsAbove = 0.;
G4double hitsAbove = G4double(fPMTsAboveThreshold) / n_evt;
G4double hitsAbove2 = G4double(fPMTsAboveThreshold2) / n_evt;
G4double rms_hitsAbove = hitsAbove2 - hitsAbove * hitsAbove;
if(rms_hitsAbove > 0.)
rms_hitsAbove = std::sqrt(rms_hitsAbove / n_evt);
else
rms_hitsAbove = 0.;
G4cout << "Number of hits per event above threshold:\t " << hitsAbove
G4cout << "Number of hits per event above threshold:\t " << hitsAbove
<< " +- " << rms_hitsAbove << G4endl;
G4double scint = G4double(fPhotonCount_Scint)/n_evt;
G4double scint2 = G4double(fPhotonCount_Scint2)/n_evt;
G4double rms_scint = scint2 - scint*scint;
if (rms_scint > 0.) rms_scint = std::sqrt(rms_scint/n_evt);
else rms_scint = 0.;
G4double scint = G4double(fPhotonCount_Scint) / n_evt;
G4double scint2 = G4double(fPhotonCount_Scint2) / n_evt;
G4double rms_scint = scint2 - scint * scint;
if(rms_scint > 0.)
rms_scint = std::sqrt(rms_scint / n_evt);
else
rms_scint = 0.;
G4cout << "Number of scintillation photons per event :\t " << scint << " +- "
<< rms_scint << G4endl;
G4double ceren = G4double(fPhotonCount_Ceren)/n_evt;
G4double ceren2 = G4double(fPhotonCount_Ceren2)/n_evt;
G4double rms_ceren = ceren2 - ceren*ceren;
if (rms_ceren > 0.) rms_ceren = std::sqrt(rms_ceren/n_evt);
else rms_ceren = 0.;
G4double ceren = G4double(fPhotonCount_Ceren) / n_evt;
G4double ceren2 = G4double(fPhotonCount_Ceren2) / n_evt;
G4double rms_ceren = ceren2 - ceren * ceren;
if(rms_ceren > 0.)
rms_ceren = std::sqrt(rms_ceren / n_evt);
else
rms_ceren = 0.;
G4cout << "Number of Cerenkov photons per event:\t " << ceren << " +- "
G4cout << "Number of Cerenkov photons per event:\t " << ceren << " +- "
<< rms_ceren << G4endl;
G4double absorb = G4double(fAbsorptionCount)/n_evt;
G4double absorb2 = G4double(fAbsorptionCount2)/n_evt;
G4double rms_absorb = absorb2 - absorb*absorb;
if (rms_absorb > 0.) rms_absorb = std::sqrt(rms_absorb/n_evt);
else rms_absorb = 0.;
G4double absorb = G4double(fAbsorptionCount) / n_evt;
G4double absorb2 = G4double(fAbsorptionCount2) / n_evt;
G4double rms_absorb = absorb2 - absorb * absorb;
if(rms_absorb > 0.)
rms_absorb = std::sqrt(rms_absorb / n_evt);
else
rms_absorb = 0.;
G4cout << "Number of absorbed photons per event :\t " << absorb << " +- "
G4cout << "Number of absorbed photons per event :\t " << absorb << " +- "
<< rms_absorb << G4endl;
G4double bdry = G4double(fBoundaryAbsorptionCount)/n_evt;
G4double bdry2 = G4double(fBoundaryAbsorptionCount2)/n_evt;
G4double rms_bdry = bdry2 - bdry*bdry;
if (rms_bdry > 0.) rms_bdry = std::sqrt(rms_bdry/n_evt);
else rms_bdry = 0.;
G4double bdry = G4double(fBoundaryAbsorptionCount) / n_evt;
G4double bdry2 = G4double(fBoundaryAbsorptionCount2) / n_evt;
G4double rms_bdry = bdry2 - bdry * bdry;
if(rms_bdry > 0.)
rms_bdry = std::sqrt(rms_bdry / n_evt);
else
rms_bdry = 0.;
G4cout << "Number of photons absorbed at boundary per event:\t " << bdry
G4cout << "Number of photons absorbed at boundary per event:\t " << bdry
<< " +- " << rms_bdry << G4endl;
//G4cout << "Number of unaccounted for photons: " << G4endl;
G4double en = fTotE/n_evt;
G4double en2 = fTotE2/n_evt;
G4double rms_en = en2 - en*en;
if (rms_en > 0.) rms_en = std::sqrt(rms_en/n_evt);
else rms_en = 0.;
G4double en = fTotE / n_evt;
G4double en2 = fTotE2 / n_evt;
G4double rms_en = en2 - en * en;
if(rms_en > 0.)
rms_en = std::sqrt(rms_en / n_evt);
else
rms_en = 0.;
G4cout << "Total energy deposition in scintillator per event:\t " << en/keV
<< " +- " << rms_en/keV << " keV." << G4endl;
G4cout << "Total energy deposition in scintillator per event:\t " << en / keV
<< " +- " << rms_en / keV << " keV." << G4endl;
G4cout << G4endl;
G4cout.precision(prec);
@@ -29,12 +29,15 @@
//
//
#include "LXeRunAction.hh"
#include "LXeRun.hh"
#include "LXeHistoManager.hh"
#include "LXeRun.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeRunAction::LXeRunAction() : fRun(nullptr), fHistoManager(nullptr)
LXeRunAction::LXeRunAction()
: fRun(nullptr)
, fHistoManager(nullptr)
{
// Book predefined histograms
fHistoManager = new LXeHistoManager();
@@ -42,10 +45,7 @@ LXeRunAction::LXeRunAction() : fRun(nullptr), fHistoManager(nullptr)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeRunAction::~LXeRunAction()
{
delete fHistoManager;
}
LXeRunAction::~LXeRunAction() { delete fHistoManager; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4Run* LXeRunAction::GenerateRun()
@@ -59,19 +59,23 @@ G4Run* LXeRunAction::GenerateRun()
void LXeRunAction::BeginOfRunAction(const G4Run*)
{
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
if (analysisManager->IsActive()) {
if(analysisManager->IsActive())
{
analysisManager->OpenFile();
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeRunAction::EndOfRunAction(const G4Run*){
if (isMaster) fRun->EndOfRun();
void LXeRunAction::EndOfRunAction(const G4Run*)
{
if(isMaster)
fRun->EndOfRun();
// save histograms
G4AnalysisManager* analysisManager = G4AnalysisManager::Instance();
if (analysisManager->IsActive()) {
if(analysisManager->IsActive())
{
analysisManager->Write();
analysisManager->CloseFile();
}
@@ -29,22 +29,29 @@
//
//
#include "LXeScintHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
#include "G4VisAttributes.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VVisManager.hh"
G4ThreadLocal G4Allocator<LXeScintHit>* LXeScintHitAllocator = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeScintHit::LXeScintHit() : fEdep(0.), fPos(0.), fPhysVol(nullptr) {}
LXeScintHit::LXeScintHit()
: fEdep(0.)
, fPos(0.)
, fPhysVol(nullptr)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeScintHit::LXeScintHit(G4VPhysicalVolume* pVol) : fPhysVol(pVol) {}
LXeScintHit::LXeScintHit(G4VPhysicalVolume* pVol)
: fPhysVol(pVol)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -52,33 +59,28 @@ LXeScintHit::~LXeScintHit() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeScintHit::LXeScintHit(const LXeScintHit &right) : G4VHit()
LXeScintHit::LXeScintHit(const LXeScintHit& right)
: G4VHit()
{
fEdep = right.fEdep;
fPos = right.fPos;
fEdep = right.fEdep;
fPos = right.fPos;
fPhysVol = right.fPhysVol;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
const LXeScintHit& LXeScintHit::operator=(const LXeScintHit &right){
fEdep = right.fEdep;
fPos = right.fPos;
const LXeScintHit& LXeScintHit::operator=(const LXeScintHit& right)
{
fEdep = right.fEdep;
fPos = right.fPos;
fPhysVol = right.fPhysVol;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool LXeScintHit::operator==(const LXeScintHit&) const{
G4bool LXeScintHit::operator==(const LXeScintHit&) const
{
return false;
//returns false because there currently isnt need to check for equality yet
// returns false because there currently isn't need to check for equality
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeScintHit::Draw() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeScintHit::Print() {}
+28 -35
View File
@@ -29,21 +29,25 @@
//
//
#include "LXeScintSD.hh"
#include "LXeScintHit.hh"
#include "G4VPhysicalVolume.hh"
#include "G4LogicalVolume.hh"
#include "G4Track.hh"
#include "G4Step.hh"
#include "G4ParticleDefinition.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4ios.hh"
#include "G4LogicalVolume.hh"
#include "G4ParticleDefinition.hh"
#include "G4SDManager.hh"
#include "G4Step.hh"
#include "G4TouchableHistory.hh"
#include "G4Track.hh"
#include "G4VPhysicalVolume.hh"
#include "G4VProcess.hh"
#include "G4VTouchable.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeScintSD::LXeScintSD(G4String name)
: G4VSensitiveDetector(name)
, fHitsCID(-1)
{
fScintCollection = nullptr;
collectionName.insert("scintCollection");
@@ -55,33 +59,36 @@ LXeScintSD::~LXeScintSD() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeScintSD::Initialize(G4HCofThisEvent* hitsCE){
fScintCollection = new LXeScintHitsCollection
(SensitiveDetectorName,collectionName[0]);
//A way to keep all the hits of this event in one place if needed
static G4int hitsCID = -1;
if(hitsCID<0){
hitsCID = GetCollectionID(0);
void LXeScintSD::Initialize(G4HCofThisEvent* hitsCE)
{
fScintCollection =
new LXeScintHitsCollection(SensitiveDetectorName, collectionName[0]);
if(fHitsCID < 0)
{
fHitsCID = G4SDManager::GetSDMpointer()->GetCollectionID(fScintCollection);
}
hitsCE->AddHitsCollection( hitsCID, fScintCollection );
hitsCE->AddHitsCollection(fHitsCID, fScintCollection);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4bool LXeScintSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ){
G4bool LXeScintSD::ProcessHits(G4Step* aStep, G4TouchableHistory*)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.) return false; //No edep so dont count as hit
if(edep == 0.)
return false; // No edep so don't count as hit
G4StepPoint* thePrePoint = aStep->GetPreStepPoint();
G4TouchableHistory* theTouchable =
(G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
(G4TouchableHistory*) (aStep->GetPreStepPoint()->GetTouchable());
G4VPhysicalVolume* thePrePV = theTouchable->GetVolume();
G4StepPoint* thePostPoint = aStep->GetPostStepPoint();
//Get the average position of the hit
// Get the average position of the hit
G4ThreeVector pos = thePrePoint->GetPosition() + thePostPoint->GetPosition();
pos/=2.;
pos /= 2.;
LXeScintHit* scintHit = new LXeScintHit(thePrePV);
@@ -94,17 +101,3 @@ G4bool LXeScintSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ){
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeScintSD::EndOfEvent(G4HCofThisEvent* ) {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeScintSD::clear() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeScintSD::DrawAll() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeScintSD::PrintAll() {}
@@ -29,21 +29,17 @@
//
//
#include "LXeStackingAction.hh"
#include "LXeEventAction.hh"
#include "LXeSteppingAction.hh"
#include "G4ios.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
#include "LXeEventAction.hh"
#include "G4OpticalPhoton.hh"
#include "G4Track.hh"
#include "G4RunManager.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4VProcess.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeStackingAction::LXeStackingAction(LXeEventAction* ea)
: fEventAction(ea)
: fEventAction(ea)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -52,29 +48,21 @@ LXeStackingAction::~LXeStackingAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
G4ClassificationOfNewTrack
LXeStackingAction::ClassifyNewTrack(const G4Track * aTrack){
//Count what process generated the optical photons
if(aTrack->GetDefinition()==G4OpticalPhoton::OpticalPhotonDefinition()){
G4ClassificationOfNewTrack LXeStackingAction::ClassifyNewTrack(
const G4Track* aTrack)
{
// Count what process generated the optical photons
if(aTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition())
{
// particle is optical photon
if(aTrack->GetParentID()>0){
if(aTrack->GetParentID() > 0)
{
// particle is secondary
if(aTrack->GetCreatorProcess()->GetProcessName()=="Scintillation")
if(aTrack->GetCreatorProcess()->GetProcessName() == "Scintillation")
fEventAction->IncPhotonCount_Scint();
else if(aTrack->GetCreatorProcess()->GetProcessName()=="Cerenkov")
else if(aTrack->GetCreatorProcess()->GetProcessName() == "Cerenkov")
fEventAction->IncPhotonCount_Ceren();
}
}
else{
}
return fUrgent;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeStackingAction::NewStage() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeStackingAction::PrepareNewEvent() {}
@@ -29,31 +29,28 @@
//
//
#include "LXeSteppingAction.hh"
#include "LXeEventAction.hh"
#include "LXeTrackingAction.hh"
#include "LXeTrajectory.hh"
#include "LXePMTSD.hh"
#include "LXeUserTrackInformation.hh"
#include "LXeSteppingMessenger.hh"
#include "G4SteppingManager.hh"
#include "G4SDManager.hh"
#include "G4EventManager.hh"
#include "LXeEventAction.hh"
#include "LXePMTSD.hh"
#include "LXeSteppingMessenger.hh"
#include "LXeTrajectory.hh"
#include "LXeUserTrackInformation.hh"
#include "G4OpticalPhoton.hh"
#include "G4ProcessManager.hh"
#include "G4Track.hh"
#include "G4SDManager.hh"
#include "G4Step.hh"
#include "G4Event.hh"
#include "G4SteppingManager.hh"
#include "G4StepPoint.hh"
#include "G4Track.hh"
#include "G4TrackStatus.hh"
#include "G4VPhysicalVolume.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleTypes.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeSteppingAction::LXeSteppingAction(LXeEventAction* ea)
: fOneStepPrimaries(false),
fEventAction(ea)
: fOneStepPrimaries(false)
, fEventAction(ea)
{
fSteppingMessenger = new LXeSteppingMessenger(this);
@@ -62,144 +59,158 @@ LXeSteppingAction::LXeSteppingAction(LXeEventAction* ea)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeSteppingAction::~LXeSteppingAction() {}
LXeSteppingAction::~LXeSteppingAction() { delete fSteppingMessenger; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeSteppingAction::UserSteppingAction(const G4Step * theStep){
void LXeSteppingAction::UserSteppingAction(const G4Step* theStep)
{
G4Track* theTrack = theStep->GetTrack();
if ( theTrack->GetCurrentStepNumber() == 1 ) fExpectedNextStatus = Undefined;
LXeUserTrackInformation* trackInformation
=(LXeUserTrackInformation*)theTrack->GetUserInformation();
if(theTrack->GetCurrentStepNumber() == 1)
fExpectedNextStatus = Undefined;
G4StepPoint* thePrePoint = theStep->GetPreStepPoint();
LXeUserTrackInformation* trackInformation =
(LXeUserTrackInformation*) theTrack->GetUserInformation();
G4StepPoint* thePrePoint = theStep->GetPreStepPoint();
G4VPhysicalVolume* thePrePV = thePrePoint->GetPhysicalVolume();
G4StepPoint* thePostPoint = theStep->GetPostStepPoint();
G4StepPoint* thePostPoint = theStep->GetPostStepPoint();
G4VPhysicalVolume* thePostPV = thePostPoint->GetPhysicalVolume();
G4OpBoundaryProcessStatus boundaryStatus=Undefined;
G4OpBoundaryProcessStatus boundaryStatus = Undefined;
static G4ThreadLocal G4OpBoundaryProcess* boundary = nullptr;
//find the boundary process only once
if(!boundary){
G4ProcessManager* pm
= theStep->GetTrack()->GetDefinition()->GetProcessManager();
G4int nprocesses = pm->GetProcessListLength();
// find the boundary process only once
if(!boundary)
{
G4ProcessManager* pm =
theStep->GetTrack()->GetDefinition()->GetProcessManager();
G4int nprocesses = pm->GetProcessListLength();
G4ProcessVector* pv = pm->GetProcessList();
G4int i;
for( i=0;i<nprocesses;i++){
if((*pv)[i]->GetProcessName()=="OpBoundary"){
boundary = (G4OpBoundaryProcess*)(*pv)[i];
for(G4int i = 0; i < nprocesses; ++i)
{
if((*pv)[i]->GetProcessName() == "OpBoundary")
{
boundary = (G4OpBoundaryProcess*) (*pv)[i];
break;
}
}
}
if(theTrack->GetParentID()==0){
//This is a primary track
G4TrackVector* fSecondary=fpSteppingManager->GetfSecondary();
G4int tN2ndariesTot = fpSteppingManager->GetfN2ndariesAtRestDoIt()
+ fpSteppingManager->GetfN2ndariesAlongStepDoIt()
+ fpSteppingManager->GetfN2ndariesPostStepDoIt();
if(theTrack->GetParentID() == 0)
{
// This is a primary track
//If we havent already found the conversion position and there were
//secondaries generated, then search for it
if(!fEventAction->IsConvPosSet() && tN2ndariesTot>0 ){
for(size_t lp1=(*fSecondary).size()-tN2ndariesTot;
lp1<(*fSecondary).size(); lp1++){
const G4VProcess* creator=(*fSecondary)[lp1]->GetCreatorProcess();
if(creator){
G4String creatorName=creator->GetProcessName();
if(creatorName=="phot"||creatorName=="compt"||creatorName=="conv"){
//since this is happening before the secondary is being tracked
//the Vertex position has not been set yet(set in initial step)
G4TrackVector* fSecondary = fpSteppingManager->GetfSecondary();
G4int tN2ndariesTot = fpSteppingManager->GetfN2ndariesAtRestDoIt() +
fpSteppingManager->GetfN2ndariesAlongStepDoIt() +
fpSteppingManager->GetfN2ndariesPostStepDoIt();
// If we haven't already found the conversion position and there were
// secondaries generated, then search for it
if(!fEventAction->IsConvPosSet() && tN2ndariesTot > 0)
{
for(size_t lp1 = (*fSecondary).size() - tN2ndariesTot;
lp1 < (*fSecondary).size(); ++lp1)
{
const G4VProcess* creator = (*fSecondary)[lp1]->GetCreatorProcess();
if(creator)
{
G4String creatorName = creator->GetProcessName();
if(creatorName == "phot" || creatorName == "compt" ||
creatorName == "conv")
{
// since this is happening before the secondary is being tracked,
// the vertex position has not been set yet (set in initial step)
fEventAction->SetConvPos((*fSecondary)[lp1]->GetPosition());
}
}
}
}
if(fOneStepPrimaries&&thePrePV->GetName()=="scintillator")
if(fOneStepPrimaries && thePrePV->GetName() == "scintillator")
theTrack->SetTrackStatus(fStopAndKill);
}
if(!thePostPV){//out of world
fExpectedNextStatus=Undefined;
if(!thePostPV)
{ // out of world
fExpectedNextStatus = Undefined;
return;
}
G4ParticleDefinition* particleType = theTrack->GetDefinition();
if(particleType==G4OpticalPhoton::OpticalPhotonDefinition()){
//Optical photon only
if(theTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition())
{
// Optical photon only
if(thePrePV->GetName()=="Slab")
//force drawing of photons in WLS slab
if(thePrePV->GetName() == "Slab")
// force drawing of photons in WLS slab
trackInformation->SetForceDrawTrajectory(true);
else if(thePostPV->GetName()=="expHall")
//Kill photons entering expHall from something other than Slab
else if(thePostPV->GetName() == "expHall")
// Kill photons entering expHall from something other than Slab
theTrack->SetTrackStatus(fStopAndKill);
//Was the photon absorbed by the absorption process
if(thePostPoint->GetProcessDefinedStep()->GetProcessName()
=="OpAbsorption"){
// Was the photon absorbed by the absorption process
if(thePostPoint->GetProcessDefinedStep()->GetProcessName() ==
"OpAbsorption")
{
fEventAction->IncAbsorption();
trackInformation->AddTrackStatusFlag(absorbed);
}
boundaryStatus=boundary->GetStatus();
boundaryStatus = boundary->GetStatus();
//Check to see if the partcile was actually at a boundary
//Otherwise the boundary status may not be valid
//Prior to Geant4.6.0-p1 this would not have been enough to check
if(thePostPoint->GetStepStatus()==fGeomBoundary){
if(fExpectedNextStatus==StepTooSmall){
if(boundaryStatus!=StepTooSmall){
if(thePostPoint->GetStepStatus() == fGeomBoundary)
{
// Check to see if the particle was actually at a boundary
// Otherwise the boundary status may not be valid
if(fExpectedNextStatus == StepTooSmall)
{
if(boundaryStatus != StepTooSmall)
{
G4ExceptionDescription ed;
ed << "LXeSteppingAction::UserSteppingAction(): "
<< "No reallocation step after reflection!"
<< G4endl;
<< "No reallocation step after reflection!" << G4endl;
G4Exception("LXeSteppingAction::UserSteppingAction()", "LXeExpl01",
FatalException,ed,
"Something is wrong with the surface normal or geometry");
FatalException, ed,
"Something is wrong with the surface normal or geometry");
}
}
fExpectedNextStatus=Undefined;
switch(boundaryStatus){
case Absorption:
trackInformation->AddTrackStatusFlag(boundaryAbsorbed);
fEventAction->IncBoundaryAbsorption();
break;
case Detection: //Note, this assumes that the volume causing detection
//is the photocathode because it is the only one with
//non-zero efficiency
fExpectedNextStatus = Undefined;
switch(boundaryStatus)
{
case Absorption:
trackInformation->AddTrackStatusFlag(boundaryAbsorbed);
fEventAction->IncBoundaryAbsorption();
break;
case Detection: // Note, this assumes that the volume causing detection
// is the photocathode because it is the only one with
// non-zero efficiency
{
//Triger sensitive detector manually since photon is
//absorbed but status was Detection
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String sdName="/LXeDet/pmtSD";
LXePMTSD* pmtSD = (LXePMTSD*)SDman->FindSensitiveDetector(sdName);
if(pmtSD)pmtSD->ProcessHits_constStep(theStep, nullptr);
trackInformation->AddTrackStatusFlag(hitPMT);
break;
// Trigger sensitive detector manually since photon is
// absorbed but status was Detection
G4SDManager* SDman = G4SDManager::GetSDMpointer();
G4String sdName = "/LXeDet/pmtSD";
LXePMTSD* pmtSD = (LXePMTSD*) SDman->FindSensitiveDetector(sdName);
if(pmtSD)
pmtSD->ProcessHits_boundary(theStep, nullptr);
trackInformation->AddTrackStatusFlag(hitPMT);
break;
}
case FresnelReflection:
case TotalInternalReflection:
case LambertianReflection:
case LobeReflection:
case SpikeReflection:
case BackScattering:
trackInformation->IncReflections();
fExpectedNextStatus=StepTooSmall;
break;
default:
break;
case FresnelReflection:
case TotalInternalReflection:
case LambertianReflection:
case LobeReflection:
case SpikeReflection:
case BackScattering:
trackInformation->IncReflections();
fExpectedNextStatus = StepTooSmall;
break;
default:
break;
}
if(thePostPV->GetName()=="sphere")
if(thePostPV->GetName() == "sphere")
trackInformation->AddTrackStatusFlag(hitSphere);
}
}
@@ -29,34 +29,33 @@
//
//
#include "LXeSteppingMessenger.hh"
#include "LXeSteppingAction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithABool.hh"
#include "G4UIdirectory.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeSteppingMessenger::LXeSteppingMessenger(LXeSteppingAction* step)
: fStepping(step)
: fStepping(step)
{
fOneStepPrimariesCmd = new G4UIcmdWithABool("/LXe/oneStepPrimaries",this);
fOneStepPrimariesCmd->
SetGuidance("Only allows primaries to go one step before being killed.");
fOneStepPrimariesCmd = new G4UIcmdWithABool("/LXe/oneStepPrimaries", this);
fOneStepPrimariesCmd->SetGuidance(
"Only allows primaries to go one step before being killed.");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeSteppingMessenger::~LXeSteppingMessenger(){
delete fOneStepPrimariesCmd;
}
LXeSteppingMessenger::~LXeSteppingMessenger() { delete fOneStepPrimariesCmd; }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void
LXeSteppingMessenger::SetNewValue(G4UIcommand* command,G4String newValue){
if( command == fOneStepPrimariesCmd ){
fStepping->SetOneStepPrimaries(fOneStepPrimariesCmd
->GetNewBoolValue(newValue));
void LXeSteppingMessenger::SetNewValue(G4UIcommand* command, G4String newValue)
{
if(command == fOneStepPrimariesCmd)
{
fStepping->SetOneStepPrimaries(
fOneStepPrimariesCmd->GetNewBoolValue(newValue));
}
}
@@ -28,68 +28,69 @@
/// \brief Implementation of the LXeTrackingAction class
//
//
#include "LXeTrajectory.hh"
#include "LXeTrackingAction.hh"
#include "LXeUserTrackInformation.hh"
#include "LXeDetectorConstruction.hh"
#include "G4TrackingManager.hh"
#include "LXeDetectorConstruction.hh"
#include "LXeTrajectory.hh"
#include "LXeUserTrackInformation.hh"
#include "G4OpticalPhoton.hh"
#include "G4Track.hh"
#include "G4ParticleTypes.hh"
#include "G4TrackingManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeTrackingAction::LXeTrackingAction()
{}
LXeTrackingAction::LXeTrackingAction() {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeTrackingAction::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 LXeTrajectory(aTrack));
//This user track information is only relevant to the photons
// This user track information is only relevant to the photons
fpTrackingManager->SetUserTrackInformation(new LXeUserTrackInformation);
/* const G4VProcess* creator = aTrack->GetCreatorProcess();
if(creator)
G4cout<<creator->GetProcessName()<<G4endl;
*/
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeTrackingAction::PostUserTrackingAction(const G4Track* aTrack){
void LXeTrackingAction::PostUserTrackingAction(const G4Track* aTrack)
{
LXeTrajectory* trajectory =
(LXeTrajectory*)fpTrackingManager->GimmeTrajectory();
LXeUserTrackInformation*
trackInformation=(LXeUserTrackInformation*)aTrack->GetUserInformation();
(LXeTrajectory*) fpTrackingManager->GimmeTrajectory();
LXeUserTrackInformation* trackInformation =
(LXeUserTrackInformation*) aTrack->GetUserInformation();
//Lets choose to draw only the photons that hit the sphere and a pmt
if(aTrack->GetDefinition()==G4OpticalPhoton::OpticalPhotonDefinition()){
const G4VProcess* creator=aTrack->GetCreatorProcess();
if(creator && creator->GetProcessName()=="OpWLS"){
// Let's choose to draw only the photons that hit the sphere and a pmt
if(aTrack->GetDefinition() == G4OpticalPhoton::OpticalPhotonDefinition())
{
const G4VProcess* creator = aTrack->GetCreatorProcess();
if(creator && creator->GetProcessName() == "OpWLS")
{
trajectory->WLS();
trajectory->SetDrawTrajectory(true);
}
if(LXeDetectorConstruction::GetSphereOn()){
if((trackInformation->GetTrackStatus()&hitPMT)&&
(trackInformation->GetTrackStatus()&hitSphere)){
if(LXeDetectorConstruction::GetSphereOn())
{
if((trackInformation->GetTrackStatus() & hitPMT) &&
(trackInformation->GetTrackStatus() & hitSphere))
{
trajectory->SetDrawTrajectory(true);
}
}
else{
if(trackInformation->GetTrackStatus()&hitPMT)
else
{
if(trackInformation->GetTrackStatus() & hitPMT)
trajectory->SetDrawTrajectory(true);
}
}
else //draw all other trajectories
// draw all other (not optical photon) trajectories
else
trajectory->SetDrawTrajectory(true);
if(trackInformation->GetForceDrawTrajectory())
@@ -29,25 +29,29 @@
//
//
#include "LXeTrajectory.hh"
#include "G4TrajectoryPoint.hh"
#include "G4Trajectory.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleTypes.hh"
#include "G4ThreeVector.hh"
#include "G4Polyline.hh"
#include "G4Circle.hh"
#include "G4Colour.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleTypes.hh"
#include "G4Polyline.hh"
#include "G4Polymarker.hh"
#include "G4ThreeVector.hh"
#include "G4Trajectory.hh"
#include "G4TrajectoryPoint.hh"
#include "G4VisAttributes.hh"
#include "G4VVisManager.hh"
#include "G4Polymarker.hh"
G4ThreadLocal G4Allocator<LXeTrajectory>* LXeTrajectoryAllocator = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeTrajectory::LXeTrajectory()
:G4Trajectory(),fWls(false),fDrawit(false),
fForceNoDraw(false),fForceDraw(false)
: G4Trajectory()
, fWls(false)
, fDrawit(false)
, fForceNoDraw(false)
, fForceDraw(false)
{
fParticleDefinition = nullptr;
}
@@ -55,17 +59,21 @@ LXeTrajectory::LXeTrajectory()
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeTrajectory::LXeTrajectory(const G4Track* aTrack)
:G4Trajectory(aTrack),fWls(false),fDrawit(false)
: G4Trajectory(aTrack)
, fWls(false)
, fDrawit(false)
{
fParticleDefinition=aTrack->GetDefinition();
fParticleDefinition = aTrack->GetDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeTrajectory::LXeTrajectory(LXeTrajectory &right)
:G4Trajectory(right),fWls(right.fWls),fDrawit(right.fDrawit)
LXeTrajectory::LXeTrajectory(LXeTrajectory& right)
: G4Trajectory(right)
, fWls(right.fWls)
, fDrawit(right.fDrawit)
{
fParticleDefinition=right.fParticleDefinition;
fParticleDefinition = right.fParticleDefinition;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -76,87 +84,88 @@ LXeTrajectory::~LXeTrajectory() {}
void LXeTrajectory::DrawTrajectory() const
{
// i_mode is no longer available as an argument of G4VTrajectory.
// In this exampple it was always called with an argument of 50.
const G4int i_mode = 50;
// Consider using commands /vis/modeling/trajectories.
//Taken from G4VTrajectory and modified to select colours based on particle
//type and to selectively eliminate drawing of certain trajectories.
// Taken from G4VTrajectory and modified to select colours based on particle
// type and to selectively eliminate drawing of certain trajectories.
if(!fForceDraw && (!fDrawit || fForceNoDraw))
return;
// If i_mode>=0, draws a trajectory as a polyline and, if i_mode!=0,
// adds markers - yellow circles for step points and magenta squares
// for auxiliary points, if any - whose screen size in pixels is
// given by std::abs(i_mode)/1000. E.g: i_mode = 5000 gives easily
// visible markers.
G4VVisManager* pVVisManager = G4VVisManager::GetConcreteInstance();
if (!pVVisManager) return;
const G4double markerSize = std::abs(i_mode)/1000;
G4bool lineRequired (i_mode >= 0);
G4bool markersRequired (markerSize > 0.);
if(!pVVisManager)
return;
const G4double markerSize = 0.05;
G4bool lineRequired = true;
G4bool markersRequired = true;
G4Polyline trajectoryLine;
G4Polymarker stepPoints;
G4Polymarker auxiliaryPoints;
for (G4int i = 0; i < GetPointEntries() ; i++) {
for(G4int i = 0; i < GetPointEntries(); ++i)
{
G4VTrajectoryPoint* aTrajectoryPoint = GetPoint(i);
const std::vector<G4ThreeVector>* auxiliaries
= aTrajectoryPoint->GetAuxiliaryPoints();
if (auxiliaries) {
for (size_t iAux = 0; iAux < auxiliaries->size(); ++iAux) {
const std::vector<G4ThreeVector>* auxiliaries =
aTrajectoryPoint->GetAuxiliaryPoints();
if(auxiliaries)
{
for(size_t iAux = 0; iAux < auxiliaries->size(); ++iAux)
{
const G4ThreeVector pos((*auxiliaries)[iAux]);
if (lineRequired) {
if(lineRequired)
{
trajectoryLine.push_back(pos);
}
if (markersRequired) {
if(markersRequired)
{
auxiliaryPoints.push_back(pos);
}
}
}
const G4ThreeVector pos(aTrajectoryPoint->GetPosition());
if (lineRequired) {
if(lineRequired)
{
trajectoryLine.push_back(pos);
}
if (markersRequired) {
if(markersRequired)
{
stepPoints.push_back(pos);
}
}
if (lineRequired) {
if(lineRequired)
{
G4Colour colour;
if(fParticleDefinition==G4OpticalPhoton::OpticalPhotonDefinition()){
if(fWls) //WLS photons are red
colour = G4Colour(1.,0.,0.);
else{ //Scintillation and Cerenkov photons are green
colour = G4Colour(0.,1.,0.);
if(fParticleDefinition == G4OpticalPhoton::OpticalPhotonDefinition())
{
if(fWls) // WLS photons are red
colour = G4Colour(1., 0., 0.);
else
{ // Scintillation and Cerenkov photons are green
colour = G4Colour(0., 1., 0.);
}
}
else //All other particles are blue
colour = G4Colour(0.,0.,1.);
else // All other particles are blue
colour = G4Colour(0., 0., 1.);
G4VisAttributes trajectoryLineAttribs(colour);
trajectoryLine.SetVisAttributes(&trajectoryLineAttribs);
pVVisManager->Draw(trajectoryLine);
}
if (markersRequired) {
if(markersRequired)
{
auxiliaryPoints.SetMarkerType(G4Polymarker::squares);
auxiliaryPoints.SetScreenSize(markerSize);
auxiliaryPoints.SetFillStyle(G4VMarker::filled);
G4VisAttributes auxiliaryPointsAttribs(G4Colour(0.,1.,1.)); // Magenta
G4VisAttributes auxiliaryPointsAttribs(G4Colour(0., 1., 1.)); // Magenta
auxiliaryPoints.SetVisAttributes(&auxiliaryPointsAttribs);
pVVisManager->Draw(auxiliaryPoints);
stepPoints.SetMarkerType(G4Polymarker::circles);
stepPoints.SetScreenSize(markerSize);
stepPoints.SetFillStyle(G4VMarker::filled);
G4VisAttributes stepPointsAttribs(G4Colour(1.,1.,0.)); // Yellow
G4VisAttributes stepPointsAttribs(G4Colour(1., 1., 0.)); // Yellow
stepPoints.SetVisAttributes(&stepPointsAttribs);
pVVisManager->Draw(stepPoints);
}
@@ -33,7 +33,10 @@
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeUserTrackInformation::LXeUserTrackInformation()
: fStatus(active),fReflections(0),fForcedraw(false) {}
: fStatus(active)
, fReflections(0)
, fForcedraw(false)
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
@@ -43,9 +46,9 @@ LXeUserTrackInformation::~LXeUserTrackInformation() {}
void LXeUserTrackInformation::AddTrackStatusFlag(int s)
{
if(s&active) //track is now active
fStatus&=~inactive; //remove any flags indicating it is inactive
else if(s&inactive) //track is now inactive
fStatus&=~active; //remove any flags indicating it is active
fStatus|=s; //add new flags
if(s & active) // track is now active
fStatus &= ~inactive; // remove any flags indicating it is inactive
else if(s & inactive) // track is now inactive
fStatus &= ~active; // remove any flags indicating it is active
fStatus |= s; // add new flags
}
@@ -29,88 +29,83 @@
//
//
#include "LXeWLSFiber.hh"
#include "globals.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4LogicalBorderSurface.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4SystemOfUnits.hh"
#include "G4Tubs.hh"
G4LogicalVolume* LXeWLSFiber::fClad2_log = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeWLSFiber::LXeWLSFiber(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo,
LXeDetectorConstruction* c)
:G4PVPlacement(pRot,tlate,
new G4LogicalVolume(new G4Box("temp",1,1,1),
G4Material::GetMaterial("Vacuum"),
"temp",0,0,0),
"Cladding2",pMotherLogical,pMany,pCopyNo),fConstructor(c)
LXeWLSFiber::LXeWLSFiber(G4RotationMatrix* pRot, const G4ThreeVector& tlate,
G4LogicalVolume* pMotherLogical, G4bool pMany,
G4int pCopyNo, LXeDetectorConstruction* c)
: G4PVPlacement(pRot, tlate,
new G4LogicalVolume(new G4Box("temp", 1., 1., 1.),
G4Material::GetMaterial("Vacuum"), "temp",
0, 0, 0),
"Cladding2", pMotherLogical, pMany, pCopyNo)
, fConstructor(c)
{
CopyValues();
// The Fiber
//
G4Tubs* fiber_tube =
new G4Tubs("Fiber",fFiber_rmin,fFiber_rmax,fFiber_z,fFiber_sphi,fFiber_ephi);
G4LogicalVolume* fiber_log =
new G4LogicalVolume(fiber_tube,G4Material::GetMaterial("PMMA"),
"Fiber",0,0,0);
G4Tubs* fiber_tube = new G4Tubs("Fiber", fFiber_rmin, fFiber_rmax, fFiber_z,
fFiber_sphi, fFiber_ephi);
G4LogicalVolume* fiber_log = new G4LogicalVolume(
fiber_tube, G4Material::GetMaterial("PMMA"), "Fiber", 0, 0, 0);
// Cladding (first layer)
//
G4Tubs* clad1_tube =
new G4Tubs("Cladding1",fClad1_rmin,fClad1_rmax,fClad1_z,fClad1_sphi,
fClad1_ephi);
G4LogicalVolume* clad1_log =
new G4LogicalVolume(clad1_tube,G4Material::GetMaterial("Pethylene1"),
"Cladding1",0,0,0);
G4Tubs* clad1_tube = new G4Tubs("Cladding1", fClad1_rmin, fClad1_rmax,
fClad1_z, fClad1_sphi, fClad1_ephi);
G4LogicalVolume* clad1_log = new G4LogicalVolume(
clad1_tube, G4Material::GetMaterial("Pethylene1"), "Cladding1", 0, 0, 0);
// Cladding (second layer)
//
G4Tubs* clad2_tube =
new G4Tubs("Cladding2",fClad2_rmin,fClad2_rmax,fClad2_z,fClad2_sphi,
fClad2_ephi);
fClad2_log =
new G4LogicalVolume(clad2_tube,G4Material::GetMaterial("Pethylene2"),
"Cladding2",0,0,0);
new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),fiber_log,
"Fiber", clad1_log,false,0);
new G4PVPlacement(0,G4ThreeVector(0.,0.,0.),clad1_log,
"Cladding1",fClad2_log,false,0);
G4Tubs* clad2_tube = new G4Tubs("Cladding2", fClad2_rmin, fClad2_rmax,
fClad2_z, fClad2_sphi, fClad2_ephi);
fClad2_log = new G4LogicalVolume(
clad2_tube, G4Material::GetMaterial("Pethylene2"), "Cladding2", 0, 0, 0);
new G4PVPlacement(0, G4ThreeVector(0., 0., 0.), fiber_log, "Fiber", clad1_log,
false, 0);
new G4PVPlacement(0, G4ThreeVector(0., 0., 0.), clad1_log, "Cladding1",
fClad2_log, false, 0);
SetLogicalVolume(fClad2_log);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeWLSFiber::CopyValues(){
void LXeWLSFiber::CopyValues()
{
fFiber_rmin = 0.0 * cm;
fFiber_rmax = 0.1 * cm;
fFiber_z = fConstructor->GetScintX() / 2.;
fFiber_sphi = 0.0 * deg;
fFiber_ephi = 360. * deg;
fFiber_rmin = 0.00*cm;
fFiber_rmax = 0.10*cm;
fFiber_z = fConstructor->GetScintX()/2;
fFiber_sphi = 0.00*deg;
fFiber_ephi = 360.*deg;
fClad1_rmin = 0.;// fFiber_rmax;
fClad1_rmax = fFiber_rmax + 0.015*fFiber_rmax;
fClad1_rmin = 0.; // fFiber_rmax;
fClad1_rmax = fFiber_rmax + 0.015 * fFiber_rmax;
fClad1_z = fFiber_z;
fClad1_sphi = fFiber_sphi;
fClad1_ephi = fFiber_ephi;
fClad2_rmin = 0.;//fClad1_rmax;
fClad2_rmax = fClad1_rmax + 0.015*fFiber_rmax;
fClad2_rmin = 0.; // fClad1_rmax;
fClad2_rmax = fClad1_rmax + 0.015 * fFiber_rmax;
fClad2_z = fFiber_z;
fClad2_sphi = fFiber_sphi;
fClad2_ephi = fFiber_ephi;
}
+40 -41
View File
@@ -29,63 +29,62 @@
//
//
#include "LXeWLSSlab.hh"
#include "LXeWLSFiber.hh"
#include "globals.hh"
#include "G4LogicalSkinSurface.hh"
#include "G4LogicalBorderSurface.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4Material.hh"
#include "G4SystemOfUnits.hh"
G4LogicalVolume* LXeWLSSlab::fScintSlab_log = nullptr;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
LXeWLSSlab::LXeWLSSlab(G4RotationMatrix *pRot,
const G4ThreeVector &tlate,
G4LogicalVolume *pMotherLogical,
G4bool pMany,
G4int pCopyNo,
LXeDetectorConstruction* c)
:G4PVPlacement(pRot,tlate,
new G4LogicalVolume(new G4Box("temp",1,1,1),
G4Material::GetMaterial("Vacuum"),
"temp",0,0,0),
"Slab",pMotherLogical,pMany,pCopyNo),fConstructor(c)
LXeWLSSlab::LXeWLSSlab(G4RotationMatrix* pRot, const G4ThreeVector& tlate,
G4LogicalVolume* pMotherLogical, G4bool pMany,
G4int pCopyNo, LXeDetectorConstruction* c)
: G4PVPlacement(pRot, tlate,
new G4LogicalVolume(new G4Box("temp", 1., 1., 1.),
G4Material::GetMaterial("Vacuum"), "temp",
0, 0, 0),
"Slab", pMotherLogical, pMany, pCopyNo)
, fConstructor(c)
{
CopyValues();
G4double slab_x = fScint_x/2.;
G4double slab_y = fScint_y/2.;
G4Box* ScintSlab_box = new G4Box("Slab",slab_x,slab_y,fSlab_z);
fScintSlab_log
= new G4LogicalVolume(ScintSlab_box,
G4Material::GetMaterial("Polystyrene"),
"Slab",0,0,0);
G4double spacing = 2*slab_y/fNfibers;
G4double slab_x = fScint_x / 2.;
G4double slab_y = fScint_y / 2.;
G4Box* ScintSlab_box = new G4Box("Slab", slab_x, slab_y, fSlab_z);
fScintSlab_log = new G4LogicalVolume(
ScintSlab_box, G4Material::GetMaterial("Polystyrene"), "Slab", 0, 0, 0);
G4double spacing = 2. * slab_y / fNfibers;
G4RotationMatrix* rm = new G4RotationMatrix();
rm->rotateY(90*deg);
//Place fibers
for(G4int i=0;i<fNfibers;i++){
G4double Y=-(spacing)*(fNfibers-1)*0.5 + i*spacing;
new LXeWLSFiber(rm,G4ThreeVector(0.,Y,0.),fScintSlab_log,false,0,
fConstructor);
rm->rotateY(90. * deg);
// Place fibers
for(G4int i = 0; i < fNfibers; ++i)
{
G4double Y = -(spacing) * (fNfibers - 1) * 0.5 + i * spacing;
new LXeWLSFiber(rm, G4ThreeVector(0., Y, 0.), fScintSlab_log, false, 0,
fConstructor);
}
SetLogicalVolume(fScintSlab_log);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void LXeWLSSlab::CopyValues(){
fScint_x=fConstructor->GetScintX();
fScint_y=fConstructor->GetScintY();
fScint_z=fConstructor->GetScintZ();
fNfibers=fConstructor->GetNFibers();
fSlab_z=fConstructor->GetSlabZ();
void LXeWLSSlab::CopyValues()
{
fScint_x = fConstructor->GetScintX();
fScint_y = fConstructor->GetScintY();
fScint_z = fConstructor->GetScintZ();
fNfibers = fConstructor->GetNFibers();
fSlab_z = fConstructor->GetSlabZ();
}
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Macro file for the initialization phase of "TestEm5.cc"
# Macro file for the initialization phase of "LXe"
# Sets some default verbose
# and initializes the graphic.
#
+8 -5
View File
@@ -1,9 +1,12 @@
/run/initialize
/control/verbose 2
/run/verbose 2
/tracking/verbose 0
/LXe/eventVerbose 0
/process/optical/verbose 1
/process/optical/processActivation OpWLS2 false
/run/initialize
/LXe/eventVerbose 0
/LXe/detector/defaults
/LXe/oneStepPrimaries false
@@ -15,9 +18,9 @@
/gun/energy 511 keV
/analysis/setFileName wls
/analysis/h1/set 3 100 -1 10000
/analysis/h1/set 4 100 -1 100
/analysis/h1/set 5 100 -1 10000
/analysis/h1/set 3 100 0 10000
/analysis/h1/set 4 100 0 100
/analysis/h1/set 5 100 0 10000
/run/printProgress 10
/run/beamOn 100