Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-08 08:29:39

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 /// \file ExGflash3DetectorConstruction.cc
0027 /// \brief Implementation of the ExGflash3DetectorConstruction class
0028 
0029 // Created by Joanna Weng 26.11.2004
0030 
0031 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0032 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0033 
0034 // User Classes
0035 #include "ExGflash3DetectorConstruction.hh"
0036 
0037 // G4 Classes
0038 #include "G4AutoDelete.hh"
0039 #include "G4Box.hh"
0040 #include "G4Colour.hh"
0041 #include "G4LogicalVolume.hh"
0042 #include "G4Material.hh"
0043 #include "G4NistManager.hh"
0044 #include "G4PVPlacement.hh"
0045 #include "G4SDManager.hh"
0046 #include "G4SystemOfUnits.hh"
0047 #include "G4ThreeVector.hh"
0048 #include "G4VPhysicalVolume.hh"
0049 #include "G4VisAttributes.hh"
0050 #include "globals.hh"
0051 
0052 // fast simulation
0053 #include "GFlashHitMaker.hh"
0054 #include "GFlashHomoShowerParameterisation.hh"
0055 #include "GFlashParticleBounds.hh"
0056 #include "GFlashShowerModel.hh"
0057 
0058 #include "G4FastSimulationManager.hh"
0059 
0060 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0061 
0062 ExGflash3DetectorConstruction::ExGflash3DetectorConstruction()
0063 {
0064   G4cout << "ExGflash3DetectorConstruction::Detector constructor" << G4endl;
0065 }
0066 
0067 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0068 
0069 ExGflash3DetectorConstruction::~ExGflash3DetectorConstruction()
0070 {
0071   delete fFastShowerModel;
0072   delete fParameterisation;
0073   delete fParticleBounds;
0074   delete fHitMaker;
0075 }
0076 
0077 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0078 
0079 G4VPhysicalVolume* ExGflash3DetectorConstruction::Construct()
0080 {
0081   //--------- Definitions of Solids, Logical Volumes, Physical Volumes ---------
0082   G4cout << "Defining the materials" << G4endl;
0083   // Get nist material manager
0084   G4NistManager* nistManager = G4NistManager::Instance();
0085   // Build materials
0086   G4Material* air = nistManager->FindOrBuildMaterial("G4_AIR");
0087   G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
0088 
0089   /*******************************
0090    * The Experimental Hall       *
0091    *******************************/
0092   G4double experimentalHall_x = 1000. * cm;
0093   G4double experimentalHall_y = 1000. * cm;
0094   G4double experimentalHall_z = 1000. * cm;
0095 
0096   G4VSolid* experimentalHall_box = new G4Box("expHall_box",  // World Volume
0097                                              experimentalHall_x,  // x size
0098                                              experimentalHall_y,  // y size
0099                                              experimentalHall_z);  // z size
0100 
0101   auto experimentalHallLog = new G4LogicalVolume(experimentalHall_box, air, "expHallLog",
0102                                                  nullptr,  // opt: fieldManager
0103                                                  nullptr,  // opt: SensitiveDetector
0104                                                  nullptr);  // opt: UserLimits
0105   G4VPhysicalVolume* experimentalHall_phys =
0106     new G4PVPlacement(nullptr,
0107                       G4ThreeVector(),  // at (0,0,0)
0108                       "expHall", experimentalHallLog, nullptr, false, 0);
0109 
0110   //------------------------------
0111   // Calorimeter segments
0112   //------------------------------
0113   // Simplified `CMS-like` PbWO4 crystal calorimeter
0114 
0115   G4int nbOfCrystals = 10;  // this are the crystals PER ROW in this example
0116                             // cube of 10 x 10 crystals
0117                             // don't change it @the moment, since
0118                             // the readout in event action assumes this
0119                             // dimensions and is not automatically adapted
0120                             // in this version of the example :-(
0121   // Simplified `CMS-like` PbWO4 crystal calorimeter
0122   G4double calo_xside = 31 * cm;
0123   G4double calo_yside = 31 * cm;
0124   G4double calo_zside = 24 * cm;
0125 
0126   G4double crystalWidth = 3 * cm;
0127   G4double crystalLength = 24 * cm;
0128 
0129   calo_xside = (crystalWidth * nbOfCrystals) + 1 * cm;
0130   calo_yside = (crystalWidth * nbOfCrystals) + 1 * cm;
0131   calo_zside = crystalLength;
0132 
0133   auto calo_box = new G4Box("CMS calorimeter",  // its name
0134                             calo_xside / 2.,  // size
0135                             calo_yside / 2., calo_zside / 2.);
0136   auto caloLog = new G4LogicalVolume(calo_box,  // its solid
0137                                      pbWO4,  // its material
0138                                      "calo log",  // its name
0139                                      nullptr,  // opt: fieldManager
0140                                      nullptr,  // opt: SensitiveDetector
0141                                      nullptr);  // opt: UserLimit
0142 
0143   G4double xpos = 0.0;
0144   G4double ypos = 0.0;
0145   G4double zpos = 100.0 * cm;
0146   new G4PVPlacement(nullptr, G4ThreeVector(xpos, ypos, zpos), caloLog, "calorimeter",
0147                     experimentalHallLog, false, 1);
0148 
0149   // Individual crystals are created as part of the readout geometry in the parallel world
0150 
0151   experimentalHallLog->SetVisAttributes(G4VisAttributes::GetInvisible());
0152   auto caloVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
0153   caloLog->SetVisAttributes(caloVisAtt);
0154 
0155   // define the fParameterisation region
0156   fRegion = new G4Region("crystals");
0157   caloLog->SetRegion(fRegion);
0158   fRegion->AddRootLogicalVolume(caloLog);
0159 
0160   return experimentalHall_phys;
0161 }
0162 
0163 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0164 
0165 void ExGflash3DetectorConstruction::ConstructSDandField()
0166 {
0167   // SD moved to parallel world
0168 
0169   // -- fast simulation models:
0170   // **********************************************
0171   // * Initializing shower modell
0172   // ***********************************************
0173   G4cout << "Creating shower parameterization models" << G4endl;
0174   fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
0175   fParameterisation = new GFlashHomoShowerParameterisation(fRegion->GetMaterialIterator()[0]);
0176   fFastShowerModel->SetParameterisation(*fParameterisation);
0177   // Energy Cuts to kill particles:
0178   fParticleBounds = new GFlashParticleBounds();
0179   fFastShowerModel->SetParticleBounds(*fParticleBounds);
0180   // Makes the EnergieSpots
0181   fHitMaker = new GFlashHitMaker();
0182   // Important: use SD defined in different geometry
0183   fHitMaker->SetNameOfWorldWithSD("parallelWorld");
0184   fFastShowerModel->SetHitMaker(*fHitMaker);
0185   G4cout << "end shower parameterization." << G4endl;
0186   // **********************************************
0187 }
0188 
0189 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......