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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/extended/visualization/userVisAction/src/B1DetectorConstruction.cc (Version 11.3.0) and /examples/extended/visualization/userVisAction/src/B1DetectorConstruction.cc (Version 11.2)


  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 //
 27 /// \file B1DetectorConstruction.cc                27 /// \file B1DetectorConstruction.cc
 28 /// \brief Implementation of the B1DetectorCon     28 /// \brief Implementation of the B1DetectorConstruction class
 29                                                    29 
 30 #include "B1DetectorConstruction.hh"               30 #include "B1DetectorConstruction.hh"
 31                                                    31 
                                                   >>  32 #include "G4RunManager.hh"
                                                   >>  33 #include "G4NistManager.hh"
 32 #include "G4Box.hh"                                34 #include "G4Box.hh"
 33 #include "G4Cons.hh"                               35 #include "G4Cons.hh"
 34 #include "G4LogicalVolume.hh"                  << 
 35 #include "G4NistManager.hh"                    << 
 36 #include "G4Orb.hh"                                36 #include "G4Orb.hh"
 37 #include "G4PVPlacement.hh"                    << 
 38 #include "G4RunManager.hh"                     << 
 39 #include "G4Sphere.hh"                             37 #include "G4Sphere.hh"
 40 #include "G4SystemOfUnits.hh"                  << 
 41 #include "G4Trd.hh"                                38 #include "G4Trd.hh"
                                                   >>  39 #include "G4LogicalVolume.hh"
                                                   >>  40 #include "G4PVPlacement.hh"
                                                   >>  41 #include "G4SystemOfUnits.hh"
 42                                                    42 
 43 //....oooOO0OOooo........oooOO0OOooo........oo     43 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 44                                                    44 
 45 B1DetectorConstruction::B1DetectorConstruction <<  45 B1DetectorConstruction::B1DetectorConstruction()
 46 {}                                             <<  46 : G4VUserDetectorConstruction(),
                                                   >>  47   fScoringVolume(0)
                                                   >>  48 { }
 47                                                    49 
 48 //....oooOO0OOooo........oooOO0OOooo........oo     50 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 49                                                    51 
 50 B1DetectorConstruction::~B1DetectorConstructio <<  52 B1DetectorConstruction::~B1DetectorConstruction()
                                                   >>  53 { }
 51                                                    54 
 52 //....oooOO0OOooo........oooOO0OOooo........oo     55 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 53                                                    56 
 54 G4VPhysicalVolume* B1DetectorConstruction::Con     57 G4VPhysicalVolume* B1DetectorConstruction::Construct()
 55 {                                              <<  58 {  
 56   // Get nist material manager                     59   // Get nist material manager
 57   G4NistManager* nist = G4NistManager::Instanc     60   G4NistManager* nist = G4NistManager::Instance();
 58                                                <<  61   
 59   // Envelope parameters                           62   // Envelope parameters
 60   //                                               63   //
 61   G4double env_sizeXY = 20 * cm, env_sizeZ = 3 <<  64   G4double env_sizeXY = 20*cm, env_sizeZ = 30*cm;
 62   G4Material* env_mat = nist->FindOrBuildMater     65   G4Material* env_mat = nist->FindOrBuildMaterial("G4_WATER");
 63                                                <<  66    
 64   // Option to switch on/off checking of volum     67   // Option to switch on/off checking of volumes overlaps
 65   //                                               68   //
 66   G4bool checkOverlaps = true;                     69   G4bool checkOverlaps = true;
 67                                                    70 
 68   //                                           <<  71   //     
 69   // World                                         72   // World
 70   //                                               73   //
 71   G4double world_sizeXY = 1.2 * env_sizeXY;    <<  74   G4double world_sizeXY = 1.2*env_sizeXY;
 72   G4double world_sizeZ = 1.2 * env_sizeZ;      <<  75   G4double world_sizeZ  = 1.2*env_sizeZ;
 73   G4Material* world_mat = nist->FindOrBuildMat     76   G4Material* world_mat = nist->FindOrBuildMaterial("G4_AIR");
 74                                                <<  77   
 75   G4Box* solidWorld =                          <<  78   G4Box* solidWorld =    
 76     new G4Box("World",  // its name            <<  79     new G4Box("World",                       //its name
 77               0.5 * world_sizeXY, 0.5 * world_ <<  80        0.5*world_sizeXY, 0.5*world_sizeXY, 0.5*world_sizeZ);     //its size
 78                                                <<  81       
 79   G4LogicalVolume* logicWorld = new G4LogicalV <<  82   G4LogicalVolume* logicWorld =                         
 80                                                <<  83     new G4LogicalVolume(solidWorld,          //its solid
 81                                                <<  84                         world_mat,           //its material
 82                                                <<  85                         "World");            //its name
 83   G4VPhysicalVolume* physWorld = new G4PVPlace <<  86                                    
 84                                                <<  87   G4VPhysicalVolume* physWorld = 
 85                                                <<  88     new G4PVPlacement(0,                     //no rotation
 86                                                <<  89                       G4ThreeVector(),       //at (0,0,0)
 87                                                <<  90                       logicWorld,            //its logical volume
 88                                                <<  91                       "World",               //its name
 89                                                <<  92                       0,                     //its mother  volume
 90                                                <<  93                       false,                 //no boolean operation
 91                                                <<  94                       0,                     //copy number
 92   //                                           <<  95                       checkOverlaps);        //overlaps checking
                                                   >>  96                      
                                                   >>  97   //     
 93   // Envelope                                      98   // Envelope
 94   //                                           <<  99   //  
 95   G4Box* solidEnv = new G4Box("Envelope",  //  << 100   G4Box* solidEnv =    
 96                               0.5 * env_sizeXY << 101     new G4Box("Envelope",                    //its name
 97                                                << 102         0.5*env_sizeXY, 0.5*env_sizeXY, 0.5*env_sizeZ); //its size
 98   G4LogicalVolume* logicEnv = new G4LogicalVol << 103       
 99                                                << 104   G4LogicalVolume* logicEnv =                         
100                                                << 105     new G4LogicalVolume(solidEnv,            //its solid
101                                                << 106                         env_mat,             //its material
102   new G4PVPlacement(0,  // no rotation         << 107                         "Envelope");         //its name
103                     G4ThreeVector(),  // at (0 << 108                
104                     logicEnv,  // its logical  << 109   new G4PVPlacement(0,                       //no rotation
105                     "Envelope",  // its name   << 110                     G4ThreeVector(),         //at (0,0,0)
106                     logicWorld,  // its mother << 111                     logicEnv,                //its logical volume
107                     false,  // no boolean oper << 112                     "Envelope",              //its name
108                     0,  // copy number         << 113                     logicWorld,              //its mother  volume
109                     checkOverlaps);  // overla << 114                     false,                   //no boolean operation
110                                                << 115                     0,                       //copy number
111   //                                           << 116                     checkOverlaps);          //overlaps checking
                                                   >> 117  
                                                   >> 118   //     
112   // Shape 1                                      119   // Shape 1
113   //                                           << 120   //  
114   G4Material* shape1_mat = nist->FindOrBuildMa    121   G4Material* shape1_mat = nist->FindOrBuildMaterial("G4_A-150_TISSUE");
115   G4ThreeVector pos1 = G4ThreeVector(0, 2 * cm << 122   G4ThreeVector pos1 = G4ThreeVector(0, 2*cm, -7*cm);
                                                   >> 123         
                                                   >> 124   // Conical section shape       
                                                   >> 125   G4double shape1_rmina =  0.*cm, shape1_rmaxa = 2.*cm;
                                                   >> 126   G4double shape1_rminb =  0.*cm, shape1_rmaxb = 4.*cm;
                                                   >> 127   G4double shape1_hz = 3.*cm;
                                                   >> 128   G4double shape1_phimin = 0.*deg, shape1_phimax = 360.*deg;
                                                   >> 129   G4Cons* solidShape1 =    
                                                   >> 130     new G4Cons("Shape1", 
                                                   >> 131     shape1_rmina, shape1_rmaxa, shape1_rminb, shape1_rmaxb, shape1_hz,
                                                   >> 132     shape1_phimin, shape1_phimax);
                                                   >> 133                       
                                                   >> 134   G4LogicalVolume* logicShape1 =                         
                                                   >> 135     new G4LogicalVolume(solidShape1,         //its solid
                                                   >> 136                         shape1_mat,          //its material
                                                   >> 137                         "Shape1");           //its name
                                                   >> 138                
                                                   >> 139   new G4PVPlacement(0,                       //no rotation
                                                   >> 140                     pos1,                    //at position
                                                   >> 141                     logicShape1,             //its logical volume
                                                   >> 142                     "Shape1",                //its name
                                                   >> 143                     logicEnv,                //its mother  volume
                                                   >> 144                     false,                   //no boolean operation
                                                   >> 145                     0,                       //copy number
                                                   >> 146                     checkOverlaps);          //overlaps checking
116                                                   147 
117   // Conical section shape                     << 
118   G4double shape1_rmina = 0. * cm, shape1_rmax << 
119   G4double shape1_rminb = 0. * cm, shape1_rmax << 
120   G4double shape1_hz = 3. * cm;                << 
121   G4double shape1_phimin = 0. * deg, shape1_ph << 
122   G4Cons* solidShape1 = new G4Cons("Shape1", s << 
123                                    shape1_hz,  << 
124                                                << 
125   G4LogicalVolume* logicShape1 = new G4Logical << 
126                                                << 
127                                                << 
128                                                << 
129   new G4PVPlacement(0,  // no rotation         << 
130                     pos1,  // at position      << 
131                     logicShape1,  // its logic << 
132                     "Shape1",  // its name     << 
133                     logicEnv,  // its mother   << 
134                     false,  // no boolean oper << 
135                     0,  // copy number         << 
136                     checkOverlaps);  // overla << 
137                                                   148 
138   //                                           << 149   //     
139   // Shape 2                                      150   // Shape 2
140   //                                              151   //
141   G4Material* shape2_mat = nist->FindOrBuildMa    152   G4Material* shape2_mat = nist->FindOrBuildMaterial("G4_BONE_COMPACT_ICRU");
142   G4ThreeVector pos2 = G4ThreeVector(0, -1 * c << 153   G4ThreeVector pos2 = G4ThreeVector(0, -1*cm, 7*cm);
143                                                << 
144   // Trapezoid shape                           << 
145   G4double shape2_dxa = 12 * cm, shape2_dxb =  << 
146   G4double shape2_dya = 10 * cm, shape2_dyb =  << 
147   G4double shape2_dz = 6 * cm;                 << 
148   G4Trd* solidShape2 = new G4Trd("Shape2",  // << 
149                                  0.5 * shape2_ << 
150                                  0.5 * shape2_ << 
151                                                << 
152   G4LogicalVolume* logicShape2 = new G4Logical << 
153                                                << 
154                                                << 
155                                                << 
156   new G4PVPlacement(0,  // no rotation         << 
157                     pos2,  // at position      << 
158                     logicShape2,  // its logic << 
159                     "Shape2",  // its name     << 
160                     logicEnv,  // its mother   << 
161                     false,  // no boolean oper << 
162                     0,  // copy number         << 
163                     checkOverlaps);  // overla << 
164                                                   154 
                                                   >> 155   // Trapezoid shape       
                                                   >> 156   G4double shape2_dxa = 12*cm, shape2_dxb = 12*cm;
                                                   >> 157   G4double shape2_dya = 10*cm, shape2_dyb = 16*cm;
                                                   >> 158   G4double shape2_dz  = 6*cm;      
                                                   >> 159   G4Trd* solidShape2 =    
                                                   >> 160     new G4Trd("Shape2",                      //its name
                                                   >> 161               0.5*shape2_dxa, 0.5*shape2_dxb, 
                                                   >> 162               0.5*shape2_dya, 0.5*shape2_dyb, 0.5*shape2_dz); //its size
                                                   >> 163                 
                                                   >> 164   G4LogicalVolume* logicShape2 =                         
                                                   >> 165     new G4LogicalVolume(solidShape2,         //its solid
                                                   >> 166                         shape2_mat,          //its material
                                                   >> 167                         "Shape2");           //its name
                                                   >> 168                
                                                   >> 169   new G4PVPlacement(0,                       //no rotation
                                                   >> 170                     pos2,                    //at position
                                                   >> 171                     logicShape2,             //its logical volume
                                                   >> 172                     "Shape2",                //its name
                                                   >> 173                     logicEnv,                //its mother  volume
                                                   >> 174                     false,                   //no boolean operation
                                                   >> 175                     0,                       //copy number
                                                   >> 176                     checkOverlaps);          //overlaps checking
                                                   >> 177                 
165   // Set Shape2 as scoring volume                 178   // Set Shape2 as scoring volume
166   //                                              179   //
167   fScoringVolume = logicShape2;                   180   fScoringVolume = logicShape2;
168                                                   181 
169   //                                              182   //
170   // always return the physical World          << 183   //always return the physical World
171   //                                              184   //
172   return physWorld;                               185   return physWorld;
173 }                                                 186 }
174                                                   187 
175 //....oooOO0OOooo........oooOO0OOooo........oo    188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
176                                                   189