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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/movies/src/MoviesDetectorConstruction.cc (Version 11.3.0) and /examples/extended/visualization/movies/src/MoviesDetectorConstruction.cc (Version 11.1.1)


  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 /// \file MoviesDetectorConstruction.cc            26 /// \file MoviesDetectorConstruction.cc
 27 /// \brief Implementation of the MoviesDetecto     27 /// \brief Implementation of the MoviesDetectorConstruction class
 28 //                                             <<  28 // 
 29                                                    29 
 30 #include "MoviesDetectorConstruction.hh"           30 #include "MoviesDetectorConstruction.hh"
 31                                                    31 
 32 #include "G4Box.hh"                            << 
 33 #include "G4LogicalVolume.hh"                  << 
 34 #include "G4Material.hh"                           32 #include "G4Material.hh"
 35 #include "G4NistManager.hh"                        33 #include "G4NistManager.hh"
                                                   >>  34 
                                                   >>  35 #include "G4Box.hh"
                                                   >>  36 #include "G4LogicalVolume.hh"
 36 #include "G4PVPlacement.hh"                        37 #include "G4PVPlacement.hh"
 37 #include "G4PVReplica.hh"                          38 #include "G4PVReplica.hh"
 38 #include "G4PhysicalConstants.hh"              <<  39 
 39 #include "G4SystemOfUnits.hh"                  << 
 40 #include "G4VisAttributes.hh"                      40 #include "G4VisAttributes.hh"
 41                                                    41 
 42 //....oooOO0OOooo........oooOO0OOooo........oo <<  42 #include "G4PhysicalConstants.hh"
                                                   >>  43 #include "G4SystemOfUnits.hh"
 43                                                    44 
 44 G4VPhysicalVolume* MoviesDetectorConstruction:     45 G4VPhysicalVolume* MoviesDetectorConstruction::Construct()
 45 {                                                  46 {
 46   // Define materials                          <<  47   // Define materials 
 47   DefineMaterials();                               48   DefineMaterials();
 48                                                <<  49   
 49   // Define volumes                                50   // Define volumes
 50   return DefineVolumes();                          51   return DefineVolumes();
 51 }                                                  52 }
 52                                                    53 
 53 //....oooOO0OOooo........oooOO0OOooo........oo << 
 54                                                << 
 55 void MoviesDetectorConstruction::DefineMateria     54 void MoviesDetectorConstruction::DefineMaterials()
 56 {                                              <<  55 { 
 57   auto nistManager = G4NistManager::Instance()     56   auto nistManager = G4NistManager::Instance();
 58                                                    57 
 59   // Lead material defined using NIST Manager      58   // Lead material defined using NIST Manager
 60   nistManager->FindOrBuildMaterial("G4_Pb");       59   nistManager->FindOrBuildMaterial("G4_Pb");
 61                                                    60 
 62   // Liquid argon material                         61   // Liquid argon material
 63   G4double a;  // mass of a mole;                  62   G4double a;  // mass of a mole;
 64   G4double z;  // z=mean number of protons;    <<  63   G4double z;  // z=mean number of protons;  
 65   G4double density;                            <<  64   G4double density; 
 66   new G4Material("liquidArgon", z = 18., a = 3 <<  65   new G4Material("liquidArgon", z=18., a=39.95*g/mole, density=1.390*g/cm3);
 67   // The argon by NIST Manager is a gas with a <<  66          // The argon by NIST Manager is a gas with a different density
 68                                                    67 
 69   // Vacuum                                        68   // Vacuum
 70   nistManager->FindOrBuildMaterial("G4_Galacti     69   nistManager->FindOrBuildMaterial("G4_Galactic");
 71                                                    70 
 72   // Print materials                               71   // Print materials
 73   G4cout << *(G4Material::GetMaterialTable())      72   G4cout << *(G4Material::GetMaterialTable()) << G4endl;
 74 }                                                  73 }
 75                                                    74 
 76 //....oooOO0OOooo........oooOO0OOooo........oo << 
 77                                                << 
 78 G4VPhysicalVolume* MoviesDetectorConstruction:     75 G4VPhysicalVolume* MoviesDetectorConstruction::DefineVolumes()
 79 {                                                  76 {
 80   // Geometry parameters                           77   // Geometry parameters
 81   const G4bool checkOverlaps = true;               78   const G4bool checkOverlaps = true;
 82                                                    79 
 83   // A generous world                              80   // A generous world
 84   const G4double worldSizeXY = 1. * m;         <<  81   const G4double worldSizeXY = 1.*m;
 85   const G4double worldSizeZ = 1. * m;          <<  82   const G4double worldSizeZ  = 1.*m;
 86                                                    83 
 87   // Lead-argon calorimeter                        84   // Lead-argon calorimeter
 88   G4int nofLayers = 10;                            85   G4int nofLayers = 10;
 89   G4double absoThickness = 10. * mm;           <<  86   G4double absoThickness = 10.*mm;
 90   G4double gapThickness = 5. * mm;             <<  87   G4double gapThickness =  5.*mm;
 91   G4double calorSizeXY = 10. * cm;             <<  88   G4double calorSizeXY  = 10.*cm;
 92                                                    89 
 93   auto layerThickness = absoThickness + gapThi     90   auto layerThickness = absoThickness + gapThickness;
 94   auto calorThickness = nofLayers * layerThick     91   auto calorThickness = nofLayers * layerThickness;
 95                                                    92 
 96   // Get materials                                 93   // Get materials
 97   auto defaultMaterial = G4Material::GetMateri     94   auto defaultMaterial = G4Material::GetMaterial("G4_Galactic");
 98   auto absorberMaterial = G4Material::GetMater     95   auto absorberMaterial = G4Material::GetMaterial("G4_Pb");
 99   auto gapMaterial = G4Material::GetMaterial("     96   auto gapMaterial = G4Material::GetMaterial("liquidArgon");
100                                                    97 
101   // World                                         98   // World
102   auto worldS = new G4Box("World", worldSizeXY <<  99   auto worldS
103                                                << 100     = new G4Box("World",worldSizeXY/2,worldSizeXY/2,worldSizeZ/2);
104   auto worldLV = new G4LogicalVolume(worldS,   << 101                          
105                                      defaultMa << 102   auto worldLV
106                                      "World"); << 103     = new G4LogicalVolume(
107                                                << 104                  worldS,           // its solid
108   auto worldPV = new G4PVPlacement(0,  // no r << 105                  defaultMaterial,  // its material
109                                    G4ThreeVect << 106                  "World");         // its name
110                                    worldLV,  / << 107                                    
111                                    "World",  / << 108   auto worldPV
112                                    0,  // its  << 109     = new G4PVPlacement(
113                                    false,  //  << 110                  0,                // no rotation
114                                    0,  // copy << 111                  G4ThreeVector(),  // at (0,0,0)
115                                    checkOverla << 112                  worldLV,          // its logical volume                         
                                                   >> 113                  "World",          // its name
                                                   >> 114                  0,                // its mother  volume
                                                   >> 115                  false,            // no boolean operation
                                                   >> 116                  0,                // copy number
                                                   >> 117                  checkOverlaps);  // checking overlaps
                                                   >> 118   
116                                                   119 
117   // Calorimeter                                  120   // Calorimeter
118                                                   121 
119   auto calorimeterS =                          << 122   auto calorimeterS
120     new G4Box("Calorimeter", calorSizeXY / 2,  << 123     = new G4Box("Calorimeter",calorSizeXY/2,calorSizeXY/2,calorThickness/2);
121                                                << 124                          
122   auto calorLV = new G4LogicalVolume(calorimet << 125   auto calorLV
123                                      defaultMa << 126     = new G4LogicalVolume(
124                                      "Calorime << 127                  calorimeterS,     // its solid
125                                                << 128                  defaultMaterial,  // its material
126   new G4PVPlacement(0,  // no rotation         << 129                  "Calorimeter");   // its name
127                     G4ThreeVector(),  // at (0 << 130                                    
128                     calorLV,  // its logical v << 131   new G4PVPlacement(
129                     "Calorimeter",  // its nam << 132                  0,                // no rotation
130                     worldLV,  // its mother  v << 133                  G4ThreeVector(),  // at (0,0,0)
131                     false,  // no boolean oper << 134                  calorLV,          // its logical volume                         
132                     0,  // copy number         << 135                  "Calorimeter",    // its name
133                     checkOverlaps);  // checki << 136                  worldLV,          // its mother  volume
134                                                << 137                  false,            // no boolean operation
                                                   >> 138                  0,                // copy number
                                                   >> 139                  checkOverlaps);  // checking overlaps
                                                   >> 140   
135   // Layer                                        141   // Layer
136                                                   142 
137   auto layerS = new G4Box("Layer",  // its nam << 143   auto layerS 
138                           calorSizeXY / 2, cal << 144     = new G4Box("Layer",           // its name
139                                                << 145                  calorSizeXY/2, calorSizeXY/2, layerThickness/2); // its size
140   auto layerLV = new G4LogicalVolume(layerS,   << 146                          
141                                      defaultMa << 147   auto layerLV
142                                      "Layer"); << 148     = new G4LogicalVolume(
143                                                << 149                  layerS,           // its solid
144   new G4PVReplica("Layer",  // its name        << 150                  defaultMaterial,  // its material
145                   layerLV,  // its logical vol << 151                  "Layer");         // its name
146                   calorLV,  // its mother      << 152 
147                   kZAxis,  // axis of replicat << 153   new G4PVReplica(
148                   nofLayers,  // number of rep << 154                  "Layer",          // its name
149                   layerThickness);  // witdth  << 155                  layerLV,          // its logical volume
150                                                << 156                  calorLV,          // its mother
                                                   >> 157                  kZAxis,           // axis of replication
                                                   >> 158                  nofLayers,        // number of replica
                                                   >> 159                  layerThickness);  // witdth of replica
                                                   >> 160   
151   // Absorber                                     161   // Absorber
152                                                   162 
153   auto absorberS = new G4Box("Abso",  // its n << 163   auto absorberS 
154                              calorSizeXY / 2,  << 164     = new G4Box("Abso",            // its name
155                                                << 165                  calorSizeXY/2, calorSizeXY/2, absoThickness/2); // its size
156   auto absorberLV = new G4LogicalVolume(absorb << 166                          
157                                         absorb << 167   auto absorberLV
158                                         "Abso" << 168     = new G4LogicalVolume(
159                                                << 169                  absorberS,        // its solid
160   new G4PVPlacement(0,  // no rotation         << 170                  absorberMaterial, // its material
161                     G4ThreeVector(0., 0., -gap << 171                  "Abso");          // its name
162                     absorberLV,  // its logica << 172                                    
163                     "Abso",  // its name       << 173   new G4PVPlacement(
164                     layerLV,  // its mother  v << 174                  0,                // no rotation
165                     false,  // no boolean oper << 175                  G4ThreeVector(0., 0., -gapThickness/2), // its position
166                     0,  // copy number         << 176                  absorberLV,       // its logical volume                         
167                     checkOverlaps);  // checki << 177                  "Abso",           // its name
                                                   >> 178                  layerLV,          // its mother  volume
                                                   >> 179                  false,            // no boolean operation
                                                   >> 180                  0,                // copy number
                                                   >> 181                  checkOverlaps);  // checking overlaps
168                                                   182 
169   // Gap                                          183   // Gap
170                                                   184 
171   auto gapS = new G4Box("Gap",  // its name    << 185   auto gapS
172                         calorSizeXY / 2, calor << 186     = new G4Box("Gap",             // its name
173                                                << 187                  calorSizeXY/2, calorSizeXY/2, gapThickness/2); // its size
174   auto gapLV = new G4LogicalVolume(gapS,  // i << 188                          
175                                    gapMaterial << 189   auto gapLV
176                                    "Gap");  // << 190     = new G4LogicalVolume(
177                                                << 191                  gapS,             // its solid
178   new G4PVPlacement(0,  // no rotation         << 192                  gapMaterial,      // its material
179                     G4ThreeVector(0., 0., abso << 193                  "Gap");           // its name
180                     gapLV,  // its logical vol << 194                                    
181                     "Gap",  // its name        << 195   new G4PVPlacement(
182                     layerLV,  // its mother  v << 196                  0,                // no rotation
183                     false,  // no boolean oper << 197                  G4ThreeVector(0., 0., absoThickness/2), // its position
184                     0,  // copy number         << 198                  gapLV,            // its logical volume                         
185                     checkOverlaps);  // checki << 199                  "Gap",            // its name
186                                                << 200                  layerLV,          // its mother  volume
                                                   >> 201                  false,            // no boolean operation
                                                   >> 202                  0,                // copy number
                                                   >> 203                  checkOverlaps);  // checking overlaps
                                                   >> 204   
187   // Visualization attributes                     205   // Visualization attributes
188   worldLV->SetVisAttributes(G4VisAttributes::G << 206   worldLV->SetVisAttributes (G4VisAttributes::GetInvisible());
189                                                   207 
190   return worldPV;                                 208   return worldPV;
191 }                                                 209 }
192                                                   210