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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/persistency/P02/src/ExP02DetectorConstruction.cc (Version 11.3.0) and /examples/extended/persistency/P02/src/ExP02DetectorConstruction.cc (Version 10.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 persistency/P02/src/ExP02DetectorCon     26 /// \file persistency/P02/src/ExP02DetectorConstruction.cc
 27 /// \brief Implementation of the ExP02Detector     27 /// \brief Implementation of the ExP02DetectorConstruction class
 28 //                                                 28 //
                                                   >>  29 // $Id: ExP02DetectorConstruction.cc 71727 2013-06-21 07:55:45Z gcosmo $
 29 //                                                 30 //
 30 //                                                 31 //
 31 #include "ExP02DetectorConstruction.hh"            32 #include "ExP02DetectorConstruction.hh"
 32                                                    33 
                                                   >>  34 #include "G4Material.hh"
 33 #include "G4Box.hh"                                35 #include "G4Box.hh"
                                                   >>  36 #include "G4Tubs.hh"
 34 #include "G4LogicalVolume.hh"                      37 #include "G4LogicalVolume.hh"
 35 #include "G4Material.hh"                       << 
 36 #include "G4PVPlacement.hh"                    << 
 37 #include "G4SystemOfUnits.hh"                  << 
 38 #include "G4ThreeVector.hh"                        38 #include "G4ThreeVector.hh"
 39 #include "G4Tubs.hh"                           <<  39 #include "G4PVPlacement.hh"
 40 #include "globals.hh"                              40 #include "globals.hh"
                                                   >>  41 #include "G4SystemOfUnits.hh"
 41                                                    42 
 42 // ROOT                                        <<  43 //ROOT
 43 #include "ExP02GeoTree.hh"                     << 
 44 #include "TFile.h"                             << 
 45 #include "TROOT.h"                                 44 #include "TROOT.h"
                                                   >>  45 #include "TFile.h"
 46 #include "TSystem.h"                               46 #include "TSystem.h"
                                                   >>  47 #include "Cintex/Cintex.h"
                                                   >>  48 
                                                   >>  49 #include "ExP02GeoTree.hh"
 47                                                    50 
 48 //....oooOO0OOooo........oooOO0OOooo........oo     51 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 49                                                    52 
 50 ExP02DetectorConstruction::ExP02DetectorConstr     53 ExP02DetectorConstruction::ExP02DetectorConstruction()
 51   : G4VUserDetectorConstruction(),             <<  54   :  G4VUserDetectorConstruction(),
 52     fExperimentalHall_log(0),                  <<  55     fExperimentalHall_log(0), fTracker_log(0),
 53     fTracker_log(0),                           <<  56     fCalorimeterBlock_log(0), fCalorimeterLayer_log(0),
 54     fCalorimeterBlock_log(0),                  <<  57     fExperimentalHall_phys(0), fCalorimeterLayer_phys(0),
 55     fCalorimeterLayer_log(0),                  <<  58     fCalorimeterBlock_phys(0), fTracker_phys(0)
 56     fExperimentalHall_phys(0),                 <<  59 {;}
 57     fCalorimeterLayer_phys(0),                 << 
 58     fCalorimeterBlock_phys(0),                 << 
 59     fTracker_phys(0)                           << 
 60 {                                              << 
 61   ;                                            << 
 62 }                                              << 
 63                                                    60 
 64 //....oooOO0OOooo........oooOO0OOooo........oo     61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 65                                                    62 
 66 ExP02DetectorConstruction::~ExP02DetectorConst <<  63 ExP02DetectorConstruction::~ExP02DetectorConstruction()
                                                   >>  64 {
                                                   >>  65 }
 67                                                    66 
 68 //....oooOO0OOooo........oooOO0OOooo........oo     67 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 69                                                    68 
 70 G4VPhysicalVolume* ExP02DetectorConstruction::     69 G4VPhysicalVolume* ExP02DetectorConstruction::Construct()
 71 {                                                  70 {
                                                   >>  71 
 72   //------------------------------------------     72   //------------------------------------------------------ materials
 73                                                    73 
 74   G4double a;  // atomic mass                      74   G4double a;  // atomic mass
 75   G4double z;  // atomic number                    75   G4double z;  // atomic number
 76   G4double density;                                76   G4double density;
 77                                                    77 
 78   G4Material* Ar =                             <<  78   G4Material* Ar = 
 79     new G4Material("ArgonGas", z = 18., a = 39 <<  79   new G4Material("ArgonGas", z= 18., a= 39.95*g/mole, density= 1.782*mg/cm3);
 80                                                    80 
 81   G4Material* Al =                             <<  81   G4Material* Al = 
 82     new G4Material("Aluminum", z = 13., a = 26 <<  82   new G4Material("Aluminum", z= 13., a= 26.98*g/mole, density= 2.7*g/cm3);
 83                                                    83 
 84   G4Material* Pb =                             <<  84   G4Material* Pb = 
 85     new G4Material("Lead", z = 82., a = 207.19 <<  85   new G4Material("Lead", z= 82., a= 207.19*g/mole, density= 11.35*g/cm3);
 86                                                    86 
 87   //------------------------------------------     87   //------------------------------------------------------ volumes
 88                                                    88 
 89   //------------------------------ experimenta     89   //------------------------------ experimental hall (world volume)
 90   //------------------------------ beam line a     90   //------------------------------ beam line along x axis
 91                                                    91 
 92   G4double expHall_x = 3.0 * m;                <<  92   G4double expHall_x = 3.0*m;
 93   G4double expHall_y = 1.0 * m;                <<  93   G4double expHall_y = 1.0*m;
 94   G4double expHall_z = 1.0 * m;                <<  94   G4double expHall_z = 1.0*m;
 95   G4Box* experimentalHall_box = new G4Box("exp <<  95   G4Box* experimentalHall_box
 96   fExperimentalHall_log = new G4LogicalVolume( <<  96     = new G4Box("expHall_box",expHall_x,expHall_y,expHall_z);
 97   fExperimentalHall_phys =                     <<  97   fExperimentalHall_log = new G4LogicalVolume(experimentalHall_box,
 98     new G4PVPlacement(0, G4ThreeVector(), fExp <<  98                                              Ar,"expHall_log",0,0,0);
                                                   >>  99   fExperimentalHall_phys = new G4PVPlacement(0,G4ThreeVector(),
                                                   >> 100                                       fExperimentalHall_log,"expHall",0,false,0);
 99                                                   101 
100   //------------------------------ a tracker t    102   //------------------------------ a tracker tube
101                                                   103 
102   G4double innerRadiusOfTheTube = 0. * cm;     << 104   G4double innerRadiusOfTheTube = 0.*cm;
103   G4double outerRadiusOfTheTube = 60. * cm;    << 105   G4double outerRadiusOfTheTube = 60.*cm;
104   G4double hightOfTheTube = 50. * cm;          << 106   G4double hightOfTheTube = 50.*cm;
105   G4double startAngleOfTheTube = 0. * deg;     << 107   G4double startAngleOfTheTube = 0.*deg;
106   G4double spanningAngleOfTheTube = 360. * deg << 108   G4double spanningAngleOfTheTube = 360.*deg;
107   G4Tubs* tracker_tube = new G4Tubs("tracker_t << 109   G4Tubs* tracker_tube = new G4Tubs("tracker_tube",innerRadiusOfTheTube,
108                                     hightOfThe << 110                                     outerRadiusOfTheTube,hightOfTheTube,
109   fTracker_log = new G4LogicalVolume(tracker_t << 111                                     startAngleOfTheTube,spanningAngleOfTheTube);
110   G4double trackerPos_x = -1.0 * m;            << 112   fTracker_log = new G4LogicalVolume(tracker_tube,Al,"tracker_log",0,0,0);
111   G4double trackerPos_y = 0. * m;              << 113   G4double trackerPos_x = -1.0*m;
112   G4double trackerPos_z = 0. * m;              << 114   G4double trackerPos_y = 0.*m;
113   fTracker_phys = new G4PVPlacement(0, G4Three << 115   G4double trackerPos_z = 0.*m;
114                                     fTracker_l << 116   fTracker_phys = new G4PVPlacement(0,
                                                   >> 117              G4ThreeVector(trackerPos_x,trackerPos_y,trackerPos_z),
                                                   >> 118              fTracker_log,"tracker",fExperimentalHall_log,false,0);
115                                                   119 
116   //------------------------------ a calorimet    120   //------------------------------ a calorimeter block
117                                                   121 
118   G4double block_x = 1.0 * m;                  << 122   G4double block_x = 1.0*m;
119   G4double block_y = 50.0 * cm;                << 123   G4double block_y = 50.0*cm;
120   G4double block_z = 50.0 * cm;                << 124   G4double block_z = 50.0*cm;
121   G4Box* calorimeterBlock_box = new G4Box("cal << 125   G4Box* calorimeterBlock_box = new G4Box("calBlock_box",block_x,
122   fCalorimeterBlock_log = new G4LogicalVolume( << 126                                           block_y,block_z);
123   G4double blockPos_x = 1.0 * m;               << 127   fCalorimeterBlock_log = new G4LogicalVolume(calorimeterBlock_box,
124   G4double blockPos_y = 0.0 * m;               << 128                                              Pb,"caloBlock_log",0,0,0);
125   G4double blockPos_z = 0.0 * m;               << 129   G4double blockPos_x = 1.0*m;
126   fCalorimeterBlock_phys =                     << 130   G4double blockPos_y = 0.0*m;
127     new G4PVPlacement(0, G4ThreeVector(blockPo << 131   G4double blockPos_z = 0.0*m;
128                       "caloBlock", fExperiment << 132   fCalorimeterBlock_phys = new G4PVPlacement(0,
                                                   >> 133              G4ThreeVector(blockPos_x,blockPos_y,blockPos_z),
                                                   >> 134              fCalorimeterBlock_log,"caloBlock",fExperimentalHall_log,false,0);
129                                                   135 
130   //------------------------------ calorimeter    136   //------------------------------ calorimeter layers
131                                                   137 
132   G4double calo_x = 1. * cm;                   << 138   G4double calo_x = 1.*cm;
133   G4double calo_y = 40. * cm;                  << 139   G4double calo_y = 40.*cm;
134   G4double calo_z = 40. * cm;                  << 140   G4double calo_z = 40.*cm;
135   G4Box* calorimeterLayer_box = new G4Box("cal << 141   G4Box* calorimeterLayer_box = new G4Box("caloLayer_box",
136   fCalorimeterLayer_log = new G4LogicalVolume( << 142                                           calo_x,calo_y,calo_z);
137   for (G4int i = 0; i < 19; i++)  // loop for  << 143   fCalorimeterLayer_log = new G4LogicalVolume(calorimeterLayer_box,
                                                   >> 144                                              Al,"caloLayer_log",0,0,0);
                                                   >> 145   for(G4int i=0;i<19;i++) // loop for 19 layers
138   {                                               146   {
139     G4double caloPos_x = (i - 9) * 10. * cm;   << 147     G4double caloPos_x = (i-9)*10.*cm;
140     G4double caloPos_y = 0.0 * m;              << 148     G4double caloPos_y = 0.0*m;
141     G4double caloPos_z = 0.0 * m;              << 149     G4double caloPos_z = 0.0*m;
142     fCalorimeterLayer_phys =                   << 150     fCalorimeterLayer_phys = new G4PVPlacement(0,
143       new G4PVPlacement(0, G4ThreeVector(caloP << 151                G4ThreeVector(caloPos_x,caloPos_y,caloPos_z),
144                         "caloLayer", fCalorime << 152                fCalorimeterLayer_log,"caloLayer",fCalorimeterBlock_log,false,i);
145   }                                               153   }
146                                                   154 
147   //------------------------------------------    155   //------------------------------------------------------------------
148                                                   156 
149   // writing the geometry to a ROOT file          157   // writing the geometry to a ROOT file
150                                                   158 
151   // initialize ROOT                              159   // initialize ROOT
152   TSystem ts;                                     160   TSystem ts;
153                                                   161 
154   gSystem->Load("libExP02ClassesDict");           162   gSystem->Load("libExP02ClassesDict");
155                                                << 163   
                                                   >> 164   //  ROOT::Cintex::Cintex::SetDebug(2);
                                                   >> 165   ROOT::Cintex::Cintex::Enable();
156   //  gDebug = 1;                                 166   //  gDebug = 1;
157                                                   167 
158   const G4ElementTable* eltab = G4Element::Get    168   const G4ElementTable* eltab = G4Element::GetElementTable();
                                                   >> 169   const G4MaterialTable* mattab = G4Material::GetMaterialTable();
159                                                   170 
160   ExP02GeoTree* geotree = new ExP02GeoTree(fEx << 171   ExP02GeoTree* geotree = new ExP02GeoTree(fExperimentalHall_phys, eltab, mattab);
161                                                   172 
162   TFile fo("geo.root", "RECREATE");            << 173   TFile fo("geo.root","RECREATE");
163                                                   174 
164   fo.WriteObject(geotree, "my_geo");              175   fo.WriteObject(geotree, "my_geo");
165                                                << 176   
166   return fExperimentalHall_phys;                  177   return fExperimentalHall_phys;
167 }                                                 178 }
                                                   >> 179 
168                                                   180