Geant4  10.03
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 
48 {}
49 
51 {}
52 
54 {
55  // constructor for killer plane
56  bool bCreated=false;
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 
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;
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);
97  SDManager->AddNewDetector(sensDetParticle);
98  logVol->SetSensitiveDetector(sensDetParticle);
99  bCreated=true;
100  return bCreated;
101 }
102 
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
CLHEP::Hep3Vector G4ThreeVector
Definition: G4Box.hh:64
const char * name(G4int ptype)
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
void SetForceSolid(G4bool=true)
long seed
Definition: chem4.cc:68
void SetVisibility(G4bool=true)
bool G4bool
Definition: G4Types.hh:79
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
CML2SDWithParticle * sensDetParticle
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
G4VPhysicalVolume * phVol
double G4double
Definition: G4Types.hh:76
static G4Colour Yellow()
Definition: G4Colour.hh:153
bool createPlane(G4VPhysicalVolume *PVWorld, G4String name, G4ThreeVector centre, G4ThreeVector halfSize)