Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-04-10 08:07:12

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