Geant4
9.6.p02
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
geant4_9_6_p02
examples
advanced
medical_linac
src
ML2PhaseSpaces.cc
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
// The code was written by :
27
// ^Claudio Andenna claudio.andenna@ispesl.it, claudio.andenna@iss.infn.it
28
// *Barbara Caccia barbara.caccia@iss.it
29
// with the support of Pablo Cirrone (LNS, INFN Catania Italy)
30
// with the contribute of Alessandro Occhigrossi*
31
//
32
// ^INAIL DIPIA - ex ISPESL and INFN Roma, gruppo collegato Sanità, Italy
33
// *Istituto Superiore di Sanità and INFN Roma, gruppo collegato Sanità, Italy
34
// Viale Regina Elena 299, 00161 Roma (Italy)
35
// tel (39) 06 49902246
36
// fax (39) 06 49387075
37
//
38
// more information:
39
// http://g4advancedexamples.lngs.infn.it/Examples/medical-linac
40
//
41
//*******************************************************//
42
43
44
#include "
ML2PhaseSpaces.hh
"
45
#include "
ML2ReadOutGeometry.hh
"
46
47
CML2PhaseSpaces::CML2PhaseSpaces
():sensDetParticle(0)
48
{}
49
50
CML2PhaseSpaces::~CML2PhaseSpaces
(
void
)
51
{}
52
53
bool
CML2PhaseSpaces::createPlane
(
G4VPhysicalVolume
*PVWorld,
G4String
name
,
G4ThreeVector
centre,
G4ThreeVector
halfSize)
54
{
55
// constructor for killer plane
56
bool
bCreated=
false
;
57
G4Material
*Vacum=
G4NistManager::Instance
()->
FindOrBuildMaterial
(
"G4_Galactic"
);
58
G4Box
*box;
59
G4LogicalVolume
*logVol;
60
box =
new
G4Box
(
"KBox"
, halfSize.
getX
(), halfSize.
getY
(), halfSize.
getZ
());
61
logVol =
new
G4LogicalVolume
(box, Vacum, name+
"KLV"
, 0, 0, 0);
62
phVol=
new
G4PVPlacement
(0, centre, name+
"KPV"
, logVol, PVWorld,
false
, 0);
63
64
G4Colour
color(0.,1.,1.,0.5);
65
G4VisAttributes
* simplePhSpVisAtt=
new
G4VisAttributes
(color);
66
simplePhSpVisAtt->
SetVisibility
(
true
);
67
simplePhSpVisAtt->
SetForceSolid
(
true
);
68
logVol->SetVisAttributes(simplePhSpVisAtt);
69
70
71
sensDetParticle=
new
CML2SDWithParticle
();
72
G4SDManager
*SDManager=
G4SDManager::GetSDMpointer
();
73
SDManager->
AddNewDetector
(sensDetParticle);
74
logVol->SetSensitiveDetector(sensDetParticle);
75
bCreated=
true
;
76
return
bCreated;
77
}
78
79
bool
CML2PhaseSpaces::createPlane
(
G4int
idSD_Type,
G4int
max_N_particles_in_PhSp_File,
G4int
seed,
G4int
nMaxParticlesInRamPhaseSpace,
G4VPhysicalVolume
*PVWorld,
G4String
name
,
G4String
PhaseSpaceOutFile,
G4bool
bSavePhaseSpace,
G4bool
bStopAtPhaseSpace,
G4ThreeVector
centre,
G4ThreeVector
halfSize,
SPrimaryParticle
*primaryParticleData,
G4double
accTargetZPosition)
80
{
81
// constructor for phase space plane
82
bool
bCreated=
false
;
83
G4Material
*Vacum=
G4NistManager::Instance
()->
FindOrBuildMaterial
(
"G4_Galactic"
);
84
G4Box
*box;
85
G4LogicalVolume
*logVol;
86
box =
new
G4Box
(name+
"Box"
, halfSize.
getX
(), halfSize.
getY
(), halfSize.
getZ
());
87
logVol =
new
G4LogicalVolume
(box, Vacum, name+
"LV"
, 0, 0, 0);
88
phVol=
new
G4PVPlacement
(0, centre, name+
"PV"
, logVol, PVWorld,
false
, 0);
89
90
G4VisAttributes
* simplePhSpVisAtt=
new
G4VisAttributes
(
G4Colour::Yellow
());
91
simplePhSpVisAtt->
SetVisibility
(
true
);
92
simplePhSpVisAtt->
SetForceSolid
(
true
);
93
logVol->SetVisAttributes(simplePhSpVisAtt);
94
95
sensDetParticle=
new
CML2SDWithParticle
(idSD_Type, max_N_particles_in_PhSp_File, seed, nMaxParticlesInRamPhaseSpace, name, PhaseSpaceOutFile, bSavePhaseSpace, bStopAtPhaseSpace, primaryParticleData, accTargetZPosition);
96
G4SDManager
*SDManager=
G4SDManager::GetSDMpointer
();
97
SDManager->
AddNewDetector
(sensDetParticle);
98
logVol->SetSensitiveDetector(sensDetParticle);
99
bCreated=
true
;
100
return
bCreated;
101
}
102
Generated on Sat May 25 2013 14:32:13 for Geant4 by
1.8.4