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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.0.p2)


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