Geant4 Cross Reference |
1 // 2 // ******************************************************************** 3 // * License and Disclaimer * 4 // * * 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. * 10 // * * 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitation of liability. * 17 // * * 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************************************** 25 // 26 // 27 /// \file ExGflash3DetectorConstruction.cc 28 /// \brief Implementation of the ExGflash3DetectorConstruction class 29 // 30 // Created by Joanna Weng 26.11.2004 31 32 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 33 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 34 35 // User Classes 36 #include "ExGflash3DetectorConstruction.hh" 37 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" 45 #include "G4PVPlacement.hh" 46 #include "G4SDManager.hh" 47 #include "G4SystemOfUnits.hh" 48 #include "G4ThreeVector.hh" 49 #include "G4VPhysicalVolume.hh" 50 #include "G4VisAttributes.hh" 51 #include "globals.hh" 52 53 // fast simulation 54 #include "GFlashHitMaker.hh" 55 #include "GFlashHomoShowerParameterisation.hh" 56 #include "GFlashParticleBounds.hh" 57 #include "GFlashShowerModel.hh" 58 59 #include "G4FastSimulationManager.hh" 60 61 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 62 63 ExGflash3DetectorConstruction::ExGflash3DetectorConstruction() 64 { 65 G4cout << "ExGflash3DetectorConstruction::Detector constructor" << G4endl; 66 } 67 68 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 69 70 ExGflash3DetectorConstruction::~ExGflash3DetectorConstruction() 71 { 72 delete fFastShowerModel; 73 delete fParameterisation; 74 delete fParticleBounds; 75 delete fHitMaker; 76 } 77 78 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 79 80 G4VPhysicalVolume* ExGflash3DetectorConstruction::Construct() 81 { 82 //--------- Definitions of Solids, Logical Volumes, Physical Volumes --------- 83 G4cout << "Defining the materials" << G4endl; 84 // Get nist material manager 85 G4NistManager* nistManager = G4NistManager::Instance(); 86 // Build materials 87 G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR"); 88 G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4"); 89 90 /******************************* 91 * The Experimental Hall * 92 *******************************/ 93 G4double experimentalHall_x = 1000. * cm; 94 G4double experimentalHall_y = 1000. * cm; 95 G4double experimentalHall_z = 1000. * cm; 96 97 G4VSolid* experimentalHall_box = new G4Box("expHall_box", // World Volume 98 experimentalHall_x, // x size 99 experimentalHall_y, // y size 100 experimentalHall_z); // z size 101 102 auto experimentalHallLog = new G4LogicalVolume(experimentalHall_box, air, "expHallLog", 103 nullptr, // opt: fieldManager 104 nullptr, // opt: SensitiveDetector 105 nullptr); // opt: UserLimits 106 G4VPhysicalVolume* experimentalHall_phys = 107 new G4PVPlacement(nullptr, 108 G4ThreeVector(), // at (0,0,0) 109 "expHall", experimentalHallLog, nullptr, false, 0); 110 111 //------------------------------ 112 // Calorimeter segments 113 //------------------------------ 114 // Simplified `CMS-like` PbWO4 crystal calorimeter 115 116 G4int nbOfCrystals = 10; // this are the crystals PER ROW in this example 117 // cube of 10 x 10 crystals 118 // don't change it @the moment, since 119 // the readout in event action assumes this 120 // dimensions and is not automatically adapted 121 // in this version of the example :-( 122 // Simplified `CMS-like` PbWO4 crystal calorimeter 123 G4double calo_xside = 31 * cm; 124 G4double calo_yside = 31 * cm; 125 G4double calo_zside = 24 * cm; 126 127 G4double crystalWidth = 3 * cm; 128 G4double crystalLength = 24 * cm; 129 130 calo_xside = (crystalWidth * nbOfCrystals) + 1 * cm; 131 calo_yside = (crystalWidth * nbOfCrystals) + 1 * cm; 132 calo_zside = crystalLength; 133 134 auto calo_box = new G4Box("CMS calorimeter", // its name 135 calo_xside / 2., // size 136 calo_yside / 2., calo_zside / 2.); 137 auto caloLog = new G4LogicalVolume(calo_box, // its solid 138 pbWO4, // its material 139 "calo log", // its name 140 nullptr, // opt: fieldManager 141 nullptr, // opt: SensitiveDetector 142 nullptr); // opt: UserLimit 143 144 G4double xpos = 0.0; 145 G4double ypos = 0.0; 146 G4double zpos = 100.0 * cm; 147 new G4PVPlacement(nullptr, G4ThreeVector(xpos, ypos, zpos), caloLog, "calorimeter", 148 experimentalHallLog, false, 1); 149 150 // Individual crystals are created as part of the readout geometry in the parallel world 151 152 experimentalHallLog->SetVisAttributes(G4VisAttributes::GetInvisible()); 153 auto caloVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0)); 154 caloLog->SetVisAttributes(caloVisAtt); 155 156 // define the fParameterisation region 157 fRegion = new G4Region("crystals"); 158 caloLog->SetRegion(fRegion); 159 fRegion->AddRootLogicalVolume(caloLog); 160 161 return experimentalHall_phys; 162 } 163 164 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 165 166 void ExGflash3DetectorConstruction::ConstructSDandField() 167 { 168 // SD moved to parallel world 169 170 // -- fast simulation models: 171 // ********************************************** 172 // * Initializing shower modell 173 // *********************************************** 174 G4cout << "Creating shower parameterization models" << G4endl; 175 fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion); 176 fParameterisation = new GFlashHomoShowerParameterisation(fRegion->GetMaterialIterator()[0]); 177 fFastShowerModel->SetParameterisation(*fParameterisation); 178 // Energy Cuts to kill particles: 179 fParticleBounds = new GFlashParticleBounds(); 180 fFastShowerModel->SetParticleBounds(*fParticleBounds); 181 // Makes the EnergieSpots 182 fHitMaker = new GFlashHitMaker(); 183 // Important: use SD defined in different geometry 184 fHitMaker->SetNameOfWorldWithSD("parallelWorld"); 185 fFastShowerModel->SetHitMaker(*fHitMaker); 186 G4cout << "end shower parameterization." << G4endl; 187 // ********************************************** 188 } 189 190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 191