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 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/human_phantom/src/G4MIRDRibCage.cc (Version 11.3.0) and /examples/advanced/human_phantom/src/G4MIRDRibCage.cc (Version 9.5)


  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 //                                             <<  26 // Authors: S. Guatelli and M. G. Pia, INFN Genova, Italy
 27 // Previous authors: G. Guerrieri, S. Guatelli << 
 28 // Authors (since 2007): S. Guatelli, Universi << 
 29 //                                                 27 // 
                                                   >>  28 // Based on code developed by the undergraduate student G. Guerrieri 
                                                   >>  29 // Note: this is a preliminary beta-version of the code; an improved 
                                                   >>  30 // version will be distributed in the next Geant4 public release, compliant
                                                   >>  31 // with the design in a forthcoming publication, and subject to a 
                                                   >>  32 // design and code review.
 30 //                                                 33 //
 31 #include "G4MIRDRibCage.hh"                        34 #include "G4MIRDRibCage.hh"
 32                                                    35 
 33 #include "globals.hh"                              36 #include "globals.hh"
 34 #include "G4SystemOfUnits.hh"                  << 
 35 #include "G4SDManager.hh"                          37 #include "G4SDManager.hh"
 36 #include "G4VisAttributes.hh"                      38 #include "G4VisAttributes.hh"
 37 #include "G4HumanPhantomMaterial.hh"               39 #include "G4HumanPhantomMaterial.hh"
 38 #include "G4SubtractionSolid.hh"                   40 #include "G4SubtractionSolid.hh"
 39 #include "G4EllipticalTube.hh"                     41 #include "G4EllipticalTube.hh"
 40 #include "G4PVReplica.hh"                          42 #include "G4PVReplica.hh"
 41 #include "G4Box.hh"                                43 #include "G4Box.hh"
 42 #include "G4PVPlacement.hh"                        44 #include "G4PVPlacement.hh"
 43 #include "G4HumanPhantomColour.hh"                 45 #include "G4HumanPhantomColour.hh"
 44 G4MIRDRibCage::G4MIRDRibCage():fPhysRib1(nullp <<  46 
 45               fPhysRib4(nullptr), fPhysRib5(nu <<  47 G4MIRDRibCage::G4MIRDRibCage()
 46               fPhysRib7(nullptr), fPhysRib8(nu <<  48 {
 47               fPhysRib10(nullptr), fPhysRib11( <<  49 }
 48 {;}                                            <<  50 
                                                   >>  51 G4MIRDRibCage::~G4MIRDRibCage()
                                                   >>  52 {
                                                   >>  53   }
 49                                                    54 
 50 G4VPhysicalVolume* G4MIRDRibCage::Construct(co     55 G4VPhysicalVolume* G4MIRDRibCage::Construct(const G4String& volumeName, G4VPhysicalVolume* mother,
 51               const G4String& colourName, G4bo <<  56              const G4String& colourName, G4bool wireFrame, G4bool sensitivity)
 52                                                << 
 53 {                                                  57 {
 54   auto* material = new G4HumanPhantomMaterial( <<  58   G4HumanPhantomMaterial* material = new G4HumanPhantomMaterial();
 55                                                    59    
 56   G4cout<<"Construct "<<volumeName<<" with mot <<  60   G4cout << "Construct "<< volumeName  <<G4endl;
 57                                                    61    
 58   auto* skeleton = material -> GetMaterial("sk <<  62   G4Material* skeleton = material -> GetMaterial("skeleton");
 59   auto* soft = material -> GetMaterial("soft_t <<  63   G4Material* soft = material -> GetMaterial("soft_tissue");
 60                                                    64  
 61   delete material;                                 65   delete material; 
 62                                                    66 
 63   G4double dx= 17. *cm; // a2                      67   G4double dx= 17. *cm; // a2
 64   G4double dy= 9.8 * cm; //b2                      68   G4double dy= 9.8 * cm; //b2
 65   G4double thickness= 32.4 * cm; // z2/2 of ca     69   G4double thickness= 32.4 * cm; // z2/2 of cage
 66                                                    70 
 67   auto* outCage = new G4EllipticalTube("outCag <<  71   G4EllipticalTube* outCage = new G4EllipticalTube("outCage",dx, dy, thickness/2.);
 68                                                    72 
 69   dx = 16.4 * cm; // a1                            73   dx = 16.4 * cm; // a1
 70   dy = 9.2 * cm; // b1                             74   dy = 9.2 * cm; // b1
 71   G4double dz = 34. *cm; // z2/2                   75   G4double dz = 34. *cm; // z2/2
 72                                                    76 
 73   auto* inCage = new G4EllipticalTube("inCage" <<  77   G4EllipticalTube* inCage = new G4EllipticalTube("inCage",dx, dy, dz/2.);
 74                                                    78 
 75   auto* cage = new G4SubtractionSolid("Cage",  <<  79   G4SubtractionSolid* cage = new G4SubtractionSolid("Cage",
 76                 outCage,                       <<  80                  outCage,
 77                 inCage, nullptr, G4ThreeVector <<  81                  inCage, 0, G4ThreeVector(0.*cm, 0.*cm, 0. * cm)); 
 78                                                    82 
 79                                                    83  
 80   auto* logicRibCage = new G4LogicalVolume(cag <<  84   G4LogicalVolume* logicRibCage = new G4LogicalVolume(cage, soft, "LogicalCage", 0, 0, 0);
 81                                                    85 
 82   G4VPhysicalVolume* physRibCage = new G4PVPla <<  86   G4VPhysicalVolume* physRibCage = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, thickness/2. + 0.1 * cm),
 83                  // with respect to the trunk  <<  87                   // with respect to the trunk
 84                  "physicalRibCage",            <<  88                   "physicalRibCage",
 85                  logicRibCage,                 <<  89                   logicRibCage,
 86                  mother,                       <<  90                   mother,
 87                  false,                        <<  91                   false,
 88                  0, true);                     <<  92                   0, true);
 89                                                    93   
                                                   >>  94   
 90   G4double xx = 17.*cm;                            95   G4double xx = 17.*cm;
 91   G4double yy = 9.8*cm;                            96   G4double yy = 9.8*cm;
 92   G4double ribThickness = 1.4*cm;                  97   G4double ribThickness = 1.4*cm;
 93   auto* rib_out = new G4EllipticalTube("rib_ou <<  98   G4EllipticalTube* rib_out = new G4EllipticalTube("rib_out",xx, yy, ribThickness/2.);  
 94                                                    99   
 95   xx = 16.5 *cm;                                  100   xx = 16.5 *cm;
 96   yy = 9.3 * cm;                                  101   yy = 9.3 * cm;
 97   G4double zz = 1.5 * cm;                         102   G4double zz = 1.5 * cm;  
 98   auto* rib_in = new G4EllipticalTube("rib_in" << 103   G4EllipticalTube* rib_in = new G4EllipticalTube("rib_in",xx, yy, zz/2.);
 99   auto* rib = new G4SubtractionSolid("rib",rib << 104   G4SubtractionSolid* rib = new G4SubtractionSolid("rib",rib_out, rib_in);
100                                                   105 
101   auto* logicRib= new G4LogicalVolume(rib, ske << 106   G4LogicalVolume* logicRib= new G4LogicalVolume(rib, skeleton, "logical" + volumeName, 0, 0, 0);
102                                                   107 
103   fPhysRib1 = new G4PVPlacement(nullptr,G4Thre << 108   physRib1 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (- 32.2*cm/2. + 0.8 *cm)),
104              // with respect to the trunk      << 109                   // with respect to the trunk
105              "physicalRib",                    << 110                   "physicalRib",
106              logicRib,                         << 111                   logicRib,
107              physRibCage,                      << 112                   physRibCage,
108              false,                            << 113                   false,
109              0, true);                         << 114                   0, true);
110                                                << 115 
111   fPhysRib2 = new G4PVPlacement(nullptr,G4Thre << 116    physRib2 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, ( - 32.2*cm/2. + 0.8 *cm + 2.8 *cm)),
112              // with respect to the trunk      << 117                   // with respect to the trunk
113              "physicalRib",                    << 118                   "physicalRib",
114              logicRib,                         << 119                   logicRib,
115              physRibCage,                      << 120                   physRibCage,
116              false,                            << 121                   false,
117              0, true);                         << 122                   0, true);
118                                                << 123 
119   fPhysRib3 = new G4PVPlacement(nullptr,G4Thre << 124    physRib3 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 5.6 *cm)),
120              // with respect to the trunk      << 125                   // with respect to the trunk
121              "physicalRib",                    << 126                   "physicalRib",
122              logicRib,                         << 127                   logicRib,
123              physRibCage,                      << 128                   physRibCage,
124              false,                            << 129                   false,
125              0, true);                         << 130                   0, true);
126                                                << 131 
127   fPhysRib4 = new G4PVPlacement(nullptr,G4Thre << 132   physRib4 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 8.4 *cm)),
128              // with respect to the trunk      << 133                   // with respect to the trunk
129              "physicalRib",                    << 134                   "physicalRib",
130              logicRib,                         << 135                   logicRib,
131              physRibCage,                      << 136                   physRibCage,
132              false,                            << 137                   false,
133              0, true);                         << 138                   0, true);
134                                                << 139 
135   fPhysRib5 = new G4PVPlacement(nullptr,G4Thre << 140  physRib5 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 * cm + 11.2 *cm)),
136              // with respect to the trunk      << 141                   // with respect to the trunk
137              "physicalRib",                    << 142                   "physicalRib",
138              logicRib,                         << 143                   logicRib,
139              physRibCage,                      << 144                   physRibCage,
140              false,                            << 145                   false,
141              0, true);                         << 146                   0, true);
142                                                << 147 
143   fPhysRib6 = new G4PVPlacement(nullptr,G4Thre << 148  physRib6 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. +  0.8 * cm + 14. *cm)),
144              // with respect to the trunk      << 149                   // with respect to the trunk
145              "physicalRib",                    << 150                   "physicalRib",
146              logicRib,                         << 151                   logicRib,
147              physRibCage,                      << 152                   physRibCage,
148              false,                            << 153                   false,
149              0, true);                         << 154                   0, true);
150                                                << 155 
151   fPhysRib7 = new G4PVPlacement(nullptr,G4Thre << 156  physRib7 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 *cm + 16.8 *cm)),
152              // with respect to the trunk      << 157                   // with respect to the trunk
153              "physicalRib",                    << 158                   "physicalRib",
154              logicRib,                         << 159                   logicRib,
155              physRibCage,                      << 160                   physRibCage,
156              false,                            << 161                   false,
157              0, true);                         << 162                   0, true);
158                                                << 163 
159   fPhysRib8 = new G4PVPlacement(nullptr,G4Thre << 164  physRib8 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8 *cm + 19.6 *cm)),
160              // with respect to the trunk      << 165                   // with respect to the trunk
161              "physicalRib",                    << 166                   "physicalRib",
162              logicRib,                         << 167                   logicRib,
163              physRibCage,                      << 168                   physRibCage,
164              false,                            << 169                   false,
165              0, true);                         << 170                   0, true);
166                                                << 171 
167   fPhysRib9 = new G4PVPlacement(nullptr,G4Thre << 172  physRib9 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 22.4 *cm)),
168              // with respect to the trunk      << 173                   // with respect to the trunk
169              "physicalRib",                    << 174                   "physicalRib",
170              logicRib,                         << 175                   logicRib,
171              physRibCage,                      << 176                   physRibCage,
172              false,                            << 177                   false,
173              0, true);                         << 178                   0, true);
174                                                << 179 
175   fPhysRib10 = new G4PVPlacement(nullptr, G4Th << 180  physRib10 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 25.2 *cm)),
176         // with respect to the trunk           << 181                   // with respect to the trunk
177         "physicalRib",                         << 182                   "physicalRib",
178         logicRib,                              << 183                   logicRib,
179         physRibCage,                           << 184                   physRibCage,
180         false,                                 << 185                   false,
181         0, true);                              << 186                   0, true);
182                                                << 187 
183   fPhysRib11 = new G4PVPlacement(nullptr,G4Thr << 188  physRib11 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 28. *cm)),
184         // with respect to the trunk           << 189                   // with respect to the trunk
185         "physicalRib",                         << 190                   "physicalRib",
186         logicRib,                              << 191                   logicRib,
187         physRibCage,                           << 192                   physRibCage,
188         false,                                 << 193                   false,
189         0, true);                              << 194                   0, true);
190                                                << 195 
191   fPhysRib12 = new G4PVPlacement(nullptr,G4Thr << 196   physRib12 = new G4PVPlacement(0,G4ThreeVector(0.0, 0.0, (-thickness/2. + 0.8*cm + 30.8 *cm)),
192         // with respect to the trunk           << 197                   // with respect to the trunk
193         "physicalRib",                         << 198                   "physicalRib",
194         logicRib,                              << 199                   logicRib,
195         physRibCage,                           << 200                   physRibCage,
196         false,                                 << 201                   false,
197         0, true);                              << 202                   0, true);
198                                                   203   
                                                   >> 204   // Sensitive Body Part
                                                   >> 205   if (sensitivity==true)
                                                   >> 206   { 
                                                   >> 207     G4SDManager* SDman = G4SDManager::GetSDMpointer();
                                                   >> 208     //    logicRibCage->SetSensitiveDetector( SDman->FindSensitiveDetector("BodyPartSD") );
                                                   >> 209     logicRib->SetSensitiveDetector( SDman->FindSensitiveDetector("BodyPartSD") );
                                                   >> 210   }
                                                   >> 211 
199   // Visualization Attributes                     212   // Visualization Attributes
200   logicRibCage -> SetVisAttributes(G4VisAttrib << 213   logicRibCage -> SetVisAttributes(G4VisAttributes::Invisible);
201                                                   214 
202   //G4VisAttributes* RibCageVisAtt = new G4Vis    215   //G4VisAttributes* RibCageVisAtt = new G4VisAttributes(G4Colour(0.46,0.53,0.6));
203                                                   216 
204   auto* colourPointer = new G4HumanPhantomColo << 217   G4HumanPhantomColour* colourPointer = new G4HumanPhantomColour();
205   G4Colour colour = colourPointer -> GetColour    218   G4Colour colour = colourPointer -> GetColour(colourName);
206   auto* RibCageVisAtt = new G4VisAttributes(co << 219   G4VisAttributes* RibCageVisAtt = new G4VisAttributes(colour); 
207   RibCageVisAtt->SetForceSolid(wireFrame);        220   RibCageVisAtt->SetForceSolid(wireFrame);
208   logicRib->SetVisAttributes(RibCageVisAtt);      221   logicRib->SetVisAttributes(RibCageVisAtt);
209                                                   222 
210   G4cout << "RibCage created !!!!!!" << G4endl    223   G4cout << "RibCage created !!!!!!" << G4endl;
211   // Testing Pelvis Volume                        224   // Testing Pelvis Volume
212   G4double RibCageVol = logicRib->GetSolid()->    225   G4double RibCageVol = logicRib->GetSolid()->GetCubicVolume();
213   G4cout << "Volume of RibCage = " << ((RibCag    226   G4cout << "Volume of RibCage = " << ((RibCageVol)*12.)/cm3 << " cm^3" << G4endl;
214                                                   227   
215   // Testing RibCage Material                     228   // Testing RibCage Material
216   G4String RibCageMat = logicRib->GetMaterial(    229   G4String RibCageMat = logicRib->GetMaterial()->GetName();
217   G4cout << "Material of RibCage = " << RibCag    230   G4cout << "Material of RibCage = " << RibCageMat << G4endl;
218                                                   231   
219   // Testing Density                              232   // Testing Density
220   G4double RibCageDensity = logicRib->GetMater    233   G4double RibCageDensity = logicRib->GetMaterial()->GetDensity();
221   G4cout << "Density of Material = " << RibCag    234   G4cout << "Density of Material = " << RibCageDensity*cm3/g << " g/cm^3" << G4endl;
222                                                   235 
223   // Testing Mass                                 236   // Testing Mass
224   G4double RibCageMass = (RibCageVol)* RibCage    237   G4double RibCageMass = (RibCageVol)* RibCageDensity * 12;// 12 is the total number of ribs;
225   G4cout << "Mass of RibCage = " << (RibCageMa    238   G4cout << "Mass of RibCage = " << (RibCageMass)/gram << " g" << G4endl;
226                                                   239 
227   return physRibCage;                             240   return physRibCage;
228 }                                                 241 }
229                                                   242