Geant4  10.03.p03
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CML2Ph_BoxInBox Class Reference

#include <ML2Ph_BoxInBox.hh>

Public Member Functions

 CML2Ph_BoxInBox ()
 
 ~CML2Ph_BoxInBox (void)
 
bool Construct (G4VPhysicalVolume *PVWorld, G4int saving_in_ROG_Voxels_every_events, G4int seed, G4String ROGOutFile, G4bool bSaveROG)
 
G4int getTotalNumberOfEvents ()
 
CML2SDWithVoxelsgetSensDet ()
 
G4VPhysicalVolumegetPhysicalVolume ()
 
G4ThreeVector getHalfContainerSize ()
 
void writeInfo ()
 

Detailed Description

Definition at line 64 of file ML2Ph_BoxInBox.hh.

Constructor & Destructor Documentation

CML2Ph_BoxInBox::CML2Ph_BoxInBox ( )

Definition at line 46 of file ML2Ph_BoxInBox.cc.

47 {// phantom size
48  halfSize.set(150.*mm,150.*mm,150.*mm);
49 // phantom position
50  centre.set(0.*mm,0.*mm,0.*mm);
51 }
void set(double x, double y, double z)
static constexpr double mm
Definition: G4SIunits.hh:115

Here is the call graph for this function:

CML2Ph_BoxInBox::~CML2Ph_BoxInBox ( void  )

Definition at line 53 of file ML2Ph_BoxInBox.cc.

54 {
55 }

Member Function Documentation

bool CML2Ph_BoxInBox::Construct ( G4VPhysicalVolume PVWorld,
G4int  saving_in_ROG_Voxels_every_events,
G4int  seed,
G4String  ROGOutFile,
G4bool  bSaveROG 
)

Definition at line 61 of file ML2Ph_BoxInBox.cc.

62 {
63  PVWorld=PWorld;
64 
65 
66  G4double A, Z;
67  A = 1.01*g/mole;
68  G4Element* elH = new G4Element ("Hydrogen","H",Z = 1.,A);
69 
70  A = 12.011*g/mole;
71  G4Element* elC = new G4Element("Carbon","C",Z = 6.,A);
72 
73  A = 16.00*g/mole;
74  G4Element* elO = new G4Element("Oxygen","O",Z = 8.,A);
75 
76  G4double d= 1.18*g/cm3;
77  G4int natoms, ncomponents;
78  G4Material* PMMA = new G4Material("Polimetilmetacrilato",d,ncomponents=3);
79  PMMA->AddElement(elC, natoms=5);
80  PMMA->AddElement(elH, natoms=8);
81  PMMA->AddElement(elO, natoms=2);
82 
83  d= 0.1*g/cm3;
84  G4Material* lightWater = new G4Material("lightWater",d,ncomponents=2);
85  lightWater->AddElement(elH, natoms=2);
86  lightWater->AddElement(elO, natoms=1);
87 
88 
89 
90 // BOX INSIDE
91  G4Material *boxInSideMaterial;
92 
93  boxInSideMaterial=PMMA;
94  std::cout <<"boxInSideMaterial name "<<boxInSideMaterial->GetName() <<" density "<< boxInSideMaterial->GetDensity()/(g/cm3) <<" g/cm3"<< G4endl;
95 
96  centreBoxInside.set(0,0,-50); // the centre of the inside box
97  halfBoxInside_Thickness=3.*cm; // the half thickness of the inside box
98 
99  G4Box *boxInSide=new G4Box("BoxInSide", halfBoxInside_Thickness, halfBoxInside_Thickness, halfBoxInside_Thickness);
100  G4LogicalVolume *boxInSideLV=new G4LogicalVolume(boxInSide, boxInSideMaterial, "boxInSideLV");
101  boxInSidePV = new G4PVPlacement(0, centre+centreBoxInside,"BoxInsidePV", boxInSideLV,PVWorld,false,0,0);
102 
103 // layer PMMA
104  G4Material *layerMaterial=G4NistManager::Instance()->FindOrBuildMaterial("G4_PLEXIGLASS"); // changable
105  G4double halfPMMA_Z_Thickness=0.5*cm;
106  G4Box *layer=new G4Box("layer", halfSize.getX(), halfSize.getY(), halfPMMA_Z_Thickness);
107  G4LogicalVolume *layerLV = new G4LogicalVolume(layer, layerMaterial, "layerLV");
108  layerPV = new G4PVPlacement(0, centre+G4ThreeVector(0,0,-halfSize.getZ()+halfPMMA_Z_Thickness),"layerPV", layerLV,PVWorld,false,0,0);
109 
110  std::cout <<"layerMaterial name "<<layerMaterial->GetName() <<" density " << layerMaterial->GetDensity()/(g/cm3) <<" g/cm3"<< G4endl;
111 
112 // BOX OUTSIDE
113  G4Material *boxOutSideMaterial=G4NistManager::Instance()->FindOrBuildMaterial("G4_LUNG_ICRP"); // changable
114  boxOutSideMaterial=lightWater;
115  G4double halfBoxOutSide_Thickness=halfSize.getZ()-halfPMMA_Z_Thickness;
116  G4Box *boxOutSide=new G4Box("BoxOutSide", halfSize.getX(), halfSize.getY(), halfBoxOutSide_Thickness);
117 
118  // boolean logic subtraction between outside box and inside box
119 
120  G4SubtractionSolid* OutMinusInBox = new G4SubtractionSolid("OutMinusInBox", boxOutSide, boxInSide, 0, centreBoxInside-G4ThreeVector(0,0,5));
121  G4LogicalVolume *OutMinusInBoxLV = new G4LogicalVolume(OutMinusInBox, boxOutSideMaterial,"OutMinusInBoxLV",0,0,0);
122  OutMinusInBoxPV = new G4PVPlacement(0, centre+G4ThreeVector(0,0,-halfSize.getZ()+2*halfPMMA_Z_Thickness+halfBoxOutSide_Thickness),
123  "OutMinusInBoxPV",OutMinusInBoxLV,PVWorld,false,0);
124 
125  std::cout <<"boxOutSideMaterial name "<<boxOutSideMaterial->GetName() <<" density "<<boxOutSideMaterial->GetDensity()/(g/cm3) <<" g/cm3"<< G4endl;
126 
127  // Region for cuts
128  G4Region *regVol= new G4Region("BoxInBoxR");
130  cuts->SetProductionCut(0.01*mm);
131  regVol->SetProductionCuts(cuts);
132 
133 
134  OutMinusInBoxLV->SetRegion(regVol);
135  regVol->AddRootLogicalVolume(OutMinusInBoxLV);
136  OutMinusInBoxLV->SetUserLimits(new G4UserLimits(0.01*mm));
137 
138  layerLV->SetRegion(regVol);
139  regVol->AddRootLogicalVolume(layerLV);
140  layerLV->SetUserLimits(new G4UserLimits(0.01*mm));
141 
142  boxInSideLV->SetRegion(regVol);
143  regVol->AddRootLogicalVolume(boxInSideLV);
144  boxInSideLV->SetUserLimits(new G4UserLimits(0.01*mm));
145 
146  // Visibility
147  G4VisAttributes* simple_PMMA_VisAttWalls= new G4VisAttributes(G4Colour::Gray());
148  G4VisAttributes* simple_InBox_VisAttWalls= new G4VisAttributes(G4Colour::Red());
149  G4VisAttributes* simple_OutBox_VisAttWalls= new G4VisAttributes(G4Colour::Blue());
150 
151  simple_OutBox_VisAttWalls->SetVisibility(true);
152 // simple_OutBox_VisAttWalls->SetForceWireframe(true);
153 // simple_OutBox_VisAttWalls->SetForceAuxEdgeVisible(true);
154  simple_OutBox_VisAttWalls->SetLineWidth(2.);
155 // simple_OutBox_VisAttWalls->SetForceSolid(true);
156 
157  simple_PMMA_VisAttWalls->SetVisibility(true);
158 // simple_PMMA_VisAttWalls->SetForceSolid(true);
159 
160  simple_InBox_VisAttWalls->SetVisibility(true);
161 // simple_InBox_VisAttWalls->SetForceSolid(true);
162 
163 
164  OutMinusInBoxLV->SetVisAttributes(simple_OutBox_VisAttWalls);
165  boxInSideLV->SetVisAttributes(simple_InBox_VisAttWalls);
166  layerLV->SetVisAttributes(simple_PMMA_VisAttWalls);
167 
168  // Sensitive detector
169  sensDet=new CML2SDWithVoxels("BoxInBoxPhantom", saving_in_ROG_Voxels_every_events, seed, ROGOutFile, bSaveROG, centre, halfSize, 100, 100, 100);
171  SDManager->AddNewDetector(sensDet);
172 
173  // Read Out Geometry
175  ROG->setBuildData(PVWorld->GetFrameTranslation(), halfSize, 100, 100, 100);
176  ROG->BuildROGeometry();
177  sensDet->SetROgeometry(ROG);
178  OutMinusInBoxLV->SetSensitiveDetector(sensDet);
179  layerLV->SetSensitiveDetector(sensDet);
180  boxInSideLV->SetSensitiveDetector(sensDet);
181 
182  return true;
183 }
void set(double x, double y, double z)
static G4Colour Gray()
Definition: G4Colour.hh:144
G4Material * FindOrBuildMaterial(const G4String &name, G4bool isotopes=true, G4bool warning=false)
static constexpr double mm
Definition: G4SIunits.hh:115
G4ThreeVector GetFrameTranslation() const
CLHEP::Hep3Vector G4ThreeVector
void AddRootLogicalVolume(G4LogicalVolume *lv)
Definition: G4Region.cc:290
Definition: G4Box.hh:64
const G4String & GetName() const
Definition: G4Material.hh:178
void SetLineWidth(G4double)
void SetUserLimits(G4UserLimits *pULimits)
G4double GetDensity() const
Definition: G4Material.hh:180
void SetProductionCut(G4double cut, G4int index=-1)
double getY() const
int G4int
Definition: G4Types.hh:78
static G4NistManager * Instance()
double getX() const
function g(Y1, Y2, PT2)
Definition: hijing1.383.f:5205
void SetRegion(G4Region *reg)
double A(double temperature)
long seed
Definition: chem4.cc:68
void SetVisibility(G4bool=true)
static constexpr double cm
Definition: G4SIunits.hh:119
void SetROgeometry(G4VReadOutGeometry *value)
static G4Colour Blue()
Definition: G4Colour.hh:150
static constexpr double cm3
Definition: G4SIunits.hh:121
void AddNewDetector(G4VSensitiveDetector *aSD)
Definition: G4SDManager.cc:71
static G4SDManager * GetSDMpointer()
Definition: G4SDManager.cc:40
double getZ() const
void setBuildData(G4ThreeVector centre, G4ThreeVector halfSize, G4int NumberOfVoxelsAlongX, G4int NumberOfVoxelsAlongY, G4int NumberOfVoxelsAlongZ)
#define G4endl
Definition: G4ios.hh:61
void SetProductionCuts(G4ProductionCuts *cut)
void AddElement(G4Element *element, G4int nAtoms)
Definition: G4Material.cc:362
static G4Colour Red()
Definition: G4Colour.hh:148
double G4double
Definition: G4Types.hh:76
static constexpr double mole
Definition: G4SIunits.hh:286
void SetVisAttributes(const G4VisAttributes *pVA)
void SetSensitiveDetector(G4VSensitiveDetector *pSDetector)

Here is the call graph for this function:

Here is the caller graph for this function:

G4ThreeVector CML2Ph_BoxInBox::getHalfContainerSize ( )
inline

Definition at line 73 of file ML2Ph_BoxInBox.hh.

73 {return halfSize;}
G4VPhysicalVolume* CML2Ph_BoxInBox::getPhysicalVolume ( void  )
inline

Definition at line 72 of file ML2Ph_BoxInBox.hh.

72 {return PVWorld;}

Here is the caller graph for this function:

CML2SDWithVoxels* CML2Ph_BoxInBox::getSensDet ( )
inline

Definition at line 71 of file ML2Ph_BoxInBox.hh.

71 {return sensDet;}

Here is the caller graph for this function:

G4int CML2Ph_BoxInBox::getTotalNumberOfEvents ( )
inline

Definition at line 70 of file ML2Ph_BoxInBox.hh.

70 {return sensDet->getTotalNumberOfEvents();}
G4int getTotalNumberOfEvents()

Here is the call graph for this function:

Here is the caller graph for this function:

void CML2Ph_BoxInBox::writeInfo ( )

Definition at line 56 of file ML2Ph_BoxInBox.cc.

57 {
58  std::cout<<"\n\n\tcentre of the inside box: " <<centreBoxInside/mm<<" [mm]"<< G4endl;
59  std::cout<<"\thalf thickness of the inside box: " <<halfBoxInside_Thickness/mm<<" [mm]\n"<< G4endl;
60 }
static constexpr double mm
Definition: G4SIunits.hh:115
#define G4endl
Definition: G4ios.hh:61

Here is the caller graph for this function:


The documentation for this class was generated from the following files: