Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-02-23 09:22:31

0001 //
0002 // ********************************************************************
0003 // * License and Disclaimer                                           *
0004 // *                                                                  *
0005 // * The  Geant4 software  is  copyright of the Copyright Holders  of *
0006 // * the Geant4 Collaboration.  It is provided  under  the terms  and *
0007 // * conditions of the Geant4 Software License,  included in the file *
0008 // * LICENSE and available at  http://cern.ch/geant4/license .  These *
0009 // * include a list of copyright holders.                             *
0010 // *                                                                  *
0011 // * Neither the authors of this software system, nor their employing *
0012 // * institutes,nor the agencies providing financial support for this *
0013 // * work  make  any representation or  warranty, express or implied, *
0014 // * regarding  this  software system or assume any liability for its *
0015 // * use.  Please see the license in the file  LICENSE  and URL above *
0016 // * for the full disclaimer and the limitation of liability.         *
0017 // *                                                                  *
0018 // * This  code  implementation is the result of  the  scientific and *
0019 // * technical work of the GEANT4 collaboration.                      *
0020 // * By using,  copying,  modifying or  distributing the software (or *
0021 // * any work based  on the software)  you  agree  to acknowledge its *
0022 // * use  in  resulting  scientific  publications,  and indicate your *
0023 // * acceptance of all terms of the Geant4 Software license.          *
0024 // ********************************************************************
0025 //
0026 //
0027 /// \file ExGflash3DetectorConstruction.cc
0028 /// \brief Implementation of the ExGflash3DetectorConstruction class
0029 //
0030 // Created by Joanna Weng 26.11.2004
0031 
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0034 
0035 // User Classes
0036 #include "ExGflash3DetectorConstruction.hh"
0037 
0038 // G4 Classes
0039 #include "G4AutoDelete.hh"
0040 #include "G4Box.hh"
0041 #include "G4Colour.hh"
0042 #include "G4LogicalVolume.hh"
0043 #include "G4Material.hh"
0044 #include "G4NistManager.hh"
0045 #include "G4PVPlacement.hh"
0046 #include "G4SDManager.hh"
0047 #include "G4SystemOfUnits.hh"
0048 #include "G4ThreeVector.hh"
0049 #include "G4VPhysicalVolume.hh"
0050 #include "G4VisAttributes.hh"
0051 #include "globals.hh"
0052 
0053 // fast simulation
0054 #include "GFlashHitMaker.hh"
0055 #include "GFlashHomoShowerParameterisation.hh"
0056 #include "GFlashParticleBounds.hh"
0057 #include "GFlashShowerModel.hh"
0058 
0059 #include "G4FastSimulationManager.hh"
0060 
0061 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0062 
0063 ExGflash3DetectorConstruction::ExGflash3DetectorConstruction()
0064 {
0065   G4cout << "ExGflash3DetectorConstruction::Detector constructor" << G4endl;
0066 }
0067 
0068 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0069 
0070 ExGflash3DetectorConstruction::~ExGflash3DetectorConstruction()
0071 {
0072   delete fFastShowerModel;
0073   delete fParameterisation;
0074   delete fParticleBounds;
0075   delete fHitMaker;
0076 }
0077 
0078 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0079 
0080 G4VPhysicalVolume* ExGflash3DetectorConstruction::Construct()
0081 {
0082   //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
0083   G4cout << "Defining the materials" << G4endl;
0084   // Get nist material manager
0085   G4NistManager* nistManager = G4NistManager::Instance();
0086   // Build materials
0087   G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
0088   G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
0089 
0090   /*******************************
0091    * The Experimental Hall       *
0092    *******************************/
0093   G4double experimentalHall_x = 1000. * cm;
0094   G4double experimentalHall_y = 1000. * cm;
0095   G4double experimentalHall_z = 1000. * cm;
0096 
0097   G4VSolid* experimentalHall_box = new G4Box("expHall_box",  // World Volume
0098                                              experimentalHall_x,  // x size
0099                                              experimentalHall_y,  // y size
0100                                              experimentalHall_z);  // z size
0101 
0102   auto experimentalHallLog = new G4LogicalVolume(experimentalHall_box, air, "expHallLog",
0103                                                  nullptr,  // opt: fieldManager
0104                                                  nullptr,  // opt: SensitiveDetector
0105                                                  nullptr);  // opt: UserLimits
0106   G4VPhysicalVolume* experimentalHall_phys =
0107     new G4PVPlacement(nullptr,
0108                       G4ThreeVector(),  // at (0,0,0)
0109                       "expHall", experimentalHallLog, nullptr, false, 0);
0110 
0111   //------------------------------
0112   // Calorimeter segments
0113   //------------------------------
0114   // Simplified `CMS-like` PbWO4 crystal calorimeter
0115 
0116   G4int nbOfCrystals = 10;  // this are the crystals PER ROW in this example
0117                             // cube of 10 x 10 crystals
0118                             // don't change it @the moment, since
0119                             // the readout in event action assumes this
0120                             // dimensions and is not automatically adapted
0121                             // in this version of the example :-(
0122   // Simplified `CMS-like` PbWO4 crystal calorimeter
0123   G4double calo_xside = 31 * cm;
0124   G4double calo_yside = 31 * cm;
0125   G4double calo_zside = 24 * cm;
0126 
0127   G4double crystalWidth = 3 * cm;
0128   G4double crystalLength = 24 * cm;
0129 
0130   calo_xside = (crystalWidth * nbOfCrystals) + 1 * cm;
0131   calo_yside = (crystalWidth * nbOfCrystals) + 1 * cm;
0132   calo_zside = crystalLength;
0133 
0134   auto calo_box = new G4Box("CMS calorimeter",  // its name
0135                             calo_xside / 2.,  // size
0136                             calo_yside / 2., calo_zside / 2.);
0137   auto caloLog = new G4LogicalVolume(calo_box,  // its solid
0138                                      pbWO4,  // its material
0139                                      "calo log",  // its name
0140                                      nullptr,  // opt: fieldManager
0141                                      nullptr,  // opt: SensitiveDetector
0142                                      nullptr);  // opt: UserLimit
0143 
0144   G4double xpos = 0.0;
0145   G4double ypos = 0.0;
0146   G4double zpos = 100.0 * cm;
0147   new G4PVPlacement(nullptr, G4ThreeVector(xpos, ypos, zpos), caloLog, "calorimeter",
0148                     experimentalHallLog, false, 1);
0149 
0150   // Individual crystals are created as part of the readout geometry in the parallel world
0151 
0152   experimentalHallLog->SetVisAttributes(G4VisAttributes::GetInvisible());
0153   auto caloVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
0154   caloLog->SetVisAttributes(caloVisAtt);
0155 
0156   // define the fParameterisation region
0157   fRegion = new G4Region("crystals");
0158   caloLog->SetRegion(fRegion);
0159   fRegion->AddRootLogicalVolume(caloLog);
0160 
0161   return experimentalHall_phys;
0162 }
0163 
0164 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0165 
0166 void ExGflash3DetectorConstruction::ConstructSDandField()
0167 {
0168   // SD moved to parallel world
0169 
0170   // -- fast simulation models:
0171   // **********************************************
0172   // * Initializing shower modell
0173   // ***********************************************
0174   G4cout << "Creating shower parameterization models" << G4endl;
0175   fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
0176   fParameterisation = new GFlashHomoShowerParameterisation(fRegion->GetMaterialIterator()[0]);
0177   fFastShowerModel->SetParameterisation(*fParameterisation);
0178   // Energy Cuts to kill particles:
0179   fParticleBounds = new GFlashParticleBounds();
0180   fFastShowerModel->SetParticleBounds(*fParticleBounds);
0181   // Makes the EnergieSpots
0182   fHitMaker = new GFlashHitMaker();
0183   // Important: use SD defined in different geometry
0184   fHitMaker->SetNameOfWorldWithSD("parallelWorld");
0185   fFastShowerModel->SetHitMaker(*fHitMaker);
0186   G4cout << "end shower parameterization." << G4endl;
0187   // **********************************************
0188 }
0189 
0190 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......