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,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....