Import Geant4 3.0.0 source tree

This commit is contained in:
Gabriele Cosmo
2016-06-08 15:55:53 +02:00
parent e7d7193284
commit cfcb558cfe
3050 changed files with 91703 additions and 48310 deletions
@@ -0,0 +1,23 @@
# $Id: GNUmakefile,v 1.3 2000/12/06 16:53:11 flongo Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := GammaRayTel
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
@@ -0,0 +1,144 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTel.cc,v 1.3 2000/12/06 16:53:12 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 main program
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTel example main program ------
// by F.Longo, R.Giannitrapani & G.Santin (29 nov 2000)
// See README file for details on this example
// ************************************************************
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#ifdef G4UI_USE_XM
#include "G4UIXm.hh"
#endif
#ifdef G4VIS_USE
#include "GammaRayTelVisManager.hh"
#endif
#include "GammaRayTelDetectorConstruction.hh"
#include "GammaRayTelPhysicsList.hh"
#include "GammaRayTelPrimaryGeneratorAction.hh"
#include "GammaRayTelRunAction.hh"
#include "GammaRayTelEventAction.hh"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisManager.hh"
#endif
/* This global file is used to store relevant data for
analysis with external tools */
G4std::ofstream outFile;
// This is the main function
int main(int argc, char** argv)
{
// Construct the default run manager
G4RunManager* runManager = new G4RunManager;
// Set mandatory user initialization classes
GammaRayTelDetectorConstruction* detector =
new GammaRayTelDetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new GammaRayTelPhysicsList);
// Set mandatory user action classes
runManager->SetUserAction(new GammaRayTelPrimaryGeneratorAction(detector));
#ifdef G4ANALYSIS_USE
// Creation of the analysis manager
GammaRayTelAnalysisManager* analysisMgr = new GammaRayTelAnalysisManager(detector);
#endif
// Set optional user action classes
#ifdef G4ANALYSIS_USE
GammaRayTelEventAction* eventAction =
new GammaRayTelEventAction(analysisMgr);
GammaRayTelRunAction* runAction =
new GammaRayTelRunAction(analysisMgr);
#else
GammaRayTelEventAction* eventAction = new GammaRayTelEventAction();
GammaRayTelRunAction* runAction = new GammaRayTelRunAction();
#endif
runManager->SetUserAction(eventAction);
runManager->SetUserAction(runAction);
// Set visualization and user interface
// Initialization of the User Interface Session
G4UIsession* session=0;
#ifdef G4UI_USE_XM
// Create a XMotif user interface
session = new G4UIXm(argc,argv);
#else
// Create the standard user interface
session = new G4UIterminal;
#endif
#ifdef G4VIS_USE
// Visualization manager
G4VisManager* visManager = new GammaRayTelVisManager;
visManager->Initialize();
#endif
// Initialize G4 kernel
runManager->Initialize();
// Get the pointer to the UI manager
G4UImanager* UI = G4UImanager::GetUIpointer();
if (session)
{
/* prerunGammaRayTel.mac is loaded by default
unless a macro file is passed as the argument
of the executable */
if(argc>1)
{
G4String command = "/control/execute ";
for (int i=2; i<=argc; i++)
{
G4String macroFileName = argv[i-1];
UI->ApplyCommand(command+macroFileName);
}
}
else UI->ApplyCommand("/control/execute prerunGammaRayTel.mac");
session->SessionStart();
delete session;
}
// Job termination
#ifdef G4VIS_USE
delete visManager;
#endif
#ifdef G4ANALYSIS_USE
delete analysisMgr;
#endif
delete runManager;
return 0;
}
+262
View File
@@ -0,0 +1,262 @@
$Id: README,v 1.2 2000/12/06 16:53:12 flongo Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
gammaray_telescope
------------------
F.Longo, R.Giannitrapani & G.Santin
December 2000
--------------------------------------------------------------
Acknowledgments to GEANT4 people, in particular to R.Nartallo,
A.Pfeiffer, M.G.Pia and G.Cosmo
--------------------------------------------------------------
GammaRayTel is an example of application of Geant4 in a space
envinronment. It simulates a typical telescope for gamma ray analysis;
the detector setup is composed by a tracker made with silicon planes,
subdivided in ladders and strips, a CsI calorimeter and an
anticoincidence system. In this version, only the tracker is made
sensitive; the hits on the tracker strips are registered and relevant
information (energy deposition, position etc) are dumped to an external
ASCII file for subsequent analysis. If Lizard is available on the user
platform, than some histograms with relevant hits information are
displayed and saved as PostScript files.
The main features of this example are
a) Macros for the visualization of geometry and tracks with
OpenGL, VRML and DAWN drivers
b) Implementation of messengers to change some parameters of
the detector geometry, the particle generator and the analysis
manager (if present) runtime
c) Readout geometry mechanism to describe an high number of
subdivisions of the planes of the tracker (strips) without
affecting in a relevant way the simulation performances
d) Histogramming for Linux and Solaris platform via the
Lizard system (tested on Linux platform); this is a preliminary
feature of GEANT4, so expect some changes and/or improvements in
future releases
e) User interfaces via Xmotif or normal terminal provided
1. Setting up the environment variables
---------------------------------------
- Setup for Visualization
IMPORTANT: be sure that your Geant4 installation has been done
with the proper visualization drivers; for details please see the
file geant4/source/visualization/README.
To use the visualization drivers set the following variables in
your local environment:
setenv G4VIS_USE_OPENGLX 1 # OpenGL visualization
setenv G4VIS_USE_DAWNFILE 1 # DAWN file
setenv G4VIS_USE_VRMLFILE 1 # VRML file
setenv G4VRMLFILE_VIEWER vrmlview # If installed
- Setup for Xmotif user interface
setenv G4UI_USE_XM 1
- Set up for analysis using Lizard
IMPORTANT: be sure that your G4 installation has been done properly;
in particular be sure that the following environment variables are
set prior to build the library (this is working only on Linux and
Solaris platform)
setenv G4ANALYSIS_BUILD 1 # Build the analysis tools
setenv G4ANALYSIS_BUILD_LIZARD 1 # Build the Lizard interface
setenv LIZARDROOT /usr/local/freeLizard/3.2.0 #get correct path
For example at CERN the path is
setenv LIZARDROOT /afs/cern.ch/project/asddat/lhcxx/3.2.0/freeLizard/3.2.0
To compile the GammaRayTel example with the analysis tools activated,
set the following variables
setenv G4ANALYSIS_USE 1 # Use the analysis tools
setenv G4ANALYSIS_USE_LIZARD 1 # Use the Lizard one
and be sure to have the right path to the Lizard library
#add to the LD_LIBRARY_PATH (get correct path)
setenv LD_LIBRARY_PATH /usr/local/freeLizard/3.2.0/Linux/lib
For example at CERN the path is
setenv LD_LIBRARY_PATH /afs/cern.ch/project/asddat/lhcxx/3.2.0/freeLizard/3.2.0/Linux/lib
2. Sample run
-------------
To run a sample simulation with gamma tracks interacting with
the detector in its standard configuration and without any
visualization, execute the following command in the example main
directory:
$G4WORKDIR/bin/$G4SYSTEM/GammaRayTel
It is possible also to run three different configuration defined in
macro1.mac, macro2.mac and macro3.mac for visualization (OpenGL, VRML
and DAWN respectively) with the following command
$G4WORKDIR/bin/$G4SYSTEM/GammaRayTel macroX.mac
where X can be 1, 2 or 3. Be sure to have the right environment (see
the preceding section) and the proper visualization driver enabled in
your local G4 installation (see geant4/source/visualization/README for
more information).
3. Detector description
-----------------------
The detector is defined in GammaRayTelDetectorConstruction.cc
It is composed of a Payload with three main detectors, a Tracker (TKR), a
Calorimeter (CAL) and an Anticoincidence system (ACD).
The standard configuration is made of a TKR of 15 Layers of Si detectors,
with Lead converter, and a CAL of 8 layers of CsI. 4 lateral panels and a
top layer of plastic scintillator (ACT and ACL) complete the configuration.
The Si detectors are composed of two silicon planes subdivided in strips
aligned along the X axis in one plane and along the Y axis for the other.
It is possible to modify in some way this configuration using the
commands defined in GammaRayTelDetectorMessenger.
This feature is available in the UI throught the commands subtree
"/payload/" (see the help command in the UI for more information).
4. Physics processes
--------------------
This example uses the standard Electromagnetic processes.
5. Particle Generator
---------------------
The GammaRayTelParticleGenerationAction and its Messenger let the user define
the incident flux of particles, from a specific direction or from an
isotropic background. The user can define also between two spectral options:
monochromatic or with a power-law dependence. The particle
generator parameters are accessible throught the UI tree "/gun/" (use the
UI help for more information). We are planning to include, in the next
release of this example, the new General Particle Source module of G4.
6. ReadOutGeometry
------------------
The tracker is made of Silicon Microstrips detectors. The ReadOut geometry
provides the description of the strips.
7. Hit
------
In this version only the hits from the TKR are recorded. Each hit
contains the following information
a) ID of the event (this is important for multiple events run)
b) Energy deposition of the particle in the strip (keV)
c) Number of the strip
d) Number of the plane
e) Type of the plane (1=X 0=Y)
f) Position of the hit (x,y,z) in the reference frame of the payload
The hit information are saved on an ASCII file named Tracks_N.dat, where
N is the progressive ID number associated to the run.
8. Histogramming
----------------
Some hits information can be visualized runtime using Lizard (if it is
available on the user platform); two 2D histograms and two 1D histograms
can be visualized and saved (as PostScript files) during the simulation
run. The 2D histograms contain the hits positions on the TKR projected on
the XZ plane and the YZ plane; the 1D histograms contain the energy
deposition in the last X plane of the TKR and the hits distribution along
the X planes of the TKR (note that this histograms have been chosen more
for pedagogical motivation than for physical one).
These histograms are filled and updated at every event and are initialized
with each new run; the scale of the histograms is automatically derived from
the detector geometry.
Throught a messenger it is possible to set some options with
the UI subtree "/analysis/" (use the UI help for more info); in particular
it is possible to enable or disable the drawing of the 1D and 2D histograms
at every event and to enable or disable the saving of PostScript files at the
end of each run. If you feel that the simulation is too slow with the
histograms updated every event, you can disable the drawing and retain
the saving. Please note that the updating of the histograms is triggered
only when there is some hit in an event.
In this example we only show the use of very basic feature of this new
simulation/analysis framework; histogramming and analysis in Geant4
are in an evolving phase, so expect some changes and/or improvements
for next releases.
9. Classes Overview
-------------------
This is the overview of the classes defined in this example
GammaRayTelPrimaryGeneratorAction
User action for primaries generator
GammaRayTelPrimaryGeneratorMessenger
Messenger for interactive particle generator
parameters modification via the User Interface
GammaRayTelPhysicsList
Determination of particles and processes active in this
example
GammaRayTelTelVisManager
Visualization manager class
GammaRayTelDetectorConstruction
Geometry and material definitions for the detector
GammaRayTelDetectorMessenger
Messenger for interactive geometry parameters
modification via the User Interface
GammaRayTelAnalysisManager
Analysis manager class with Lizard tool (experimental)
GammaRayTelAnalysisMessenger
Messenger for interactive analysis options modification
via the User Interface
GammaRayTelRunAction
User run action class
GammaRayTelEventAction
User event action class
GammaRayTelPayloadHit
Description of the hits on the tracker
GammaRayTelPayloadROGeometry
Description of the readout geometry for strips subdivision
GammaRayTelPayloadSD
Description of the sensitive detector
@@ -0,0 +1,99 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelAnalysisManager.hh,v 1.1 2000/12/06 16:53:12 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelAnalysisManager ------
// by R.Giannitrapani, F. Longo & G.Santin (30 nov 2000)
//
// ************************************************************
#ifdef G4ANALYSIS_USE
#ifndef GammaRayTelAnalysisManager_h
#define GammaRayTelAnalysisManager_h 1
#include "G4VAnalysisManager.hh"
#include "globals.hh"
#include "g4std/vector"
#include "G4ThreeVector.hh"
class GammaRayTelAnalysisMessenger;
class GammaRayTelDetectorConstruction;
class IHistogramFactory;
class IHistogram1D;
class IHistogram2D;
class IPlotter;
class IVectorFactory;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelAnalysisManager: public G4VAnalysisManager
{
public:
GammaRayTelAnalysisManager(GammaRayTelDetectorConstruction*);
virtual ~GammaRayTelAnalysisManager();
public:
G4bool RegisterAnalysisSystem(G4VAnalysisSystem*);
IHistogramFactory* GetHistogramFactory(const G4String&);
void Store(IHistogram* = 0, const G4String& = "");
void Plot(IHistogram* = 0);
void InsertPositionXZ(double x, double z);
void InsertPositionYZ(double y, double z);
void InsertEnergy(double en);
void InsertHits(int nplane);
void BeginOfRun();
void EndOfRun(G4int n);
void EndOfEvent(G4int flag);
void SetHisto1DDraw(G4String str) {histo1DDraw = str;};
void SetHisto1DSave(G4String str) {histo1DSave = str;};
void SetHisto2DDraw(G4String str) {histo2DDraw = str;};
void SetHisto2DSave(G4String str) {histo2DSave = str;};
void SetHisto2DMode(G4String str) {histo2DMode = str;};
G4String GetHisto2DMode() {return histo2DMode;};
private:
G4VAnalysisSystem* analysisSystem;
IPlotter* pl;
IVectorFactory* fVectorFactory;
IHistogramFactory* histoFactory;
IHistogram1D* energy;
IHistogram1D* hits;
IHistogram2D* posXZ;
IHistogram2D* posYZ;
GammaRayTelDetectorConstruction* GammaRayTelDetector;
G4String histo1DDraw;
G4String histo1DSave;
G4String histo2DDraw;
G4String histo2DSave;
G4String histo2DMode;
GammaRayTelAnalysisMessenger* analysisMessenger;
};
#endif
#endif
@@ -0,0 +1,66 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelAnalysisMessenger.hh,v 1.1 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelAnalysysMessenger ------
// by R.Giannitrapani, F.Longo & G.Santin (03 dec 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifdef G4ANALYSIS_USE
#ifndef GammaRayTelAnalysisMessenger_h
#define GammaRayTelAnalysisMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class GammaRayTelAnalysisManager;
class G4UIdirectory;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelAnalysisMessenger: public G4UImessenger
{
public:
GammaRayTelAnalysisMessenger(GammaRayTelAnalysisManager* );
~GammaRayTelAnalysisMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
GammaRayTelAnalysisManager* GammaRayTelAnalysis;
G4UIdirectory* GammaRayTelAnalysisDir;
G4UIcmdWithAString* Histo1DDrawCmd;
G4UIcmdWithAString* Histo2DDrawCmd;
G4UIcmdWithAString* Histo1DSaveCmd;
G4UIcmdWithAString* Histo2DSaveCmd;
G4UIcmdWithAString* Histo2DModeCmd;
};
#endif
#endif
@@ -0,0 +1,288 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelDetectorConstruction.hh,v 1.4 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelDetectorConstruction ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
#ifndef GammaRayTelDetectorConstruction_h
#define GammaRayTelDetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4Box;
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class G4UniformMagField;
class GammaRayTelDetectorMessenger;
class GammaRayTelPayloadSD;
class GammaRayTelPayloadROGeometry;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelDetectorConstruction : public G4VUserDetectorConstruction
{
public:
GammaRayTelDetectorConstruction();
~GammaRayTelDetectorConstruction();
public:
void SetNbOfTKRLayers (G4int); // TKR number of layers, material, detector
void SetTKRTileSizeXY (G4double);
void SetNbOfTKRTiles (G4int);
void SetTKRSiliconThickness(G4double);
void SetTKRSiliconPitch(G4double);
void SetTKRLayerDistance (G4double);
void SetTKRViewsDistance (G4double);
void SetConverterMaterial (G4String); // TKR Converter material & thickness
void SetConverterThickness(G4double);
void SetNbOfCALLayers (G4int); // CAL material, lenght, thickness
void SetNbOfCALBars (G4int);
void SetCALBarThickness(G4double);
void SetACDThickness (G4double); //ACD Thickness
void SetMagField(G4double); // Magnetic Field
G4VPhysicalVolume* Construct();
void UpdateGeometry();
public:
void PrintPayloadParameters();
G4double GetWorldSizeZ() {return WorldSizeZ;};
G4double GetWorldSizeXY() {return WorldSizeXY;};
G4double GetPayloadSizeZ() {return PayloadSizeZ;};
G4double GetPayloadSizeXY() {return PayloadSizeXY;};
G4double GetTKRSizeZ() {return TKRSizeZ;};
G4double GetTKRSizeXY() {return TKRSizeXY;};
G4double GetCALSizeZ() {return CALSizeZ;};
G4double GetCALTKRDistance() {return CALTKRDistance;};
G4double GetTKRSiliconThickness() {return TKRSiliconThickness;};
G4double GetTKRSiliconTileXY() {return TKRSiliconTileXY;};
G4double GetTKRSiliconPitch() {return TKRSiliconPitch;};
G4int GetNbOfTKRLayers() {return NbOfTKRLayers;};
G4int GetNbOfTKRTiles() {return NbOfTKRTiles;};
G4int GetNbOfTKRStrips() {return NbOfTKRStrips;};
G4double GetTKRLayerDistance() {return TKRLayerDistance;};
G4double GetTKRViewsDistance() {return TKRViewsDistance;};
G4double GetTKRActiveTileXY() {return TKRActiveTileXY;};
G4double GetTKRActiveTileZ() {return TKRActiveTileZ;};
G4double GetSiliconGuardRing() {return SiliconGuardRing;}
G4double GetTilesSeparation() {return TilesSeparation;};
G4Material* GetConverterMaterial() {return ConverterMaterial;};
G4double GetConverterThickness() {return ConverterThickness;};
G4double GetCALBarThickness() {return CALBarThickness;};
G4int GetNbOfCALLayers() {return NbOfCALLayers;};
G4int GetNbOfCALBars() {return NbOfCALBars;};
G4double GetACDThickness() {return ACDThickness;};
private:
G4Material* ConverterMaterial;
G4double ConverterThickness;
G4double TKRSiliconThickness;
G4double TKRSiliconTileXY;
G4double TKRSiliconPitch;
G4double TKRSizeXY;
G4double TKRSizeZ;
G4double TKRLayerDistance;
G4double TKRViewsDistance;
G4double TKRSupportThickness;
G4int NbOfTKRLayers;
G4int NbOfTKRTiles;
G4double CALBarThickness;
G4int NbOfCALLayers;
G4int NbOfCALBars;
G4double CALSizeXY;
G4double CALSizeZ;
G4double ACDThickness;
G4double ACTSizeXY;
G4double ACTSizeZ;
G4double ACL1SizeX;
G4double ACL1SizeY;
G4double ACL1SizeZ;
G4double ACL2SizeX;
G4double ACL2SizeY;
G4double ACL2SizeZ;
G4double TilesSeparation;
G4double ACDTKRDistance;
G4double CALTKRDistance;
G4double TKRActiveTileXY;
G4double TKRActiveTileZ;
G4double SiliconGuardRing;
G4int NbOfTKRStrips;
G4double TKRXStripX;
G4double TKRYStripX;
G4double TKRXStripY;
G4double TKRYStripY;
G4double TKRZStrip;
G4double PayloadSizeZ;
G4double PayloadSizeXY;
G4Material* defaultMaterial;
G4Material* CALMaterial;
G4Material* TKRMaterial;
G4Material* ACDMaterial;
G4double WorldSizeXY;
G4double WorldSizeZ;
G4Box* solidWorld; // World
G4LogicalVolume* logicWorld;
G4VPhysicalVolume* physiWorld;
G4Box* solidPayload; // Payload
G4LogicalVolume* logicPayload;
G4VPhysicalVolume* physiPayload;
G4Box* solidTKR; // Tracker
G4LogicalVolume* logicTKR;
G4VPhysicalVolume* physiTKR;
G4Box* solidCAL; // Calorimeter
G4LogicalVolume* logicCAL;
G4VPhysicalVolume* physiCAL;
G4Box* solidACT; // Top Anticoincidence
G4LogicalVolume* logicACT;
G4VPhysicalVolume* physiACT;
G4Box* solidACL1; // Lateral Anticoincidence
G4LogicalVolume* logicACL1;
G4VPhysicalVolume* physiACL1;
G4Box* solidACL2;
G4LogicalVolume* logicACL2;
G4VPhysicalVolume* physiACL2;
G4Box* solidTKRDetectorX; // Tracker PLANE X
G4LogicalVolume* logicTKRDetectorX;
G4VPhysicalVolume* physiTKRDetectorX;
G4Box* solidTKRDetectorY; // Tracker PLANE Y
G4LogicalVolume* logicTKRDetectorY;
G4VPhysicalVolume* physiTKRDetectorY;
G4Box* solidCALDetector; // Calorimeter PLANE
G4LogicalVolume* logicCALDetector;
G4VPhysicalVolume* physiCALDetectorX;
G4VPhysicalVolume* physiCALDetectorY;
G4Box* solidPlane; // Support Plane
G4LogicalVolume* logicPlane;
G4VPhysicalVolume* physiPlane;
G4Box* solidConverter; // Converter
G4LogicalVolume* logicConverter;
G4VPhysicalVolume* physiConverter;
G4UniformMagField* magField; //pointer to the magnetic field
GammaRayTelDetectorMessenger* detectorMessenger; //pointer to the Messenger
GammaRayTelPayloadSD* payloadSD; //pointer to the sensitive detector
private:
void DefineMaterials();
void ComputePayloadParameters();
G4VPhysicalVolume* ConstructPayload();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void GammaRayTelDetectorConstruction::ComputePayloadParameters()
{
// Compute derived parameters of the payload
TKRSupportThickness =TKRLayerDistance -2.*TKRSiliconThickness
- TKRViewsDistance;
TKRSizeXY = NbOfTKRTiles*TKRSiliconTileXY + (NbOfTKRTiles+1)*TilesSeparation;
TKRSizeZ = NbOfTKRLayers*TKRLayerDistance;
TKRActiveTileXY = TKRSiliconTileXY - 2*SiliconGuardRing;
TKRActiveTileZ = TKRSiliconThickness;
NbOfTKRStrips = G4int(TKRActiveTileXY/TKRSiliconPitch);
SiliconGuardRing = TKRActiveTileXY - NbOfTKRStrips*TKRSiliconPitch;
TKRActiveTileXY = TKRSiliconTileXY - 2*SiliconGuardRing;
TKRXStripX = TKRYStripY = TKRSiliconPitch;
TKRYStripX = TKRXStripY = TKRActiveTileXY;
TKRZStrip = TKRSiliconThickness;
CALSizeXY = TKRSizeXY;
CALSizeZ = 2.*NbOfCALLayers*CALBarThickness;
ACTSizeXY = TKRSizeXY + 2*ACDTKRDistance + 2*ACDThickness;
ACTSizeZ = ACDThickness;
ACL1SizeX = TKRSizeXY + 2*ACDTKRDistance + ACDThickness;
ACL1SizeY = ACDThickness;
ACL1SizeZ = TKRSizeZ + CALSizeZ + ACDTKRDistance + CALTKRDistance;
ACL2SizeX = ACDThickness;
ACL2SizeY = TKRSizeXY + 2*ACDTKRDistance + ACDThickness;
ACL2SizeZ = TKRSizeZ + CALSizeZ + ACDTKRDistance + CALTKRDistance;
PayloadSizeZ = 1.1*(ACL1SizeZ + ACTSizeZ);
PayloadSizeXY = (ACTSizeXY);
WorldSizeZ = 1.5*PayloadSizeZ; WorldSizeXY = 1.5*PayloadSizeXY;
}
#endif
@@ -0,0 +1,97 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelDetectorMessenger.hh,v 1.2 2000/11/15 20:27:38 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelDetectorMessenger ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelDetectorMessenger_h
#define GammaRayTelDetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class GammaRayTelDetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelDetectorMessenger: public G4UImessenger
{
public:
GammaRayTelDetectorMessenger(GammaRayTelDetectorConstruction* );
~GammaRayTelDetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
GammaRayTelDetectorConstruction* GammaRayTelDetector;
G4UIdirectory* GammaRayTeldetDir;
// Converter
G4UIcmdWithAString* ConverterMaterCmd;
G4UIcmdWithADoubleAndUnit* ConverterThickCmd;
// Silicon Tile
G4UIcmdWithADoubleAndUnit* SiliconThickCmd;
G4UIcmdWithADoubleAndUnit* SiliconTileXYCmd;
G4UIcmdWithAnInteger* NbSiTilesCmd;
G4UIcmdWithADoubleAndUnit* SiliconPitchCmd;
// Tracker
G4UIcmdWithAnInteger* NbTKRLayersCmd;
G4UIcmdWithADoubleAndUnit* LayerDistanceCmd;
G4UIcmdWithADoubleAndUnit* ViewsDistanceCmd;
// Calorimeter
G4UIcmdWithADoubleAndUnit* CALThickCmd;
G4UIcmdWithAnInteger* NbCALBarsCmd;
G4UIcmdWithAnInteger* NbCALLayersCmd;
// Anticoincidence
G4UIcmdWithADoubleAndUnit* ACDThickCmd;
// Total
G4UIcmdWithADoubleAndUnit* MagFieldCmd;
G4UIcmdWithoutParameter* UpdateCmd;
};
#endif
@@ -0,0 +1,49 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelDummySD.hh,v 1.1 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelDummySD ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
//
// Dummy sensitive used only to flag sensitivity
// in cells of RO geometry.
//
#ifndef GammaRayTelDummySD_h
#define GammaRayTelDummySD_h 1
#include "G4VSensitiveDetector.hh"
class G4Step;
class GammaRayTelDummySD : public G4VSensitiveDetector
{
public:
GammaRayTelDummySD();
~GammaRayTelDummySD() {};
void Initialize(G4HCofThisEvent*HCE) {};
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist) {return false;}
void EndOfEvent(G4HCofThisEvent*HCE) {};
void clear() {};
void DrawAll() {};
void PrintAll() {};
};
GammaRayTelDummySD::GammaRayTelDummySD()
: G4VSensitiveDetector("dummySD")
{}
#endif
@@ -0,0 +1,68 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelEventAction.hh,v 1.3 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelEventAction ------
// by R.Giannitrapani, F. Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelEventAction_h
#define GammaRayTelEventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisManager.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelEventAction : public G4UserEventAction
{
public:
#ifdef G4ANALYSIS_USE
GammaRayTelEventAction(GammaRayTelAnalysisManager* analysisMgr);
#else
GammaRayTelEventAction();
#endif
virtual ~GammaRayTelEventAction();
public:
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
void SetDrawFlag (G4String val) {drawFlag = val;};
private:
G4int trackerCollID;
G4String drawFlag;
#ifdef G4ANALYSIS_USE
GammaRayTelAnalysisManager* analysisManager;
#endif
};
#endif
@@ -0,0 +1,105 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadHit.hh,v 1.2 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadHit ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
// This Class describe the hits on the Payload
#ifndef GammaRayTelPayloadHit_h
#define GammaRayTelPayloadHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelPayloadHit : public G4VHit
{
public:
GammaRayTelPayloadHit();
~GammaRayTelPayloadHit();
GammaRayTelPayloadHit(const GammaRayTelPayloadHit&);
const GammaRayTelPayloadHit& operator=(const GammaRayTelPayloadHit&);
int operator==(const GammaRayTelPayloadHit&) const;
inline void* operator new(size_t);
inline void operator delete(void*);
void Draw();
void Print();
private:
G4double EdepSil; // Energy deposited on the silicon strip
G4ThreeVector pos; // Position of the hit
G4int NStrip; // Number of the strip
G4int NSilPlane; // Number of the plane
G4int IsXPlane; // Type of the plane (1 X, 0 Y)
public:
inline void AddSil(G4double de) {EdepSil += de;};
inline void SetNStrip(G4int i) {NStrip = i;};
inline void SetNSilPlane(G4int i) {NSilPlane = i;};
inline void SetPlaneType(G4int i) {IsXPlane = i;};
inline void SetPos(G4ThreeVector xyz){ pos = xyz; }
inline G4double GetEdepSil() { return EdepSil; };
inline G4int GetNStrip() { return NStrip; };
inline G4int GetNSilPlane() { return NSilPlane; };
inline G4int GetPlaneType() {return IsXPlane;};
inline G4ThreeVector GetPos() { return pos; };
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
typedef G4THitsCollection<GammaRayTelPayloadHit> GammaRayTelPayloadHitsCollection;
extern G4Allocator<GammaRayTelPayloadHit> GammaRayTelPayloadHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void* GammaRayTelPayloadHit::operator new(size_t)
{
void* aHit;
aHit = (void*) GammaRayTelPayloadHitAllocator.MallocSingle();
return aHit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void GammaRayTelPayloadHit::operator delete(void* aHit)
{
GammaRayTelPayloadHitAllocator.FreeSingle((GammaRayTelPayloadHit*) aHit);
}
#endif
@@ -0,0 +1,45 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadROGeometry.hh,v 1.1 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadROGeometry ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
#ifndef GammaRayTelPayloadROGeometry_h
#define GammaRayTelPayloadROGeometry_h 1
#include "G4VReadOutGeometry.hh"
class GammaRayTelDetectorConstruction;
class GammaRayTelPayloadROGeometry : public G4VReadOutGeometry
{
public:
GammaRayTelPayloadROGeometry();
GammaRayTelPayloadROGeometry(G4String);
GammaRayTelPayloadROGeometry(G4String, GammaRayTelDetectorConstruction*);
~GammaRayTelPayloadROGeometry();
private:
G4VPhysicalVolume* Build();
GammaRayTelDetectorConstruction* GammaRayTelDetector;
//pointer to the geometry
};
#endif
@@ -0,0 +1,66 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadSD.hh,v 1.3 2000/11/24 16:56:59 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadSD ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
#ifndef GammaRayTelPayloadSD_h
#define GammaRayTelPayloadSD_h 1
#include "G4VSensitiveDetector.hh"
#include "globals.hh"
class GammaRayTelDetectorConstruction;
class G4HCofThisEvent;
class G4Step;
#include "GammaRayTelPayloadHit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelPayloadSD : public G4VSensitiveDetector
{
public:
GammaRayTelPayloadSD(G4String, GammaRayTelDetectorConstruction* );
~GammaRayTelPayloadSD();
void Initialize(G4HCofThisEvent*);
G4bool ProcessHits(G4Step* astep,G4TouchableHistory* ROHist);
void EndOfEvent(G4HCofThisEvent*);
void clear();
void DrawAll();
void PrintAll();
private:
GammaRayTelPayloadHitsCollection* PayloadCollection;
GammaRayTelDetectorConstruction* Detector;
G4int (*HitXID)[30];
G4int (*HitYID)[30];
G4int NbOfTKRLayers;
G4int NbOfTKRStrips;
};
#endif
@@ -0,0 +1,84 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPhysicsList.hh,v 1.2 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPhysicsList ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelPhysicsList_h
#define GammaRayTelPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelPhysicsList: public G4VUserPhysicsList
{
public:
GammaRayTelPhysicsList();
~GammaRayTelPhysicsList();
protected:
// Construct particle and physics
virtual void ConstructParticle();
virtual void ConstructProcess();
virtual void SetCuts();
public:
// Set/Get cut values
void SetCutForGamma(G4double);
void SetCutForElectron(G4double);
void SetCutForProton(G4double);
G4double GetCutForGamma() const;
G4double GetCutForElectron() const;
G4double GetCutForProton() const;
protected:
// these methods Construct particles
void ConstructBosons();
void ConstructLeptons();
void ConstructMesons();
void ConstructBaryons();
protected:
// these methods Construct physics processes and register them
void ConstructGeneral();
void ConstructEM();
private:
G4double cutForGamma;
G4double cutForElectron;
G4double cutForProton;
G4double currentDefaultCut;
};
#endif
@@ -0,0 +1,67 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPrimaryGeneratorAction.hh,v 1.3 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPrimaryGeneratorAction ------
// by G.Santin, F.Longo & R.Giannitrapani (30 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelPrimaryGeneratorAction_h
#define GammaRayTelPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
class GammaRayTelDetectorConstruction;
class GammaRayTelPrimaryGeneratorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
GammaRayTelPrimaryGeneratorAction(GammaRayTelDetectorConstruction*);
~GammaRayTelPrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event*);
void SetRndmFlag(G4String val) { rndmFlag = val;}
void SetSourceType(G4int val) { nSourceType = val;}
void SetSpectrumType(G4int val) { nSpectrumType = val;}
void SetVertexRadius(G4double val) { dVertexRadius = val;}
private:
G4ParticleGun* particleGun;
GammaRayTelDetectorConstruction* GammaRayTelDetector;
GammaRayTelPrimaryGeneratorMessenger* gunMessenger;
G4String rndmFlag; //flag for a random impact point
G4int nSourceType;
G4double dVertexRadius;
G4int nSpectrumType;
};
#endif
@@ -0,0 +1,58 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPrimaryGeneratorMessenger.hh,v 1.2 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPrimaryGeneratorMessenger ------
// by G.Santin, F.Longo & R.Giannitrapani (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelPrimaryGeneratorMessenger_h
#define GammaRayTelPrimaryGeneratorMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class GammaRayTelPrimaryGeneratorAction;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADoubleAndUnit;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelPrimaryGeneratorMessenger: public G4UImessenger
{
public:
GammaRayTelPrimaryGeneratorMessenger(GammaRayTelPrimaryGeneratorAction*);
~GammaRayTelPrimaryGeneratorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
GammaRayTelPrimaryGeneratorAction* GammaRayTelAction;
G4UIcmdWithAString* RndmCmd;
G4UIcmdWithAnInteger* SourceTypeCmd;
G4UIcmdWithADoubleAndUnit* VertexRadiusCmd;
G4UIcmdWithAnInteger* SpectrumTypeCmd;
};
#endif
@@ -0,0 +1,61 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelRunAction.hh,v 1.3 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelRunAction ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelRunAction_h
#define GammaRayTelRunAction_h 1
#include "G4UserRunAction.hh"
#include "globals.hh"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisManager.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4Run;
class GammaRayTelRunAction : public G4UserRunAction
{
public:
#ifdef G4ANALYSIS_USE
GammaRayTelRunAction(GammaRayTelAnalysisManager* analysisMgr);
#else
GammaRayTelRunAction();
#endif
~GammaRayTelRunAction();
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
private:
#ifdef G4ANALYSIS_USE
GammaRayTelAnalysisManager* analysisManager;
#endif
};
#endif
@@ -0,0 +1,47 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelVisManager.hh,v 1.2 2000/11/15 20:27:39 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class header file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelVisManager ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef GammaRayTelVisManager_h
#define GammaRayTelVisManager_h 1
#ifdef G4VIS_USE
#include "G4VisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class GammaRayTelVisManager: public G4VisManager {
public:
GammaRayTelVisManager ();
private:
void RegisterGraphicsSystems ();
};
#endif
#endif
@@ -0,0 +1,59 @@
# ----------------------------------------------
# Example macro file for the GammaRayTel
# Visualization with OpenGL
# ----------------------------------------------
# Authors: R.Giannitrapani, F.Longo and G.Santin
# ----------------------------------------------
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
/control/saveHistory
/run/verbose 2
/gun/particle gamma
/gun/energy 1 GeV
/gun/vertexRadius 25. cm
/gun/sourceType 2
# You can modify the geometry of the telescope via a messenger
#/payload/setNbOfTKRLayers 15
#/payload/update
#
# Create empty scene ("world" is default)
/vis/scene/create
#
# Add volume to scene
/vis/scene/add/volume
#
# Create a scene handler for a specific graphics system
/vis/sceneHandler/create OGLSX
# Create a viewer
/vis/viewer/create
# Positioning of the camera
/vis/camera/viewpoint 30 30
# for drawing the tracks
# if too many tracks cause core dump => storeTrajectory 0
/tracking/storeTrajectory 1
#/vis/scene/include/trajectories
#
# Flush visualization
/vis/viewer/update
#
# Draw scene
/vis/scene/notifyHandlers
@@ -0,0 +1,68 @@
# ----------------------------------------------
# Example macro file for the GammaRayTel
# Visualization with VRML
# ----------------------------------------------
# Authors: R.Giannitrapani, F.Longo and G.Santin
# ----------------------------------------------
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
/control/saveHistory
/run/verbose 2
/gun/particle mu-
/gun/energy 100 MeV
/gun/vertexRadius 30. cm
/gun/sourceType 2
/gun/direction 0 0 -1
# You can modify the geometry of the telescope via a messenger
/payload/setNbOfTKRLayers 10
/payload/update
#
# Create empty scene ("world" is default)
/vis/scene/create
#
# Add volume to scene
/vis/scene/add/volume
#
# Create a scene handler for a VRML file
/vis/sceneHandler/create VRML2FILE
# Create a viewer
/vis/viewer/create
# Positioning of the camera
/vis/camera/viewpoint 30 30
# Create a viewer
/vis/viewer/create
# Positioning of the camera
/vis/camera/viewpoint 90 0
# Draw scene
/vis/scene/notifyHandlers
# for drawing the tracks
# if too many tracks cause core dump => storeTrajectory 0
/tracking/storeTrajectory 1
#/vis/scene/include/trajectories
#
# Flush visualization
/vis/viewer/update
@@ -0,0 +1,59 @@
# ----------------------------------------------
# Example macro file for the GammaRayTel
# Visualization with DAWN
# ----------------------------------------------
# Authors: R.Giannitrapani, F.Longo and G.Santin
# ----------------------------------------------
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
/control/saveHistory
/run/verbose 2
/gun/particle gamma
/gun/energy 1 GeV
/gun/vertexRadius 25. cm
/gun/sourceType 2
# You can modify the geometry of the telescope via a messenger
#/payload/setNbOfTKRLayers 15
#/payload/update
#
# Create empty scene ("world" is default)
/vis/scene/create
#
# Add volume to scene
/vis/scene/add/volume
#
# Create a scene handler for a specific graphics system
/vis/sceneHandler/create DAWNFILE
# Create a viewer
/vis/viewer/create
# Positioning of the camera
/vis/camera/viewpoint 30 30
# for drawing the tracks
# if too many tracks cause core dump => storeTrajectory 0
/tracking/storeTrajectory 1
#/vis/scene/include/trajectories
#
# Flush visualization
/vis/viewer/update
#
# Draw scene
/vis/scene/notifyHandlers
@@ -0,0 +1,17 @@
# Macro file for the initialization phase of the
# GammaRayTel
#
# Sets some default verbose
# and initializes the graphic.
#
/control/verbose 2
/control/saveHistory
/run/verbose 2
/gun/particle gamma
/gun/energy 1 GeV
/gun/vertexRadius 25. cm
/gun/sourceType 2
@@ -0,0 +1,320 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelAnalysisManager.cc,v 1.1 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayAnalysisManager ------
// by R.Giannitrapani, F.Longo & G.Santin (03 dic 2000)
//
// ************************************************************
#ifdef G4ANALYSIS_USE
#include <stdlib.h>
#include "g4std/fstream"
#include "GammaRayTelAnalysisManager.hh"
#include "G4VAnalysisSystem.hh"
#include "GammaRayTelDetectorConstruction.hh"
#include "GammaRayTelAnalysisMessenger.hh"
#include <IHistogramFactory.h>
#include <IHistogram1D.h>
#include <IHistogram2D.h>
#include <IPlotter.h>
#include <IVector.h>
#include <IVectorFactory.h>
#include "G4LizardSystem.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnalysisManager::GammaRayTelAnalysisManager(GammaRayTelDetectorConstruction* GammaRayTelDC):
GammaRayTelDetector(GammaRayTelDC),
posXZ(0), posYZ(0), energy(0), hits(0), histoFactory(0), pl(0),
histo1DDraw("enable"),histo1DSave("enable"),histo2DDraw("enable"),
histo2DSave("enable"),histo2DMode("strip")
{
// Define the messenger and the analysis system
analysisMessenger = new GammaRayTelAnalysisMessenger(this);
analysisSystem = new G4LizardSystem;
histoFactory = analysisSystem->GetHistogramFactory();
/*
The following lines set the plotter and the vectorfactory that
are needed in this example for a multiple histograms
visualization. Please see the README for more information
*/
fVectorFactory = createIVectorFactory();
pl = createIPlotter();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnalysisManager::~GammaRayTelAnalysisManager() {
delete posXZ;
delete posYZ;
delete energy;
delete hits;
delete analysisSystem;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool GammaRayTelAnalysisManager::RegisterAnalysisSystem(G4VAnalysisSystem*)
{
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
IHistogramFactory* GammaRayTelAnalysisManager::GetHistogramFactory(const G4String& aSystem)
{
return histoFactory;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelAnalysisManager::Store(IHistogram* histo, const G4String& ID)
{
analysisSystem->Store(histo, ID);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/*
Since the Lizard interface and analysis classes in G4 are still
experimental, they lack for now the possibility to show directly
more than one histograms at the same time. In order to show 2 or 4 histo
in a single view in our example, we decided to override this implementation
and use directly the IPlotter interface for our needs. This will change
in future releases.
Please note that for visualization purpouses the histograms result
stretched along the x axis; when they are saved in a PostScript
file the proportions are the right ones.
*/
void GammaRayTelAnalysisManager::Plot(IHistogram* histo = 0)
{
// In a normal case we use the following line to use the standard plot
// analysisSystem->Plot(histo);
// We define some vectors
IVector* vxz = 0;
IVector* vyz = 0;
IVector* ve = 0;
IVector* vhit= 0;
// We fill them with the histograms and
// draw them
if(histo2DDraw == "enable")
{
vxz = fVectorFactory->from2D(dynamic_cast<IHistogram2D*>(posXZ));
vyz = fVectorFactory->from2D(dynamic_cast<IHistogram2D*>(posYZ));
pl->plot(vxz);
pl->plot(vyz);
pl->refresh();
}
if(histo1DDraw == "enable")
{
ve = fVectorFactory->from1D(dynamic_cast<IHistogram1D*>(energy));
vhit = fVectorFactory->from1D(dynamic_cast<IHistogram1D*>(hits));
pl->plot(ve);
pl->plot(vhit);
pl->refresh();
}
delete vxz;
delete vyz;
delete ve;
delete vhit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 2d histogram of the XZ positions
void GammaRayTelAnalysisManager::InsertPositionXZ(double x, double z)
{
posXZ->fill(x, z);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 2d histogram of the YZ positions
void GammaRayTelAnalysisManager::InsertPositionYZ(double y, double z)
{
posYZ->fill(y, z);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 1d histogram of the energy released in the last Si plane
void GammaRayTelAnalysisManager::InsertEnergy(double en)
{
energy->fill(en);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// This function fill the 1d histogram of the hits distribution along the TKR planes
void GammaRayTelAnalysisManager::InsertHits(int nplane)
{
hits->fill(nplane);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/*
This member reset the histograms and it is called at the begin
of each run; here we put the inizialization so that the histograms have
always the right dimensions depending from the detector geometry
*/
void GammaRayTelAnalysisManager::BeginOfRun()
{
float sizexy, sizez;
int nplane;
int Nstrip, Nplane, Ntile, N;
// Relevant data from the detector to set the histograms dimensions
Nplane = GammaRayTelDetector->GetNbOfTKRLayers();
Nstrip = GammaRayTelDetector->GetNbOfTKRStrips();
Ntile = GammaRayTelDetector->GetNbOfTKRTiles();
sizexy = GammaRayTelDetector->GetTKRSizeXY();
sizez = GammaRayTelDetector->GetTKRSizeZ();
N = Nstrip*Ntile;
if (histoFactory)
{
// 1D histogram that store the energy deposition of the
// particle in the last (number 0) TKR X-plane
histoFactory->destroy(energy);
energy = histoFactory->create1D("Energy deposition in the last X plane (keV)", 100, 50, 200);
// 1D histogram that store the hits distribution along the TKR X-planes
histoFactory->destroy(hits);
hits = histoFactory->create1D("Hits distribution in the TKR X planes",
Nplane, 0, Nplane-1);
// 2D histogram that store the position (mm) of the hits (XZ projection)
histoFactory->destroy(posXZ);
if (histo2DMode == "strip")
posXZ = histoFactory->create2D("Tracker Hits XZ (strip,plane)",
N, 0, N-1,
2*Nplane, 0, Nplane-1);
else
posXZ = histoFactory->create2D("Tracker Hits XZ (x,z) in mm",
sizexy/5, -sizexy/2, sizexy/2,
sizez/5, -sizez/2, sizez/2);
// 2D histogram that store the position (mm) of the hits (YZ projection)
histoFactory->destroy(posYZ);
if(histo2DMode=="strip")
posYZ = histoFactory->create2D("Tracker Hits YZ (strip,plane)",
N, 0, N-1,
2*Nplane, 0, Nplane-1);
else
posYZ = histoFactory->create2D("Tracker Hits YZ (y,z) in mm",
sizexy/5, -sizexy/2, sizexy/2,
sizez/5, -sizez/2, sizez/2);
}
if(posXZ)
posXZ->reset();
if(posYZ)
posYZ->reset();
if(energy)
energy->reset();
if(hits)
hits->reset();
// We divide the plotter in the right nuber of zone depending
// on which histograms the user want to draw
if((histo2DDraw == "enable") && (histo1DDraw == "enable"))
pl->zone(2,2);
else if((histo1DDraw == "enable") || (histo2DDraw == "enable"))
pl->zone(1,2);
else
pl->zone(1,1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/*
This member is called at the end of each run
*/
void GammaRayTelAnalysisManager::EndOfRun(G4int n)
{
// This variable contains the names of the PS files
char name[15];
// We define some vectors
IVector* vxz = 0;
IVector* vyz = 0;
IVector* ve = 0;
IVector* vhit = 0;
// Temporary we set one single zone for the plotter
pl->zone(1,1);
// We now print the histograms, each one in a separate file
if(histo2DSave == "enable")
{
vxz = fVectorFactory->from2D(dynamic_cast<IHistogram2D*>(posXZ));
vyz = fVectorFactory->from2D(dynamic_cast<IHistogram2D*>(posYZ));
sprintf(name,"posxz_%d.ps", n);
pl->plot(vxz);
pl->psPrint(name);
sprintf(name,"posyz_%d.ps", n);
pl->plot(vyz);
pl->psPrint(name);
}
if(histo1DSave == "enable")
{
ve = fVectorFactory->from1D(dynamic_cast<IHistogram1D*>(energy));
vhit = fVectorFactory->from1D(dynamic_cast<IHistogram1D*>(hits));
sprintf(name,"energy_%d.ps", n);
pl->plot(ve);
pl->psPrint(name);
sprintf(name,"hits_%d.ps", n);
pl->plot(vhit);
pl->psPrint(name);
}
delete vxz;
delete vyz;
delete ve;
delete vhit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
/* This member is called at the end of every event */
void GammaRayTelAnalysisManager::EndOfEvent(G4int flag)
{
// The histograms are updated only if there is some
// hits in the event
if(flag) Plot();
}
#endif
@@ -0,0 +1,152 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelAnalysisMessenger.cc,v 1.1 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelAnalysisMessenger ------
// by R.Giannitrapani, F.Longo & G.Santin (03 dic 2000)
//
// ************************************************************
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisMessenger.hh"
#include "GammaRayTelAnalysisManager.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnalysisMessenger::GammaRayTelAnalysisMessenger(GammaRayTelAnalysisManager* analysisManager)
:GammaRayTelAnalysis(analysisManager)
{
GammaRayTelAnalysisDir = new G4UIdirectory("/analysis/");
GammaRayTelAnalysisDir->SetGuidance("GammaRayTel analysis control.");
/*
Commands for the 1D histograms (energy deposition in the last
TKR layer and hits distribution along the TKR)
The Draw command gives the possibility to draw the 1d histograms
at every event.
The Save command gives the possibility to save the 1d histograms in
two separate PostScript files at the end of the run.
*/
Histo1DDrawCmd = new G4UIcmdWithAString("/analysis/histo1dDraw",this);
Histo1DDrawCmd->SetGuidance("Enable the drawing of the 1d histograms every event.");
Histo1DDrawCmd->SetGuidance("Choice: disable, enable(default)");
Histo1DDrawCmd->SetParameterName("choice",true);
Histo1DDrawCmd->SetDefaultValue("ebable");
Histo1DDrawCmd->SetCandidates("disable enable");
Histo1DDrawCmd->AvailableForStates(Idle);
Histo1DSaveCmd = new G4UIcmdWithAString("/analysis/histo1dSave",this);
Histo1DSaveCmd->SetGuidance("Enable the saving of the 1d histograms every run.");
Histo1DSaveCmd->SetGuidance("Choice: disable, enable(default)");
Histo1DSaveCmd->SetParameterName("choice",true);
Histo1DSaveCmd->SetDefaultValue("enable");
Histo1DSaveCmd->SetCandidates("disable enable");
Histo1DSaveCmd->AvailableForStates(Idle);
/*
Commands for the 2D histograms (hits positions along the TKR)
The Draw command gives the possibility to draw the 1d histograms
at every event.
The Save command gives the possibility to save the 1d histograms in
two separate PostScript files at the end of the run.
Moreover there is the possibility to set the 2d histograms so
that the info stored are true position ((x,z) or (y,z)
coordinates with respect to the payload reference frame in mm) or
the number of the Strip and the number of the Plane in which the
hit occur. To note that this feature is just for visualization
purpouse since both the information are saved in the external ASCII
file.
*/
Histo2DDrawCmd = new G4UIcmdWithAString("/analysis/histo2dDraw",this);
Histo2DDrawCmd->SetGuidance("Enable the drawing of the 2d histograms every events.");
Histo2DDrawCmd->SetGuidance("Choice: disable, enable(default)");
Histo2DDrawCmd->SetParameterName("choice",true);
Histo2DDrawCmd->SetDefaultValue("enable");
Histo2DDrawCmd->SetCandidates("disable enable");
Histo2DDrawCmd->AvailableForStates(Idle);
Histo2DSaveCmd = new G4UIcmdWithAString("/analysis/histo2dSave",this);
Histo2DSaveCmd->SetGuidance("Enable the saving of the 2d histograms every run.");
Histo2DSaveCmd->SetGuidance("Choice: disable, enable(default)");
Histo2DSaveCmd->SetParameterName("choice",true);
Histo2DSaveCmd->SetDefaultValue("enable");
Histo2DSaveCmd->SetCandidates("disable enable");
Histo2DSaveCmd->AvailableForStates(Idle);
Histo2DModeCmd = new G4UIcmdWithAString("/analysis/histo2dMode",this);
Histo2DModeCmd->SetGuidance("Select the mode for the 2d histograms.");
Histo2DModeCmd->SetGuidance("Choice: position, strip(default)");
Histo2DModeCmd->SetGuidance("position -> the histo is filled with true positions in mm");
Histo2DModeCmd->SetGuidance("strip -> the histo is filled with the number of the strip and the plane");
Histo2DModeCmd->SetParameterName("choice",true);
Histo2DModeCmd->SetDefaultValue("strip");
Histo2DModeCmd->SetCandidates("position strip");
Histo2DModeCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelAnalysisMessenger::~GammaRayTelAnalysisMessenger()
{
delete Histo1DDrawCmd;
delete Histo1DSaveCmd;
delete Histo2DDrawCmd;
delete Histo2DSaveCmd;
delete Histo2DModeCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelAnalysisMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
// 1D Histograms
if( command == Histo1DDrawCmd )
{ GammaRayTelAnalysis->SetHisto1DDraw(newValue);}
if( command == Histo1DSaveCmd )
{ GammaRayTelAnalysis->SetHisto1DSave(newValue);}
// 2D Histograms
if( command == Histo2DDrawCmd )
{ GammaRayTelAnalysis->SetHisto2DDraw(newValue);}
if( command == Histo2DSaveCmd )
{ GammaRayTelAnalysis->SetHisto2DSave(newValue);}
if( command == Histo2DModeCmd )
{ GammaRayTelAnalysis->SetHisto2DMode(newValue);}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#endif
@@ -0,0 +1,813 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelDetectorConstruction.cc,v 1.4 2000/12/06 16:53:13 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelDetectorConstruction ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelDetectorConstruction.hh"
#include "GammaRayTelDetectorMessenger.hh"
#include "GammaRayTelPayloadSD.hh"
#include "GammaRayTelPayloadROGeometry.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4LogicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4UniformMagField.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4SDManager.hh"
#include "G4RunManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDetectorConstruction::GammaRayTelDetectorConstruction()
:solidWorld(0),logicWorld(0),physiWorld(0),
solidPayload(0),logicPayload(0),physiPayload(0),
solidTKR(0),logicTKR(0),physiTKR(0),
solidCAL(0),logicCAL(0),physiCAL(0),
solidACT(0),logicACT(0),physiACT(0),
solidACL1(0),logicACL1(0),physiACL1(0),
solidACL2(0),logicACL2(0),physiACL2(0),
solidConverter(0),logicConverter(0),physiConverter(0),
solidTKRDetectorX(0),logicTKRDetectorX(0),
solidTKRDetectorY(0),logicTKRDetectorY(0),
physiTKRDetectorX(0),physiTKRDetectorY(0),
solidCALDetector(0),logicCALDetector(0),
physiCALDetectorX(0),physiCALDetectorY(0),
solidPlane(0),logicPlane(0),physiPlane(0)
{
// default parameter values of the payload
ConverterThickness = 300.*micrometer;
TKRSiliconThickness = 400.*micrometer;
TKRSiliconTileXY = 9.*cm;
TKRSiliconPitch = 200.*micrometer;
TKRLayerDistance = 3.*cm;
SiliconGuardRing = 1.5*mm;
TKRViewsDistance = 1.*mm;
NbOfTKRLayers = 15;
NbOfTKRTiles = 4;
CALBarThickness = 1.5*cm;
NbOfCALBars = 12;
NbOfCALLayers = 5;
ACDThickness = 1.*cm;
TilesSeparation = 100.*micrometer;
ACDTKRDistance = 5.*cm;
CALTKRDistance = 1.5*cm;
ComputePayloadParameters();
// create commands for interactive definition of the payload
detectorMessenger = new GammaRayTelDetectorMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDetectorConstruction::~GammaRayTelDetectorConstruction()
{ delete detectorMessenger;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* GammaRayTelDetectorConstruction::Construct()
{
DefineMaterials();
return ConstructPayload();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::DefineMaterials()
{
G4String name, symbol;
G4double a, z, density;
G4int ncomponents, natoms;
G4double abundance, fractionmass;
G4double temperature, pressure;
//
// define Elements
//
a = 1.01*g/mole;
G4Element* H = new G4Element(name="Hydrogen",symbol="H" , z= 1., a);
a = 12.01*g/mole;
G4Element* C = new G4Element(name="Carbon" ,symbol="C" , z= 6., a);
a = 14.006*g/mole;
G4Element* N = new G4Element(name="Nitrogen" ,symbol="N" , z= 7., a);
a = 15.99*g/mole;
G4Element* O = new G4Element(name="Oxygen" ,symbol="O" , z= 8., a);
a = 126.904*g/mole;
G4Element* I = new G4Element(name="Iodine" ,symbol="I" , z= 53., a);
a = 132.905*g/mole;
G4Element* Cs = new G4Element(name="Cesium" ,symbol="Cs" , z= 55., a);
//
// define simple materials
//
density = 2.700*g/cm3;
a = 26.98*g/mole;
G4Material* Al = new G4Material(name="Aluminium", z=13., a, density);
density = 2.333*g/cm3;
a = 28.09*g/mole;
G4Material* Si = new G4Material(name="Silicon",z=14., a,density);
density = 19.3*g/cm3;
a = 183.84*g/mole;
G4Material* W = new G4Material(name="Tungsten", z=74., a, density);
density = 11.35*g/cm3;
a = 207.19*g/mole;
G4Material* Pb = new G4Material(name="Lead", z=82., a, density);
density = 7.87*g/cm3;
a= 55.845*g/mole;
G4Material* Fe = new G4Material(name="Iron", z=26.,a,density);
//
// define a material from elements. case 1: chemical molecule
//
density = 1.032*g/cm3;
G4Material* Sci = new G4Material(name="Scintillator", density, ncomponents=2);
Sci->AddElement(C, natoms=9);
Sci->AddElement(H, natoms=10);
density = 4.53*g/cm3;
G4Material* CsI = new G4Material(name="CesiumIodide", density, ncomponents=2);
CsI->AddElement(C, natoms=5);
CsI->AddElement(H, natoms=5);
//
// define a material from elements. case 2: mixture by fractional mass
//
density = 1.290*mg/cm3;
G4Material* Air = new G4Material(name="Air" , density, ncomponents=2);
Air->AddElement(N, fractionmass=0.7);
Air->AddElement(O, fractionmass=0.3);
//
// examples of vacuum
//
density = universe_mean_density; //from PhysicalConstants.h
pressure = 3.e-18*pascal;
temperature = 2.73*kelvin;
G4Material* vacuum = new G4Material(name="Galactic", z=1., a=1.01*g/mole, density,kStateGas,temperature,pressure);
density = 1.e-5*g/cm3;
pressure = 2.e-2*bar;
temperature = STP_Temperature; //from PhysicalConstants.h
G4Material* beam = new G4Material(name="Beam", density, ncomponents=1,
kStateGas,temperature,pressure);
beam->AddMaterial(Air, fractionmass=1.);
G4cout << *(G4Material::GetMaterialTable()) << G4endl;
//default materials of the payload
ConverterMaterial = Pb;
defaultMaterial = vacuum;
ACDMaterial = Sci;
CALMaterial = CsI;
TKRMaterial = Si;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4VPhysicalVolume* GammaRayTelDetectorConstruction::ConstructPayload()
{
// complete the Payload parameters definition
ComputePayloadParameters();
//
// World
//
solidWorld = new G4Box("World",
WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2);
logicWorld = new G4LogicalVolume(solidWorld,
defaultMaterial,
"World");
physiWorld = new G4PVPlacement(0,G4ThreeVector(),"World",logicWorld,
0,false,0);
//
// Payload
//
solidPayload=0; logicPayload=0; physiPayload=0;
solidTKR=0;logicTKR=0;physiTKR=0;
solidCAL=0;logicCAL=0;physiCAL=0;
solidACT=0;logicACT=0;physiACT=0;
solidACL1=0;logicACL1=0;physiACL1=0;
solidACL2=0;logicACL2=0;physiACL2=0;
solidConverter=0;logicConverter=0;physiConverter=0;
solidTKRDetectorX=0;logicTKRDetectorX=0;
solidTKRDetectorY=0;logicTKRDetectorY=0;
physiTKRDetectorX=0;physiTKRDetectorY=0;
solidCALDetector=0;logicCALDetector=0;
physiCALDetectorX=0;physiCALDetectorY=0;
solidPlane=0;logicPlane=0;physiPlane=0;
// if (PayloadSizeZ > 0.)
// {
//
// Payload
//
solidPayload = new G4Box("Payload",
PayloadSizeXY/2,
PayloadSizeXY/2,
PayloadSizeZ/2);
logicPayload = new G4LogicalVolume(solidPayload,
defaultMaterial,
"Payload");
physiPayload = new G4PVPlacement(0,
G4ThreeVector(),
"Payload",
logicPayload,
physiWorld,
false,
0);
//
// Calorimeter (CAL)
//
solidCAL = new G4Box("CAL",
CALSizeXY/2,CALSizeXY/2,CALSizeZ/2);
logicCAL = new G4LogicalVolume(solidCAL,
defaultMaterial,
"CAL");
physiCAL = new G4PVPlacement(0,
G4ThreeVector(0,0,
-PayloadSizeZ/2+CALSizeZ/2),
"CAL",
logicCAL,
physiPayload,
false,
0);
//
// Tracker (TKR)
//
solidTKR = new G4Box("TKR",
TKRSizeXY/2,TKRSizeXY/2,TKRSizeZ/2);
logicTKR = new G4LogicalVolume(solidTKR,
defaultMaterial,
"TKR");
physiTKR = new G4PVPlacement(0,
G4ThreeVector(0,0,
-PayloadSizeZ/2+CALSizeZ+
CALTKRDistance+TKRSizeZ/2),
"TKR",
logicTKR,
physiPayload,
false,
0);
//
// Anticoincidence Top (ACT)
//
solidACT = new G4Box("ACT",
ACTSizeXY/2,ACTSizeXY/2,ACTSizeZ/2);
logicACT = new G4LogicalVolume(solidACT,ACDMaterial,"ACT");
physiACT = new G4PVPlacement(0,
G4ThreeVector(0,0,
-PayloadSizeZ/2+CALSizeZ+
CALTKRDistance+TKRSizeZ+
ACDTKRDistance+ACTSizeZ/2),
"ACT",
logicACT,
physiPayload,
false,
0);
//
// Anticoincidence Lateral Side (ACL)
//
solidACL1 = new G4Box("ACL1",
ACL1SizeX/2,ACL1SizeY/2,ACL1SizeZ/2);
logicACL1 = new G4LogicalVolume(solidACL1,ACDMaterial,"ACL");
physiACL1 = new G4PVPlacement(0,
G4ThreeVector(-PayloadSizeXY/2+ACL1SizeX/2,
-PayloadSizeXY/2+ACL1SizeY/2,
-PayloadSizeZ/2+ACL1SizeZ/2),
"ACL1",
logicACL1,
physiPayload,
false,
0);
physiACL1 = new G4PVPlacement(0,
G4ThreeVector(PayloadSizeXY/2-ACL1SizeX/2,
PayloadSizeXY/2-ACL1SizeY/2,
-PayloadSizeZ/2+ACL1SizeZ/2),
"ACL1",
logicACL1,
physiPayload,
false,
1);
solidACL2 = new G4Box("ACL2",
ACL2SizeX/2,ACL2SizeY/2,ACL2SizeZ/2);
logicACL2 = new G4LogicalVolume(solidACL2,
ACDMaterial,
"ACL2");
physiACL2 = new G4PVPlacement(0,
G4ThreeVector(-PayloadSizeXY/2+ACL2SizeX/2,
PayloadSizeXY/2-ACL2SizeY/2,
-PayloadSizeZ/2+ACL2SizeZ/2),
"ACL2",
logicACL2,
physiPayload,
false,
0);
physiACL2 = new G4PVPlacement(0,
G4ThreeVector(PayloadSizeXY/2-ACL2SizeX/2,
-PayloadSizeXY/2+ACL2SizeY/2,
-PayloadSizeZ/2+ACL2SizeZ/2),
"ACL2",
logicACL2,
physiPayload,
false,
1);
// Tracker Structure (Plane + Converter + TKRDetectorX + TKRDetectorY)
solidPlane = new G4Box("Plane",
TKRSizeXY/2,TKRSizeXY/2,TKRSupportThickness/2);
logicPlane = new G4LogicalVolume(solidPlane,
defaultMaterial,
"Plane");
solidTKRDetectorY = new G4Box
("TKRDetectorY",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2);
logicTKRDetectorY = new G4LogicalVolume(solidTKRDetectorY,
TKRMaterial,
"TKRDetector Y");
solidTKRDetectorX = new G4Box
("TKRDetectorX",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2);
logicTKRDetectorX = new G4LogicalVolume(solidTKRDetectorX,
TKRMaterial,
"TKRDetector X");
solidConverter = new G4Box
("Converter",TKRSizeXY/2,TKRSizeXY/2,ConverterThickness/2);
logicConverter = new G4LogicalVolume(solidConverter,
ConverterMaterial,
"Converter");
G4int i=0;
for (i = 0; i < NbOfTKRLayers; i++)
{
physiTKRDetectorY =
new G4PVPlacement(0,G4ThreeVector(0.,0.,-TKRSizeZ/2
+TKRSiliconThickness/2
+(i)*TKRLayerDistance),
"TKRDetectorY",
logicTKRDetectorY,
physiTKR,
false,
i);
physiTKRDetectorX =
new G4PVPlacement(0,G4ThreeVector(0.,0.,
-TKRSizeZ/2+
TKRSiliconThickness/2 +
TKRViewsDistance+
TKRSiliconThickness+
(i)*TKRLayerDistance),
"TKRDetectorX",
logicTKRDetectorX,
physiTKR,
false,
i);
physiConverter =
new G4PVPlacement(0,G4ThreeVector(0.,0.,
-TKRSizeZ/2+
2*TKRSiliconThickness +
TKRViewsDistance+
ConverterThickness/2+
(i)*TKRLayerDistance),
"Converter",
logicConverter,
physiTKR,
false,
i);
physiPlane =
new G4PVPlacement(0,G4ThreeVector(0.,0.,
-TKRSizeZ/2+
2*TKRSiliconThickness +
TKRViewsDistance+
ConverterThickness+
TKRSupportThickness/2),
"Plane",
logicPlane,
physiTKR,
false,
i);
}
G4VSolid * solidTKRActiveTileX = new
G4Box("Active Tile X", TKRActiveTileXY/2,TKRActiveTileXY/2,TKRActiveTileZ/2);
G4VSolid * solidTKRActiveTileY = new
G4Box("Active Tile Y", TKRActiveTileXY/2,TKRActiveTileXY/2,TKRActiveTileZ/2);
G4LogicalVolume* logicTKRActiveTileX =
new G4LogicalVolume(solidTKRActiveTileX, TKRMaterial,
"Active Tile X",0,0,0);
G4LogicalVolume* logicTKRActiveTileY =
new G4LogicalVolume(solidTKRActiveTileY, TKRMaterial,
"Active Tile Y",0,0,0);
G4int j=0;
G4int k=0;
G4VPhysicalVolume* physiTKRActiveTileX = 0;
G4VPhysicalVolume* physiTKRActiveTileY = 0;
G4double x=0.;
G4double y=0.;
G4double z=0.;
for (i=0;i< NbOfTKRTiles; i++)
{
for (j=0;j< NbOfTKRTiles; j++)
{
k = i*NbOfTKRTiles + j;
x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
TKRActiveTileXY/2+(i)*((2*SiliconGuardRing)+
TilesSeparation+TKRActiveTileXY);
y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
TKRActiveTileXY/2+(j)*((2*SiliconGuardRing)+TilesSeparation+
TKRActiveTileXY);
z = 0.;
physiTKRActiveTileY =
new G4PVPlacement(0,
G4ThreeVector(x,y,z),
"Active Tile Y",
logicTKRActiveTileY,
physiTKRDetectorY,
false,
k);
x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
TKRActiveTileXY/2+(j)*((2*SiliconGuardRing)+
TilesSeparation+TKRActiveTileXY);
y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+
TKRActiveTileXY/2+(i)*((2*SiliconGuardRing)+
TilesSeparation+TKRActiveTileXY);
z = 0.;
physiTKRActiveTileX =
new G4PVPlacement(0,
G4ThreeVector(x,y,z),
"Active Tile X",
logicTKRActiveTileX,
physiTKRDetectorX,
false,
k);
}
}
// Calorimeter Structure (CALDetectorX + CALDetectorY)
solidCALDetector = new G4Box("CALDetector",
CALSizeXY/2,CALSizeXY/2,CALBarThickness/2);
logicCALDetector = new G4LogicalVolume(solidCALDetector,
CALMaterial,
"CALDetector");
for (i = 0; i < NbOfCALLayers; i++)
{
physiCALDetectorY =
new G4PVPlacement(0,G4ThreeVector(0,0,
-CALSizeZ/2+
CALBarThickness/2 +
(i)*2*CALBarThickness),
"CALDetectorY",
logicCALDetector,
physiCAL,
false,
i);
physiCALDetectorX =
new G4PVPlacement(0,G4ThreeVector(0,0,
-CALSizeZ/2+
CALBarThickness/2 +
CALBarThickness +
(i)*2*CALBarThickness),
"CALDetectorX",
logicCALDetector,
physiCAL,
false,
i);
}
//}
//
// Sensitive Detectors: TKRDetector
//
G4SDManager* SDman = G4SDManager::GetSDMpointer();
if(!payloadSD)
{
payloadSD = new GammaRayTelPayloadSD("PayloadSD",this);
SDman->AddNewDetector( payloadSD );
}
G4String ROgeometryName = "PayloadROGeom";
G4VReadOutGeometry* payloadRO =
payloadRO = new GammaRayTelPayloadROGeometry(ROgeometryName, this);
payloadRO->BuildROGeometry();
payloadSD->SetROgeometry(payloadRO);
// if (logicTKRDetector)
// logicTKRDetector->SetSensitiveDetector(payloadSD); // sensitive planes
if (logicTKRActiveTileX)
logicTKRActiveTileX->SetSensitiveDetector(payloadSD); // sensitive tile
if (logicTKRActiveTileY)
logicTKRActiveTileY->SetSensitiveDetector(payloadSD); // sensitive tile
//
// Visualization attributes
//
// Invisible Volume
logicWorld->SetVisAttributes (G4VisAttributes::Invisible);
logicPayload->SetVisAttributes (G4VisAttributes::Invisible);
logicTKR->SetVisAttributes(G4VisAttributes::Invisible);
logicTKRActiveTileX->SetVisAttributes(G4VisAttributes::Invisible);
logicTKRActiveTileY->SetVisAttributes(G4VisAttributes::Invisible);
logicPlane->SetVisAttributes(G4VisAttributes::Invisible);
logicConverter->SetVisAttributes(G4VisAttributes::Invisible);
// Some visualization styles
G4VisAttributes* VisAtt1= new G4VisAttributes(G4Colour(0.3,0.8,0.1));
VisAtt1->SetVisibility(true);
VisAtt1->SetForceSolid(TRUE);
G4VisAttributes* VisAtt2= new G4VisAttributes(G4Colour(0.2,0.3,0.8));
VisAtt2->SetVisibility(true);
VisAtt2->SetForceSolid(FALSE);
G4VisAttributes* VisAtt3= new G4VisAttributes(G4Colour(0.8,0.2,0.3));
VisAtt3->SetVisibility(true);
VisAtt3->SetForceWireframe(TRUE);
// Visible Volumes
logicCAL->SetVisAttributes(VisAtt1);
logicTKRDetectorX->SetVisAttributes(VisAtt2);
logicTKRDetectorY->SetVisAttributes(VisAtt2);
logicACT->SetVisAttributes(VisAtt3);
logicACL1->SetVisAttributes(VisAtt3);
logicACL2->SetVisAttributes(VisAtt3);
//
//always return the physical World
//
PrintPayloadParameters();
return physiWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::PrintPayloadParameters()
{
G4cout << "\n------------------------------------------------------------"
<< "\n---> The Tracker is " << NbOfTKRLayers << " layers of: "
<< ConverterThickness/mm << "mm of " << ConverterMaterial->GetName()
<< "\n------------------------------------------------------------\n";
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::SetConverterMaterial(G4String materialChoice)
{
// search the material by its name
G4Material* pttoMaterial = G4Material::GetMaterial(materialChoice);
if (pttoMaterial)
{
ConverterMaterial = pttoMaterial;
logicConverter->SetMaterial(pttoMaterial);
PrintPayloadParameters();
}
}
void GammaRayTelDetectorConstruction::SetConverterThickness(G4double val)
{
ConverterThickness = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::SetTKRSiliconThickness(G4double val)
{
TKRSiliconThickness = val;
}
void GammaRayTelDetectorConstruction::SetTKRSiliconPitch(G4double val)
{
TKRSiliconPitch = val;
}
void GammaRayTelDetectorConstruction::SetTKRTileSizeXY(G4double val)
{
TKRSiliconTileXY = val;
}
void GammaRayTelDetectorConstruction::SetNbOfTKRLayers(G4int val)
{
NbOfTKRLayers = val;
}
void GammaRayTelDetectorConstruction::SetNbOfTKRTiles(G4int val)
{
NbOfTKRTiles = val;
}
void GammaRayTelDetectorConstruction::SetTKRLayerDistance(G4double val)
{
TKRLayerDistance = val;
}
void GammaRayTelDetectorConstruction::SetTKRViewsDistance(G4double val)
{
TKRViewsDistance = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::SetNbOfCALLayers(G4int val)
{
NbOfCALLayers = val;
}
void GammaRayTelDetectorConstruction::SetNbOfCALBars(G4int val)
{
NbOfCALBars = val;
}
void GammaRayTelDetectorConstruction::SetCALBarThickness(G4double val)
{
CALBarThickness = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::SetACDThickness(G4double val)
{
ACDThickness = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::SetMagField(G4double fieldValue)
{
//apply a global uniform magnetic field along Z axis
G4FieldManager* fieldMgr
= G4TransportationManager::GetTransportationManager()->GetFieldManager();
if(magField) delete magField; //delete the existing magn field
if(fieldValue!=0.) // create a new one if non nul
{ magField = new G4UniformMagField(G4ThreeVector(0.,0.,fieldValue));
fieldMgr->SetDetectorField(magField);
fieldMgr->CreateChordFinder(magField);
} else {
magField = 0;
fieldMgr->SetDetectorField(magField);
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorConstruction::UpdateGeometry()
{
// delete payloadSD;
G4RunManager::GetRunManager()->DefineWorldVolume(ConstructPayload());
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,256 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelDetectorMessenger.cc,v 1.3 2000/12/06 16:53:14 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelDetectorMessenger ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
#include "GammaRayTelDetectorMessenger.hh"
#include "GammaRayTelDetectorConstruction.hh"
#include "G4UIdirectory.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
#include "G4UIcmdWithoutParameter.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDetectorMessenger::GammaRayTelDetectorMessenger(GammaRayTelDetectorConstruction * GammaRayTelDet)
:GammaRayTelDetector(GammaRayTelDet)
{
GammaRayTeldetDir = new G4UIdirectory("/payload/");
GammaRayTeldetDir->SetGuidance("GammaRayTel payload control.");
// converter material command
ConverterMaterCmd = new G4UIcmdWithAString("/payload/setConvMat",this);
ConverterMaterCmd->SetGuidance("Select Material of the Converter.");
ConverterMaterCmd->SetParameterName("choice",false);
ConverterMaterCmd->AvailableForStates(Idle);
// converter thickness command
ConverterThickCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setConvThick",this);
ConverterThickCmd->SetGuidance("Set Thickness of the Converter");
ConverterThickCmd->SetParameterName("Size",false);
ConverterThickCmd->SetRange("Size>=0.");
ConverterThickCmd->SetUnitCategory("Length");
ConverterThickCmd->AvailableForStates(Idle);
// tracker silicon thickness command
SiliconThickCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setSiThick",this);
SiliconThickCmd->SetGuidance("Set Thickness of the Silicon");
SiliconThickCmd->SetParameterName("Size",false);
SiliconThickCmd->SetRange("Size>=0.");
SiliconThickCmd->SetUnitCategory("Length");
SiliconThickCmd->AvailableForStates(Idle);
// tracker silicon pitch command
SiliconPitchCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setSiPitch",this);
SiliconPitchCmd->SetGuidance("Set Pitch of the Silicon Strips");
SiliconPitchCmd->SetParameterName("Size",false);
SiliconPitchCmd->SetRange("Size>=0.");
SiliconPitchCmd->SetUnitCategory("Length");
SiliconPitchCmd->AvailableForStates(Idle);
// tracker silicon tile size command
SiliconTileXYCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setSiTileXY",this);
SiliconTileXYCmd->SetGuidance("Set XY dimensions of Si Tile");
SiliconTileXYCmd->SetParameterName("Size",false);
SiliconTileXYCmd->SetRange("Size>=0.");
SiliconTileXYCmd->SetUnitCategory("Length");
SiliconTileXYCmd->AvailableForStates(Idle);
// tracker number of silicon tiles
NbSiTilesCmd = new G4UIcmdWithAnInteger("/payload/setNbOfSiTiles",this);
NbSiTilesCmd->SetGuidance("Set number of Si Tiles.");
NbSiTilesCmd->SetParameterName("NbSiTiles",false);
NbSiTilesCmd->SetRange("NbSiTiles>0 && NbSiTiles<100");
NbSiTilesCmd->AvailableForStates(Idle);
// tracker number of silicon layers
NbTKRLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfTKRLayers",this);
NbTKRLayersCmd->SetGuidance("Set number of TKR Layers.");
NbTKRLayersCmd->SetParameterName("NbTKRLayers",false);
NbTKRLayersCmd->SetRange("NbTKRLayers>0 && NbTKRLayers<30");
NbTKRLayersCmd->AvailableForStates(Idle);
// tracker layer distance
LayerDistanceCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setLayerDistance",this);
LayerDistanceCmd->SetGuidance("Set distance between two layers");
LayerDistanceCmd->SetParameterName("Size",false);
LayerDistanceCmd->SetRange("Size>=0.");
LayerDistanceCmd->SetUnitCategory("Length");
LayerDistanceCmd->AvailableForStates(Idle);
// tracker views distance
ViewsDistanceCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setViewsDistance",this);
ViewsDistanceCmd->SetGuidance("Set distance between X and Y views");
ViewsDistanceCmd->SetParameterName("Size",false);
ViewsDistanceCmd->SetRange("Size>=0.");
ViewsDistanceCmd->SetUnitCategory("Length");
ViewsDistanceCmd->AvailableForStates(Idle);
// calorimeter detector thickness
CALThickCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setCALThick",this);
CALThickCmd->SetGuidance("Set thickness of CAL detectors");
CALThickCmd->SetParameterName("Size",false);
CALThickCmd->SetRange("Size>=0.");
CALThickCmd->SetUnitCategory("Length");
CALThickCmd->AvailableForStates(Idle);
// number calorimeter detectors
NbCALBarsCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALBars",this);
NbCALBarsCmd->SetGuidance("Set number of CsI Bars.");
NbCALBarsCmd->SetParameterName("NbSiTiles",false);
NbCALBarsCmd->SetRange("NbSiTiles>0 && NbSiTiles<100");
NbCALBarsCmd->AvailableForStates(Idle);
// number calorimeter layers
NbCALLayersCmd = new G4UIcmdWithAnInteger("/payload/setNbOfCALLayers",this);
NbCALLayersCmd->SetGuidance("Set number of CAL Layers.");
NbCALLayersCmd->SetParameterName("NbCALLayers",false);
NbCALLayersCmd->SetRange("NbCALLayers>0 && NbCALLayers<16");
NbCALLayersCmd->AvailableForStates(Idle);
// calorimeter detector thickness
ACDThickCmd = new G4UIcmdWithADoubleAndUnit
("/payload/setACDThick",this);
ACDThickCmd->SetGuidance("Set thickness of ACD detectors");
ACDThickCmd->SetParameterName("Size",false);
ACDThickCmd->SetRange("Size>=0.");
ACDThickCmd->SetUnitCategory("Length");
ACDThickCmd->AvailableForStates(Idle);
// update Payload
UpdateCmd = new G4UIcmdWithoutParameter("/payload/update",this);
UpdateCmd->SetGuidance("Update payload geometry.");
UpdateCmd->SetGuidance("This command MUST be applied before \"beamOn\" ");
UpdateCmd->SetGuidance("if you changed geometrical value(s).");
UpdateCmd->AvailableForStates(Idle);
// magnetic field
MagFieldCmd = new G4UIcmdWithADoubleAndUnit("/payload/setField",this);
MagFieldCmd->SetGuidance("Define magnetic field.");
MagFieldCmd->SetGuidance("Magnetic field will be in Z direction.");
MagFieldCmd->SetParameterName("Bz",false);
MagFieldCmd->SetUnitCategory("Magnetic flux density");
MagFieldCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelDetectorMessenger::~GammaRayTelDetectorMessenger()
{
delete ConverterMaterCmd; delete ConverterThickCmd;
delete NbSiTilesCmd; delete NbTKRLayersCmd;
delete SiliconTileXYCmd; delete SiliconPitchCmd;
delete SiliconThickCmd; delete LayerDistanceCmd;
delete ViewsDistanceCmd; delete ACDThickCmd;
delete NbCALLayersCmd; delete NbCALBarsCmd;
delete CALThickCmd; delete UpdateCmd;
delete MagFieldCmd; delete GammaRayTeldetDir;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelDetectorMessenger::SetNewValue(G4UIcommand* command,G4String newValue)
{
// converter
if( command == ConverterMaterCmd )
{ GammaRayTelDetector->SetConverterMaterial(newValue);}
if( command == ConverterThickCmd )
{ GammaRayTelDetector->SetConverterThickness(ConverterThickCmd->GetNewDoubleValue(newValue));}
// tracker
if( command == SiliconTileXYCmd )
{ GammaRayTelDetector->SetTKRTileSizeXY(SiliconTileXYCmd->GetNewDoubleValue(newValue));}
if( command == SiliconPitchCmd )
{ GammaRayTelDetector->SetTKRSiliconPitch(SiliconPitchCmd->GetNewDoubleValue(newValue));}
if( command == SiliconThickCmd )
{ GammaRayTelDetector->SetTKRSiliconThickness(SiliconThickCmd->GetNewDoubleValue(newValue));}
if( command == NbSiTilesCmd )
{ GammaRayTelDetector->SetNbOfTKRTiles(NbSiTilesCmd->GetNewIntValue(newValue));}
if( command == NbTKRLayersCmd )
{ GammaRayTelDetector->SetNbOfTKRLayers(NbTKRLayersCmd->GetNewIntValue(newValue));}
if( command == LayerDistanceCmd )
{ GammaRayTelDetector->SetTKRLayerDistance(LayerDistanceCmd->GetNewDoubleValue(newValue));}
if( command == ViewsDistanceCmd )
{ GammaRayTelDetector->SetTKRViewsDistance(ViewsDistanceCmd->GetNewDoubleValue(newValue));}
// calorimeter
if( command == NbCALLayersCmd )
{ GammaRayTelDetector->SetNbOfCALLayers(NbCALLayersCmd->GetNewIntValue(newValue));}
if( command == NbCALBarsCmd )
{ GammaRayTelDetector->SetNbOfCALBars(NbCALBarsCmd->GetNewIntValue(newValue));}
if( command == CALThickCmd )
{ GammaRayTelDetector->SetCALBarThickness(CALThickCmd->GetNewDoubleValue(newValue));}
// anticoincidence
if( command == ACDThickCmd )
{ GammaRayTelDetector->SetACDThickness(ACDThickCmd->GetNewDoubleValue(newValue));}
if( command == UpdateCmd )
{ GammaRayTelDetector->UpdateGeometry(); }
if( command == MagFieldCmd )
{ GammaRayTelDetector->SetMagField(MagFieldCmd->GetNewDoubleValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,173 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelEventAction.cc,v 1.4 2000/12/06 16:53:14 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelEventAction ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
#include "GammaRayTelEventAction.hh"
#include "GammaRayTelPayloadHit.hh"
#include "g4rw/tvordvec.h"
#ifdef G4ANALYSIS_USE
#include "GammaRayTelAnalysisManager.hh"
#endif
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4VHitsCollection.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
#include "G4ios.hh"
#include "G4UnitsTable.hh"
#include "Randomize.hh"
// This file is a global variable in which we store energy deposition per hit
// and other relevant information
extern G4std::ofstream outFile;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifdef G4ANALYSIS_USE
GammaRayTelEventAction::GammaRayTelEventAction(GammaRayTelAnalysisManager* aMgr)
:drawFlag("all"),trackerCollID(-1),analysisManager(aMgr)
{
}
#else
GammaRayTelEventAction::GammaRayTelEventAction()
:drawFlag("all"), trackerCollID(-1)
{
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelEventAction::~GammaRayTelEventAction()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelEventAction::BeginOfEventAction(const G4Event* evt)
{
G4int evtNb = evt->GetEventID();
G4cout << "Event: " << evtNb << G4endl;
if (trackerCollID==-1)
{
G4SDManager * SDman = G4SDManager::GetSDMpointer();
trackerCollID = SDman->GetCollectionID("PayloadCollection");
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelEventAction::EndOfEventAction(const G4Event* evt)
{
G4int event_id = evt->GetEventID();
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if (trajectoryContainer) n_trajectories = trajectoryContainer->entries();
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
GammaRayTelPayloadHitsCollection* CHC = NULL;
if (HCE)
CHC = (GammaRayTelPayloadHitsCollection*)(HCE->GetHC(trackerCollID));
if (CHC)
{
int n_hit = CHC->entries();
G4cout << "Number of hits in this event = " << n_hit << G4endl;
G4double ESil=0;
G4int NStrip, NPlane, IsX;
// This is a cycle on all the hits of this event
for (int i=0;i<n_hit;i++)
{
// Here we put the hit data in a an ASCII file for
// later analysis
ESil = (*CHC)[i]->GetEdepSil();
NStrip = (*CHC)[i]->GetNStrip();
NPlane = (*CHC)[i]->GetNSilPlane();
IsX = (*CHC)[i]->GetPlaneType();
outFile << G4std::setw(7) << event_id << " " <<
ESil/keV << " " << NStrip <<
" " << NPlane << " " << IsX << " " <<
(*CHC)[i]->GetPos().x()/mm <<" "<<
(*CHC)[i]->GetPos().y()/mm <<" "<<
(*CHC)[i]->GetPos().z()/mm <<" "<<
G4endl;
#ifdef G4ANALYSIS_USE
// Here we fill the histograms of the Analysis manager
if(IsX)
{
if (analysisManager->GetHisto2DMode()=="position")
analysisManager->InsertPositionXZ((*CHC)[i]->GetPos().x()/mm,(*CHC)[i]->GetPos().z()/mm);
else
analysisManager->InsertPositionXZ(NStrip, NPlane);
if (NPlane == 0) analysisManager->InsertEnergy(ESil/keV);
analysisManager->InsertHits(NPlane);
}
else
if (analysisManager->GetHisto2DMode()=="position")
analysisManager->InsertPositionYZ((*CHC)[i]->GetPos().y()/mm,(*CHC)[i]->GetPos().z()/mm);
else
analysisManager->InsertPositionYZ(NStrip, NPlane);
#endif
}
// Here we call the analysis manager function for visualization
#ifdef G4ANALYSIS_USE
analysisManager->EndOfEvent(n_hit);
#endif
}
if(G4VVisManager::GetConcreteInstance())
{
for(G4int i=0; i<n_trajectories; i++)
{ G4Trajectory* trj = (G4Trajectory *)((*(evt->GetTrajectoryContainer()))[i]);
if (drawFlag == "all") trj->DrawTrajectory(50);
else if ((drawFlag == "charged")&&(trj->GetCharge() != 0.))
trj->DrawTrajectory(50);
}
}
}
@@ -0,0 +1,91 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadHit.cc,v 1.2 2000/11/15 20:27:41 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadHit ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelPayloadHit.hh"
G4Allocator<GammaRayTelPayloadHit> GammaRayTelPayloadHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPayloadHit::GammaRayTelPayloadHit()
{
EdepSil = 0.;
NStrip = 0; NSilPlane = 0; IsXPlane = 0;
pos = 0.;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPayloadHit::~GammaRayTelPayloadHit()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPayloadHit::GammaRayTelPayloadHit(const GammaRayTelPayloadHit& right)
{
EdepSil = right.EdepSil;
NStrip = right.NStrip; NSilPlane = right.NSilPlane;
IsXPlane = right.IsXPlane;
pos = right.pos;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
const GammaRayTelPayloadHit& GammaRayTelPayloadHit::operator=(const GammaRayTelPayloadHit& right)
{
EdepSil = right.EdepSil;
NStrip = right.NStrip; NSilPlane = right.NSilPlane;
IsXPlane = right.IsXPlane;
pos =right.pos;
return *this;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
int GammaRayTelPayloadHit::operator==(const GammaRayTelPayloadHit& right) const
{
return 0;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadHit::Draw()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadHit::Print()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,336 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadROGeometry.cc,v 1.2 2000/11/20 16:49:02 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadROGeometry class ------
// by F.Longo, R.Giannitrapani & G.Santin (13 nov 2000)
//
// ************************************************************
#include "GammaRayTelPayloadROGeometry.hh"
#include "GammaRayTelDummySD.hh"
#include "GammaRayTelDetectorConstruction.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4Box.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
GammaRayTelPayloadROGeometry::GammaRayTelPayloadROGeometry()
: G4VReadOutGeometry()
{
}
GammaRayTelPayloadROGeometry::GammaRayTelPayloadROGeometry(G4String aString,GammaRayTelDetectorConstruction* GammaRayTelDC)
:GammaRayTelDetector(GammaRayTelDC), G4VReadOutGeometry(aString)
{
}
GammaRayTelPayloadROGeometry::GammaRayTelPayloadROGeometry(G4String aString)
: G4VReadOutGeometry(aString)
{
}
GammaRayTelPayloadROGeometry::~GammaRayTelPayloadROGeometry()
{
}
G4VPhysicalVolume* GammaRayTelPayloadROGeometry::Build()
{
// A dummy material is used to fill the volumes of the readout geometry.
// ( It will be allowed to set a NULL pointer in volumes of such virtual
// division in future, since this material is irrelevant for tracking.)
G4Material* dummyMat = new G4Material(name="dummyMat", 1., 1.*g/mole, 1.*g/cm3);
//Builds the ReadOut World:
G4double WorldSizeXY = GammaRayTelDetector->GetWorldSizeXY();
G4double WorldSizeZ = GammaRayTelDetector->GetWorldSizeZ();
G4Box* ROWorldBox = new
G4Box("ROWorldBox",WorldSizeXY/2,WorldSizeXY/2,WorldSizeZ/2);
G4LogicalVolume* ROWorldLog = new G4LogicalVolume(ROWorldBox, dummyMat,
"ROWorldLogical");
G4PVPlacement* ROWorldPhys =
new G4PVPlacement(0,G4ThreeVector(),"ROWorldPhysical",
ROWorldLog,0,false,0);
// Payload RO volume:
G4double PayloadSizeXY = GammaRayTelDetector->GetPayloadSizeXY();
G4double PayloadSizeZ = GammaRayTelDetector->GetPayloadSizeZ();
G4VSolid* solidPayloadRO
= new G4Box("Payload RO",
PayloadSizeXY/2,
PayloadSizeXY/2,
PayloadSizeZ/2);
G4LogicalVolume* logicPayloadRO = new
G4LogicalVolume(solidPayloadRO,dummyMat,"Payload RO",0,0,0);
G4VPhysicalVolume* physiPayloadRO =
new G4PVPlacement(0, G4ThreeVector(),
"Payload RO", logicPayloadRO,ROWorldPhys,false, 0);
// -------------------------------
// Tracker readout division:
// -------------------------------
// TRK Layers of Silicon MicroStrips
G4double TKRSizeXY = GammaRayTelDetector->GetTKRSizeXY();
G4double TKRSizeZ = GammaRayTelDetector->GetTKRSizeZ();
G4double CALSizeZ = GammaRayTelDetector->GetCALSizeZ();
G4double CALTKRDistance = GammaRayTelDetector->GetCALTKRDistance();
G4VSolid* ROsolidTKR =
new G4Box("ReadOutTKR", TKRSizeXY/2,TKRSizeXY/2,TKRSizeZ/2);
G4LogicalVolume* ROlogicTKR =
new G4LogicalVolume(ROsolidTKR,dummyMat, "ReadOutTKR",0,0,0);
G4VPhysicalVolume* ROphysiTKR =
new G4PVPlacement(0, G4ThreeVector(0,0,-PayloadSizeZ/2+CALSizeZ+
CALTKRDistance+TKRSizeZ/2),
"ReadOutTKR",ROlogicTKR,physiPayloadRO,
false, 0);
// TKR Layers
G4double TKRSiliconThickness =
GammaRayTelDetector->GetTKRSiliconThickness();
G4int NbOfTKRLayers = GammaRayTelDetector->GetNbOfTKRLayers();
G4double TKRLayerDistance = GammaRayTelDetector->GetTKRLayerDistance();
G4double TKRViewsDistance = GammaRayTelDetector->GetTKRViewsDistance();
G4VSolid* solidTKRDetectorYRO = new G4Box
("TKRDetectorYRO",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2);
G4LogicalVolume* logicTKRDetectorYRO =
new G4LogicalVolume(solidTKRDetectorYRO,dummyMat, "TKRDetectorYRO",0,0,0);
G4VSolid* solidTKRDetectorXRO = new G4Box
("TKRDetectorXRO",TKRSizeXY/2,TKRSizeXY/2,TKRSiliconThickness/2);
G4LogicalVolume* logicTKRDetectorXRO =
new G4LogicalVolume(solidTKRDetectorXRO,dummyMat, "TKRDetectorXRO",0,0,0);
G4int i=0;
G4VPhysicalVolume* physiTKRDetectorXRO = 0;
G4VPhysicalVolume* physiTKRDetectorYRO = 0;
for (i = 0; i < NbOfTKRLayers; i++)
{
physiTKRDetectorYRO =
new G4PVPlacement(0,G4ThreeVector(0.,0.,-TKRSizeZ/2
+TKRSiliconThickness/2
+(i)*TKRLayerDistance),
"TKRDetectorYRO",
logicTKRDetectorYRO,
ROphysiTKR,
false,
i);
physiTKRDetectorXRO =
new G4PVPlacement(0,G4ThreeVector(0.,0.,
-TKRSizeZ/2+
TKRSiliconThickness/2 +
TKRViewsDistance+
TKRSiliconThickness+
(i)*TKRLayerDistance),
"TKRDetectorXRO",
logicTKRDetectorXRO,
ROphysiTKR,
false,
i);
}
// Silicon Tiles
// some problems with the RO tree
G4double TKRActiveTileXY = GammaRayTelDetector->GetTKRActiveTileXY();
G4double TKRActiveTileZ = GammaRayTelDetector->GetTKRActiveTileZ();
G4VSolid * solidTKRActiveTileXRO = new
G4Box("Active Tile X", TKRActiveTileXY/2,TKRActiveTileXY/2,TKRActiveTileZ/2);
G4VSolid * solidTKRActiveTileYRO = new
G4Box("Active Tile Y", TKRActiveTileXY/2,TKRActiveTileXY/2,TKRActiveTileZ/2);
G4LogicalVolume* logicTKRActiveTileXRO =
new G4LogicalVolume(solidTKRActiveTileXRO, dummyMat,"Active Tile",0,0,0);
G4LogicalVolume* logicTKRActiveTileYRO =
new G4LogicalVolume(solidTKRActiveTileYRO, dummyMat,"Active Tile",0,0,0);
G4int j=0;
G4int k=0;
G4int NbOfTKRTiles = GammaRayTelDetector->GetNbOfTKRTiles();
G4double SiliconGuardRing = GammaRayTelDetector->GetSiliconGuardRing();
G4double TilesSeparation = GammaRayTelDetector->GetTilesSeparation();
G4VPhysicalVolume* physiTKRActiveTileXRO = 0;
G4VPhysicalVolume* physiTKRActiveTileYRO = 0;
G4double x=0.;
G4double y=0.;
G4double z=0.;
for (i=0;i< NbOfTKRTiles; i++)
{
for (j=0;j< NbOfTKRTiles; j++)
{
k = i*NbOfTKRTiles + j;
x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
(j)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
(i)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
z = 0.;
physiTKRActiveTileXRO =
new G4PVPlacement(0,
G4ThreeVector(x,y,z),
"Active Tile X",
logicTKRActiveTileXRO,
physiTKRDetectorXRO,
false,
k);
x = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
(i)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
y = -TKRSizeXY/2+TilesSeparation+SiliconGuardRing+TKRActiveTileXY/2+
(j)*((2*SiliconGuardRing)+TilesSeparation+TKRActiveTileXY);
z = 0.;
physiTKRActiveTileYRO =
new G4PVPlacement(0,
G4ThreeVector(x,y,z),
"Active Tile Y",
logicTKRActiveTileYRO,
physiTKRDetectorYRO,
false,
k);
}
}
// Silicon Strips
// some problems with the RO tree
G4double TKRXStripX=0.;
G4double TKRYStripY=0.;
G4double TKRYStripX=0.;
G4double TKRXStripY=0.;
TKRXStripX = TKRYStripY = GammaRayTelDetector->GetTKRSiliconPitch();
TKRYStripX = TKRXStripY= GammaRayTelDetector->GetTKRActiveTileXY();
G4double TKRZStrip = GammaRayTelDetector->GetTKRSiliconThickness();
G4int NbOfTKRStrips = GammaRayTelDetector->GetNbOfTKRStrips();
G4VSolid* solidTKRStripX = new G4Box("Strip X",
TKRXStripX/2,TKRYStripX/2,
TKRZStrip/2);
G4LogicalVolume* logicTKRStripX =
new G4LogicalVolume(solidTKRStripX,dummyMat,"Strip X",0,0,0);
G4VSolid* solidTKRStripY = new G4Box("Strip Y",
TKRXStripY/2,TKRYStripY/2,
TKRZStrip/2);
G4LogicalVolume* logicTKRStripY =
new G4LogicalVolume(solidTKRStripY,dummyMat,"Strip Y",0,0,0);
G4VPhysicalVolume* physiTKRStripX = 0;
G4VPhysicalVolume* physiTKRStripY = 0;
G4double TKRSiliconPitch = GammaRayTelDetector->GetTKRSiliconPitch();
for (i=0;i< NbOfTKRStrips; i++)
{
physiTKRStripX = new
G4PVPlacement(0,G4ThreeVector(-TKRActiveTileXY/2 +TKRSiliconPitch/2 +
(i)*TKRSiliconPitch, 0., 0.),
"Strip X",
logicTKRStripX,
physiTKRActiveTileXRO,
false,
i);
physiTKRStripY = new
G4PVPlacement(0,G4ThreeVector(0.,-TKRActiveTileXY/2
+TKRSiliconPitch/2 +
(i)*TKRSiliconPitch, 0.),
"Strip Y",
logicTKRStripY,
physiTKRActiveTileYRO,
false,
i);
}
//Flags the strip as sensitive .The pointer here serves
// as a flag only to check for sensitivity.
// (Could we make it by a simple cast of a non-NULL value ?)
GammaRayTelDummySD * dummySensi = new GammaRayTelDummySD;
logicTKRStripX->SetSensitiveDetector(dummySensi);
logicTKRStripY->SetSensitiveDetector(dummySensi);
//logicTKRActiveTileXRO->SetSensitiveDetector(dummySensi);
//logicTKRActiveTileYRO->SetSensitiveDetector(dummySensi);
//logicTKRDetectorRO->SetSensitiveDetector(dummySensi);
return ROWorldPhys;
}
@@ -0,0 +1,223 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPayloadSD.cc,v 1.6 2000/12/06 17:48:10 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPayloadSD ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
#include "GammaRayTelPayloadSD.hh"
#include "GammaRayTelPayloadHit.hh"
#include "GammaRayTelDetectorConstruction.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPayloadSD::GammaRayTelPayloadSD(G4String name,
GammaRayTelDetectorConstruction* det)
:G4VSensitiveDetector(name),Detector(det)
{
G4int NbOfTKRTiles = Detector->GetNbOfTKRTiles();
NbOfTKRStrips = Detector->GetNbOfTKRStrips();
NbOfTKRLayers = Detector->GetNbOfTKRLayers();
NbOfTKRStrips = NbOfTKRStrips*NbOfTKRTiles;
HitXID = new G4int[NbOfTKRStrips][30];
HitYID = new G4int[NbOfTKRStrips][30];
collectionName.insert("PayloadCollection");
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPayloadSD::~GammaRayTelPayloadSD()
{
delete [] HitXID;
delete [] HitYID;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadSD::Initialize(G4HCofThisEvent*HCE)
{
PayloadCollection = new GammaRayTelPayloadHitsCollection
(SensitiveDetectorName,collectionName[0]);
for (G4int i=0;i<NbOfTKRStrips;i++)
for (G4int j=0;j<NbOfTKRLayers;j++)
{
HitXID[i][j] = -1;
HitYID[i][j] = -1;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
G4bool GammaRayTelPayloadSD::ProcessHits(G4Step* aStep,G4TouchableHistory* ROhist)
{
G4double edep = aStep->GetTotalEnergyDeposit();
if ((edep/keV == 0.)) return false;
G4int StripTotal = Detector->GetNbOfTKRStrips();
G4int TileTotal = Detector->GetNbOfTKRTiles();
// This TouchableHistory is used to obtain the physical volume
// of the hit
G4TouchableHistory* theTouchable
= (G4TouchableHistory*)(aStep->GetPreStepPoint()->GetTouchable());
G4VPhysicalVolume* phys_tile = theTouchable->GetVolume();
G4VPhysicalVolume* plane = phys_tile->GetMother();
G4int PlaneNumber = 0;
PlaneNumber=plane->GetCopyNo();
G4String PlaneName = plane->GetName();
// The RO History is used to obtain the real strip
// of the hit
G4int StripNumber = 0;
G4VPhysicalVolume* strip = 0;
strip = ROhist->GetVolume();
G4String StripName = strip->GetName();
StripNumber= strip->GetCopyNo();
ROhist->MoveUpHistory();
G4VPhysicalVolume* tile = ROhist->GetVolume();
G4int TileNumber = tile->GetCopyNo();
G4String TileName = tile->GetName();
G4int NTile = (TileNumber%TileTotal);
G4int j=0;
for (j=0;j<TileTotal;j++)
{
if(NTile==j) StripNumber += StripTotal*NTile;
}
// G4cout << " Plane Number = " << PlaneNumber << " " << PlaneName << G4endl;
// G4cout << StripName << " " << StripNumber << G4endl;
ROhist->MoveUpHistory();
G4VPhysicalVolume* ROPlane = ROhist->GetVolume();
G4int ROPlaneNumber = ROPlane->GetCopyNo();
G4String ROPlaneName = ROPlane->GetName();
if (PlaneName == "TKRDetectorX" )
// The hit is on an X silicon plane
{
// This is a new hit
if (HitXID[StripNumber][PlaneNumber]==-1)
{
GammaRayTelPayloadHit* PayloadHit = new GammaRayTelPayloadHit;
PayloadHit->SetPlaneType(1);
PayloadHit->AddSil(edep);
PayloadHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
PayloadHit->SetNSilPlane(PlaneNumber);
PayloadHit->SetNStrip(StripNumber);
HitXID[StripNumber][PlaneNumber] =
PayloadCollection->insert(PayloadHit) -1;
}
else // This is not new
{
(*PayloadCollection)[HitXID[StripNumber][PlaneNumber]]->AddSil(edep);
// G4cout << "X" << PlaneNumber << " " << StripNumber << G4endl;
}
}
if (PlaneName == "TKRDetectorY")
// The hit is on an Y silicon plane
{
// This is a new hit
if (HitYID[StripNumber][PlaneNumber]==-1)
{
GammaRayTelPayloadHit* PayloadHit = new GammaRayTelPayloadHit;
PayloadHit->SetPlaneType(0);
PayloadHit->AddSil(edep);
PayloadHit->SetPos(aStep->GetPreStepPoint()->GetPosition());
PayloadHit->SetNSilPlane(PlaneNumber);
PayloadHit->SetNStrip(StripNumber);
HitYID[StripNumber][PlaneNumber] =
PayloadCollection->insert(PayloadHit)-1;
}
else // This is not new
{
(*PayloadCollection)[HitYID[StripNumber][PlaneNumber]]->AddSil(edep);
// G4cout << "Y" << PlaneNumber << " " << StripNumber << G4endl;
}
}
return true;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadSD::EndOfEvent(G4HCofThisEvent* HCE)
{
static G4int HCID = -1;
if(HCID<0)
{
HCID = G4SDManager::GetSDMpointer()->GetCollectionID(collectionName[0]);
}
HCE->AddHitsCollection(HCID,PayloadCollection);
for (G4int i=0;i<NbOfTKRLayers;i++)
for (G4int j=0;j<NbOfTKRStrips;j++)
{
HitXID[i][j] = -1;
HitYID[i][j] = -1;
};
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadSD::clear()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadSD::DrawAll()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPayloadSD::PrintAll()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,302 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPhysicsList.cc,v 1.2 2000/11/15 20:27:41 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPhysicsList ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelPhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPhysicsList::GammaRayTelPhysicsList(): G4VUserPhysicsList()
{
currentDefaultCut = defaultCutValue = 0.1*mm;
cutForGamma = defaultCutValue;
cutForElectron = defaultCutValue;
cutForProton = defaultCutValue;
SetVerboseLevel(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPhysicsList::~GammaRayTelPhysicsList()
{}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::ConstructParticle()
{
// In this method, static member functions should be called
// for all particles which you want to use.
// This ensures that objects of these particle types will be
// created in the program.
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBaryons();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4MuonPlus::MuonPlusDefinition();
G4MuonMinus::MuonMinusDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::ConstructMesons()
{
// mesons
G4PionPlus::PionPlusDefinition();
G4PionMinus::PionMinusDefinition();
G4PionZero::PionZeroDefinition();
G4Eta::EtaDefinition();
G4EtaPrime::EtaPrimeDefinition();
G4KaonPlus::KaonPlusDefinition();
G4KaonMinus::KaonMinusDefinition();
G4KaonZero::KaonZeroDefinition();
G4AntiKaonZero::AntiKaonZeroDefinition();
G4KaonZeroLong::KaonZeroLongDefinition();
G4KaonZeroShort::KaonZeroShortDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::ConstructBaryons()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
ConstructGeneral();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4MultipleScattering.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MuIonisation.hh"
#include "G4MuBremsstrahlung.hh"
#include "G4MuPairProduction.hh"
#include "G4hIonisation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
if (particleName == "gamma") {
//gamma
pmanager->AddDiscreteProcess(new G4PhotoElectricEffect());
pmanager->AddDiscreteProcess(new G4ComptonScattering());
pmanager->AddDiscreteProcess(new G4GammaConversion());
} else if (particleName == "e-") {
//electron
pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
pmanager->AddProcess(new G4eIonisation(), -1, 2,2);
pmanager->AddProcess(new G4eBremsstrahlung(), -1,-1,3);
} else if (particleName == "e+") {
//positron
pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
pmanager->AddProcess(new G4eIonisation(), -1, 2,2);
pmanager->AddProcess(new G4eBremsstrahlung(), -1,-1,3);
pmanager->AddProcess(new G4eplusAnnihilation(), 0,-1,4);
} else if( particleName == "mu+" ||
particleName == "mu-" ) {
//muon
pmanager->AddProcess(new G4MultipleScattering(),-1, 1,1);
pmanager->AddProcess(new G4MuIonisation(), -1, 2,2);
pmanager->AddProcess(new G4MuBremsstrahlung(), -1,-1,3);
pmanager->AddProcess(new G4MuPairProduction(), -1,-1,4);
} else if ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino")) {
//all others charged particles except geantino
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
pmanager->AddProcess(new G4hIonisation(), -1,2,2);
}
}
}
#include "G4Decay.hh"
void GammaRayTelPhysicsList::ConstructGeneral()
{
// Add Decay Process
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(theDecayProcess);
// set ordering for PostStepDoIt and AtRestDoIt
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::SetCuts()
{
// reactualise cutValues
if (currentDefaultCut != defaultCutValue)
{
if(cutForGamma == currentDefaultCut) cutForGamma = defaultCutValue;
if(cutForElectron == currentDefaultCut) cutForElectron = defaultCutValue;
if(cutForProton == currentDefaultCut) cutForProton = defaultCutValue;
currentDefaultCut = defaultCutValue;
}
if (verboseLevel >0){
G4cout << "GammaRayTelPhysicsList::SetCuts:";
G4cout << "CutLength : " << G4BestUnit(defaultCutValue,"Length") << G4endl;
}
// set cut values for gamma at first and for e- second and next for e+,
// because some processes for e+/e- need cut values for gamma
SetCutValue(cutForGamma, "gamma");
SetCutValue(cutForElectron, "e-");
SetCutValue(cutForElectron, "e+");
// set cut values for proton and anti_proton before all other hadrons
// because some processes for hadrons need cut values for proton/anti_proton
SetCutValue(cutForProton, "proton");
SetCutValue(cutForProton, "anti_proton");
SetCutValueForOthers(defaultCutValue);
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPhysicsList::SetCutForGamma(G4double cut)
{
ResetCuts();
cutForGamma = cut;
}
void GammaRayTelPhysicsList::SetCutForElectron(G4double cut)
{
ResetCuts();
cutForElectron = cut;
}
void GammaRayTelPhysicsList::SetCutForProton(G4double cut)
{
ResetCuts();
cutForProton = cut;
}
G4double GammaRayTelPhysicsList::GetCutForGamma() const
{
return cutForGamma;
}
G4double GammaRayTelPhysicsList::GetCutForElectron() const
{
return cutForElectron;
}
G4double GammaRayTelPhysicsList::GetCutForProton() const
{
return cutForProton;
}
@@ -0,0 +1,210 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPrimaryGeneratorAction.cc,v 1.3 2000/11/24 16:57:00 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPrimaryGeneratorAction ------
// by G.Santin, F.Longo & R.Giannitrapani (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelPrimaryGeneratorAction.hh"
#include "GammaRayTelDetectorConstruction.hh"
#include "GammaRayTelPrimaryGeneratorMessenger.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4ParticleTable.hh"
#include "G4ParticleDefinition.hh"
#include "Randomize.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPrimaryGeneratorAction::GammaRayTelPrimaryGeneratorAction
(GammaRayTelDetectorConstruction* GammaRayTelDC)
:GammaRayTelDetector(GammaRayTelDC),rndmFlag("off"),
nSourceType(0),nSpectrumType(0)
{
G4int n_particle = 1;
particleGun = new G4ParticleGun(n_particle);
//create a messenger for this class
gunMessenger = new GammaRayTelPrimaryGeneratorMessenger(this);
// default particle kinematic
G4ParticleTable* particleTable = G4ParticleTable::GetParticleTable();
G4String particleName;
G4ParticleDefinition* particle
= particleTable->FindParticle(particleName="e-");
particleGun->SetParticleDefinition(particle);
particleGun->SetParticleMomentumDirection(G4ThreeVector(0.,0.,-1.));
particleGun->SetParticleEnergy(30.*MeV);
G4double position = 0.5*(GammaRayTelDetector->GetWorldSizeZ());
particleGun->SetParticlePosition(G4ThreeVector(0.*cm,0.*cm,position));
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPrimaryGeneratorAction::~GammaRayTelPrimaryGeneratorAction()
{
delete particleGun;
delete gunMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
//this function is called at the begining of event
//
G4double z0 = 0.5*(GammaRayTelDetector->GetWorldSizeZ());
G4double x0 = 0.*cm, y0 = 0.*cm;
G4ThreeVector pos0;
G4ThreeVector dir0;
G4ThreeVector vertex0 = G4ThreeVector(x0,y0,z0);
dir0 = G4ThreeVector(0.,0.,-1.);
G4double theta, phi, y, f;
G4double theta0,phi0;
switch(nSourceType) {
case 0:
particleGun->SetParticlePosition(vertex0);
particleGun->SetParticleMomentumDirection(dir0);
break;
case 1:
// GS: Generate random position on the 4PIsphere to create a unif. distrib.
// GS: on the sphere
phi = G4UniformRand() * 2.0 * M_PI;
do {
y = G4UniformRand()*1.0;
theta = G4UniformRand() * M_PI;
f = sin(theta);
} while (y > f);
vertex0 = G4ThreeVector(1.,0.,0.);
vertex0.setMag(dVertexRadius);
vertex0.setTheta(theta);
vertex0.setPhi(phi);
particleGun->SetParticlePosition(vertex0);
dir0 = G4ThreeVector(1.,0.,0.);
do {
phi = G4UniformRand() * 2.0 * M_PI;
do {
y = G4UniformRand()*1.0;
theta = G4UniformRand() * M_PI;
f = sin(theta);
} while (y > f);
dir0.setPhi(phi);
dir0.setTheta(theta);
} while (vertex0.dot(dir0) >= -0.7 * vertex0.mag());
particleGun->SetParticleMomentumDirection((G4ParticleMomentum)dir0);
break;
case 2:
// GS: Generate random position on the upper semi-sphere z>0 to create a unif. distrib.
// GS: on a plane
phi = G4UniformRand() * 2.0 * M_PI;
do {
y = G4UniformRand()*1.0;
theta = G4UniformRand() * M_PI/2;
f = sin(theta) * cos(theta);
} while (y > f);
vertex0 = G4ThreeVector(1.,0.,0.);
G4double xy = GammaRayTelDetector->GetWorldSizeXY();
G4double z = GammaRayTelDetector->GetWorldSizeZ();
if (dVertexRadius > xy*0.5)
{
G4cout << "vertexRadius too big " << G4endl;
G4cout << "vertexRadius setted to " << xy*0.45 << G4endl;
dVertexRadius = xy*0.45;
}
if (dVertexRadius > z*0.5)
{
G4cout << "vertexRadius too high " << G4endl;
G4cout << "vertexRadius setted to " << z*0.45 << G4endl;
dVertexRadius = z*0.45;
}
vertex0.setMag(dVertexRadius);
vertex0.setTheta(theta);
vertex0.setPhi(phi);
// GS: Get the user defined direction for the primaries and
// GS: Rotate the random position according to the user defined direction for the particle
dir0 = particleGun->GetParticleMomentumDirection();
if (dir0.mag() > 0.001)
{
theta0 = dir0.theta();
phi0 = dir0.phi();
}
if (theta0!=0.)
{
G4ThreeVector rotationAxis(1.,0.,0.);
rotationAxis.setPhi(phi0+M_PI/2.);
vertex0.rotate(theta0+M_PI,rotationAxis);
}
particleGun->SetParticlePosition(vertex0);
break;
}
G4double pEnergy;
switch(nSpectrumType) {
case 0:
break;
case 1:
break;
case 2:
do {
y = G4UniformRand()*100000.0;
pEnergy = G4UniformRand() * 10. * GeV;
f = pow(pEnergy * (1/GeV), -4.);
} while (y > f);
particleGun->SetParticleEnergy(pEnergy);
break;
case 3:
break;
}
particleGun->GeneratePrimaryVertex(anEvent);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,106 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelPrimaryGeneratorMessenger.cc,v 1.2 2000/11/15 20:27:41 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelPrimaryGeneratorMessenger ------
// by G.Santin, F.Longo & R.Giannitrapani (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelPrimaryGeneratorMessenger.hh"
#include "GammaRayTelPrimaryGeneratorAction.hh"
#include "G4UIcmdWithAnInteger.hh"
#include "G4UIcmdWithAString.hh"
#include "G4UIcmdWithADoubleAndUnit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPrimaryGeneratorMessenger::GammaRayTelPrimaryGeneratorMessenger
(GammaRayTelPrimaryGeneratorAction* GammaRayTelGun)
:GammaRayTelAction(GammaRayTelGun)
{
RndmCmd = new G4UIcmdWithAString("/gun/random",this);
RndmCmd->SetGuidance("Shoot randomly the incident particle.");
RndmCmd->SetGuidance(" Choice : on(default), off");
RndmCmd->SetParameterName("choice",true);
RndmCmd->SetDefaultValue("on");
RndmCmd->SetCandidates("on off");
RndmCmd->AvailableForStates(PreInit,Idle);
SourceTypeCmd = new G4UIcmdWithAnInteger("/gun/sourceType",this);
SourceTypeCmd->SetGuidance("Select the type of incident flux.");
SourceTypeCmd->SetGuidance(" Choice : 0(default), 1(isotropic), 2(wide parallel beam)");
SourceTypeCmd->SetParameterName("choice",true);
SourceTypeCmd->SetDefaultValue((G4int)0);
SourceTypeCmd->AvailableForStates(PreInit,Idle);
VertexRadiusCmd = new G4UIcmdWithADoubleAndUnit("/gun/vertexRadius",this);
VertexRadiusCmd->SetGuidance("Radius (and unit) of sphere for vertices of incident flux.");
VertexRadiusCmd->SetParameterName("choice",true);
VertexRadiusCmd->SetDefaultValue((G4double)1.*cm);
VertexRadiusCmd->AvailableForStates(PreInit,Idle);
SpectrumTypeCmd = new G4UIcmdWithAnInteger("/gun/spectrumType",this);
SpectrumTypeCmd->SetGuidance("Select the type of incident spectrum.");
SpectrumTypeCmd->SetGuidance(" Choice : 0(default), 1(), 2(E^{-gamma}), 3()");
SpectrumTypeCmd->SetParameterName("choice",true);
SpectrumTypeCmd->SetDefaultValue((G4int)0);
SpectrumTypeCmd->AvailableForStates(PreInit,Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelPrimaryGeneratorMessenger::~GammaRayTelPrimaryGeneratorMessenger()
{
delete RndmCmd;
delete SourceTypeCmd;
delete VertexRadiusCmd;
delete SpectrumTypeCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelPrimaryGeneratorMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if( command == RndmCmd )
{ GammaRayTelAction->SetRndmFlag(newValue);}
if( command == SourceTypeCmd )
{ GammaRayTelAction->SetSourceType(SourceTypeCmd->GetNewIntValue(newValue));}
if( command == VertexRadiusCmd )
{ GammaRayTelAction->SetVertexRadius(VertexRadiusCmd->GetNewDoubleValue(newValue));}
if( command == SpectrumTypeCmd )
{ GammaRayTelAction->SetSpectrumType(SpectrumTypeCmd->GetNewIntValue(newValue));}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,103 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelRunAction.cc,v 1.3 2000/12/06 16:53:14 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelRunAction ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "GammaRayTelRunAction.hh"
#include <stdlib.h>
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
extern ofstream outFile;
#ifdef G4ANALYSIS_USE
GammaRayTelRunAction::GammaRayTelRunAction(GammaRayTelAnalysisManager* aMgr)
:analysisManager(aMgr)
{
}
#else
GammaRayTelRunAction::GammaRayTelRunAction()
{
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelRunAction::~GammaRayTelRunAction()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelRunAction::BeginOfRunAction(const G4Run* aRun)
{
char name[15];
// Open the file for the tracks of this run
sprintf(name,"Tracks_%d.dat", aRun->GetRunID());
outFile.open(name);
// Prepare the visualization
if (G4VVisManager::GetConcreteInstance())
{
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/vis/scene/notifyHandlers");
}
// If analysis is used reset the histograms
#ifdef G4ANALYSIS_USE
analysisManager->BeginOfRun();
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelRunAction::EndOfRunAction(const G4Run* aRun)
{
// Run ended, update the visualization
if (G4VVisManager::GetConcreteInstance()) {
G4UImanager::GetUIpointer()->ApplyCommand("/vis/viewer/update");
}
// Close the file with the hits information
outFile.close();
// If analysis is used, print out the histograms
#ifdef G4ANALYSIS_USE
analysisManager->EndOfRun(aRun->GetRunID());
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
@@ -0,0 +1,139 @@
// This code implementation is the intellectual property of
// the GEANT4 collaboration.
//
// By copying, distributing or modifying the Program (or any work
// based on the Program) you indicate your acceptance of this statement,
// and all its terms.
//
// $Id: GammaRayTelVisManager.cc,v 1.2 2000/11/15 20:27:42 flongo Exp $
// GEANT4 tag $Name: geant4-03-00 $
// ------------------------------------------------------------
// GEANT 4 class implementation file
// CERN Geneva Switzerland
//
// For information related to this code contact:
// CERN, IT Division, ASD group
//
// ------------ GammaRayTelVisManager ------
// by R.Giannitrapani, F.Longo & G.Santin (13 nov 2000)
//
// ************************************************************
#ifdef G4VIS_USE
#include "GammaRayTelVisManager.hh"
// Supported drivers...
#ifdef G4VIS_USE_DAWN
#include "G4FukuiRenderer.hh"
#endif
#ifdef G4VIS_USE_DAWNFILE
#include "G4DAWNFILE.hh"
#endif
#ifdef G4VIS_USE_OPACS
#include "G4Wo.hh"
#include "G4Xo.hh"
#endif
#ifdef G4VIS_USE_OPENGLX
#include "G4OpenGLImmediateX.hh"
#include "G4OpenGLStoredX.hh"
#endif
#ifdef G4VIS_USE_OPENGLWIN32
#include "G4OpenGLImmediateWin32.hh"
#include "G4OpenGLStoredWin32.hh"
#endif
#ifdef G4VIS_USE_OPENGLXM
#include "G4OpenGLImmediateXm.hh"
#include "G4OpenGLStoredXm.hh"
#endif
#ifdef G4VIS_USE_OIX
#include "G4OpenInventorX.hh"
#endif
#ifdef G4VIS_USE_OIWIN32
#include "G4OpenInventorWin32.hh"
#endif
#ifdef G4VIS_USE_VRML
#include "G4VRML1.hh"
#include "G4VRML2.hh"
#endif
#ifdef G4VIS_USE_VRMLFILE
#include "G4VRML1File.hh"
#include "G4VRML2File.hh"
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
GammaRayTelVisManager::GammaRayTelVisManager () {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void GammaRayTelVisManager::RegisterGraphicsSystems () {
#ifdef G4VIS_USE_DAWN
RegisterGraphicsSystem (new G4FukuiRenderer);
#endif
#ifdef G4VIS_USE_DAWNFILE
RegisterGraphicsSystem (new G4DAWNFILE);
#endif
#ifdef G4VIS_USE_OPACS
RegisterGraphicsSystem (new G4Wo);
RegisterGraphicsSystem (new G4Xo);
#endif
#ifdef G4VIS_USE_OPENGLX
RegisterGraphicsSystem (new G4OpenGLImmediateX);
RegisterGraphicsSystem (new G4OpenGLStoredX);
#endif
#ifdef G4VIS_USE_OPENGLWIN32
RegisterGraphicsSystem (new G4OpenGLImmediateWin32);
RegisterGraphicsSystem (new G4OpenGLStoredWin32);
#endif
#ifdef G4VIS_USE_OPENGLXM
RegisterGraphicsSystem (new G4OpenGLImmediateXm);
RegisterGraphicsSystem (new G4OpenGLStoredXm);
#endif
#ifdef G4VIS_USE_OIX
RegisterGraphicsSystem (new G4OpenInventorX);
#endif
#ifdef G4VIS_USE_OIWIN32
RegisterGraphicsSystem (new G4OpenInventorWin32);
#endif
#ifdef G4VIS_USE_VRML
RegisterGraphicsSystem (new G4VRML1);
RegisterGraphicsSystem (new G4VRML2);
#endif
#ifdef G4VIS_USE_VRMLFILE
RegisterGraphicsSystem (new G4VRML1File);
RegisterGraphicsSystem (new G4VRML2File);
#endif
if (fVerbose > 0) {
G4cout <<
"\nYou have successfully chosen to use the following graphics systems."
<< G4endl;
PrintAvailableGraphicsSystems ();
}
}
#endif
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....