Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 08:28:58

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 ExGflash2ParallelWorld.cc
0027 /// \brief Implementation of the ExGflash2ParallelWorld class
0028 
0029 // User Classes
0030 #include "ExGflash2ParallelWorld.hh"
0031 
0032 // G4 Classes
0033 #include "G4AutoDelete.hh"
0034 #include "G4Box.hh"
0035 #include "G4Colour.hh"
0036 #include "G4LogicalVolume.hh"
0037 #include "G4Material.hh"
0038 #include "G4NistManager.hh"
0039 #include "G4PVPlacement.hh"
0040 #include "G4SystemOfUnits.hh"
0041 #include "G4ThreeVector.hh"
0042 #include "G4VPhysicalVolume.hh"
0043 #include "G4VisAttributes.hh"
0044 #include "globals.hh"
0045 
0046 // fast simulation
0047 #include "GFlashHitMaker.hh"
0048 #include "GFlashHomoShowerParameterisation.hh"
0049 #include "GFlashParticleBounds.hh"
0050 #include "GFlashShowerModel.hh"
0051 
0052 #include "G4FastSimulationManager.hh"
0053 
0054 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0055 
0056 ExGflash2ParallelWorld::ExGflash2ParallelWorld(G4String aWorldName)
0057   : G4VUserParallelWorld(aWorldName)
0058 {
0059   G4cout << "ExGflash2ParallelWorld::Parralel world constructor" << G4endl;
0060 }
0061 
0062 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0063 
0064 ExGflash2ParallelWorld::~ExGflash2ParallelWorld()
0065 {
0066   delete fFastShowerModel;
0067   delete fParameterisation;
0068   delete fParticleBounds;
0069   delete fHitMaker;
0070 }
0071 
0072 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0073 
0074 void ExGflash2ParallelWorld::Construct()
0075 {
0076   // In parallel world material does not matter
0077   G4Material* dummy = nullptr;
0078 
0079   // Build parallel/ghost geometry:
0080   auto ghostLogicalVolume = GetWorld()->GetLogicalVolume();
0081 
0082   // Use part of the Ex1GflashDetectorConstruction (without individual crystals)
0083 
0084   G4int nbOfCrystals = 10;  // this are the crystals PER ROW in this example
0085                             // cube of 10 x 10 crystals
0086                             // don't change it @the moment, since
0087                             // the readout in event action assumes this
0088                             // dimensions and is not automatically adapted
0089                             // in this version of the example :-(
0090   // Simplified `CMS-like` PbWO4 crystal calorimeter
0091   G4double calo_xside = 31 * cm;
0092   G4double calo_yside = 31 * cm;
0093   G4double calo_zside = 24 * cm;
0094 
0095   G4double crystalWidth = 3 * cm;
0096   G4double crystalLength = 24 * cm;
0097 
0098   calo_xside = (crystalWidth * nbOfCrystals) + 1 * cm;
0099   calo_yside = (crystalWidth * nbOfCrystals) + 1 * cm;
0100   calo_zside = crystalLength;
0101 
0102   auto calo_box = new G4Box("CMS calorimeter",  // its name
0103                             calo_xside / 2.,  // size
0104                             calo_yside / 2., calo_zside / 2.);
0105   auto calo_log = new G4LogicalVolume(calo_box,  // its solid
0106                                       dummy,  // its material
0107                                       "calo log",  // its name
0108                                       nullptr,  // opt: fieldManager
0109                                       nullptr,  // opt: SensitiveDetector
0110                                       nullptr);  // opt: UserLimit
0111 
0112   G4double xpos = 0.0;
0113   G4double ypos = 0.0;
0114   G4double zpos = 100.0 * cm;
0115   new G4PVPlacement(nullptr, G4ThreeVector(xpos, ypos, zpos), calo_log, "calorimeter",
0116                     ghostLogicalVolume, false, 1);
0117 
0118   auto caloVisAtt = new G4VisAttributes(G4Colour(1.0, 1.0, 1.0));
0119   calo_log->SetVisAttributes(caloVisAtt);
0120 
0121   // define the fParameterisation region
0122   fRegion = new G4Region("crystals");
0123   calo_log->SetRegion(fRegion);
0124   fRegion->AddRootLogicalVolume(calo_log);
0125 }
0126 
0127 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
0128 
0129 void ExGflash2ParallelWorld::ConstructSD()
0130 {
0131   // Get nist material manager
0132   G4NistManager* nistManager = G4NistManager::Instance();
0133   G4Material* pbWO4 = nistManager->FindOrBuildMaterial("G4_PbWO4");
0134   // -- fast simulation models:
0135   // **********************************************
0136   // * Initializing shower modell
0137   // ***********************************************
0138   G4cout << "Creating shower parameterization models" << G4endl;
0139   fFastShowerModel = new GFlashShowerModel("fFastShowerModel", fRegion);
0140   fParameterisation = new GFlashHomoShowerParameterisation(pbWO4);
0141   fFastShowerModel->SetParameterisation(*fParameterisation);
0142   // Energy Cuts to kill particles:
0143   fParticleBounds = new GFlashParticleBounds();
0144   fFastShowerModel->SetParticleBounds(*fParticleBounds);
0145   // Makes the EnergieSpots
0146   fHitMaker = new GFlashHitMaker();
0147   fFastShowerModel->SetHitMaker(*fHitMaker);
0148   G4cout << "end shower parameterization." << G4endl;
0149   // **********************************************
0150 }
0151 
0152 //....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......