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