Geant4  10.02.p02
ML2Ph_FullWater.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 #include "ML2Ph_FullWater.hh"
44 #include "G4SystemOfUnits.hh"
45 
47 {
48  // phantom size and position
49  halfSize.set(150.*mm,150.*mm,150.*mm);
50  // phantom position
51  centre.set(0.,0.,0.);
52 }
53 
55 {
56 }
58 {
59  std::cout<<"\n\n\tcentre of the phantom: " <<centre/mm<<" [mm]"<< G4endl;
60  std::cout<<"\thalf thickness of the phantom: " <<halfSize/mm<<" [mm]\n"<< G4endl;
61 }
62 bool CML2Ph_FullWater::Construct(G4VPhysicalVolume *PWorld, G4int saving_in_ROG_Voxels_every_events, G4int seed, G4String ROGOutFile, G4bool bSaveROG)
63 {
64  PVWorld=PWorld;
65 
66  bool bCreated=false;
68  G4Box *fullWaterPhantomBox = new G4Box("fullWaterPhantomBox", halfSize.getX(), halfSize.getY(), halfSize.getZ());
69  G4LogicalVolume *fullWaterPhantomLV = new G4LogicalVolume(fullWaterPhantomBox, WATER, "fullWaterPhantomLV", 0, 0, 0);
70  fullWaterPhantomPV = new G4PVPlacement(0, centre, "fullWaterPhantomPV", fullWaterPhantomLV, PVWorld, false, 0);
71 
72  // Region for cuts
73  G4Region *regVol= new G4Region("fullWaterPhantomR");
75  cuts->SetProductionCut(0.1*mm);
76  regVol->SetProductionCuts(cuts);
77 
78  fullWaterPhantomLV->SetRegion(regVol);
79  regVol->AddRootLogicalVolume(fullWaterPhantomLV);
80 
81  // Visibility
82  G4VisAttributes* simpleAlSVisAtt= new G4VisAttributes(G4Colour::Red());
83  simpleAlSVisAtt->SetVisibility(true);
84 // simpleAlSVisAtt->SetForceSolid(true);
85  fullWaterPhantomLV->SetVisAttributes(simpleAlSVisAtt);
86 
87  // Sensitive detector
88  sensDet=new CML2SDWithVoxels("Water phantom", saving_in_ROG_Voxels_every_events, seed, ROGOutFile, bSaveROG, G4ThreeVector(0.,0.,0.), halfSize, 100, 100, 100);
90  SDManager->AddNewDetector(sensDet);
91 
92  // Read Out Geometry
94  ROG->setBuildData(PVWorld->GetFrameTranslation(), halfSize, 100, 100, 100);
95  ROG->BuildROGeometry();
96  sensDet->SetROgeometry(ROG);
97  fullWaterPhantomLV->SetSensitiveDetector(sensDet);
98 
99  bCreated=true;
100  return bCreated;
101 }
102 
103 
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
G4ThreeVector GetFrameTranslation() const
CLHEP::Hep3Vector G4ThreeVector
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:254
Definition: G4Box.hh:64
CML2SDWithVoxels * sensDet
void SetVisibility(G4bool)
void SetProductionCut(G4double cut, G4int index=-1)
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
bool G4bool
Definition: G4Types.hh:79
void SetROgeometry(G4VReadOutGeometry *value)
G4VPhysicalVolume * PVWorld
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
void setBuildData(G4ThreeVector centre, G4ThreeVector halfSize, G4int NumberOfVoxelsAlongX, G4int NumberOfVoxelsAlongY, G4int NumberOfVoxelsAlongZ)
bool Construct(G4VPhysicalVolume *PVWorld, G4int saving_in_ROG_Voxels_every_events, G4int seed, G4String ROGOutFile, G4bool bSaveROG)
#define G4endl
Definition: G4ios.hh:61
void SetProductionCuts(G4ProductionCuts *cut)
static G4Colour Red()
Definition: G4Colour.hh:148
G4VPhysicalVolume * fullWaterPhantomPV
static const double mm
Definition: G4SIunits.hh:114
G4ThreeVector halfSize
G4ThreeVector centre