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
+11 -1
View File
@@ -1,4 +1,4 @@
$Id: History,v 1.55 2000/06/17 12:56:56 stesting Exp $
$Id: History,v 1.58 2000/11/18 10:56:11 stesting Exp $
-------------------------------------------------------------------
=========================================================
@@ -17,6 +17,16 @@ committal in the CVS repository !
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
18th Nov 2000 Steve O'Neale (examples-V02-00-05)
- Updated test 102,104,508 outputs
9th August 2000 Steve O'Neale (examples-V02-00-00)
- Updated all (except large_N) .out files ready for public patch
geant4-02-00
24th June 2000 John Allison (examples-V01-01-08)
- Updated .out files where necessary for stand-V01-01-05 and utils-V01-01-03.
17th June 2000 John Allison (examples-V01-01-07)
- Updated all .out files for geant4-01-01-ref-06.
+118
View File
@@ -0,0 +1,118 @@
// 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: Brachy.cc,v 1.4 2000/12/10 08:56:15 chauvie Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
// --------------------------------------------------------------
// GEANT 4 - Brachytherapy example
// --------------------------------------------------------------
//
// Code developed by:
// S. Agostinelli, F. Foppiano, S. Garelli and M. Tropeano
//
// Brachytherapy simulates the dose deposition in a cubic (30*cm)
// water phantom for a Ir-192 MicroSelectron High Dose Rate
// brachytherapy source.
//
// Simplified gamma generation is used.
// Source axis is oriented along Z axis.
// Voxel data on the X-Z plane is output to ASCII file
// "Brachy.out".
//
// For information related to this code contact the developers.
//
// --------------------------------------------------------------
#include "BrachyEventAction.hh"
#include "BrachyDetectorConstruction.hh"
#include "BrachyPhysicsList.hh"
#include "BrachyPrimaryGeneratorAction.hh"
#include "BrachyWaterBoxSD.hh"
#include "Randomize.hh"
#include "G4RunManager.hh"
#include "G4SDManager.hh"
#include "G4UImanager.hh"
int main()
{
// Number of generated photons
G4int NumberOfEvents = 10;
// Define number of voxels in X-Z plane
G4int NumVoxelX = 101;
G4int NumVoxelZ = 101;
// Construct the default run manager
G4RunManager* pRunManager = new G4RunManager;
// Set mandatory initialization classes
G4String SDName = "WaterBox";
BrachyDetectorConstruction *pDetectorConstruction;
pRunManager->SetUserInitialization(pDetectorConstruction = new BrachyDetectorConstruction(SDName,NumVoxelX,NumVoxelZ));
pRunManager->SetUserInitialization(new BrachyPhysicsList);
// Set mandatory user action class
pRunManager->SetUserAction(new BrachyPrimaryGeneratorAction);
// Initialize G4 kernel
pRunManager->Initialize();
// Alloc and initialize voxel matrix
G4float* pVoxel = new G4float[NumVoxelX*NumVoxelZ];
for(G4int j=0;j<NumVoxelX*NumVoxelZ;j++)
pVoxel[j] = 0.0F;
BrachyEventAction *pEventAction;
pRunManager->SetUserAction(pEventAction = new BrachyEventAction(pVoxel,NumVoxelX,NumVoxelZ));
// Get the pointer to the UI manager and set verbosities
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/run/verbose 0");
UI->ApplyCommand("/event/verbose 0");
UI->ApplyCommand("/tracking/verbose 0");
pRunManager->BeamOn(NumberOfEvents);
if(pVoxel)
{
G4std::ofstream ofs;
// Output voxel data to text file
// Format = x coord [mm] <tab> z coord [mm] <tab> edep [MeV] <eol>
ofs.open("Brachy.out");
{
G4double VoxelWidth_X = pDetectorConstruction->m_BoxDimX/NumVoxelX;
G4double VoxelWidth_Z = pDetectorConstruction->m_BoxDimZ/NumVoxelZ;
G4double x,z;
for(G4int k=0;k<NumVoxelZ;k++)
{
z = (-NumVoxelZ+1+2*k)*VoxelWidth_Z/2;
for(G4int i=0;i<NumVoxelX;i++)
{
G4int j = i+k*NumVoxelX;
x = (-NumVoxelX+1+2*i)*VoxelWidth_X/2;
// Do not consider near voxels
if(fabs(x) > 3*mm || fabs(z) > 6*mm)
ofs << x << '\t' << z << '\t' << pVoxel[j] << G4endl;
}
}
ofs.close();
}
}
delete[] pVoxel;
// Job termination
delete pRunManager;
return 0;
}
@@ -0,0 +1,19 @@
# --------------------------------------------------------------
# $Id: GNUmakefile,v 1.2 2000/12/10 08:38:46 chauvie Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := Brachy
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
+22
View File
@@ -0,0 +1,22 @@
-------------------------------------------------------------------
$Id: History,v 1.3 2000/12/10 08:42:44 chauvie Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - Brachytherapy example
=========================================================
Category History file
---------------------
09.11.2000 - SA, tag brachy-V02-00-00
(dvnote) First submission of Brachytherapy advanced example.
15.11.2000 - SA, tag brachy-V02-00-01
(minrev) Data fully compliant to Geant4 types.
(newfea) LowEnergy option available (see BRACHY_OPT_USELOWENERGY in BrachyPhysicsList.cc).
10.12.2000 - Stephane Chauvie
(minrev) DOS -> Unix text conversion.
(newfea) Added Low Energy Electromagnetic physics. Removed switch to standard.
+38
View File
@@ -0,0 +1,38 @@
-------------------------------------------------------------------
$Id: README,v 1.2 2000/12/10 08:39:39 chauvie Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - Brachytherapy example
=========================================================
README
---------------------
0. Introduction.
Brachytherapy example simulates energy deposition on a voxel grid
for a MicroSelectron Ir-192 HDR brachytherapy source.
1. Technical description
1.0. MicroSelectron HDR Ir-192 source is constructed in the
brachyDetectorConstruction class. The source is composed by
an iridium core encapsulated in a stainless steel capsule
(body + tip). The source is put into a 30*cm water box.
1.1. The water box is made sensitive detector. A longitudinal slice
of it is associated to a planar read out geometry. At every hit
energy deposition is read and stored into a voxel matrix.
1.2. Voxel matrix is output to an ASCII file for further processing
(e.g. anysotropy and isodose calculations).
2. Make
A standard Geant4 example GNUmakefile is provided.
2. Usage
Simply run "Brachy" executable. The ASCII "Brachy.out" file is
produced.
@@ -0,0 +1,36 @@
// ****************************************
// * *
// * BrachyDetectorConstruction.hh *
// * *
// ****************************************
#ifndef BrachyDetectorConstruction_H
#define BrachyDetectorConstruction_H 1
#include "G4VUserDetectorConstruction.hh"
class G4VPhysicalVolume;
class BrachyWaterBoxSD;
class BrachyDetectorConstruction : public G4VUserDetectorConstruction
{
public:
BrachyDetectorConstruction(G4String &SDName,G4int NumVoxelX,G4int NumVoxelZ);
~BrachyDetectorConstruction();
public:
const G4double m_BoxDimX;
const G4double m_BoxDimY;
const G4double m_BoxDimZ;
const G4int m_NumVoxelX;
const G4int m_NumVoxelZ;
G4String m_SDName;
public:
G4VPhysicalVolume* Construct();
};
#endif
@@ -0,0 +1,31 @@
// ********************************
// * *
// * BrachyDummySD.hh *
// * *
// ********************************
// Dummy sensitive used only to flag sensitivity in cells of RO geometry.
#ifndef BrachyDummySD_h
#define BrachyDummySD_h 1
#include "G4VSensitiveDetector.hh"
class G4Step;
class BrachyDummySD : public G4VSensitiveDetector
{
public:
BrachyDummySD();
~BrachyDummySD() {};
void Initialize(G4HCofThisEvent*HCE) {};
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist) {return false;}
void EndOfEvent(G4HCofThisEvent*HCE) {};
void clear() {};
void DrawAll() {};
void PrintAll() {};
};
BrachyDummySD::BrachyDummySD() : G4VSensitiveDetector("dummySD")
{}
#endif
@@ -0,0 +1,35 @@
// **********************************
// * *
// * BrachyEventAction.hh *
// * *
// **********************************
#ifndef BrachyEventAction_h
#define BrachyEventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class BrachyEventAction : public G4UserEventAction
{
public:
BrachyEventAction(G4float *pVoxel,G4int NumVoxelX,G4int NumVoxelZ);
~BrachyEventAction();
public:
void BeginOfEventAction(const G4Event*);
void EndOfEventAction(const G4Event*);
public:
const G4int m_NumVoxelX;
const G4int m_NumVoxelZ;
G4float *m_pVoxel;
private:
G4int m_HitsCollectionID;
};
#endif
@@ -0,0 +1,70 @@
// **********************************
// * *
// * BrachyPhysicsList.hh *
// * *
// **********************************
#ifndef BrachyPhysicsList_h
#define BrachyPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4LowEnergyIonisation;
class G4LowEnergyPhotoElectric;
class G4LowEnergyBremsstrahlung;
class BrachyPhysicsList: public G4VUserPhysicsList
{
public:
BrachyPhysicsList();
~BrachyPhysicsList();
protected:
// Construct particle and physics
void ConstructParticle();
void ConstructProcess();
void SetCuts();
public:
// Set Cuts
void SetGammaCut(G4double);
void SetElectronCut(G4double);
void SetPositronCut(G4double);
void SetGammaLowLimit(G4double);
void SetElectronLowLimit(G4double);
void SetGELowLimit(G4double);
void SetLowEnSecPhotCut(G4double);
void SetLowEnSecElecCut(G4double);
private:
G4double cutForGamma;
G4double cutForElectron;
G4double cutForPositron;
protected:
// these methods Construct particles
void ConstructBosons();
void ConstructLeptons();
protected:
// these methods Construct physics processes and register them
void ConstructGeneral();
void ConstructEM();
private:
G4LowEnergyIonisation* loweIon;
G4LowEnergyPhotoElectric* lowePhot;
G4LowEnergyBremsstrahlung* loweBrem;
};
#endif
@@ -0,0 +1,33 @@
// ********************************************
// * *
// * BrachyPrimaryGeneratorAction.hh *
// * *
// ********************************************
#ifndef BrachyPrimaryGeneratorAction_h
#define BrachyPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "G4RadioactiveDecay.hh"
class G4ParticleGun;
class G4Event;
class BrachyPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
BrachyPrimaryGeneratorAction();
~BrachyPrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event* anEvent);
private:
G4ParticleGun* m_pParticleGun;
G4RadioactiveDecay *m_pRadioactiveDecay;
};
#endif
@@ -0,0 +1,85 @@
// ********************************
// * *
// * BrachyWaterBoxHit.hh *
// * *
// ********************************
#ifndef BrachyWaterBoxHit_h
#define BrachyWaterBoxHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
#include "G4ThreeVector.hh"
#include "G4LogicalVolume.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
class BrachyWaterBoxHit : public G4VHit
{
public:
BrachyWaterBoxHit(G4LogicalVolume* logVol,G4int XID,G4int ZID);
~BrachyWaterBoxHit();
BrachyWaterBoxHit(const BrachyWaterBoxHit &right);
const BrachyWaterBoxHit& operator=(const BrachyWaterBoxHit &right);
int operator==(const BrachyWaterBoxHit &right) const;
inline void *operator new(size_t);
inline void operator delete(void *aHit);
void Draw();
void Print();
private:
G4ThreeVector m_Pos;
G4RotationMatrix m_Rot;
const G4LogicalVolume* m_pLogV;
G4double m_Edep;
G4int m_XID;
G4int m_ZID;
public:
inline void SetCellID(G4int XID,G4int ZID)
{m_XID = XID;m_ZID = ZID;}
inline G4int GetXID()
{return m_XID;}
inline G4int GetZID()
{return m_ZID;}
inline void SetEdep(G4double edep)
{m_Edep = edep;}
inline void AddEdep(G4double edep)
{m_Edep += edep;}
inline G4double GetEdep()
{return m_Edep;}
inline void SetPos(G4ThreeVector xyz)
{m_Pos = xyz;}
inline G4ThreeVector GetPos()
{return m_Pos;}
inline void SetRot(G4RotationMatrix rmat)
{m_Rot = rmat;}
inline G4RotationMatrix GetRot()
{return m_Rot;}
inline const G4LogicalVolume * GetLogV()
{return m_pLogV;}
};
typedef G4THitsCollection<BrachyWaterBoxHit> BrachyWaterBoxHitsCollection;
extern G4Allocator<BrachyWaterBoxHit> BrachyWaterBoxHitAllocator;
inline void* BrachyWaterBoxHit::operator new(size_t)
{
void *aHit;
aHit = (void *) BrachyWaterBoxHitAllocator.MallocSingle();
return aHit;
}
inline void BrachyWaterBoxHit::operator delete(void *aHit)
{
BrachyWaterBoxHitAllocator.FreeSingle((BrachyWaterBoxHit*) aHit);
}
#endif
@@ -0,0 +1,29 @@
// ************************************
// * *
// * BrachyWaterBoxROGeometry.hh *
// * *
// ************************************
#ifndef BrachyWaterBoxROGeometry_h
#define BrachyWaterBoxROGeometry_h 1
#include "G4VReadOutGeometry.hh"
class BrachyWaterBoxROGeometry : public G4VReadOutGeometry
{
public:
BrachyWaterBoxROGeometry(G4String aString,G4double DetDimX,G4double DetDimZ,G4int NumVoxelX,G4int NumVoxelZ);
~BrachyWaterBoxROGeometry();
public:
const G4double m_DetDimX;
const G4double m_DetDimZ;
const G4int m_NumVoxelX;
const G4int m_NumVoxelZ;
private:
G4VPhysicalVolume* Build();
};
#endif
@@ -0,0 +1,37 @@
// ********************************
// * *
// * BrachyWaterBoxSD.hh *
// * *
// ********************************
#ifndef BrachyWaterBoxSD_h
#define BrachyWaterBoxSD_h 1
#include "G4VSensitiveDetector.hh"
#include "BrachyWaterBoxHit.hh"
class G4Step;
class G4HCofThisEvent;
class G4TouchableHistory;
class BrachyWaterBoxSD : public G4VSensitiveDetector
{
public:
BrachyWaterBoxSD(G4String name, G4int NumVoxelX, G4int NumVoxelZ);
~BrachyWaterBoxSD();
void Initialize(G4HCofThisEvent*HCE);
G4bool ProcessHits(G4Step*aStep,G4TouchableHistory*ROhist);
void EndOfEvent(G4HCofThisEvent*HCE);
void clear();
void DrawAll();
void PrintAll();
private:
BrachyWaterBoxHitsCollection *m_pWaterBoxHitsCollection;
const G4int m_NumVoxelX;
const G4int m_NumVoxelZ;
G4int *m_pVoxelID;
};
#endif
@@ -0,0 +1,183 @@
// ****************************************
// * *
// * BrachyDetectorConstruction.cc *
// * *
// ****************************************
#include "BrachyWaterBoxROGeometry.hh"
#include "BrachyWaterBoxSD.hh"
#include "BrachyDetectorConstruction.hh"
#include "G4CSGSolid.hh"
#include "G4Sphere.hh"
#include "G4MaterialPropertyVector.hh"
#include "G4SDManager.hh"
#include "G4SubtractionSolid.hh"
#include "G4RunManager.hh"
#include "G4MaterialPropertiesTable.hh"
#include "G4Material.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "globals.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4PVParameterised.hh"
#include "G4Transform3D.hh"
#include "G4RotationMatrix.hh"
#include "G4FieldManager.hh"
#include "G4TransportationManager.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
//....
BrachyDetectorConstruction::BrachyDetectorConstruction(G4String &SDName,G4int NumVoxelX,G4int NumVoxelZ) :
m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ),m_BoxDimX(30*cm),m_BoxDimY(30*cm),m_BoxDimZ(30*cm)
{
m_SDName = SDName;
}
//....
BrachyDetectorConstruction::~BrachyDetectorConstruction()
{
}
//....
G4VPhysicalVolume* BrachyDetectorConstruction::Construct()
{
// Define required materials
G4double A; // atomic mass
G4double Z; // atomic number
G4double d; // density
// General elements
A = 1.01*g/mole;
Z = 1;
G4Element* elH = new G4Element ("Hydrogen","H",Z,A);
A = 14.01*g/mole;
Z = 7;
G4Element* elN = new G4Element("Nitrogen","N",Z,A);
A = 16.00*g/mole;
Z = 8;
G4Element* elO = new G4Element("Oxygen","O",Z,A);
// Elements for source capsule and cable
A = 54.94*g/mole;
Z = 25;
G4Element* elMn = new G4Element("Manganese","Mn",Z,A);
A = 28.09*g/mole;
Z = 14;
G4Element* elSi = new G4Element("Silicon","Si",Z,A);
A = 52.00*g/mole;
Z = 24;
G4Element* elCr = new G4Element("Chromium","Cr",Z,A);
A = 58.70*g/mole;
Z = 28;
G4Element* elNi = new G4Element("Nickel","Ni",Z,A);
A = 55.85*g/mole;
Z = 26;
G4Element* elFe = new G4Element("Iron","Fe",Z,A);
// Lead material
A = 207.19*g/mole;
Z = 82;
d = 11.35*g/cm3;
G4Material* matPb = new G4Material("Lead",Z,A,d);
// Air material
d = 1.290*mg/cm3;
G4Material* matAir = new G4Material("Air",d,2);
matAir->AddElement(elN,0.7);
matAir->AddElement(elO,0.3);
// Water
d = 1.000*g/cm3;
G4Material* matH2O = new G4Material("Water",d,2);
matH2O->AddElement(elH,2);
matH2O->AddElement(elO,1);
// Iridium (Medical Physics, Vol 25, No 10, Oct 1998)
d = 22.42*g/cm3;
A = 191.96260*g/mole ;
Z = 77;
G4Material* matIr192 = new G4Material("Iridium",Z,A,d);
// Stainless steel (Medical Physics, Vol 25, No 10, Oct 1998)
d = 8.02*g/cm3 ;
G4Material* matSteel = new G4Material("Stainless steel",d,5);
matSteel->AddElement(elMn, 0.02);
matSteel->AddElement(elSi, 0.01);
matSteel->AddElement(elCr, 0.19);
matSteel->AddElement(elNi, 0.10);
matSteel->AddElement(elFe, 0.68);
// Volumes
// EXPERIMENTAL HALL (our world volume)
G4double ExpHall_x = 4.0*m;
G4double ExpHall_y = 4.0*m;
G4double ExpHall_z = 4.0*m;
G4Box* ExpHall = new G4Box("ExpHall",ExpHall_x,ExpHall_y,ExpHall_z);
G4LogicalVolume* ExpHallLog = new G4LogicalVolume(ExpHall,matAir,"ExpHallLog",0,0,0);
G4VPhysicalVolume* ExpHallPhys = new G4PVPlacement(0,G4ThreeVector(),"ExpHallPhys",ExpHallLog,0,false,0);
// Water Box
G4Box* WaterBox = new G4Box("WaterBox",m_BoxDimX/2,m_BoxDimY/2,m_BoxDimZ/2);
G4LogicalVolume* WaterBoxLog = new G4LogicalVolume(WaterBox,matH2O,"WaterBoxLog",0,0,0);
G4VPhysicalVolume* WaterBoxPhys = new G4PVPlacement(0,G4ThreeVector(),WaterBoxLog,"WaterBoxPhys",ExpHallLog,false,0);
// Capsule main body
G4Tubs* Capsule = new G4Tubs("Capsule",0,0.55*mm,3.725*mm,0.*deg,360.*deg);
G4LogicalVolume* CapsuleLog = new G4LogicalVolume(Capsule,matSteel,"CapsuleLog");
G4VPhysicalVolume* CapsulePhys = new G4PVPlacement(0,G4ThreeVector(0,0,-1.975),CapsuleLog,"CapsulePhys",WaterBoxLog,false,0);
// Capsule tip
G4Sphere* CapsuleTip = new G4Sphere("CapsuleTip",0.*mm,0.55*mm,0.*deg,360.*deg,0.*deg,90.*deg);
G4LogicalVolume* CapsuleTipLog = new G4LogicalVolume(CapsuleTip,matSteel,"CapsuleTipLog");
G4VPhysicalVolume* CapsuleTipPhys = new G4PVPlacement(0,G4ThreeVector(0.,0.,1.75*mm),CapsuleTipLog,"CapsuleTipPhys",WaterBoxLog,false,0);
// Iridium core
G4Tubs* IridiumCore = new G4Tubs("IrCore",0,0.30*mm,1.75*mm,0.*deg,360.*deg);
G4LogicalVolume* IridiumCoreLog = new G4LogicalVolume(IridiumCore,matIr192,"IridiumCoreLog");
G4VPhysicalVolume* IridiumCorePhys = new G4PVPlacement(0,G4ThreeVector(),IridiumCoreLog,"IridiumCorePhys",CapsuleLog,false,0);
// Sensitive Detector and ReadOut geometry definition
G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
BrachyWaterBoxSD* pWaterBoxSD = new BrachyWaterBoxSD(m_SDName,m_NumVoxelX,m_NumVoxelZ);
if(pWaterBoxSD)
{
G4String ROGeometryName = "WaterBoxROGeometry";
BrachyWaterBoxROGeometry* pWaterBoxROGeometry = new BrachyWaterBoxROGeometry(ROGeometryName,m_BoxDimX,m_BoxDimZ,m_NumVoxelX,m_NumVoxelZ);
pWaterBoxROGeometry->BuildROGeometry();
pWaterBoxSD->SetROgeometry(pWaterBoxROGeometry);
pSDManager->AddNewDetector(pWaterBoxSD);
WaterBoxLog->SetSensitiveDetector(pWaterBoxSD);
CapsuleLog->SetSensitiveDetector(pWaterBoxSD);
CapsuleTipLog->SetSensitiveDetector(pWaterBoxSD);
IridiumCoreLog->SetSensitiveDetector(pWaterBoxSD);
}
return ExpHallPhys;
}
@@ -0,0 +1,69 @@
// *******************************
// * *
// * BrachyEventAction.cc *
// * *
// *******************************
#include "BrachyEventAction.hh"
#include "BrachyWaterBoxHit.hh"
#include "BrachyWaterBoxSD.hh"
#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"
//....
BrachyEventAction::BrachyEventAction(G4float *pVoxel,G4int NumVoxelX,G4int NumVoxelZ) :
m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ)
{
m_HitsCollectionID = -1;
m_pVoxel = pVoxel;
}
//....
BrachyEventAction::~BrachyEventAction()
{
}
//....
void BrachyEventAction::BeginOfEventAction(const G4Event*)
{
G4SDManager* pSDManager = G4SDManager::GetSDMpointer();
if(m_HitsCollectionID == -1)
m_HitsCollectionID = pSDManager->GetCollectionID("WaterBoxHitsCollection");
}
//....
void BrachyEventAction::EndOfEventAction(const G4Event* evt)
{
if(m_HitsCollectionID < 0)
return;
G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
BrachyWaterBoxHitsCollection* CHC = NULL;
if(HCE)
CHC = (BrachyWaterBoxHitsCollection*)(HCE->GetHC(m_HitsCollectionID));
if(CHC)
{
if(m_pVoxel)
{
// Fill voxel matrix with energy deposit data
G4int HitCount = CHC->entries();
for (G4int h=0; h<HitCount; h++)
m_pVoxel[((*CHC)[h])->GetZID() + ((*CHC)[h])->GetXID()*m_NumVoxelX] += (*CHC)[h]->GetEdep();
}
}
}
@@ -0,0 +1,236 @@
// **********************************
// * *
// * BrachyPhysicsList.cc *
// * *
// **********************************
#include "BrachyPhysicsList.hh"
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4Material.hh"
#include "G4UnitsTable.hh"
#include "G4ios.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
BrachyPhysicsList::BrachyPhysicsList(): G4VUserPhysicsList()
{
defaultCutValue = 1*mm;
cutForGamma = defaultCutValue;
cutForElectron = defaultCutValue;
cutForPositron = defaultCutValue;
SetVerboseLevel(1);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
BrachyPhysicsList::~BrachyPhysicsList()
{
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::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();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::ConstructBosons()
{
// gamma
G4Gamma::GammaDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::ConstructProcess()
{
AddTransportation();
ConstructEM();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#include "G4MultipleScattering.hh"
// gamma
#include "G4LowEnergyRayleigh.hh"
#include "G4LowEnergyPhotoElectric.hh"
#include "G4LowEnergyCompton.hh"
#include "G4LowEnergyGammaConversion.hh"
// e-
#include "G4LowEnergyIonisation.hh"
#include "G4LowEnergyBremsstrahlung.hh"
// e+
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::ConstructEM()
{
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
G4String particleName = particle->GetParticleName();
//processes
lowePhot = new G4LowEnergyPhotoElectric("LowEnPhotoElec");
loweIon = new G4LowEnergyIonisation("LowEnergyIoni");
loweBrem = new G4LowEnergyBremsstrahlung("LowEnBrem");
if (particleName == "gamma") {
//gamma
pmanager->AddDiscreteProcess(new G4LowEnergyRayleigh);
pmanager->AddDiscreteProcess(lowePhot);
pmanager->AddDiscreteProcess(new G4LowEnergyCompton);
pmanager->AddDiscreteProcess(new G4LowEnergyGammaConversion);
} else if (particleName == "e-") {
//electron
pmanager->AddProcess(new G4MultipleScattering, -1, 1,1);
pmanager->AddProcess(loweIon, -1, 2,2);
pmanager->AddProcess(loweBrem, -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);
}
}
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetCuts()
{
if (verboseLevel >0){
G4cout << "BrachyPhysicsList::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(cutForPositron, "e+");
SetCutValueForOthers(defaultCutValue);
if (verboseLevel>0) DumpCutValuesTable();
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetGammaLowLimit(G4double lowcut)
{
if (verboseLevel >0){
G4cout << "BrachyPhysicsList::SetCuts:";
G4cout << "Gamma cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
}
G4Gamma::SetEnergyRange(lowcut,1e5);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetElectronLowLimit(G4double lowcut)
{
if (verboseLevel >0){
G4cout << "BrachyPhysicsList::SetCuts:";
G4cout << "Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
}
G4Electron::SetEnergyRange(lowcut,1e5);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetGELowLimit(G4double lowcut)
{
if (verboseLevel >0){
G4cout << "BrachyPhysicsList::SetCuts:";
G4cout << "Gamma and Electron cut in energy: " << lowcut*MeV << " (MeV)" << G4endl;
}
G4Gamma::SetEnergyRange(lowcut,1e5);
G4Electron::SetEnergyRange(lowcut,1e5);
G4Positron::SetEnergyRange(lowcut,1e5);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetGammaCut(G4double val)
{
ResetCuts();
cutForGamma = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetElectronCut(G4double val)
{
// ResetCuts();
cutForElectron = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetPositronCut(G4double val)
{
// ResetCuts();
cutForPositron = val;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetLowEnSecPhotCut(G4double cut){
G4cout<<"Low energy secondary photons cut is now set to: "<<cut*MeV<<" (MeV)"<<G4endl;
G4cout<<"for processes LowEnergyPhotoElectric, LowEnergyBremsstrahlung, LowEnergyIonisation"<<G4endl;
lowePhot->SetCutForLowEnSecPhotons(cut);
loweIon->SetCutForLowEnSecPhotons(cut);
loweBrem->SetCutForLowEnSecPhotons(cut);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void BrachyPhysicsList::SetLowEnSecElecCut(G4double cut){
G4cout<<"Low energy secondary electrons cut is now set to: "<<cut*MeV<<" (MeV)"<<G4endl;
G4cout<<"for processes LowEnergyIonisation"<<G4endl;
loweIon->SetCutForLowEnSecElectrons(cut);
}
@@ -0,0 +1,80 @@
// ********************************************
// * *
// * BrachyPrimaryGeneratorAction.cc *
// * *
// ********************************************
#include "BrachyPrimaryGeneratorAction.hh"
#include "G4ParticleTable.hh"
#include "Randomize.hh"
#include "G4Event.hh"
#include "G4ParticleGun.hh"
#include "G4IonTable.hh"
#include "G4RadioactiveDecay.hh"
#include "G4UImanager.hh"
#include "globals.hh"
#include <math.h>
//....
BrachyPrimaryGeneratorAction::BrachyPrimaryGeneratorAction()
{
// Generate a gamma particle with energy = Ir-192 mean energy
G4int NumParticles = 1;
G4double Energy = 0.356*MeV;
m_pParticleGun = new G4ParticleGun(NumParticles);
if(m_pParticleGun)
m_pParticleGun->SetParticleEnergy(Energy);
}
//....
BrachyPrimaryGeneratorAction::~BrachyPrimaryGeneratorAction()
{
if(m_pParticleGun)
delete m_pParticleGun;
}
//....
void BrachyPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
G4ParticleTable* pParticleTable = G4ParticleTable::GetParticleTable();
G4String ParticleName = "gamma";
G4ParticleDefinition* pParticle = pParticleTable->FindParticle(ParticleName);
m_pParticleGun->SetParticleDefinition(pParticle);
// Random generation of gamma source point inside the Iridium core cylinder(R=0.3*mm,h=3.5*mm)
G4double radius = 0.3*mm;
G4double x,y,z;
do{
x = (G4UniformRand()-0.5)*radius/0.5;
y = (G4UniformRand()-0.5)*radius/0.5;
}while(x*x+y*y > radius*radius);
z = (G4UniformRand()-0.5)*1.75*mm/0.5;
G4ThreeVector position(x,y,z);
m_pParticleGun->SetParticlePosition(position);
// Random generation of the impulse direction
G4double a,b,c;
G4double n;
do{
a = (G4UniformRand()-0.5)/0.5;
b = (G4UniformRand()-0.5)/0.5;
c = (G4UniformRand()-0.5)/0.5;
n = a*a+b*b+c*c;
}while(n > 1 || n == 0.0);
n = sqrt(n);
a /= n;
b /= n;
c /= n;
G4ThreeVector direction(a,b,c);
m_pParticleGun->SetParticleMomentumDirection(direction);
m_pParticleGun->GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,72 @@
// ********************************
// * *
// * BrachyWaterBoxHit.cc *
// * *
// ********************************
#include "BrachyWaterBoxHit.hh"
#include "G4ios.hh"
#include "G4VVisManager.hh"
#include "G4Colour.hh"
#include "G4VisAttributes.hh"
#include "G4LogicalVolume.hh"
G4Allocator<BrachyWaterBoxHit> BrachyWaterBoxHitAllocator;
//....
BrachyWaterBoxHit::BrachyWaterBoxHit(G4LogicalVolume* logVol,G4int XID,G4int ZID)
:m_pLogV(logVol),m_XID(XID),m_ZID(ZID)
{
m_Edep=0;
}
//....
BrachyWaterBoxHit::~BrachyWaterBoxHit()
{
}
//....
BrachyWaterBoxHit::BrachyWaterBoxHit(const BrachyWaterBoxHit &right)
{
m_XID = right.m_XID;
m_ZID = right.m_ZID;
m_Edep = right.m_Edep;
m_Pos = right.m_Pos;
m_Rot = right.m_Rot;
m_pLogV = right.m_pLogV;
}
//....
const BrachyWaterBoxHit& BrachyWaterBoxHit::operator=(const BrachyWaterBoxHit &right)
{
m_XID = right.m_XID;
m_ZID = right.m_ZID;
m_Edep = right.m_Edep;
m_Pos = right.m_Pos;
m_Rot = right.m_Rot;
m_pLogV = right.m_pLogV;
return *this;
}
//....
int BrachyWaterBoxHit::operator==(const BrachyWaterBoxHit &right) const
{
return((m_XID==right.m_XID)&&(m_ZID==right.m_ZID));
}
//....
void BrachyWaterBoxHit::Draw()
{
}
//....
void BrachyWaterBoxHit::Print()
{
}
@@ -0,0 +1,94 @@
// ************************************
// * *
// * BrachyWaterBoxROGeometry.cc *
// * *
// ************************************
#include "BrachyWaterBoxROGeometry.hh"
#include "BrachyDummySD.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4Box.hh"
#include "G4Tubs.hh"
#include "G4SubtractionSolid.hh"
#include "G4ThreeVector.hh"
#include "G4Material.hh"
//....
BrachyWaterBoxROGeometry::BrachyWaterBoxROGeometry(G4String aString,G4double DetDimX,G4double DetDimZ,G4int NumVoxelX,G4int NumVoxelZ)
: G4VReadOutGeometry(aString),m_DetDimX(DetDimX),m_DetDimZ(DetDimZ),m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ)
{
}
//....
BrachyWaterBoxROGeometry::~BrachyWaterBoxROGeometry()
{
}
//....
G4VPhysicalVolume* BrachyWaterBoxROGeometry::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);
// Slice thickness is the average of Voxel X and Z sizes
G4double DetVoxel_y = (m_DetDimX/m_NumVoxelX+m_DetDimZ/m_NumVoxelZ)/2.0;
G4double ExpHall_x = 4.0*m;
G4double ExpHall_y = 4.0*m;
G4double ExpHall_z = 4.0*m;
G4double Det_x = m_DetDimX/2;
G4double Det_y = DetVoxel_y;
G4double Det_z = m_DetDimZ/2;
G4double DetVoxelX_x = Det_x/m_NumVoxelX;
G4double DetVoxelX_y = DetVoxel_y;
G4double DetVoxelX_z = Det_z;
G4double DetVoxelX_dx = 2*DetVoxelX_x;
G4double DetVoxelZ_x = Det_x;
G4double DetVoxelZ_y = DetVoxel_y;
G4double DetVoxelZ_z = Det_z/m_NumVoxelZ;
G4double DetVoxelZ_dz = 2*DetVoxelZ_z;
G4Box *ROExpHall = new G4Box("ROExpHall",ExpHall_x,ExpHall_y,ExpHall_z);
G4LogicalVolume *ROExpHallLog = new G4LogicalVolume(ROExpHall,dummyMat,"ROExpHallLog",0,0,0);
G4VPhysicalVolume *ROExpHallPhys = new G4PVPlacement(0,G4ThreeVector(),"ROExpHallPhys",ROExpHallLog,0,false,0);
G4Box *RODetector = new G4Box("RODetector", Det_x, Det_y, Det_z);
G4LogicalVolume *RODetectorLog = new G4LogicalVolume(RODetector,dummyMat,"RODetectorLog",0,0,0);
G4VPhysicalVolume *RODetectorPhys = new G4PVPlacement(0,G4ThreeVector(),"DetectorPhys",RODetectorLog,ROExpHallPhys,false,0);
// ReadOut Voxel division
// X division first...
G4Box *RODetectorXDivision = new G4Box("RODetectorXDivision",DetVoxelX_x,DetVoxelX_y,DetVoxelX_z);
G4LogicalVolume *RODetectorXDivisionLog = new G4LogicalVolume(RODetectorXDivision,dummyMat,"RODetectorXDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorXDivisionPhys = new G4PVReplica("RODetectorXDivisionPhys",RODetectorXDivisionLog,RODetectorPhys,kXAxis,m_NumVoxelX,DetVoxelX_dx);
// ...then Z division
G4Box *RODetectorZDivision = new G4Box("RODetectorZDivision",DetVoxelZ_x,DetVoxelZ_y,DetVoxelZ_z);
G4LogicalVolume *RODetectorZDivisionLog = new G4LogicalVolume(RODetectorZDivision,dummyMat,"RODetectorZDivisionLog",0,0,0);
G4VPhysicalVolume *RODetectorZDivisionPhys = new G4PVReplica("RODetectorZDivisionPhys",RODetectorZDivisionLog,RODetectorXDivisionPhys,kZAxis,m_NumVoxelZ,DetVoxelZ_dz);
BrachyDummySD *dummySD = new BrachyDummySD;
RODetectorZDivisionLog->SetSensitiveDetector(dummySD);
return ROExpHallPhys;
}
@@ -0,0 +1,119 @@
// ********************************
// * *
// * BrachyWaterBoxSD.cc *
// * *
// ********************************
#include "BrachyWaterBoxSD.hh"
#include "BrachyWaterBoxHit.hh"
#include "BrachyDetectorConstruction.hh"
#include "G4Track.hh"
#include "G4LogicalVolume.hh"
#include "G4VPhysicalVolume.hh"
#include "G4Step.hh"
#include "G4VTouchable.hh"
#include "G4TouchableHistory.hh"
#include "G4SDManager.hh"
#include "G4ParticleDefinition.hh"
//....
BrachyWaterBoxSD::BrachyWaterBoxSD(G4String name, G4int NumVoxelX, G4int NumVoxelZ)
:G4VSensitiveDetector(name),m_NumVoxelX(NumVoxelX),m_NumVoxelZ(NumVoxelZ)
{
G4String HCname;
collectionName.insert(HCname="WaterBoxHitsCollection");
m_pVoxelID = new G4int[NumVoxelX*NumVoxelZ];
m_pWaterBoxHitsCollection = NULL;
}
//....
BrachyWaterBoxSD::~BrachyWaterBoxSD()
{
delete[] m_pVoxelID;
}
//....
void BrachyWaterBoxSD::Initialize(G4HCofThisEvent*HCE)
{
m_pWaterBoxHitsCollection = new BrachyWaterBoxHitsCollection(SensitiveDetectorName,collectionName[0]);
for(G4int k=0;k<m_NumVoxelZ;k++)
for(G4int i=0;i<m_NumVoxelX;i++)
m_pVoxelID[i+k*m_NumVoxelX] = -1;
}
//....
G4bool BrachyWaterBoxSD::ProcessHits(G4Step* aStep, G4TouchableHistory* ROhist)
{
if(!ROhist)
return false;
if(aStep->GetPreStepPoint()->GetPhysicalVolume()->GetName() != "WaterBoxPhys")
return false;
G4double edep = aStep->GetTotalEnergyDeposit();
if(edep==0.)
return false;
G4VPhysicalVolume* physVol = ROhist->GetVolume();
G4VPhysicalVolume* mothVol = ROhist->GetVolume(1);
// Read Voxel indexes: i is the x index, k is the z index
G4int k = ROhist->GetReplicaNumber();
G4int i = ROhist->GetReplicaNumber(1);
if(m_pVoxelID[i+k*m_NumVoxelX]==-1)
{
BrachyWaterBoxHit* WaterBoxHit = new BrachyWaterBoxHit(physVol->GetLogicalVolume(),i,k);
G4RotationMatrix rotM;
if(physVol->GetObjectRotation())
rotM = *(physVol->GetObjectRotation());
WaterBoxHit->SetEdep(edep);
WaterBoxHit->SetPos(physVol->GetTranslation());
WaterBoxHit->SetRot(rotM);
G4int VoxelID = m_pWaterBoxHitsCollection->insert(WaterBoxHit);
m_pVoxelID[i+k*m_NumVoxelX] = VoxelID - 1;
}
else
(*m_pWaterBoxHitsCollection)[m_pVoxelID[i+k*m_NumVoxelX]]->AddEdep(edep);
return true;
}
//....
void BrachyWaterBoxSD::EndOfEvent(G4HCofThisEvent*HCE)
{
static G4int HCID = -1;
if(HCID<0)
{
HCID = GetCollectionID(0);
}
HCE->AddHitsCollection(HCID,m_pWaterBoxHitsCollection);
}
//....
void BrachyWaterBoxSD::clear()
{
}
//....
void BrachyWaterBoxSD::DrawAll()
{
}
//....
void BrachyWaterBoxSD::PrintAll()
{
}
@@ -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....
@@ -0,0 +1,21 @@
# --------------------------------------------------------------
# $Id: GNUmakefile,v 1.4 2000/11/16 13:46:04 nartallo Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := XrayTel
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../..
endif
G4VIS_USE = 1
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
+68
View File
@@ -0,0 +1,68 @@
$Id: History,v 1.9 2000/12/06 18:34:34 nartallo Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Category History file
---------------------
This file should be used by G4 developers and category coordinators
to briefly summarize all major modifications introduced in the code
and keep track of all category-tags.
It DOES NOT substitute the CVS log-message one should put at every
committal in the CVS repository !
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
06.12.2000 - RN, tag xraytel-V02-00-10
Removed old XrayTelPrimaryGeneratorMessenger.cc and .hh
files from cvs
30.11.2000 - RN, tag xraytel-V02-00-09
Removed longsection.macro file from cvs
30.11.2000 - RN, tag xraytel-V02-00-08
Implemented AnalysisManager class and related histograming
code. Analysis is limited to the Lizard package for now.
16.11.2000 - RN, tag xraytel-V02-00-07
Removed analysis directory
16.11.2000 - RN, tag xraytel-V02-00-06
Replace standard gun with General Particle Source
Remove all code related to old Histogram implementation
Modified all macros to work with GPS
Cleaned GNUmakefile
Started drafting README file
08.11.2000 - RN, tag xraytel-V02-00-05
Tydied up macros
Small bug fixes to compile on Linux, SUN and DEC platforms
06.11.2000 - RN, tag xraytel-V02-00-04
Tydied up code added headers
18.10.2000 - RN, tag xraytel-V02-00-03
Modified geometry and PrimaryGenerator to speed up events
Modified SteppingAction.cc to call histoManager analyser
Modified Histogram.cc to do all the histo work
17.10.2000 - RN, tag xraytel-V02-00-02
Added histograming capability
Added XrayTelHistogram.hh, XrayTelHistogram.cc
Modified: GNUmakefile
XrayTel.cc
XrayTelSteppingAction.hh
XrayTelSteppingAction.cc
17.10.2000 - RN, tag xraytel-V02-00-01
Tydied up geometry
Add all physics processes to XrayTelPhysicsList.cc
Modified *.hh accordingly
06.10.2000 - RN, tag xraytel-V02-00-00
First submission of XrayTel advanced example.
+171
View File
@@ -0,0 +1,171 @@
$Id: README,v 1.5 2000/12/06 18:34:42 nartallo Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
xray_telescope
--------------
XrayTel is an advanced Geant4 example based on a realistic simulation of
an X-ray Telescope. It is based on work carried out by a team of Geant4
experts to simulate the interaction between X-ray Telescopes XMM-Newton
and Chandra with low energy protons present in the orbital radiation
background. The X-ray mirrors are designed to collect x-ray photons at
grazing-incidence angles and focus them onto detectors at the focal plane.
However, this mechanism also seems to work for low energy protons which,
if they reach the detectors in sufficient numbers, can cause damage.
In this example, the geometry has been simplified by using a single mirror
shell and no baffles, but all the dimensions and materials are realistic.
The aim of this advanced example is to illustrate the use advanced
GUI, visualisation, particle generation and analysis schemes available
in Geant4:
- the simulation can be run from GAG or the command prompt
- macros are provided to display the geometry and particle tracks with
OpenGL, DAWN Postscript or VRML visualisation
- the generation of particles is done via the new General Particle Source
- histograming facilities are provided for the Linux environment only
with the Lizard system at present, other analysis systems such as
OpenScientist and JAS will be implemented at a later stage
In order to be able to use any of these packages, prior installation is
necessary and a number of environment variables will have to be set.
1. Setting up the environment variables for GAG, Visualisation and
Analysis options (example based on Linux at CERN)
#set up GAG
setenv G4UI_BUILD_GAG_SESSION 1
setenv G4UI_USE_GAG 1
#set up VRMLview
setenv G4VIS_BUILD_VRMLFILE_DRIVER 1
setenv G4VIS_USE_VRML 1
setenv G4VIS_USE_VRMLFILE 1
setenv G4VRMLFILE_MAX_FILE_NUM 100
setenv G4VRMLFILE_VIEWER vrmlview #if installed
setenv G4VIS_USE_VRML 1
setenv G4VIS_USE_VRMLFILE 1
setenv PATH ${PATH}:"/afs/cern.ch/sw/contrib/VRML/bin/Linux"
#set up OpenGL or Mesa
setenv G4VIS_BUILD_OPENGLX_DRIVER 1
setenv G4VIS_USE_OPENGLX 1
setenv OGLHOME /afs/cern.ch/sw/geant4/dev/Mesa/Linux-g++
#set up DAWN
setenv G4VIS_BUILD_DAWN_DRIVER 1
setenv G4VIS_BUILD_DAWNFILE_DRIVER 1
setenv G4VIS_USE_DAWN 1
setenv G4VIS_USE_DAWNFILE 1
setenv PATH ${PATH}:"/afs/cern.ch/sw/geant4/dev/DAWN/Linux-g++"
#set up Lizard
setenv LIZARDROOT /usr/local/freeLizard/3.2.0 #get correct path
setenv G4ANALYSIS_SYSTEM Lizard
setenv G4ANALYSIS_USE 1
setenv G4ANALYSIS_USE_LIZARD 1
setenv G4ANALYSIS_BUILD 1
setenv G4ANALYSIS_BUILD_LIZARD 1
#add to the LD_LIBRARY_PATH
setenv LD_LIBRARY_PATH /usr/local/freeLizard/3.2.0/Linux/lib:$OGLHOME/lib
IMPORTANT WARNING!
setenv G4ANALYSIS_BUILD 1
must always be set to build the example even if the analysis option
is not required
Sources
-------
GAG can be obtained from
http://erpc1.naruto-u.ac.jp/~geant4/
OpenGL Mesa needs to be installed prior to building Geant4 and can be
downloaded from
http://www.mesa3d.org/download.html
DAWN can be obtained from
http://133.7.51.8/dawn/
VRMLview for Linux can be obtained from
2. Run
To execute a sample simulation with visualisation of proton tracks
reaching the detector run:
XrayTel opengl.mac for OpenGL display
XrayTel vrml.mac for VRML display and output file
XrayTel dawn.mac for dawn display and PS output file
To execute a run without visualisation
XrayTel test.mac
If the Lizard analysis options are set, histograming windows will
automatically open and the corresponding files will be created.
A 2D histogram (scatter plot) will display in real time every proton
hit that reaches the detector.
A 1D histogram will display the energy distribution of the protons
that reach the detector at the end of the run.
The final energy and (x,y,z) position of the protons that reach the
detector is output to a file "detector.hits". This file is created
if it does not exist or appended to if it does.
3. Detector description
The telescope and detector geometry is defined in
XrayTelDetectorConstruction.cc
4. Physics processes
The physics processes are in XrayTelPhysicsList.cc
The main process in this example is MultipleScattering of the protons
on the mirror surfaces.
5. Event generation
This is done using the new General Particle Source. Documentation for
this can be found in
http://www.space.dera.gov.uk/space_env/gspm.html
6. Analysis
At present the analysis package implemented is Lizard. As this is still
under development only simple histograming is used. The main purpose of
including this facility was to provide the basis for the implementation of
AIDA interfaces between Geant4 and analysis packages, in particular
Lizard, OpenScientist and JAS. More complex analysis features may be
implemented in future releases.
The current implementation of the analysis class is very preliminary
and new tags of this example are anticipated to be released soon after
the general release
Lizard is not currently implemented on platforms other than Linux.
To build and execute the example on other platforms the analysis
environment variables must not be set, except for G4ANALYSIS_BUILD
which is required for building the executable.
+124
View File
@@ -0,0 +1,124 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTel.cc main file *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// HISTORY
// -------
//
// The development of this advanced example is based on earlier work
// carried out by a team of Geant4 collaborators to simulate the Chandra
// and XMM X-ray observatories. The authors involved in those models are
// J Apostolakis, P Arce, S Giani, F Lei, R Nartallo, S Magni,
// P Truscott, L Urban
//
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 R. Nartallo, A. Pfeiffer
// - Implementation of analysis manager code for histograming
//
// 15.11.2000 R. Nartallo
// - Minor changes proposed by F. Lei to implement the GPS module now
// replacing the standard particle gun
// - Remove commented lines related to old histograming code
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
// - Lines for using GAG and the histogram manager are commented out.
//
//
// **********************************************************************
#include "G4RunManager.hh"
#include "G4UImanager.hh"
//#include "G4UIGAG.hh"
#include "G4UIterminal.hh"
#include "G4UIXm.hh"
#include "XrayTelDetectorConstruction.hh"
#include "XrayTelPhysicsList.hh"
#include "XrayTelVisManager.hh"
#include "XrayTelEventAction.hh"
#include "XrayTelRunAction.hh"
#include "XrayTelSteppingAction.hh"
#include "XrayTelPrimaryGeneratorAction.hh"
#include <iostream.h>
#include "g4std/vector"
#include "XrayTelAnalysisManager.hh"
int main( int argc, char** argv )
{
// Construct the default run manager
G4RunManager * runManager = new G4RunManager;
// set mandatory initialization classes
runManager->SetUserInitialization(new XrayTelDetectorConstruction ) ;
runManager->SetUserInitialization(new XrayTelPhysicsList);
// setup some of the common variables
G4bool drawEvent;
G4std::vector<G4double*> EnteringEnergy;
G4std::vector<G4ThreeVector*> EnteringDirection;
// create manager for analysis.
char* s = getenv("G4ANALYSIS_SYSTEM");
XrayTelAnalysisManager* analysisManager = new XrayTelAnalysisManager(s?s:"");
// set mandatory user action class
runManager->SetUserAction(new XrayTelPrimaryGeneratorAction);
runManager->SetUserAction(new XrayTelRunAction(&EnteringEnergy,
&EnteringDirection, &drawEvent, analysisManager));
runManager->SetUserAction(new XrayTelEventAction(&drawEvent));
runManager->SetUserAction(new XrayTelSteppingAction(
&EnteringEnergy, &EnteringDirection, &drawEvent, analysisManager));
// visualization manager
G4VisManager* visManager = new XrayTelVisManager;
visManager->Initialize();
//Initialize G4 kernel
runManager->Initialize();
// get the pointer to the User Interface manager
G4UImanager *UI = G4UImanager::GetUIpointer();
if ( argc==1 ){
// G4UIsession * session = new G4UIGAG;
G4UIsession * session = new G4UIterminal;
session->SessionStart();
delete session;
}
else {
// Create a pointer to the User Interface manager
G4String command = "/control/execute ";
for (int i=2; i<=argc; i++) {
G4String macroFileName = argv[i-1];
UI->ApplyCommand(command+macroFileName);
}
}
// job termination
delete visManager;
delete analysisManager;
delete runManager;
return 0;
}
+131
View File
@@ -0,0 +1,131 @@
#######################################################################
# #
# 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. #
# #
# ******************************************************************* #
# * * #
# * GEANT 4 xray_telescope advanced example * #
# * * #
# * MACRO: dawn.mac * #
# * ------ demostrates the DAWN DRIVER * #
# * * #
# * Version: 0.6 * #
# * Date: 15/11/00 * #
# * Author: R Nartallo * #
# * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands * #
# * * #
# ******************************************************************* #
# #
# NOTES #
# ----- #
# USAGE: Idle> /control/execute dawn.mac #
# prompt> XrayTel dawn.mac #
# #
# REQUIRED PLATFORMS & SOFTWARE: DAWN (version 3.85 or after) #
# Ghostview #
# #
# ENVIRONMENT VARIABLES (C-MACROS) FOR INSTALLATION: #
# (See geant4/source/visualization/README for details.) #
# #
# % setenv G4VIS_USE_DAWN 1 #
# % setenv G4VIS_USE_DAWNFILE 1 #
# % setenv G4VIS_BUILD_DAWN_DRIVER 1 #
# % setenv G4VIS_BUILD_DAWNFILE_DRIVER 1 #
# #
# Addional Notes: #
# #
# * You may have to set the command path to the directory where #
# a Fukui Renderer DAWN is installed, e.g., to #
# "/afs/cern.ch/sw/contrib/DAWN/3.85/bin/Linux/" #
# at CERN. #
# #
# * Set as follows to skip DAWN GUI: #
# % setenv G4DAWNFILE_VIEWER "dawn -d" #
# #
# * In order to make the generated PostScript file "g4_XX.eps" #
# printable, append the "showpage" PostScript command to the file. #
# You can do it with the 4th page of the DAWN GUI panel #
# or by editing the file by hand. #
# #
#######################################################################
# #
# CHANGE HISTORY #
# -------------- #
# #
# 15.11.2000 R. Nartallo #
# - Replaced standard particle gun by GPS set options #
# #
# 08.11.2000 R. Nartallo #
# - Modified version #
# #
# 17.10.2000 S. Tanaka #
# - First implementation #
# #
#######################################################################
# Set verbose level
/run/verbose 2
# Invoke the DAWNFILE driver
/vis/open DAWNFILE
# Create a new scene
/vis/scene/create
# Attach the current scene handler to the current scene
/vis/sceneHandler/attach
# Add the world volume to the current scene
/vis/scene/add/volume
# Set drawing style
/vis/viewer/set/style surface
#/vis/viewer/set/style wireframe
# Set camera
/vis/camera/reset
/vis/camera/viewpoint 25 0
# Visualize one event added to the current scene
# * Command "/vis/scene/notifyHandlers" is written in
# XrayTelRunAction::BeginOfRunAction()
# * Command "/vis/show/view" is written in
# XrayTelRunAction::EndOfRunAction()
# Store particle trajactories for visualization
/tracking/storeTrajectory 1
# Set to draw tracks of positively charged particles
/event/drawTracks charged
# Set General Particle Source options
/gps/particle proton
/gps/type Plane
/gps/shape Annulus
/gps/posrot1 0. 0. 1.
/gps/posrot2 0. 1. 0.
/gps/radius 35.5 cm
/gps/radius0 30.5 cm
/gps/centre 780.1 0. 0. cm
/gps/angtype cos
/gps/angrot1 0. 0. 1.
/gps/angrot2 0. 1. 0.
/gps/maxtheta 1. deg
/gps/energytype Mono
/gps/monoenergy 0.5 MeV
# Set number of particles and start
/run/beamOn 10000
@@ -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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelAnalysisManager.cc *
// * ------- *
// * *
// * Version: 0.2 *
// * Date: 30/11/00 *
// * Author: A. Pfeiffer, G. Barrand, MG Pia, R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 M.G. Pia, R. Nartallo
// - Simplification of code
// - Inheritance directly from the base class G4VAnalysisManager instead
// of the derived class G4AnalysisManager
//
// 16.10.2000 G. Barrand
// - First implementation of XrayAnalysisManager class
// - Provision of code for various AIDA and non-AIDA systems
//
// **********************************************************************
#ifndef XrayTelAnalysisManager_h
#define XrayTelAnalysisManager_h 1
#include "G4VAnalysisManager.hh"
#include "globals.hh"
#include "g4std/vector"
#include "G4ThreeVector.hh"
class G4SteppingManager;
class G4VAnalysisSystem;
#ifdef G4ANALYSIS_USE
class IHistogramFactory;
class IHistogram1D;
class IHistogram2D;
#endif
#ifdef G4ANALYSIS_USE
class XrayTelAnalysisManager: public G4VAnalysisManager {
#endif
#ifndef G4ANALYSIS_USE
class XrayTelAnalysisManager {
#endif
public:
XrayTelAnalysisManager(const G4String&);
~XrayTelAnalysisManager();
G4bool RegisterAnalysisSystem(G4VAnalysisSystem*);
#ifdef G4ANALYSIS_USE
IHistogramFactory* GetHistogramFactory(const G4String&);
virtual void Store(IHistogram* = 0,const G4String& = "");
virtual void Plot(IHistogram*);
#endif
void BeginOfRun();
void EndOfRun();
void Step(const G4SteppingManager*);
private:
G4VAnalysisSystem* analysisSystem;
#ifdef G4ANALYSIS_USE
IHistogramFactory* hFactory;
IHistogram1D* enteringEnergyHistogram;
IHistogram2D* yzHistogram;
#endif
};
#endif
@@ -0,0 +1,59 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelDetectorConstruction.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelDetectorConstruction_H
#define XrayTelDetectorConstruction_H 1
class G4VPhysicalVolume;
#include "G4VUserDetectorConstruction.hh"
#include "G4LogicalVolume.hh"
class XrayTelDetectorConstruction : public G4VUserDetectorConstruction
{
public:
XrayTelDetectorConstruction();
~XrayTelDetectorConstruction();
public:
G4VPhysicalVolume* Construct();
private:
G4double world_x;
G4double world_y;
G4double world_z;
void ConstructTelescope();
void ConstructFocalPlane();
G4VPhysicalVolume* physicalWorld;
};
#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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelEventAction.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelEventAction_h
#define XrayTelEventAction_h 1
#include "G4UserEventAction.hh"
#include "globals.hh"
class XrayTelEventActionMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class XrayTelEventAction : public G4UserEventAction
{
public:
XrayTelEventAction(G4bool* dEvent);
~XrayTelEventAction();
public:
void BeginOfEventAction(const G4Event* anEvent);
void EndOfEventAction(const G4Event* anEvent);
void SetDrawFlag(G4String val) {drawFlag = val;};
private:
G4bool* drawEvent;
G4String drawFlag; // control the drawing of event
XrayTelEventActionMessenger* eventMessenger;
};
#endif
@@ -0,0 +1,62 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelEventActionMessenger.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelEventActionMessenger_h
#define XrayTelEventActionMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class XrayTelEventAction;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class XrayTelEventActionMessenger: public G4UImessenger
{
public:
XrayTelEventActionMessenger(XrayTelEventAction*);
~XrayTelEventActionMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
XrayTelEventAction* eventAction;
G4UIcmdWithAString* DrawCmd;
};
#endif
@@ -0,0 +1,85 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelPhysicsList.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelPhysicsList_h
#define XrayTelPhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
class XrayTelPhysicsList: public G4VUserPhysicsList
{
public:
XrayTelPhysicsList();
~XrayTelPhysicsList();
protected:
// Construct particle and physics process
void ConstructParticle();
void ConstructProcess();
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();
void ConstructAllShortLiveds();
protected:
// these methods Construct physics processes and register them
void ConstructGeneral();
void ConstructEM();
private:
G4double cutForGamma;
G4double cutForElectron;
G4double cutForProton;
};
#endif
@@ -0,0 +1,62 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelPrimaryGeneratorAction.hh *
// * ------- *
// * *
// * Version: 0.5 *
// * Date: 15/11/00 *
// * Author: F.Lei *
// * Organisation: DERA, UK *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 15.11.2000 F.Lei
// - New version of PrimaryGeneratorAction using the GPS insead of the
// standard particle gun.
// - The PrimaryGeneratorMessenger is no longer needed.
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelPrimaryGeneratorAction_h
#define XrayTelPrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
class G4GeneralParticleSource;
class G4Event;
class XrayTelPrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
XrayTelPrimaryGeneratorAction();
~XrayTelPrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event* anEvent);
private:
G4GeneralParticleSource* particleGun;
};
#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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelRunAction.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelRunAction_h
#define XrayTelRunAction_h 1
#include "G4UserRunAction.hh"
#include "G4ThreeVector.hh"
#include "globals.hh"
#include "g4std/vector"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class G4Run;
class XrayTelAnalysisManager;
class XrayTelRunAction : public G4UserRunAction
{
public:
XrayTelRunAction(G4std::vector<G4double*> *enEnergy,
G4std::vector<G4ThreeVector*> *enDirect,
G4bool* dEvent,
XrayTelAnalysisManager* = 0);
~XrayTelRunAction();
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
private:
G4bool* drawEvent;
G4std::vector<G4double*>* enteringEnergy;
G4std::vector<G4ThreeVector*>* enteringDirection;
XrayTelAnalysisManager* fAnalysisManager;
};
#endif
@@ -0,0 +1,128 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelStepCut.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelStepCut_h
#define XrayTelStepCut_h 1
#include "G4ios.hh"
#include "G4VDiscreteProcess.hh"
#include "G4Step.hh"
#include "globals.hh"
class XrayTelStepCut : public G4VDiscreteProcess
{
public:
XrayTelStepCut(const G4String& processName ="UserStepCut" );
XrayTelStepCut(XrayTelStepCut &);
~XrayTelStepCut();
G4double PostStepGetPhysicalInteractionLength(
const G4Track& track,
G4double previousStepSize,
G4ForceCondition* condition
);
G4VParticleChange* PostStepDoIt(
const G4Track& ,
const G4Step&
);
void SetMaxStep(G4double);
protected:
// it is not needed here !
G4double GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition
);
private:
// hide assignment operator as private
XrayTelStepCut & operator=(const XrayTelStepCut &right);
private:
G4double MaxChargedStep ;
};
// inlined function members implementation
#include "G4Step.hh"
#include "G4Track.hh"
#include "G4UserLimits.hh"
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
inline G4double XrayTelStepCut::PostStepGetPhysicalInteractionLength(
const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition
)
{
// condition is set to "Not Forced"
*condition = NotForced;
G4double ProposedStep = DBL_MAX;
if((MaxChargedStep > 0.) &&
(aTrack.GetVolume() != NULL) &&
(aTrack.GetVolume()->GetName() == "Absorber") &&
(aTrack.GetDynamicParticle()->GetDefinition()->GetPDGCharge() != 0.))
ProposedStep = MaxChargedStep ;
return ProposedStep;
}
inline G4VParticleChange* XrayTelStepCut::PostStepDoIt(
const G4Track& aTrack,
const G4Step&
)
{
// do nothing
aParticleChange.Initialize(aTrack);
return &aParticleChange;
}
inline G4double XrayTelStepCut::GetMeanFreePath(const G4Track& aTrack,
G4double previousStepSize,
G4ForceCondition* condition
)
{
return 0.;
}
#endif
@@ -0,0 +1,63 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelSteppingAction.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelSteppingAction_h
#define XrayTelSteppingAction_h 1
class XrayTelAnalysisManager;
#include "G4UserSteppingAction.hh"
#include "G4ThreeVector.hh"
#include "g4std/vector"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class XrayTelSteppingAction : public G4UserSteppingAction
{
public:
XrayTelSteppingAction(
G4std::vector<G4double*> *enEnergy,
G4std::vector<G4ThreeVector*> *enDirect,
G4bool* dEvent,
XrayTelAnalysisManager* = 0);
virtual ~XrayTelSteppingAction();
virtual void UserSteppingAction(const G4Step*);
private:
G4bool* drawEvent;
G4std::vector<G4double*>* enteringEnergy;
G4std::vector<G4ThreeVector*>* enteringDirection;
XrayTelAnalysisManager* fAnalysisManager;
};
#endif
@@ -0,0 +1,54 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelVisManager.hh *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of X-ray Telescope advanced example.
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifndef XrayTelVisManager_h
#define XrayTelVisManager_h 1
#ifdef G4VIS_USE
#include "G4VisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class XrayTelVisManager: public G4VisManager {
public:
XrayTelVisManager ();
private:
void RegisterGraphicsSystems ();
};
#endif
#endif
+115
View File
@@ -0,0 +1,115 @@
#######################################################################
# #
# 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. #
# #
# ******************************************************************* #
# * * #
# * GEANT 4 xray_telescope advanced example * #
# * * #
# * MACRO: opengl.mac * #
# * ------ demostrates the OGLIX DRIVER * #
# * * #
# * Version: 0.6 * #
# * Date: 15/11/00 * #
# * Author: R Nartallo * #
# * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands * #
# * * #
# ******************************************************************* #
# #
# NOTES #
# ----- #
# USAGE: Idle> /control/execute opengl.mac. #
# prompt> XrayTel opengl.mac #
# #
# REQUIRED PLATFORMS & SOFTWARE: OpenGL, e.g. Mesa #
# #
# ENVIRONMENT VARIABLES (C-MACROS) FOR INSTALLATION: #
# (See geant4/source/visualization/README for details.) #
# #
# % setenv OGLHOME opengl_home_dir #
# (where opengl_home_dir is e.g. /usr/local/Mesa-3.2.1 #
# #
# % setenv G4VIS_USE_OPENGLX 1 #
# % setenv G4VIS_BUILD_OPENGLX_DRIVER 1 #
# #
#######################################################################
# #
# CHANGE HISTORY #
# -------------- #
# #
# 15.11.2000 R. Nartallo #
# - Replaced standard particle gun by GPS set options #
# #
# 08.11.2000 R. Nartallo #
# - First implementation #
# #
#######################################################################
# Set verbose level
/run/verbose 2
# Invoke the OGLIX driver
/vis/open OGLIX
# Create a new scene
/vis/scene/create
# Attach the current scene handler to the current scene
/vis/sceneHandler/attach
# Add the world volume to the current scene
/vis/scene/add/volume
# Add all trajectories to the current scene
#/vis/scene/add/trajectories
# Set drawing style
/vis/viewer/set/style surface
# Set camera
/vis/camera/reset
/vis/camera/viewpoint 25 0
#/vis/camera/spin 360 1
# Visualize one event added to the current scene
# * Command "/vis/scene/notifyHandlers" is written in
# XrayTelRunAction::BeginOfRunAction()
# * Command "/vis/show/view" is written in
# XrayTelRunAction::EndOfRunAction()
# Store particle trajactories for visualization
/tracking/storeTrajectory 1
# Set to draw tracks of positively charged particles
# /event/drawTracks charged
# Set General Particle Source options
/gps/particle proton
/gps/type Plane
/gps/shape Annulus
/gps/posrot1 0. 0. 1.
/gps/posrot2 0. 1. 0.
/gps/radius 35.5 cm
/gps/radius0 30.5 cm
/gps/centre 780.1 0. 0. cm
/gps/angtype cos
/gps/angrot1 0. 0. 1.
/gps/angrot2 0. 1. 0.
/gps/maxtheta 1. deg
/gps/energytype Mono
/gps/monoenergy 0.5 MeV
# Set number of particles and start
/run/beamOn 10000
@@ -0,0 +1,166 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelAnalysisManager.cc *
// * ------- *
// * *
// * Version: 0.2 *
// * Date: 30/11/00 *
// * Author: A. Pfeiffer, G. Barrand, MG Pia, R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 M.G. Pia, R. Nartallo
// - Simplification of code: removal of non-Lizard specific code
// - Inheritance directly from the base class G4VAnalysisManager instead
// of the derived class G4AnalysisManager
//
// 15.11.2000 A. Pfeiffer
// - Adaptation to Lizard
//
// 16.10.2000 G. Barrand
// - First implementation of XrayAnalysisManager
// - Provision of code for various AIDA and non-AIDA systems
//
// **********************************************************************
#include "g4std/fstream"
#include "G4ios.hh"
#include "G4Run.hh"
#include "G4Event.hh"
#include "G4Track.hh"
#include "G4VVisManager.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4SteppingManager.hh"
#include "G4VAnalysisSystem.hh"
#ifdef G4ANALYSIS_USE
#include <IHistogramFactory.h>
#endif
#ifdef G4ANALYSIS_USE_LIZARD
#include <IHistogram1D.h>
#include <IHistogram2D.h>
#include "G4LizardSystem.hh"
#endif
#include "XrayTelAnalysisManager.hh"
#ifndef G4ANALYSIS_USE
XrayTelAnalysisManager::XrayTelAnalysisManager(G4String const& aSystem)
{
}
XrayTelAnalysisManager::~XrayTelAnalysisManager()
{
}
#endif
#ifdef G4ANALYSIS_USE
XrayTelAnalysisManager::XrayTelAnalysisManager(G4String const& aSystem)
:
enteringEnergyHistogram(0),
yzHistogram(0)
{
// The Lizard analysis system is provided here as default
// other analysis systems will be implemented at a later stage
analysisSystem = new G4LizardSystem;
IHistogramFactory* hFactory = analysisSystem->GetHistogramFactory();
if(hFactory) {
// Histogram creation :
enteringEnergyHistogram = hFactory->create1D("Entering energy",100,0,0.5);
// Book the histogram for the 2D position.
// Instead of using a scatter plot, just book enough bins ...
yzHistogram = hFactory->create2D("YZ",200, -50, 50, 200, -50, 50);
}
}
XrayTelAnalysisManager::~XrayTelAnalysisManager()
{
// delete hFactory;
delete enteringEnergyHistogram;
delete yzHistogram;
delete analysisSystem;
}
G4bool XrayTelAnalysisManager::RegisterAnalysisSystem(
G4VAnalysisSystem* )
{
return true;
}
IHistogramFactory* XrayTelAnalysisManager::GetHistogramFactory(
const G4String& aSystem)
{
return hFactory;
}
void XrayTelAnalysisManager::Store(IHistogram* aHistogram,const G4String& aSID)
{
analysisSystem->Store(aHistogram,aSID);
}
void XrayTelAnalysisManager::Plot(IHistogram* aHistogram)
{
analysisSystem->Plot(aHistogram);
}
void XrayTelAnalysisManager::BeginOfRun(){
if(enteringEnergyHistogram)
enteringEnergyHistogram->reset();
if(yzHistogram)
yzHistogram->reset();
}
void XrayTelAnalysisManager::EndOfRun(){
// the following things cannot be done in Run::EndOfRun()
// only now plot the energy of the particles
if(enteringEnergyHistogram) {
Plot(enteringEnergyHistogram);
}
// and store the histograms
if(enteringEnergyHistogram) {
Store(enteringEnergyHistogram,"ekin.vop");
}
if(yzHistogram) {
Store(yzHistogram,"position.vop");
}
}
void XrayTelAnalysisManager::Step(const G4SteppingManager* aSteppingManager) {
if(!aSteppingManager) return;
G4Track* track = aSteppingManager->GetTrack();
G4ThreeVector pos = track->GetPosition();
if(enteringEnergyHistogram) {
enteringEnergyHistogram->fill(track->GetKineticEnergy());
}
if(yzHistogram) {
yzHistogram->fill(pos.y(), pos.z());
Plot(yzHistogram);
}
}
#endif
@@ -0,0 +1,408 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelDetectorConstruction.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope geometry
// - Based on Chandra and XMM models by R Nartallo, P Truscott, F Lei
// and P Arce
//
//
// **********************************************************************
#include "G4UnitsTable.hh"
#include "G4VUserDetectorConstruction.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4Element.hh"
#include "G4ElementTable.hh"
#include "G4Box.hh"
#include "G4Cons.hh"
#include "G4Tubs.hh"
#include "G4LogicalVolume.hh"
#include "G4ThreeVector.hh"
#include "G4PVPlacement.hh"
#include "G4PVReplica.hh"
#include "G4SDManager.hh"
#include "G4VisAttributes.hh"
#include "G4Colour.hh"
#include "globals.hh"
#include "XrayTelDetectorConstruction.hh"
XrayTelDetectorConstruction::XrayTelDetectorConstruction()
{
world_x = 2500.*cm;
world_y = 2500.*cm;
world_z = 2500.*cm;
}
XrayTelDetectorConstruction::~XrayTelDetectorConstruction()
{;}
G4VPhysicalVolume* XrayTelDetectorConstruction::Construct( )
{
// Material: Vacuum
G4Material* Vacuum = new G4Material("Vacuum",
1.0 , 1.01*g/mole, 1.0E-25*g/cm3,
kStateGas, 2.73*kelvin, 3.0E-18*pascal );
// Visualization attributes
G4VisAttributes* VisAttWorld= new G4VisAttributes( G4Colour(204/255.,255/255.,255/255.));
// World
G4Box * solidWorld = new G4Box( "world_S", world_x, world_y, world_z );
G4LogicalVolume * logicalWorld = new G4LogicalVolume( solidWorld, // solid
Vacuum, // material
"world_L", // name
0,0,0);
logicalWorld -> SetVisAttributes(VisAttWorld);
// Physical volume
physicalWorld= new G4PVPlacement( 0,
G4ThreeVector(),
"world_P", // name (2nd constructor)
logicalWorld, // logical volume
NULL, // mother volume
false, // no boolean operation
0); // copy number
// Make Invisible
logicalWorld -> SetVisAttributes(G4VisAttributes::Invisible);
// Construct geometry
ConstructTelescope();
ConstructFocalPlane();
return physicalWorld;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
// Construct Telescope
void XrayTelDetectorConstruction::ConstructTelescope()
{
// Construct Mirror
// Single shell mirror made of Nickel with thin Gold coating
// Mirror made up of two cones approximating the parabolic section and
// two cones approximating the hyperbolic section
// The centre of the mirror is filled wiith a solid aluminium rod shaped as the
// mirrors, so as to leave a constant BaffleGap distance from the mirror surface
// Build materials
G4Material* Ni = new G4Material("Nickel", 28., 58.6934*g/mole, 8.902*g/cm3);
G4Material* Au = new G4Material("Gold", 79., 196.96654*g/mole, 19.300*g/cm3);
G4Material* Al = new G4Material("Aluminium", 13., 26.98*g/mole, 2.700*g/cm3);
// Visualization attributes
G4VisAttributes* VisAttMirror = new G4VisAttributes(
G4Colour(0/255., 0/255.,255/255.));
G4VisAttributes* VisAttAuCoating = new G4VisAttributes(
G4Colour(255/255., 255/255., 0/255.));
G4VisAttributes* VisAttBaffle = new G4VisAttributes(
G4Colour(128/255., 128/255., 128/255.));
// Rotation Matrix
G4RotationMatrix *rotateMatrix = new G4RotationMatrix();
rotateMatrix -> rotateY(90.*deg);
// Construct cones to make Mirror sections
G4int i;
G4double MirrorEnd[5] = { 34.9995975*cm, 34.8277209*cm, 34.6549918*cm,
34.1347834*cm, 33.6137753*cm };
G4double MirrorPosition[4] = { 772.5*cm, 757.5*cm, 742.5*cm, 727.5*cm };
G4double MirrorSectionLength = 15.0*cm;
G4double MirrorNiThickness = 1.07*mm;
G4double MirrorAuCoating = 50.0e-6*mm;
G4double BaffleGap = 4.0*mm;
G4Cons* MirrorSolid[4];
G4Cons* MirrorAuCoatingSolid[4];
G4Cons* BaffleSolid[4];
G4LogicalVolume* MirrorLogicalVolume[4];
G4LogicalVolume* MirrorAuCoatingLogicalVolume[4];
G4LogicalVolume* BaffleLogicalVolume[4];
for ( i=0; i<4; i++ ) {
// Mirror Nickel base
MirrorSolid[i] = new G4Cons( "Mirror_S",
MirrorEnd[i], MirrorEnd[i] + MirrorNiThickness,
MirrorEnd[i+1], MirrorEnd[i+1] + MirrorNiThickness,
MirrorSectionLength/2, 0*deg, 360.*deg);
MirrorLogicalVolume[i] = new G4LogicalVolume(
MirrorSolid[i], Ni, "Mirror_L", 0, 0, 0 );
MirrorLogicalVolume[i]->SetVisAttributes(VisAttMirror);
// Gold coating on mirror
MirrorAuCoatingSolid[i] = new G4Cons(
"MirrorAuCoating_S",
MirrorEnd[i] - MirrorAuCoating, MirrorEnd[i],
MirrorEnd[i+1] - MirrorAuCoating, MirrorEnd[i+1],
MirrorSectionLength/2, 0*deg, 360.*deg);
MirrorAuCoatingLogicalVolume[i] = new G4LogicalVolume(
MirrorAuCoatingSolid[i],
Au,
"MirrorAuCoating_L",
0, 0, 0 );
MirrorAuCoatingLogicalVolume[i]->SetVisAttributes(VisAttAuCoating);
// Aluminium baffle inside mirror
BaffleSolid[i] = new G4Cons( "Baffle_S",
0, MirrorEnd[i] - BaffleGap,
0, MirrorEnd[i+1] - BaffleGap,
MirrorSectionLength/2, 0*deg, 360.*deg);
BaffleLogicalVolume[i] = new G4LogicalVolume(
BaffleSolid[i], Al, "Baffle_L", 0, 0, 0 );
BaffleLogicalVolume[i]-> SetVisAttributes(VisAttBaffle);
}
// Physical volume
G4VPhysicalVolume* MirrorPhysicalVolume[4];
G4VPhysicalVolume* MirrorAuCoatingPhysicalVolume[4];
G4VPhysicalVolume* BafflePhysicalVolume[4];
for ( i=0; i<4; i++ ) {
MirrorPhysicalVolume[i] = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
"Mirror_P",
MirrorLogicalVolume[i],
physicalWorld, false, 0 );
MirrorAuCoatingPhysicalVolume[i] = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
"MirrorAuCoating_P",
MirrorAuCoatingLogicalVolume[i],
physicalWorld, false, 0 );
BafflePhysicalVolume[i] = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( MirrorPosition[i], 0.0*cm, 0.0*cm ),
"Baffle_P",
BaffleLogicalVolume[i],
physicalWorld, false, 0 );
}
// Make Mirror Invisible
for ( i=0; i<4; i++ ) {
// MirrorLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::Invisible);
// MirrorAuCoatingLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::Invisible);
BaffleLogicalVolume[i] -> SetVisAttributes(G4VisAttributes::Invisible);
}
// Construct Optical Bench
// Main Telescope carbon fibre tube and two aluminium end caps
G4int nel;
G4String symbol;
// Elements
G4Element* C = new G4Element("Carbon", symbol="C", 6., 12.011*g/mole);
G4Element* H = new G4Element("Hydrogen",symbol="H", 1., 1.00794*g/mole);
// Materials from Combination
G4Material* Cf = new G4Material("Carbon Fibre", 2.0*g/cm3, nel=2);
Cf->AddElement(C,1);
Cf->AddElement(H,2);
// Visualization attributes
G4VisAttributes* VisAttBench = new G4VisAttributes(
G4Colour(0/255., 200/255., 0/255.));
// Construct Optical bench
G4double BenchThickness = 1.0*cm;
G4double BenchFrontEndMinRadiusOut = MirrorEnd[4] +
( MirrorEnd[3] - MirrorEnd[4] )*7.5/15
+ MirrorNiThickness;
G4double BenchFrontEndMinRadiusIn = MirrorEnd[4] +
( MirrorEnd[3] - MirrorEnd[4] )*7.4/15
+ MirrorNiThickness;
G4double BenchFrontEndMaxRadius = MirrorEnd[4] + MirrorNiThickness + 25.*cm;
G4double BenchBackEndMinRadius = 0.0*cm;
G4double BenchBackEndMaxRadius = MirrorEnd[4] + MirrorNiThickness + 5.*cm;
G4double BenchMainLength;
BenchMainLength = MirrorPosition[3] - BenchThickness;
G4Cons* BenchFrontEndSolid;
G4Tubs* BenchBackEndSolid;
G4Cons* BenchMainSolid;
G4LogicalVolume* BenchFrontEndLogicalVolume;
G4LogicalVolume* BenchBackEndLogicalVolume;
G4LogicalVolume* BenchMainLogicalVolume;
BenchFrontEndSolid = new G4Cons( "BenchFrontEnd_S",
BenchFrontEndMinRadiusOut, BenchFrontEndMaxRadius,
BenchFrontEndMinRadiusIn, BenchFrontEndMaxRadius,
BenchThickness/2, 0*deg, 360.*deg );
BenchFrontEndLogicalVolume = new G4LogicalVolume(
BenchFrontEndSolid, Al, "BenchFrontEnd_L", 0, 0, 0 );
BenchFrontEndLogicalVolume->SetVisAttributes(VisAttBench);
BenchBackEndSolid = new G4Tubs( "BenchBackEnd_S",
BenchBackEndMinRadius, BenchBackEndMaxRadius,
BenchThickness/2, 0*deg, 360.*deg );
BenchBackEndLogicalVolume = new G4LogicalVolume(
BenchBackEndSolid, Al, "BenchBackEnd_L", 0, 0, 0 );
BenchBackEndLogicalVolume->SetVisAttributes(VisAttBench);
BenchMainSolid = new G4Cons( "BenchMain_S",
BenchFrontEndMaxRadius - BenchThickness,
BenchFrontEndMaxRadius,
BenchBackEndMaxRadius - BenchThickness,
BenchBackEndMaxRadius,
BenchMainLength/2, 0*deg, 360.*deg);
BenchMainLogicalVolume = new G4LogicalVolume(
BenchMainSolid, Cf, "BenchMain_L", 0, 0, 0 );
BenchMainLogicalVolume -> SetVisAttributes(VisAttBench);
// Physical volume
G4VPhysicalVolume* BenchFrontEndPhysicalVolume;
G4VPhysicalVolume* BenchBackEndPhysicalVolume;
G4VPhysicalVolume* BenchMainPhysicalVolume;
BenchFrontEndPhysicalVolume = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( MirrorPosition[3] - BenchThickness/2,
0.0*cm, 0.0*cm ),
"BenchFrontEnd_P",
BenchFrontEndLogicalVolume,
physicalWorld, false, 0 );
BenchBackEndPhysicalVolume = new G4PVPlacement(
rotateMatrix,
G4ThreeVector(0.0*cm - BenchThickness/2, 0.0*cm, 0.0*cm ),
"BenchBackEnd_P",
BenchBackEndLogicalVolume,
physicalWorld, false, 0 );
BenchMainPhysicalVolume = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( BenchMainLength/2, 0.0*cm, 0.0*cm ),
"BenchMain_P",
BenchMainLogicalVolume,
physicalWorld, false, 0 );
//--- Make Bench Invisible
// BenchFrontEndLogicalVolume -> SetVisAttributes(G4VisAttributes::Invisible);
// BenchBackEndLogicalVolume -> SetVisAttributes(G4VisAttributes::Invisible);
BenchMainLogicalVolume -> SetVisAttributes(G4VisAttributes::Invisible);
return;
}
// Construct Focal Plane
// Conical Titanium baffle and silicon detector
void XrayTelDetectorConstruction::ConstructFocalPlane()
{
// Elements
G4Material* Ti = new G4Material("Titanium", 22., 47.867*g/mole, 4.54*g/cm3);
G4Material* Si = new G4Material("Silicon", 14., 28.090*g/mole, 2.33*g/cm3);
// Visualization attributes
G4VisAttributes* VisDetectorBaffle = new G4VisAttributes(
G4Colour(190/255., 255/255., 0/255.) );
G4VisAttributes* VisDetector = new G4VisAttributes(
G4Colour(255/255., 0/255., 0/255.) );
// Rotation Matrix
G4RotationMatrix *rotateMatrix = new G4RotationMatrix();
rotateMatrix -> rotateY(90.*deg);
// Construct Detector Baffle
G4double DetectorBaffleLength = 57.2*cm;
G4double DetectorBaffleOuterRadiusIn = 7.1*cm;
G4double DetectorBaffleOuterRadiusOut = 7.35*cm;
G4double DetectorBaffleInnerRadiusIn = 4.55*cm;
G4double DetectorBaffleInnerRadiusOut = 5.75*cm;
G4Cons* DetectorBaffleSolid;
G4LogicalVolume* DetectorBaffleLogicalVolume;
DetectorBaffleSolid = new G4Cons( "DetectorBaffle_S",
DetectorBaffleOuterRadiusIn,
DetectorBaffleOuterRadiusOut,
DetectorBaffleInnerRadiusIn,
DetectorBaffleInnerRadiusOut,
DetectorBaffleLength/2, 0*deg, 360.*deg);
DetectorBaffleLogicalVolume = new G4LogicalVolume(
DetectorBaffleSolid, Ti, "DetectorBaffle_L", 0, 0, 0 );
DetectorBaffleLogicalVolume -> SetVisAttributes( VisDetectorBaffle );
// Physical volume
G4VPhysicalVolume* DetectorBafflePhysicalVolume;
DetectorBafflePhysicalVolume = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( DetectorBaffleLength/2, 0.0*cm, 0.0*cm),
"DetectorBaffle_P",
DetectorBaffleLogicalVolume,
physicalWorld, false, 0 );
//--- Make Invisible
// DetectorBaffleLogicalVolume -> SetVisAttributes( G4VisAttributes::Invisible );
// Construct Detector
G4double DetectorRadius = 32.5*mm;
G4double DetectorThickness = 50e-6*m;
G4Tubs* DetectorSolid;
G4LogicalVolume* DetectorLogicalVolume;
DetectorSolid = new G4Tubs( "Detector_S",
0, DetectorRadius,
DetectorThickness/2, 0*deg, 360.*deg);
DetectorLogicalVolume = new G4LogicalVolume(
DetectorSolid, Si, "Detector_L", 0, 0, 0 );
DetectorLogicalVolume -> SetVisAttributes( VisDetector );
// Physical volume
G4VPhysicalVolume* DetectorPhysicalVolume;
DetectorPhysicalVolume = new G4PVPlacement(
rotateMatrix,
G4ThreeVector( DetectorThickness/2, 0.0*cm, 0.0*cm),
"Detector_P",
DetectorLogicalVolume,
physicalWorld, false, 0 );
//--- Make Invisible
// DetectorLogicalVolume -> SetVisAttributes( G4VisAttributes::Invisible );
return;
}
@@ -0,0 +1,137 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelEventAction.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope event action
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4ios.hh"
#include "G4Event.hh"
#include "G4EventManager.hh"
#include "G4HCofThisEvent.hh"
#include "G4TrajectoryContainer.hh"
#include "G4Trajectory.hh"
#include "G4VVisManager.hh"
#include "G4UImanager.hh"
#include "G4UnitsTable.hh"
#include "XrayTelEventAction.hh"
#include "XrayTelEventActionMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelEventAction::XrayTelEventAction(G4bool* dEvent)
: drawFlag("all"),eventMessenger(NULL), drawEvent(dEvent)
{
eventMessenger = new XrayTelEventActionMessenger(this);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelEventAction::~XrayTelEventAction()
{
delete eventMessenger;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelEventAction::BeginOfEventAction(const G4Event* Ev)
{
*drawEvent=false;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelEventAction::EndOfEventAction(const G4Event* Ev)
{
if (*drawEvent){
const G4Event* evt = fpEventManager->GetConstCurrentEvent();
G4TrajectoryContainer * trajectoryContainer = evt->GetTrajectoryContainer();
G4int n_trajectories = 0;
if ( trajectoryContainer ){
n_trajectories = trajectoryContainer->entries();
}
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);
trj->ShowTrajectory();
}
}
}
}
@@ -0,0 +1,71 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelEventActionMessenger.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope event action messenger
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4UIcmdWithAString.hh"
#include "globals.hh"
#include "XrayTelEventAction.hh"
#include "XrayTelEventActionMessenger.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelEventActionMessenger::XrayTelEventActionMessenger(XrayTelEventAction* EvAct)
:eventAction(EvAct)
{
DrawCmd = new G4UIcmdWithAString("/event/drawTracks",this);
DrawCmd->SetGuidance("Draw the tracks in the event");
DrawCmd->SetGuidance(" Choice : none, charged, all (default)");
DrawCmd->SetParameterName("choice",true);
DrawCmd->SetDefaultValue("charged");
DrawCmd->SetCandidates("none charged all");
DrawCmd->AvailableForStates(Idle);
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelEventActionMessenger::~XrayTelEventActionMessenger()
{
delete DrawCmd;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelEventActionMessenger::SetNewValue(G4UIcommand * command,G4String newValue)
{
if(command == DrawCmd)
{eventAction->SetDrawFlag(newValue);}
}
@@ -0,0 +1,257 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelPhysicsList.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope Physics list
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4ParticleDefinition.hh"
#include "G4ParticleWithCuts.hh"
#include "G4ProcessManager.hh"
#include "G4ProcessVector.hh"
#include "G4ParticleTypes.hh"
#include "G4ParticleTable.hh"
#include "G4ShortLivedConstructor.hh"
#include "G4Material.hh"
#include "G4MaterialTable.hh"
#include "G4ios.hh"
#include "globals.hh"
#include "XrayTelPhysicsList.hh"
XrayTelPhysicsList::XrayTelPhysicsList(): G4VUserPhysicsList()
{
// Default cut values
defaultCutValue = 2.0*mm;
cutForGamma = 1.0*micrometer;
cutForElectron = 1.0*micrometer;
cutForProton = 1.0*micrometer;
SetVerboseLevel(1);
}
XrayTelPhysicsList::~XrayTelPhysicsList()
{}
void XrayTelPhysicsList::ConstructParticle()
{
// Here are constructed all particles
ConstructBosons();
ConstructLeptons();
ConstructMesons();
ConstructBaryons();
ConstructAllShortLiveds();
}
// In this method, static member functions should be called for ALL particles to be used.
void XrayTelPhysicsList::ConstructBosons()
{
// pseudo-particles
G4Geantino::GeantinoDefinition();
G4ChargedGeantino::ChargedGeantinoDefinition();
// gamma
G4Gamma::GammaDefinition();
// optical photon
G4OpticalPhoton::OpticalPhotonDefinition();
}
void XrayTelPhysicsList::ConstructLeptons()
{
// leptons
G4Electron::ElectronDefinition();
G4Positron::PositronDefinition();
G4NeutrinoE::NeutrinoEDefinition();
G4AntiNeutrinoE::AntiNeutrinoEDefinition();
G4NeutrinoMu::NeutrinoMuDefinition();
G4AntiNeutrinoMu::AntiNeutrinoMuDefinition();
}
void XrayTelPhysicsList::ConstructMesons()
{
}
void XrayTelPhysicsList::ConstructBaryons()
{
// barions
G4Proton::ProtonDefinition();
G4AntiProton::AntiProtonDefinition();
G4Neutron::NeutronDefinition();
G4AntiNeutron::AntiNeutronDefinition();
}
void XrayTelPhysicsList::ConstructAllShortLiveds()
{
}
void XrayTelPhysicsList::ConstructProcess()
{
// Transportation, electromagnetic and general processes
AddTransportation();
ConstructEM();
ConstructGeneral();
}
// Here are respective header files for chosen processes
#include "G4ComptonScattering.hh"
#include "G4GammaConversion.hh"
#include "G4PhotoElectricEffect.hh"
#include "G4eIonisation.hh"
#include "G4eBremsstrahlung.hh"
#include "G4eplusAnnihilation.hh"
#include "G4MultipleScattering.hh"
#include "G4hLowEnergyIonisation.hh"
void XrayTelPhysicsList::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 ((!particle->IsShortLived()) &&
(particle->GetPDGCharge() != 0.0) &&
(particle->GetParticleName() != "chargedgeantino"))
{
//all others charged particles except geantino
pmanager->AddProcess(new G4MultipleScattering(),-1,1,1);
G4double demax = 0.05; // try to lose at most 5% of the energy in
// a single step (in limit of large energies)
G4double stmin = 1.e-9 * m; // length of the final step: 10 angstrom
// reproduced angular distribution of TRIM
G4hLowEnergyIonisation* lowEIonisation = new G4hLowEnergyIonisation();
pmanager->AddProcess( lowEIonisation, -1,2,2);
lowEIonisation->SetStepFunction( demax, stmin );
}
}
}
#include "G4Decay.hh"
void XrayTelPhysicsList::ConstructGeneral()
{
G4Decay* theDecayProcess = new G4Decay();
theParticleIterator->reset();
while( (*theParticleIterator)() ){
G4ParticleDefinition* particle = theParticleIterator->value();
G4ProcessManager* pmanager = particle->GetProcessManager();
if (theDecayProcess->IsApplicable(*particle)) {
pmanager ->AddProcess(theDecayProcess);
pmanager ->SetProcessOrdering(theDecayProcess, idxPostStep);
pmanager ->SetProcessOrdering(theDecayProcess, idxAtRest);
}
}
}
void XrayTelPhysicsList::SetCuts()
{
// defaultCutValue you have typed in is used
if (verboseLevel >1){
G4cout << "XrayTelPhysicsList::SetCuts:" << G4endl;
}
// set cut values for gamma at first and for e- second
SetCutValue(cutForGamma, "gamma");
SetCutValue(cutForElectron, "e-");
SetCutValue(cutForElectron, "e+");
// set cut values for proton
SetCutValue(cutForProton, "proton");
SetCutValue(cutForProton, "anti_proton");
SetCutValueForOthers(defaultCutValue);
if (verboseLevel >1) {
DumpCutValuesTable();
}
}
void XrayTelPhysicsList::SetCutForGamma(G4double cut)
{
ResetCuts();
cutForGamma = cut;
}
void XrayTelPhysicsList::SetCutForElectron(G4double cut)
{
ResetCuts();
cutForElectron = cut;
}
void XrayTelPhysicsList::SetCutForProton(G4double cut)
{
ResetCuts();
cutForProton = cut;
}
G4double XrayTelPhysicsList::GetCutForGamma() const
{
return cutForGamma;
}
G4double XrayTelPhysicsList::GetCutForElectron() const
{
return cutForElectron;
}
G4double XrayTelPhysicsList::GetCutForProton() const
{
return cutForProton;
}
@@ -0,0 +1,59 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelPrimaryGeneratorAction.cc *
// * ------- *
// * *
// * Version: 0.5 *
// * Date: 15/11/00 *
// * Author: F.Lei *
// * Organisation: DERA, UK *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 15.11.2000 F.Lei
// - New version of PrimaryGeneratorAction using the GPS insead of the
// standard particle gun.
// - The PrimaryGeneratorMessenger is no longer needed.
//
// 06.11.2000 R.Nartallo
// - First implementation of PrimaryGeneratorAction
// - Based on Chandra and XMM models by S Magni and F Lei
//
// **********************************************************************
#include "G4Event.hh"
#include "G4GeneralParticleSource.hh"
#include "XrayTelPrimaryGeneratorAction.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelPrimaryGeneratorAction::XrayTelPrimaryGeneratorAction()
{
particleGun = new G4GeneralParticleSource ();
}
XrayTelPrimaryGeneratorAction::~XrayTelPrimaryGeneratorAction()
{
delete particleGun;
}
void XrayTelPrimaryGeneratorAction::GeneratePrimaries(G4Event* anEvent)
{
particleGun->GeneratePrimaryVertex(anEvent);
}
@@ -0,0 +1,151 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelRunAction.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 R. Nartallo
// - Add pre-processor directives to compile without analysis option
//
// 16.11.2000 A. Pfeiffer
// - Implementation of analysis manager call
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope Physics list
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4Run.hh"
#include "G4UImanager.hh"
#include "G4VVisManager.hh"
#include "G4ios.hh"
#include "g4std/fstream"
#include "g4std/vector"
#include "XrayTelRunAction.hh"
#include "XrayTelAnalysisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelRunAction::XrayTelRunAction(G4std::vector<G4double*> *enEnergy,
G4std::vector<G4ThreeVector*> *enDirect,
G4bool* dEvent,
XrayTelAnalysisManager* aAnalysisManager)
:enteringEnergy(enEnergy),
enteringDirection(enDirect),drawEvent(dEvent),
fAnalysisManager(aAnalysisManager)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelRunAction::~XrayTelRunAction()
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelRunAction::BeginOfRunAction(const G4Run* aRun)
{
G4int RunN = aRun->GetRunID();
if ( RunN % 1000 == 0 )
G4cout << "### Run : " << RunN << G4endl;
if (G4VVisManager::GetConcreteInstance()) {
G4UImanager* UI = G4UImanager::GetUIpointer();
UI->ApplyCommand("/vis/clear/view");
UI->ApplyCommand("/vis/draw/current");
}
enteringEnergy->clear();
enteringDirection->clear();
#ifdef G4ANALYSIS_USE
if(fAnalysisManager) fAnalysisManager->BeginOfRun();
#endif
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelRunAction::EndOfRunAction(const G4Run* )
{
G4int i;
if (G4VVisManager::GetConcreteInstance())
G4UImanager::GetUIpointer()->ApplyCommand("/vis/show/view");
G4std::ofstream outscat("detector.hist", ios::app);
G4cout << "End of Run summary" << G4endl << G4endl;
G4double totEnteringEnergy = 0.0;
for (i=0;i< enteringEnergy->size();i++)
totEnteringEnergy += *(*enteringEnergy)[i];
G4cout << "Total Entering Detector : " << enteringEnergy->size() << G4endl;
G4cout << "Total Entering Detector Energy : " << totEnteringEnergy << G4endl;
for (i=0;i<enteringEnergy->size();i++) {
outscat << " "
<< *(*enteringEnergy)[i]
<< " "
<< (*enteringDirection)[i]->x()
<< " "
<< (*enteringDirection)[i]->y()
<< " "
<< (*enteringDirection)[i]->z()
<< G4endl;
}
outscat.close();
#ifdef G4ANALYSIS_USE
if(fAnalysisManager) fAnalysisManager->EndOfRun();
#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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelStepCut.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope Physics list
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4Step.hh"
#include "G4VParticleChange.hh"
#include "G4EnergyLossTables.hh"
#include "XrayTelStepCut.hh"
XrayTelStepCut::XrayTelStepCut(const G4String& aName)
: G4VDiscreteProcess(aName),MaxChargedStep(DBL_MAX)
{
if (verboseLevel>0) {
G4cout << GetProcessName() << " is created "<< G4endl;
}
}
XrayTelStepCut::~XrayTelStepCut()
{
}
XrayTelStepCut::XrayTelStepCut(XrayTelStepCut& right)
:G4VDiscreteProcess(right)
{}
void XrayTelStepCut::SetMaxStep(G4double step)
{
MaxChargedStep = step ;
}
@@ -0,0 +1,115 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelSteppingAction.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 30.11.2000 R. Nartallo
// - Add pre-processor directives to compile without analysis option
//
// 16.11.2000 A. Pfeiffer
// - Implementation of analysis manager call
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope Physics list
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#include "G4ios.hh"
#include "G4Track.hh"
#include "G4SteppingManager.hh"
#include "globals.hh"
#include <assert.h>
#include "g4std/fstream"
#include "g4std/iomanip"
#include "g4std/iostream"
#include "g4std/vector"
#include "XrayTelSteppingAction.hh"
#include "XrayTelAnalysisManager.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelSteppingAction::XrayTelSteppingAction(
G4std::vector<G4double*>* enEnergy,
G4std::vector<G4ThreeVector*>* enDirect,
G4bool* dEvent,
XrayTelAnalysisManager* aAnalysisManager)
: enteringEnergy(enEnergy),
enteringDirection(enDirect),drawEvent(dEvent),
fAnalysisManager(aAnalysisManager)
{;}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
XrayTelSteppingAction::~XrayTelSteppingAction()
{ }
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelSteppingAction::UserSteppingAction(const G4Step*)
{
const G4SteppingManager* pSM = fpSteppingManager;
G4Track* fTrack = pSM->GetTrack();
G4Step* fStep = pSM->GetStep();
G4int TrackID = fTrack->GetTrackID();
G4int StepNo = fTrack->GetCurrentStepNumber();
if(StepNo >= 10000) fTrack->SetTrackStatus(fStopAndKill);
G4String volName;
if ( fTrack->GetVolume() )
volName = fTrack->GetVolume()->GetName();
G4String nextVolName;
if ( fTrack->GetNextVolume() )
nextVolName = fTrack->GetNextVolume()->GetName();
G4ThreeVector pos = fTrack->GetPosition();
//--- Entering Detector
if(volName != "Detector_P" && nextVolName == "Detector_P") {
enteringEnergy->push_back ( new G4double (fTrack->GetKineticEnergy()) );
enteringDirection->push_back (new G4ThreeVector (pos));
// now we want to do some analysis at this step ...
// call back to the analysis-manger to do the analysis ...
#ifdef G4ANALYSIS_USE
if(fAnalysisManager) fAnalysisManager->Step(fpSteppingManager);
#endif
*drawEvent = true;
}
}
@@ -0,0 +1,157 @@
// 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.
//
// **********************************************************************
// * *
// * GEANT 4 xray_telescope advanced example *
// * *
// * MODULE: XrayTelVisManager.cc *
// * ------- *
// * *
// * Version: 0.4 *
// * Date: 06/11/00 *
// * Author: R Nartallo *
// * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands *
// * *
// **********************************************************************
//
// CHANGE HISTORY
// --------------
//
// 06.11.2000 R.Nartallo
// - First implementation of xray_telescope Physics list
// - Based on Chandra and XMM models
//
//
// **********************************************************************
#ifdef G4VIS_USE
#include "XrayTelVisManager.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_RAYX
#include "G4RayX.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....
XrayTelVisManager::XrayTelVisManager () {}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
void XrayTelVisManager::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_RAYX
RegisterGraphicsSystem (new G4RayX);
#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....
+20
View File
@@ -0,0 +1,20 @@
/run/verbose 1
/tracking/storeTrajectory 1
/gps/particle proton
/gps/type Plane
/gps/shape Annulus
/gps/posrot1 0. 0. 1.
/gps/posrot2 0. 1. 0.
/gps/radius 35.5 cm
/gps/radius0 30.5 cm
/gps/centre 780.1 0. 0. cm
/gps/angtype cos
/gps/angrot1 0. 0. 1.
/gps/angrot2 0. 1. 0.
/gps/maxtheta 1. deg
/gps/energytype Mono
/gps/monoenergy 0.5 MeV
/run/beamOn 100000
+142
View File
@@ -0,0 +1,142 @@
#######################################################################
# #
# 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. #
# #
# ******************************************************************* #
# * * #
# * GEANT 4 xray_telescope advanced example * #
# * * #
# * MACRO: vrml.mac * #
# * ------ demostrates the VRML DRIVER * #
# * * #
# * Version: 0.6 * #
# * Date: 15/11/00 * #
# * Author: R Nartallo * #
# * Organisation: ESA/ESTEC, Noordwijk, THe Netherlands * #
# * * #
# ******************************************************************* #
# #
# NOTES #
# ----- #
# USAGE: Idle> /control/execute vrml.mac #
# prompt> XrayTel vrml.mac #
# #
# REQUIRED PLATFORMS & SOFTWARE: VRML viewer, e.g. VRMLview #
# #
# ENVIRONMENT VARIABLES (C-MACROS) FOR INSTALLATION: #
# (See geant4/source/visualization/README for details.) #
# #
# % setenv G4VIS_USE_VRML 1 #
# % setenv G4VIS_USE_VRMLFILE 1 #
# % setenv G4VIS_BUILD_VRMLFILE_DRIVER 1 #
# #
# RECOMMENDED ENVIRONMENT VARIABLES FOR THE VRML VIEWER: #
# #
# % setenv G4VRMLFILE_VIEWER vrmlview //default value is "NONE" #
# % setenv G4VRMLFILE_MAX_FILE_NUM 100 //default value is "1" #
# #
# Addional Notes: #
# You may have to set the command path to the directory where #
# a VRML viewer is installed, e.g., to #
# "/afs/cern.ch/sw/contrib/VRML/bin/Linux/" at CERN #
# #
#######################################################################
# #
# CHANGE HISTORY #
# -------------- #
# #
# 15.11.2000 R. Nartallo #
# - Replaced standard particle gun by GPS set options #
# #
# 08.11.2000 R. Nartallo #
# - Modified version #
# #
# 17.10.2000 S. Tanaka #
# - First implementation #
# #
#######################################################################
# Set verbose level
/run/verbose 2
#################################################
# Visualization of detector geometry with
# the VRML2FILE driver.
#################################################
# Invoke the VRML2FILE driver
#/vis/open VRML2FILE
# Visualize of the whole detector geometry
#/vis/viewer/set/style surface
#/vis/drawVolume
#/vis/viewer/update
#################################################
# Visualization of detector geometry and events
# with the VRML2FILE driver.
#################################################
# Invoke the VRML2FILE driver
/vis/open VRML2FILE
# Create a new scene
/vis/scene/create
# Add the world volume to the current scene
/vis/scene/add/volume
# Attach the current scene handler to the current scene
/vis/sceneHandler/attach
# Visualize one event added to the current scene
# * Command "/vis/scene/notifyHandlers" is written in
# XrayTelRunAction::BeginOfRunAction()
# * Command "/vis/viewer/update" is written in
# XrayTelRunAction::EndOfRunAction()
# Set viewer rendering style
# "wireframe" means "half-transparent" in VRML2FILE driver
#/vis/viewer/set/style surface
/vis/viewer/set/style wireframe
# Store particle trajactories for visualization
/tracking/storeTrajectory 1
# Set to draw tracks of positively charged particles
/event/drawTracks charged
# Set General Particle Source options
/gps/particle proton
/gps/type Plane
/gps/shape Annulus
/gps/posrot1 0. 0. 1.
/gps/posrot2 0. 1. 0.
/gps/radius 35.5 cm
/gps/radius0 30.5 cm
/gps/centre 780.1 0. 0. cm
/gps/angtype cos
/gps/angrot1 0. 0. 1.
/gps/angrot2 0. 1. 0.
/gps/maxtheta 1. deg
/gps/energytype Mono
/gps/monoenergy 0.5 MeV
# Set number of particles and start
/run/beamOn 10000
@@ -0,0 +1,87 @@
// 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: AnaEx01.cc,v 1.6 2000/11/15 13:46:23 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// --------------------------------------------------------------
// GEANT 4 - exampleN03
//
// For information related to this code contact:
// CERN, IT Division, ASD Group
// --------------------------------------------------------------
// Comments
//
// --------------------------------------------------------------
#include "G4RunManager.hh"
#include "G4UImanager.hh"
#include "G4UIterminal.hh"
#include "Randomize.hh"
#ifdef G4ANALYSIS_USE
#include "AnaEx01AnalysisManager.hh"
#endif
#include "AnaEx01DetectorConstruction.hh"
#include "AnaEx01PhysicsList.hh"
#include "AnaEx01PrimaryGeneratorAction.hh"
#include "AnaEx01RunAction.hh"
#include "AnaEx01EventAction.hh"
#include "AnaEx01SteppingAction.hh"
#include "AnaEx01SteppingVerbose.hh"
int main(int argc,char** argv) {
// choose the Random engine
HepRandom::setTheEngine(new RanecuEngine);
//my Verbose output class
G4VSteppingVerbose::SetInstance(new AnaEx01SteppingVerbose);
// Construct the default run manager
G4RunManager * runManager = new G4RunManager;
// set mandatory initialization classes
AnaEx01DetectorConstruction* detector = new AnaEx01DetectorConstruction;
runManager->SetUserInitialization(detector);
runManager->SetUserInitialization(new AnaEx01PhysicsList);
#ifdef G4ANALYSIS_USE
AnaEx01AnalysisManager* analysisManager =
new AnaEx01AnalysisManager(argc==1?"Lab":argv[1]);
runManager->SetUserAction(new AnaEx01PrimaryGeneratorAction(detector));
runManager->SetUserAction(new AnaEx01RunAction(analysisManager));
runManager->SetUserAction(new AnaEx01EventAction(analysisManager));
runManager->SetUserAction(new AnaEx01SteppingAction(analysisManager));
#else
runManager->SetUserAction(new AnaEx01PrimaryGeneratorAction(detector));
runManager->SetUserAction(new AnaEx01RunAction());
runManager->SetUserAction(new AnaEx01EventAction());
runManager->SetUserAction(new AnaEx01SteppingAction());
#endif
//Initialize G4 kernel
runManager->Initialize();
// get the pointer to the User Interface manager
G4UImanager* UI = G4UImanager::GetUIpointer();
// Batch mode
UI->ApplyCommand("/control/execute run.mac");
// job termination
#ifdef G4ANALYSIS_USE
delete analysisManager;
#endif
delete runManager;
return 0;
}
@@ -0,0 +1,17 @@
# $Id: GNUmakefile,v 1.1.1.1 2000/09/14 11:37:21 barrand Exp $
# --------------------------------------------------------------
# GNUmakefile for examples module. Gabriele Cosmo, 06/04/98.
# --------------------------------------------------------------
name := AnaEx01
G4TARGET := $(name)
G4EXLIB := true
ifndef G4INSTALL
G4INSTALL = ../../../..
endif
.PHONY: all
all: lib bin
include $(G4INSTALL)/config/binmake.gmk
@@ -0,0 +1,19 @@
$Id: History,v 1.1.1.1 2000/09/14 11:37:21 barrand Exp $
--------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
Example AnaEx01 History file
----------------------------
This file should be used by the G4 example coordinator to briefly
summarize all major modifications introduced in the code and keep
track of all tags.
----------------------------------------------------------
* Reverse chronological order (last date on top), please *
----------------------------------------------------------
14 September 2000, Guy Barrand :
- Birth.
+68
View File
@@ -0,0 +1,68 @@
$Id: README,v 1.6 2000/12/06 13:08:13 barrand Exp $
-------------------------------------------------------------------
=========================================================
Geant4 - an Object-Oriented Toolkit for Simulation in HEP
=========================================================
AnaEx01
-------
This example shows the usage of histogramming with the
analysis category.
To use the G4AnalysisManager the source/analysis category
must have been reconstructed with one of the environment
variable setted :
G4ANALYSIS_BUILD_JAS
G4ANALYSIS_BUILD_LAB
G4ANALYSIS_BUILD_LIZARD
To use an analysis system with this example, the coresponding
environment variable must be setted :
G4ANALYSIS_USE_JAS
G4ANALYSIS_USE_LAB
G4ANALYSIS_USE_LIZARD
Then to cosntruct this example :
csh> cd $G4INSTALL/examples/extended/analysis/AnaEx01
csh> setenv G4ANALYSIS_USE_JAS 1
csh> setenv G4ANALYSIS_USE_LAB 1
csh> setenv G4ANALYSIS_USE_LIZARD 1
csh> gmake
Working with the Lab package :
----------------------------
If working with the Lab package run the program
from the analysis/Lab directory :
csh> cd analyis/Lab
csh> $G4WORKDIR/bin/$G4SYSTEM/AnaEx01 Lab
It must produce a g4osc.root file that contains
some histograms. You can visualize them with :
csh> source <path>/Lab/<version>/cmt/setup.csh
csh> oxm
and click in File/session to execute the session.tcl
file.
Working with jas :
--------------------------
If working with jas :
csh> cd $G4INSTALL/examples/extended/analysis/AnaEx01
csh> $G4WORKDIR/bin/$G4SYSTEM/AnaEx01 jas
The program will pend for a connection toward jas, then
spawn jas :
csh> <path_to_jas_bin>/jas
From jas panel, open a connection toward the AnaEx01 job :
- File/Reconnect
- Give no server name if running on same machine.
- Next to end the connect panel.
When connection is established, the tree widget
on the left of jas panel must display "G4Job".
Click on the tree items to access an histogram.
Double click on the histogram name to visualize it.
The histogram will update itself according time.
@@ -0,0 +1,19 @@
#
# Macro file for "AnEx01.cc"
#
# (can be run in batch, without graphic)
#
#/control/verbose 2
#/control/saveHistory
#
#/run/verbose 2
#/event/verbose 0
#/tracking/verbose 1
#
# muon 300 MeV to the direction (1.,0.,0.)
# 3 events
#
#/gun/particle mu+
/gun/particle e+
/gun/energy 300 MeV
/run/beamOn 100
@@ -0,0 +1,49 @@
#/////////////////////////////////////////////////////////////////////////////
#/////////////////////////////////////////////////////////////////////////////
#/////////////////////////////////////////////////////////////////////////////
#
# Example of tcl script using a root file.
#
#/////////////////////////////////////////////////////////////////////////////
# If reexecuted :
delete storage
delete v
#
# Get a SWIG handler over the current viewer :
IViewer v -this [ui getCurrentViewer]
v reset page
#
# 2x2 regions :
#v set page "2 2"
v set pageTitle "G4 analysis with Open Scientist"
#
RioStorage storage g4osc.root READ
storage ls
#
delete EAbs
#
#storage cd histograms
#storage ls
#
# Get some histograms with the H1Get
# builtin procedure defined in Lab/user/init.tcl :
# In the below the first "EAbs" is a variable and
# the second is the name of the object in the storage
# (the SID, storage identifier) :
# H1DGet <variable> <storage> <SID>
H1DGet EAbs storage EAbs
#
# Plot the histo :
EAbs vis
#
v set textContext "color black fontName TTF/couri"
v set histogramContext "color red modeling solid"
#
# Fit :
#delete fitExp
#
#Exponential fitExp 0. 1.
#fitExp fit [& EAbs]
#
#fitExp vis
#
@@ -0,0 +1,19 @@
#
# Macro file for "AnEx01.cc"
#
# (can be run in batch, without graphic)
#
#/control/verbose 2
#/control/saveHistory
#
#/run/verbose 2
#/event/verbose 0
#/tracking/verbose 1
#
# muon 300 MeV to the direction (1.,0.,0.)
# 3 events
#
#/gun/particle mu+
/gun/particle e+
/gun/energy 300 MeV
/run/beamOn 10000
@@ -0,0 +1,55 @@
// 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: AnaEx01AnalysisManager.hh,v 1.3 2000/10/31 13:10:00 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
// Example Analysis Manager implementing virtual function
// RegisterAnalysisSystems. Exploits C-pre-processor variables
// G4ANALYSIS_USE_JAS, etc., which are set by the GNUmakefiles if
// environment variables of the same name are set.
// So all you have to do is set environment variables and compile and
// instantiate this in your main().
#ifndef AnaEx01AnalysisManager_h
#define AnaEx01AnalysisManager_h 1
#ifdef G4ANALYSIS_USE
#include "G4AnalysisManager.hh"
class G4Run;
class G4Event;
class G4Step;
class IHistogram1D;
//class ITuple;
class AnaEx01AnalysisManager: public G4AnalysisManager {
public:
AnaEx01AnalysisManager(const G4String&);
public:
virtual void BeginOfRun(const G4Run*);
virtual void EndOfRun(const G4Run*);
virtual void BeginOfEvent(const G4Event*);
virtual void EndOfEvent(const G4Event*);
virtual void Step(const G4Step*);
private:
G4int fCalorimeterCollID;
IHistogram1D* fEAbs;
IHistogram1D* fLAbs;
IHistogram1D* fEGap;
IHistogram1D* fLGap;
//ITuple* fTuple;
};
#endif
#endif
@@ -0,0 +1,82 @@
// 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: AnaEx01CalorHit.hh,v 1.1.1.1 2000/09/14 11:37:21 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef AnaEx01CalorHit_h
#define AnaEx01CalorHit_h 1
#include "G4VHit.hh"
#include "G4THitsCollection.hh"
#include "G4Allocator.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class AnaEx01CalorHit : public G4VHit
{
public:
AnaEx01CalorHit();
~AnaEx01CalorHit();
AnaEx01CalorHit(const AnaEx01CalorHit&);
const AnaEx01CalorHit& operator=(const AnaEx01CalorHit&);
int operator==(const AnaEx01CalorHit&) const;
inline void* operator new(size_t);
inline void operator delete(void*);
void Draw();
void Print();
public:
void AddAbs(G4double de, G4double dl) {EdepAbs += de; TrackLengthAbs += dl;};
void AddGap(G4double de, G4double dl) {EdepGap += de; TrackLengthGap += dl;};
G4double GetEdepAbs() { return EdepAbs; };
G4double GetTrakAbs() { return TrackLengthAbs; };
G4double GetEdepGap() { return EdepGap; };
G4double GetTrakGap() { return TrackLengthGap; };
private:
G4double EdepAbs, TrackLengthAbs;
G4double EdepGap, TrackLengthGap;
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
typedef G4THitsCollection<AnaEx01CalorHit> AnaEx01CalorHitsCollection;
extern G4Allocator<AnaEx01CalorHit> AnaEx01CalorHitAllocator;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void* AnaEx01CalorHit::operator new(size_t)
{
void* aHit;
aHit = (void*) AnaEx01CalorHitAllocator.MallocSingle();
return aHit;
}
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void AnaEx01CalorHit::operator delete(void* aHit)
{
AnaEx01CalorHitAllocator.FreeSingle((AnaEx01CalorHit*) aHit);
}
#endif
@@ -0,0 +1,51 @@
// 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: AnaEx01CalorimeterSD.hh,v 1.1.1.1 2000/09/14 11:37:21 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef AnaEx01CalorimeterSD_h
#define AnaEx01CalorimeterSD_h 1
#include "G4VSensitiveDetector.hh"
#include "globals.hh"
class AnaEx01DetectorConstruction;
class G4HCofThisEvent;
class G4Step;
#include "AnaEx01CalorHit.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class AnaEx01CalorimeterSD : public G4VSensitiveDetector
{
public:
AnaEx01CalorimeterSD(G4String, AnaEx01DetectorConstruction* );
~AnaEx01CalorimeterSD();
void Initialize(G4HCofThisEvent*);
G4bool ProcessHits(G4Step*,G4TouchableHistory*);
void EndOfEvent(G4HCofThisEvent*);
void clear();
void DrawAll();
void PrintAll();
private:
AnaEx01CalorHitsCollection* CalCollection;
AnaEx01DetectorConstruction* Detector;
G4int* HitID;
};
#endif
@@ -0,0 +1,140 @@
// 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: AnaEx01DetectorConstruction.hh,v 1.1.1.1 2000/09/14 11:37:21 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef AnaEx01DetectorConstruction_h
#define AnaEx01DetectorConstruction_h 1
#include "G4VUserDetectorConstruction.hh"
#include "globals.hh"
class G4Box;
class G4LogicalVolume;
class G4VPhysicalVolume;
class G4Material;
class G4UniformMagField;
class AnaEx01DetectorMessenger;
class AnaEx01CalorimeterSD;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class AnaEx01DetectorConstruction : public G4VUserDetectorConstruction
{
public:
AnaEx01DetectorConstruction();
~AnaEx01DetectorConstruction();
public:
void SetAbsorberMaterial (G4String);
void SetAbsorberThickness(G4double);
void SetGapMaterial (G4String);
void SetGapThickness(G4double);
void SetCalorSizeYZ(G4double);
void SetNbOfLayers (G4int);
void SetMagField(G4double);
G4VPhysicalVolume* Construct();
void UpdateGeometry();
public:
void PrintCalorParameters();
G4double GetWorldSizeX() {return WorldSizeX;};
G4double GetWorldSizeYZ() {return WorldSizeYZ;};
G4double GetCalorThickness() {return CalorThickness;};
G4double GetCalorSizeYZ() {return CalorSizeYZ;};
G4int GetNbOfLayers() {return NbOfLayers;};
G4Material* GetAbsorberMaterial() {return AbsorberMaterial;};
G4double GetAbsorberThickness() {return AbsorberThickness;};
G4Material* GetGapMaterial() {return GapMaterial;};
G4double GetGapThickness() {return GapThickness;};
const G4VPhysicalVolume* GetphysiWorld() {return physiWorld;};
const G4VPhysicalVolume* GetAbsorber() {return physiAbsorber;};
const G4VPhysicalVolume* GetGap() {return physiGap;};
private:
G4Material* AbsorberMaterial;
G4double AbsorberThickness;
G4Material* GapMaterial;
G4double GapThickness;
G4int NbOfLayers;
G4double LayerThickness;
G4double CalorSizeYZ;
G4double CalorThickness;
G4Material* defaultMaterial;
G4double WorldSizeYZ;
G4double WorldSizeX;
G4Box* solidWorld; //pointer to the solid World
G4LogicalVolume* logicWorld; //pointer to the logical World
G4VPhysicalVolume* physiWorld; //pointer to the physical World
G4Box* solidCalor; //pointer to the solid Calor
G4LogicalVolume* logicCalor; //pointer to the logical Calor
G4VPhysicalVolume* physiCalor; //pointer to the physical Calor
G4Box* solidLayer; //pointer to the solid Layer
G4LogicalVolume* logicLayer; //pointer to the logical Layer
G4VPhysicalVolume* physiLayer; //pointer to the physical Layer
G4Box* solidAbsorber; //pointer to the solid Absorber
G4LogicalVolume* logicAbsorber; //pointer to the logical Absorber
G4VPhysicalVolume* physiAbsorber; //pointer to the physical Absorber
G4Box* solidGap; //pointer to the solid Gap
G4LogicalVolume* logicGap; //pointer to the logical Gap
G4VPhysicalVolume* physiGap; //pointer to the physical Gap
G4UniformMagField* magField; //pointer to the magnetic field
AnaEx01DetectorMessenger* detectorMessenger; //pointer to the Messenger
AnaEx01CalorimeterSD* calorimeterSD; //pointer to the sensitive detector
private:
void DefineMaterials();
void ComputeCalorParameters();
G4VPhysicalVolume* ConstructCalorimeter();
};
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
inline void AnaEx01DetectorConstruction::ComputeCalorParameters()
{
// Compute derived parameters of the calorimeter
LayerThickness = AbsorberThickness + GapThickness;
CalorThickness = NbOfLayers*LayerThickness;
WorldSizeX = 1.2*CalorThickness; WorldSizeYZ = 1.2*CalorSizeYZ;
}
#endif
@@ -0,0 +1,54 @@
// 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: AnaEx01DetectorMessenger.hh,v 1.1.1.1 2000/09/14 11:37:21 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef AnaEx01DetectorMessenger_h
#define AnaEx01DetectorMessenger_h 1
#include "globals.hh"
#include "G4UImessenger.hh"
class AnaEx01DetectorConstruction;
class G4UIdirectory;
class G4UIcmdWithAString;
class G4UIcmdWithAnInteger;
class G4UIcmdWithADoubleAndUnit;
class G4UIcmdWithoutParameter;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class AnaEx01DetectorMessenger: public G4UImessenger
{
public:
AnaEx01DetectorMessenger(AnaEx01DetectorConstruction* );
~AnaEx01DetectorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
AnaEx01DetectorConstruction* AnaEx01Detector;
G4UIdirectory* AnaEx01detDir;
G4UIcmdWithAString* AbsMaterCmd;
G4UIcmdWithAString* GapMaterCmd;
G4UIcmdWithADoubleAndUnit* AbsThickCmd;
G4UIcmdWithADoubleAndUnit* GapThickCmd;
G4UIcmdWithADoubleAndUnit* SizeYZCmd;
G4UIcmdWithAnInteger* NbLayersCmd;
G4UIcmdWithADoubleAndUnit* MagFieldCmd;
G4UIcmdWithoutParameter* UpdateCmd;
};
#endif
@@ -0,0 +1,33 @@
// 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: AnaEx01EventAction.hh,v 1.3 2000/11/10 14:12:07 gbarrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
#ifndef AnaEx01EventAction_h
#define AnaEx01EventAction_h
#include "G4UserEventAction.hh"
class AnaEx01AnalysisManager;
class AnaEx01EventAction : public G4UserEventAction {
public:
AnaEx01EventAction(AnaEx01AnalysisManager* = 0);
virtual ~AnaEx01EventAction();
public:
virtual void BeginOfEventAction(const G4Event*);
virtual void EndOfEventAction(const G4Event*);
private:
AnaEx01AnalysisManager* fAnalysisManager;
};
#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: AnaEx01PhysicsList.hh,v 1.1.1.1 2000/09/14 11:37:21 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef AnaEx01PhysicsList_h
#define AnaEx01PhysicsList_h 1
#include "G4VUserPhysicsList.hh"
#include "globals.hh"
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class AnaEx01PhysicsList: public G4VUserPhysicsList
{
public:
AnaEx01PhysicsList();
~AnaEx01PhysicsList();
protected:
// Construct particle and physics
void ConstructParticle();
void ConstructProcess();
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,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: AnaEx01PrimaryGeneratorAction.hh,v 1.1.1.1 2000/09/14 11:37:21 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef AnaEx01PrimaryGeneratorAction_h
#define AnaEx01PrimaryGeneratorAction_h 1
#include "G4VUserPrimaryGeneratorAction.hh"
#include "globals.hh"
class G4ParticleGun;
class G4Event;
class AnaEx01DetectorConstruction;
class AnaEx01PrimaryGeneratorMessenger;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class AnaEx01PrimaryGeneratorAction : public G4VUserPrimaryGeneratorAction
{
public:
AnaEx01PrimaryGeneratorAction(AnaEx01DetectorConstruction*);
~AnaEx01PrimaryGeneratorAction();
public:
void GeneratePrimaries(G4Event*);
void SetRndmFlag(G4String val) { rndmFlag = val;}
private:
G4ParticleGun* particleGun; //pointer a to G4 service class
AnaEx01DetectorConstruction* AnaEx01Detector; //pointer to the geometry
AnaEx01PrimaryGeneratorMessenger* gunMessenger; //messenger of this class
G4String rndmFlag; //flag for a random impact point
};
#endif
@@ -0,0 +1,41 @@
// 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: AnaEx01PrimaryGeneratorMessenger.hh,v 1.1.1.1 2000/09/14 11:37:21 barrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
#ifndef AnaEx01PrimaryGeneratorMessenger_h
#define AnaEx01PrimaryGeneratorMessenger_h 1
#include "G4UImessenger.hh"
#include "globals.hh"
class AnaEx01PrimaryGeneratorAction;
class G4UIcmdWithAString;
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo....
class AnaEx01PrimaryGeneratorMessenger: public G4UImessenger
{
public:
AnaEx01PrimaryGeneratorMessenger(AnaEx01PrimaryGeneratorAction*);
~AnaEx01PrimaryGeneratorMessenger();
void SetNewValue(G4UIcommand*, G4String);
private:
AnaEx01PrimaryGeneratorAction* AnaEx01Action;
G4UIcmdWithAString* RndmCmd;
};
#endif
@@ -0,0 +1,32 @@
// 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: AnaEx01RunAction.hh,v 1.3 2000/11/10 14:12:07 gbarrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
#ifndef AnaEx01RunAction_h
#define AnaEx01RunAction_h
#include "G4UserRunAction.hh"
class AnaEx01AnalysisManager;
class AnaEx01RunAction : public G4UserRunAction {
public:
AnaEx01RunAction(AnaEx01AnalysisManager* = 0);
~AnaEx01RunAction();
public:
void BeginOfRunAction(const G4Run*);
void EndOfRunAction(const G4Run*);
private:
AnaEx01AnalysisManager* fAnalysisManager;
};
#endif
@@ -0,0 +1,29 @@
// 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: AnaEx01SteppingAction.hh,v 1.3 2000/11/10 14:12:07 gbarrand Exp $
// GEANT4 tag $Name: geant4-03-00 $
//
//
#ifndef AnaEx01SteppingAction_h
#define AnaEx01SteppingAction_h
#include "G4UserSteppingAction.hh"
class AnaEx01AnalysisManager;
class AnaEx01SteppingAction : public G4UserSteppingAction {
public:
AnaEx01SteppingAction(AnaEx01AnalysisManager* = 0);
virtual ~AnaEx01SteppingAction();
virtual void UserSteppingAction(const G4Step*);
private:
AnaEx01AnalysisManager* fAnalysisManager;
};
#endif

Some files were not shown because too many files have changed in this diff Show More