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 10.4.p3 ] [ 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/parameterisations/gflash/gflash3/src/ExGflash3DetectorConstruction.cc (Version 11.3.0) and /examples/extended/parameterisations/gflash/gflash3/src/ExGflash3DetectorConstruction.cc (Version 11.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 //                                                 26 //
 27 /// \file ExGflash3DetectorConstruction.cc         27 /// \file ExGflash3DetectorConstruction.cc
 28 /// \brief Implementation of the ExGflash3Dete     28 /// \brief Implementation of the ExGflash3DetectorConstruction class
 29 //                                                 29 //
 30 // Created by Joanna Weng 26.11.2004               30 // Created by Joanna Weng 26.11.2004
 31                                                    31 
 32 //....oooOO0OOooo........oooOO0OOooo........oo     32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 33 //....oooOO0OOooo........oooOO0OOooo........oo     33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 34                                                    34 
 35 // User Classes                                    35 // User Classes
 36 #include "ExGflash3DetectorConstruction.hh"        36 #include "ExGflash3DetectorConstruction.hh"
 37                                                    37 
 38 // G4 Classes                                      38 // G4 Classes
 39 #include "G4AutoDelete.hh"                     << 
 40 #include "G4Box.hh"                            << 
 41 #include "G4Colour.hh"                         << 
 42 #include "G4LogicalVolume.hh"                  << 
 43 #include "G4Material.hh"                       << 
 44 #include "G4NistManager.hh"                        39 #include "G4NistManager.hh"
 45 #include "G4PVPlacement.hh"                    <<  40 #include "G4Material.hh"
 46 #include "G4SDManager.hh"                      << 
 47 #include "G4SystemOfUnits.hh"                  << 
 48 #include "G4ThreeVector.hh"                        41 #include "G4ThreeVector.hh"
                                                   >>  42 #include "G4PVPlacement.hh"
 49 #include "G4VPhysicalVolume.hh"                    43 #include "G4VPhysicalVolume.hh"
                                                   >>  44 #include "G4LogicalVolume.hh"
                                                   >>  45 #include "G4Box.hh"
                                                   >>  46 #include "G4SDManager.hh"
 50 #include "G4VisAttributes.hh"                      47 #include "G4VisAttributes.hh"
                                                   >>  48 #include "G4Colour.hh"
                                                   >>  49 #include "G4SystemOfUnits.hh"
                                                   >>  50 #include "G4AutoDelete.hh"
 51 #include "globals.hh"                              51 #include "globals.hh"
 52                                                    52 
 53 // fast simulation                             <<  53 //fast simulation
 54 #include "GFlashHitMaker.hh"                   << 
 55 #include "GFlashHomoShowerParameterisation.hh"     54 #include "GFlashHomoShowerParameterisation.hh"
 56 #include "GFlashParticleBounds.hh"             <<  55 #include "G4FastSimulationManager.hh"
 57 #include "GFlashShowerModel.hh"                    56 #include "GFlashShowerModel.hh"
                                                   >>  57 #include "GFlashHitMaker.hh"
                                                   >>  58 #include "GFlashParticleBounds.hh"
 58                                                    59 
 59 #include "G4FastSimulationManager.hh"          <<  60 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
                                                   >>  61 
                                                   >>  62 G4ThreadLocal GFlashShowerModel* ExGflash3DetectorConstruction::fFastShowerModel = 0; 
                                                   >>  63 G4ThreadLocal 
                                                   >>  64 GFlashHomoShowerParameterisation* ExGflash3DetectorConstruction::fParameterisation = 0;
                                                   >>  65 G4ThreadLocal GFlashParticleBounds* ExGflash3DetectorConstruction::fParticleBounds = 0;
                                                   >>  66 G4ThreadLocal GFlashHitMaker* ExGflash3DetectorConstruction::fHitMaker = 0;
 60                                                    67 
 61 //....oooOO0OOooo........oooOO0OOooo........oo     68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 62                                                    69 
 63 ExGflash3DetectorConstruction::ExGflash3Detect     70 ExGflash3DetectorConstruction::ExGflash3DetectorConstruction()
                                                   >>  71   :G4VUserDetectorConstruction(), fRegion(nullptr)
 64 {                                                  72 {
 65   G4cout << "ExGflash3DetectorConstruction::De <<  73   G4cout<<"ExGflash3DetectorConstruction::Detector constructor"<<G4endl;
 66 }                                                  74 }
 67                                                    75 
 68 //....oooOO0OOooo........oooOO0OOooo........oo     76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 69                                                    77 
 70 ExGflash3DetectorConstruction::~ExGflash3Detec     78 ExGflash3DetectorConstruction::~ExGflash3DetectorConstruction()
 71 {                                                  79 {
 72   delete fFastShowerModel;                     <<  80   delete fFastShowerModel; 
 73   delete fParameterisation;                        81   delete fParameterisation;
 74   delete fParticleBounds;                          82   delete fParticleBounds;
 75   delete fHitMaker;                                83   delete fHitMaker;
 76 }                                                  84 }
 77                                                    85 
 78 //....oooOO0OOooo........oooOO0OOooo........oo     86 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
 79                                                    87 
 80 G4VPhysicalVolume* ExGflash3DetectorConstructi     88 G4VPhysicalVolume* ExGflash3DetectorConstruction::Construct()
 81 {                                                  89 {
 82   //--------- Definitions of Solids, Logical V     90   //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
 83   G4cout << "Defining the materials" << G4endl     91   G4cout << "Defining the materials" << G4endl;
 84   // Get nist material manager                     92   // Get nist material manager
 85   G4NistManager* nistManager = G4NistManager::     93   G4NistManager* nistManager = G4NistManager::Instance();
 86   // Build materials                               94   // Build materials
 87   G4Material* air = nistManager->FindOrBuildMa <<  95   G4Material* air   = nistManager->FindOrBuildMaterial("G4_AIR");
 88   G4Material* pbWO4 = nistManager->FindOrBuild     96   G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
 89                                                <<  97   
 90   /*******************************                 98   /*******************************
 91    * The Experimental Hall       *                 99    * The Experimental Hall       *
 92    *******************************/               100    *******************************/
 93   G4double experimentalHall_x = 1000. * cm;    << 101   G4double experimentalHall_x=1000.*cm;
 94   G4double experimentalHall_y = 1000. * cm;    << 102   G4double experimentalHall_y=1000.*cm;
 95   G4double experimentalHall_z = 1000. * cm;    << 103   G4double experimentalHall_z=1000.*cm;
 96                                                << 104   
 97   G4VSolid* experimentalHall_box = new G4Box(" << 105   G4VSolid* experimentalHall_box 
 98                                              e << 106     = new G4Box("expHall_box",             // World Volume
 99                                              e << 107                 experimentalHall_x,        // x size
100                                              e << 108                 experimentalHall_y,        // y size
101                                                << 109                 experimentalHall_z);       // z size
102   auto experimentalHallLog = new G4LogicalVolu << 110   
103                                                << 111   G4LogicalVolume* experimentalHallLog 
104                                                << 112     = new G4LogicalVolume(experimentalHall_box,
105                                                << 113                           air,
106   G4VPhysicalVolume* experimentalHall_phys =   << 114                           "expHallLog",
107     new G4PVPlacement(nullptr,                 << 115                           0,               //opt: fieldManager
108                       G4ThreeVector(),  // at  << 116                           0,               //opt: SensitiveDetector
109                       "expHall", experimentalH << 117                           0);              //opt: UserLimits
110                                                << 118   G4VPhysicalVolume* experimentalHall_phys 
111   //------------------------------             << 119     = new G4PVPlacement(0,
                                                   >> 120                         G4ThreeVector(),   //at (0,0,0)
                                                   >> 121                         "expHall",
                                                   >> 122                         experimentalHallLog,
                                                   >> 123                         0,
                                                   >> 124                         false,
                                                   >> 125                         0);
                                                   >> 126   
                                                   >> 127   
                                                   >> 128   //------------------------------ 
112   // Calorimeter segments                         129   // Calorimeter segments
113   //------------------------------                130   //------------------------------
114   // Simplified `CMS-like` PbWO4 crystal calor << 131   // Simplified `CMS-like` PbWO4 crystal calorimeter  
115                                                << 132   
116   G4int nbOfCrystals = 10;  // this are the cr << 133   G4int nbOfCrystals = 10;  // this are the crystals PER ROW in this example 
117                             // cube of 10 x 10 << 134                        // cube of 10 x 10 crystals 
118                             // don't change it << 135                        // don't change it @the moment, since 
119                             // the readout in  << 136                        // the readout in event action assumes this 
120                             // dimensions and  << 137                        // dimensions and is not automatically adapted
121                             // in this version << 138                        // in this version of the example :-( 
122   // Simplified `CMS-like` PbWO4 crystal calor << 139   // Simplified `CMS-like` PbWO4 crystal calorimeter  
123   G4double calo_xside = 31 * cm;               << 140   G4double calo_xside = 31*cm;
124   G4double calo_yside = 31 * cm;               << 141   G4double calo_yside = 31*cm;
125   G4double calo_zside = 24 * cm;               << 142   G4double calo_zside = 24*cm; 
126                                                   143 
127   G4double crystalWidth = 3 * cm;              << 144   G4double crystalWidth = 3*cm;
128   G4double crystalLength = 24 * cm;            << 145   G4double crystalLength = 24*cm;
129                                                   146 
130   calo_xside = (crystalWidth * nbOfCrystals) + << 147   calo_xside = (crystalWidth*nbOfCrystals)+1*cm;
131   calo_yside = (crystalWidth * nbOfCrystals) + << 148   calo_yside = (crystalWidth*nbOfCrystals)+1*cm;
132   calo_zside = crystalLength;                     149   calo_zside = crystalLength;
133                                                << 150   
134   auto calo_box = new G4Box("CMS calorimeter", << 151   G4Box* calo_box= new G4Box("CMS calorimeter",  // its name
135                             calo_xside / 2.,   << 152                              calo_xside/2.,      // size
136                             calo_yside / 2., c << 153                              calo_yside/2.,
137   auto caloLog = new G4LogicalVolume(calo_box, << 154                              calo_zside/2.);
138                                      pbWO4,  / << 155   G4LogicalVolume* caloLog 
139                                      "calo log << 156     = new G4LogicalVolume(calo_box,      // its solid
140                                      nullptr,  << 157                           pbWO4,           // its material
141                                      nullptr,  << 158                           "calo log",    // its name
142                                      nullptr); << 159                           0,             // opt: fieldManager
143                                                << 160                           0,             // opt: SensitiveDetector 
                                                   >> 161                           0);            // opt: UserLimit
                                                   >> 162   
144   G4double xpos = 0.0;                            163   G4double xpos = 0.0;
145   G4double ypos = 0.0;                            164   G4double ypos = 0.0;
146   G4double zpos = 100.0 * cm;                  << 165   G4double zpos = 100.0*cm;
147   new G4PVPlacement(nullptr, G4ThreeVector(xpo << 166   new G4PVPlacement(0,
148                     experimentalHallLog, false << 167                     G4ThreeVector(xpos, ypos, zpos),
                                                   >> 168                     caloLog,
                                                   >> 169                     "calorimeter",
                                                   >> 170                     experimentalHallLog,
                                                   >> 171                     false,
                                                   >> 172                     1);
149                                                   173 
150   // Individual crystals are created as part o    174   // Individual crystals are created as part of the readout geometry in the parallel world
151                                                << 175   
152   experimentalHallLog->SetVisAttributes(G4VisA    176   experimentalHallLog->SetVisAttributes(G4VisAttributes::GetInvisible());
153   auto caloVisAtt = new G4VisAttributes(G4Colo << 177   G4VisAttributes* caloVisAtt = new G4VisAttributes(G4Colour(1.0,1.0,1.0));
154   caloLog->SetVisAttributes(caloVisAtt);          178   caloLog->SetVisAttributes(caloVisAtt);
155                                                   179 
156   // define the fParameterisation region          180   // define the fParameterisation region
157   fRegion = new G4Region("crystals");             181   fRegion = new G4Region("crystals");
158   caloLog->SetRegion(fRegion);                    182   caloLog->SetRegion(fRegion);
159   fRegion->AddRootLogicalVolume(caloLog);         183   fRegion->AddRootLogicalVolume(caloLog);
160                                                << 184   
161   return experimentalHall_phys;                   185   return experimentalHall_phys;
162 }                                                 186 }
163                                                   187 
164 //....oooOO0OOooo........oooOO0OOooo........oo    188 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
165                                                   189 
166 void ExGflash3DetectorConstruction::ConstructS    190 void ExGflash3DetectorConstruction::ConstructSDandField()
167 {                                                 191 {
168   // SD moved to parallel world                   192   // SD moved to parallel world
169                                                   193 
170   // -- fast simulation models:                   194   // -- fast simulation models:
171   // *****************************************    195   // **********************************************
172   // * Initializing shower modell                 196   // * Initializing shower modell
173   // *****************************************    197   // ***********************************************
174   G4cout << "Creating shower parameterization     198   G4cout << "Creating shower parameterization models" << G4endl;
175   fFastShowerModel = new GFlashShowerModel("fF    199   fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
176   fParameterisation = new GFlashHomoShowerPara    200   fParameterisation = new GFlashHomoShowerParameterisation(fRegion->GetMaterialIterator()[0]);
177   fFastShowerModel->SetParameterisation(*fPara    201   fFastShowerModel->SetParameterisation(*fParameterisation);
178   // Energy Cuts to kill particles:               202   // Energy Cuts to kill particles:
179   fParticleBounds = new GFlashParticleBounds()    203   fParticleBounds = new GFlashParticleBounds();
180   fFastShowerModel->SetParticleBounds(*fPartic    204   fFastShowerModel->SetParticleBounds(*fParticleBounds);
181   // Makes the EnergieSpots                       205   // Makes the EnergieSpots
182   fHitMaker = new GFlashHitMaker();               206   fHitMaker = new GFlashHitMaker();
183   // Important: use SD defined in different ge    207   // Important: use SD defined in different geometry
184   fHitMaker->SetNameOfWorldWithSD("parallelWor    208   fHitMaker->SetNameOfWorldWithSD("parallelWorld");
185   fFastShowerModel->SetHitMaker(*fHitMaker);      209   fFastShowerModel->SetHitMaker(*fHitMaker);
186   G4cout << "end shower parameterization." <<  << 210   G4cout<<"end shower parameterization."<<G4endl;
187   // *****************************************    211   // **********************************************
188 }                                                 212 }
189                                                   213 
190 //....oooOO0OOooo........oooOO0OOooo........oo    214 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
191                                                   215