Geant4  v4-10.4-release
 모두 클래스 네임스페이스들 파일들 함수 변수 타입정의 열거형 타입 열거형 멤버 Friends 매크로 그룹들 페이지들
ML2WorldConstruction.cc
이 파일의 문서화 페이지로 가기
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 "ML2WorldConstruction.hh"
44 #include "G4SystemOfUnits.hh"
45 
46 CML2WorldConstruction::CML2WorldConstruction():acceleratorEnv(0),phantomEnv(0),PVWorld(0),phaseSpace(0),backScatteredPlane(0)
47 {
50  bWorldCreated=false;
51 }
52 
54 {
55  delete PVWorld;
56  delete phantomEnv;
57  delete acceleratorEnv;
58  delete phaseSpace;
59  delete backScatteredPlane;
60 }
61 
63 
65 {
66  if (instance == 0)
67  {
69  }
70  return instance;
71 }
72 
74 {
75  return PVWorld;
76 }
77 
78 bool CML2WorldConstruction::create(SInputData *inputData, bool bOV)
79 {
80  // create the world box
81  bOnlyVisio=bOV;
82  G4double halfSize=3000.*mm;
83  G4Material *Vacuum=G4NistManager::Instance()->FindOrBuildMaterial("G4_Galactic");
84  G4Box *worldB = new G4Box("worldG", halfSize, halfSize, halfSize);
85  G4LogicalVolume *worldLV = new G4LogicalVolume(worldB, Vacuum, "worldL", 0, 0, 0);
86  G4VisAttributes* simpleWorldVisAtt= new G4VisAttributes(G4Colour::Black());
87  simpleWorldVisAtt->SetVisibility(false);
88  // simpleWorldVisAtt->SetForceSolid(false);
89  worldLV->SetVisAttributes(simpleWorldVisAtt);
90  PVWorld= new G4PVPlacement(0, G4ThreeVector(0.,0.,0.), "worldPV", worldLV, 0, false, 0);
91 
92  // create the accelerator-world box
93  if (!acceleratorEnv->Construct(PVWorld, bOV))
94  {
95  std::cout <<"\n\n The macro file '"<<inputData->generalData.StartFileInputData<<"' refers to a not defined accelerator.\n"<< acceleratorEnv->getAcceleratorName()<<"\n\nSTOP\n\n" << G4endl;
96  return false;
97  }
98 
99  // create the phantom-world box
101  {
102  std::cout <<"\n\n The macro file '"<<inputData->generalData.StartFileInputData<<"' refers to a not defined phantom.\n"<< phantomEnv->getPhantomName()<<"\n\nSTOP\n\n" << G4endl;
103  return false;
104  }
105 
106  // if the bSavePhaseSpace flag is true create a phase plane
107  if (inputData->generalData.bSavePhaseSpace)
108  {
113  }
114 
115  // create a killer plane to destroy the particles back scattered from the target
117  backScatteredPlane->createPlane(acceleratorEnv->getPhysicalVolume(), "killerPlane", G4ThreeVector(0, 0, -50*mm), G4ThreeVector(200*mm, 200*mm, 1*mm));
118 
119  bWorldCreated=true;
120  return true;
121 }
123 {
124  // loop inside all the daughters volumes
125  std::cout<< G4endl;
126  // bool bCheckOverlap;
127  // bCheckOverlap=false;
128 
129  int nSubWorlds, nSubWorlds2;
130  for (int i=0; i<(int) PVWorld->GetLogicalVolume()->GetNoDaughters(); i++)
131  {
134  for (int j=0; j<nSubWorlds; j++)
135  {
138  for (int k=0; k<nSubWorlds2; k++)
139  {
141  }
142  }
143  }
144  std::cout<< G4endl;
145 }
147 {
148  G4bool bNewRotation=false;
149  G4bool bNewCentre=false;
150  G4bool bNewGeometry=false;
151  bNewCentre=phantomEnv->applyNewCentre();
153  if (rmInv!=0)
154  {
156  bNewRotation=true;
157  }
158  if (bNewRotation || bNewCentre){bNewGeometry=true;}
159  return bNewGeometry;
160 }
161 
CLHEP::Hep3Vector G4ThreeVector
bool create(SInputData *inputData, bool bOnlyVisio)
G4String ROGOutFile
G4LogicalVolume * GetLogicalVolume() const
G4bool bSavePhaseSpace
bool Construct(G4VPhysicalVolume *PVWorld, G4int saving_in_ROG_Voxels_every_events, G4int seed, G4String ROGOutFile, G4bool bSaveROG, G4bool bOnlyVisio)
static constexpr double mm
Definition: G4SIunits.hh:115
#define G4endl
Definition: G4ios.hh:61
static G4Colour Black()
Definition: G4Colour.hh:158
bool Construct(G4VPhysicalVolume *PVWorld, G4bool bOnlyVisio)
static CML2PhantomConstruction * GetInstance(void)
G4int GetNoDaughters() const
G4ThreeVector halfSizePhaseSpace
CML2AcceleratorConstruction * acceleratorEnv
int saving_in_ROG_Voxels_every_events
G4String PhaseSpaceOutFile
virtual G4bool CheckOverlaps(G4int res=1000, G4double tol=0., G4bool verbose=true, G4int errMax=1)
G4int nMaxParticlesInRamPlanePhaseSpace
G4bool bStopAtPhaseSpace
double G4double
Definition: G4Types.hh:76
bool G4bool
Definition: G4Types.hh:79
CML2PhaseSpaces * phaseSpace
static CML2PrimaryGenerationAction * GetInstance(void)
SPrimaryParticle primaryParticleData
void setZ(double)
static CML2WorldConstruction * GetInstance(void)
void setRotation(G4RotationMatrix *val)
Definition: G4Box.hh:64
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
typedef int(XMLCALL *XML_NotStandaloneHandler)(void *userData)
G4VPhysicalVolume * getPhysicalVolume(void)
void applyNewCentre(G4ThreeVector val)
G4VPhysicalVolume * Construct()
G4VPhysicalVolume * PVWorld
void SetVisAttributes(const G4VisAttributes *pVA)
CML2PhaseSpaces * backScatteredPlane
void SetVisibility(G4bool=true)
static CML2AcceleratorConstruction * GetInstance(void)
CML2PhantomConstruction * phantomEnv
SGeneralData generalData
G4String StartFileInputData
G4bool bForcePhaseSpaceBeforeJaws
static CML2WorldConstruction * instance
int max_N_particles_in_PhSp_File
G4VPhysicalVolume * GetDaughter(const G4int i) const
bool createPlane(G4VPhysicalVolume *PVWorld, G4String name, G4ThreeVector centre, G4ThreeVector halfSize)
static G4NistManager * Instance()
G4ThreeVector centrePhaseSpace