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 10.7.p1)


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