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 ExGflash2ParallelWorld.cc 28 /// \brief Implementation of the ExGflash2ParallelWorld class 29 30 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 31 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 32 33 // User Classes 34 #include "ExGflash2ParallelWorld.hh" 35 36 // G4 Classes 37 #include "G4AutoDelete.hh" 38 #include "G4Box.hh" 39 #include "G4Colour.hh" 40 #include "G4LogicalVolume.hh" 41 #include "G4Material.hh" 42 #include "G4NistManager.hh" 43 #include "G4PVPlacement.hh" 44 #include "G4SystemOfUnits.hh" 45 #include "G4ThreeVector.hh" 46 #include "G4VPhysicalVolume.hh" 47 #include "G4VisAttributes.hh" 48 #include "globals.hh" 49 50 // fast simulation 51 #include "GFlashHitMaker.hh" 52 #include "GFlashHomoShowerParameterisation.hh" 53 #include "GFlashParticleBounds.hh" 54 #include "GFlashShowerModel.hh" 55 56 #include "G4FastSimulationManager.hh" 57 58 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 59 60 ExGflash2ParallelWorld::ExGflash2ParallelWorld(G4String aWorldName) 61 : G4VUserParallelWorld(aWorldName) 62 { 63 G4cout << "ExGflash2ParallelWorld::Parralel world constructor" << G4endl; 64 } 65 66 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 67 68 ExGflash2ParallelWorld::~ExGflash2ParallelWorld() 69 { 70 delete fFastShowerModel; 71 delete fParameterisation; 72 delete fParticleBounds; 73 delete fHitMaker; 74 } 75 76 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 77 78 void ExGflash2ParallelWorld::Construct() 79 { 80 // In parallel world material does not matter 81 G4Material* dummy = nullptr; 82 83 // Build parallel/ghost geometry: 84 auto ghostLogicalVolume = GetWorld()->GetLogicalVolume(); 85 86 // Use part of the Ex1GflashDetectorConstruction (without individual crystals) 87 88 G4int nbOfCrystals = 10; // this are the crystals PER ROW in this example 89 // cube of 10 x 10 crystals 90 // don't change it @the moment, since 91 // the readout in event action assumes this 92 // dimensions and is not automatically adapted 93 // in this version of the example :-( 94 // Simplified `CMS-like` PbWO4 crystal calorimeter 95 G4double calo_xside = 31 * cm; 96 G4double calo_yside = 31 * cm; 97 G4double calo_zside = 24 * cm; 98 99 G4double crystalWidth = 3 * cm; 100 G4double crystalLength = 24 * cm; 101 102 calo_xside = (crystalWidth * nbOfCrystals) + 1 * cm; 103 calo_yside = (crystalWidth * nbOfCrystals) + 1 * cm; 104 calo_zside = crystalLength; 105 106 auto calo_box = new G4Box("CMS calorimeter", // its name 107 calo_xside / 2., // size 108 calo_yside / 2., calo_zside / 2.); 109 auto calo_log = new G4LogicalVolume(calo_box, // its solid 110 dummy, // its material 111 "calo log", // its name 112 nullptr, // opt: fieldManager 113 nullptr, // opt: SensitiveDetector 114 nullptr); // opt: UserLimit 115 116 G4double xpos = 0.0; 117 G4double ypos = 0.0; 118 G4double zpos = 100.0 * cm; 119 new G4PVPlacement(nullptr, G4ThreeVector(xpos, ypos, zpos), calo_log, "calorimeter", 120 ghostLogicalVolume, false, 1); 121 122 auto caloVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0)); 123 calo_log->SetVisAttributes(caloVisAtt); 124 125 // define the fParameterisation region 126 fRegion = new G4Region("crystals"); 127 calo_log->SetRegion(fRegion); 128 fRegion->AddRootLogicalVolume(calo_log); 129 } 130 131 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 132 133 void ExGflash2ParallelWorld::ConstructSD() 134 { 135 // Get nist material manager 136 G4NistManager* nistManager = G4NistManager::Instance(); 137 G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4"); 138 // -- fast simulation models: 139 // ********************************************** 140 // * Initializing shower modell 141 // *********************************************** 142 G4cout << "Creating shower parameterization models" << G4endl; 143 fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion); 144 fParameterisation = new GFlashHomoShowerParameterisation(pbWO4); 145 fFastShowerModel->SetParameterisation(*fParameterisation); 146 // Energy Cuts to kill particles: 147 fParticleBounds = new GFlashParticleBounds(); 148 fFastShowerModel->SetParticleBounds(*fParticleBounds); 149 // Makes the EnergieSpots 150 fHitMaker = new GFlashHitMaker(); 151 fFastShowerModel->SetHitMaker(*fHitMaker); 152 G4cout << "end shower parameterization." << G4endl; 153 // ********************************************** 154 } 155 156 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo...... 157