Geant4 Cross Reference

Cross-Referencing   Geant4
Geant4/examples/advanced/doiPET/src/doiPETDetectorConstruction.cc

Version: [ ReleaseNotes ] [ 1.0 ] [ 1.1 ] [ 2.0 ] [ 3.0 ] [ 3.1 ] [ 3.2 ] [ 4.0 ] [ 4.0.p1 ] [ 4.0.p2 ] [ 4.1 ] [ 4.1.p1 ] [ 5.0 ] [ 5.0.p1 ] [ 5.1 ] [ 5.1.p1 ] [ 5.2 ] [ 5.2.p1 ] [ 5.2.p2 ] [ 6.0 ] [ 6.0.p1 ] [ 6.1 ] [ 6.2 ] [ 6.2.p1 ] [ 6.2.p2 ] [ 7.0 ] [ 7.0.p1 ] [ 7.1 ] [ 7.1.p1 ] [ 8.0 ] [ 8.0.p1 ] [ 8.1 ] [ 8.1.p1 ] [ 8.1.p2 ] [ 8.2 ] [ 8.2.p1 ] [ 8.3 ] [ 8.3.p1 ] [ 8.3.p2 ] [ 9.0 ] [ 9.0.p1 ] [ 9.0.p2 ] [ 9.1 ] [ 9.1.p1 ] [ 9.1.p2 ] [ 9.1.p3 ] [ 9.2 ] [ 9.2.p1 ] [ 9.2.p2 ] [ 9.2.p3 ] [ 9.2.p4 ] [ 9.3 ] [ 9.3.p1 ] [ 9.3.p2 ] [ 9.4 ] [ 9.4.p1 ] [ 9.4.p2 ] [ 9.4.p3 ] [ 9.4.p4 ] [ 9.5 ] [ 9.5.p1 ] [ 9.5.p2 ] [ 9.6 ] [ 9.6.p1 ] [ 9.6.p2 ] [ 9.6.p3 ] [ 9.6.p4 ] [ 10.0 ] [ 10.0.p1 ] [ 10.0.p2 ] [ 10.0.p3 ] [ 10.0.p4 ] [ 10.1 ] [ 10.1.p1 ] [ 10.1.p2 ] [ 10.1.p3 ] [ 10.2 ] [ 10.2.p1 ] [ 10.2.p2 ] [ 10.2.p3 ] [ 10.3 ] [ 10.3.p1 ] [ 10.3.p2 ] [ 10.3.p3 ] [ 10.4 ] [ 10.4.p1 ] [ 10.4.p2 ] [ 10.4.p3 ] [ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /examples/advanced/doiPET/src/doiPETDetectorConstruction.cc (Version 11.3.0) and /examples/advanced/doiPET/src/doiPETDetectorConstruction.cc (Version 9.2.p3)


  1 //                                                  1 
  2 // *******************************************    
  3 // * License and Disclaimer                       
  4 // *                                              
  5 // * The  Geant4 software  is  copyright of th    
  6 // * the Geant4 Collaboration.  It is provided    
  7 // * conditions of the Geant4 Software License    
  8 // * LICENSE and available at  http://cern.ch/    
  9 // * include a list of copyright holders.         
 10 // *                                              
 11 // * Neither the authors of this software syst    
 12 // * institutes,nor the agencies providing fin    
 13 // * work  make  any representation or  warran    
 14 // * regarding  this  software system or assum    
 15 // * use.  Please see the license in the file     
 16 // * for the full disclaimer and the limitatio    
 17 // *                                              
 18 // * This  code  implementation is the result     
 19 // * technical work of the GEANT4 collaboratio    
 20 // * By using,  copying,  modifying or  distri    
 21 // * any work based  on the software)  you  ag    
 22 // * use  in  resulting  scientific  publicati    
 23 // * acceptance of all terms of the Geant4 Sof    
 24 // *******************************************    
 25                                                   
 26 //GEANT4 - Depth-of-Interaction enabled Positr    
 27                                                   
 28 //Authors and contributors                        
 29                                                   
 30 // Author list to be updated, with names of co    
 31                                                   
 32 // Abdella M. Ahmed (1, 2), Andrew Chacon (1,     
 33 // Hideaki Tashima (3), Go Akamatsu (3), Akram    
 34 // Susanna Guatelli (2), and Mitra Safavi-Naei    
 35                                                   
 36 // (1) Australian Nuclear Science and Technolo    
 37 // (2) University of Wollongong, Australia        
 38 // (3) National Institute of Radiological Scie    
 39                                                   
 40                                                   
 41                                                   
 42 //A whole-body PET scanner with depth-of-inter    
 43 //defined in the doiPETDetectorConstruction cl    
 44 //are also defined based on the NEMA NU-2 2012    
 45 //performance evaluation PET scanners.            
 46 //The scanner's geometrical specifications (li    
 47 //If the phantom is other there the phantoms d    
 48 //you can comment out ConstructPhantom(world_l    
 49                                                   
 50 #include "doiPETDetectorConstruction.hh"          
 51 #include "doiPETAnalysis.hh"                      
 52 #include "doiPETDetectorConstructionMessenger.    
 53 #include "doiPETGlobalParameters.hh"              
 54                                                   
 55 #include "G4NistManager.hh"                       
 56 #include "G4Box.hh"                               
 57 #include "G4Tubs.hh"                              
 58 #include "G4LogicalVolume.hh"                     
 59 #include "G4PVPlacement.hh"                       
 60 #include "G4RotationMatrix.hh"                    
 61 #include "G4Transform3D.hh"                       
 62 #include "G4SDManager.hh"                         
 63 #include "G4MultiFunctionalDetector.hh"           
 64 #include "G4VPrimitiveScorer.hh"                  
 65 #include "G4PSEnergyDeposit.hh"                   
 66 #include "G4PSDoseDeposit.hh"                     
 67 #include "G4VisAttributes.hh"                     
 68 #include "G4PhysicalConstants.hh"                 
 69 #include "G4SystemOfUnits.hh"                     
 70                                                   
 71 //                                                
 72 #include "G4SubtractionSolid.hh"                  
 73 #include "G4UnionSolid.hh"                        
 74 #include "G4IntersectionSolid.hh"                 
 75 //                                                
 76 #include "G4Element.hh"                           
 77 #include "G4Material.hh"                          
 78 #include "G4Sphere.hh"                            
 79 #include "G4Colour.hh"                            
 80 #include "G4RunManager.hh"                        
 81 #include "G4StateManager.hh"                      
 82 #include "G4GeometryManager.hh"                   
 83 #include "G4PhysicalVolumeStore.hh"               
 84 #include "G4LogicalVolumeStore.hh"                
 85 #include "G4SolidStore.hh"                        
 86                                                   
 87                                                   
 88 //////////////////////////////////////////////    
 89                                                   
 90 doiPETDetectorConstruction::doiPETDetectorCons    
 91   : G4VUserDetectorConstruction(),                
 92   fCheckOverlaps(true)                            
 93 {                                                 
 94   DefineMaterials();                              
 95   fDetectorMessenger = new doiPETDetectorConst    
 96                                                   
 97   //Initialize variables. The following variab    
 98   PhantomType = "NEMA_imageQualityPhantom_whol    
 99   phantomRadius = 100 * mm;                       
100   phantomLength = 700 * mm;                       
101   phantomPosition = G4ThreeVector(0,0,0);         
102   numOfSleeves = 5;                               
103 }                                                 
104                                                   
105 //////////////////////////////////////////////    
106                                                   
107 doiPETDetectorConstruction::~doiPETDetectorCon    
108 {                                                 
109   delete fDetectorMessenger;                      
110 }                                                 
111                                                   
112 /////////////////////////////////// Define Mat    
113                                                   
114 void doiPETDetectorConstruction::DefineMateria    
115 {                                                 
116   G4NistManager* nist = G4NistManager::Instanc    
117                                                   
118   //Define air                                    
119   air = nist->FindOrBuildMaterial("G4_AIR");      
120                                                   
121   //Define PMMA                                   
122   pmma  = nist->FindOrBuildMaterial("G4_PLEXIG    
123                                                   
124   //Define water                                  
125   water  = nist->FindOrBuildMaterial("G4_WATER    
126                                                   
127   //Defining polyethylene from NIST and modify    
128   polyethylene = nist->BuildMaterialWithNewDen    
129   polyethylene->GetIonisation()->SetMeanExcita    
130                                                   
131   //polyethylene_NEMA, defualt density 0.94 g/    
132   polyethylene_NEMA = nist->FindOrBuildMateria    
133                                                   
134                                                   
135   //Define expanded polystyrene by modifiying     
136   polystyrene = nist->BuildMaterialWithNewDens    
137                                                   
138   isotopes = false;                               
139                                                   
140   //Defile Aluminum material for the detetor c    
141   Aluminum = nist->FindOrBuildMaterial("G4_Al"    
142                                                   
143   //Define elements for the GSO  crystal (scin    
144   O = nist->FindOrBuildElement("O" , isotopes)    
145   Si = nist->FindOrBuildElement("Si", isotopes    
146   Gd = nist->FindOrBuildElement("Gd", isotopes    
147                                                   
148                                                   
149   //define GSO crystal for PET detector           
150   GSO = new G4Material("GSO", 6.7*g/cm3, 3);      
151   GSO->AddElement(Gd, 2);                         
152   GSO->AddElement(Si, 1);                         
153   GSO->AddElement(O,  5);                         
154   crystalMaterial   = nist->FindOrBuildMateria    
155 }                                                 
156                                                   
157 //////////////////////////////////////////////    
158                                                   
159 G4VPhysicalVolume* doiPETDetectorConstruction:    
160 {                                                 
161   //size of the world                             
162   worldSizeX = 2 * m;//0.5 *mm                    
163   worldSizeY = 2 * m;//0.5*mm                     
164   worldSizeZ = 4. * m;                            
165                                                   
166                                                   
167   // Define a solid shape to describe the worl    
168   G4Box* solid_world = new G4Box("world", worl    
169                                                   
170   // Define a logical volume for the world vol    
171   world_logicalV = new G4LogicalVolume(solid_w    
172                                                   
173                                                   
174   // Define the physical world volume             
175   world_physicalV = new G4PVPlacement(0,G4Thre    
176   world_logicalV->SetVisAttributes (G4VisAttri    
177                                                   
178   //NOTE!!!                                       
179   //The scanner specification (like size and n    
180                                                   
181   //Each block detector is identified with its    
182   blockIndex = 0;                                 
183                                                   
184   //Each crystal is identified with its unique    
185   crystalIndex = 0;                               
186                                                   
187   //This is to place the phantom.                 
188                                                   
189   ConstructPhantom(world_logicalV);               
190                                                   
191   //Define air volume (box) to fill the detect    
192   sizeOfAirBox_DOI = (numberOfCrystal_DOI * si    
193   sizeOfAirBox_axial = (numberOfCrystal_axial     
194   sizeOfAirBox_tangential = (numberOfCrystal_t    
195                                                   
196   //This will pass the size of the detector bl    
197   //see doiPETAnalysis.cc                         
198   pAnalysis = doiPETAnalysis::GetInstance();      
199   pAnalysis->GetSizeOfDetector(sizeOfAirBox_DO    
200                                                   
201   G4cout<<"size of crytal element: "<<sizeOfCr    
202   G4cout<<"Size of detector block (without Al     
203                                                   
204                                                   
205                                                   
206   //Define the size of the detector block.        
207   sizeOfBlockDetector_DOI = sizeOfAirBox_DOI +    
208   sizeOfBlockDetector_axial = sizeOfAirBox_axi    
209   sizeOfBlockDetector_tangential = sizeOfAirBo    
210                                                   
211                                                   
212                                                   
213   //Define solid shape for the detector block     
214   G4Box* blockDetector = new G4Box("blockDetec    
215                                                   
216   //Define the logical volume for the detector    
217   blockDetector_logicalV = new G4LogicalVolume    
218                                                   
219                                                   
220                                                   
221   //Define air (box) inside the detector block    
222   G4Box* airBox = new G4Box("airBox", sizeOfAi    
223                                                   
224   //Define the logical volume                     
225   airBox_logicalV = new G4LogicalVolume(airBox    
226                                                   
227   //Define its physical volume and place it in    
228   airBox_physicalV = new G4PVPlacement (0,G4Th    
229                                                   
230                                                   
231   ///////////////////////////////////////// Ar    
232                                                   
233   for(G4int Ring = 0; Ring< numberOfRings; Rin    
234   {                                               
235     //place the detectors in a ring along the     
236                                                   
237     detectorPositionZ = (Ring-((G4double)numbe    
238                                                   
239     for(G4int i = 0; i<numberOfDetector_perRin    
240     {                                             
241       //The azimuthal angle to arrange the det    
242       thetaDetector = (double)(i*twopi/numberO    
243                                                   
244       //The radius of the scanner is measured     
245       detectorPositionX = (scannerRadius + siz    
246       detectorPositionY = (scannerRadius + siz    
247                                                   
248       //Define the rotation matrix for correct    
249       G4RotationMatrix rotm_PET = G4RotationMa    
250       rotm_PET.rotateZ(thetaDetector);            
251       G4ThreeVector uz_PET = G4ThreeVector(det    
252       G4Transform3D transform = G4Transform3D(    
253                                                   
254       //Define the physical volume of the dete    
255       blockDetector_physicalV = new G4PVPlacem    
256       blockIndex++;                               
257       //G4cout<<Ring<<" "<<detectorPositionX-     
258                                                   
259     }                                             
260   }                                               
261                                                   
262   //Define the solid crystal                      
263   G4VSolid* CrystalSolid = new G4Box("Crystal"    
264                                                   
265   //Define the local volume of the crystal        
266   crystal_logicalV = new G4LogicalVolume(Cryst    
267                                                   
268   //Place the crystals inside the detectors an    
269   for(G4int i_DOI = 0; i_DOI<numberOfCrystal_D    
270     crystalPositionX=(i_DOI-((G4double)numberO    
271     for(G4int i_axial=0; i_axial< numberOfCrys    
272       crystalPositionZ = (i_axial-((G4double)n    
273       for(G4int i_tan=0; i_tan<numberOfCrystal    
274         crystalPositionY=(i_tan-((G4double)num    
275                                                   
276         //G4cout<<crystalIndex<<" "<<crystalPo    
277         //place the crystal inside the block d    
278         crystal_physicalV = new G4PVPlacement     
279         crystalIndex++;                           
280       }                                           
281     }                                             
282   }                                               
283                                                   
284   //******************  Visualization ********    
285                                                   
286   //visualization for the block detector          
287   G4VisAttributes* blockDetectorVisAtt;           
288   blockDetectorVisAtt = new G4VisAttributes(G4    
289   blockDetectorVisAtt->SetVisibility (true);      
290   //blockDetectorVisAtt->SetForceWireframe (tr    
291   blockDetector_logicalV->SetVisAttributes (bl    
292   //blockDetector_logicalV->SetVisAttributes (    
293                                                   
294   //visualization for the the box filled with     
295   G4VisAttributes* airBoxVisAtt;                  
296   airBoxVisAtt = new G4VisAttributes(G4Colour(    
297   airBoxVisAtt->SetVisibility (true);             
298   airBoxVisAtt->SetForceWireframe (true);         
299   airBox_logicalV->SetVisAttributes (airBoxVis    
300   airBox_logicalV->SetVisAttributes (G4VisAttr    
301                                                   
302   //visualization for the crystal                 
303   G4VisAttributes* crystalVisAtt;                 
304   crystalVisAtt = new G4VisAttributes(G4Colour    
305   //crystalVisAtt->SetVisibility (true);          
306   crystalVisAtt->SetForceWireframe (true);        
307   crystal_logicalV->SetVisAttributes (crystalV    
308   crystal_logicalV->SetVisAttributes (G4VisAtt    
309                                                   
310                                                   
311   //always return the physical World              
312   return world_physicalV;                         
313 }                                                 
314                                                   
315                                                   
316 //////////////////////////////////////////////    
317                                                   
318 void doiPETDetectorConstruction::ConstructPhan    
319 {                                                 
320   G4cout<<"------------------================-    
321                                                   
322   //The following phantoms are defined based o    
323   if(PhantomType == "NEMA_imageQualityPhantom_    
324                                                   
325     //The body phantom (also called image qual    
326     //(2) two small full (or quarter) cylinder    
327     //All the material to surround (hold) the     
328                                                   
329     //offset position for the body phantom. Th    
330     yOffsetBodyPhantom =  35*mm;                  
331                                                   
332     //The body phantom is moved by 70 mm in th    
333     zOffsetBodyPhantom =70*mm;                    
334                                                   
335     //length (in the z-direction) of the body     
336     lengthOfBodyPhantom = 180*mm; //Interior l    
337                                                   
338     //outer radius of the body phantom. (inner    
339     radiusOfBodyPhantom = 147 * mm;               
340                                                   
341     //wall thickness of the surrounding pmma p    
342     wallThicknessOfBodyPhantom = 3 * mm;          
343                                                   
344     //                                            
345     radiusOfSmallcyl = 77 * mm;                   
346     boxWidth = 140*mm;// along the x-axis         
347     boxHeight = 77 * mm; // along the y-axis      
348                                                   
349                                                   
350     /************************* Surrounding PMM    
351                                                   
352     //define a half cylinder                      
353     G4Tubs* halfcyl_pmma = new G4Tubs("halfcyl    
354                                                   
355     //define two full small cylinder. (It can     
356     G4Tubs* cyl1_pmma = new G4Tubs("cyl_pmma",    
357     G4Tubs* cyl2_pmma = new G4Tubs("cyl_pmma",    
358                                                   
359     //define a box                                
360     G4Box*  box_pmma = new G4Box("box_pmma", b    
361                                                   
362     //a translation vector for the small cylin    
363     G4ThreeVector translation_cyl1 = G4ThreeVe    
364                                                   
365     //a translation vector for the small cylin    
366     G4ThreeVector translation_cyl2 = G4ThreeVe    
367                                                   
368     //translation for the box with respect to     
369     G4ThreeVector translation_box = G4ThreeVec    
370                                                   
371     //define union1_pmma by uniting the solids    
372     G4UnionSolid* union1_pmma = new G4UnionSol    
373                                                   
374     //define union2_pmma by uniting the solids    
375     G4UnionSolid* union2_pmma = new G4UnionSol    
376                                                   
377     //********** Now define the solid volume o    
378     //define phantom by uniting the solids of     
379     G4UnionSolid* phantom = new G4UnionSolid("    
380                                                   
381     //Define the logical volume of the body ph    
382     phantom_logicalV = new G4LogicalVolume(pha    
383                                                   
384     //Define the physical volume of the body p    
385     phantom_physicalV = new G4PVPlacement(0, G    
386                                                   
387                                                   
388                                                   
389     //****************************** Water ins    
390                                                   
391     //define a half cylinder                      
392     G4Tubs* halfcyl_water = new G4Tubs("halfcy    
393                                                   
394     //define a full small cylinder phantom. (I    
395     G4Tubs* cyl1_water = new G4Tubs("cyl_water    
396     G4Tubs* cyl2_water = new G4Tubs("cyl_water    
397                                                   
398     //define a box                                
399     G4Box*  box_water = new G4Box("box_water",    
400                                                   
401     //a translation vector for the small cylin    
402     G4ThreeVector translation_cyl1_water = G4T    
403                                                   
404     //a translation vector for the small cylin    
405     G4ThreeVector translation_cyl2_water = G4T    
406                                                   
407     //translation for the box with respect to     
408     G4ThreeVector translation_box_water = G4Th    
409                                                   
410     //define union1_water by uniting the solid    
411     G4UnionSolid* union1_water = new G4UnionSo    
412                                                   
413     //define union2_water by uniting the solid    
414     G4UnionSolid* union2_water = new G4UnionSo    
415                                                   
416     //********** Now define the solid volume o    
417     //define phantom by uniting the solids of     
418     G4UnionSolid* phantom_water = new G4UnionS    
419                                                   
420     //Define the logical volume of the body ph    
421     water_logicalV = new G4LogicalVolume(phant    
422                                                   
423     //Define the physical volume of the body p    
424     water_physicalV = new G4PVPlacement(0, G4T    
425                                                   
426     //                                            
427     /////////////////////////////// lung phant    
428                                                   
429     //A lung phantom (with low density materia    
430     G4double wallThiknessOfLungPhantom = 4 *mm    
431     radiusOfLungPhantom = 21 *mm;                 
432                                                   
433     //define surrounding pmma phantom for the     
434     //Define the solid shape for the lung phan    
435     G4Tubs* phantom_lungPMMA = new G4Tubs("Pha    
436                                                   
437     //Define the logical volume of for the lun    
438     lung_logicalV_PMMA = new G4LogicalVolume(p    
439                                                   
440     //Define the physical volume for the lung     
441     lung_physicalVPMMA = new G4PVPlacement(0,     
442                                                   
443                                                   
444     //Define the solid shape for the lung phan    
445     G4Tubs* phantom_lung = new G4Tubs("Phantom    
446                                                   
447     //Define the logical volume of for the lun    
448     lung_logicalV = new G4LogicalVolume(phanto    
449                                                   
450     //Define the physical volume for the lung     
451     lung_physicalV = new G4PVPlacement(0, G4Th    
452     //lung_logicalV->SetVisAttributes (G4VisAt    
453                                                   
454                                                   
455     ////////////////////////////////// Test ph    
456     //This phantom has the same characteristic    
457                                                   
458     hieghtOfTestPhantom = 705* mm;                
459     diameterOfTestPhantom = 203 * mm;             
460     G4double zOffset_testPhantom = 0*mm;//this    
461                                                   
462     //Define the solid shape for the test phan    
463     G4Tubs* phantom_test = new G4Tubs("Phantom    
464                                                   
465     //Define the logical volume of the test ph    
466     test_logicalV = new G4LogicalVolume(phanto    
467                                                   
468     //Define the physical volume of the test p    
469     test_physicalV = new G4PVPlacement(0,G4Thr    
470     //test_logicalV->SetVisAttributes (G4VisAt    
471                                                   
472     ////////////////////////////////// Six Sph    
473                                                   
474     //Define diameter from the center of the b    
475     distanceFromCenter = 114.4*mm;                
476                                                   
477     //Define total number of spherical phantom    
478     numberOfSpheres = 6;                          
479                                                   
480     //Define the wall thickness of the spheric    
481     sphereWallThickness = 1*mm;                   
482                                                   
483     //The centers of the sphere phantoms are p    
484     zOffsetSpherePhantom = lengthOfBodyPhantom    
485                                                   
486     //Place the spherical phantoms in the body    
487     for(G4int i = 0; i < numberOfSpheres; i++)    
488       if(i == 0) sphereDiameter = 37*mm;//cold    
489       if(i == 1) sphereDiameter = 10*mm;// hot    
490       if(i == 2) sphereDiameter = 13*mm;// hot    
491       if(i == 3) sphereDiameter = 17*mm;// hot    
492       if(i == 4) sphereDiameter = 22*mm;// hot    
493       if(i == 5) sphereDiameter = 28*mm;// col    
494                                                   
495       spherePositionX = distanceFromCenter/2*s    
496       spherePositionY = distanceFromCenter/2*s    
497       //zOffsetBodyPhantom = 0;                   
498                                                   
499       //hot sphere phantoms                       
500       if(i>0 && i <5){                            
501                                                   
502         //Surrounding PMMA phantom for the hot    
503         //Define the solid shape for the surro    
504         G4Sphere* hotSpherePMMA = new G4Sphere    
505                                                   
506         //Deifne the logical volume of the sur    
507         hotSpherePMMA_logicalV = new G4Logical    
508                                                   
509         //Deifne the physical volume of the su    
510         hotSpherePMMA_physicalV = new G4PVPlac    
511                                                   
512                                                   
513         //Defining and placing the water in th    
514         //Define the solid shape of the water     
515         G4Sphere* hotSphereWater = new G4Spher    
516                                                   
517         //Define the logical volume of the wat    
518         hotSphereWater_logicalV = new G4Logica    
519                                                   
520         //Define the physical volume of the wa    
521         hotSphereWater_physicalV = new G4PVPla    
522         //G4cout<<"Hot sphere "<<i<<" is place    
523         //hotSpherePMMA_logicalV->SetVisAttrib    
524         //hotSphereWater_logicalV->SetVisAttri    
525       }                                           
526                                                   
527       //Cold sphere phantoms                      
528       if(i==0 || i==5){                           
529         //Surrounding PMMA phantom for the col    
530         //Define the solid shape for the surro    
531         G4Sphere* coldSpherePMMA = new G4Spher    
532                                                   
533         //Deifne the logical volume of the sur    
534         coldSpherePMMA_logicalV = new G4Logica    
535                                                   
536         //Deifne the physical volume of the su    
537         coldSpherePMMA_physicalV = new G4PVPla    
538                                                   
539                                                   
540         //Defining and placing the water in th    
541         //Define the solid shape of the water     
542         G4Sphere* coldSphereWater = new G4Sphe    
543                                                   
544         //Define the logical volume of the wat    
545         coldSphereWater_logicalV = new G4Logic    
546                                                   
547         //Define the physical volume of the wa    
548         coldSphereWater_physicalV = new G4PVPl    
549         //G4cout<<"Cold sphere "<<i<<" is plac    
550         //coldSpherePMMA_logicalV->SetVisAttri    
551         //coldSphereWater_logicalV->SetVisAttr    
552       }                                           
553     }                                             
554   }                                               
555                                                   
556   else if(PhantomType == "NEMA_imageQualityPha    
557     //The follwoing is for NEMA NU-2 image qua    
558     //To see the details of the phantom, pleas    
559                                                   
560     //Outside radius of PMMMA                     
561     phantomRadius = 16.75*mm;// dia=33.5*mm;      
562                                                   
563     //Outside length of PMMA                      
564     phantomLength = 63*mm;                        
565                                                   
566     //Dimension of water phantom to be filled     
567     waterPhantomRadius = 15*mm;                   
568     waterPhantomLength = 30*mm;                   
569                                                   
570                                                   
571     //Dimension of rod phantom (hot region)       
572     rodPhantomLength = 20*mm;                     
573                                                   
574     //There are five rod phantoms with differe    
575     numberOfRods = 5;                             
576                                                   
577     //Distance from the center of the cylinder    
578     distanceFromCenter = 7*mm;                    
579                                                   
580     //surrounding PMMA phantom.                   
581     //Define PMMA solid                           
582     G4Tubs* phantom = new G4Tubs("Phantom", 0*    
583                                                   
584     //Define PMMA logical volume                  
585     phantom_logicalV = new G4LogicalVolume(pha    
586                                                   
587     //Define PMMA physical volume                 
588     phantom_physicalV = new G4PVPlacement(0,G4    
589                                                   
590     //The rods are placed at one end of the su    
591     rodPositionZ = -waterPhantomLength/2;         
592                                                   
593     for(G4int i = 0; i < numberOfRods; i++){      
594                                                   
595       if(i == 0) rodDiameter = 1 * mm;            
596       if(i == 1) rodDiameter = 2 * mm;            
597       if(i == 2) rodDiameter = 3 * mm;            
598       if(i == 3) rodDiameter = 4 * mm;            
599       if(i == 4) rodDiameter = 5 * mm;            
600                                                   
601       rodPositionX = distanceFromCenter*std::c    
602       rodPositionY = distanceFromCenter*std::s    
603                                                   
604       //Define rod phantom                        
605       G4Tubs* rod_phantom = new G4Tubs("Phanto    
606                                                   
607       //Define rod phantom logical volume         
608       rod_phantom_logicalV = new G4LogicalVolu    
609                                                   
610       //Define rod phantom physical volume        
611       rod_phantom_physicalV = new G4PVPlacemen    
612     }                                             
613                                                   
614     //Out dimensions of the surrounding PMMA f    
615     chamberPhantomLength = 15*mm;                 
616     chamberDiameter = 10*mm;                      
617                                                   
618     //Wall thickness of the surrounding PMMA p    
619     wallThicknessOfChamber = 1*mm;                
620                                                   
621     //The centers of the cold chambers is         
622     chamberPositionX = distanceFromCenter;        
623     chamberPositionY = 0*mm;                      
624     chamberPositionZ =  waterPhantomLength/2 -    
625                                                   
626     //hot region filled with water                
627     G4Tubs* water_phantom = new G4Tubs("Phanto    
628                                                   
629     waterPhantom_logicalV = new G4LogicalVolum    
630                                                   
631     //place the phantom at one end of the PMMA    
632     WaterPhantom_physicalV = new G4PVPlacement    
633     //waterPhantom_logicalV->SetVisAttributes     
634                                                   
635     //define the surrounding PMMA chamber         
636     G4Tubs* chamberPMMA = new G4Tubs("chamber_    
637                                                   
638     //define the logical volume of the surroun    
639     chamberPMMA_logicalV = new G4LogicalVolume    
640                                                   
641     //define the physical volume of the surrou    
642     chamberPMMA_physicalV = new G4PVPlacement(    
643                                                   
644                                                   
645     //Two cold region chambers: one of them fi    
646     //chamber one filled with water (cold regi    
647     //Define the cold region chamber phantom t    
648     G4Tubs* chamberWater = new G4Tubs("chamber    
649                                                   
650     //Define the logical volume of the cold re    
651     chamberWater_logicalV = new G4LogicalVolum    
652                                                   
653     //Define the physical volume of the cold r    
654     chamberWater_physicalV = new G4PVPlacement    
655                                                   
656     //chamber2 filled with air                    
657     //Place the surrounding chamber at another    
658     chamberPMMA_physicalV = new G4PVPlacement(    
659                                                   
660     //Define the logical volume of the cold re    
661     G4Tubs* chamberAir = new G4Tubs("chamber_p    
662                                                   
663     //Define its logical volume                   
664     chamberAir_logicalV = new G4LogicalVolume(    
665                                                   
666     //Define the physical volume of air-filled    
667     chamberAir_physicalV = new G4PVPlacement(0    
668                                                   
669   }                                               
670                                                   
671   else if(PhantomType == "NEMA_phantom_NECR"){    
672     //////////////////////////////   Phantom f    
673     //The phantom is 203 mm in diameter and 70    
674                                                   
675     //Define its solid shape                      
676     G4Tubs* phantom = new G4Tubs("Phantom", 0*    
677                                                   
678     //Define its logical volume                   
679     phantom_logicalV = new G4LogicalVolume(pha    
680                                                   
681     //Define its physical volume                  
682     phantom_physicalV = new G4PVPlacement(0,G4    
683   }                                               
684   else if(PhantomType == "Phantom_sensitivity"    
685                                                   
686     /////////////////////////////////////////     
687     //There are six diffrent sizes of the sens    
688     //The size of the phantom can be changed v    
689     //The length of sensitivity phantom is 700    
690     //(3.9, 6.4), (7.0, 9.5), (10.2, 12.7), (1    
691                                                   
692     G4double Rmin, Rmax;                          
693     G4cout<<"Total number of sleeves : "<<numO    
694                                                   
695     for(G4int i=0; i<numOfSleeves; i++){          
696       if(i==0){                                   
697         Rmin = 3.9/2 * mm;                        
698         Rmax = 3.2 * mm;                          
699         }                                         
700       if(i==1){                                   
701         Rmin = 7.0/2 * mm;                        
702         Rmax = 4.75 * mm;                         
703       }                                           
704       if(i==2){                                   
705         Rmin = 10.2/2 * mm;                       
706         Rmax = 6.35*mm;                           
707       }                                           
708       if(i==3){                                   
709         Rmin = 13.4/2 * mm;                       
710         Rmax = 7.95 *mm;                          
711       }                                           
712       if(i==4){                                   
713         Rmin = 16.6/2 * mm;                       
714         Rmax = 9.55 * mm;                         
715                                                   
716       }                                           
717       G4cout<<"Sleeve "<<i+1 <<" is placed, Rm    
718                                                   
719       //Concenric aluminum sleeves                
720       G4Tubs* phantom = new G4Tubs("Phantom_se    
721                                                   
722       //Define its logical volume. The Matrial    
723       phantom_logicalV = new G4LogicalVolume(p    
724                                                   
725       //Define its physical volume                
726       phantom_physicalV = new G4PVPlacement(0,    
727     }                                             
728                                                   
729     //Define the inner most polyethylene (PE)     
730     G4Tubs* phantomPE = new G4Tubs("Phantom_se    
731                                                   
732     //Define its logical volume. The Matrial o    
733     phantomPE_logicalV = new G4LogicalVolume(p    
734                                                   
735     //Define its physical volume                  
736     phantomPE_physicalV = new G4PVPlacement(0,    
737                                                   
738                                                   
739     G4cout<<"---------------Phantom dimension:    
740     G4cout<<"---------------Phantom position (    
741   }                                               
742   else if(PhantomType == "Phantom_spatialResol    
743     ////////////////// phantom for point sourc    
744     //The position of the point source phantom    
745     //It has cylindrical shape and its radius     
746                                                   
747     //Define its solid shape                      
748     G4Tubs* phantom = new G4Tubs("Phantom_poin    
749                                                   
750     //Define its logical volume                   
751     phantom_logicalV = new G4LogicalVolume(pha    
752                                                   
753     //place the phantom                           
754     phantomPosition = G4ThreeVector(phantomPos    
755                                                   
756     //Define its physical volume                  
757     phantom_physicalV = new G4PVPlacement(0, p    
758     G4cout<<"---------------Phantom dimension:    
759     G4cout<<"---------------Phantom position:     
760   }                                               
761                                                   
762   else if (PhantomType == "Normalization")        
763   {                                               
764     //The normalization phantom is a hallow cy    
765     //The thickness of the phantom is 3 mm, an    
766                                                   
767     //Define the solid shape.                     
768     G4Tubs* phantom = new G4Tubs("Phantom", ph    
769                                                   
770     //Define its logical volume.                  
771     phantom_logicalV = new G4LogicalVolume(pha    
772                                                   
773     //Define its physical volume                  
774     phantom_physicalV = new G4PVPlacement(0, p    
775                                                   
776                                                   
777     G4cout<<"---------------Phantom dimension:    
778     G4cout<<"---------------Phantom position :    
779                                                   
780   }                                               
781   //-------------------------------------=====    
782   else                                            
783   {                                               
784     G4cerr << "*******************************    
785     exit(0);                                      
786                                                   
787   }                                               
788   ///////////Visualization of phantoms////////    
789                                                   
790   G4VisAttributes* phantomVisAtt;                 
791   phantomVisAtt = new G4VisAttributes(G4Colour    
792   phantomVisAtt->SetVisibility (true);            
793   phantomVisAtt->SetForceWireframe (true);        
794   phantom_logicalV->SetVisAttributes (phantomV    
795   //phantom_logicalV->SetVisAttributes (G4VisA    
796 }                                                 
797                                                   
798 //Change the type of the phantom via .mac file    
799 void doiPETDetectorConstruction::ChangePhantom    
800 {                                                 
801   PhantomType = NewPhantomtype;                   
802 }                                                 
803                                                   
804 //Change position of the phantom via .mac file    
805 void doiPETDetectorConstruction::SetPhantomPos    
806 {                                                 
807   phantomPosition = NewphantomPosition;           
808 }                                                 
809                                                   
810 //Change the radius of the phantom via .mac fi    
811 void doiPETDetectorConstruction::SetPhantomRad    
812   phantomRadius = newPhantomRadius;               
813 }                                                 
814                                                   
815 //Change the length of the phantom via .mac fi    
816 void doiPETDetectorConstruction::SetPhantomLen    
817   phantomLength = newPhantomLength;               
818 }                                                 
819 //                                                
820 void doiPETDetectorConstruction::SetNumberOfSl    
821   numOfSleeves = NewNumOfSleeves;                 
822   //G4cout<<"numOfSleeves "<<numOfSleeves<<G4e    
823 }                                                 
824